{
Ecore_Evas *ee;
Evas_Event_Multi_Down *ev;
- Evas_Coord x, y;
+ Evas_Coord x, y, xx, yy;
+ double xf, yf;
ee = data;
ev = event_info;
x = ev->canvas.x;
y = ev->canvas.y;
+ xx = x;
+ yy = y;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
- evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->flags, ev->timestamp, NULL);
+ xf = (ev->canvas.xsub - (double)xx) + (double)x;
+ yf = (ev->canvas.ysub - (double)yy) + (double)y;
+ evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
}
static void
{
Ecore_Evas *ee;
Evas_Event_Multi_Up *ev;
- Evas_Coord x, y;
+ Evas_Coord x, y, xx, yy;
+ double xf, yf;
ee = data;
ev = event_info;
x = ev->canvas.x;
y = ev->canvas.y;
+ xx = x;
+ yy = y;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
- evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->flags, ev->timestamp, NULL);
+ xf = (ev->canvas.xsub - (double)xx) + (double)x;
+ yf = (ev->canvas.ysub - (double)yy) + (double)y;
+ evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
}
static void
{
Ecore_Evas *ee;
Evas_Event_Multi_Move *ev;
- Evas_Coord x, y;
+ Evas_Coord x, y, xx, yy;
+ double xf, yf;
ee = data;
ev = event_info;
x = ev->cur.canvas.x;
y = ev->cur.canvas.y;
+ xx = x;
+ yy = y;
_ecore_evas_buffer_coord_translate(ee, &x, &y);
- evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->timestamp, NULL);
+ xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
+ yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
+ evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL);
}
static void
int y;
} root;
- int device;
- int radius;
- int radius_x;
- int radius_y;
+ struct
+ {
+ int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
+ double radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
+ double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
+ double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
+ double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
+ struct
+ {
+ double x, y;
+ } root;
+ } multi;
};
typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel;
int y;
} root;
- int device;
- int radius;
- int radius_x;
- int radius_y;
+ struct
+ {
+ int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
+ double radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
+ double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
+ double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
+ double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
+ struct
+ {
+ double x, y;
+ } root;
+ } multi;
};
typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO;
if (!lookup) return 1;
if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
- if (e->device == 0)
+ if (e->multi.device == 0)
{
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN)
}
else
{
- // FIXME: multi-touch feed
+ if (press == ECORE_DOWN)
+ evas_event_feed_multi_down(lookup->evas, e->multi.device, e->x, e->y, e->multi.radius, e->multi.radius_x, e->multi.radius_y, e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, flags, e->timestamp, NULL);
+ else
+ evas_event_feed_multi_up(lookup->evas, e->multi.device, e->x, e->y, e->multi.radius, e->multi.radius_x, e->multi.radius_y, e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, flags, e->timestamp, NULL);
+ }
+ return 1;
+}
+
+EAPI int
+ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ Ecore_Event_Mouse_Move *e;
+ Ecore_Input_Window *lookup;
+
+ e = event;
+ lookup = _ecore_event_window_match(e->window);
+ if (!lookup) return 1;
+ if (e->multi.device == 0)
+ {
+ ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
+ lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
+ }
+ else
+ {
+ evas_event_feed_multi_move(lookup->evas, e->multi.device, e->x, e->y, e->multi.radius, e->multi.radius_x, e->multi.radius_y, e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, e->timestamp, NULL);
}
return 1;
}
+EAPI int
+ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN);
+}
+
+EAPI int
+ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP);
+}
+
static int
_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
{
}
EAPI int
-ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_DOWN);
-}
-
-EAPI int
-ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button*) event, ECORE_UP);
-}
-
-EAPI int
ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Event_Mouse_Wheel *e;
}
EAPI int
-ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Event_Mouse_Move *e;
- Ecore_Input_Window *lookup;
-
- e = event;
- lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
- if (e->device == 0)
- {
- ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
- lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
- }
- else
- {
- // FIXME: multi-touch feed
- }
- return 1;
-}
-
-EAPI int
ecore_event_evas_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO*) event, ECORE_IN);
_ecore_x_composite_init();
_ecore_x_dpms_init();
_ecore_x_randr_init();
+ _ecore_x_input_init();
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
_ecore_x_fd_handler_handle = NULL;
_ecore_x_disp = NULL;
_ecore_x_event_handlers = NULL;
+ _ecore_x_input_shutdown();
_ecore_x_selection_shutdown();
_ecore_x_dnd_shutdown();
ecore_x_netwm_shutdown();
unsigned int window,
unsigned int root_win,
int same_screen,
- int dev, int radx, int rady)
+ int dev, double radx, double rady, double pressure, double angle, double mx, double my, double mrx, double mry)
{
Ecore_Event_Mouse_Move *e;
Ecore_Event *event;
e->root.x = x_root;
e->root.y = y_root;
- e->device = dev;
- e->radius = (radx + rady) / 2;
- e->radius_x = radx;
- e->radius_y = rady;
-
+ e->multi.device = dev;
+ e->multi.radius = (radx + rady) / 2;
+ e->multi.radius_x = radx;
+ e->multi.radius_y = rady;
+ e->multi.pressure = pressure;
+ e->multi.angle = angle;
+ e->multi.x = mx;
+ e->multi.y = my;
+ e->multi.root.x = mrx;
+ e->multi.root.y = mry;
+
event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, _ecore_x_event_free_mouse_move, NULL);
_ecore_x_event_last_time = timestamp;
unsigned int window,
unsigned int root_win,
int same_screen,
- int dev, int radx, int rady)
+ int dev, double radx, double rady, double pressure, double angle, double mx, double my, double mrx, double mry)
{
Ecore_Event_Mouse_Button *e;
&& !e->triple_click)
_ecore_x_mouse_up_count = 0;
- e->device = dev;
- e->radius = (radx + rady) / 2;
- e->radius_x = radx;
- e->radius_y = rady;
-
+ e->multi.device = dev;
+ e->multi.radius = (radx + rady) / 2;
+ e->multi.radius_x = radx;
+ e->multi.radius_y = rady;
+ e->multi.pressure = pressure;
+ e->multi.angle = angle;
+ e->multi.x = mx;
+ e->multi.y = my;
+ e->multi.root.x = mrx;
+ e->multi.root.y = mry;
+
_ecore_x_event_last_time = e->timestamp;
_ecore_x_event_last_win = e->window;
_ecore_x_event_last_root_x = x_root;
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
- 1,
- devid, 1, 1);
-
+ 1, // same_screen
+ devid, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ evd->event_x, evd->event_y,
+ evd->root_x, evd->root_y);
//printf("motion\n");
printf("=");
break;
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
- 1,
- devid, 1, 1);
+ 1, // same_screen
+ devid, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ evd->event_x, evd->event_y,
+ evd->root_x, evd->root_y);
//printf("abs X:%f Y:%f - ", evd->root_x, evd->root_y);
//printf("win X:%f Y:%f\n", evd->event_x, evd->event_y);
printf("[[");
evd->event,
(evd->child ? evd->child : evd->event),
evd->root,
- 1,
- devid, 1, 1);
+ 1, // same_screen
+ devid, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ evd->event_x, evd->event_y,
+ evd->root_x, evd->root_y);
//printf("unclick\n");
printf("]]\n");
break;
xevent->xbutton.window,
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
xevent->xbutton.root,
- xevent->xbutton.same_screen, 0, 1, 1);
+ xevent->xbutton.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xbutton.x, xevent->xbutton.y,
+ xevent->xbutton.x_root, xevent->xbutton.y_root);
}
{
Ecore_Event_Mouse_Button *e;
xevent->xbutton.x_root, xevent->xbutton.y_root,
event_window, window,
xevent->xbutton.root, xevent->xbutton.same_screen,
- 0, 1, 1);
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xbutton.x, xevent->xbutton.y,
+ xevent->xbutton.x_root, xevent->xbutton.y_root);
if (e)
for (i = 0; i < _ecore_window_grabs_num; i++)
{
xevent->xbutton.window,
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
xevent->xbutton.root,
- xevent->xbutton.same_screen, 0, 1, 1);
+ xevent->xbutton.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xbutton.x, xevent->xbutton.y,
+ xevent->xbutton.x_root, xevent->xbutton.y_root);
_ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
xevent->xbutton.time, xevent->xbutton.state,
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->xbutton.window),
xevent->xbutton.root,
xevent->xbutton.same_screen,
- 0, 1, 1);
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xbutton.x, xevent->xbutton.y,
+ xevent->xbutton.x_root, xevent->xbutton.y_root);
}
}
xevent->xmotion.window,
(xevent->xmotion.subwindow ? xevent->xmotion.subwindow : xevent->xmotion.window),
xevent->xmotion.root,
- xevent->xmotion.same_screen, 0, 1, 1);
+ xevent->xmotion.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xmotion.x, xevent->xmotion.y,
+ xevent->xmotion.x_root, xevent->xmotion.y_root);
_ecore_x_last_event_mouse_move = 1;
{
_ecore_x_last_event_mouse_move = 0;
{
- _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
+ _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
xevent->xcrossing.x, xevent->xcrossing.y,
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
xevent->xcrossing.window,
(xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
xevent->xcrossing.root,
- xevent->xcrossing.same_screen, 0, 1, 1);
+ xevent->xcrossing.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xcrossing.x, xevent->xcrossing.y,
+ xevent->xcrossing.x_root, xevent->xcrossing.y_root);
}
{
Ecore_X_Event_Mouse_In *e;
{
_ecore_x_last_event_mouse_move = 0;
{
- _ecore_mouse_move(xevent->xmotion.time, xevent->xcrossing.state,
+ _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
xevent->xcrossing.x, xevent->xcrossing.y,
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
xevent->xcrossing.window,
(xevent->xcrossing.subwindow ? xevent->xcrossing.subwindow : xevent->xcrossing.window),
xevent->xcrossing.root,
- xevent->xcrossing.same_screen, 0, 1, 1);
+ xevent->xcrossing.same_screen,
+ 0, 1, 1,
+ 1.0, // pressure
+ 0.0, // angle
+ xevent->xcrossing.x, xevent->xcrossing.y,
+ xevent->xcrossing.x_root, xevent->xcrossing.y_root);
}
{
Ecore_X_Event_Mouse_Out *e;
void _ecore_x_randr_init(void);
void _ecore_x_atoms_init(void);
+
+void _ecore_x_input_init(void);
+void _ecore_x_input_shutdown(void);
/* from sync */
#ifdef ECORE_XI2
int _ecore_x_xi2_opcode = -1;
+
+static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
+static int _ecore_x_xi2_num = 0;
#endif
-EAPI Eina_Bool
-ecore_x_input_multi_select(Ecore_X_Window win)
+void
+_ecore_x_input_init(void)
{
#ifdef ECORE_XI2
- int find = 0;
- static int num;
- static XIDeviceInfo *devs = NULL;
- static int checked = 0;
- static int check_ret = 1;
+ int event, error;
+ int major = 2, minor = 0;
- if (!checked)
+ if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
+ &_ecore_x_xi2_opcode, &event, &error))
{
- int event, error;
- int major = 2, minor = 0;
-
- checked = 1;
- if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
- &_ecore_x_xi2_opcode, &event, &error))
- {
- _ecore_x_xi2_opcode = -1;
- check_ret = 0;
- return 0;
- }
+ _ecore_x_xi2_opcode = -1;
+ return;
+ }
- if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest)
- {
- _ecore_x_xi2_opcode = -1;
- check_ret = 0;
- return 0;
- }
- devs = XIQueryDevice(_ecore_x_disp, XIAllDevices, &num);
-// XIFreeDeviceInfo(devs);
+ if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest)
+ {
+ _ecore_x_xi2_opcode = -1;
+ return;
}
- else
+ _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices,
+ &_ecore_x_xi2_num);
+#endif
+}
+
+void
+_ecore_x_input_shutdown(void)
+{
+#ifdef ECORE_XI2
+ if (_ecore_x_xi2_devs)
{
- if (!check_ret) return 0;
+ XIFreeDeviceInfo(_ecore_x_xi2_devs);
+ _ecore_x_xi2_devs = NULL;
}
+ _ecore_x_xi2_num = 0;
+ _ecore_x_xi2_opcode = -1;
+#endif
+}
+
+EAPI Eina_Bool
+ecore_x_input_multi_select(Ecore_X_Window win)
+{
+#ifdef ECORE_XI2
+ int i, find = 0;
+
+ if (!_ecore_x_xi2_devs) return 0;
- if (devs)
+ for (i = 0; i < num; i++)
{
- int i;
+ XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]);
- for (i = 0; i < num; i++)
+ if (dev->use == XIFloatingSlave)
{
- XIDeviceInfo *dev = &(devs[i]);
+ XIEventMask eventmask;
+ unsigned char mask[1] = { 0 };
- if (dev->use == XIFloatingSlave)
- {
- XIEventMask eventmask;
- unsigned char mask[1] = { 0 };
-
- eventmask.deviceid = dev->deviceid;
- eventmask.mask_len = sizeof(mask);
- eventmask.mask = mask;
- XISetMask(mask, XI_ButtonPress);
- XISetMask(mask, XI_ButtonRelease);
- XISetMask(mask, XI_Motion);
- XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
- find = 1;
- }
+ eventmask.deviceid = dev->deviceid;
+ eventmask.mask_len = sizeof(mask);
+ eventmask.mask = mask;
+ XISetMask(mask, XI_ButtonPress);
+ XISetMask(mask, XI_ButtonRelease);
+ XISetMask(mask, XI_Motion);
+ XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
+ find = 1;
}
}