[gtk+/wip/wayland-tablet-v2: 7/19] gdk: Add pad event structs, enum values, and event mask bit



commit 5907292e8e5c70066d0d98feaf6b896b4b3766a6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 4 19:04:36 2016 +0200

    gdk: Add pad event structs, enum values, and event mask bit
    
    GDK_PAD_BUTTON*,RING and STRIP will be emitted respectively when
    pad buttons, rings or strips are interacted with. Each of those
    pad components belong to a group (a pad can contain several of
    those), which may be in a given mode. All this information is
    contained in the event.
    
    GDK_PAD_GROUP_MODE is emitted when a group in the pad switches
    mode, which will generally result in a different set of actions
    being triggered from the same buttons/rings/strips in the group.

 gdk/gdkevents.c |   17 +++++++++++++++++
 gdk/gdkevents.h |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdk/gdktypes.h  |    2 ++
 gdk/gdkwindow.c |    5 +++++
 4 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 6d1a1ca..cc6cb5e 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -920,6 +920,14 @@ gdk_event_get_time (const GdkEvent *event)
       case GDK_DROP_START:
       case GDK_DROP_FINISHED:
        return event->dnd.time;
+      case GDK_PAD_BUTTON_PRESS:
+      case GDK_PAD_BUTTON_RELEASE:
+        return event->pad_button.time;
+      case GDK_PAD_RING:
+      case GDK_PAD_STRIP:
+        return event->pad_axis.time;
+      case GDK_PAD_GROUP_MODE:
+        return event->pad_group_mode.time;
       case GDK_CLIENT_EVENT:
       case GDK_VISIBILITY_NOTIFY:
       case GDK_CONFIGURE:
@@ -1023,6 +1031,11 @@ gdk_event_get_state (const GdkEvent        *event,
       case GDK_SETTING:
       case GDK_OWNER_CHANGE:
       case GDK_GRAB_BROKEN:
+      case GDK_PAD_BUTTON_PRESS:
+      case GDK_PAD_BUTTON_RELEASE:
+      case GDK_PAD_RING:
+      case GDK_PAD_STRIP:
+      case GDK_PAD_GROUP_MODE:
       case GDK_EVENT_LAST:
         /* no state field */
         break;
@@ -1213,6 +1226,10 @@ gdk_event_get_button (const GdkEvent *event,
     case GDK_BUTTON_RELEASE:
       number = event->button.button;
       break;
+    case GDK_PAD_BUTTON_PRESS:
+    case GDK_PAD_BUTTON_RELEASE:
+      number = event->pad_button.button;
+      break;
     default:
       fetched = FALSE;
       break;
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index dec5c1b..3a30bc3 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -142,6 +142,9 @@ typedef struct _GdkEventSetting     GdkEventSetting;
 typedef struct _GdkEventGrabBroken  GdkEventGrabBroken;
 typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
 typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
+typedef struct _GdkEventPadButton   GdkEventPadButton;
+typedef struct _GdkEventPadAxis     GdkEventPadAxis;
+typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
 
 typedef struct _GdkEventSequence    GdkEventSequence;
 
@@ -278,6 +281,16 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  *   is determined by its phase field. This event type was added in 3.18.
  * @GDK_TOUCHPAD_PINCH: A touchpad pinch gesture event, the current state
  *   is determined by its phase field. This event type was added in 3.18.
+ * @GDK_PAD_BUTTON_PRESS: A tablet pad button press event. This event type
+ *   was added in 3.22.
+ * @GDK_PAD_BUTTON_RELEASE: A tablet pad button release event. This event type
+ *   was added in 3.22.
+ * @GDK_PAD_RING: A tablet pad axis event from a "ring". This event type was
+ *   added in 3.22.
+ * @GDK_PAD_STRIP: A tablet pad axis event from a "strip". This event type was
+ *   added in 3.22.
+ * @GDK_PAD_MODE: A tablet pad group mode change. This event type was added
+ *   in 3.22.
  * @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
  *
  * Specifies the type of the event.
@@ -340,6 +353,11 @@ typedef enum
   GDK_TOUCH_CANCEL      = 40,
   GDK_TOUCHPAD_SWIPE    = 41,
   GDK_TOUCHPAD_PINCH    = 42,
+  GDK_PAD_BUTTON_PRESS  = 43,
+  GDK_PAD_BUTTON_RELEASE = 44,
+  GDK_PAD_RING          = 45,
+  GDK_PAD_STRIP         = 46,
+  GDK_PAD_GROUP_MODE    = 47,
   GDK_EVENT_LAST        /* helper variable for decls */
 } GdkEventType;
 
@@ -1240,6 +1258,36 @@ struct _GdkEventTouchpadPinch {
   guint state;
 };
 
+struct _GdkEventPadButton {
+  GdkEventType type;
+  GdkWindow *window;
+  gint8 send_event;
+  guint32 time;
+  guint group;
+  guint button;
+  guint mode;
+};
+
+struct _GdkEventPadAxis {
+  GdkEventType type;
+  GdkWindow *window;
+  gint8 send_event;
+  guint32 time;
+  guint group;
+  guint index;
+  guint mode;
+  gdouble value;
+};
+
+struct _GdkEventPadGroupMode {
+  GdkEventType type;
+  GdkWindow *window;
+  gint8 send_event;
+  guint32 time;
+  guint group;
+  guint mode;
+};
+
 /**
  * GdkEvent:
  * @type: the #GdkEventType
@@ -1318,6 +1366,9 @@ union _GdkEvent
   GdkEventGrabBroken        grab_broken;
   GdkEventTouchpadSwipe     touchpad_swipe;
   GdkEventTouchpadPinch     touchpad_pinch;
+  GdkEventPadButton         pad_button;
+  GdkEventPadAxis           pad_axis;
+  GdkEventPadGroupMode      pad_group_mode;
 };
 
 GDK_AVAILABLE_IN_ALL
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 48846b8..211d7a1 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -394,6 +394,7 @@ typedef enum
  * @GDK_TOUCH_MASK: receive touch events. Since 3.4
  * @GDK_SMOOTH_SCROLL_MASK: receive smooth scrolling events. Since 3.4
    @GDK_TOUCHPAD_GESTURE_MASK: receive touchpad gesture events. Since 3.18
+ * @GDK_TABLET_PAD_MASK: receive tablet pad events. Since 3.22
  * @GDK_ALL_EVENTS_MASK: the combination of all the above event masks.
  *
  * A set of bit-flags to indicate which events a window is to receive.
@@ -449,6 +450,7 @@ typedef enum
   GDK_TOUCH_MASK                = 1 << 22,
   GDK_SMOOTH_SCROLL_MASK        = 1 << 23,
   GDK_TOUCHPAD_GESTURE_MASK     = 1 << 24,
+  GDK_TABLET_PAD_MASK           = 1 << 25,
   GDK_ALL_EVENTS_MASK           = 0xFFFFFE
 } GdkEventMask;
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index aa28e4a..288fdbf 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -7960,6 +7960,11 @@ static const guint type_masks[] = {
   GDK_TOUCH_MASK, /* GDK_TOUCH_CANCEL = 40 */
   GDK_TOUCHPAD_GESTURE_MASK, /* GDK_TOUCHPAD_SWIPE = 41 */
   GDK_TOUCHPAD_GESTURE_MASK, /* GDK_TOUCHPAD_PINCH = 42 */
+  GDK_TABLET_PAD_MASK, /* GDK_PAD_BUTTON_PRESS  = 43 */
+  GDK_TABLET_PAD_MASK, /* GDK_PAD_BUTTON_RELEASE = 44 */
+  GDK_TABLET_PAD_MASK, /* GDK_PAD_RING = 45 */
+  GDK_TABLET_PAD_MASK, /* GDK_PAD_STRIP = 46 */
+  GDK_TABLET_PAD_MASK, /* GDK_PAD_GROUP_MODE = 47 */
 };
 G_STATIC_ASSERT (G_N_ELEMENTS (type_masks) == GDK_EVENT_LAST);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]