From bda2f4f5825b8ac3a954cee1e0ed830993a48b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 21 Jun 2017 13:25:41 +0200 Subject: [PATCH] popover: Create subsurface on wayland --- gtk/gtkpopover.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 2ae6f7a1f1..05cbacb346 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -378,11 +378,30 @@ gtk_popover_realize (GtkWidget *widget) GtkAllocation allocation; GdkWindow *window; - gtk_widget_get_allocation (widget, &allocation); + gtk_widget_get_window_allocation (widget, &allocation); + +#ifdef GDK_WINDOWING_WAYLAND + if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget))) + { + GtkWidget *toplevel = gtk_widget_get_toplevel (widget); + + g_assert (GTK_IS_WINDOW (toplevel)); + + window = gdk_wayland_window_new_subsurface (gtk_widget_get_display (toplevel), + GDK_ALL_EVENTS_MASK, + &allocation); + + gdk_window_set_transient_for (window, + gtk_widget_get_window (toplevel)); + } + else +#endif + { + window = gdk_window_new_child (gtk_widget_get_parent_window (widget), + GDK_ALL_EVENTS_MASK, + &allocation); + } - window = gdk_window_new_child (gtk_widget_get_parent_window (widget), - GDK_ALL_EVENTS_MASK, - &(GdkRectangle) { 0, 0, allocation.width, allocation.height }); gtk_widget_set_window (widget, window); gtk_widget_register_window (widget, window); gtk_widget_set_realized (widget, TRUE);