mirror of
https://github.com/brl/mutter.git
synced 2025-01-09 19:22:22 +00:00
wayland: Avoid MetaWaylandPointer struct peeking in touchpad gestures
Use getters for the MetaWaylandPointerClient and MetaWaylandSurface for the logical focus. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
This commit is contained in:
parent
bf4d46097b
commit
f53adae278
@ -35,10 +35,12 @@ handle_hold_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
MetaWaylandSeat *seat;
|
||||
MetaWaylandSurface *focus_surface;
|
||||
struct wl_resource *resource;
|
||||
uint32_t serial, fingers;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
focus_surface = meta_wayland_pointer_get_focus_surface (pointer);
|
||||
seat = meta_wayland_pointer_get_seat (pointer);
|
||||
serial = wl_display_next_serial (seat->wl_display);
|
||||
fingers = clutter_event_get_touchpad_gesture_finger_count (event);
|
||||
@ -49,7 +51,7 @@ handle_hold_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
zwp_pointer_gesture_hold_v1_send_begin (resource, serial,
|
||||
clutter_event_get_time (event),
|
||||
pointer->focus_surface->resource,
|
||||
focus_surface->resource,
|
||||
fingers);
|
||||
}
|
||||
}
|
||||
@ -63,7 +65,7 @@ broadcast_end (MetaWaylandPointer *pointer,
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
struct wl_resource *resource;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
|
||||
wl_resource_for_each (resource, &pointer_client->hold_gesture_resources)
|
||||
{
|
||||
@ -101,7 +103,7 @@ meta_wayland_pointer_gesture_hold_handle_event (MetaWaylandPointer *pointer,
|
||||
if (clutter_event_type (event) != CLUTTER_TOUCHPAD_HOLD)
|
||||
return FALSE;
|
||||
|
||||
if (!pointer->focus_client)
|
||||
if (!meta_wayland_pointer_get_focus_client (pointer))
|
||||
return FALSE;
|
||||
|
||||
switch (clutter_event_get_gesture_phase (event))
|
||||
|
@ -37,10 +37,12 @@ handle_pinch_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
MetaWaylandSeat *seat;
|
||||
MetaWaylandSurface *focus_surface;
|
||||
struct wl_resource *resource;
|
||||
uint32_t serial, fingers;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
focus_surface = meta_wayland_pointer_get_focus_surface (pointer);
|
||||
seat = meta_wayland_pointer_get_seat (pointer);
|
||||
serial = wl_display_next_serial (seat->wl_display);
|
||||
fingers = clutter_event_get_touchpad_gesture_finger_count (event);
|
||||
@ -51,7 +53,7 @@ handle_pinch_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
zwp_pointer_gesture_pinch_v1_send_begin (resource, serial,
|
||||
clutter_event_get_time (event),
|
||||
pointer->focus_surface->resource,
|
||||
focus_surface->resource,
|
||||
fingers);
|
||||
}
|
||||
}
|
||||
@ -64,7 +66,7 @@ handle_pinch_update (MetaWaylandPointer *pointer,
|
||||
struct wl_resource *resource;
|
||||
gdouble dx, dy, scale, rotation;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
clutter_event_get_gesture_motion_delta (event, &dx, &dy);
|
||||
rotation = clutter_event_get_gesture_pinch_angle_delta (event);
|
||||
scale = clutter_event_get_gesture_pinch_scale (event);
|
||||
@ -89,7 +91,7 @@ broadcast_end (MetaWaylandPointer *pointer,
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
struct wl_resource *resource;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
|
||||
wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
|
||||
{
|
||||
@ -127,7 +129,7 @@ meta_wayland_pointer_gesture_pinch_handle_event (MetaWaylandPointer *pointer,
|
||||
if (clutter_event_type (event) != CLUTTER_TOUCHPAD_PINCH)
|
||||
return FALSE;
|
||||
|
||||
if (!pointer->focus_client)
|
||||
if (!meta_wayland_pointer_get_focus_client (pointer))
|
||||
return FALSE;
|
||||
|
||||
switch (clutter_event_get_gesture_phase (event))
|
||||
|
@ -37,10 +37,12 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
MetaWaylandSeat *seat;
|
||||
MetaWaylandSurface *focus_surface;
|
||||
struct wl_resource *resource;
|
||||
uint32_t serial, fingers;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
focus_surface = meta_wayland_pointer_get_focus_surface (pointer);
|
||||
seat = meta_wayland_pointer_get_seat (pointer);
|
||||
serial = wl_display_next_serial (seat->wl_display);
|
||||
fingers = clutter_event_get_touchpad_gesture_finger_count (event);
|
||||
@ -51,7 +53,7 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
|
||||
{
|
||||
zwp_pointer_gesture_swipe_v1_send_begin (resource, serial,
|
||||
clutter_event_get_time (event),
|
||||
pointer->focus_surface->resource,
|
||||
focus_surface->resource,
|
||||
fingers);
|
||||
}
|
||||
}
|
||||
@ -64,7 +66,7 @@ handle_swipe_update (MetaWaylandPointer *pointer,
|
||||
struct wl_resource *resource;
|
||||
gdouble dx, dy;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
clutter_event_get_gesture_motion_delta (event, &dx, &dy);
|
||||
|
||||
wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
|
||||
@ -85,7 +87,7 @@ broadcast_end (MetaWaylandPointer *pointer,
|
||||
MetaWaylandPointerClient *pointer_client;
|
||||
struct wl_resource *resource;
|
||||
|
||||
pointer_client = pointer->focus_client;
|
||||
pointer_client = meta_wayland_pointer_get_focus_client (pointer);
|
||||
|
||||
wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
|
||||
{
|
||||
@ -123,7 +125,7 @@ meta_wayland_pointer_gesture_swipe_handle_event (MetaWaylandPointer *pointer,
|
||||
if (clutter_event_type (event) != CLUTTER_TOUCHPAD_SWIPE)
|
||||
return FALSE;
|
||||
|
||||
if (!pointer->focus_client)
|
||||
if (!meta_wayland_pointer_get_focus_client (pointer))
|
||||
return FALSE;
|
||||
|
||||
switch (clutter_event_get_gesture_phase (event))
|
||||
|
Loading…
Reference in New Issue
Block a user