[mutter] clutter-event: Add device added/removed events
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter-event: Add device added/removed events
- Date: Sat, 29 Aug 2020 10:05:20 +0000 (UTC)
commit 928b32b1a18f0c4abdc29b98378f5f36141fa58d
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 | 21 +++++++++++++++++++++
clutter/clutter/clutter-event.h | 13 +++++++++++++
4 files changed, 39 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 6a8dfe89ae..05148e907f 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -12715,6 +12715,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 66f6d9beb1..24e961a18e 100644
--- a/clutter/clutter/clutter-enums.h
+++ b/clutter/clutter/clutter-enums.h
@@ -906,6 +906,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 0a8e56798c..2bc6baff33 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -414,6 +414,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;
@@ -487,6 +489,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:
@@ -1158,6 +1162,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:
+ event->device.device = device;
+ break;
}
}
@@ -1254,6 +1263,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;
@@ -1407,6 +1421,11 @@ clutter_event_copy (const ClutterEvent *event)
sizeof (gdouble) * n_axes);
break;
+ case CLUTTER_DEVICE_ADDED:
+ case CLUTTER_DEVICE_REMOVED:
+ new_event->device.device = event->device.device;
+ break;
+
default:
break;
}
@@ -1728,6 +1747,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]