[Bf-blender-cvs] [33fa053fe8c] blender-v3.4-release: GHOST/Wayland: add missing lock in setWindowCursorShape
Campbell Barton
noreply at git.blender.org
Wed Nov 16 11:36:41 CET 2022
Commit: 33fa053fe8c229be8218679e765626ab4f2a140b
Author: Campbell Barton
Date: Wed Nov 16 21:16:38 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB33fa053fe8c229be8218679e765626ab4f2a140b
GHOST/Wayland: add missing lock in setWindowCursorShape
Also add some comments for locking.
===================================================================
M intern/ghost/intern/GHOST_SystemWayland.cpp
M intern/ghost/intern/GHOST_WindowWayland.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 97cf9d1bee0..285fbbd3b6c 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2595,7 +2595,7 @@ static void pointer_handle_enter(void *data,
seat->system->seat_active_set(seat);
- win->setCursorShape(win->getCursorShape());
+ seat->system->cursor_shape_set(win->getCursorShape());
const wl_fixed_t scale = win->scale();
seat->system->pushEvent_maybe_pending(
@@ -3257,7 +3257,7 @@ static void tablet_tool_handle_proximity_in(void *data,
win->activate();
- win->setCursorShape(win->getCursorShape());
+ seat->system->cursor_shape_set(win->getCursorShape());
}
static void tablet_tool_handle_proximity_out(void *data,
struct zwp_tablet_tool_v2 * /*zwp_tablet_tool_v2*/)
@@ -3456,7 +3456,7 @@ static void tablet_tool_handle_frame(void *data,
wl_fixed_to_int(scale * seat->tablet.xy[1]),
tablet_tool->data));
if (tablet_tool->proximity == false) {
- win->setCursorShape(win->getCursorShape());
+ seat->system->cursor_shape_set(win->getCursorShape());
}
}
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 460fc99d27f..928e442abd6 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -966,6 +966,9 @@ GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mo
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorShape(GHOST_TStandardCursor shape)
{
+#ifdef USE_EVENT_BACKGROUND_THREAD
+ std::lock_guard lock_server_guard{*system_->server_mutex};
+#endif
const GHOST_TSuccess ok = system_->cursor_shape_set(shape);
m_cursorShape = (ok == GHOST_kSuccess) ? shape : GHOST_kStandardCursorDefault;
return ok;
@@ -1006,6 +1009,7 @@ void GHOST_WindowWayland::setTitle(const char *title)
std::string GHOST_WindowWayland::getTitle() const
{
+ /* No need to lock `server_mutex` (WAYLAND never changes this). */
return window_->title.empty() ? "untitled" : window_->title;
}
@@ -1016,6 +1020,7 @@ void GHOST_WindowWayland::getWindowBounds(GHOST_Rect &bounds) const
void GHOST_WindowWayland::getClientBounds(GHOST_Rect &bounds) const
{
+ /* No need to lock `server_mutex` (WAYLAND never changes this in a thread). */
bounds.set(0, 0, UNPACK2(window_->frame.size));
}
@@ -1098,6 +1103,9 @@ GHOST_WindowWayland::~GHOST_WindowWayland()
uint16_t GHOST_WindowWayland::getDPIHint()
{
+ /* No need to lock `server_mutex`
+ * (`outputs_changed_update_scale` never changes values in a non-main thread). */
+
/* Using the physical DPI will cause wrong scaling of the UI
* use a multiplier for the default DPI as a workaround. */
return wl_fixed_to_int(window_->scale_fractional * base_dpi);
More information about the Bf-blender-cvs
mailing list