[mutter/wip/carlosg/input-thread: 33/133] 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: 33/133] clutter-event: Add device added/removed events
- Date: Thu, 13 Aug 2020 19:31:07 +0000 (UTC)
commit cd00e69ce34d8f56734129835fa78d78e62fb4c7
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 32e485c6c4..2b9dde075f 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 ce1121d8d6..0f80ba502f 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..e805a18718 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:
+ g_set_object (&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:
+ g_set_object (&new_event->device.device, event->device.device);
+ break;
+
default:
break;
}
@@ -1461,6 +1480,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;
@@ -1728,6 +1751,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]