[mutter/wayland] Move delete / kill to be a vfunc
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] Move delete / kill to be a vfunc
- Date: Thu, 20 Mar 2014 19:53:19 +0000 (UTC)
commit 9debd2fb0d2618774a1a9b721df67a5dbdfe092c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Mar 20 15:07:44 2014 -0400
Move delete / kill to be a vfunc
src/core/delete.c | 51 +-------------------------------------
src/core/window-private.h | 3 ++
src/wayland/window-wayland.c | 15 +++++++++++
src/x11/window-x11.c | 55 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 75 insertions(+), 49 deletions(-)
---
diff --git a/src/core/delete.c b/src/core/delete.c
index 136e564..8b50707 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -143,31 +143,7 @@ void
meta_window_delete (MetaWindow *window,
guint32 timestamp)
{
- if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
- {
- meta_error_trap_push (window->display);
- if (window->delete_window)
- {
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Deleting %s with delete_window request\n",
- window->desc);
- meta_window_send_icccm_message (window,
- window->display->atom_WM_DELETE_WINDOW,
- timestamp);
- }
- else
- {
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Deleting %s with explicit kill\n",
- window->desc);
- XKillClient (window->display->xdisplay, window->xwindow);
- }
- meta_error_trap_pop (window->display);
- }
- else
- {
- meta_wayland_surface_delete (window->surface);
- }
+ META_WINDOW_GET_CLASS (window)->delete (window, timestamp);
meta_window_check_alive (window, timestamp);
@@ -200,33 +176,10 @@ meta_window_delete (MetaWindow *window,
}
}
-
void
meta_window_kill (MetaWindow *window)
{
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Killing %s brutally\n",
- window->desc);
-
- if (!meta_window_is_remote (window) &&
- window->net_wm_pid > 0)
- {
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Killing %s with kill()\n",
- window->desc);
-
- if (kill (window->net_wm_pid, 9) < 0)
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Failed to signal %s: %s\n",
- window->desc, strerror (errno));
- }
-
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Disconnecting %s with XKillClient()\n",
- window->desc);
- meta_error_trap_push (window->display);
- XKillClient (window->display->xdisplay, window->xwindow);
- meta_error_trap_pop (window->display);
+ META_WINDOW_GET_CLASS (window)->kill (window);
}
void
diff --git a/src/core/window-private.h b/src/core/window-private.h
index aa57332..82bfbde 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -471,6 +471,9 @@ struct _MetaWindowClass
void (*manage) (MetaWindow *window);
void (*unmanage) (MetaWindow *window);
+ void (*delete) (MetaWindow *window,
+ guint32 timestamp);
+ void (*kill) (MetaWindow *window);
void (*move_resize_internal) (MetaWindow *window,
int gravity,
MetaRectangle requested_rect,
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 8b75da7..eea45f3 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -76,6 +76,19 @@ meta_window_wayland_unmanage (MetaWindow *window)
}
static void
+meta_window_wayland_delete (MetaWindow *window,
+ guint32 timestamp)
+{
+ meta_wayland_surface_delete (window->surface);
+}
+
+static void
+meta_window_wayland_kill (MetaWindow *window)
+{
+ /* TODO */
+}
+
+static void
meta_window_wayland_move_resize_internal (MetaWindow *window,
int gravity,
MetaRectangle requested_rect,
@@ -176,5 +189,7 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
window_class->manage = meta_window_wayland_manage;
window_class->unmanage = meta_window_wayland_unmanage;
+ window_class->delete = meta_window_wayland_delete;
+ window_class->kill = meta_window_wayland_kill;
window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
}
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 86491a6..e95fdec 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -323,6 +323,59 @@ meta_window_x11_unmanage (MetaWindow *window)
}
static void
+meta_window_x11_delete (MetaWindow *window,
+ guint32 timestamp)
+{
+ meta_error_trap_push (window->display);
+ if (window->delete_window)
+ {
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Deleting %s with delete_window request\n",
+ window->desc);
+ meta_window_send_icccm_message (window,
+ window->display->atom_WM_DELETE_WINDOW,
+ timestamp);
+ }
+ else
+ {
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Deleting %s with explicit kill\n",
+ window->desc);
+ XKillClient (window->display->xdisplay, window->xwindow);
+ }
+ meta_error_trap_pop (window->display);
+}
+
+static void
+meta_window_x11_kill (MetaWindow *window)
+{
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Killing %s brutally\n",
+ window->desc);
+
+ if (!meta_window_is_remote (window) &&
+ window->net_wm_pid > 0)
+ {
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Killing %s with kill()\n",
+ window->desc);
+
+ if (kill (window->net_wm_pid, 9) < 0)
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Failed to signal %s: %s\n",
+ window->desc, strerror (errno));
+ }
+
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Disconnecting %s with XKillClient()\n",
+ window->desc);
+
+ meta_error_trap_push (window->display);
+ XKillClient (window->display->xdisplay, window->xwindow);
+ meta_error_trap_pop (window->display);
+}
+
+static void
update_net_frame_extents (MetaWindow *window)
{
unsigned long data[4];
@@ -744,6 +797,8 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
window_class->manage = meta_window_x11_manage;
window_class->unmanage = meta_window_x11_unmanage;
+ window_class->delete = meta_window_x11_delete;
+ window_class->kill = meta_window_x11_kill;
window_class->move_resize_internal = meta_window_x11_move_resize_internal;
window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]