diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-07 09:29:19 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-07-07 09:36:46 +0300 |
commit | 843ad51d18c80f4122baab47454d09383ae365c3 (patch) | |
tree | 239533c8e52d2ebc9aa521ba7c8af13f0fe6080c /intern/ghost/intern/GHOST_WindowWayland.cpp | |
parent | 34c701abbdbfa6143c11e1b6f8d7797257c70237 (diff) |
Cleanup: use arguments for internal wayland cursor grabbing
Pass in arguments for internal grab logic instead of accessing
some values from the window and other values as arguments.
While more verbose it's simpler to reason about.
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowWayland.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWayland.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index 77eddbb13a5..a04ff23a1a1 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -501,7 +501,21 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mode) { - if (m_system->window_cursor_grab_set(mode, m_cursorGrab, m_cursorGrabInitPos, w->wl_surface)) { + GHOST_Rect bounds_buf; + GHOST_Rect *bounds = nullptr; + if (m_cursorGrab == GHOST_kGrabWrap) { + if (getCursorGrabBounds(bounds_buf) == GHOST_kFailure) { + getClientBounds(bounds_buf); + } + bounds = &bounds_buf; + } + if (m_system->window_cursor_grab_set(mode, + m_cursorGrab, + m_cursorGrabInitPos, + bounds, + m_cursorGrabAxis, + w->wl_surface, + w->scale)) { return GHOST_kSuccess; } return GHOST_kFailure; |