|
|
68333f |
From 13603e46a07f4ece309f5b2ab3196ad306b6008c Mon Sep 17 00:00:00 2001
|
|
|
68333f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
68333f |
Date: Fri, 6 Jun 2014 07:58:20 +0200
|
|
|
68333f |
Subject: [PATCH 1/3] boxes: Ignore struts that don't attach to the side they
|
|
|
68333f |
claim
|
|
|
68333f |
|
|
|
68333f |
Like the _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL client properties,
|
|
|
68333f |
_NET_WORKAREA is defined in terms of screen geometry rather than
|
|
|
68333f |
taking individual monitors into account. However we do want to
|
|
|
68333f |
allow system chrome to be attached to a monitor edge rather than
|
|
|
68333f |
a screen edges under some circumstances. As not all clients can
|
|
|
68333f |
be assumed to deal gracefully with the resulting workarea, use
|
|
|
68333f |
those "struts" only internally for constraining windows, but
|
|
|
68333f |
ignore them when exporting _NET_WORKAREA.
|
|
|
68333f |
|
|
|
68333f |
https://bugzilla.gnome.org/show_bug.cgi?id=730527
|
|
|
68333f |
---
|
|
|
68333f |
src/core/boxes.c | 29 ++++++++++++++++++++++++++---
|
|
|
68333f |
1 file changed, 26 insertions(+), 3 deletions(-)
|
|
|
68333f |
|
|
|
68333f |
diff --git a/src/core/boxes.c b/src/core/boxes.c
|
|
|
68333f |
index 3c4f444..1057528 100644
|
|
|
68333f |
--- a/src/core/boxes.c
|
|
|
68333f |
+++ b/src/core/boxes.c
|
|
|
68333f |
@@ -548,6 +548,26 @@ compare_rect_areas (gconstpointer a, gconstpointer b)
|
|
|
68333f |
return b_area - a_area; /* positive ret value denotes b > a, ... */
|
|
|
68333f |
}
|
|
|
68333f |
|
|
|
68333f |
+/* ... and another helper for get_minimal_spanning_set_for_region()... */
|
|
|
68333f |
+static gboolean
|
|
|
68333f |
+check_strut_align (MetaStrut *strut, const MetaRectangle *rect)
|
|
|
68333f |
+{
|
|
|
68333f |
+ /* Check whether @strut actually aligns to the side of @rect it claims */
|
|
|
68333f |
+ switch (strut->side)
|
|
|
68333f |
+ {
|
|
|
68333f |
+ case META_SIDE_TOP:
|
|
|
68333f |
+ return BOX_TOP (strut->rect) <= BOX_TOP (*rect);
|
|
|
68333f |
+ case META_SIDE_BOTTOM:
|
|
|
68333f |
+ return BOX_BOTTOM (strut->rect) >= BOX_BOTTOM (*rect);
|
|
|
68333f |
+ case META_SIDE_LEFT:
|
|
|
68333f |
+ return BOX_LEFT (strut->rect) <= BOX_LEFT (*rect);
|
|
|
68333f |
+ case META_SIDE_RIGHT:
|
|
|
68333f |
+ return BOX_RIGHT (strut->rect) >= BOX_RIGHT (*rect);
|
|
|
68333f |
+ default:
|
|
|
68333f |
+ return FALSE;
|
|
|
68333f |
+ }
|
|
|
68333f |
+}
|
|
|
68333f |
+
|
|
|
68333f |
/**
|
|
|
68333f |
* meta_rectangle_get_minimal_spanning_set_for_region:
|
|
|
68333f |
* @basic_rect: Input rectangle
|
|
|
68333f |
@@ -631,8 +651,9 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
|
|
68333f |
|
|
|
68333f |
for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next)
|
|
|
68333f |
{
|
|
|
68333f |
- GList *rect_iter;
|
|
|
68333f |
- MetaRectangle *strut_rect = &((MetaStrut*)strut_iter->data)->rect;
|
|
|
68333f |
+ GList *rect_iter;
|
|
|
68333f |
+ MetaStrut *strut = (MetaStrut*)strut_iter->data;
|
|
|
68333f |
+ MetaRectangle *strut_rect = &strut->rect;
|
|
|
68333f |
|
|
|
68333f |
tmp_list = ret;
|
|
|
68333f |
ret = NULL;
|
|
|
68333f |
@@ -640,7 +661,9 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
|
|
68333f |
while (rect_iter)
|
|
|
68333f |
{
|
|
|
68333f |
MetaRectangle *rect = (MetaRectangle*) rect_iter->data;
|
|
|
68333f |
- if (!meta_rectangle_overlap (rect, strut_rect))
|
|
|
68333f |
+
|
|
|
68333f |
+ if (!meta_rectangle_overlap (strut_rect, rect) ||
|
|
|
68333f |
+ !check_strut_align (strut, basic_rect))
|
|
|
68333f |
ret = g_list_prepend (ret, rect);
|
|
|
68333f |
else
|
|
|
68333f |
{
|
|
|
68333f |
--
|
|
|
68333f |
2.1.0
|
|
|
68333f |
|
|
|
68333f |
|
|
|
68333f |
From 147decb30f1539b18eb8aeb1e37914d9cccac016 Mon Sep 17 00:00:00 2001
|
|
|
68333f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
68333f |
Date: Thu, 12 Jun 2014 01:06:25 +0200
|
|
|
68333f |
Subject: [PATCH 2/3] testboxes: Update test cases
|
|
|
68333f |
|
|
|
68333f |
Who cares? We do now ...
|
|
|
68333f |
|
|
|
68333f |
https://bugzilla.gnome.org/show_bug.cgi?id=730527
|
|
|
68333f |
---
|
|
|
68333f |
src/core/testboxes.c | 42 ++++++++++++++++++------------------------
|
|
|
68333f |
1 file changed, 18 insertions(+), 24 deletions(-)
|
|
|
68333f |
|
|
|
68333f |
diff --git a/src/core/testboxes.c b/src/core/testboxes.c
|
|
|
68333f |
index 128efac..44f70b1 100644
|
|
|
68333f |
--- a/src/core/testboxes.c
|
|
|
68333f |
+++ b/src/core/testboxes.c
|
|
|
68333f |
@@ -240,7 +240,7 @@ static GSList*
|
|
|
68333f |
get_strut_list (int which)
|
|
|
68333f |
{
|
|
|
68333f |
GSList *ans;
|
|
|
68333f |
- MetaDirection wc = 0; /* wc == who cares? ;-) */
|
|
|
68333f |
+ MetaSide wc = 0; /* wc == who cares? ;-) */
|
|
|
68333f |
|
|
|
68333f |
ans = NULL;
|
|
|
68333f |
|
|
|
68333f |
@@ -250,32 +250,32 @@ get_strut_list (int which)
|
|
|
68333f |
case 0:
|
|
|
68333f |
break;
|
|
|
68333f |
case 1:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 400, 1160, 1600, 40, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 400, 1160, 1600, 40, META_SIDE_BOTTOM));
|
|
|
68333f |
break;
|
|
|
68333f |
case 2:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 150, 50, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, META_SIDE_BOTTOM));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 150, 50, META_SIDE_BOTTOM));
|
|
|
68333f |
break;
|
|
|
68333f |
case 3:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 80, 50, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, META_SIDE_LEFT));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 80, 50, META_SIDE_BOTTOM));
|
|
|
68333f |
ans = g_slist_prepend (ans, new_meta_strut ( 700, 525, 200, 150, wc));
|
|
|
68333f |
break;
|
|
|
68333f |
case 4:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, META_SIDE_LEFT));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
break;
|
|
|
68333f |
case 5:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 800, 10, 800, 1200, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, META_SIDE_LEFT));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 800, 10, 800, 1200, META_SIDE_RIGHT));
|
|
|
68333f |
break;
|
|
|
68333f |
case 6:
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 40, wc));
|
|
|
68333f |
- ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 40, META_SIDE_TOP));
|
|
|
68333f |
+ ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
|
|
|
68333f |
break;
|
|
|
68333f |
}
|
|
|
68333f |
|
|
|
68333f |
@@ -625,15 +625,9 @@ test_regions_okay ()
|
|
|
68333f |
/*************************************************************/
|
|
|
68333f |
region = get_screen_region (3);
|
|
|
68333f |
tmp = NULL;
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); /* 220500 */
|
|
|
68333f |
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); /* 354000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); /* 377600 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); /* 380000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); /* 472000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); /* 680000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); /* 756000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); /* 791000 */
|
|
|
68333f |
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); /* 808000 */
|
|
|
68333f |
+ tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 1220, 1180)); /* 377600 */
|
|
|
68333f |
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 1130)); /* 791000 */
|
|
|
68333f |
#if 0
|
|
|
68333f |
printf ("Got to here...\n");
|
|
|
68333f |
char region_list[(RECT_LENGTH+2) * g_list_length (region)];
|
|
|
68333f |
--
|
|
|
68333f |
2.1.0
|
|
|
68333f |
|
|
|
68333f |
|
|
|
68333f |
From 0e1668ea9d4fb070480351021af44932ab04bcc2 Mon Sep 17 00:00:00 2001
|
|
|
68333f |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
68333f |
Date: Wed, 11 Jun 2014 02:16:13 +0200
|
|
|
68333f |
Subject: [PATCH 3/3] workspace: Extend builtin struts to screen edge when
|
|
|
68333f |
possible
|
|
|
68333f |
|
|
|
68333f |
Struts are defined in terms of screen edges, so expand the rectangles
|
|
|
68333f |
we get via set_builtin_struts() accordingly. However we do want to
|
|
|
68333f |
allow chrome on edges between monitors, in which case the expansion
|
|
|
68333f |
would render an entire monitor unusable - don't expand the rectangles
|
|
|
68333f |
in that case, which means we will only use them for constraining
|
|
|
68333f |
windows but ignore them for the client-visible _NET_WORKAREA property.
|
|
|
68333f |
|
|
|
68333f |
https://bugzilla.gnome.org/show_bug.cgi?id=730527
|
|
|
68333f |
---
|
|
|
68333f |
src/core/workspace.c | 39 +++++++++++++++++++++++++++++++++++++++
|
|
|
68333f |
1 file changed, 39 insertions(+)
|
|
|
68333f |
|
|
|
68333f |
diff --git a/src/core/workspace.c b/src/core/workspace.c
|
|
|
68333f |
index e5da6d2..9683baf 100644
|
|
|
68333f |
--- a/src/core/workspace.c
|
|
|
68333f |
+++ b/src/core/workspace.c
|
|
|
68333f |
@@ -1042,6 +1042,45 @@ void
|
|
|
68333f |
meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|
|
68333f |
GSList *struts)
|
|
|
68333f |
{
|
|
|
68333f |
+ MetaScreen *screen = workspace->screen;
|
|
|
68333f |
+ GSList *l;
|
|
|
68333f |
+
|
|
|
68333f |
+ for (l = struts; l; l = l->next)
|
|
|
68333f |
+ {
|
|
|
68333f |
+ MetaStrut *strut = l->data;
|
|
|
68333f |
+ int idx = meta_screen_get_monitor_index_for_rect (screen, &strut->rect);
|
|
|
68333f |
+
|
|
|
68333f |
+ switch (strut->side)
|
|
|
68333f |
+ {
|
|
|
68333f |
+ case META_SIDE_TOP:
|
|
|
68333f |
+ if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_UP))
|
|
|
68333f |
+ continue;
|
|
|
68333f |
+
|
|
|
68333f |
+ strut->rect.height += strut->rect.y;
|
|
|
68333f |
+ strut->rect.y = 0;
|
|
|
68333f |
+ break;
|
|
|
68333f |
+ case META_SIDE_BOTTOM:
|
|
|
68333f |
+ if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_DOWN))
|
|
|
68333f |
+ continue;
|
|
|
68333f |
+
|
|
|
68333f |
+ strut->rect.height = screen->rect.height - strut->rect.y;
|
|
|
68333f |
+ break;
|
|
|
68333f |
+ case META_SIDE_LEFT:
|
|
|
68333f |
+ if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_LEFT))
|
|
|
68333f |
+ continue;
|
|
|
68333f |
+
|
|
|
68333f |
+ strut->rect.width += strut->rect.x;
|
|
|
68333f |
+ strut->rect.x = 0;
|
|
|
68333f |
+ break;
|
|
|
68333f |
+ case META_SIDE_RIGHT:
|
|
|
68333f |
+ if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_RIGHT))
|
|
|
68333f |
+ continue;
|
|
|
68333f |
+
|
|
|
68333f |
+ strut->rect.width = screen->rect.width - strut->rect.x;
|
|
|
68333f |
+ break;
|
|
|
68333f |
+ }
|
|
|
68333f |
+ }
|
|
|
68333f |
+
|
|
|
68333f |
/* Reordering doesn't actually matter, so we don't catch all
|
|
|
68333f |
* no-impact changes, but this is just a (possibly unnecessary
|
|
|
68333f |
* anyways) optimization */
|
|
|
68333f |
--
|
|
|
68333f |
2.1.0
|
|
|
68333f |
|