xfreerdp: improve selection between multitouch and non-multitouch devices with XInput 2

This commit is contained in:
Marc-André Moreau 2013-06-28 13:46:58 -04:00
parent 863b51f938
commit c084e0f8ae
2 changed files with 17 additions and 5 deletions

View File

@ -176,6 +176,9 @@ BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window win
static BOOL xf_event_MotionNotify(xfContext* xfc, XEvent* event, BOOL app)
{
if (xfc->use_xinput)
return TRUE;
return xf_generic_MotionNotify(xfc, event->xmotion.x, event->xmotion.y,
event->xmotion.state, event->xmotion.window, app);
}
@ -278,6 +281,9 @@ BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window win
static BOOL xf_event_ButtonPress(xfContext* xfc, XEvent* event, BOOL app)
{
if (xfc->use_xinput)
return TRUE;
return xf_generic_ButtonPress(xfc, event->xbutton.x, event->xbutton.y,
event->xbutton.button, event->xbutton.window, app);
}
@ -290,6 +296,7 @@ BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window w
rdpInput* input;
Window childWindow;
flags = 0;
wheel = FALSE;
extended = FALSE;
@ -361,6 +368,9 @@ BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window w
static BOOL xf_event_ButtonRelease(xfContext* xfc, XEvent* event, BOOL app)
{
if (xfc->use_xinput)
return TRUE;
return xf_generic_ButtonRelease(xfc, event->xbutton.x, event->xbutton.y,
event->xbutton.button, event->xbutton.window, app);
}

View File

@ -163,8 +163,11 @@ int xf_input_init(xfContext* xfc, Window window)
if (xfc->use_xinput)
{
if (!touch && (class->type == XIButtonClass))
if (!touch && (class->type == XIButtonClass) && strcmp(dev->name, "Virtual core pointer"))
{
printf("%s button device (id: %d, mode: %d)\n",
dev->name,
dev->deviceid, t->mode);
XISetMask(masks[nmasks], XI_ButtonPress);
XISetMask(masks[nmasks], XI_ButtonRelease);
XISetMask(masks[nmasks], XI_Motion);
@ -419,24 +422,23 @@ int xf_input_touch_remote(xfContext* xfc, XIDeviceEvent* event, int evtype)
int xf_input_event(xfContext* xfc, XIDeviceEvent* event, int evtype)
{
return TRUE;
switch (evtype)
{
case XI_ButtonPress:
printf("ButtonPress\n");
//printf("ButtonPress\n");
xf_generic_ButtonPress(xfc, (int) event->event_x, (int) event->event_y,
event->detail, event->event, xfc->remote_app);
break;
case XI_ButtonRelease:
printf("ButtonRelease\n");
//printf("ButtonRelease\n");
xf_generic_ButtonRelease(xfc, (int) event->event_x, (int) event->event_y,
event->detail, event->event, xfc->remote_app);
break;
case XI_Motion:
printf("Motion\n");
//printf("Motion\n");
xf_generic_MotionNotify(xfc, (int) event->event_x, (int) event->event_y,
event->detail, event->event, xfc->remote_app);
break;