want_ecore_x_render="yes"
want_ecore_x_screensaver="yes"
want_ecore_x_shape="yes"
+want_ecore_x_gesture="no"
want_ecore_x_sync="yes"
want_ecore_x_xfixes="yes"
want_ecore_x_xinerama="yes"
@<:@default=detect@:>@])],
[want_ecore_x_shape=$enableval])
+AC_ARG_ENABLE(ecore-x-gesture,
+ [AC_HELP_STRING([--enable-ecore-x-gesture],
+ [enable the ecore_x support for Xgesture extension.
+ @<:@default=detect@:>@])],
+ [want_ecore_x_gesture=$enableval])
+
AC_ARG_ENABLE(ecore-x-sync,
[AC_HELP_STRING([--disable-ecore-x-sync],
[disable the ecore_x support for Xsync extension.
AC_MSG_NOTICE("shape extension explicitly disabled")
fi
+ if test "x$want_ecore_x_gesture" != "xno"; then
+ PKG_CHECK_MODULES(XCB_XGESTURE, xcb-gesture,
+ [ have_ecore_x_xcb_gesture="yes"
+ requirements_ecore_x="xcb-gesture ${requirements_ecore_x}"
+ AC_DEFINE(ECORE_XCB_XGESTURE, 1, [Build support for XCB gesture]) ],
+ [ have_ecore_x_xcb_gesture="no" ])
+ else
+ have_ecore_x_xcb_gesture="no"
+ AC_MSG_NOTICE("gesture extension explicitly disabled")
+ fi
+
if test "x$want_ecore_x_sync" != "xno"; then
PKG_CHECK_MODULES(XCB_SYNC, xcb-sync,
[ have_ecore_x_xcb_sync="yes"
ECORE_CHECK_X_EXTENSION([Xinerama], [Xinerama.h], [Xinerama], [XineramaQueryScreens], [$want_ecore_x_xinerama])
ECORE_CHECK_X_EXTENSION([Xprint], [Print.h], [Xp], [XpQueryScreens], [$want_ecore_x_xprint])
ECORE_CHECK_X_EXTENSION([Xrandr], [Xrandr.h], [Xrandr], [XRRGetScreenResourcesCurrent], [$want_ecore_x_randr])
+ ECORE_CHECK_X_EXTENSION([Xgesture], [gesture.h], [Xgesture], [XGestureQueryExtension], [$want_ecore_x_gesture])
ECORE_CHECK_X_EXTENSION([Xrender], [Xrender.h], [Xrender], [XRenderFindVisualFormat], [$want_ecore_x_render])
ECORE_CHECK_X_EXTENSION([Xtest], [XTest.h], [Xtst], [XTestFakeKeyEvent], [$want_ecore_x_xtest])
ECORE_CHECK_X_EXTENSION([Xss], [scrnsaver.h], [Xss], [XScreenSaverSelectInput], [$want_ecore_x_screensaver])
ECORE_CHECK_X_EXTENSION([Xi2], [XInput2.h], [Xi], [XIQueryDevice], [$want_ecore_x_input])
- ecore_x_libs_private="${Xcursor_libs} ${XKB_LIBS} ${XCOMPOSITE_LIBS} ${XDAMAGE_LIBS} ${XDPMS_LIBS} ${XFIXES_LIBS} ${XINERAMA_LIBS} ${XPRINT_LIBS} ${XRANDR_LIBS} ${XRENDER_LIBS} ${XTEST_LIBS} ${XSS_LIBS} ${XI2_LIBS}"
+ ecore_x_libs_private="${Xcursor_libs} ${XKB_LIBS} ${XCOMPOSITE_LIBS} ${XGESTURE_LIBS} ${XDAMAGE_LIBS} ${XDPMS_LIBS} ${XFIXES_LIBS} ${XINERAMA_LIBS} ${XPRINT_LIBS} ${XRANDR_LIBS} ${XRENDER_LIBS} ${XTEST_LIBS} ${XSS_LIBS} ${XI2_LIBS}"
AC_DEFINE(HAVE_ECORE_X_XLIB, 1, [Defined to 1 if Xlib is enabled.])
have_x="yes"
echo " Xrandr.....................: $have_ecore_x_xcb_randr"
echo " Xscreensaver...............: $have_ecore_x_xcb_screensaver"
echo " Xshape.....................: $have_ecore_x_xcb_shape"
+ echo " Xgesture...................: $have_ecore_x_xcb_gesture"
echo " Xsync......................: $have_ecore_x_xcb_sync"
echo " Xrender....................: $have_ecore_x_xcb_render"
echo " Xcomposite.................: $have_ecore_x_xcb_composite"
echo " Xprint.....................: $use_xprint"
echo " Xinerama...................: $use_xinerama"
echo " Xrandr.....................: $use_xrandr"
+ echo " Xgesture...................: $use_xgesture"
echo " Xscreensaver...............: $use_xss"
echo " Xrender....................: $use_xrender"
echo " Xcomposite.................: $use_xcomposite"
typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message;
typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape;
typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver_Notify;
+typedef struct _Ecore_X_Event_Gesture_Notify_Flick Ecore_X_Event_Gesture_Notify_Flick;
+typedef struct _Ecore_X_Event_Gesture_Notify_Pan Ecore_X_Event_Gesture_Notify_Pan;
+typedef struct _Ecore_X_Event_Gesture_Notify_PinchRotation Ecore_X_Event_Gesture_Notify_PinchRotation;
+typedef struct _Ecore_X_Event_Gesture_Notify_Tap Ecore_X_Event_Gesture_Notify_Tap;
+typedef struct _Ecore_X_Event_Gesture_Notify_TapNHold Ecore_X_Event_Gesture_Notify_TapNHold;
+typedef struct _Ecore_X_Event_Gesture_Notify_Hold Ecore_X_Event_Gesture_Notify_Hold;
+typedef struct _Ecore_X_Event_Gesture_Notify_Group Ecore_X_Event_Gesture_Notify_Group;
typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter;
typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm;
typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change;
EAPI extern int ECORE_X_EVENT_CLIENT_MESSAGE;
EAPI extern int ECORE_X_EVENT_WINDOW_SHAPE;
EAPI extern int ECORE_X_EVENT_SCREENSAVER_NOTIFY;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PAN;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAP;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD;
+EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP;
EAPI extern int ECORE_X_EVENT_SYNC_COUNTER;
EAPI extern int ECORE_X_EVENT_SYNC_ALARM;
EAPI extern int ECORE_X_EVENT_SCREEN_CHANGE;
EAPI Eina_Bool
ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win);
+typedef enum _Ecore_X_Gesture_Event_Mask
+{
+ ECORE_X_GESTURE_EVENT_MASK_NONE = 0L,
+ ECORE_X_GESTURE_EVENT_MASK_FLICK = (1L << 0),
+ ECORE_X_GESTURE_EVENT_MASK_PAN = (1L << 1),
+ ECORE_X_GESTURE_EVENT_MASK_PINCHROTATION = (1L << 2),
+ ECORE_X_GESTURE_EVENT_MASK_TAP = (1L << 3),
+ ECORE_X_GESTURE_EVENT_MASK_TAPNHOLD = (1L << 4),
+ ECORE_X_GESTURE_EVENT_MASK_HOLD = (1L << 5),
+ ECORE_X_GESTURE_EVENT_MASK_GROUP = (1L << 6)
+} Ecore_X_Gesture_Event_Mask;
+
+typedef enum _Ecore_X_Gesture_Event_Type
+{
+ ECORE_X_GESTURE_EVENT_FLICK,
+ ECORE_X_GESTURE_EVENT_PAN,
+ ECORE_X_GESTURE_EVENT_PINCHROTATION,
+ ECORE_X_GESTURE_EVENT_TAP,
+ ECORE_X_GESTURE_EVENT_TAPNHOLD,
+ ECORE_X_GESTURE_EVENT_HOLD,
+ ECORE_X_GESTURE_EVENT_GROUP
+} Ecore_X_Gesture_Event_Type;
+
+typedef enum _Ecore_X_Gesture_Event_Subtype
+{
+ ECORE_X_GESTURE_END,
+ ECORE_X_GESTURE_BEGIN,
+ ECORE_X_GESTURE_UPDATE,
+ ECORE_X_GESTURE_DONE
+} Ecore_X_Gesture_Event_Subtype;
+
+typedef enum _Ecore_X_Gesture_Group_Subtype
+{
+ ECORE_X_GESTURE_GROUP_REMOVED,
+ ECORE_X_GESTURE_GROUP_ADDED,
+ ECORE_X_GESTURE_GROUP_CURRENT
+} Ecore_X_Gesture_Group_Subtype;
+
+typedef enum _Ecore_X_Gesture_Direction
+{
+ ECORE_X_GESTURE_NORTHWARD,
+ ECORE_X_GESTURE_NORTHEASTWARD,
+ ECORE_X_GESTURE_EASTWARD,
+ ECORE_X_GESTURE_SOUTHEASTWARD,
+ ECORE_X_GESTURE_SOUTHWARD,
+ ECORE_X_GESTURE_SOUTHWESTWARD,
+ ECORE_X_GESTURE_WESTWARD,
+ ECORE_X_GESTURE_NORTHWESTWARD
+} Ecore_X_Gesture_Direction;
+
+struct _Ecore_X_Event_Gesture_Notify_Flick
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int distance;
+ Ecore_X_Time duration;
+ Ecore_X_Gesture_Direction direction;
+ double angle;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_Pan
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int dx;
+ int dy;
+ int distance;
+ Ecore_X_Time duration;
+ Ecore_X_Gesture_Direction direction;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_PinchRotation
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int distance;
+ int cx;
+ int cy;
+ double zoom;
+ double angle;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_Tap
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ int tap_repeat;
+ Ecore_X_Time interval;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_TapNHold
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ Ecore_X_Time interval;
+ Ecore_X_Time hold_time;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_Hold
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Event_Subtype subtype;
+ int num_fingers;
+ int cx;
+ int cy;
+ Ecore_X_Time hold_time;
+};
+
+struct _Ecore_X_Event_Gesture_Notify_Group
+{
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Gesture_Group_Subtype subtype;
+ int num_groups;
+ int group_id;
+};
+
+EAPI Eina_Bool
+ecore_x_gesture_supported(void);
+
+EAPI Eina_Bool
+ecore_x_gesture_events_select(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Mask mask);
+
+EAPI Ecore_X_Gesture_Event_Mask
+ecore_x_gesture_events_selected_get(Ecore_X_Window win);
+
+EAPI Eina_Bool
+ecore_x_gesture_event_grab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers);
+
+EAPI Eina_Bool
+ecore_x_gesture_event_ungrab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers);
+
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
@XCB_XPRINT_CFLAGS@ \
@XCB_XTEST_CFLAGS@ \
@XCB_XINPUT_CFLAGS@ \
+ @XCB_XGESTURE_CFLAGS@ \
@XCB_CURSOR_CFLAGS@ \
@ECORE_XCB_CFLAGS@ \
@PIXMAN_CFLAGS@ \
ecore_xcb_gc.c \
ecore_xcb_image.c \
ecore_xcb_input.c \
+ ecore_xcb_gesture.c \
ecore_xcb_mwm.c \
ecore_xcb_pixmap.c \
ecore_xcb_region.c \
@XCB_XPRINT_LIBS@ \
@XCB_XTEST_LIBS@ \
@XCB_XINPUT_LIBS@ \
+ @XCB_XGESTURE_LIBS@ \
@XCB_CURSOR_LIBS@ \
@ECORE_XCB_LIBS@ \
@PIXMAN_LIBS@ \
/* shutdown input extension */
_ecore_xcb_input_shutdown();
+ /* shutdown gesture extension */
+ _ecore_xcb_gesture_shutdown();
+
/* shutdown selection */
_ecore_xcb_selection_shutdown();
# ifdef ECORE_XCB_XFIXES
# include <xcb/xfixes.h>
# endif
+# ifdef ECORE_XCB_XGESTURE
+# include <xcb/gesture.h>
+# endif
#ifndef CODESET
# define CODESET "INVALID"
static void _ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event);
static void _ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event);
static void _ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event);
+#ifdef ECORE_XCB_XGESTURE
+static void _ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event);
+static void _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event);
+#endif
#ifdef ECORE_XCB_SHAPE
static void _ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event);
#endif
EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = 0;
EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new();
ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
_ecore_xcb_event_screensaver + XCB_SCREENSAVER_NOTIFY))
_ecore_xcb_event_handle_screensaver_notify(ev);
#endif
+#ifdef ECORE_XCB_XGESTURE
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_FLICK))
+ _ecore_xcb_event_handle_gesture_notify_flick(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PAN))
+ _ecore_xcb_event_handle_gesture_notify_pan(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PINCH_ROTATION))
+ _ecore_xcb_event_handle_gesture_notify_pinchrotation(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP))
+ _ecore_xcb_event_handle_gesture_notify_tap(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP_N_HOLD))
+ _ecore_xcb_event_handle_gesture_notify_tapnhold(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_HOLD))
+ _ecore_xcb_event_handle_gesture_notify_hold(ev);
+ else if ((_ecore_xcb_event_gesture >= 0) &&
+ (response ==
+ _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_GROUP))
+ _ecore_xcb_event_handle_gesture_notify_group(ev);
+#endif
#ifdef ECORE_XCB_SHAPE
else if ((_ecore_xcb_event_shape >= 0) &&
(response == (_ecore_xcb_event_shape + XCB_SHAPE_NOTIFY)))
#endif
}
+#ifdef ECORE_XCB_XGESTURE
+static void
+_ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_flick_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_Flick *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_flick_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->distance = ev->distance;
+ e->duration = ev->duration;
+ e->direction = ev->direction;
+ e->angle = XFixedToDouble(ev->angle);
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL);
+}
+
+static void
+_ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_pan_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_Pan *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_pan_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->dx = ev->dx;
+ e->dy = ev->dy;
+ e->distance = ev->distance;
+ e->duration = ev->duration;
+ e->direction = ev->direction;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL);
+}
+
+static void
+_ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_pinch_rotation_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_PinchRotation *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_pinch_rotation_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->distance = ev->distance;
+ e->cx = ev->cx;
+ e->cy = ev->cy;
+ e->zoom = XFixedToDouble(ev->zoom);
+ e->angle = XFixedToDouble(ev->angle);
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL);
+}
+
+static void
+_ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_tap_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_Tap *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_tap_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->cx = ev->cx;
+ e->cy = ev->cy;
+ e->tap_repeat = ev->tap_repeat;
+ e->interval = ev->interval;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL);
+}
+
+static void
+_ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_tap_n_hold_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_TapNHold *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_tap_n_hold_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->cx = ev->cx;
+ e->cy = ev->cy;
+ e->interval = ev->interval;
+ e->hold_time = ev->holdtime;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL);
+}
+
+static void
+ _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_hold_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_Hold *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_hold_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_fingers = ev->num_finger;
+ e->cx = ev->cx;
+ e->cy = ev->cy;
+ e->hold_time = ev->holdtime;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL);
+}
+
+static void
+ _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event)
+{
+ xcb_gesture_notify_group_event_t *ev;
+ Ecore_X_Event_Gesture_Notify_Group *e;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ _ecore_xcb_event_last_mouse_move = EINA_FALSE;
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ev = (xcb_gesture_notify_group_event_t *)event;
+ if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)))) return;
+
+ e->win = ev->window;
+ e->time = ev->time;
+ e->subtype = ev->kind;
+ e->num_groups = ev->num_group;
+ e->group_id = ev->groupid;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL);
+}
+#endif
+
#ifdef ECORE_XCB_SHAPE
static void
_ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event)
_ecore_xcb_input_init();
#endif
+#ifdef ECORE_XCB_GESTURE
+ _ecore_xcb_gesture_init();
+#endif
+
/* #ifdef ECORE_XCB_DRI */
/* _ecore_xcb_dri_init(); */
/* #endif */
_ecore_xcb_input_finalize();
#endif
+#ifdef ECORE_XCB_GESTURE
+ _ecore_xcb_gesture_finalize();
+#endif
+
/* #ifdef ECORE_XCB_DRI */
/* _ecore_xcb_dri_finalize(); */
/* #endif */
--- /dev/null
+#include "ecore_xcb_private.h"
+#ifdef ECORE_XCB_XGESTURE
+# include <xcb/gesture.h>
+# include <xcb/xcb_event.h>
+#endif
+
+/* local variables */
+static Eina_Bool _gesture_available = EINA_FALSE;
+
+/* external variables */
+int _ecore_xcb_event_gesture = -1;
+
+void
+_ecore_xcb_gesture_init(void)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+#ifdef ECORE_XCB_XGESTURE
+ xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_gesture_id);
+#endif
+}
+
+void
+_ecore_xcb_gesture_finalize(void)
+{
+#ifdef ECORE_XCB_XGESTURE
+ xcb_gesture_query_version_cookie_t cookie;
+ xcb_gesture_query_version_reply_t *reply;
+#endif
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+#ifdef ECORE_XCB_XGESTURE
+ cookie =
+ xcb_gesture_query_version_unchecked(_ecore_xcb_conn);
+ reply =
+ xcb_gesture_query_version_reply(_ecore_xcb_conn, cookie, NULL);
+ if (reply)
+ {
+ _gesture_available = EINA_TRUE;
+ free(reply);
+ }
+
+ if (_gesture_available)
+ {
+ const xcb_query_extension_reply_t *ext_reply;
+
+ ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_gesture_id);
+ if (ext_reply)
+ _ecore_xcb_event_gesture = ext_reply->first_event;
+ }
+#endif
+}
+
+void
+_ecore_xcb_gesture_shutdown(void)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_supported(void)
+{
+ return _gesture_available;
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_events_select(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Mask mask)
+{
+#ifdef ECORE_XCB_XGESTURE
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ xcb_gesture_select_events(_ecore_xcb_conn, win, mask);
+
+ return EINA_TRUE;
+#else
+ return EINA_FALSE;
+#endif
+}
+
+EAPI Ecore_X_Gesture_Event_Mask
+ecore_x_gesture_events_selected_get(Ecore_X_Window win)
+{
+#ifdef ECORE_XCB_XGESTURE
+ xcb_gesture_get_selected_events_cookie_t ecookie;
+ xcb_gesture_get_selected_events_reply_t *ereply;
+ Ecore_X_Gesture_Event_Mask mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
+
+ if (!_gesture_available)
+ return mask;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ecookie = xcb_gesture_get_selected_events(_ecore_xcb_conn, win);
+ ereply = xcb_gesture_get_selected_events_reply(_ecore_xcb_conn,
+ ecookie,
+ NULL);
+ if (ereply)
+ {
+ mask = ereply->mask;
+ free(ereply);
+ }
+
+ return mask;
+#else
+ return ECORE_X_GESTURE_EVENT_MASK_NONE;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_event_grab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers)
+{
+#ifdef ECORE_XCB_XGESTURE
+ Eina_Bool status = EINA_TRUE;
+ xcb_gesture_grab_event_cookie_t ecookie;
+ xcb_gesture_grab_event_reply_t *ereply;
+
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ecookie = xcb_gesture_grab_event(_ecore_xcb_conn, win, type, num_fingers, 0L);
+ ereply = xcb_gesture_grab_event_reply(_ecore_xcb_conn, ecookie, NULL);
+
+ if (ereply)
+ {
+ if (ereply->status)
+ {
+ status = EINA_FALSE;
+ }
+
+ free(ereply);
+ }
+ else
+ status = EINA_FALSE;
+
+ return status;
+#else
+ return EINA_FALSE;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_event_ungrab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers)
+{
+#ifdef ECORE_XCB_XGESTURE
+ Eina_Bool status = EINA_TRUE;
+ xcb_gesture_ungrab_event_cookie_t ecookie;
+ xcb_gesture_ungrab_event_reply_t *ereply;
+
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ CHECK_XCB_CONN
+ fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__);
+
+ ecookie = xcb_gesture_ungrab_event(_ecore_xcb_conn, win, type, num_fingers, 0L);
+ ereply = xcb_gesture_ungrab_event_reply(_ecore_xcb_conn, ecookie, NULL);
+
+ if (ereply)
+ {
+ if (ereply->status)
+ {
+ status = EINA_FALSE;
+ }
+
+ free(ereply);
+ }
+ else
+ status = EINA_FALSE;
+
+ return status;
+#else
+ return EINA_FALSE;
+#endif
+}
+
extern int _ecore_xcb_event_sync;
extern int _ecore_xcb_event_xfixes;
extern int _ecore_xcb_event_input;
+extern int _ecore_xcb_event_gesture;
extern int ECORE_X_MODIFIER_SHIFT;
extern int ECORE_X_MODIFIER_CTRL;
void _ecore_xcb_randr_init(void);
void _ecore_xcb_randr_finalize(void);
+void _ecore_xcb_gesture_init(void);
+void _ecore_xcb_gesture_finalize(void);
+void _ecore_xcb_gesture_shutdown(void);
+
void _ecore_xcb_xfixes_init(void);
void _ecore_xcb_xfixes_finalize(void);
Eina_Bool _ecore_xcb_xfixes_avail_get(void);
@XKB_CFLAGS@ \
@XDAMAGE_CFLAGS@ \
@XCOMPOSITE_CFLAGS@ \
+@XGESTURE_CFLAGS@ \
@XDPMS_CFLAGS@ \
@XFIXES_CFLAGS@ \
@XI2_CFLAGS@ \
ecore_x_image.c \
ecore_x_xi2.c \
ecore_x_vsync.c \
-ecore_x_randr.h
+ecore_x_randr.h \
+ecore_x_gesture.c
libecore_x_xlib_la_LIBADD = \
@Xcursor_libs@ \
@XKB_LIBS@ \
@XDAMAGE_LIBS@ \
@XCOMPOSITE_LIBS@ \
+@XGESTURE_LIBS@ \
@XDPMS_LIBS@ \
@XFIXES_LIBS@ \
@XI2_LIBS@ \
#ifdef ECORE_XDAMAGE
static int _ecore_x_event_damage_id = 0;
#endif /* ifdef ECORE_XDAMAGE */
+#ifdef ECORE_XGESTURE
+static int _ecore_x_event_gesture_id = 0;
+#endif /* ifdef ECORE_XGESTURE */
static int _ecore_x_event_handlers_num = 0;
static void (**_ecore_x_event_handlers) (XEvent * event) = NULL;
EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD;
+EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP;
EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
int damage_base = 0;
int damage_err_base = 0;
#endif /* ifdef ECORE_XDAMAGE */
+#ifdef ECORE_XGESTURE
+ int gesture_base = 0;
+ int gesture_err_base = 0;
+#endif /* ifdef ECORE_XGESTURE */
if (++_ecore_x_init_count != 1)
return _ecore_x_init_count;
ECORE_X_EVENT_HANDLERS_GROW(damage_base, XDamageNumberEvents);
#endif /* ifdef ECORE_XDAMAGE */
+#ifdef ECORE_XGESTURE
+ if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base))
+ _ecore_x_event_gesture_id = gesture_base;
+
+ ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents);
+#endif /* ifdef ECORE_XGESTURE */
+
_ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
if (!_ecore_x_event_handlers)
goto close_display;
while (0);
#endif /* ifdef ECORE_XKB */
+#ifdef ECORE_XGESTURE
+ if (_ecore_x_event_gesture_id)
+ {
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] =
+ _ecore_x_event_handle_gesture_notify_flick;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] =
+ _ecore_x_event_handle_gesture_notify_pan;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] =
+ _ecore_x_event_handle_gesture_notify_pinchrotation;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] =
+ _ecore_x_event_handle_gesture_notify_tap;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] =
+ _ecore_x_event_handle_gesture_notify_tapnhold;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] =
+ _ecore_x_event_handle_gesture_notify_hold;
+ _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] =
+ _ecore_x_event_handle_gesture_notify_group;
+ }
+
+#endif /* ifdef ECORE_XGESTURE */
+
if (!ECORE_X_EVENT_ANY)
{
ECORE_X_EVENT_ANY = ecore_event_type_new();
ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new();
+ ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new();
ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
_ecore_x_composite_init();
_ecore_x_dpms_init();
_ecore_x_randr_init();
+ _ecore_x_gesture_init();
_ecore_x_input_init();
_ecore_x_events_init();
#endif /* ifdef ECORE_XI2 */
} /* _ecore_x_event_handle_generic_event */
+#ifdef ECORE_XGESTURE
+void
+_ecore_x_event_handle_gesture_notify_flick(XEvent *xevent)
+{
+ XGestureNotifyFlickEvent *xfe;
+ Ecore_X_Event_Gesture_Notify_Flick *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xfe = (XGestureNotifyFlickEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick));
+ if (!e)
+ return;
+
+ e->win = xfe->window;
+ e->time = xfe->time;
+ e->subtype = xfe->kind;
+ e->num_fingers = xfe->num_finger;
+ e->distance = xfe->distance;
+ e->duration = xfe->duration;
+ e->direction = xfe->direction;
+ e->angle = XFixedToDouble(xfe->angle);
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL);
+}
+
+void
+_ecore_x_event_handle_gesture_notify_pan(XEvent *xevent)
+{
+ XGestureNotifyPanEvent *xpe;
+ Ecore_X_Event_Gesture_Notify_Pan *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xpe = (XGestureNotifyPanEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan));
+ if (!e)
+ return;
+
+ e->win = xpe->window;
+ e->time = xpe->time;
+ e->subtype = xpe->kind;
+ e->num_fingers = xpe->num_finger;
+ e->dx = xpe->dx;
+ e->dy = xpe->dy;
+ e->distance = xpe->distance;
+ e->duration = xpe->duration;
+ e->direction = xpe->direction;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL);
+}
+
+void
+_ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent)
+{
+ XGestureNotifyPinchRotationEvent *xpre;
+ Ecore_X_Event_Gesture_Notify_PinchRotation *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xpre = (XGestureNotifyPinchRotationEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation));
+ if (!e)
+ return;
+
+ e->win = xpre->window;
+ e->time = xpre->time;
+ e->subtype = xpre->kind;
+ e->num_fingers = xpre->num_finger;
+ e->distance = xpre->distance;
+ e->cx = xpre->cx;
+ e->cy = xpre->cy;
+ e->zoom = XFixedToDouble(xpre->zoom);
+ e->angle = XFixedToDouble(xpre->angle);
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL);
+}
+
+void
+_ecore_x_event_handle_gesture_notify_tap(XEvent *xevent)
+{
+ XGestureNotifyTapEvent *xte;
+ Ecore_X_Event_Gesture_Notify_Tap *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xte = (XGestureNotifyTapEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap));
+ if (!e)
+ return;
+
+ e->win = xte->window;
+ e->time = xte->time;
+ e->subtype = xte->kind;
+ e->num_fingers = xte->num_finger;
+ e->cx = xte->cx;
+ e->cy = xte->cy;
+ e->tap_repeat = xte->tap_repeat;
+ e->interval = xte->interval;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL);
+}
+
+void
+_ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent)
+{
+ XGestureNotifyTapNHoldEvent *xthe;
+ Ecore_X_Event_Gesture_Notify_TapNHold *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xthe = (XGestureNotifyTapNHoldEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold));
+ if (!e)
+ return;
+
+ e->win = xthe->window;
+ e->time = xthe->time;
+ e->subtype = xthe->kind;
+ e->num_fingers = xthe->num_finger;
+ e->cx = xthe->cx;
+ e->cy = xthe->cy;
+ e->interval = xthe->interval;
+ e->hold_time = xthe->holdtime;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL);
+}
+
+void
+ _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent)
+{
+ XGestureNotifyHoldEvent *xhe;
+ Ecore_X_Event_Gesture_Notify_Hold *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xhe = (XGestureNotifyHoldEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold));
+ if (!e)
+ return;
+
+ e->win = xhe->window;
+ e->time = xhe->time;
+ e->subtype = xhe->kind;
+ e->num_fingers = xhe->num_finger;
+ e->cx = xhe->cx;
+ e->cy = xhe->cy;
+ e->hold_time = xhe->holdtime;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL);
+}
+
+void
+ _ecore_x_event_handle_gesture_notify_group(XEvent *xevent)
+{
+ XGestureNotifyGroupEvent *xge;
+ Ecore_X_Event_Gesture_Notify_Group *e;
+
+ _ecore_x_last_event_mouse_move = 0;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ xge = (XGestureNotifyGroupEvent *)xevent;
+ e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group));
+ if (!e)
+ return;
+
+ e->win = xge->window;
+ e->time = xge->time;
+ e->subtype = xge->kind;
+ e->num_groups = xge->num_group;
+ e->group_id = xge->groupid;
+
+ ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL);
+}
+#endif /* ifdef ECORE_XGESTURE */
+
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* ifdef HAVE_CONFIG_H */
+
+#include "ecore_x_private.h"
+
+static Eina_Bool _gesture_available = EINA_FALSE;
+
+#ifdef ECORE_XGESTURE
+static int _gesture_major, _gesture_minor, _gesture_patch;
+int _gesture_version;
+#endif /* ifdef ECORE_XGESTURE */
+
+void
+_ecore_x_gesture_init(void)
+{
+#ifdef ECORE_XGESTURE
+ _gesture_major = 0;
+ _gesture_minor = 0;
+ _gesture_patch = 0;
+ _gesture_version = 0;
+
+ if (XGestureQueryVersion(_ecore_x_disp, &_gesture_major, &_gesture_minor, &_gesture_patch))
+ {
+ _gesture_version = (_gesture_major << 16) | _gesture_minor;
+ _gesture_available = EINA_TRUE;
+ }
+ else
+ _gesture_available = EINA_FALSE;
+#else /* ifdef ECORE_XGESTURE */
+ _gesture_available = EINA_FALSE;
+#endif /* ifdef ECORE_XGESTURE */
+}
+
+/*
+ * @brief query whether gesture is available or not
+ * @return EINA_TRUE, if extension is available, else EINA_FALSE
+ */
+EAPI Eina_Bool
+ecore_x_gesture_supported(void)
+{
+ return _gesture_available;
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_events_select(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Mask mask)
+{
+#ifdef ECORE_XGESTURE
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ XGestureSelectEvents(_ecore_x_disp, win, mask);
+
+ return EINA_TRUE;
+#else /* ifdef ECORE_XGESTURE */
+ return EINA_FALSE;
+#endif /* ifdef ECORE_XGESTURE */
+}
+
+EAPI Ecore_X_Gesture_Event_Mask
+ecore_x_gesture_events_selected_get(Ecore_X_Window win)
+{
+#ifdef ECORE_XGESTURE
+ Ecore_X_Gesture_Event_Mask mask;
+
+ if (!_gesture_available)
+ return ECORE_X_GESTURE_EVENT_MASK_NONE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask))
+ {
+ mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
+ return mask;
+ }
+
+ return mask;
+#else /* ifdef ECORE_XGESTURE */
+ return ECORE_X_GESTURE_EVENT_MASK_NONE;
+#endif /* ifdef ECORE_XGESTURE */
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_event_grab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers)
+{
+#ifdef ECORE_XGESTURE
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
+ {
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+#else /* ifdef ECORE_XGESTURE */
+ return EINA_FALSE;
+#endif /* ifdef ECORE_XGESTURE */
+}
+
+EAPI Eina_Bool
+ecore_x_gesture_event_ungrab(Ecore_X_Window win,
+ Ecore_X_Gesture_Event_Type type,
+ int num_fingers)
+{
+#ifdef ECORE_XGESTURE
+ Ecore_X_Gesture_Event_Mask mask;
+
+ if (!_gesture_available)
+ return EINA_FALSE;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
+ {
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+#else /* ifdef ECORE_XGESTURE */
+ return EINA_FALSE;
+#endif /* ifdef ECORE_XGESTURE */
+}
+
#ifdef ECORE_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif /* ifdef ECORE_XDAMAGE */
+#ifdef ECORE_XGESTURE
+#include <X11/extensions/gesture.h>
+#include <X11/extensions/gestureproto.h>
+#endif /* ifdef ECORE_XGESTURE */
#ifdef ECORE_XDPMS
#include <X11/extensions/dpms.h>
#endif /* ifdef ECORE_XDPMS */
void _ecore_x_event_handle_mapping_notify(XEvent *xevent);
void _ecore_x_event_handle_shape_change(XEvent *xevent);
void _ecore_x_event_handle_screensaver_notify(XEvent *xevent);
+#ifdef ECORE_XGESTURE
+void _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent);
+void _ecore_x_event_handle_gesture_notify_group(XEvent *xevent);
+#endif /* ifdef ECORE_XGESTURE */
void _ecore_x_event_handle_sync_counter(XEvent *xevent);
void _ecore_x_event_handle_sync_alarm(XEvent *xevent);
#ifdef ECORE_XRANDR
void _ecore_x_composite_init(void);
void _ecore_x_dpms_init(void);
void _ecore_x_randr_init(void);
+void _ecore_x_gesture_init(void);
void _ecore_x_atoms_init(void);