mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
wayland: Always send wl_pointer.axis after .axis_value120/discrete
The wl_pointer.axis_discrete axis (applicable to wl_seat <= v8) is meant to be sent together with wl_pointer.axis events in the same frame. And the wl_pointer.axis_value120 event replaces it in wl_seat >= v9, but has the same relation with the other information available in a frame. This emission should not be conditional to anything, so drop the various checks leading to maybe sending wl_pointer.axis or not. This fixes emission of wl_pointer.axis in conjunction with discrete events, for some combinations of versions and (non)value120 mice. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3642>
This commit is contained in:
parent
ddc76d878e
commit
39d8e44f5e
@ -716,7 +716,6 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
int32_t x_value120 = 0, y_value120 = 0;
|
int32_t x_value120 = 0, y_value120 = 0;
|
||||||
enum wl_pointer_axis_source source = -1;
|
enum wl_pointer_axis_source source = -1;
|
||||||
MetaWaylandPointerClient *client;
|
MetaWaylandPointerClient *client;
|
||||||
gboolean is_discrete_event = FALSE, is_value120_event = FALSE;
|
|
||||||
ClutterScrollFinishFlags finish_flags;
|
ClutterScrollFinishFlags finish_flags;
|
||||||
|
|
||||||
if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_POINTER_EMULATED)
|
if (clutter_event_get_flags (event) & CLUTTER_EVENT_FLAG_POINTER_EMULATED)
|
||||||
@ -745,28 +744,24 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
switch (clutter_event_get_scroll_direction (event))
|
switch (clutter_event_get_scroll_direction (event))
|
||||||
{
|
{
|
||||||
case CLUTTER_SCROLL_UP:
|
case CLUTTER_SCROLL_UP:
|
||||||
is_discrete_event = TRUE;
|
|
||||||
y_value = -DEFAULT_AXIS_STEP_DISTANCE;
|
y_value = -DEFAULT_AXIS_STEP_DISTANCE;
|
||||||
y_discrete = -1;
|
y_discrete = -1;
|
||||||
y_value120 = y_discrete * 120;
|
y_value120 = y_discrete * 120;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL_DOWN:
|
case CLUTTER_SCROLL_DOWN:
|
||||||
is_discrete_event = TRUE;
|
|
||||||
y_value = DEFAULT_AXIS_STEP_DISTANCE;
|
y_value = DEFAULT_AXIS_STEP_DISTANCE;
|
||||||
y_discrete = 1;
|
y_discrete = 1;
|
||||||
y_value120 = y_discrete * 120;
|
y_value120 = y_discrete * 120;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL_LEFT:
|
case CLUTTER_SCROLL_LEFT:
|
||||||
is_discrete_event = TRUE;
|
|
||||||
x_value = -DEFAULT_AXIS_STEP_DISTANCE;
|
x_value = -DEFAULT_AXIS_STEP_DISTANCE;
|
||||||
x_discrete = -1;
|
x_discrete = -1;
|
||||||
x_value120 = x_discrete * 120;
|
x_value120 = x_discrete * 120;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL_RIGHT:
|
case CLUTTER_SCROLL_RIGHT:
|
||||||
is_discrete_event = TRUE;
|
|
||||||
x_value = DEFAULT_AXIS_STEP_DISTANCE;
|
x_value = DEFAULT_AXIS_STEP_DISTANCE;
|
||||||
x_discrete = 1;
|
x_discrete = 1;
|
||||||
x_value120 = x_discrete * 120;
|
x_value120 = x_discrete * 120;
|
||||||
@ -783,8 +778,7 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
x_value = wl_fixed_from_double (dx) * factor;
|
x_value = wl_fixed_from_double (dx) * factor;
|
||||||
y_value = wl_fixed_from_double (dy) * factor;
|
y_value = wl_fixed_from_double (dy) * factor;
|
||||||
|
|
||||||
is_value120_event = (source == WL_POINTER_AXIS_SOURCE_WHEEL);
|
if (source == WL_POINTER_AXIS_SOURCE_WHEEL)
|
||||||
if (is_value120_event)
|
|
||||||
{
|
{
|
||||||
x_value120 = (int32_t) (dx * 120);
|
x_value120 = (int32_t) (dx * 120);
|
||||||
y_value120 = (int32_t) (dy * 120);
|
y_value120 = (int32_t) (dy * 120);
|
||||||
@ -801,7 +795,6 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
wl_resource_for_each (resource, &client->pointer_resources)
|
wl_resource_for_each (resource, &client->pointer_resources)
|
||||||
{
|
{
|
||||||
int client_version = wl_resource_get_version (resource);
|
int client_version = wl_resource_get_version (resource);
|
||||||
gboolean send_axis_x = TRUE, send_axis_y = TRUE;
|
|
||||||
|
|
||||||
if (client_version >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
|
if (client_version >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
|
||||||
wl_pointer_send_axis_source (resource, source);
|
wl_pointer_send_axis_source (resource, source);
|
||||||
@ -815,8 +808,6 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
x_value120);
|
x_value120);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_axis_x = !is_discrete_event;
|
|
||||||
}
|
}
|
||||||
else if (client_version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION)
|
else if (client_version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION)
|
||||||
{
|
{
|
||||||
@ -826,11 +817,9 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||||
x_discrete);
|
x_discrete);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_axis_x = !is_value120_event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x_value && send_axis_x)
|
if (x_value)
|
||||||
wl_pointer_send_axis (resource, clutter_event_get_time (event),
|
wl_pointer_send_axis (resource, clutter_event_get_time (event),
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL, x_value);
|
WL_POINTER_AXIS_HORIZONTAL_SCROLL, x_value);
|
||||||
|
|
||||||
@ -848,8 +837,6 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
||||||
y_value120);
|
y_value120);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_axis_y = !is_discrete_event;
|
|
||||||
}
|
}
|
||||||
else if (client_version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION)
|
else if (client_version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION)
|
||||||
{
|
{
|
||||||
@ -859,11 +846,9 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
|||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
||||||
y_discrete);
|
y_discrete);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_axis_y = !is_value120_event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y_value && send_axis_y)
|
if (y_value)
|
||||||
wl_pointer_send_axis (resource, clutter_event_get_time (event),
|
wl_pointer_send_axis (resource, clutter_event_get_time (event),
|
||||||
WL_POINTER_AXIS_VERTICAL_SCROLL, y_value);
|
WL_POINTER_AXIS_VERTICAL_SCROLL, y_value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user