mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] wayland: update absolute mouse position
We are actually getting mouse events directly from Wayland instead of going through SDL, so we call app_updateCursorPos in pointer motion handlers and swallow the SDL event. Also removed parameters for app_handleMouseBasic as it relies exclusively on absolute positions provided by app_updateCursorPos. Wayland does not give you relative movements at all unless grabbed and passing absolute movements is semantically incorrect. Note that when the cursor is grabbed, movements are handled entirely through relativePointerMotionHandler in wayland.c and does not go through app_handleMouseBasic at all.
This commit is contained in:
@@ -125,7 +125,8 @@ static void pointerMotionHandler(void * data, struct wl_pointer * pointer,
|
||||
{
|
||||
int sx = wl_fixed_to_int(sxW);
|
||||
int sy = wl_fixed_to_int(syW);
|
||||
app_handleMouseNormal(sx, sy);
|
||||
app_updateCursorPos(sx, sy);
|
||||
app_handleMouseBasic();
|
||||
}
|
||||
|
||||
static void pointerEnterHandler(void * data, struct wl_pointer * pointer,
|
||||
@@ -134,7 +135,8 @@ static void pointerEnterHandler(void * data, struct wl_pointer * pointer,
|
||||
{
|
||||
int sx = wl_fixed_to_int(sxW);
|
||||
int sy = wl_fixed_to_int(syW);
|
||||
app_handleMouseNormal(sx, sy);
|
||||
app_updateCursorPos(sx, sy);
|
||||
app_handleMouseBasic();
|
||||
}
|
||||
|
||||
static void pointerLeaveHandler(void * data, struct wl_pointer * pointer,
|
||||
@@ -394,13 +396,7 @@ static bool waylandEventFilter(SDL_Event * event)
|
||||
switch(event->type)
|
||||
{
|
||||
case SDL_MOUSEMOTION:
|
||||
{
|
||||
app_updateCursorPos(event->motion.x, event->motion.y);
|
||||
|
||||
// we must use the basic handler as Wayland has no warp support
|
||||
app_handleMouseBasic(event->motion.x, event->motion.y);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user