mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-04 01:34:13 +00:00
[all] update KVMFR to provide cursor hotspot information
This commit bumps the KVMFR protocol version as it adds additional hotspot x & y fields to the KVMFRCursor struct. This corrects the issue of invalid alignment of the local mouse when the shape has an offset such as the 'I' beam.
This commit is contained in:
@@ -328,6 +328,9 @@ static int cursorThread(void * unused)
|
||||
continue;
|
||||
}
|
||||
|
||||
state.cursor.hx = cursor->hx;
|
||||
state.cursor.hy = cursor->hy;
|
||||
|
||||
const uint8_t * data = (const uint8_t *)(cursor + 1);
|
||||
if (!state.lgr->on_mouse_shape(
|
||||
state.lgrData,
|
||||
@@ -760,8 +763,8 @@ static void alignMouseWithGuest()
|
||||
if (state.ignoreInput || !params.useSpiceInput)
|
||||
return;
|
||||
|
||||
state.curLastX = (int)round((float)state.cursor.x / state.scaleX) + state.dstRect.x;
|
||||
state.curLastY = (int)round((float)state.cursor.y / state.scaleY) + state.dstRect.y;
|
||||
state.curLastX = (int)round((float)(state.cursor.x + state.cursor.hx) / state.scaleX) + state.dstRect.x;
|
||||
state.curLastY = (int)round((float)(state.cursor.y + state.cursor.hy) / state.scaleY) + state.dstRect.y;
|
||||
SDL_WarpMouseInWindow(state.window, state.curLastX, state.curLastY);
|
||||
}
|
||||
|
||||
@@ -773,8 +776,8 @@ static void alignMouseWithHost()
|
||||
if (!state.haveCursorPos || state.serverMode)
|
||||
return;
|
||||
|
||||
state.curLastX = (int)round((float)state.cursor.x / state.scaleX) + state.dstRect.x;
|
||||
state.curLastY = (int)round((float)state.cursor.y / state.scaleY) + state.dstRect.y;
|
||||
state.curLastX = (int)round((float)(state.cursor.x + state.cursor.hx) / state.scaleX) + state.dstRect.x;
|
||||
state.curLastY = (int)round((float)(state.cursor.y + state.cursor.hy) / state.scaleY) + state.dstRect.y;
|
||||
handleMouseMoveEvent(state.curLocalX, state.curLocalY);
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,12 @@ enum RunState
|
||||
APP_STATE_SHUTDOWN
|
||||
};
|
||||
|
||||
struct CursorInfo
|
||||
{
|
||||
int x , y;
|
||||
int hx, hy;
|
||||
};
|
||||
|
||||
struct AppState
|
||||
{
|
||||
enum RunState state;
|
||||
@@ -49,7 +55,7 @@ struct AppState
|
||||
int windowW, windowH;
|
||||
SDL_Point srcSize;
|
||||
LG_RendererRect dstRect;
|
||||
SDL_Point cursor;
|
||||
struct CursorInfo cursor;
|
||||
bool cursorVisible;
|
||||
|
||||
bool serverMode;
|
||||
|
Reference in New Issue
Block a user