[client] spice: be more aggressive with window warp for high DPI mice

This commit is contained in:
Geoffrey McRae 2021-01-04 12:59:14 +11:00
parent 183d06f90c
commit 2bc767430c
2 changed files with 11 additions and 8 deletions

View File

@ -837,9 +837,9 @@ static void handleMouseMoveEvent(int ex, int ey)
{
g_cursor.inView = true;
spice_mouse_motion(delta.x, delta.y);
if (ex < 50 || ex > g_state.windowW - 50 ||
ey < 50 || ey > g_state.windowH - 50)
warpMouse(g_state.windowW / 2, g_state.windowH / 2);
if (ex < g_state.windowCX - 25 || ex > g_state.windowCX + 25 ||
ey < g_state.windowCY - 25 || ey > g_state.windowCY + 25)
warpMouse(g_state.windowCX, g_state.windowCY);
}
return;
@ -887,9 +887,9 @@ static void handleMouseMoveEvent(int ex, int ey)
}
else if (inView)
{
if (ex < g_state.dstRect.x + 50 || ex > g_state.dstRect.w - 50 ||
ey < g_state.dstRect.y + 50 || ey > g_state.dstRect.h - 50)
warpMouse(g_state.windowW / 2, g_state.windowH / 2);
if (ex < g_state.windowCX - 25 || ex > g_state.windowCX + 25 ||
ey < g_state.windowCY - 25 || ey > g_state.windowCY + 25)
warpMouse(g_state.windowCX, g_state.windowCY);
}
if (!inView)
@ -970,8 +970,10 @@ static void handleResizeEvent(unsigned int w, unsigned int h)
&g_state.border.w
);
g_state.windowW = w;
g_state.windowH = h;
g_state.windowW = w;
g_state.windowH = h;
g_state.windowCX = w / 2;
g_state.windowCY = h / 2;
updatePositionInfo();
}

View File

@ -49,6 +49,7 @@ struct AppState
bool haveSrcSize;
SDL_Point windowPos;
int windowW, windowH;
int windowCX, windowCY;
SDL_Rect border;
SDL_Point srcSize;
LG_RendererRect dstRect;