[client] ds: detect when the cursor exits into an overlapping window

This adds a new method to the display server interface to allow the
application to notify the ds when there is a guest cursor position
update along with the translated local guest cursor position. This makes
it possible for the display server to keep the local cursor position in
sync with the guest cursor so that window leave events can be detected
when the cursor would move into an overlapping window.

Wayland currently just has a stub for this, and the X11 implementation
still needs some minor tweaking.
This commit is contained in:
Geoffrey McRae
2021-05-04 06:35:36 +10:00
parent cd56321e65
commit d0a12f6097
11 changed files with 122 additions and 54 deletions

View File

@@ -41,6 +41,11 @@ bool app_isRunning(void)
g_state.state == APP_STATE_RESTART;
}
bool app_isCaptureMode(void)
{
return g_cursor.grab;
}
void app_updateCursorPos(double x, double y)
{
g_cursor.pos.x = x;

View File

@@ -326,6 +326,17 @@ void core_stopFrameThread(void)
g_state.frameThread = NULL;
}
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);
}
void core_handleMouseGrabbed(double ex, double ey)
{
if (!core_inputEnabled())

View File

@@ -32,6 +32,7 @@ void core_alignToGuest(void);
bool core_isValidPointerPos(int x, int y);
bool core_startFrameThread(void);
void core_stopFrameThread(void);
void core_handleGuestMouseUpdate(void);
void core_handleMouseGrabbed(double ex, double ey);
void core_handleMouseNormal(double ex, double ey);

View File

@@ -306,6 +306,9 @@ static int cursorThread(void * unused)
core_alignToGuest();
app_resyncMouseBasic();
}
// tell the DS there was an update
core_handleGuestMouseUpdate();
}
lgmpClientMessageDone(queue);