forked from bartvdbraak/blender
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.
This commit is contained in:
parent
55e6aa77c4
commit
9b26e7d7ca
@ -405,19 +405,21 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
|||||||
window->getCursorGrabAccum(x_accum, y_accum);
|
window->getCursorGrabAccum(x_accum, y_accum);
|
||||||
|
|
||||||
if(x_new != xme.x_root || y_new != xme.y_root) {
|
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 */
|
setCursorPosition(x_new, y_new); /* wrap */
|
||||||
window->setCursorGrabAccum(x_accum + (xme.x_root - x_new), y_accum + (xme.y_root - y_new));
|
window->setCursorGrabAccum(x_accum + (xme.x_root - x_new), y_accum + (xme.y_root - y_new));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
g_event = new
|
g_event = new
|
||||||
GHOST_EventCursor(
|
GHOST_EventCursor(
|
||||||
getMilliSeconds(),
|
getMilliSeconds(),
|
||||||
GHOST_kEventCursorMove,
|
GHOST_kEventCursorMove,
|
||||||
window,
|
window,
|
||||||
xme.x_root + x_accum,
|
xme.x_root + x_accum,
|
||||||
xme.y_root + y_accum
|
xme.y_root + y_accum
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_event = new
|
g_event = new
|
||||||
|
@ -1419,6 +1419,13 @@ setWindowCursorGrab(
|
|||||||
setWindowCursorVisibility(true);
|
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 */
|
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
||||||
setCursorGrabAccum(0, 0);
|
setCursorGrabAccum(0, 0);
|
||||||
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
|
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
|
||||||
|
@ -169,7 +169,6 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
|
|||||||
* It helps not to get a stuck WM when hitting a breakpoint
|
* It helps not to get a stuck WM when hitting a breakpoint
|
||||||
* */
|
* */
|
||||||
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
|
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
|
||||||
int bounds_arr[4] = {-1, -1, -1, -1}; /* l/t/r/b */
|
|
||||||
|
|
||||||
if(hide) mode = GHOST_kGrabHide;
|
if(hide) mode = GHOST_kGrabHide;
|
||||||
else if(wrap) mode = GHOST_kGrabWrap;
|
else if(wrap) mode = GHOST_kGrabWrap;
|
||||||
|
Loading…
Reference in New Issue
Block a user