[mutter/gbsneto/cleanup-x11-from-meta-window: 161/164] window: Delegate map and unmap to subclasses
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/cleanup-x11-from-meta-window: 161/164] window: Delegate map and unmap to subclasses
- Date: Wed, 13 Feb 2019 08:06:15 +0000 (UTC)
commit 43307c6b843bec882c6deca719a9a1b38954f606
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Dec 22 18:58:18 2018 -0200
window: Delegate map and unmap to subclasses
As of now, the base class MetaWindow is calling into X11
API when mapping and unmapping a window. Even on purely
Wayland clients.
Fix that by moving those calls to MetaWindow subclasses.
On MetaWindowX11, it calls into X11 APIs, and the Wayland
implementation is stub.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/372
src/core/window-private.h | 2 ++
src/core/window.c | 7 +++----
src/wayland/meta-window-wayland.c | 12 ++++++++++++
src/x11/window-x11.c | 24 ++++++++++++++++++++++++
4 files changed, 41 insertions(+), 4 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 04eae5b96..d7c8700ce 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -517,6 +517,8 @@ struct _MetaWindowClass
void (*manage) (MetaWindow *window);
void (*unmanage) (MetaWindow *window);
+ void (*map) (MetaWindow *window);
+ void (*unmap) (MetaWindow *window);
void (*ping) (MetaWindow *window,
guint32 serial);
void (*delete) (MetaWindow *window,
diff --git a/src/core/window.c b/src/core/window.c
index a01cc9b1f..47a836497 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -799,6 +799,7 @@ client_window_should_be_mapped (MetaWindow *window)
static void
sync_client_window_mapped (MetaWindow *window)
{
+ MetaWindowClass *window_class = META_WINDOW_GET_CLASS (window);
gboolean should_be_mapped = client_window_should_be_mapped (window);
g_return_if_fail (!window->override_redirect);
@@ -808,17 +809,15 @@ 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);
+ window_class->map (window);
}
else
{
- XUnmapWindow (window->display->x11_display->xdisplay, window->xwindow);
+ window_class->unmap (window);
window->unmaps_pending ++;
}
- meta_x11_error_trap_pop (window->display->x11_display);
}
static gboolean
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index c7c3785d8..9515a2103 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -111,6 +111,16 @@ meta_window_wayland_unmanage (MetaWindow *window)
meta_display_unregister_wayland_window (window->display, window);
}
+static void
+meta_window_wayland_map (MetaWindow *window)
+{
+}
+
+static void
+meta_window_wayland_unmap (MetaWindow *window)
+{
+}
+
static void
meta_window_wayland_ping (MetaWindow *window,
guint32 serial)
@@ -618,6 +628,8 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
window_class->manage = meta_window_wayland_manage;
window_class->unmanage = meta_window_wayland_unmanage;
+ window_class->map = meta_window_wayland_map;
+ window_class->unmap = meta_window_wayland_unmap;
window_class->ping = meta_window_wayland_ping;
window_class->delete = meta_window_wayland_delete;
window_class->kill = meta_window_wayland_kill;
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index ff4ece384..80193dbbf 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -709,6 +709,28 @@ meta_window_x11_can_ping (MetaWindow *window)
return priv->wm_ping;
}
+static void
+meta_window_x11_map (MetaWindow *window)
+{
+ meta_x11_error_trap_push (window->display->x11_display);
+
+ XMapWindow (window->display->x11_display->xdisplay,
+ window->xwindow);
+
+ meta_x11_error_trap_pop (window->display->x11_display);
+}
+
+static void
+meta_window_x11_unmap (MetaWindow *window)
+{
+ meta_x11_error_trap_push (window->display->x11_display);
+
+ XUnmapWindow (window->display->x11_display->xdisplay,
+ window->xwindow);
+
+ meta_x11_error_trap_pop (window->display->x11_display);
+}
+
static void
meta_window_x11_ping (MetaWindow *window,
guint32 serial)
@@ -1728,6 +1750,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
window_class->manage = meta_window_x11_manage;
window_class->unmanage = meta_window_x11_unmanage;
+ window_class->map = meta_window_x11_map;
+ window_class->unmap = meta_window_x11_unmap;
window_class->ping = meta_window_x11_ping;
window_class->delete = meta_window_x11_delete;
window_class->kill = meta_window_x11_kill;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]