[gtk+/wip/baedert/drawing: 277/348] popover: Create subsurface on wayland



commit f86afea1bc50125154e225fc1297f39b88eca215
Author: Timm Bäder <mail baedert org>
Date:   Wed Jun 21 13:25:41 2017 +0200

    popover: Create subsurface on wayland

 gtk/gtkpopover.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 2ae6f7a..05cbacb 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]