mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 05:53:40 +00:00
[client] spice: adjust ordering to avoid dropping mouse input events
This commit is contained in:
parent
c5befbba0e
commit
265b4544ef
@ -795,16 +795,6 @@ static void warpMouse(int x, int y)
|
||||
|
||||
static void handleMouseMoveEvent(int ex, int ey)
|
||||
{
|
||||
if (!state.cursorInWindow)
|
||||
return;
|
||||
|
||||
if (state.ignoreInput || !params.useSpiceInput)
|
||||
return;
|
||||
|
||||
state.curLocalX = ex;
|
||||
state.curLocalY = ey;
|
||||
state.haveCurLocal = true;
|
||||
|
||||
SDL_Point delta = {
|
||||
.x = ex - state.curLastX,
|
||||
.y = ey - state.curLastY
|
||||
@ -813,8 +803,9 @@ static void handleMouseMoveEvent(int ex, int ey)
|
||||
if (delta.x == 0 && delta.y == 0)
|
||||
return;
|
||||
|
||||
state.curLastX = ex;
|
||||
state.curLastY = ey;
|
||||
state.curLastX = state.curLocalX = ex;
|
||||
state.curLastY = state.curLocalX = ey;
|
||||
state.haveCurLocal = true;
|
||||
|
||||
if (state.warpState == WARP_STATE_ACTIVE &&
|
||||
ex == state.warpToX && ey == state.warpToY)
|
||||
@ -823,21 +814,20 @@ static void handleMouseMoveEvent(int ex, int ey)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.cursorInWindow)
|
||||
if (!state.cursorInWindow || state.ignoreInput || !params.useSpiceInput)
|
||||
return;
|
||||
|
||||
/* if we don't have the current cursor pos just send cursor movements */
|
||||
if (!state.haveCursorPos)
|
||||
{
|
||||
state.cursorInView = true;
|
||||
spice_mouse_motion(delta.x, delta.y);
|
||||
if ((state.haveCursorPos || state.grabMouse) &&
|
||||
(ex < 100 || ex > state.windowW - 100 ||
|
||||
ey < 100 || ey > state.windowH - 100))
|
||||
{
|
||||
warpMouse(state.windowW / 2, state.windowH / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
/* if we don't have the current cursor pos just send cursor movements */
|
||||
if (!state.haveCursorPos)
|
||||
{
|
||||
spice_mouse_motion(delta.x, delta.y);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -851,7 +841,6 @@ static void handleMouseMoveEvent(int ex, int ey)
|
||||
|
||||
if (params.useSpiceInput && !params.alwaysShowCursor)
|
||||
state.drawCursor = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.cursorInView)
|
||||
@ -881,6 +870,14 @@ static void handleMouseMoveEvent(int ex, int ey)
|
||||
state.sensY -= delta.y;
|
||||
}
|
||||
|
||||
if ((state.haveCursorPos || state.grabMouse) &&
|
||||
(ex < 100 || ex > state.windowW - 100 ||
|
||||
ey < 100 || ey > state.windowH - 100))
|
||||
{
|
||||
warpMouse(state.windowW / 2, state.windowH / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.grabMouse && state.warpState == WARP_STATE_ON)
|
||||
{
|
||||
/* check if the movement would exit the window */
|
||||
|
Loading…
Reference in New Issue
Block a user