[metacity/wip/muktupavels/work-areas-v3: 3/4] window: add support for _NET_WM_STRUT_AREA
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/wip/muktupavels/work-areas-v3: 3/4] window: add support for _NET_WM_STRUT_AREA
- Date: Sun, 23 Dec 2018 16:00:38 +0000 (UTC)
commit 4016c5ca832528f95353f4cf19a36be460ee82b4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Jun 16 22:19:11 2018 +0300
window: add support for _NET_WM_STRUT_AREA
src/core/atomnames.h | 1 +
src/core/window-props.c | 6 ++++
src/core/window.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 92 insertions(+)
---
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index 5ad031b6..8c75fab8 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -152,6 +152,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 32f47614..04a09dd1 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1954,6 +1954,12 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
reload_struts,
NONE
},
+ {
+ display->atom__NET_WM_STRUT_AREA,
+ META_PROP_VALUE_INVALID,
+ reload_struts,
+ NONE
+ },
{
display->atom__NET_WM_WINDOW_OPACITY,
META_PROP_VALUE_CARDINAL,
diff --git a/src/core/window.c b/src/core/window.c
index 789048ec..ad5516ce 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6375,6 +6375,91 @@ meta_window_update_struts (MetaWindow *window)
new_struts = NULL;
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))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]