[mutter] seat: Rewrite event handling in terms of MetaWaylandPointer
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] seat: Rewrite event handling in terms of MetaWaylandPointer
- Date: Thu, 17 Apr 2014 23:17:47 +0000 (UTC)
commit bdf55bc674a51f13e3c104783d0b63d3306c4944
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Apr 17 18:12:23 2014 -0400
seat: Rewrite event handling in terms of MetaWaylandPointer
src/wayland/meta-wayland-pointer.c | 6 +++++-
src/wayland/meta-wayland-pointer.h | 5 ++++-
src/wayland/meta-wayland-seat.c | 35 +++++++++++++++--------------------
3 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index f3ec987..b3756aa 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -283,13 +283,17 @@ pointer_constrain_callback (ClutterInputDevice *device,
}
void
-meta_wayland_pointer_init (MetaWaylandPointer *pointer)
+meta_wayland_pointer_init (MetaWaylandPointer *pointer,
+ struct wl_display *display)
{
ClutterDeviceManager *manager;
ClutterInputDevice *device;
ClutterPoint current;
memset (pointer, 0, sizeof *pointer);
+
+ pointer->display = display;
+
wl_list_init (&pointer->resource_list);
wl_list_init (&pointer->focus_resource_list);
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index 4c9d927..e45e357 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -46,6 +46,8 @@ struct _MetaWaylandPointerGrab
struct _MetaWaylandPointer
{
+ struct wl_display *display;
+
struct wl_list resource_list;
struct wl_list focus_resource_list;
@@ -74,7 +76,8 @@ struct _MetaWaylandPointer
};
void
-meta_wayland_pointer_init (MetaWaylandPointer *pointer);
+meta_wayland_pointer_init (MetaWaylandPointer *pointer,
+ struct wl_display *display);
void
meta_wayland_pointer_release (MetaWaylandPointer *pointer);
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index e77f60b..4e3ef8e 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -141,7 +141,7 @@ meta_wayland_seat_new (struct wl_display *display)
wl_list_init (&seat->base_resource_list);
wl_list_init (&seat->data_device_resource_list);
- meta_wayland_pointer_init (&seat->pointer);
+ meta_wayland_pointer_init (&seat->pointer, display);
meta_wayland_keyboard_init (&seat->keyboard, display);
seat->display = display;
@@ -184,11 +184,10 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
}
static void
-repick_for_event (MetaWaylandSeat *seat,
+repick_for_event (MetaWaylandPointer *pointer,
const ClutterEvent *for_event)
{
ClutterActor *actor = NULL;
- MetaWaylandPointer *pointer = &seat->pointer;
MetaWaylandSurface *surface = NULL;
MetaDisplay *display = meta_get_display ();
@@ -222,31 +221,28 @@ repick_for_event (MetaWaylandSeat *seat,
}
static void
-notify_motion (MetaWaylandSeat *seat,
+notify_motion (MetaWaylandPointer *pointer,
const ClutterEvent *event)
{
- MetaWaylandPointer *pointer = &seat->pointer;
-
- repick_for_event (seat, event);
+ repick_for_event (pointer, event);
pointer->grab->interface->motion (pointer->grab, event);
}
static void
-handle_motion_event (MetaWaylandSeat *seat,
+handle_motion_event (MetaWaylandPointer *pointer,
const ClutterEvent *event)
{
- notify_motion (seat, event);
+ notify_motion (pointer, event);
}
static void
-handle_button_event (MetaWaylandSeat *seat,
+handle_button_event (MetaWaylandPointer *pointer,
const ClutterEvent *event)
{
- MetaWaylandPointer *pointer = &seat->pointer;
gboolean implicit_grab;
- notify_motion (seat, event);
+ notify_motion (pointer, event);
implicit_grab = (event->type == CLUTTER_BUTTON_PRESS) && (pointer->button_count == 1);
if (implicit_grab)
@@ -260,19 +256,18 @@ handle_button_event (MetaWaylandSeat *seat,
pointer->grab->interface->button (pointer->grab, event);
if (implicit_grab)
- pointer->grab_serial = wl_display_get_serial (seat->display);
+ pointer->grab_serial = wl_display_get_serial (pointer->display);
}
static void
-handle_scroll_event (MetaWaylandSeat *seat,
+handle_scroll_event (MetaWaylandPointer *pointer,
const ClutterEvent *event)
{
- MetaWaylandPointer *pointer = &seat->pointer;
struct wl_resource *resource;
struct wl_list *l;
wl_fixed_t x_value = 0, y_value = 0;
- notify_motion (seat, event);
+ notify_motion (pointer, event);
if (clutter_event_is_pointer_emulated (event))
return;
@@ -327,16 +322,16 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
switch (event->type)
{
case CLUTTER_MOTION:
- handle_motion_event (seat, event);
+ handle_motion_event (&seat->pointer, event);
break;
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
- handle_button_event (seat, event);
+ handle_button_event (&seat->pointer, event);
break;
case CLUTTER_SCROLL:
- handle_scroll_event (seat, event);
+ handle_scroll_event (&seat->pointer, event);
break;
case CLUTTER_KEY_PRESS:
@@ -354,7 +349,7 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
void
meta_wayland_seat_repick (MetaWaylandSeat *seat)
{
- repick_for_event (seat, NULL);
+ repick_for_event (&seat->pointer, NULL);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]