[mutter] delete: Share some code between X11 and wayland



commit e9944350d394b3d1668b5fd179a95137d4c5fbec
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Oct 8 17:32:27 2016 +0200

    delete: Share some code between X11 and wayland
    
    In order to kill a window, on both X11 and wayland we first try to
    kill(3) the corresponding process, so we can add the newly added
    get_client_pid() method to share that code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772613

 src/core/delete.c                 |   16 ++++++++++++++++
 src/wayland/meta-window-wayland.c |   18 ------------------
 src/x11/window-x11.c              |   17 -----------------
 3 files changed, 16 insertions(+), 35 deletions(-)
---
diff --git a/src/core/delete.c b/src/core/delete.c
index 141cd49..a6a0608 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -185,6 +185,22 @@ meta_window_delete (MetaWindow  *window,
 void
 meta_window_kill (MetaWindow *window)
 {
+  pid_t pid = meta_window_get_client_pid (window);
+
+  if (pid > 0)
+    {
+      meta_topic (META_DEBUG_WINDOW_OPS,
+                  "Killing %s with kill()\n",
+                  window->desc);
+
+      if (kill (pid, 9) == 0)
+        return;
+
+      meta_topic (META_DEBUG_WINDOW_OPS,
+                  "Failed to signal %s: %s\n",
+                  window->desc, strerror (errno));
+    }
+
   META_WINDOW_GET_CLASS (window)->kill (window);
 }
 
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index b74a8fa..1b3e090 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -106,24 +106,6 @@ meta_window_wayland_kill (MetaWindow *window)
 {
   MetaWaylandSurface *surface = window->surface;
   struct wl_resource *resource = surface->resource;
-  pid_t pid;
-  uid_t uid;
-  gid_t gid;
-
-  wl_client_get_credentials (wl_resource_get_client (resource), &pid, &uid, &gid);
-  if (pid > 0)
-    {
-      meta_topic (META_DEBUG_WINDOW_OPS,
-                  "Killing %s with kill()\n",
-                  window->desc);
-
-      if (kill (pid, 9) == 0)
-        return;
-
-      meta_topic (META_DEBUG_WINDOW_OPS,
-                  "Failed to signal %s: %s\n",
-                  window->desc, strerror (errno));
-    }
 
   /* Send the client an unrecoverable error to kill the client. */
   wl_resource_post_error (resource,
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index c8b9b04..376d73c 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -705,23 +705,6 @@ 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);
 


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