[Bf-blender-cvs] [a582abd9233] blender-v3.4-release: Cleanup: add a system reference to the wayland window

Campbell Barton noreply at git.blender.org
Sat Nov 12 07:36:17 CET 2022


Commit: a582abd92337c7901a7315c4e688b149415b79c6
Author: Campbell Barton
Date:   Sat Nov 12 17:35:17 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBa582abd92337c7901a7315c4e688b149415b79c6

Cleanup: add a system reference to the wayland window

Avoid relying on GHOST_ISystem::getSystem(), store the system instead.

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

M	intern/ghost/intern/GHOST_WindowWayland.cpp

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

diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 942cb02dd4f..ef53f6a02e6 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -83,6 +83,7 @@ static void gwl_xdg_decor_window_destroy(WGL_XDG_Decor_Window *decor)
 
 struct GWL_Window {
   GHOST_WindowWayland *ghost_window = nullptr;
+  GHOST_SystemWayland *ghost_system = nullptr;
   struct wl_surface *wl_surface = nullptr;
   /**
    * Outputs on which the window is currently shown on.
@@ -389,7 +390,7 @@ static void frame_handle_configure(struct libdecor_frame *frame,
   win->is_maximised = window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED;
   win->is_fullscreen = window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN;
 
-  GHOST_SystemWayland *system = static_cast<GHOST_SystemWayland *>(GHOST_ISystem::getSystem());
+  GHOST_SystemWayland *system = win->ghost_system;
   const bool is_active_prev_ghost = (win->ghost_window ==
                                      system->getWindowManager()->getActiveWindow());
   win->is_active = window_state & LIBDECOR_WINDOW_STATE_ACTIVE;
@@ -500,7 +501,7 @@ static void xdg_surface_handle_configure(void *data,
     win->ghost_window->notify_size();
   }
 
-  GHOST_SystemWayland *system = static_cast<GHOST_SystemWayland *>(GHOST_ISystem::getSystem());
+  GHOST_SystemWayland *system = win->ghost_system;
   const bool is_active_prev_ghost = (win->ghost_window ==
                                      system->getWindowManager()->getActiveWindow());
   if (is_active_prev_ghost != win->is_active) {
@@ -606,6 +607,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
   }
 
   window_->ghost_window = this;
+  window_->ghost_system = system;
 
   window_->size[0] = int32_t(width);
   window_->size[1] = int32_t(height);
@@ -1125,7 +1127,7 @@ bool GHOST_WindowWayland::outputs_changed_update_scale()
 
     /* As this is a low-level function, we might want adding this event to be optional,
      * always add the event unless it causes issues. */
-    GHOST_System *system = (GHOST_System *)GHOST_ISystem::getSystem();
+    GHOST_SystemWayland *system = window_->ghost_system;
     system->pushEvent(
         new GHOST_Event(system->getMilliSeconds(), GHOST_kEventWindowDPIHintChanged, this));
   }



More information about the Bf-blender-cvs mailing list