summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-06-16 22:19:11 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-06-16 22:19:11 +0300
commitae595d19b52d7e0a6b0092b17bfe3004e55a321f (patch)
tree7677788385290545d525bb931cefcc209a1cc497
parentf12980833b9463c1e0c1a005d026bdf6d869cad2 (diff)
downloadmetacity-ae595d19b52d7e0a6b0092b17bfe3004e55a321f.tar.gz
window: add support for _NET_WM_STRUT_AREA
-rw-r--r--src/core/atomnames.h1
-rw-r--r--src/core/window-props.c6
-rw-r--r--src/core/window.c85
3 files changed, 92 insertions, 0 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index 735c78b2..2c139871 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -150,6 +150,7 @@ item(_NET_WM_STATE_ABOVE)
item(_NET_WM_STATE_BELOW)
item(_NET_STARTUP_ID)
item(_NET_WM_STRUT_PARTIAL)
+item(_NET_WM_STRUT_AREA)
item(_NET_WM_ACTION_FULLSCREEN)
item(_NET_WM_ACTION_MINIMIZE)
item(_NET_FRAME_EXTENTS)
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 9001d881..730d8200 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1953,6 +1953,12 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
NONE
},
{
+ display->atom__NET_WM_STRUT_AREA,
+ META_PROP_VALUE_INVALID,
+ reload_struts,
+ NONE
+ },
+ {
display->atom__NET_WM_WINDOW_OPACITY,
META_PROP_VALUE_CARDINAL,
reload_window_opacity,
diff --git a/src/core/window.c b/src/core/window.c
index fb4006b8..5d2c23ec 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6376,6 +6376,91 @@ meta_window_update_struts (MetaWindow *window)
if (meta_prop_get_cardinal_list (window->display,
window->xwindow,
+ window->display->atom__NET_WM_STRUT_AREA,
+ &struts, &nitems))
+ {
+ if (nitems != 4)
+ {
+ meta_verbose ("_NET_WM_STRUT_AREA on %s has %d values instead of 4\n",
+ window->desc, nitems);
+ }
+ else
+ {
+ MetaEdge *temp;
+ MetaSide side;
+ gboolean valid;
+ int i;
+
+ temp = g_new (MetaEdge, 1);
+
+ temp->rect.x = struts[0];
+ temp->rect.y = struts[1];
+ temp->rect.width = struts[2];
+ temp->rect.height = struts[3];
+
+ side = META_SIDE_LEFT;
+ valid = FALSE;
+
+ for (i = 0; i < window->screen->n_monitor_infos; i++)
+ {
+ MetaRectangle monitor;
+
+ monitor = window->screen->monitor_infos[i].rect;
+ if (!meta_rectangle_contains_rect (&monitor, &temp->rect))
+ continue;
+
+ if (temp->rect.height > temp->rect.width)
+ {
+ if (temp->rect.x == monitor.x)
+ {
+ side = META_SIDE_LEFT;
+ valid = TRUE;
+ }
+ else if (temp->rect.x + temp->rect.width == monitor.x + monitor.width)
+ {
+ side = META_SIDE_RIGHT;
+ valid = TRUE;
+ }
+ }
+ else
+ {
+ if (temp->rect.y == monitor.y)
+ {
+ side = META_SIDE_TOP;
+ valid = TRUE;
+ }
+ else if (temp->rect.y + temp->rect.height == monitor.y + monitor.height)
+ {
+ side = META_SIDE_BOTTOM;
+ valid = TRUE;
+ }
+ }
+ }
+
+ if (valid)
+ {
+ temp->side_type = side;
+ temp->edge_type = META_EDGE_MONITOR;
+
+ new_struts = g_slist_prepend (new_struts, temp);
+ }
+ else
+ {
+ g_free (temp);
+ }
+ }
+
+ meta_XFree (struts);
+ }
+ else
+ {
+ meta_verbose ("No _NET_WM_STRUT_AREA property for %s\n",
+ window->desc);
+ }
+
+ if (!new_struts &&
+ meta_prop_get_cardinal_list (window->display,
+ window->xwindow,
window->display->atom__NET_WM_STRUT_PARTIAL,
&struts, &nitems))
{