summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore_x')
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_xi2.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/lib/ecore_x/xlib/ecore_x_xi2.c b/src/lib/ecore_x/xlib/ecore_x_xi2.c
index b6e451926e..be19de2c94 100644
--- a/src/lib/ecore_x/xlib/ecore_x_xi2.c
+++ b/src/lib/ecore_x/xlib/ecore_x_xi2.c
@@ -99,12 +99,13 @@ _ecore_x_input_get_axis_label(char *axis_name)
99 { 99 {
100 "Abs X", "Abs Y", "Abs Pressure", 100 "Abs X", "Abs Y", "Abs Pressure",
101 "Abs Distance", "Abs Rotary Z", 101 "Abs Distance", "Abs Rotary Z",
102 "Abs Wheel", "Abs Tilt X", "Abs Tilt Y" 102 "Abs Wheel", "Abs Tilt X", "Abs Tilt Y",
103 "Rel X", "Rel Y", "Rel Dial", "Rel Horiz Wheel", "Rel Vert Wheel"
103 }; 104 };
104 int n = sizeof(names) / sizeof(names[0]); 105 int n = sizeof(names) / sizeof(names[0]);
105 int i; 106 int i;
106 107
107 if (atoms == NULL) 108 if (EINA_UNLIKELY(atoms == NULL))
108 { 109 {
109 atoms = calloc(n, sizeof(Atom)); 110 atoms = calloc(n, sizeof(Atom));
110 if (!atoms) return 0; 111 if (!atoms) return 0;
@@ -501,6 +502,7 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
501 Ecore_Axis *axis = calloc(n, sizeof(Ecore_Axis)); 502 Ecore_Axis *axis = calloc(n, sizeof(Ecore_Axis));
502 if (!axis) return; 503 if (!axis) return;
503 Ecore_Axis *axis_ptr = axis; 504 Ecore_Axis *axis_ptr = axis;
505 Ecore_Axis *shrunk_axis;
504 506
505 for (i = 0; i < dev->num_classes; i++) 507 for (i = 0; i < dev->num_classes; i++)
506 { 508 {
@@ -562,6 +564,15 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
562 compute_tilt = EINA_TRUE; 564 compute_tilt = EINA_TRUE;
563 /* don't increment axis_ptr */ 565 /* don't increment axis_ptr */
564 } 566 }
567 else if ((inf->label == _ecore_x_input_get_axis_label("Rel X")) ||
568 (inf->label == _ecore_x_input_get_axis_label("Rel Y")) ||
569 (inf->label == _ecore_x_input_get_axis_label("Rel Vert Wheel")) ||
570 (inf->label == _ecore_x_input_get_axis_label("Rel Horiz Wheel")) ||
571 (inf->label == _ecore_x_input_get_axis_label("Rel Dial")))
572 {
573 /* Ignore those: mouse. Values are in fact not relative.
574 * No idea what is a "dial" event. */
575 }
565 else 576 else
566 { 577 {
567 axis_ptr->label = ECORE_AXIS_LABEL_UNKNOWN; 578 axis_ptr->label = ECORE_AXIS_LABEL_UNKNOWN;
@@ -589,13 +600,16 @@ _ecore_x_input_axis_handler(XEvent *xevent, XIDeviceInfo *dev)
589 600
590 /* update n to reflect actual count and realloc array to free excess */ 601 /* update n to reflect actual count and realloc array to free excess */
591 n = (axis_ptr - axis); 602 n = (axis_ptr - axis);
592 Ecore_Axis *shrunk_axis = realloc(axis, n * sizeof(Ecore_Axis));
593 if (shrunk_axis != NULL) axis = shrunk_axis;
594
595 if (n > 0) 603 if (n > 0)
596 _ecore_x_axis_update(evd->child ? evd->child : evd->event, 604 {
597 evd->event, evd->root, evd->time, evd->deviceid, 605 shrunk_axis = realloc(axis, n * sizeof(Ecore_Axis));
598 evd->detail, n, axis); 606 if (shrunk_axis != NULL) axis = shrunk_axis;
607 _ecore_x_axis_update(evd->child ? evd->child : evd->event,
608 evd->event, evd->root, evd->time, evd->deviceid,
609 evd->detail, n, axis);
610 }
611 else
612 free(axis);
599} 613}
600#endif /* ifdef ECORE_XI2 */ 614#endif /* ifdef ECORE_XI2 */
601 615