[client] mouse: correct issues with cursor alignment on enter/exit/focus

This commit is contained in:
Geoffrey McRae
2021-01-17 12:53:55 +11:00
parent 76182bbeb8
commit e23d536af5
5 changed files with 107 additions and 64 deletions

View File

@@ -146,6 +146,12 @@ static void sdlWarpPointer(int x, int y, bool exiting)
SDL_WarpMouseInWindow(app_getWindow(), x, y);
}
static void sdlRealignPointer(void)
{
// no need to care about grab, realign only happens in normal mode
app_handleMouseNormal(0, 0);
}
struct LG_DisplayServerOps LGDS_SDL =
{
.subsystem = SDL_SYSWM_UNKNOWN,
@@ -161,6 +167,7 @@ struct LG_DisplayServerOps LGDS_SDL =
.grabKeyboard = sdlGrabKeyboard,
.ungrabKeyboard = sdlUngrabKeyboard,
.warpPointer = sdlWarpPointer,
.realignPointer = sdlRealignPointer,
/* SDL does not have clipboard support */
.cbInit = NULL,

View File

@@ -391,6 +391,11 @@ static void waylandWarpPointer(int x, int y, bool exiting)
// This is an unsupported operation on Wayland.
}
static void waylandRealignPointer(void)
{
app_handleMouseBasic();
}
static void waylandFree(void)
{
waylandUngrabPointer();
@@ -774,6 +779,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
.grabKeyboard = waylandGrabKeyboard,
.ungrabKeyboard = waylandUngrabKeyboard,
.warpPointer = waylandWarpPointer,
.realignPointer = waylandRealignPointer,
.cbInit = waylandCBInit,
.cbNotice = waylandCBNotice,