diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-26 04:03:34 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-26 04:11:44 +0300 |
commit | e844f706fbc438e0f79c2162a3eeed34b8daa62b (patch) | |
tree | 9469d4e307a4110b3445dd6ecf0db02cf77ca578 | |
parent | 9fe9705bc0af9d881905d75957c8dd467f8c8cb3 (diff) |
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.
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 7 |
1 files 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 |