summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2014-06-11 02:16:13 +0200
committerFlorian Müllner <fmuellner@gnome.org>2014-06-12 15:28:46 +0200
commita7350475e846116d98cc110c2afa10151007b183 (patch)
tree2b06bd890cf7735466da4a05d77243d4ae4650ba
parentf3d7c9cff995f2901483c2e6213daf625e66db95 (diff)
downloadmutter-a7350475e846116d98cc110c2afa10151007b183.tar.gz
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
-rw-r--r--src/core/workspace.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 419adb9ce..ea999bc3f 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 */