[clutter/wip/evdev-tablet-support: 159/164] events: Add proximity events



commit aee47bfebaa66ca6901b7064541b7130476034d4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jan 14 14:31:13 2015 +0100

    events: Add proximity events
    
    These events will be sent on tool proximity of tablet events.

 clutter/clutter-enums.h            |    2 ++
 clutter/clutter-event.c            |   16 ++++++++++++++++
 clutter/clutter-event.h            |   26 ++++++++++++++++++++++++++
 clutter/clutter-main.c             |   13 +++++++++++++
 clutter/clutter-stage.c            |    4 +++-
 doc/reference/clutter-sections.txt |    1 +
 6 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-enums.h b/clutter/clutter-enums.h
index 9c6cf4b..40acf56 100644
--- a/clutter/clutter-enums.h
+++ b/clutter/clutter-enums.h
@@ -788,6 +788,8 @@ typedef enum { /*< prefix=CLUTTER >*/
   CLUTTER_TOUCH_CANCEL,
   CLUTTER_TOUCHPAD_PINCH,
   CLUTTER_TOUCHPAD_SWIPE,
+  CLUTTER_PROXIMITY_IN,
+  CLUTTER_PROXIMITY_OUT,
 
   CLUTTER_EVENT_LAST            /* helper */
 } ClutterEventType;
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c
index c07823e..332ceb2 100644
--- a/clutter/clutter-event.c
+++ b/clutter/clutter-event.c
@@ -411,6 +411,8 @@ clutter_event_get_position (const ClutterEvent *event,
     case CLUTTER_CLIENT_MESSAGE:
     case CLUTTER_DELETE:
     case CLUTTER_EVENT_LAST:
+    case CLUTTER_PROXIMITY_IN:
+    case CLUTTER_PROXIMITY_OUT:
       clutter_point_init (position, 0.f, 0.f);
       break;
 
@@ -479,6 +481,8 @@ clutter_event_set_coords (ClutterEvent *event,
     case CLUTTER_CLIENT_MESSAGE:
     case CLUTTER_DELETE:
     case CLUTTER_EVENT_LAST:
+    case CLUTTER_PROXIMITY_IN:
+    case CLUTTER_PROXIMITY_OUT:
       break;
 
     case CLUTTER_ENTER:
@@ -1124,6 +1128,11 @@ clutter_event_set_device (ClutterEvent       *event,
     case CLUTTER_TOUCHPAD_SWIPE:
       /* Rely on priv data for these */
       break;
+
+    case CLUTTER_PROXIMITY_IN:
+    case CLUTTER_PROXIMITY_OUT:
+      event->proximity.device = device;
+      break;
     }
 }
 
@@ -1203,6 +1212,11 @@ clutter_event_get_device (const ClutterEvent *event)
     case CLUTTER_TOUCHPAD_SWIPE:
       /* Rely on priv data for these */
       break;
+
+    case CLUTTER_PROXIMITY_IN:
+    case CLUTTER_PROXIMITY_OUT:
+      device = event->proximity.device;
+      break;
     }
 
   return device;
@@ -1665,6 +1679,8 @@ clutter_event_get_axes (const ClutterEvent *event,
     case CLUTTER_KEY_PRESS:
     case CLUTTER_KEY_RELEASE:
     case CLUTTER_EVENT_LAST:
+    case CLUTTER_PROXIMITY_IN:
+    case CLUTTER_PROXIMITY_OUT:
       break;
 
     case CLUTTER_SCROLL:
diff --git a/clutter/clutter-event.h b/clutter/clutter-event.h
index bcfe21b..670f9f7 100644
--- a/clutter/clutter-event.h
+++ b/clutter/clutter-event.h
@@ -117,6 +117,7 @@ typedef struct _ClutterCrossingEvent    ClutterCrossingEvent;
 typedef struct _ClutterTouchEvent       ClutterTouchEvent;
 typedef struct _ClutterTouchpadPinchEvent ClutterTouchpadPinchEvent;
 typedef struct _ClutterTouchpadSwipeEvent ClutterTouchpadSwipeEvent;
+typedef struct _ClutterProximityEvent   ClutterProximityEvent;
 
 /**
  * ClutterAnyEvent:
@@ -214,6 +215,30 @@ struct _ClutterButtonEvent
 };
 
 /**
+ * ClutterProximityEvent:
+ * @type: event type
+ * @time: event time
+ * @flags: event flags
+ * @stage: event source stage
+ * @source: event source actor
+ * @device: the device that originated the event. If you want the physical
+ * device the event originated from, use clutter_event_get_source_device()
+ *
+ * Event for tool proximity in tablet devices
+ *
+ * Since: 1.22
+ */
+struct _ClutterProximityEvent
+{
+  ClutterEventType type;
+  guint32 time;
+  ClutterEventFlags flags;
+  ClutterStage *stage;
+  ClutterActor *source;
+  ClutterInputDevice *device;
+};
+
+/**
  * ClutterCrossingEvent:
  * @type: event type
  * @time: event time
@@ -486,6 +511,7 @@ union _ClutterEvent
   ClutterTouchEvent touch;
   ClutterTouchpadPinchEvent touchpad_pinch;
   ClutterTouchpadSwipeEvent touchpad_swipe;
+  ClutterProximityEvent proximity;
 };
 
 /**
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 3d2130c..eabef66 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2493,6 +2493,19 @@ _clutter_process_event_details (ClutterActor        *stage,
           break;
         }
 
+      case CLUTTER_PROXIMITY_IN:
+      case CLUTTER_PROXIMITY_OUT:
+        if (_clutter_event_process_filters (event))
+          break;
+
+        if (!clutter_actor_event (stage, event, TRUE))
+          {
+            /* and bubbling phase */
+            clutter_actor_event (stage, event, FALSE);
+          }
+
+        break;
+
       case CLUTTER_STAGE_STATE:
         /* fullscreen / focus - forward to stage */
         event->any.source = stage;
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 2c67ca3..e81a245 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -930,7 +930,9 @@ _clutter_stage_queue_event (ClutterStage *stage,
    * event processing function
    */
   device = clutter_event_get_device (event);
-  if (device != NULL)
+  if (device != NULL &&
+      event->type != CLUTTER_PROXIMITY_IN &&
+      event->type != CLUTTER_PROXIMITY_OUT)
     {
       ClutterModifierType event_state = clutter_event_get_state (event);
       ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt
index 057110d..3fbfc67 100644
--- a/doc/reference/clutter-sections.txt
+++ b/doc/reference/clutter-sections.txt
@@ -1104,6 +1104,7 @@ ClutterScrollEvent
 ClutterStageStateEvent
 ClutterCrossingEvent
 ClutterTouchEvent
+ClutterProximityEvent
 ClutterEventSequence
 ClutterTouchpadPinchEvent
 ClutterTouchpadSwipeEvent


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