2010-01-16 04:20:56 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef HAVE_CONFIG_H */
|
2010-01-16 04:20:56 -08:00
|
|
|
|
|
|
|
#include <string.h>
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
#include <math.h>
|
2010-01-16 04:20:56 -08:00
|
|
|
|
|
|
|
#include "Ecore.h"
|
|
|
|
#include "ecore_x_private.h"
|
|
|
|
#include "Ecore_X.h"
|
|
|
|
|
|
|
|
#ifdef ECORE_XI2
|
2010-01-18 21:13:58 -08:00
|
|
|
#include "Ecore_Input.h"
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2010-01-18 21:13:58 -08:00
|
|
|
|
2010-01-16 04:20:56 -08:00
|
|
|
int _ecore_x_xi2_opcode = -1;
|
2010-01-17 00:52:38 -08:00
|
|
|
|
2011-10-14 00:23:09 -07:00
|
|
|
#ifndef XIPointerEmulated
|
|
|
|
#define XIPointerEmulated (1 << 16)
|
|
|
|
#endif
|
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
#ifdef ECORE_XI2
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2013-01-16 01:03:55 -08:00
|
|
|
#ifndef XITouchEmulatingPointer
|
|
|
|
#define XITouchEmulatingPointer (1 << 17)
|
|
|
|
#endif
|
|
|
|
|
2012-12-04 22:57:30 -08:00
|
|
|
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 */
|
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
|
|
|
|
static int _ecore_x_xi2_num = 0;
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
|
|
|
static Eina_Inlist *_ecore_x_xi2_touch_info_list = NULL;
|
|
|
|
#endif /* ifdef ECORE_XI2_2 */
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2010-01-16 04:20:56 -08:00
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
void
|
|
|
|
_ecore_x_input_init(void)
|
2010-01-16 04:20:56 -08:00
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
2010-01-17 00:52:38 -08:00
|
|
|
int event, error;
|
2012-12-04 22:57:30 -08:00
|
|
|
int major = XI_2_Major, minor = XI_2_Minor;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
|
2010-01-17 00:52:38 -08:00
|
|
|
&_ecore_x_xi2_opcode, &event, &error))
|
2010-01-16 04:20:56 -08:00
|
|
|
{
|
2010-01-17 00:52:38 -08:00
|
|
|
_ecore_x_xi2_opcode = -1;
|
|
|
|
return;
|
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest)
|
|
|
|
{
|
|
|
|
_ecore_x_xi2_opcode = -1;
|
|
|
|
return;
|
2010-01-16 04:20:56 -08:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
_ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices,
|
2010-01-17 00:52:38 -08:00
|
|
|
&_ecore_x_xi2_num);
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-01-17 00:52:38 -08:00
|
|
|
|
2012-12-04 22:57:30 -08:00
|
|
|
#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);
|
2012-12-26 21:26:14 -08:00
|
|
|
if (info->slot) free(info->slot);
|
2012-12-04 22:57:30 -08:00
|
|
|
free(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
_ecore_x_xi2_touch_info_list = NULL;
|
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XI2_2 */
|
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
#ifdef ECORE_XI2
|
|
|
|
static Atom
|
|
|
|
_ecore_x_input_get_axis_label(char *axis_name)
|
|
|
|
{
|
|
|
|
static Atom *atoms = NULL;
|
|
|
|
static char *names[] =
|
|
|
|
{
|
|
|
|
"Abs X", "Abs Y", "Abs Pressure",
|
|
|
|
"Abs Distance", "Abs Rotary Z",
|
|
|
|
"Abs Wheel", "Abs Tilt X", "Abs Tilt Y"
|
|
|
|
};
|
|
|
|
int n = sizeof(names) / sizeof(names[0]);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (atoms == NULL)
|
|
|
|
{
|
|
|
|
atoms = calloc(n, sizeof(Atom));
|
|
|
|
if (!atoms) return 0;
|
|
|
|
|
|
|
|
if (!XInternAtoms(_ecore_x_disp, names, n, 1, atoms))
|
|
|
|
{
|
|
|
|
free(atoms);
|
|
|
|
atoms = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(axis_name, names[i])) return atoms[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
void
|
|
|
|
_ecore_x_input_shutdown(void)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
if (_ecore_x_xi2_devs)
|
2010-01-16 04:20:56 -08:00
|
|
|
{
|
2010-01-17 00:52:38 -08:00
|
|
|
XIFreeDeviceInfo(_ecore_x_xi2_devs);
|
|
|
|
_ecore_x_xi2_devs = NULL;
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
|
|
|
_ecore_x_input_touch_info_clear();
|
|
|
|
#endif /* ifdef ECORE_XI2_2 */
|
2010-01-16 04:20:56 -08:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
_ecore_x_xi2_num = 0;
|
|
|
|
_ecore_x_xi2_opcode = -1;
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-01-17 00:52:38 -08:00
|
|
|
|
2012-12-04 22:57:30 -08:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-26 21:26:14 -08:00
|
|
|
static Ecore_X_Touch_Device_Info *
|
|
|
|
_ecore_x_input_touch_info_get(XIDeviceInfo *dev)
|
2012-12-04 22:57:30 -08:00
|
|
|
{
|
|
|
|
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++)
|
|
|
|
{
|
2012-12-26 21:26:14 -08:00
|
|
|
XIAnyClassInfo *clas = dev->classes[k];
|
2012-12-04 22:57:30 -08:00
|
|
|
|
2012-12-26 21:26:14 -08:00
|
|
|
if (clas && (clas->type == XITouchClass))
|
2012-12-04 22:57:30 -08:00
|
|
|
{
|
2012-12-26 21:26:14 -08:00
|
|
|
t = (XITouchClassInfo *)clas;
|
2012-12-04 22:57:30 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t && (t->type == XITouchClass))
|
|
|
|
{
|
|
|
|
info = calloc(1, sizeof(Ecore_X_Touch_Device_Info));
|
|
|
|
if (!info) return NULL;
|
|
|
|
|
2012-12-26 21:26:14 -08:00
|
|
|
slot = malloc(sizeof(int) * (t->num_touches + 1));
|
2012-12-04 22:57:30 -08:00
|
|
|
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;
|
2012-12-26 21:26:14 -08:00
|
|
|
memset(slot, -1, sizeof(int) * info->max_touch);
|
2012-12-04 22:57:30 -08:00
|
|
|
info->slot = slot;
|
|
|
|
}
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XI2_2 */
|
|
|
|
#endif
|
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
void
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
_ecore_x_input_raw_handler(XEvent *xevent)
|
2010-01-18 21:13:58 -08:00
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
if (xevent->type != GenericEvent) return;
|
2011-10-14 02:11:49 -07:00
|
|
|
|
2012-10-03 22:56:59 -07:00
|
|
|
switch (xevent->xcookie.evtype)
|
|
|
|
{
|
|
|
|
#ifdef XI_RawButtonPress
|
|
|
|
case XI_RawButtonPress:
|
|
|
|
ecore_event_add(ECORE_X_RAW_BUTTON_PRESS, NULL, NULL, NULL);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef XI_RawButtonRelease
|
|
|
|
case XI_RawButtonRelease:
|
|
|
|
ecore_event_add(ECORE_X_RAW_BUTTON_RELEASE, NULL, NULL, NULL);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef XI_RawMotion
|
|
|
|
case XI_RawMotion:
|
|
|
|
ecore_event_add(ECORE_X_RAW_MOTION, NULL, NULL, NULL);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
}
|
2012-10-03 22:56:59 -07:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
void
|
|
|
|
_ecore_x_input_mouse_handler(XEvent *xevent)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
if (xevent->type != GenericEvent) return;
|
|
|
|
|
|
|
|
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
|
|
|
int devid = evd->deviceid;
|
2011-10-20 22:40:59 -07:00
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
switch (xevent->xcookie.evtype)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
case XI_Motion:
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
INF("Handling XI_Motion");
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_mouse_move
|
|
|
|
(evd->time,
|
|
|
|
0, // state
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
|
|
|
devid, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
|
|
|
break;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
case XI_ButtonPress:
|
2013-01-26 01:47:21 -08:00
|
|
|
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);
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_mouse_button
|
|
|
|
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
|
|
|
evd->time,
|
|
|
|
0, // state
|
|
|
|
0, // button
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
|
|
|
devid, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
|
|
|
break;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
case XI_ButtonRelease:
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
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);
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_mouse_button
|
|
|
|
(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
|
|
evd->time,
|
|
|
|
0, // state
|
|
|
|
0, // button
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
|
|
|
devid, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
|
|
|
break;
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_input_multi_handler(XEvent *xevent)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
if (xevent->type != GenericEvent) return;
|
|
|
|
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
|
|
|
int devid = evd->deviceid;
|
2011-10-13 19:32:34 -07:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
switch (xevent->xcookie.evtype)
|
2014-11-24 22:37:16 -08:00
|
|
|
{
|
2011-10-20 22:40:59 -07:00
|
|
|
#ifdef XI_TouchUpdate
|
2011-10-13 19:32:34 -07:00
|
|
|
case XI_TouchUpdate:
|
2014-11-24 22:37:16 -08:00
|
|
|
{
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
int i = _ecore_x_input_touch_index_get(devid, evd->detail, XI_TouchUpdate);
|
|
|
|
if ((i == 0) && (evd->flags & XITouchEmulatingPointer)) return;
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
INF("Handling XI_TouchUpdate");
|
|
|
|
_ecore_mouse_move(evd->time,
|
|
|
|
0, // state
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
i, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#else
|
2014-11-24 22:37:16 -08:00
|
|
|
devid, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
|
|
|
}
|
2011-10-13 19:32:34 -07:00
|
|
|
break;
|
|
|
|
#endif
|
2012-12-04 22:57:30 -08:00
|
|
|
|
2011-10-13 19:32:34 -07:00
|
|
|
#ifdef XI_TouchBegin
|
|
|
|
case XI_TouchBegin:
|
2014-11-24 22:37:16 -08:00
|
|
|
{
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
int i = _ecore_x_input_touch_index_get(devid, evd->detail, XI_TouchBegin);
|
|
|
|
if ((i == 0) && (evd->flags & XITouchEmulatingPointer)) return;
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
INF("Handling XI_TouchBegin");
|
|
|
|
_ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
|
|
|
evd->time,
|
|
|
|
0, // state
|
|
|
|
0, // button
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
i, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#else
|
2014-11-24 22:37:16 -08:00
|
|
|
devid, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
|
|
|
}
|
2011-10-13 19:32:34 -07:00
|
|
|
break;
|
|
|
|
#endif
|
2012-12-04 22:57:30 -08:00
|
|
|
|
2011-10-13 19:32:34 -07:00
|
|
|
#ifdef XI_TouchEnd
|
|
|
|
case XI_TouchEnd:
|
2013-01-16 01:03:55 -08:00
|
|
|
{
|
2014-11-24 22:37:16 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
|
|
|
int 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;
|
|
|
|
}
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
INF("Handling XI_TouchEnd");
|
|
|
|
_ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
|
|
evd->time,
|
|
|
|
0, // state
|
|
|
|
0, // button
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y,
|
|
|
|
evd->event,
|
|
|
|
(evd->child ? evd->child : evd->event),
|
|
|
|
evd->root,
|
|
|
|
1, // same_screen
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
i, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#else
|
2014-11-24 22:37:16 -08:00
|
|
|
devid, 1, 1,
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2014-11-24 22:37:16 -08:00
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
evd->event_x, evd->event_y,
|
|
|
|
evd->root_x, evd->root_y);
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
2014-11-24 22:37:16 -08:00
|
|
|
_ecore_x_input_touch_index_clear(devid, i);
|
|
|
|
}
|
2012-12-04 22:57:30 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2011-10-13 19:32:34 -07:00
|
|
|
break;
|
|
|
|
#endif
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
}
|
|
|
|
|
2014-11-24 23:09:28 -08:00
|
|
|
#ifdef ECORE_XI2
|
|
|
|
static unsigned int
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
count_bits(long n)
|
|
|
|
{
|
|
|
|
unsigned int c; /* c accumulates the total bits set in v */
|
|
|
|
for (c = 0; n; c++) n &= n - 1; /* clear the least significant bit set */
|
|
|
|
return c;
|
|
|
|
}
|
2014-11-24 23:09:28 -08:00
|
|
|
#endif
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
if (xevent->type != GenericEvent) return;
|
|
|
|
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
|
|
|
int n = count_bits(*evd->valuators.mask);
|
|
|
|
int i;
|
|
|
|
int j = 0;
|
|
|
|
double tiltx = 0, tilty = 0;
|
|
|
|
Eina_Bool compute_tilt = EINA_FALSE;
|
|
|
|
Ecore_Axis *axis = calloc(n, sizeof(Ecore_Axis));
|
|
|
|
if (!axis) return;
|
|
|
|
Ecore_Axis *axis_ptr = axis;
|
|
|
|
|
|
|
|
for (i = 0; i < dev->num_classes; i++)
|
|
|
|
{
|
|
|
|
if (dev->classes[i]->type == XIValuatorClass)
|
|
|
|
{
|
|
|
|
XIValuatorClassInfo *inf = ((XIValuatorClassInfo *)dev->classes[i]);
|
|
|
|
|
|
|
|
if (*evd->valuators.mask & (1 << inf->number))
|
|
|
|
{
|
|
|
|
if (inf->label == _ecore_x_input_get_axis_label("Abs X"))
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_X;
|
|
|
|
axis_ptr->value = evd->valuators.values[j];
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
else if (inf->label == _ecore_x_input_get_axis_label("Abs Y"))
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_Y;
|
|
|
|
axis_ptr->value = evd->valuators.values[j];
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
else if (inf->label == _ecore_x_input_get_axis_label("Abs Pressure"))
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_PRESSURE;
|
|
|
|
axis_ptr->value = (evd->valuators.values[j] - inf->min) / (inf->max - inf->min);
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
else if (inf->label == _ecore_x_input_get_axis_label("Abs Distance"))
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_DISTANCE;
|
|
|
|
axis_ptr->value = (evd->valuators.values[j] - inf->min) / (inf->max - inf->min);
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
else if ((inf->label == _ecore_x_input_get_axis_label("Abs Rotary Z")) ||
|
|
|
|
(inf->label == _ecore_x_input_get_axis_label("Abs Wheel")))
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_TWIST;
|
|
|
|
if (inf->resolution == 1)
|
|
|
|
{
|
|
|
|
/* some wacom drivers do not correctly report resolution, so pre-normalize */
|
|
|
|
axis_ptr->value = 2*((evd->valuators.values[j] - inf->min) / (inf->max - inf->min)) - 1;
|
|
|
|
axis_ptr->value *= M_PI;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
axis_ptr->value = evd->valuators.values[j] / inf->resolution;
|
|
|
|
}
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
else if (inf->label == _ecore_x_input_get_axis_label("Abs Tilt X"))
|
|
|
|
{
|
|
|
|
tiltx = evd->valuators.values[j] / inf->resolution;
|
|
|
|
compute_tilt = EINA_TRUE;
|
|
|
|
/* don't increment axis_ptr */
|
|
|
|
}
|
|
|
|
else if (inf->label == _ecore_x_input_get_axis_label("Abs Tilt Y"))
|
|
|
|
{
|
|
|
|
tilty = -evd->valuators.values[j] / inf->resolution;
|
|
|
|
compute_tilt = EINA_TRUE;
|
|
|
|
/* don't increment axis_ptr */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_UNKNOWN;
|
|
|
|
axis_ptr->value = evd->valuators.values[j];
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((compute_tilt) && ((axis_ptr + 2) <= (axis + n)))
|
|
|
|
{
|
|
|
|
double x = sin(tiltx);
|
|
|
|
double y = sin(tilty);
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_TILT;
|
|
|
|
axis_ptr->value = asin(sqrt((x * x) + (y * y)));
|
|
|
|
axis_ptr++;
|
|
|
|
|
|
|
|
/* note: the value of atan2(0,0) is implementation-defined */
|
|
|
|
axis_ptr->label = ECORE_AXIS_LABEL_AZIMUTH;
|
|
|
|
axis_ptr->value = atan2(y, x);
|
|
|
|
axis_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update n to reflect actual count and realloc array to free excess */
|
|
|
|
n = (axis_ptr - axis);
|
|
|
|
Ecore_Axis *shrunk_axis = realloc(axis, n * sizeof(Ecore_Axis));
|
|
|
|
if (shrunk_axis != NULL) axis = shrunk_axis;
|
|
|
|
|
|
|
|
if (n > 0)
|
|
|
|
_ecore_x_axis_update(evd->child ? evd->child : evd->event,
|
|
|
|
evd->event, evd->root, evd->time, evd->deviceid,
|
|
|
|
evd->detail, n, axis);
|
|
|
|
#endif /* ifdef ECORE_XI2 */
|
|
|
|
}
|
|
|
|
|
2014-11-24 23:09:28 -08:00
|
|
|
#ifdef ECORE_XI2
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
static XIDeviceInfo *
|
|
|
|
_ecore_x_input_device_lookup(int deviceid)
|
|
|
|
{
|
|
|
|
XIDeviceInfo *dev;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (_ecore_x_xi2_devs)
|
|
|
|
{
|
|
|
|
for (i = 0; i < _ecore_x_xi2_num; i++)
|
|
|
|
{
|
|
|
|
dev = &(_ecore_x_xi2_devs[i]);
|
|
|
|
if (deviceid == dev->deviceid) return dev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-11-24 23:09:28 -08:00
|
|
|
#endif
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_input_handler(XEvent *xevent)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
if (xevent->type != GenericEvent) return;
|
|
|
|
|
|
|
|
switch (xevent->xcookie.evtype)
|
|
|
|
{
|
|
|
|
case XI_RawMotion:
|
|
|
|
case XI_RawButtonPress:
|
|
|
|
case XI_RawButtonRelease:
|
|
|
|
_ecore_x_input_raw_handler(xevent);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XI_Motion:
|
|
|
|
case XI_ButtonPress:
|
|
|
|
case XI_ButtonRelease:
|
|
|
|
case XI_TouchUpdate:
|
|
|
|
case XI_TouchBegin:
|
|
|
|
case XI_TouchEnd:
|
|
|
|
{
|
|
|
|
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
|
|
|
|
XIDeviceInfo *dev = _ecore_x_input_device_lookup(evd->deviceid);
|
2012-12-04 22:57:30 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
if ((dev->use == XISlavePointer) &&
|
|
|
|
!(evd->flags & XIPointerEmulated))
|
|
|
|
_ecore_x_input_multi_handler(xevent);
|
|
|
|
else if (dev->use == XIFloatingSlave)
|
|
|
|
_ecore_x_input_mouse_handler(xevent);
|
|
|
|
|
|
|
|
if (dev->use != XIMasterPointer)
|
|
|
|
_ecore_x_input_axis_handler(xevent, dev);
|
|
|
|
}
|
|
|
|
break;
|
2011-10-13 19:32:34 -07:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-01-18 21:13:58 -08:00
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
EAPI Eina_Bool
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
ecore_x_input_select(Ecore_X_Window win)
|
2010-01-17 00:52:38 -08:00
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
2010-08-16 05:03:49 -07:00
|
|
|
int i;
|
|
|
|
Eina_Bool find = EINA_FALSE;
|
2010-01-17 11:57:50 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!_ecore_x_xi2_devs)
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
return EINA_FALSE;
|
2010-01-16 04:20:56 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-01-17 11:57:50 -08:00
|
|
|
for (i = 0; i < _ecore_x_xi2_num; i++)
|
2010-01-16 04:20:56 -08:00
|
|
|
{
|
2010-01-17 00:52:38 -08:00
|
|
|
XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]);
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
XIEventMask eventmask;
|
|
|
|
unsigned char mask[4] = { 0 };
|
|
|
|
int update = 0;
|
2010-01-17 11:57:50 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
eventmask.deviceid = dev->deviceid;
|
|
|
|
eventmask.mask_len = sizeof(mask);
|
|
|
|
eventmask.mask = mask;
|
2011-10-13 19:32:34 -07:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
if ((dev->use == XIFloatingSlave) || (dev->use == XISlavePointer))
|
|
|
|
{
|
2011-10-13 19:32:34 -07:00
|
|
|
XISetMask(mask, XI_ButtonPress);
|
|
|
|
XISetMask(mask, XI_ButtonRelease);
|
|
|
|
XISetMask(mask, XI_Motion);
|
2011-10-20 22:40:59 -07:00
|
|
|
|
2012-12-04 22:57:30 -08:00
|
|
|
#ifdef ECORE_XI2_2
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
Eina_Inlist *l = _ecore_x_xi2_touch_info_list;
|
|
|
|
Ecore_X_Touch_Device_Info *info;
|
|
|
|
info = _ecore_x_input_touch_info_get(dev);
|
2012-12-04 22:57:30 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
if (info)
|
|
|
|
{
|
2011-10-14 02:11:49 -07:00
|
|
|
XISetMask(mask, XI_TouchUpdate);
|
|
|
|
XISetMask(mask, XI_TouchBegin);
|
|
|
|
XISetMask(mask, XI_TouchEnd);
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
update = 1;
|
2013-02-19 07:09:32 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
l = eina_inlist_append(l, (Eina_Inlist *)info);
|
|
|
|
_ecore_x_xi2_touch_info_list = l;
|
2011-10-14 02:11:49 -07:00
|
|
|
}
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
#endif /* #ifdef ECORE_XI2_2 */
|
2012-12-04 22:57:30 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
#if !defined (ECORE_XI2_2) && defined (XI_TouchUpdate) && defined (XI_TouchBegin) && defined (XI_TouchEnd)
|
|
|
|
XISetMask(mask, XI_TouchUpdate);
|
|
|
|
XISetMask(mask, XI_TouchBegin);
|
|
|
|
XISetMask(mask, XI_TouchEnd);
|
|
|
|
#endif
|
2012-12-04 22:57:30 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
update = 1;
|
|
|
|
}
|
2012-12-04 22:57:30 -08:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
if (update)
|
|
|
|
{
|
|
|
|
XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
|
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
|
|
|
find = EINA_TRUE;
|
2010-01-16 04:20:56 -08:00
|
|
|
}
|
|
|
|
}
|
2010-01-17 11:57:50 -08:00
|
|
|
|
2010-01-16 04:20:56 -08:00
|
|
|
return find;
|
2010-08-02 10:47:49 -07:00
|
|
|
#else /* ifdef ECORE_XI2 */
|
2010-08-16 05:03:49 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|
2012-10-03 22:56:59 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_x_input_raw_select(Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XI2
|
|
|
|
XIEventMask emask;
|
|
|
|
unsigned char mask[4] = { 0 };
|
|
|
|
|
|
|
|
if (!_ecore_x_xi2_devs)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
emask.deviceid = XIAllMasterDevices;
|
|
|
|
emask.mask_len = sizeof(mask);
|
|
|
|
emask.mask = mask;
|
|
|
|
#ifdef XI_RawButtonPress
|
|
|
|
XISetMask(emask.mask, XI_RawButtonPress);
|
|
|
|
#endif
|
|
|
|
#ifdef XI_RawButtonRelease
|
|
|
|
XISetMask(emask.mask, XI_RawButtonRelease);
|
|
|
|
#endif
|
|
|
|
#ifdef XI_RawMotion
|
|
|
|
XISetMask(emask.mask, XI_RawMotion);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
XISelectEvents(_ecore_x_disp, win, &emask, 1);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2012-10-03 22:56:59 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
#else
|
|
|
|
return EINA_FALSE;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|