mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +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()
|
static void lgInit()
|
||||||
{
|
{
|
||||||
state.state = APP_STATE_RUNNING;
|
state.state = APP_STATE_RUNNING;
|
||||||
|
state.scale = false;
|
||||||
state.scaleX = 1.0f;
|
state.scaleX = 1.0f;
|
||||||
state.scaleY = 1.0f;
|
state.scaleY = 1.0f;
|
||||||
state.resizeDone = true;
|
state.resizeDone = true;
|
||||||
@ -151,6 +152,10 @@ static void updatePositionInfo()
|
|||||||
}
|
}
|
||||||
state.dstRect.valid = true;
|
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.scaleX = (float)state.srcSize.y / (float)state.dstRect.h;
|
||||||
state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w;
|
state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w;
|
||||||
}
|
}
|
||||||
@ -856,7 +861,7 @@ static void handleMouseMoveEvent(int ex, int ey)
|
|||||||
state.drawCursor = true;
|
state.drawCursor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.scaleMouseInput && !state.grabMouse)
|
if (state.scale && params.scaleMouseInput && !state.grabMouse)
|
||||||
{
|
{
|
||||||
state.accX += (float)delta.x * state.scaleX;
|
state.accX += (float)delta.x * state.scaleX;
|
||||||
state.accY += (float)delta.y * state.scaleY;
|
state.accY += (float)delta.y * state.scaleY;
|
||||||
@ -931,8 +936,12 @@ static void alignMouseWithHost()
|
|||||||
if (!state.haveCursorPos)
|
if (!state.haveCursorPos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int dx = round((state.curLocalX - state.dstRect.x) * state.scaleX) - state.cursor.x;
|
const int dx = round((state.curLocalX - state.dstRect.x) * state.scaleX) -
|
||||||
const int dy = round((state.curLocalY - state.dstRect.y) * state.scaleY) - state.cursor.y;
|
state.cursor.x;
|
||||||
|
|
||||||
|
const int dy = round((state.curLocalY - state.dstRect.y) * state.scaleY) -
|
||||||
|
state.cursor.y;
|
||||||
|
|
||||||
spice_mouse_motion(dx, dy);
|
spice_mouse_motion(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ struct AppState
|
|||||||
bool cursorInView;
|
bool cursorInView;
|
||||||
bool updateCursor;
|
bool updateCursor;
|
||||||
bool initialCursorSync;
|
bool initialCursorSync;
|
||||||
|
bool scale;
|
||||||
float scaleX, scaleY;
|
float scaleX, scaleY;
|
||||||
float accX, accY;
|
float accX, accY;
|
||||||
int curLastX;
|
int curLastX;
|
||||||
|
Loading…
Reference in New Issue
Block a user