Hi,
would it be possible to apply the attached patch to 1.7.5 and make a
release which includes it?
I extracted this from git HEAD and it contains at least those fixes that
assign a suitable touch ID to the events. (2636da4e00b14, e290dfae93962,
01452373c76dca470)
Since I am working on touch support in the EFL WebKit MiniBrowser - it'd
be essential for me to have a release that contains at least those fixes.
Thanks very much,
Dominik
--
Dominik Röttsches <[email protected]>
diff --git a/configure.ac b/configure.ac
index b4ec95b..592ec37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1182,6 +1182,7 @@ if ! test "x$have_ecore_x_xcb" = "xyes" ; then
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_CHECK_X_EXTENSION([Xi2_2], [XInput2.h], [Xi],[XIGrabTouchBegin], [$want_ecore_x_input])
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}"
diff --git a/src/lib/ecore_x/xlib/ecore_x_xi2.c b/src/lib/ecore_x/xlib/ecore_x_xi2.c
index fbfbd43..9f7eeaa 100644
--- a/src/lib/ecore_x/xlib/ecore_x_xi2.c
+++ b/src/lib/ecore_x/xlib/ecore_x_xi2.c
@@ -19,8 +19,27 @@ int _ecore_x_xi2_opcode = -1;
#endif
#ifdef ECORE_XI2
+#ifdef ECORE_XI2_2
+#ifndef XITouchEmulatingPointer
+#define XITouchEmulatingPointer (1 << 17)
+#endif
+
+typedef struct _Ecore_X_Touch_Device_Info
+{
+ EINA_INLIST;
+ int devid;
+ int mode;
+ const char *name;
+ int max_touch;
+ int *slot;
+} Ecore_X_Touch_Device_Info;
+#endif /* ifdef ECORE_XI2_2 */
+
static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
static int _ecore_x_xi2_num = 0;
+#ifdef ECORE_XI2_2
+static Eina_Inlist *_ecore_x_xi2_touch_info_list = NULL;
+#endif /* ifdef ECORE_XI2_2 */
#endif /* ifdef ECORE_XI2 */
void
@@ -28,7 +47,7 @@ _ecore_x_input_init(void)
{
#ifdef ECORE_XI2
int event, error;
- int major = 2, minor = 0;
+ int major = XI_2_Major, minor = XI_2_Minor;
if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
&_ecore_x_xi2_opcode, &event, &error))
@@ -48,6 +67,27 @@ _ecore_x_input_init(void)
#endif /* ifdef ECORE_XI2 */
}
+#ifdef ECORE_XI2
+#ifdef ECORE_XI2_2
+static void
+_ecore_x_input_touch_info_clear(void)
+{
+ Eina_Inlist *l = _ecore_x_xi2_touch_info_list;
+ Ecore_X_Touch_Device_Info *info = NULL;
+
+ while (l)
+ {
+ info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Touch_Device_Info);
+ l = eina_inlist_remove(l, l);
+ if (info->slot) free(info->slot);
+ free(info);
+ }
+
+ _ecore_x_xi2_touch_info_list = NULL;
+}
+#endif /* ifdef ECORE_XI2_2 */
+#endif /* ifdef ECORE_XI2 */
+
void
_ecore_x_input_shutdown(void)
{
@@ -56,6 +96,9 @@ _ecore_x_input_shutdown(void)
{
XIFreeDeviceInfo(_ecore_x_xi2_devs);
_ecore_x_xi2_devs = NULL;
+#ifdef ECORE_XI2_2
+ _ecore_x_input_touch_info_clear();
+#endif /* ifdef ECORE_XI2_2 */
}
_ecore_x_xi2_num = 0;
@@ -63,6 +106,107 @@ _ecore_x_input_shutdown(void)
#endif /* ifdef ECORE_XI2 */
}
+#ifdef ECORE_XI2
+#ifdef ECORE_XI2_2
+static int
+_ecore_x_input_touch_index_get(int devid, int detail, int event_type)
+{
+ int i;
+ Eina_Inlist *l = _ecore_x_xi2_touch_info_list;
+ Ecore_X_Touch_Device_Info *info = NULL;
+
+ if ((!_ecore_x_xi2_devs) || (!_ecore_x_xi2_touch_info_list))
+ return 0;
+
+ EINA_INLIST_FOREACH(l, info)
+ if (info->devid == devid) break;
+
+ if ((!info) || (!info->slot)) return 0;
+
+ for (i = 0; i < info->max_touch ; i++)
+ {
+ int *p = &(info->slot[i]);
+
+ if ((event_type == XI_TouchBegin) && (*p < 0))
+ {
+ *p = detail;
+ return i;
+ }
+ else if (*p == detail)
+ {
+ return i;
+ }
+ }
+
+ return 0;
+}
+
+static void
+_ecore_x_input_touch_index_clear(int devid, int idx)
+{
+ Eina_Inlist *l = _ecore_x_xi2_touch_info_list;
+ Ecore_X_Touch_Device_Info *info = NULL;
+
+ if ((!_ecore_x_xi2_devs) || (!_ecore_x_xi2_touch_info_list))
+ return;
+
+ EINA_INLIST_FOREACH(l, info)
+ {
+ if ((info->devid == devid) && (info->slot))
+ {
+ info->slot[idx] = -1;
+ return;
+ }
+ }
+}
+
+static Ecore_X_Touch_Device_Info *
+_ecore_x_input_touch_info_get(XIDeviceInfo *dev)
+{
+ int k;
+ int *slot = NULL;
+ XITouchClassInfo *t = NULL;
+ Ecore_X_Touch_Device_Info *info = NULL;
+
+ if (!dev)
+ return NULL;
+
+ for (k = 0; k < dev->num_classes; k++)
+ {
+ XIAnyClassInfo *clas = dev->classes[k];
+
+ if (clas && (clas->type == XITouchClass))
+ {
+ t = (XITouchClassInfo *)clas;
+ break;
+ }
+ }
+
+ if (t && (t->type == XITouchClass))
+ {
+ info = calloc(1, sizeof(Ecore_X_Touch_Device_Info));
+ if (!info) return NULL;
+
+ slot = malloc(sizeof(int) * (t->num_touches + 1));
+ if (!slot)
+ {
+ free(info);
+ return NULL;
+ }
+
+ info->devid = dev->deviceid;
+ info->max_touch = t->num_touches + 1;
+ info->mode = t->mode;
+ info->name = dev->name;
+ memset(slot, -1, sizeof(int) * info->max_touch);
+ info->slot = slot;
+ }
+
+ return info;
+}
+#endif /* ifdef ECORE_XI2_2 */
+#endif
+
void
_ecore_x_input_handler(XEvent *xevent)
{
@@ -103,8 +247,8 @@ _ecore_x_input_handler(XEvent *xevent)
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
-
case XI_ButtonPress:
+ INF("ButtonEvent:multi press time=%u x=%d y=%d devid=%d", (unsigned int)evd->time, (int)evd->event_x, (int)evd->event_y, devid);
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
@@ -124,6 +268,7 @@ _ecore_x_input_handler(XEvent *xevent)
break;
case XI_ButtonRelease:
+ INF("ButtonEvent:multi release time=%u x=%d y=%d devid=%d", (unsigned int)evd->time, (int)evd->event_x, (int)evd->event_y, devid);
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
@@ -144,6 +289,10 @@ _ecore_x_input_handler(XEvent *xevent)
#ifdef XI_TouchUpdate
case XI_TouchUpdate:
+#ifdef ECORE_XI2_2
+ i = _ecore_x_input_touch_index_get(devid, evd->detail, XI_TouchUpdate);
+ if ((i == 0) && (evd->flags & XITouchEmulatingPointer)) return;
+#endif /* #ifdef ECORE_XI2_2 */
_ecore_mouse_move
(evd->time,
0, // state
@@ -153,16 +302,24 @@ _ecore_x_input_handler(XEvent *xevent)
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
+#ifdef ECORE_XI2_2
+ i, 1, 1,
+#else
devid, 1, 1,
+#endif /* #ifdef ECORE_XI2_2 */
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
-
#endif
+
#ifdef XI_TouchBegin
case XI_TouchBegin:
+#ifdef ECORE_XI2_2
+ i = _ecore_x_input_touch_index_get(devid, evd->detail, XI_TouchBegin);
+ if ((i == 0) && (evd->flags & XITouchEmulatingPointer)) return;
+#endif /* #ifdef ECORE_XI2_2 */
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
evd->time,
@@ -174,16 +331,27 @@ _ecore_x_input_handler(XEvent *xevent)
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
+#ifdef ECORE_XI2_2
+ i, 1, 1,
+#else
devid, 1, 1,
+#endif /* #ifdef ECORE_XI2_2 */
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
break;
-
#endif
+
#ifdef XI_TouchEnd
case XI_TouchEnd:
+#ifdef ECORE_XI2_2
+ i = _ecore_x_input_touch_index_get(devid, evd->detail, XI_TouchEnd);
+ if ((i == 0) && (evd->flags & XITouchEmulatingPointer)) {
+ _ecore_x_input_touch_index_clear(devid, i);
+ return;
+ }
+#endif /* #ifdef ECORE_XI2_2 */
_ecore_mouse_button
(ECORE_EVENT_MOUSE_BUTTON_UP,
evd->time,
@@ -195,14 +363,21 @@ _ecore_x_input_handler(XEvent *xevent)
(evd->child ? evd->child : evd->event),
evd->root,
1, // same_screen
+#ifdef ECORE_XI2_2
+ i, 1, 1,
+#else
devid, 1, 1,
+#endif /* #ifdef ECORE_XI2_2 */
1.0, // pressure
0.0, // angle
evd->event_x, evd->event_y,
evd->root_x, evd->root_y);
+#ifdef ECORE_XI2_2
+ _ecore_x_input_touch_index_clear(devid, i);
+#endif /* #ifdef ECORE_XI2_2 */
break;
-
#endif
+
default:
break;
}
@@ -240,38 +415,42 @@ ecore_x_input_multi_select(Ecore_X_Window win)
}
else if (dev->use == XISlavePointer)
{
- XIDeviceInfo *atdev = NULL;
- int j;
+ XIEventMask eventmask;
+ unsigned char mask[4] = { 0 };
- for (j = 0; j < _ecore_x_xi2_num; j++)
- {
- if (_ecore_x_xi2_devs[j].deviceid == dev->attachment)
- atdev = &(_ecore_x_xi2_devs[j]);
- }
- if (((atdev) && (atdev->use != XIMasterPointer)) ||
- (!atdev))
- {
- XIEventMask eventmask;
- unsigned char mask[4] = { 0 };
-
- eventmask.deviceid = dev->deviceid;
- eventmask.mask_len = sizeof(mask);
- eventmask.mask = mask;
- XISetMask(mask, XI_ButtonPress);
- XISetMask(mask, XI_ButtonRelease);
- XISetMask(mask, XI_Motion);
+ eventmask.deviceid = dev->deviceid;
+ eventmask.mask_len = sizeof(mask);
+ eventmask.mask = mask;
+ XISetMask(mask, XI_ButtonPress);
+ XISetMask(mask, XI_ButtonRelease);
+ XISetMask(mask, XI_Motion);
+#ifdef ECORE_XI2_2
+ Eina_Inlist *l = _ecore_x_xi2_touch_info_list;
+ Ecore_X_Touch_Device_Info *info;
+ info = _ecore_x_input_touch_info_get(dev);
+
+ if (info)
+ {
+ XISetMask(mask, XI_TouchUpdate);
+ XISetMask(mask, XI_TouchBegin);
+ XISetMask(mask, XI_TouchEnd);
+
+ l = eina_inlist_append(l, (Eina_Inlist *)info);
+ _ecore_x_xi2_touch_info_list = l;
+ }
+#else
# ifdef XI_TouchUpdate
- XISetMask(mask, XI_TouchUpdate);
+ XISetMask(mask, XI_TouchUpdate);
# endif
# ifdef XI_TouchBegin
- XISetMask(mask, XI_TouchBegin);
+ XISetMask(mask, XI_TouchBegin);
# endif
# ifdef XI_TouchEnd
- XISetMask(mask, XI_TouchEnd);
+ XISetMask(mask, XI_TouchEnd);
# endif
- XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
- find = EINA_TRUE;
- }
+#endif
+ XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
+ find = EINA_TRUE;
}
}
@@ -280,4 +459,3 @@ ecore_x_input_multi_select(Ecore_X_Window win)
return EINA_FALSE;
#endif /* ifdef ECORE_XI2 */
}
-
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel