gtkwindow: Add private API to mark as subsurface

This is a rather hackish way to let GTK+ widgets declare popup windows
as subsurfaces, so they may work on wayland without the need of xdg_popup,
and without many changes yet on the GTK+ side.

https://bugzilla.gnome.org/show_bug.cgi?id=695504
This commit is contained in:
Carlos Garnacho 2014-08-21 17:34:09 +02:00
parent 6574d99adf
commit c38651cac4
2 changed files with 23 additions and 0 deletions

View File

@ -229,6 +229,8 @@ struct _GtkWindowPrivate
guint drag_possible : 1;
guint use_subsurface : 1;
GtkGesture *multipress_gesture;
};
@ -6337,6 +6339,12 @@ gtk_window_realize (GtkWidget *widget)
break;
}
#ifdef GDK_WINDOWING_WAYLAND
if (priv->use_subsurface &&
GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
attributes.window_type = GDK_WINDOW_SUBSURFACE;
#endif
attributes.title = priv->title;
attributes.wmclass_name = priv->wmclass_name;
attributes.wmclass_class = priv->wmclass_class;
@ -11697,3 +11705,15 @@ gtk_window_enable_debugging (GtkWindow *window,
else
gtk_window_set_debugging (TRUE, TRUE, warn);
}
void
gtk_window_set_use_subsurface (GtkWindow *window,
gboolean use_subsurface)
{
GtkWindowPrivate *priv = window->priv;
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
priv->use_subsurface = use_subsurface;
}

View File

@ -119,6 +119,9 @@ void _gtk_window_get_popover_position (GtkWindow *window,
GdkPixbuf *gtk_window_get_icon_for_size (GtkWindow *window,
gint size);
void gtk_window_set_use_subsurface (GtkWindow *window,
gboolean use_subsurface);
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */