mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] spice: don't scale mouse if it's 1:1
This commit is contained in:
parent
3df23d6b73
commit
c5befbba0e
@ -82,6 +82,7 @@ static void alignMouseWithHost();
|
||||
static void lgInit()
|
||||
{
|
||||
state.state = APP_STATE_RUNNING;
|
||||
state.scale = false;
|
||||
state.scaleX = 1.0f;
|
||||
state.scaleY = 1.0f;
|
||||
state.resizeDone = true;
|
||||
@ -151,6 +152,10 @@ static void updatePositionInfo()
|
||||
}
|
||||
state.dstRect.valid = true;
|
||||
|
||||
state.scale = (
|
||||
state.srcSize.y != state.dstRect.h ||
|
||||
state.srcSize.x != state.dstRect.w);
|
||||
|
||||
state.scaleX = (float)state.srcSize.y / (float)state.dstRect.h;
|
||||
state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w;
|
||||
}
|
||||
@ -856,7 +861,7 @@ static void handleMouseMoveEvent(int ex, int ey)
|
||||
state.drawCursor = true;
|
||||
}
|
||||
|
||||
if (params.scaleMouseInput && !state.grabMouse)
|
||||
if (state.scale && params.scaleMouseInput && !state.grabMouse)
|
||||
{
|
||||
state.accX += (float)delta.x * state.scaleX;
|
||||
state.accY += (float)delta.y * state.scaleY;
|
||||
@ -931,8 +936,12 @@ static void alignMouseWithHost()
|
||||
if (!state.haveCursorPos)
|
||||
return;
|
||||
|
||||
const int dx = round((state.curLocalX - state.dstRect.x) * state.scaleX) - state.cursor.x;
|
||||
const int dy = round((state.curLocalY - state.dstRect.y) * state.scaleY) - state.cursor.y;
|
||||
const int dx = round((state.curLocalX - state.dstRect.x) * state.scaleX) -
|
||||
state.cursor.x;
|
||||
|
||||
const int dy = round((state.curLocalY - state.dstRect.y) * state.scaleY) -
|
||||
state.cursor.y;
|
||||
|
||||
spice_mouse_motion(dx, dy);
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ struct AppState
|
||||
bool cursorInView;
|
||||
bool updateCursor;
|
||||
bool initialCursorSync;
|
||||
bool scale;
|
||||
float scaleX, scaleY;
|
||||
float accX, accY;
|
||||
int curLastX;
|
||||
|
Loading…
Reference in New Issue
Block a user