[Bf-blender-cvs] [e844f706fbc] master: GHOST/Wayland: support device add/removal at runtime

Campbell Barton noreply at git.blender.org
Wed Oct 26 03:20:25 CEST 2022


Commit: e844f706fbc438e0f79c2162a3eeed34b8daa62b
Author: Campbell Barton
Date:   Wed Oct 26 12:03:34 2022 +1100
Branches: master
https://developer.blender.org/rBe844f706fbc438e0f79c2162a3eeed34b8daa62b

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.

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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, &registry_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



More information about the Bf-blender-cvs mailing list