diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-18 13:55:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-18 13:55:39 +0400 |
commit | 9b26e7d7caca6834d7d70430993d1bb715695292 (patch) | |
tree | dfdb51529ed67ff3daeaec5356a487b4bb84dfad /intern | |
parent | 55e6aa77c4fa014730096f2debba2cb979a0f9de (diff) |
minor changes to x11 cursor grab wrapping
- when wrapping 2 mouse events were added.
- on release blender still had the last event (possibly outside the screen), where menus would fail to show. Add a mouse event by calling XWarpPointer with no movement when leaving grab.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 22 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 7 |
2 files changed, 19 insertions, 10 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 774fd025b85..ff4a5956a12 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -405,19 +405,21 @@ GHOST_SystemX11::processEvent(XEvent *xe) window->getCursorGrabAccum(x_accum, y_accum); if(x_new != xme.x_root || y_new != xme.y_root) { + /* when wrapping we don't need to add an event because the + * setCursorPosition call will cause a new event after */ setCursorPosition(x_new, y_new); /* wrap */ window->setCursorGrabAccum(x_accum + (xme.x_root - x_new), y_accum + (xme.y_root - y_new)); } - - g_event = new - GHOST_EventCursor( - getMilliSeconds(), - GHOST_kEventCursorMove, - window, - xme.x_root + x_accum, - xme.y_root + y_accum - ); - + else { + g_event = new + GHOST_EventCursor( + getMilliSeconds(), + GHOST_kEventCursorMove, + window, + xme.x_root + x_accum, + xme.y_root + y_accum + ); + } } else { g_event = new diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index dba1be1b862..95441e74771 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -1419,6 +1419,13 @@ setWindowCursorGrab( setWindowCursorVisibility(true); } + if(m_cursorGrab != GHOST_kGrabNormal) { + /* use to generate a mouse move event, otherwise the last event + * blender gets can be outside the screen causing menus not to show + * properly unless the user moves the mouse */ + XWarpPointer(m_display,None,None,0,0,0,0,0,0); + } + /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */ setCursorGrabAccum(0, 0); m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */ |