[mutter] workspace: Extend builtin struts to screen edge when possible



commit a7350475e846116d98cc110c2afa10151007b183
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jun 11 02:16:13 2014 +0200

    workspace: Extend builtin struts to screen edge when possible
    
    Struts are defined in terms of screen edges, so expand the rectangles
    we get via set_builtin_struts() accordingly. However we do want to
    allow chrome on edges between monitors, in which case the expansion
    would render an entire monitor unusable - don't expand the rectangles
    in that case, which means we will only use them for constraining
    windows but ignore them for the client-visible _NET_WORKAREA property.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730527

 src/core/workspace.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 419adb9..ea999bc 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -1040,6 +1040,45 @@ void
 meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
                                    GSList        *struts)
 {
+  MetaScreen *screen = workspace->screen;
+  GSList *l;
+
+  for (l = struts; l; l = l->next)
+    {
+      MetaStrut *strut = l->data;
+      int idx = meta_screen_get_monitor_index_for_rect (screen, &strut->rect);
+
+      switch (strut->side)
+        {
+        case META_SIDE_TOP:
+          if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_UP))
+            continue;
+
+          strut->rect.height += strut->rect.y;
+          strut->rect.y = 0;
+          break;
+        case META_SIDE_BOTTOM:
+          if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_DOWN))
+            continue;
+
+          strut->rect.height = screen->rect.height - strut->rect.y;
+          break;
+        case META_SIDE_LEFT:
+          if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_LEFT))
+            continue;
+
+          strut->rect.width += strut->rect.x;
+          strut->rect.x = 0;
+          break;
+        case META_SIDE_RIGHT:
+          if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_RIGHT))
+            continue;
+
+          strut->rect.width = screen->rect.width - strut->rect.x;
+          break;
+        }
+    }
+
   /* Reordering doesn't actually matter, so we don't catch all
    * no-impact changes, but this is just a (possibly unnecessary
    * anyways) optimization */


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