Xfce Wiki

Sub domains
 
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Buxton <a.j.buxton@gmail.com>2014-01-12 17:13:11 +0000
committerOlivier Fourdan <fourdan@xfce.org>2015-01-08 21:25:08 +0100
commit3f12ac8f92096ce562221622aa5ad2f45ae37006 (patch)
tree845a0286c70bb6116647d2122339b0fdb4a6fc09
parentc6842b38ea34a5ae28404d6c6af877ab8b5402dc (diff)
downloadxfwm4-3f12ac8f92096ce562221622aa5ad2f45ae37006.tar.gz
Workaround for NET_WORKAREA with multimonitor
Bug #10625 NET_WORKAREA doesn't support L shaped displays at all. gdk works around this by ignoring it unless dealing with the primary monitor. Mimic this behaviour by ignoring struts not on the primary display when calculating NET_WORKAREA
-rw-r--r--src/workspaces.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/workspaces.c b/src/workspaces.c
index f57eec9..3800429 100644
--- a/src/workspaces.c
+++ b/src/workspaces.c
@@ -527,6 +527,8 @@ workspaceUpdateArea (ScreenInfo *screen_info)
int prev_bottom;
guint i;
+ GdkRectangle workarea,struttmp;
+
g_return_if_fail (screen_info != NULL);
g_return_if_fail (screen_info->margins != NULL);
g_return_if_fail (screen_info->gnome_margins != NULL);
@@ -544,11 +546,65 @@ workspaceUpdateArea (ScreenInfo *screen_info)
screen_info->margins[i] = screen_info->gnome_margins[i];
}
+ gdk_screen_get_monitor_geometry (screen_info->gscr, gdk_screen_get_primary_monitor(screen_info->gscr), &workarea);
+
for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
{
if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT)
&& FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
{
+ /*
+ * NET_WORKAREA doesn't support L shaped displays at all.
+ * gdk works around this by ignoring it unless dealing with
+ * the primary monitor.
+ * Mimic this behaviour by ignoring struts not on the primary
+ * display when calculating NET_WORKAREA
+ */
+
+ if(c->struts[STRUTS_TOP])
+ {
+ struttmp.x = c->struts[STRUTS_TOP_START_X];
+ struttmp.y = 0;
+ struttmp.width = c->struts[STRUTS_TOP_END_X] - c->struts[STRUTS_TOP_START_X];
+ struttmp.height = c->struts[STRUTS_TOP];
+
+ if (!gdk_rectangle_intersect (&workarea, &struttmp, NULL))
+ continue;
+ }
+
+ if(c->struts[STRUTS_BOTTOM])
+ {
+ struttmp.x = c->struts[STRUTS_BOTTOM_START_X];
+ struttmp.y = screen_info->height - c->struts[STRUTS_BOTTOM];
+ struttmp.width = c->struts[STRUTS_BOTTOM_END_X] - c->struts[STRUTS_BOTTOM_START_X];
+ struttmp.height = c->struts[STRUTS_BOTTOM];
+
+ if (!gdk_rectangle_intersect (&workarea, &struttmp, NULL))
+ continue;
+ }
+
+ if(c->struts[STRUTS_LEFT])
+ {
+ struttmp.x = 0;
+ struttmp.y = c->struts[STRUTS_LEFT_START_Y];
+ struttmp.width = c->struts[STRUTS_LEFT];
+ struttmp.height = c->struts[STRUTS_LEFT_END_Y] - c->struts[STRUTS_LEFT_START_Y];
+
+ if (!gdk_rectangle_intersect (&workarea, &struttmp, NULL))
+ continue;
+ }
+
+ if(c->struts[STRUTS_RIGHT])
+ {
+ struttmp.x = screen_info->width - c->struts[STRUTS_RIGHT];
+ struttmp.y = c->struts[STRUTS_RIGHT_START_Y];
+ struttmp.width = c->struts[STRUTS_RIGHT];
+ struttmp.height = c->struts[STRUTS_RIGHT_END_Y] - c->struts[STRUTS_RIGHT_START_Y];
+
+ if (!gdk_rectangle_intersect (&workarea, &struttmp, NULL))
+ continue;
+ }
+
screen_info->margins[STRUTS_TOP] = MAX (screen_info->margins[STRUTS_TOP], c->struts[STRUTS_TOP]);
screen_info->margins[STRUTS_LEFT] = MAX (screen_info->margins[STRUTS_LEFT], c->struts[STRUTS_LEFT]);
screen_info->margins[STRUTS_RIGHT] = MAX (screen_info->margins[STRUTS_RIGHT], c->struts[STRUTS_RIGHT]);