[client] spice: refactor g_cursor.last to g_cursor.pos

This commit is contained in:
Geoffrey McRae 2021-01-07 02:16:55 +11:00
parent 026251cfd9
commit d6bb518992
2 changed files with 12 additions and 12 deletions

View File

@ -793,8 +793,8 @@ static void warpMouse(int x, int y, bool disable)
g_cursor.warpState = WARP_STATE_OFF; g_cursor.warpState = WARP_STATE_OFF;
struct WarpInfo * warp = malloc(sizeof(struct WarpInfo)); struct WarpInfo * warp = malloc(sizeof(struct WarpInfo));
warp->x = g_cursor.last.x; warp->x = g_cursor.pos.x;
warp->y = g_cursor.last.y; warp->y = g_cursor.pos.y;
if (g_state.wminfo.subsystem == SDL_SYSWM_X11) if (g_state.wminfo.subsystem == SDL_SYSWM_X11)
{ {
@ -841,8 +841,8 @@ static void handleMouseMoveEvent(int ex, int ey)
/* calculate the relative movement */ /* calculate the relative movement */
SDL_Point delta = { SDL_Point delta = {
.x = ex - g_cursor.last.x, .x = ex - g_cursor.pos.x,
.y = ey - g_cursor.last.y .y = ey - g_cursor.pos.y
}; };
if (delta.x == 0 && delta.y == 0) if (delta.x == 0 && delta.y == 0)
@ -850,8 +850,8 @@ static void handleMouseMoveEvent(int ex, int ey)
g_cursor.delta.x += delta.x; g_cursor.delta.x += delta.x;
g_cursor.delta.y += delta.y; g_cursor.delta.y += delta.y;
g_cursor.last.x = ex; g_cursor.pos.x = ex;
g_cursor.last.y = ey; g_cursor.pos.y = ey;
/* if we don't have the current cursor pos just send cursor movements */ /* if we don't have the current cursor pos just send cursor movements */
if (!g_cursor.guest.valid) if (!g_cursor.guest.valid)
@ -1079,8 +1079,8 @@ static void processWarp(int x, int y)
ll_shift(g_cursor.warpList, NULL); ll_shift(g_cursor.warpList, NULL);
g_cursor.last.x = x + (warp->x - g_cursor.last.x); g_cursor.pos.x = x + (warp->x - g_cursor.pos.x);
g_cursor.last.y = y + (warp->y - g_cursor.last.y); g_cursor.pos.y = y + (warp->y - g_cursor.pos.y);
free(warp); free(warp);
if (ll_count(g_cursor.warpList) == 0 && g_cursor.inWindow) if (ll_count(g_cursor.warpList) == 0 && g_cursor.inWindow)
@ -1096,8 +1096,8 @@ static void processXWarp(const XEvent xe, int x, int y)
ll_shift(g_cursor.warpList, NULL); ll_shift(g_cursor.warpList, NULL);
g_cursor.last.x = x + (warp->x - g_cursor.last.x); g_cursor.pos.x = x + (warp->x - g_cursor.pos.x);
g_cursor.last.y = y + (warp->y - g_cursor.last.y); g_cursor.pos.y = y + (warp->y - g_cursor.pos.y);
free(warp); free(warp);
if (ll_count(g_cursor.warpList) == 0 && g_cursor.inWindow) if (ll_count(g_cursor.warpList) == 0 && g_cursor.inWindow)

View File

@ -207,8 +207,8 @@ struct CursorState
/* the error accumulators */ /* the error accumulators */
float accX, accY; float accX, accY;
/* the last local X & Y positions */ /* the local X & Y position */
SDL_Point last; SDL_Point pos;
/* the delta since the last warp to CX/CY */ /* the delta since the last warp to CX/CY */
SDL_Point delta; SDL_Point delta;