[metacity/wip/muktupavels/work-areas-v3: 1/4] screen: add support for _NET_WORKAREAS_Dn



commit d4e7b2aded1823ce4685c0cbd086a0e558d6af35
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Dec 23 17:58:16 2018 +0200

    screen: add support for _NET_WORKAREAS_Dn
    
    In addition to existing property set also new _NET_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

 src/core/atomnames.h |  1 +
 src/core/screen.c    | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
---
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index bab2630b..8480d20d 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -135,6 +135,7 @@ item(_NET_WM_STATE_FULLSCREEN)
 item(_NET_WM_PING)
 item(_NET_WM_PID)
 item(_NET_WORKAREA)
+item(_NET_WORKAREAS)
 item(_NET_SHOWING_DESKTOP)
 item(_NET_DESKTOP_LAYOUT)
 item(_NET_DESKTOP_NAMES)
diff --git a/src/core/screen.c b/src/core/screen.c
index aec8f11f..b7269ee0 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1876,6 +1876,51 @@ set_work_area_hint (MetaScreen *screen)
                    (guchar*) data, num_workspaces*4);
   g_free (data);
   meta_error_trap_pop (screen->display);
+
+  tmp_list = screen->workspaces;
+
+  while (tmp_list != NULL)
+    {
+      MetaWorkspace *workspace = tmp_list->data;
+
+      if (workspace->screen == screen)
+        {
+          int i;
+          gchar *atom_name;
+          Atom region_atom;
+
+          data = g_new (unsigned long, screen->n_monitor_infos * 4);
+          tmp = data;
+
+          for (i = 0; i < screen->n_monitor_infos; i++)
+            {
+              meta_workspace_get_work_area_for_monitor (workspace, i, &area);
+
+              tmp[0] = area.x;
+              tmp[1] = area.y;
+              tmp[2] = area.width;
+              tmp[3] = area.height;
+
+              tmp += 4;
+            }
+
+          atom_name = g_strdup_printf ("_NET_WORKAREAS_D%d",
+                                       meta_workspace_index (workspace));
+
+          region_atom = XInternAtom (screen->display->xdisplay, atom_name, False);
+          g_free (atom_name);
+
+          meta_error_trap_push (screen->display);
+          XChangeProperty (screen->display->xdisplay, screen->xroot, region_atom,
+                           XA_CARDINAL, 32, PropModeReplace,
+                           (guchar*) data, screen->n_monitor_infos * 4);
+          meta_error_trap_pop (screen->display);
+
+          g_free (data);
+        }
+
+        tmp_list = tmp_list->next;
+    }
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]