diff options
author | Sebastiano Barrera <bars> | 2022-07-21 19:51:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-07-21 20:02:03 +0300 |
commit | a5c2d0018cd9a5844d618aaed21f64f11f35a97a (patch) | |
tree | 1c043439e237e4c1f657ab6731fb073d615a52c6 /intern/ghost | |
parent | 611be46cc9443c673fb1517de3ebae53bdedd4f4 (diff) |
Fix T91932: number sliders wrap around when dragged for long distance on X11
The value of number sliders (e.g. the "end frame" button) wrap around to
their pre-click value when dragging them for a very long distance (e.g.
by lifting the mouse off the desk and placing it back on to keep
dragging in the same direction).
The problem is X11-specific, and due to XTranslateCoordinates using a
signed int16 behind the curtains, while its signature and the rest of
Blender uses int32. The solution is to only use XTranslateCoordinates on
(0, 0) to get the delta between the screen and client reference systems,
and applying the delta in a second step.
Differential Revision: https://developer.blender.org/D15507
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 01045c516c1..2276e90387b 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -658,15 +658,15 @@ GHOST_TSuccess GHOST_WindowX11::setClientSize(uint32_t width, uint32_t height) void GHOST_WindowX11::screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const { - /* This is correct! */ - int ax, ay; Window temp; + /* Use (0, 0) instead of (inX, inY) to work around overflow of signed int16 in + * the implementation of this function. */ XTranslateCoordinates( - m_display, RootWindow(m_display, m_visualInfo->screen), m_window, inX, inY, &ax, &ay, &temp); - outX = ax; - outY = ay; + m_display, RootWindow(m_display, m_visualInfo->screen), m_window, 0, 0, &ax, &ay, &temp); + outX = ax + inX; + outY = ay + inY; } void GHOST_WindowX11::clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const |