mirror of
https://github.com/brl/mutter.git
synced 2025-01-14 13:43:08 +00:00
wayland/pointer: Return on scroll without client
Return early from handle_scroll_event if no client is focused to avoid redundant calculations. Refactor, no functional changes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1966>
This commit is contained in:
parent
d703ba56c3
commit
cea5c47671
@ -721,10 +721,15 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
||||
wl_fixed_t x_value = 0, y_value = 0;
|
||||
int x_discrete = 0, y_discrete = 0;
|
||||
enum wl_pointer_axis_source source = -1;
|
||||
MetaWaylandPointerClient *client;
|
||||
|
||||
if (clutter_event_is_pointer_emulated (event))
|
||||
return;
|
||||
|
||||
client = pointer->focus_client;
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
switch (event->scroll.scroll_source)
|
||||
{
|
||||
case CLUTTER_SCROLL_SOURCE_WHEEL:
|
||||
@ -780,9 +785,7 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
||||
return;
|
||||
}
|
||||
|
||||
if (pointer->focus_client)
|
||||
{
|
||||
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
|
||||
wl_resource_for_each (resource, &client->pointer_resources)
|
||||
{
|
||||
int client_version = wl_resource_get_version (resource);
|
||||
|
||||
@ -825,7 +828,6 @@ handle_scroll_event (MetaWaylandPointer *pointer,
|
||||
|
||||
meta_wayland_pointer_broadcast_frame (pointer);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_pointer_handle_event (MetaWaylandPointer *pointer,
|
||||
|
Loading…
Reference in New Issue
Block a user