[client] ds: avoid util_cursorToInt when warping pointer

Using util_cursorToInt messes with the error tracking for normal movements,
and is not necessary since we are computing an absolute position on the
client window.

Instead, we should pass doubles directly to display servers and let them
decide how to best handle them. For example, XIWarpPointer accepts doubles
directly.
This commit is contained in:
Quantum 2021-05-04 04:53:31 -04:00 committed by Geoffrey McRae
parent 71c9680245
commit 0f2fd84724
5 changed files with 10 additions and 10 deletions

View File

@ -459,10 +459,10 @@ void waylandRealignPointer(void)
app_resyncMouseBasic();
}
void waylandGuestPointerUpdated(double x, double y, int localX, int localY)
void waylandGuestPointerUpdated(double x, double y, double localX, double localY)
{
if (!wlWm.warpSupport || !wlWm.pointerInSurface || wlWm.lockedPointer)
return;
waylandWarpPointer(localX, localY, false);
waylandWarpPointer((int) localX, (int) localY, false);
}

View File

@ -230,7 +230,7 @@ void waylandCapturePointer(void);
void waylandUncapturePointer(void);
void waylandRealignPointer(void);
void waylandWarpPointer(int x, int y, bool exiting);
void waylandGuestPointerUpdated(double x, double y, int localX, int localY);
void waylandGuestPointerUpdated(double x, double y, double localX, double localY);
// output module
bool waylandOutputInit(void);

View File

@ -963,7 +963,7 @@ static void x11GLSwapBuffers(void)
}
#endif
static void x11GuestPointerUpdated(double x, double y, int localX, int localY)
static void x11GuestPointerUpdated(double x, double y, double localX, double localY)
{
if (app_isCaptureMode() || !x11.entered)
return;

View File

@ -129,7 +129,7 @@ struct LG_DisplayServerOps
#endif
/* dm specific cursor implementations */
void (*guestPointerUpdated)(double x, double y, int localX, int localY);
void (*guestPointerUpdated)(double x, double y, double localX, double localY);
void (*showPointer)(bool show);
void (*grabKeyboard)();
void (*ungrabKeyboard)();

View File

@ -318,13 +318,13 @@ void core_stopFrameThread(void)
void core_handleGuestMouseUpdate(void)
{
int x, y;
struct DoublePoint localPos;
util_guestCurToLocal(&localPos);
localPos.x = util_clamp(localPos.x, 0.0, g_state.dstRect.w);
localPos.y = util_clamp(localPos.y, 0.0, g_state.dstRect.h);
util_cursorToInt(localPos.x, localPos.y, &x, &y);
g_state.ds->guestPointerUpdated(g_cursor.guest.x, g_cursor.guest.y, x, y);
g_state.ds->guestPointerUpdated(
g_cursor.guest.x, g_cursor.guest.y,
util_clamp(localPos.x, 0.0, g_state.dstRect.w),
util_clamp(localPos.y, 0.0, g_state.dstRect.h)
);
}
void core_handleMouseGrabbed(double ex, double ey)