From 4e4fd6c512423b16640914b33192a32f290b0ef1 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sat, 10 Apr 2021 14:21:30 +0200 Subject: screen: add support for _GTK_WORKAREAS_Dn In addition to existing _NET_WORKAREA property set also new _GTK_WORKAREAS_Dn property where n is desktop number (between 0 and _NET_NUMBER_OF_DESKTOPS - 1). https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22 origin commit: https://gitlab.gnome.org/GNOME/metacity/-/commit/3d8b03d --- src/core/atomnames.h | 1 + src/core/screen.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/core/atomnames.h b/src/core/atomnames.h index 3744f428..059594d3 100644 --- a/src/core/atomnames.h +++ b/src/core/atomnames.h @@ -61,6 +61,7 @@ item(_MARCO_TOGGLE_VERBOSE) item(_GTK_THEME_VARIANT) item(_GTK_FRAME_EXTENTS) item(_GTK_SHOW_WINDOW_MENU) +item(_GTK_WORKAREAS) item(_MATE_PANEL_ACTION) item(_MATE_PANEL_ACTION_MAIN_MENU) item(_MATE_PANEL_ACTION_RUN_DIALOG) diff --git a/src/core/screen.c b/src/core/screen.c index 5e65fd2a..c5962cb2 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -108,6 +108,7 @@ set_supported_hint (MetaScreen *screen) #undef EWMH_ATOMS_ONLY screen->display->atom__GTK_FRAME_EXTENTS, screen->display->atom__GTK_SHOW_WINDOW_MENU, + screen->display->atom__GTK_WORKAREAS }; XChangeProperty (screen->display->xdisplay, screen->xroot, @@ -2034,6 +2035,48 @@ meta_create_offscreen_window (Display *xdisplay, &attrs); } +static void +set_workspace_work_area_hint (MetaWorkspace *workspace, + MetaScreen *screen) +{ + unsigned long *data; + unsigned long *tmp; + int i; + gchar *workarea_name; + Atom workarea_atom; + + data = g_new (unsigned long, screen->n_xinerama_infos * 4); + tmp = data; + + for (i = 0; i < screen->n_xinerama_infos; i++) + { + MetaRectangle area; + + meta_workspace_get_work_area_for_xinerama (workspace, i, &area); + + tmp[0] = area.x; + tmp[1] = area.y; + tmp[2] = area.width; + tmp[3] = area.height; + + tmp += 4; + } + + workarea_name = g_strdup_printf ("_GTK_WORKAREAS_D%d", + meta_workspace_index (workspace)); + + workarea_atom = XInternAtom (screen->display->xdisplay, workarea_name, False); + g_free (workarea_name); + + meta_error_trap_push (screen->display); + XChangeProperty (screen->display->xdisplay, screen->xroot, workarea_atom, + XA_CARDINAL, 32, PropModeReplace, + (guchar*) data, screen->n_xinerama_infos * 4); + meta_error_trap_pop (screen->display, TRUE); + + g_free (data); +} + static void set_work_area_hint (MetaScreen *screen) { @@ -2054,6 +2097,7 @@ set_work_area_hint (MetaScreen *screen) if (workspace->screen == screen) { meta_workspace_get_work_area_all_xineramas (workspace, &area); + set_workspace_work_area_hint (workspace, screen); tmp[0] = area.x; tmp[1] = area.y; tmp[2] = area.width; -- cgit v1.2.1