[mutter/wip/carlosg/input-thread: 59/159] clutter-event: Add device added/removed events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 59/159] clutter-event: Add device added/removed events
- Date: Wed, 12 Aug 2020 17:24:02 +0000 (UTC)
commit 0d54172e31d81acbfecf71550aa6fe1f74cc3358
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri Jul 17 16:31:10 2020 +0200
clutter-event: Add device added/removed events
Add clutter device added and removed events to allow processing of them as
it happens in the backends, queuing them and performing actions in order.
This allows not to loose any event that is performed just before removing or
disabling a device, and still process the events in order in the event
queue.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
clutter/clutter/clutter-actor.c | 3 +++
clutter/clutter/clutter-enums.h | 2 ++
clutter/clutter/clutter-event.c | 25 +++++++++++++++++++++++++
clutter/clutter/clutter-event.h | 13 +++++++++++++
4 files changed, 43 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index f9f41ab47f..bad5f42a8d 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -12721,6 +12721,9 @@ clutter_actor_event (ClutterActor *actor,
signal_num = -1;
detail = quark_stage;
break;
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ break;
case CLUTTER_EVENT_LAST: /* Just keep compiler warnings quiet */
break;
}
diff --git a/clutter/clutter/clutter-enums.h b/clutter/clutter/clutter-enums.h
index 009d6d671c..7c246c2a1b 100644
--- a/clutter/clutter/clutter-enums.h
+++ b/clutter/clutter/clutter-enums.h
@@ -908,6 +908,8 @@ typedef enum /*< prefix=CLUTTER >*/
CLUTTER_PAD_BUTTON_RELEASE,
CLUTTER_PAD_STRIP,
CLUTTER_PAD_RING,
+ CLUTTER_DEVICE_ADDED,
+ CLUTTER_DEVICE_REMOVED,
CLUTTER_EVENT_LAST /* helper */
} ClutterEventType;
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 9ccc0da1c5..efc01a2b26 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -415,6 +415,8 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
graphene_point_init (position, 0.f, 0.f);
break;
@@ -489,6 +491,8 @@ clutter_event_set_coords (ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
break;
case CLUTTER_ENTER:
@@ -1161,6 +1165,11 @@ clutter_event_set_device (ClutterEvent *event,
case CLUTTER_PAD_RING:
event->pad_ring.device = device;
break;
+
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ g_set_object (&event->device.device, device);
+ break;
}
}
@@ -1258,6 +1267,11 @@ clutter_event_get_device (const ClutterEvent *event)
case CLUTTER_PAD_RING:
device = event->pad_ring.device;
break;
+
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ device = event->device.device;
+ break;
}
return device;
@@ -1411,6 +1425,11 @@ clutter_event_copy (const ClutterEvent *event)
sizeof (gdouble) * n_axes);
break;
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ g_set_object (&new_event->device.device, event->device.device);
+ break;
+
default:
break;
}
@@ -1465,6 +1484,10 @@ clutter_event_free (ClutterEvent *event)
case CLUTTER_TOUCH_CANCEL:
g_free (event->touch.axes);
break;
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ g_clear_object (&event->device.device);
+ break;
default:
break;
@@ -1733,6 +1756,8 @@ clutter_event_get_axes (const ClutterEvent *event,
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
break;
case CLUTTER_SCROLL:
diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h
index f090ca8e11..22dc6b7c53 100644
--- a/clutter/clutter/clutter-event.h
+++ b/clutter/clutter/clutter-event.h
@@ -121,6 +121,7 @@ typedef struct _ClutterProximityEvent ClutterProximityEvent;
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
+typedef struct _ClutterDeviceEvent ClutterDeviceEvent;
/**
* ClutterAnyEvent:
@@ -544,6 +545,17 @@ struct _ClutterPadRingEvent
guint32 mode;
};
+struct _ClutterDeviceEvent
+{
+ ClutterEventType type;
+ guint32 time;
+ ClutterEventFlags flags;
+ ClutterStage *stage;
+ ClutterActor *source;
+
+ ClutterInputDevice *device;
+};
+
/**
* ClutterEvent:
*
@@ -570,6 +582,7 @@ union _ClutterEvent
ClutterPadButtonEvent pad_button;
ClutterPadStripEvent pad_strip;
ClutterPadRingEvent pad_ring;
+ ClutterDeviceEvent device;
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]