[metacity/wip/muktupavels/work-areas-v3: 169/170] 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: 169/170] window: add support for _NET_WM_STRUT_AREA
- Date: Sat, 11 Jan 2020 15:56:40 +0000 (UTC)
commit fc1a4262f5c2d7b30c45ad7e36e368dfd58f5104
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 36acc171..68d57791 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -153,6 +153,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 ef877f24..b8bb2eac 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1967,6 +1967,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 9335f965..36fbaa2a 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6385,6 +6385,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]