mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-25 21:08:11 +00:00
Fixing scaled mouse movement
This commit is contained in:
parent
f715034fc4
commit
8cb25792ba
1 changed files with 9 additions and 3 deletions
|
@ -58,6 +58,7 @@ struct AppState
|
||||||
bool cursorVisible;
|
bool cursorVisible;
|
||||||
bool haveCursorPos;
|
bool haveCursorPos;
|
||||||
float scaleX, scaleY;
|
float scaleX, scaleY;
|
||||||
|
float accX, accY;
|
||||||
|
|
||||||
const LG_Renderer * lgr ;
|
const LG_Renderer * lgr ;
|
||||||
void * lgrData;
|
void * lgrData;
|
||||||
|
@ -487,6 +488,7 @@ int eventFilter(void * userdata, SDL_Event * event)
|
||||||
x -= state.cursor.x;
|
x -= state.cursor.x;
|
||||||
y -= state.cursor.y;
|
y -= state.cursor.y;
|
||||||
realignGuest = false;
|
realignGuest = false;
|
||||||
|
state.accX = state.accY = 0;
|
||||||
|
|
||||||
if (!spice_mouse_motion(x, y))
|
if (!spice_mouse_motion(x, y))
|
||||||
DEBUG_ERROR("SDL_MOUSEMOTION: failed to send message");
|
DEBUG_ERROR("SDL_MOUSEMOTION: failed to send message");
|
||||||
|
@ -499,8 +501,12 @@ int eventFilter(void * userdata, SDL_Event * event)
|
||||||
{
|
{
|
||||||
if (params.scaleMouseInput)
|
if (params.scaleMouseInput)
|
||||||
{
|
{
|
||||||
x = (float)x * state.scaleX;
|
state.accX += (float)x * state.scaleX;
|
||||||
y = (float)y * state.scaleY;
|
state.accY += (float)y * state.scaleY;
|
||||||
|
x = floor(state.accX);
|
||||||
|
y = floor(state.accY);
|
||||||
|
state.accX -= x;
|
||||||
|
state.accY -= y;
|
||||||
}
|
}
|
||||||
if (!spice_mouse_motion(x, y))
|
if (!spice_mouse_motion(x, y))
|
||||||
{
|
{
|
||||||
|
@ -1530,4 +1536,4 @@ int main(int argc, char * argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue