[gtk/event-source-device: 3/3] events: Enforce that source device must be a slave
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/event-source-device: 3/3] events: Enforce that source device must be a slave
- Date: Tue, 19 May 2020 20:01:40 +0000 (UTC)
commit 391472870fdc86bead198b5a845a1c4f3e8e57c7
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 19 15:59:15 2020 -0400
events: Enforce that source device must be a slave
We were allowing backends too much leeway to create
nonsense events. Enforce that the device is NULL or
a master device, and the source device is NULL or a
slave device.
gdk/gdkevents.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 5495d5e6ca..a89adcbb2f 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -416,6 +416,11 @@ gdk_event_alloc (GdkEventType event_type,
g_assert (event_type >= GDK_DELETE && event_type < GDK_EVENT_LAST);
g_assert (gdk_event_types[event_type] != G_TYPE_INVALID);
+ g_assert (device == NULL ||
+ gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
+ g_assert (source_device == NULL ||
+ gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE);
+
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
GDK_NOTE (EVENTS, {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]