[mutter] Move workarea hint setting to MetaX11Display



commit 9f1ab1c3afba114fd82609a04fd4708b096e575f
Author: Armin Krezović <krezovic armin gmail com>
Date:   Sat Aug 26 22:41:16 2017 +0200

    Move workarea hint setting to MetaX11Display
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759538

 src/core/display.c         | 41 +----------------------------------------
 src/x11/meta-x11-display.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 40 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 4c7ce3998..027d35f43 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -3345,45 +3345,6 @@ meta_display_apply_startup_properties (MetaDisplay *display,
   return FALSE;
 }
 
-static void
-set_work_area_hint (MetaDisplay *display)
-{
-  MetaX11Display *x11_display = display->x11_display;
-  int num_workspaces;
-  GList *l;
-  unsigned long *data, *tmp;
-  MetaRectangle area;
-
-  num_workspaces = meta_display_get_n_workspaces (display);
-  data = g_new (unsigned long, num_workspaces * 4);
-  tmp = data;
-
-  for (l = display->workspaces; l; l = l->next)
-    {
-      MetaWorkspace *workspace = l->data;
-
-      meta_workspace_get_work_area_all_monitors (workspace, &area);
-      tmp[0] = area.x;
-      tmp[1] = area.y;
-      tmp[2] = area.width;
-      tmp[3] = area.height;
-
-      tmp += 4;
-    }
-
-  meta_error_trap_push (x11_display);
-  XChangeProperty (x11_display->xdisplay,
-                   x11_display->xroot,
-                   x11_display->atom__NET_WORKAREA,
-                   XA_CARDINAL, 32, PropModeReplace,
-                   (guchar*) data, num_workspaces*4);
-  meta_error_trap_pop (x11_display);
-
-  g_free (data);
-
-  g_signal_emit (display, display_signals[WORKAREAS_CHANGED], 0);
-}
-
 static gboolean
 set_work_area_later_func (MetaDisplay *display)
 {
@@ -3392,7 +3353,7 @@ set_work_area_later_func (MetaDisplay *display)
 
   display->work_area_later = 0;
 
-  set_work_area_hint (display);
+  g_signal_emit (display, display_signals[WORKAREAS_CHANGED], 0);
 
   return FALSE;
 }
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 47045896d..755a05b66 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -887,6 +887,43 @@ set_workspace_names (MetaX11Display *x11_display)
   g_string_free (flattened, TRUE);
 }
 
+static void
+set_work_area_hint (MetaDisplay    *display,
+                    MetaX11Display *x11_display)
+{
+  int num_workspaces;
+  GList *l;
+  unsigned long *data, *tmp;
+  MetaRectangle area;
+
+  num_workspaces = meta_display_get_n_workspaces (display);
+  data = g_new (unsigned long, num_workspaces * 4);
+  tmp = data;
+
+  for (l = display->workspaces; l; l = l->next)
+    {
+      MetaWorkspace *workspace = l->data;
+
+      meta_workspace_get_work_area_all_monitors (workspace, &area);
+      tmp[0] = area.x;
+      tmp[1] = area.y;
+      tmp[2] = area.width;
+      tmp[3] = area.height;
+
+      tmp += 4;
+    }
+
+  meta_error_trap_push (x11_display);
+  XChangeProperty (x11_display->xdisplay,
+                   x11_display->xroot,
+                   x11_display->atom__NET_WORKAREA,
+                   XA_CARDINAL, 32, PropModeReplace,
+                   (guchar*) data, num_workspaces*4);
+  meta_error_trap_pop (x11_display);
+
+  g_free (data);
+}
+
 /**
  * meta_set_wm_name: (skip)
  * @wm_name: value for _NET_WM_NAME
@@ -1198,6 +1235,12 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
 
   meta_prefs_add_listener (prefs_changed_callback, x11_display);
 
+  set_work_area_hint (display, x11_display);
+
+  g_signal_connect_object (display, "workareas-changed",
+                           G_CALLBACK (set_work_area_hint),
+                           x11_display, 0);
+
   init_x11_bell (x11_display);
 
   g_signal_connect_object (display->bell, "is-audible-changed",


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