From e844f706fbc438e0f79c2162a3eeed34b8daa62b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Oct 2022 12:03:34 +1100 Subject: GHOST/Wayland: support device add/removal at runtime Keep the registry listener active at runtime, now plugging/unplugging monitors at run-time is detected and the associated data stored by Blender is added/removed as well. Previously all interfaces were detected at startup, afterwards no changes were supported. --- intern/ghost/intern/GHOST_SystemWayland.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 4e3689ddfc2..90f975ed29c 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -776,6 +776,7 @@ struct GWL_Display { /** Registry entries, kept to allow removal at run-time. */ struct GWL_RegistryEntry *registry_entry = nullptr; + struct wl_registry *wl_registry = nullptr; struct wl_display *wl_display = nullptr; struct wl_compositor *wl_compositor = nullptr; @@ -805,6 +806,9 @@ struct GWL_Display { static void gwl_display_destroy(GWL_Display *display) { + wl_registry_destroy(display->wl_registry); + display->wl_registry = nullptr; + /* Unregister items in reverse order. */ gwl_registry_entry_remove_all(display); @@ -4803,6 +4807,7 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background) display_->registry_add_deferred = registry_add_table; struct wl_registry *registry = wl_display_get_registry(display_->wl_display); + display_->wl_registry = registry; wl_registry_add_listener(registry, ®istry_listener, display_); /* Call callback for registry listener. */ wl_display_roundtrip(display_->wl_display); @@ -4821,8 +4826,6 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background) delete reg_add; } } - - wl_registry_destroy(registry); } #ifdef WITH_GHOST_WAYLAND_LIBDECOR -- cgit v1.2.3