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
This commit is contained in:
Matthias Clasen 2012-03-22 17:44:54 -04:00
parent 482195d788
commit 88a1d4d5a1

View File

@ -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 *