[gtk+] x11: Deal better with L-shaped monitor arrangements



commit 88a1d4d5a1e26545e9a69ef9d11d37f62b608e14
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 22 17:44:54 2012 -0400

    x11: Deal better with L-shaped monitor arrangements
    
    The code for calculating the per-monitor workarea was ignoring
    the fact that the EWMH workarea property can only handle rectangular
    workareas, and thus can't really do justice to general monitor
    arrangements. As a workaround, we ignore it for anything but
    the primary monitor. And we ignore it for the primary monitor
    as well if it does not even cover it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672163

 gdk/x11/gdkscreen-x11.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index c14e065..a6d8ba6 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -372,8 +372,19 @@ gdk_x11_screen_get_monitor_workarea (GdkScreen    *screen,
   GdkRectangle workarea;
 
   gdk_x11_screen_get_monitor_geometry (screen, monitor_num, dest);
-  get_work_area (screen, &workarea);
-  gdk_rectangle_intersect (&workarea, dest, dest);
+
+  /* The EWMH constrains workarea to be a rectangle, so it
+   * can't adequately deal with L-shaped monitor arrangements.
+   * As a workaround, we ignore the workarea for anything
+   * but the primary monitor. Since that is where the 'desktop
+   * chrome' usually lives, this works ok in practice.
+   */
+  if (monitor_num == GDK_X11_SCREEN (screen)->primary_monitor)
+    {
+      get_work_area (screen, &workarea);
+      if (gdk_rectangle_intersect (dest, &workarea, &workarea))
+        *dest = workarea;
+    }
 }
 
 static GdkVisual *



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