diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-01-14 14:31:13 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-05-03 13:05:06 +0200 |
commit | b63e73e4227563172d6a51d7129a2100781f4ad2 (patch) | |
tree | 3784809421a007ddd4549ee52be69d1ec78438db | |
parent | 3602b49a30a31d274edba45d3eca8908716ff2c8 (diff) | |
download | mutter-b63e73e4227563172d6a51d7129a2100781f4ad2.tar.gz |
events: Add proximity events
These events will be sent on tool proximity of tablet events.
-rw-r--r-- | clutter/clutter/clutter-enums.h | 6 | ||||
-rw-r--r-- | clutter/clutter/clutter-event.c | 16 | ||||
-rw-r--r-- | clutter/clutter/clutter-event.h | 26 | ||||
-rw-r--r-- | clutter/clutter/clutter-main.c | 13 | ||||
-rw-r--r-- | clutter/clutter/clutter-stage.c | 4 |
5 files changed, 64 insertions, 1 deletions
diff --git a/clutter/clutter/clutter-enums.h b/clutter/clutter/clutter-enums.h index 6794c2bd9..cd87d0b37 100644 --- a/clutter/clutter/clutter-enums.h +++ b/clutter/clutter/clutter-enums.h @@ -761,6 +761,10 @@ typedef enum { /*< flags prefix=CLUTTER_EVENT >*/ * determined by its phase field; event added in 1.24 * @CLUTTER_TOUCHPAD_SWIPE: A swipe gesture event, the current state is * determined by its phase field; event added in 1.24 + * @CLUTTER_PROXIMITY_IN: A tool entered in proximity to a tablet; + * event added in 1.28 + * @CLUTTER_PROXIMITY_OUT: A tool left from the proximity area of a tablet; + * event added in 1.28 * @CLUTTER_EVENT_LAST: Marks the end of the #ClutterEventType enumeration; * added in 1.10 * @@ -788,6 +792,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/clutter-event.c b/clutter/clutter/clutter-event.c index 28bc4b931..05682fbd5 100644 --- a/clutter/clutter/clutter-event.c +++ b/clutter/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; @@ -1668,6 +1682,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/clutter-event.h b/clutter/clutter/clutter-event.h index fd9afe2aa..0202104be 100644 --- a/clutter/clutter/clutter-event.h +++ b/clutter/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.28 + */ +struct _ClutterProximityEvent +{ + ClutterEventType type; + guint32 time; + ClutterEventFlags flags; + ClutterStage *stage; + ClutterActor *source; + ClutterInputDevice *device; +}; + +/** * ClutterCrossingEvent: * @type: event type * @time: event time @@ -490,6 +515,7 @@ union _ClutterEvent ClutterTouchEvent touch; ClutterTouchpadPinchEvent touchpad_pinch; ClutterTouchpadSwipeEvent touchpad_swipe; + ClutterProximityEvent proximity; }; /** diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c index 5252030ce..9a4e3ab87 100644 --- a/clutter/clutter/clutter-main.c +++ b/clutter/clutter/clutter-main.c @@ -2487,6 +2487,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/clutter-stage.c b/clutter/clutter/clutter-stage.c index 2c67ca3ad..e81a245b4 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/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); |