summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ecore_evas/ecore_evas.c31
-rw-r--r--src/lib/ecore_input/Ecore_Input.h6
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_xi2.c29
-rw-r--r--src/lib/efl/interfaces/efl_common_internal.h2
-rw-r--r--src/lib/evas/Evas_Common.h6
-rw-r--r--src/lib/evas/canvas/evas_events.c39
6 files changed, 101 insertions, 12 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 9b43ec370e..d8d5b8b1e3 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -4525,6 +4525,7 @@ _direct_mouse_out_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info)
4525static Eina_Bool 4525static Eina_Bool
4526_direct_axis_update_cb(Ecore_Evas *ee, const Ecore_Event_Axis_Update *info) 4526_direct_axis_update_cb(Ecore_Evas *ee, const Ecore_Event_Axis_Update *info)
4527{ 4527{
4528 Eina_Bool haswinx = 0, haswiny = 0;
4528 Efl_Event_Pointer_Data *ev; 4529 Efl_Event_Pointer_Data *ev;
4529 Efl_Event_Pointer *evt; 4530 Efl_Event_Pointer *evt;
4530 Evas *e = ee->evas; 4531 Evas *e = ee->evas;
@@ -4549,14 +4550,40 @@ _direct_axis_update_cb(Ecore_Evas *ee, const Ecore_Event_Axis_Update *info)
4549 const Ecore_Axis *axis = &(info->axis[n]); 4550 const Ecore_Axis *axis = &(info->axis[n]);
4550 switch (axis->label) 4551 switch (axis->label)
4551 { 4552 {
4552 case EVAS_AXIS_LABEL_X: 4553 case EVAS_AXIS_LABEL_WINDOW_X:
4553 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X); 4554 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X);
4554 x = axis->value; 4555 x = axis->value;
4556 haswinx = EINA_TRUE;
4555 break; 4557 break;
4556 4558
4557 case EVAS_AXIS_LABEL_Y: 4559 case EVAS_AXIS_LABEL_WINDOW_Y:
4558 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y); 4560 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y);
4559 y = axis->value; 4561 y = axis->value;
4562 haswiny = EINA_TRUE;
4563 break;
4564
4565 case EVAS_AXIS_LABEL_X:
4566 if (!haswinx)
4567 {
4568 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X);
4569 x = axis->value;
4570 }
4571 break;
4572
4573 case EVAS_AXIS_LABEL_Y:
4574 if (!haswiny)
4575 {
4576 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y);
4577 y = axis->value;
4578 }
4579 break;
4580
4581 case EVAS_AXIS_LABEL_NORMAL_X:
4582 ev->raw.x = axis->value;
4583 break;
4584
4585 case EVAS_AXIS_LABEL_NORMAL_Y:
4586 ev->raw.y = axis->value;
4560 break; 4587 break;
4561 4588
4562 case EVAS_AXIS_LABEL_PRESSURE: 4589 case EVAS_AXIS_LABEL_PRESSURE:
diff --git a/src/lib/ecore_input/Ecore_Input.h b/src/lib/ecore_input/Ecore_Input.h
index 45f6c387bd..1122b6457c 100644
--- a/src/lib/ecore_input/Ecore_Input.h
+++ b/src/lib/ecore_input/Ecore_Input.h
@@ -319,7 +319,11 @@ extern "C" {
319 ECORE_AXIS_LABEL_TOUCH_WIDTH_MAJOR, /**< Length of contact ellipse along AZIMUTH. Range: Unbounded: Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */ 319 ECORE_AXIS_LABEL_TOUCH_WIDTH_MAJOR, /**< Length of contact ellipse along AZIMUTH. Range: Unbounded: Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */
320 ECORE_AXIS_LABEL_TOUCH_WIDTH_MINOR, /**< Length of contact ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */ 320 ECORE_AXIS_LABEL_TOUCH_WIDTH_MINOR, /**< Length of contact ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */
321 ECORE_AXIS_LABEL_TOOL_WIDTH_MAJOR, /**< Length of tool ellipse along AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */ 321 ECORE_AXIS_LABEL_TOOL_WIDTH_MAJOR, /**< Length of tool ellipse along AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */
322 ECORE_AXIS_LABEL_TOOL_WIDTH_MINOR /**< Length of tool ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */ 322 ECORE_AXIS_LABEL_TOOL_WIDTH_MINOR, /**< Length of tool ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as ECORE_AXIS_LABEL_{X,Y}. @since 1.13 */
323 ECORE_AXIS_LABEL_WINDOW_X, /**< X coordinate mapped to the window. @since 1.19 */
324 ECORE_AXIS_LABEL_WINDOW_Y, /**< Y coordinate mapped to the window. @since 1.19 */
325 ECORE_AXIS_LABEL_NORMAL_X, /**< X normalized to the [0, 1] range. @since 1.19 */
326 ECORE_AXIS_LABEL_NORMAL_Y, /**< Y normalized to the [0, 1] range. @since 1.19 */
323 } Ecore_Axis_Label; /**< @since 1.13 */ 327 } Ecore_Axis_Label; /**< @since 1.13 */
324 328
325 struct _Ecore_Axis 329 struct _Ecore_Axis
diff --git a/src/lib/ecore_x/xlib/ecore_x_xi2.c b/src/lib/ecore_x/xlib/ecore_x_xi2.c
index be19de2c94..089c2a7029 100644
--- a/src/lib/ecore_x/xlib/ecore_x_xi2.c
+++ b/src/lib/ecore_x/xlib/ecore_x_xi2.c
@@ -494,7 +494,7 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
494{ 494{
495 if (xevent->type != GenericEvent) return; 495 if (xevent->type != GenericEvent) return;
496 XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data); 496 XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
497 unsigned int n = _ecore_x_count_bits(*evd->valuators.mask); 497 unsigned int n = _ecore_x_count_bits(*evd->valuators.mask) + 4;
498 int i; 498 int i;
499 int j = 0; 499 int j = 0;
500 double tiltx = 0, tilty = 0; 500 double tiltx = 0, tilty = 0;
@@ -514,15 +514,29 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
514 { 514 {
515 if (inf->label == _ecore_x_input_get_axis_label("Abs X")) 515 if (inf->label == _ecore_x_input_get_axis_label("Abs X"))
516 { 516 {
517 int x = evd->valuators.values[j];
517 axis_ptr->label = ECORE_AXIS_LABEL_X; 518 axis_ptr->label = ECORE_AXIS_LABEL_X;
518 axis_ptr->value = evd->valuators.values[j]; 519 axis_ptr->value = x;
519 axis_ptr++; 520 axis_ptr++;
521 if (inf->max > inf->min)
522 {
523 axis_ptr->label = ECORE_AXIS_LABEL_NORMAL_X;
524 axis_ptr->value = (x - inf->min) / (inf->max - inf->min);
525 axis_ptr++;
526 }
520 } 527 }
521 else if (inf->label == _ecore_x_input_get_axis_label("Abs Y")) 528 else if (inf->label == _ecore_x_input_get_axis_label("Abs Y"))
522 { 529 {
530 int y = evd->valuators.values[j];
523 axis_ptr->label = ECORE_AXIS_LABEL_Y; 531 axis_ptr->label = ECORE_AXIS_LABEL_Y;
524 axis_ptr->value = evd->valuators.values[j]; 532 axis_ptr->value = y;
525 axis_ptr++; 533 axis_ptr++;
534 if (inf->max > inf->min)
535 {
536 axis_ptr->label = ECORE_AXIS_LABEL_NORMAL_Y;
537 axis_ptr->value = (y - inf->min) / (inf->max - inf->min);
538 axis_ptr++;
539 }
526 } 540 }
527 else if (inf->label == _ecore_x_input_get_axis_label("Abs Pressure")) 541 else if (inf->label == _ecore_x_input_get_axis_label("Abs Pressure"))
528 { 542 {
@@ -602,6 +616,15 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
602 n = (axis_ptr - axis); 616 n = (axis_ptr - axis);
603 if (n > 0) 617 if (n > 0)
604 { 618 {
619 /* event position in the window - most useful */
620 axis_ptr->label = ECORE_AXIS_LABEL_WINDOW_X;
621 axis_ptr->value = evd->event_x;
622 axis_ptr++;
623 axis_ptr->label = ECORE_AXIS_LABEL_WINDOW_Y;
624 axis_ptr->value = evd->event_y;
625 axis_ptr++;
626 n += 2;
627
605 shrunk_axis = realloc(axis, n * sizeof(Ecore_Axis)); 628 shrunk_axis = realloc(axis, n * sizeof(Ecore_Axis));
606 if (shrunk_axis != NULL) axis = shrunk_axis; 629 if (shrunk_axis != NULL) axis = shrunk_axis;
607 _ecore_x_axis_update(evd->child ? evd->child : evd->event, 630 _ecore_x_axis_update(evd->child ? evd->child : evd->event,
diff --git a/src/lib/efl/interfaces/efl_common_internal.h b/src/lib/efl/interfaces/efl_common_internal.h
index 03940d560b..95b8681b67 100644
--- a/src/lib/efl/interfaces/efl_common_internal.h
+++ b/src/lib/efl/interfaces/efl_common_internal.h
@@ -33,7 +33,7 @@ struct _Efl_Event_Pointer_Data
33 double radius, radius_x, radius_y; 33 double radius, radius_x, radius_y;
34 double pressure; 34 double pressure;
35 double angle; 35 double angle;
36 Eina_Vector2 cur, prev; 36 Eina_Vector2 cur, prev, raw;
37 struct { 37 struct {
38 Efl_Orient dir; 38 Efl_Orient dir;
39 int z; 39 int z;
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 00c17d2af5..05c2a0607e 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -607,7 +607,11 @@ typedef enum _Evas_Axis_Label
607 EVAS_AXIS_LABEL_TOUCH_WIDTH_MAJOR, /**< Length of contact ellipse along AZIMUTH. Range: Unbounded: Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */ 607 EVAS_AXIS_LABEL_TOUCH_WIDTH_MAJOR, /**< Length of contact ellipse along AZIMUTH. Range: Unbounded: Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */
608 EVAS_AXIS_LABEL_TOUCH_WIDTH_MINOR, /**< Length of contact ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */ 608 EVAS_AXIS_LABEL_TOUCH_WIDTH_MINOR, /**< Length of contact ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */
609 EVAS_AXIS_LABEL_TOOL_WIDTH_MAJOR, /**< Length of tool ellipse along AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */ 609 EVAS_AXIS_LABEL_TOOL_WIDTH_MAJOR, /**< Length of tool ellipse along AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */
610 EVAS_AXIS_LABEL_TOOL_WIDTH_MINOR /**< Length of tool ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */ 610 EVAS_AXIS_LABEL_TOOL_WIDTH_MINOR, /**< Length of tool ellipse perpendicular to AZIMUTH. Range: Unbounded. Unit: Same as EVAS_AXIS_LABEL_{X,Y}. @since 1.13 */
611 EVAS_AXIS_LABEL_WINDOW_X, /**< X coordinate mapped to the window. @since 1.19 */
612 EVAS_AXIS_LABEL_WINDOW_Y, /**< Y coordinate mapped to the window. @since 1.19 */
613 EVAS_AXIS_LABEL_NORMAL_X, /**< X normalized to the [0, 1] range. @since 1.19 */
614 EVAS_AXIS_LABEL_NORMAL_Y, /**< Y normalized to the [0, 1] range. @since 1.19 */
611} Evas_Axis_Label; /**< Types of recognized device axes @since 1.13 */ 615} Evas_Axis_Label; /**< Types of recognized device axes @since 1.13 */
612 616
613struct _Evas_Axis 617struct _Evas_Axis
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index f94566b8fe..d8359478b2 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -2929,7 +2929,9 @@ evas_event_feed_axis_update(Evas *eo_e, unsigned int timestamp, int device, int
2929 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS)); 2929 EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
2930 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2930 Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2931 Efl_Event_Pointer_Data *ev = NULL; 2931 Efl_Event_Pointer_Data *ev = NULL;
2932 Eina_Bool haswinx = 0, haswiny = 0;
2932 Efl_Event_Pointer *evt; 2933 Efl_Event_Pointer *evt;
2934 double x = 0, y = 0;
2933 int n; 2935 int n;
2934 2936
2935 evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, eo_e, (void **) &ev); 2937 evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, eo_e, (void **) &ev);
@@ -2946,14 +2948,40 @@ evas_event_feed_axis_update(Evas *eo_e, unsigned int timestamp, int device, int
2946 const Evas_Axis *axis = &(axes[n]); 2948 const Evas_Axis *axis = &(axes[n]);
2947 switch (axis->label) 2949 switch (axis->label)
2948 { 2950 {
2949 case EVAS_AXIS_LABEL_X: 2951 case EVAS_AXIS_LABEL_WINDOW_X:
2950 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X); 2952 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X);
2951 ev->cur.x = axis->value; 2953 x = axis->value;
2954 haswinx = EINA_TRUE;
2952 break; 2955 break;
2953 2956
2954 case EVAS_AXIS_LABEL_Y: 2957 case EVAS_AXIS_LABEL_WINDOW_Y:
2955 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y); 2958 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y);
2956 ev->cur.y = axis->value; 2959 y = axis->value;
2960 haswiny = EINA_TRUE;
2961 break;
2962
2963 case EVAS_AXIS_LABEL_X:
2964 if (!haswinx)
2965 {
2966 _efl_input_value_mark(ev, EFL_INPUT_VALUE_X);
2967 x = axis->value;
2968 }
2969 break;
2970
2971 case EVAS_AXIS_LABEL_Y:
2972 if (!haswiny)
2973 {
2974 _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y);
2975 y = axis->value;
2976 }
2977 break;
2978
2979 case EVAS_AXIS_LABEL_NORMAL_X:
2980 ev->raw.x = axis->value;
2981 break;
2982
2983 case EVAS_AXIS_LABEL_NORMAL_Y:
2984 ev->raw.y = axis->value;
2957 break; 2985 break;
2958 2986
2959 case EVAS_AXIS_LABEL_PRESSURE: 2987 case EVAS_AXIS_LABEL_PRESSURE:
@@ -2979,6 +3007,9 @@ evas_event_feed_axis_update(Evas *eo_e, unsigned int timestamp, int device, int
2979 } 3007 }
2980 } 3008 }
2981 3009
3010 ev->cur.x = x;
3011 ev->cur.y = y;
3012
2982 /* FIXME: set proper device based on the device id (X or WL specific) */ 3013 /* FIXME: set proper device based on the device id (X or WL specific) */
2983 ev->device = _evas_device_top_get(eo_e); // FIXME 3014 ev->device = _evas_device_top_get(eo_e); // FIXME
2984 (void) device; 3015 (void) device;