* 3. let evas send legacy & eo events to the objects
*/
-#define EVENT_XY_SET(EV, X, Y, MX, MY, FX, FY) do { \
- EV->cur.x = (X) - (FX); EV->cur.xsub = (MX) - (FX); \
- EV->cur.y = (Y) - (FY); EV->cur.ysub = (MY) - (FY); \
+#define EVENT_XY_SET(EV, MX, MY, FX, FY) do { \
+ EV->cur.x = (MX) - (FX); EV->cur.y = (MY) - (FY); \
} while (0)
static inline void
-_pointer_position_set(Efl_Pointer_Event_Data *ev, Ecore_Evas *ee, int x, int y, double mx, double my)
+_pointer_position_set(Efl_Pointer_Event_Data *ev, Ecore_Evas *ee, double mx, double my)
{
int fx, fy, fw, fh;
evas_output_framespace_get(ee->evas, &fx, &fy, &fw, &fh);
if (ee->rotation == 0)
- EVENT_XY_SET(ev, x, y, mx, my, fx, fy);
+ EVENT_XY_SET(ev, mx, my, fx, fy);
else if (ee->rotation == 90)
- EVENT_XY_SET(ev, ee->h + fw - y - 1, x, ee->h + fw - my - 1, mx, fx, fy);
+ EVENT_XY_SET(ev, ee->h + fw - my - 1, mx, fx, fy);
else if (ee->rotation == 180)
- EVENT_XY_SET(ev, ee->w + fw - x - 1, ee->h + fh - y - 1,
- ee->w + fw - mx - 1, ee->h + fh - my - 1,
- fx, fy);
+ EVENT_XY_SET(ev, ee->w + fw - mx - 1, ee->h + fh - my - 1, fx, fy);
else if (ee->rotation == 270)
- EVENT_XY_SET(ev, y, ee->w + fh - x - 1, y, ee->w + fh - mx - 1, fx, fy);
+ EVENT_XY_SET(ev, my, ee->w + fh - mx - 1, fx, fy);
}
static const Eo_Event_Description *
if (info->triple_click) ev->button_flags |= EFL_POINTER_BUTTON_FLAGS_TRIPLE_CLICK;
ev->timestamp = info->timestamp;
ev->finger = info->multi.device;
- _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y);
+ _pointer_position_set(ev, ee, info->multi.x, info->multi.y);
ev->radius = info->multi.radius;
ev->radius_x = info->multi.radius_x;
ev->radius_y = info->multi.radius_y;
ev->action = EFL_POINTER_ACTION_MOVE;
ev->timestamp = info->timestamp;
ev->finger = info->multi.device;
- _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y);
+ _pointer_position_set(ev, ee, info->multi.x, info->multi.y);
ev->radius = info->multi.radius;
ev->radius_x = info->multi.radius_x;
ev->action = EFL_POINTER_ACTION_WHEEL;
ev->timestamp = info->timestamp;
- _pointer_position_set(ev, ee, info->x, info->y, info->x, info->y);
+ _pointer_position_set(ev, ee, info->x, info->y);
ev->wheel.z = info->z;
ev->wheel.dir = info->direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL;
ev->action = action;
ev->timestamp = info->timestamp;
- _pointer_position_set(ev, ee, info->x, info->y, info->x, info->y);
+ _pointer_position_set(ev, ee, info->x, info->y);
eo_event_callback_call(e, _event_description_get(ev->action), evt);
processed = ev->evas_done;
double pressure;
double angle;
struct {
- int x, y;
- double xsub, ysub; // couldn't we just cast from double to int?
+ double x, y;
} cur, prev;
struct {
Efl_Orient dir;
}
EOLIAN static void
-_efl_pointer_event_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y, double xsub, double ysub)
+_efl_pointer_event_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y)
+{
+ pd->cur.x = (double) x;
+ pd->cur.y = (double) y;
+}
+
+EOLIAN static void
+_efl_pointer_event_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y)
+{
+ if (x) *x = (int) pd->cur.x;
+ if (y) *y = (int) pd->cur.y;
+}
+
+EOLIAN static void
+_efl_pointer_event_position_precise_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double x, double y)
{
pd->cur.x = x;
pd->cur.y = y;
- pd->cur.xsub = xsub;
- pd->cur.ysub = ysub;
}
EOLIAN static void
-_efl_pointer_event_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y, double *xsub, double *ysub)
+_efl_pointer_event_position_precise_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double *x, double *y)
{
if (x) *x = pd->cur.x;
if (y) *y = pd->cur.y;
- if (xsub) *xsub = pd->cur.xsub;
- if (ysub) *ysub = pd->cur.ysub;
}
EOLIAN static void
_efl_pointer_event_previous_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y)
{
+ pd->prev.x = (double) x;
+ pd->prev.y = (double) y;
+}
+
+EOLIAN static void
+_efl_pointer_event_previous_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y)
+{
+ if (x) *x = (int) pd->prev.x;
+ if (y) *y = (int) pd->prev.y;
+}
+
+EOLIAN static void
+_efl_pointer_event_previous_position_precise_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double x, double y)
+{
pd->prev.x = x;
pd->prev.y = y;
}
EOLIAN static void
-_efl_pointer_event_previous_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y)
+_efl_pointer_event_previous_position_precise_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double *x, double *y)
{
if (x) *x = pd->prev.x;
if (y) *y = pd->prev.y;
pressed: bool;
}
}
- /* FIXME: output vs. canvas position??? */
@property position {
[[Position where the event happened, relative to the window.]]
values {
x: int;
y: int;
- xsub: double;
- ysub: double;
+ }
+ }
+ @property position_precise {
+ [[Position where the event happened, with subpixel precision
+
+ Note: Same value as @.position, relative to the window.
+ ]]
+ values {
+ x: double;
+ y: double;
}
}
@property previous_position {
y: int;
}
}
+ @property previous_position_precise {
+ [[Position of the previous event, with subpixel precision.
+
+ Valid for move events, may not be valid for other events.
+ Relative to the window. May be equal to @.position_precise.
+ ]]
+ values {
+ x: double;
+ y: double;
+ }
+ }
@property device {
[[Pointing device that originated this event.]]
values {
_canvas_event_feed_multi_move_internal(eo_e, e, ev->finger, ev->cur.x, ev->cur.y,
ev->radius, ev->radius_x, ev->radius_y,
ev->pressure, ev->angle,
- ev->cur.xsub, ev->cur.ysub,
+ ev->cur.x, ev->cur.y,
ev->timestamp, ev->data, ev);
}
break;
_canvas_event_feed_multi_down_internal(eo_e, e, ev->finger, ev->cur.x, ev->cur.y,
ev->radius, ev->radius_x, ev->radius_y,
ev->pressure, ev->angle,
- ev->cur.xsub, ev->cur.ysub, ev->button_flags,
+ ev->cur.x, ev->cur.y, ev->button_flags,
ev->timestamp, ev->data, ev);
}
break;
_canvas_event_feed_multi_up_internal(eo_e, e, ev->finger, ev->cur.x, ev->cur.y,
ev->radius, ev->radius_x, ev->radius_y,
ev->pressure, ev->angle,
- ev->cur.xsub, ev->cur.ysub, ev->button_flags,
+ ev->cur.x, ev->cur.y, ev->button_flags,
ev->timestamp, ev->data, ev);
}
break;
ev->action = EFL_POINTER_ACTION_IN;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.x;
- ev->cur.ysub = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->action = EFL_POINTER_ACTION_OUT;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.x;
- ev->cur.ysub = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->button = e->button;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.x;
- ev->cur.ysub = e->canvas.y;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->button = e->button;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.x;
- ev->cur.ysub = e->canvas.y;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->pressed_buttons = e->buttons;
ev->cur.x = e->cur.canvas.x;
ev->cur.y = e->cur.canvas.y;
- ev->cur.xsub = e->cur.canvas.x;
- ev->cur.ysub = e->cur.canvas.y;
ev->prev.x = e->prev.canvas.x;
ev->prev.y = e->prev.canvas.y;
- ev->prev.xsub = e->prev.canvas.x;
- ev->prev.ysub = e->prev.canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->wheel.z = e->z;
ev->cur.x = e->canvas.x;
ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.x;
- ev->cur.ysub = e->canvas.y;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
- ev->cur.x = e->canvas.x;
- ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.xsub;
- ev->cur.ysub = e->canvas.ysub;
+ ev->cur.x = e->canvas.xsub;
+ ev->cur.y = e->canvas.ysub;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
- ev->cur.x = e->canvas.x;
- ev->cur.y = e->canvas.y;
- ev->cur.xsub = e->canvas.xsub;
- ev->cur.ysub = e->canvas.ysub;
+ ev->cur.x = e->canvas.xsub;
+ ev->cur.y = e->canvas.ysub;
ev->data = e->data;
ev->button_flags = e->flags;
ev->timestamp = e->timestamp;
ev->radius_y = e->radius_y;
ev->pressure = e->pressure;
ev->angle = e->angle;
- ev->cur.x = e->cur.canvas.x;
- ev->cur.y = e->cur.canvas.y;
- ev->cur.xsub = e->cur.canvas.xsub;
- ev->cur.ysub = e->cur.canvas.ysub;
+ ev->cur.x = e->cur.canvas.xsub;
+ ev->cur.y = e->cur.canvas.ysub;
ev->data = e->data;
ev->timestamp = e->timestamp;
ev->event_flags = e->event_flags;
e->angle = ev->angle;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
- e->canvas.xsub = ev->cur.xsub;
- e->canvas.ysub = ev->cur.ysub;
+ e->canvas.xsub = ev->cur.x;
+ e->canvas.ysub = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->angle = ev->angle;
e->canvas.x = ev->cur.x;
e->canvas.y = ev->cur.y;
- e->canvas.xsub = ev->cur.xsub;
- e->canvas.ysub = ev->cur.ysub;
+ e->canvas.xsub = ev->cur.x;
+ e->canvas.ysub = ev->cur.y;
e->output.x = ev->cur.x;
e->output.y = ev->cur.y;
e->data = ev->data;
e->angle = ev->angle;
e->cur.canvas.x = ev->cur.x;
e->cur.canvas.y = ev->cur.y;
- e->cur.canvas.xsub = ev->cur.xsub;
- e->cur.canvas.ysub = ev->cur.ysub;
+ e->cur.canvas.xsub = ev->cur.x;
+ e->cur.canvas.ysub = ev->cur.y;
e->cur.output.x = ev->cur.x;
e->cur.output.y = ev->cur.y;
e->data = ev->data;