wayland: Avoid sending wl_pointer.motion on unchanged coordinates
This might happen for a variety of reasons, like monitor edges or pointer constraints. Handle this naturally in MetaWaylandPointer for all these cases. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:
parent
07d24fe502
commit
0e56ebb51a
@ -397,11 +397,18 @@ meta_wayland_pointer_send_motion (MetaWaylandPointer *pointer,
|
||||
meta_wayland_surface_get_relative_coordinates (pointer->focus_surface,
|
||||
x, y, &sx, &sy);
|
||||
|
||||
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
|
||||
if (pointer->last_rel_x != sx ||
|
||||
pointer->last_rel_y != sy)
|
||||
{
|
||||
wl_pointer_send_motion (resource, time,
|
||||
wl_fixed_from_double (sx),
|
||||
wl_fixed_from_double (sy));
|
||||
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
|
||||
{
|
||||
wl_pointer_send_motion (resource, time,
|
||||
wl_fixed_from_double (sx),
|
||||
wl_fixed_from_double (sy));
|
||||
}
|
||||
|
||||
pointer->last_rel_x = sx;
|
||||
pointer->last_rel_y = sy;
|
||||
}
|
||||
|
||||
meta_wayland_pointer_send_relative_motion (pointer, event);
|
||||
@ -469,6 +476,9 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
|
||||
"cursor-changed",
|
||||
G_CALLBACK (meta_wayland_pointer_on_cursor_changed),
|
||||
pointer);
|
||||
|
||||
pointer->last_rel_x = -FLT_MAX;
|
||||
pointer->last_rel_y = -FLT_MAX;
|
||||
}
|
||||
|
||||
void
|
||||
@ -966,6 +976,9 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
||||
if (pointer->focus_surface == surface)
|
||||
return;
|
||||
|
||||
pointer->last_rel_x = -FLT_MAX;
|
||||
pointer->last_rel_y = -FLT_MAX;
|
||||
|
||||
if (pointer->focus_surface != NULL)
|
||||
{
|
||||
uint32_t serial;
|
||||
|
@ -66,6 +66,7 @@ struct _MetaWaylandPointer
|
||||
guint32 grab_serial;
|
||||
guint32 grab_time;
|
||||
float grab_x, grab_y;
|
||||
float last_rel_x, last_rel_y;
|
||||
|
||||
ClutterInputDevice *device;
|
||||
MetaWaylandSurface *current;
|
||||
|
Loading…
Reference in New Issue
Block a user