diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-30 15:53:20 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-30 16:46:57 +0300 |
commit | 6bd2c6789b244a03bccdb254502567691c42b944 (patch) | |
tree | 264949e98f2d99a91e9a393c0cd3478ef1701a77 /intern/ghost/GHOST_ISystem.h | |
parent | df40e9d0aad0c2a5b649d99c25e991a3664501c5 (diff) |
GHOST: get/set cursor position now uses client instead of screen coords
Use client (window) relative coordinates for cursor position access,
this only moves the conversion from window-manager into GHOST,
(no functional changes).
This is needed for fix a bug in GHOST/Wayland which doesn't support
accessing absolute cursor coordinates & the window is needed to properly
access the cursor coordinates.
As it happens every caller to GHOST_GetCursorPosition was already making
the values window-relative, so there is little benefit in attempting to
workaround the problem on the Wayland side.
If needed the screen-space versions of functions can be exposed again.
Diffstat (limited to 'intern/ghost/GHOST_ISystem.h')
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index d7485975906..91cf1c4c558 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -365,6 +365,25 @@ class GHOST_ISystem { ***************************************************************************************/ /** + * Returns the current location of the cursor (location in window coordinates) + * \param x: The x-coordinate of the cursor. + * \param y: The y-coordinate of the cursor. + * \return Indication of success. + */ + virtual GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window, + int32_t &x, + int32_t &y) const = 0; + /** + * Updates the location of the cursor (location in window coordinates). + * \param x: The x-coordinate of the cursor. + * \param y: The y-coordinate of the cursor. + * \return Indication of success. + */ + virtual GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, + int32_t x, + int32_t y) = 0; + + /** * Returns the current location of the cursor (location in screen coordinates) * \param x: The x-coordinate of the cursor. * \param y: The y-coordinate of the cursor. |