[gtk/gtk-4-2: 76/91] x11: Try harder to find the right monitor




commit f795a75d2b4c41c53c3546d8ba230eaba3a72aaa
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 26 23:18:50 2021 -0400

    x11: Try harder to find the right monitor
    
    If we deal with a panel, we end up with no monitor,
    and crash, which isn't great and isn't necessary.
    
    Fixes: #3900

 gdk/x11/gdksurface-x11.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index aeaca9c0f9..f8a69b858e 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -1822,9 +1822,16 @@ gdk_x11_surface_layout_popup (GdkSurface     *surface,
 
   monitor = gdk_surface_get_layout_monitor (surface, layout,
                                             gdk_x11_monitor_get_workarea);
-  gdk_x11_monitor_get_workarea (monitor, &bounds);
+  if (monitor)
+    gdk_x11_monitor_get_workarea (monitor, &bounds);
+  else
+    {
+      monitor = gdk_surface_get_layout_monitor (surface, layout,
+                                                gdk_monitor_get_geometry);
+      gdk_monitor_get_geometry (monitor, &bounds);
+    }
 
-  gdk_popup_layout_get_shadow_width (layout,
+  gdk_popup_layout_get_shadow_width (layout, 
                                      &impl->shadow_left,
                                      &impl->shadow_right,
                                      &impl->shadow_top,


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