[Xfce4-commits] [xfce/xfwm4] 01/02: Workaround for NET_WORKAREA with multimonitor

noreply at xfce.org noreply at xfce.org
Thu Jan 8 21:43:34 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 3f12ac8f92096ce562221622aa5ad2f45ae37006
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Sun Jan 12 17:13:11 2014 +0000

    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
---
 src/workspaces.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

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]);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list