mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 09:59:03 +00:00
wayland: Drop pointer grab interface
This is now unused, with everything ported to MetaWaylandEventInterface. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:
parent
bcfb7a4a33
commit
ec435ea540
@ -91,12 +91,6 @@ static void
|
|||||||
meta_wayland_pointer_set_current (MetaWaylandPointer *pointer,
|
meta_wayland_pointer_set_current (MetaWaylandPointer *pointer,
|
||||||
MetaWaylandSurface *surface);
|
MetaWaylandSurface *surface);
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer);
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_pointer_cancel_grab (MetaWaylandPointer *pointer);
|
|
||||||
|
|
||||||
static MetaBackend *
|
static MetaBackend *
|
||||||
backend_from_pointer (MetaWaylandPointer *pointer)
|
backend_from_pointer (MetaWaylandPointer *pointer)
|
||||||
{
|
{
|
||||||
@ -448,59 +442,6 @@ meta_wayland_pointer_send_button (MetaWaylandPointer *pointer,
|
|||||||
sync_focus_surface (pointer);
|
sync_focus_surface (pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
default_grab_focus (MetaWaylandPointerGrab *grab,
|
|
||||||
MetaWaylandSurface *surface)
|
|
||||||
{
|
|
||||||
MetaWaylandPointer *pointer = grab->pointer;
|
|
||||||
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
|
||||||
MetaBackend *backend = backend_from_pointer (pointer);
|
|
||||||
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
|
||||||
|
|
||||||
if (!meta_wayland_seat_has_pointer (seat))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (clutter_stage_get_grab_actor (stage) != NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (surface)
|
|
||||||
{
|
|
||||||
MetaWindow *window = NULL;
|
|
||||||
|
|
||||||
window = surface_get_effective_window (surface);
|
|
||||||
|
|
||||||
/* Avoid focusing a non-alive surface */
|
|
||||||
if (!window || !meta_window_get_alive (window))
|
|
||||||
surface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_wayland_pointer_set_focus (pointer, surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
default_grab_motion (MetaWaylandPointerGrab *grab,
|
|
||||||
const ClutterEvent *event)
|
|
||||||
{
|
|
||||||
MetaWaylandPointer *pointer = grab->pointer;
|
|
||||||
|
|
||||||
meta_wayland_pointer_send_motion (pointer, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
default_grab_button (MetaWaylandPointerGrab *grab,
|
|
||||||
const ClutterEvent *event)
|
|
||||||
{
|
|
||||||
MetaWaylandPointer *pointer = grab->pointer;
|
|
||||||
|
|
||||||
meta_wayland_pointer_send_button (pointer, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const MetaWaylandPointerGrabInterface default_pointer_grab_interface = {
|
|
||||||
default_grab_focus,
|
|
||||||
default_grab_motion,
|
|
||||||
default_grab_button
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_pointer_on_cursor_changed (MetaCursorTracker *cursor_tracker,
|
meta_wayland_pointer_on_cursor_changed (MetaCursorTracker *cursor_tracker,
|
||||||
MetaWaylandPointer *pointer)
|
MetaWaylandPointer *pointer)
|
||||||
@ -547,8 +488,6 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
|||||||
pointer->cursor_surface);
|
pointer->cursor_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_wayland_pointer_cancel_grab (pointer);
|
|
||||||
meta_wayland_pointer_reset_grab (pointer);
|
|
||||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||||
meta_wayland_pointer_set_current (pointer, NULL);
|
meta_wayland_pointer_set_current (pointer, NULL);
|
||||||
|
|
||||||
@ -704,7 +643,7 @@ static void
|
|||||||
notify_motion (MetaWaylandPointer *pointer,
|
notify_motion (MetaWaylandPointer *pointer,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
pointer->grab->interface->motion (pointer->grab, event);
|
meta_wayland_pointer_send_motion (pointer, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -728,7 +667,7 @@ handle_button_event (MetaWaylandPointer *pointer,
|
|||||||
clutter_event_get_coords (event, &pointer->grab_x, &pointer->grab_y);
|
clutter_event_get_coords (event, &pointer->grab_x, &pointer->grab_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer->grab->interface->button (pointer->grab, event);
|
meta_wayland_pointer_send_button (pointer, event);
|
||||||
|
|
||||||
if (implicit_grab)
|
if (implicit_grab)
|
||||||
{
|
{
|
||||||
@ -1095,48 +1034,28 @@ void
|
|||||||
meta_wayland_pointer_focus_surface (MetaWaylandPointer *pointer,
|
meta_wayland_pointer_focus_surface (MetaWaylandPointer *pointer,
|
||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
|
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
interface->focus (pointer->grab, surface);
|
MetaBackend *backend = backend_from_pointer (pointer);
|
||||||
}
|
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||||
|
|
||||||
void
|
if (!meta_wayland_seat_has_pointer (seat))
|
||||||
meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer,
|
return;
|
||||||
MetaWaylandPointerGrab *grab)
|
|
||||||
{
|
|
||||||
const MetaWaylandPointerGrabInterface *interface;
|
|
||||||
|
|
||||||
meta_wayland_pointer_cancel_grab (pointer);
|
if (clutter_stage_get_grab_actor (stage) != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
pointer->grab = grab;
|
if (surface)
|
||||||
interface = pointer->grab->interface;
|
{
|
||||||
grab->pointer = pointer;
|
MetaWindow *window = NULL;
|
||||||
|
|
||||||
interface->focus (pointer->grab, pointer->current);
|
window = surface_get_effective_window (surface);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
/* Avoid focusing a non-alive surface */
|
||||||
meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer)
|
if (!window || !meta_window_get_alive (window))
|
||||||
{
|
surface = NULL;
|
||||||
pointer->grab = &pointer->default_grab;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
meta_wayland_pointer_set_focus (pointer, surface);
|
||||||
meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer)
|
|
||||||
{
|
|
||||||
const MetaWaylandPointerGrabInterface *interface;
|
|
||||||
|
|
||||||
pointer->grab = &pointer->default_grab;
|
|
||||||
interface = pointer->grab->interface;
|
|
||||||
interface->focus (pointer->grab, pointer->current);
|
|
||||||
|
|
||||||
meta_wayland_pointer_update_cursor_surface (pointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_wayland_pointer_cancel_grab (MetaWaylandPointer *pointer)
|
|
||||||
{
|
|
||||||
if (pointer->grab->interface->cancel)
|
|
||||||
pointer->grab->interface->cancel (pointer->grab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1468,9 +1387,6 @@ meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer)
|
|||||||
static void
|
static void
|
||||||
meta_wayland_pointer_init (MetaWaylandPointer *pointer)
|
meta_wayland_pointer_init (MetaWaylandPointer *pointer)
|
||||||
{
|
{
|
||||||
pointer->default_grab.interface = &default_pointer_grab_interface;
|
|
||||||
pointer->default_grab.pointer = pointer;
|
|
||||||
pointer->grab = &pointer->default_grab;
|
|
||||||
pointer->pointer_clients =
|
pointer->pointer_clients =
|
||||||
g_hash_table_new_full (NULL, NULL, NULL,
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
(GDestroyNotify) meta_wayland_pointer_client_free);
|
(GDestroyNotify) meta_wayland_pointer_client_free);
|
||||||
@ -1501,12 +1417,6 @@ meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass)
|
|||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_wayland_pointer_is_grabbed (MetaWaylandPointer *pointer)
|
|
||||||
{
|
|
||||||
return pointer->grab != &pointer->default_grab;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaWaylandSurface *
|
MetaWaylandSurface *
|
||||||
meta_wayland_pointer_get_current_surface (MetaWaylandPointer *pointer)
|
meta_wayland_pointer_get_current_surface (MetaWaylandPointer *pointer)
|
||||||
{
|
{
|
||||||
|
@ -36,23 +36,6 @@ G_DECLARE_FINAL_TYPE (MetaWaylandPointer, meta_wayland_pointer,
|
|||||||
META, WAYLAND_POINTER,
|
META, WAYLAND_POINTER,
|
||||||
MetaWaylandInputDevice)
|
MetaWaylandInputDevice)
|
||||||
|
|
||||||
struct _MetaWaylandPointerGrabInterface
|
|
||||||
{
|
|
||||||
void (*focus) (MetaWaylandPointerGrab *grab,
|
|
||||||
MetaWaylandSurface *surface);
|
|
||||||
void (*motion) (MetaWaylandPointerGrab *grab,
|
|
||||||
const ClutterEvent *event);
|
|
||||||
void (*button) (MetaWaylandPointerGrab *grab,
|
|
||||||
const ClutterEvent *event);
|
|
||||||
void (*cancel) (MetaWaylandPointerGrab *grab);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaWaylandPointerGrab
|
|
||||||
{
|
|
||||||
const MetaWaylandPointerGrabInterface *interface;
|
|
||||||
MetaWaylandPointer *pointer;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaWaylandPointerClient
|
struct _MetaWaylandPointerClient
|
||||||
{
|
{
|
||||||
struct wl_list pointer_resources;
|
struct wl_list pointer_resources;
|
||||||
@ -79,8 +62,6 @@ struct _MetaWaylandPointer
|
|||||||
MetaWaylandSurface *cursor_surface;
|
MetaWaylandSurface *cursor_surface;
|
||||||
gulong cursor_surface_destroy_id;
|
gulong cursor_surface_destroy_id;
|
||||||
|
|
||||||
MetaWaylandPointerGrab *grab;
|
|
||||||
MetaWaylandPointerGrab default_grab;
|
|
||||||
guint32 grab_button;
|
guint32 grab_button;
|
||||||
guint32 grab_serial;
|
guint32 grab_serial;
|
||||||
guint32 grab_time;
|
guint32 grab_time;
|
||||||
@ -117,11 +98,6 @@ void meta_wayland_pointer_broadcast_frame (MetaWaylandPointer *pointer);
|
|||||||
void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
||||||
MetaWaylandSurface *surface);
|
MetaWaylandSurface *surface);
|
||||||
|
|
||||||
void meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer,
|
|
||||||
MetaWaylandPointerGrab *grab);
|
|
||||||
|
|
||||||
void meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer);
|
|
||||||
|
|
||||||
void meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
void meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
||||||
MetaWaylandSurface *surface,
|
MetaWaylandSurface *surface,
|
||||||
wl_fixed_t *x,
|
wl_fixed_t *x,
|
||||||
@ -151,8 +127,6 @@ void meta_wayland_surface_cursor_update (MetaWaylandSurface *cursor_surface);
|
|||||||
|
|
||||||
void meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer);
|
void meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer);
|
||||||
|
|
||||||
gboolean meta_wayland_pointer_is_grabbed (MetaWaylandPointer *pointer);
|
|
||||||
|
|
||||||
MetaWaylandSurface * meta_wayland_pointer_get_current_surface (MetaWaylandPointer *pointer);
|
MetaWaylandSurface * meta_wayland_pointer_get_current_surface (MetaWaylandPointer *pointer);
|
||||||
|
|
||||||
void meta_wayland_pointer_focus_surface (MetaWaylandPointer *pointer,
|
void meta_wayland_pointer_focus_surface (MetaWaylandPointer *pointer,
|
||||||
|
@ -665,10 +665,6 @@ meta_wayland_seat_get_compositor (MetaWaylandSeat *seat)
|
|||||||
gboolean
|
gboolean
|
||||||
meta_wayland_seat_is_grabbed (MetaWaylandSeat *seat)
|
meta_wayland_seat_is_grabbed (MetaWaylandSeat *seat)
|
||||||
{
|
{
|
||||||
if (meta_wayland_seat_has_pointer (seat) &&
|
|
||||||
meta_wayland_pointer_is_grabbed (seat->pointer))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (!meta_wayland_input_is_current_handler (seat->input_handler,
|
if (!meta_wayland_input_is_current_handler (seat->input_handler,
|
||||||
seat->default_handler))
|
seat->default_handler))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -22,8 +22,6 @@ typedef struct _MetaWaylandCompositor MetaWaylandCompositor;
|
|||||||
typedef struct _MetaWaylandSeat MetaWaylandSeat;
|
typedef struct _MetaWaylandSeat MetaWaylandSeat;
|
||||||
typedef struct _MetaWaylandInputDevice MetaWaylandInputDevice;
|
typedef struct _MetaWaylandInputDevice MetaWaylandInputDevice;
|
||||||
typedef struct _MetaWaylandPointer MetaWaylandPointer;
|
typedef struct _MetaWaylandPointer MetaWaylandPointer;
|
||||||
typedef struct _MetaWaylandPointerGrab MetaWaylandPointerGrab;
|
|
||||||
typedef struct _MetaWaylandPointerGrabInterface MetaWaylandPointerGrabInterface;
|
|
||||||
typedef struct _MetaWaylandPopupGrab MetaWaylandPopupGrab;
|
typedef struct _MetaWaylandPopupGrab MetaWaylandPopupGrab;
|
||||||
typedef struct _MetaWaylandPopup MetaWaylandPopup;
|
typedef struct _MetaWaylandPopup MetaWaylandPopup;
|
||||||
typedef struct _MetaWaylandPopupSurface MetaWaylandPopupSurface;
|
typedef struct _MetaWaylandPopupSurface MetaWaylandPopupSurface;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user