mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
wayland: Add tracking of X11 windows
This is unused ATM, but will be used to check whether it is safe to shut Xwayland down. https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
This commit is contained in:
parent
319f7f5b63
commit
f5a2694eba
@ -58,6 +58,8 @@ typedef struct
|
||||
GSubprocess *proc;
|
||||
GMainLoop *init_loop;
|
||||
|
||||
GList *x11_windows;
|
||||
|
||||
MetaXWaylandDnd *dnd;
|
||||
} MetaXWaylandManager;
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "compositor/meta-window-actor-private.h"
|
||||
#include "meta/main.h"
|
||||
#include "wayland/meta-wayland-actor-surface.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -620,6 +621,31 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
window_unmanaged_cb (MetaWindow *window,
|
||||
MetaXWaylandManager *manager)
|
||||
{
|
||||
manager->x11_windows = g_list_remove (manager->x11_windows, window);
|
||||
g_signal_handlers_disconnect_by_func (window,
|
||||
window_unmanaged_cb,
|
||||
manager);
|
||||
}
|
||||
|
||||
static void
|
||||
window_created_cb (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
MetaXWaylandManager *manager)
|
||||
{
|
||||
/* Ignore all internal windows */
|
||||
if (!window->xwindow ||
|
||||
meta_window_get_client_pid (window) == getpid ())
|
||||
return;
|
||||
|
||||
manager->x11_windows = g_list_prepend (manager->x11_windows, window);
|
||||
g_signal_connect (window, "unmanaged",
|
||||
G_CALLBACK (window_unmanaged_cb), manager);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_xwayland_init (MetaXWaylandManager *manager,
|
||||
struct wl_display *wl_display)
|
||||
@ -647,6 +673,9 @@ on_x11_display_closing (MetaDisplay *display)
|
||||
void
|
||||
meta_xwayland_complete_init (MetaDisplay *display)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
|
||||
/* We install an X IO error handler in addition to the child watch,
|
||||
because after Xlib connects our child watch may not be called soon
|
||||
enough, and therefore we won't crash when X exits (and most important
|
||||
@ -657,6 +686,9 @@ meta_xwayland_complete_init (MetaDisplay *display)
|
||||
g_signal_connect (display, "x11-display-closing",
|
||||
G_CALLBACK (on_x11_display_closing), NULL);
|
||||
meta_xwayland_init_dnd ();
|
||||
|
||||
g_signal_connect (meta_get_display (), "window-created",
|
||||
G_CALLBACK (window_created_cb), manager);
|
||||
}
|
||||
|
||||
void
|
||||
@ -664,6 +696,10 @@ meta_xwayland_shutdown (MetaXWaylandManager *manager)
|
||||
{
|
||||
char path[256];
|
||||
|
||||
g_signal_handlers_disconnect_by_func (meta_get_display (),
|
||||
window_created_cb,
|
||||
manager);
|
||||
|
||||
g_cancellable_cancel (manager->xserver_died_cancellable);
|
||||
g_clear_object (&manager->proc);
|
||||
g_clear_object (&manager->xserver_died_cancellable);
|
||||
|
Loading…
Reference in New Issue
Block a user