[mutter/wip/carlosg/x11less-preparations: 14/25] x11: Move X11 calls to map/unmap a MetaWindow to MetaWindowX11



commit 993e168f120a7ac4bf3e1b8a519b87ec7e4e9446
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 30 13:55:52 2018 +0100

    x11: Move X11 calls to map/unmap a MetaWindow to MetaWindowX11
    
    Add 2 vmethods so that MetaWindowX11 may handle the X11 calls itself.

 src/core/window-private.h |  3 +++
 src/core/window.c         | 25 +++++++++++++++----------
 src/x11/window-x11.c      | 27 +++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 10 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 1babd307f..b26b42532 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -572,6 +572,9 @@ struct _MetaWindowClass
                                    ClutterInputDevice *source);
   gboolean (*is_stackable)        (MetaWindow *window);
   gboolean (*are_updates_frozen)  (MetaWindow *window);
+
+  void (* map)   (MetaWindow *window);
+  void (* unmap) (MetaWindow *window);
 };
 
 /* These differ from window->has_foo_func in that they consider
diff --git a/src/core/window.c b/src/core/window.c
index 812726295..2a76c86f9 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -300,6 +300,16 @@ meta_window_real_get_client_pid (MetaWindow *window)
   return 0;
 }
 
+static void
+meta_window_real_map (MetaWindow *window)
+{
+}
+
+static void
+meta_window_real_unmap (MetaWindow *window)
+{
+}
+
 static void
 meta_window_finalize (GObject *object)
 {
@@ -469,6 +479,8 @@ meta_window_class_init (MetaWindowClass *klass)
   klass->get_default_skip_hints = meta_window_real_get_default_skip_hints;
   klass->update_icon = meta_window_real_update_icon;
   klass->get_client_pid = meta_window_real_get_client_pid;
+  klass->map = meta_window_real_map;
+  klass->unmap = meta_window_real_unmap;
 
   obj_props[PROP_TITLE] =
     g_param_spec_string ("title",
@@ -808,17 +820,10 @@ sync_client_window_mapped (MetaWindow *window)
 
   window->mapped = should_be_mapped;
 
-  meta_x11_error_trap_push (window->display->x11_display);
-  if (should_be_mapped)
-    {
-      XMapWindow (window->display->x11_display->xdisplay, window->xwindow);
-    }
+  if (window->mapped)
+    META_WINDOW_GET_CLASS (window)->map (window);
   else
-    {
-      XUnmapWindow (window->display->x11_display->xdisplay, window->xwindow);
-      window->unmaps_pending ++;
-    }
-  meta_x11_error_trap_pop (window->display->x11_display);
+    META_WINDOW_GET_CLASS (window)->unmap (window);
 }
 
 static gboolean
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index c2103aa14..0fc2b436f 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -1648,6 +1648,31 @@ meta_window_x11_are_updates_frozen (MetaWindow *window)
   return FALSE;
 }
 
+static void
+meta_window_x11_map (MetaWindow *window)
+{
+  MetaX11Display *x11_display = window->display->x11_display;
+
+  meta_x11_error_trap_push (x11_display);
+  XMapWindow (x11_display->xdisplay, window->xwindow);
+  meta_x11_error_trap_pop (x11_display);
+
+  META_WINDOW_CLASS (meta_window_x11_parent_class)->map (window);
+}
+
+static void
+meta_window_x11_unmap (MetaWindow *window)
+{
+  MetaX11Display *x11_display = window->display->x11_display;
+
+  meta_x11_error_trap_push (x11_display);
+  XUnmapWindow (x11_display->xdisplay, window->xwindow);
+  meta_x11_error_trap_pop (x11_display);
+  window->unmaps_pending ++;
+
+  META_WINDOW_CLASS (meta_window_x11_parent_class)->unmap (window);
+}
+
 static void
 meta_window_x11_class_init (MetaWindowX11Class *klass)
 {
@@ -1673,6 +1698,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
   window_class->shortcuts_inhibited = meta_window_x11_shortcuts_inhibited;
   window_class->is_stackable = meta_window_x11_is_stackable;
   window_class->are_updates_frozen = meta_window_x11_are_updates_frozen;
+  window_class->map = meta_window_x11_map;
+  window_class->unmap = meta_window_x11_unmap;
 }
 
 void


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