also more multitouch suport improvements.
SVN revision: 45249
This commit is contained in:
parent
04bcfb9245
commit
258f47f511
|
@ -224,14 +224,19 @@ _ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *ob
|
|||
{
|
||||
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
|
||||
|
@ -239,14 +244,19 @@ _ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|||
{
|
||||
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
|
||||
|
@ -254,14 +264,19 @@ _ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *ob
|
|||
{
|
||||
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
|
||||
|
|
|
@ -97,10 +97,18 @@ struct _Ecore_Event_Mouse_Button
|
|||
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;
|
||||
|
@ -146,10 +154,18 @@ struct _Ecore_Event_Mouse_Move
|
|||
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;
|
||||
|
|
|
@ -155,7 +155,7 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
|
|||
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)
|
||||
|
@ -165,11 +165,47 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -206,18 +242,6 @@ ecore_event_evas_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
return _ecore_event_evas_key((Ecore_Event_Key*) event, ECORE_UP);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -233,27 +257,6 @@ ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *e
|
|||
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->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)
|
||||
{
|
||||
|
|
|
@ -434,6 +434,7 @@ ecore_x_init(const char *name)
|
|||
_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);
|
||||
|
||||
|
@ -514,6 +515,7 @@ _ecore_x_shutdown(int close_display)
|
|||
_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();
|
||||
|
|
|
@ -200,7 +200,7 @@ _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
|
|||
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;
|
||||
|
@ -220,11 +220,17 @@ _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
|
|||
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;
|
||||
|
@ -360,7 +366,7 @@ _ecore_mouse_button(int event,
|
|||
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;
|
||||
|
||||
|
@ -410,11 +416,17 @@ _ecore_mouse_button(int event,
|
|||
&& !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;
|
||||
|
@ -458,9 +470,12 @@ _ecore_x_event_handle_any_event(XEvent *xevent)
|
|||
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;
|
||||
|
@ -475,8 +490,12 @@ _ecore_x_event_handle_any_event(XEvent *xevent)
|
|||
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("[[");
|
||||
|
@ -492,8 +511,12 @@ _ecore_x_event_handle_any_event(XEvent *xevent)
|
|||
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;
|
||||
|
@ -587,7 +610,12 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
|||
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;
|
||||
|
@ -614,7 +642,11 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
|
|||
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++)
|
||||
{
|
||||
|
@ -669,7 +701,12 @@ _ecore_x_event_handle_button_release(XEvent *xevent)
|
|||
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,
|
||||
|
@ -680,7 +717,11 @@ _ecore_x_event_handle_button_release(XEvent *xevent)
|
|||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +742,12 @@ _ecore_x_event_handle_motion_notify(XEvent *xevent)
|
|||
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;
|
||||
|
||||
|
@ -714,13 +760,18 @@ _ecore_x_event_handle_enter_notify(XEvent *xevent)
|
|||
{
|
||||
_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;
|
||||
|
@ -767,13 +818,18 @@ _ecore_x_event_handle_leave_notify(XEvent *xevent)
|
|||
{
|
||||
_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;
|
||||
|
|
|
@ -287,6 +287,9 @@ void _ecore_x_dpms_init(void);
|
|||
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 */
|
||||
|
||||
|
|
|
@ -14,68 +14,74 @@
|
|||
|
||||
#ifdef ECORE_XI2
|
||||
int _ecore_x_xi2_opcode = -1;
|
||||
|
||||
static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
|
||||
static int _ecore_x_xi2_num = 0;
|
||||
#endif
|
||||
|
||||
void
|
||||
_ecore_x_input_init(void)
|
||||
{
|
||||
#ifdef ECORE_XI2
|
||||
int event, error;
|
||||
int major = 2, minor = 0;
|
||||
|
||||
if (!XQueryExtension(_ecore_x_disp, "XInputExtension",
|
||||
&_ecore_x_xi2_opcode, &event, &error))
|
||||
{
|
||||
_ecore_x_xi2_opcode = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest)
|
||||
{
|
||||
_ecore_x_xi2_opcode = -1;
|
||||
return;
|
||||
}
|
||||
_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)
|
||||
{
|
||||
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 find = 0;
|
||||
static int num;
|
||||
static XIDeviceInfo *devs = NULL;
|
||||
static int checked = 0;
|
||||
static int check_ret = 1;
|
||||
int i, find = 0;
|
||||
|
||||
if (!checked)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!check_ret) return 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue