[mutter/gnome-41] xwayland: Add API to send signal to the Xwayland process



commit 89d182300130e338531ca82e7f25d94bcf0f7bd8
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Apr 5 23:46:42 2022 +0200

    xwayland: Add API to send signal to the Xwayland process
    
    Will be used for test cases to fake-crash the Xwayland process.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>

 src/wayland/meta-xwayland.c | 16 ++++++++++++++++
 src/wayland/meta-xwayland.h |  5 +++++
 2 files changed, 21 insertions(+)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 9f1fac333d..4cdc5616f2 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -1420,3 +1420,19 @@ meta_xwayland_handle_xevent (XEvent *event)
 
   return FALSE;
 }
+
+gboolean
+meta_xwayland_signal (MetaXWaylandManager  *manager,
+                      int                   signum,
+                      GError              **error)
+{
+  if (!manager->proc)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Can't send signal, Xwayland not running");
+      return FALSE;
+    }
+
+  g_subprocess_send_signal (manager->proc, signum);
+  return TRUE;
+}
diff --git a/src/wayland/meta-xwayland.h b/src/wayland/meta-xwayland.h
index dac9c689f0..cbe27b1837 100644
--- a/src/wayland/meta-xwayland.h
+++ b/src/wayland/meta-xwayland.h
@@ -50,4 +50,9 @@ void
 meta_xwayland_associate_window_with_surface (MetaWindow          *window,
                                              MetaWaylandSurface  *surface);
 
+META_EXPORT_TEST
+gboolean meta_xwayland_signal (MetaXWaylandManager  *manager,
+                               int                   signum,
+                               GError              **error);
+
 #endif /* META_XWAYLAND_H */


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