Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-11-12 09:35:17 +0300
committerCampbell Barton <campbell@blender.org>2022-11-12 09:35:17 +0300
commita582abd92337c7901a7315c4e688b149415b79c6 (patch)
treed54a357c57f38da8c84a99e6abd74c0f7786c961
parent436e6dca242cedcc53655609248c04fdea2cd89b (diff)
Cleanup: add a system reference to the wayland window
Avoid relying on GHOST_ISystem::getSystem(), store the system instead.
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.cpp8
1 files changed, 5 insertions, 3 deletions
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));
}