[client] spice: fix mouse warp on window focus

This commit is contained in:
Geoffrey McRae 2021-01-03 22:59:23 +11:00
parent 3b580af194
commit 5323d9833a
2 changed files with 12 additions and 9 deletions

View File

@ -816,8 +816,8 @@ static void handleMouseMoveEvent(int ex, int ey)
if (delta.x == 0 && delta.y == 0) if (delta.x == 0 && delta.y == 0)
return; return;
state.curLastX = state.curLocalX = ex; state.curLastX = ex;
state.curLastY = state.curLocalY = ey; state.curLastY = ey;
state.haveCurLocal = true; state.haveCurLocal = true;
if (state.warpState == WARP_STATE_ACTIVE && if (state.warpState == WARP_STATE_ACTIVE &&
@ -992,7 +992,6 @@ static void handleWindowLeave()
static void handleWindowEnter() static void handleWindowEnter()
{ {
state.cursorInWindow = true; state.cursorInWindow = true;
return;
if (state.warpState == WARP_STATE_OFF) if (state.warpState == WARP_STATE_OFF)
state.warpState = WARP_STATE_ON; state.warpState = WARP_STATE_ON;
@ -1103,15 +1102,21 @@ int eventFilter(void * userdata, SDL_Event * event)
break; break;
case EnterNotify: case EnterNotify:
state.curLocalX = xe.xcrossing.x; if (xe.xcrossing.detail != NotifyNonlinear)
state.curLocalY = xe.xcrossing.y; break;
state.curLastX = xe.xcrossing.x;
state.curLastY = xe.xcrossing.y;
state.haveCurLocal = true; state.haveCurLocal = true;
handleWindowEnter(); handleWindowEnter();
break; break;
case LeaveNotify: case LeaveNotify:
state.curLocalX = xe.xcrossing.x; if (xe.xcrossing.detail != NotifyNonlinear)
state.curLocalY = xe.xcrossing.y; break;
state.curLastX = xe.xcrossing.x;
state.curLastY = xe.xcrossing.y;
state.haveCurLocal = true; state.haveCurLocal = true;
handleWindowLeave(); handleWindowLeave();
break; break;

View File

@ -82,8 +82,6 @@ struct AppState
int curLastX; int curLastX;
int curLastY; int curLastY;
bool haveCurLocal; bool haveCurLocal;
int curLocalX;
int curLocalY;
bool haveAligned; bool haveAligned;
enum WarpState warpState; enum WarpState warpState;