diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-13 14:20:58 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-18 11:02:13 +1000 |
commit | 1c72fd55d61371de81f44be5d92982a3012ad24b (patch) | |
tree | bdad62ba65058a6d829924533bad435981567701 | |
parent | 9c6a51e8aaba50b8f3a0f3ad767c34a80aee55a1 (diff) |
Update to new inputproto and libXi naming conventions.
Require inputproto 1.9.99.9.
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/hierarchy.c | 12 | ||||
-rw-r--r-- | src/test_xi2.c | 31 |
3 files changed, 30 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac index 8314a6b..84bdcc6 100644 --- a/configure.ac +++ b/configure.ac @@ -21,8 +21,8 @@ XORG_CWARNFLAGS PKG_CHECK_MODULES(XINPUT, x11 xext [xi >= 1.2] [inputproto >= 1.5]) # XI2 support -PKG_CHECK_MODULES(XI2, [xi >= 1.2.99], - HAVE_XI2="yes"; AC_DEFINE(HAVE_XI2, 1, "foo"), +PKG_CHECK_MODULES(XI2, [xi >= 1.2.99] [inputproto >= 1.9.99.9], + HAVE_XI2="yes"; AC_DEFINE(HAVE_XI2, 1, [XI2 available]), HAVE_XI2="no"); AM_CONDITIONAL(HAVE_XI2, [ test "$HAVE_XI2" = "yes" ]) diff --git a/src/hierarchy.c b/src/hierarchy.c index 9f0cc8f..77960d5 100644 --- a/src/hierarchy.c +++ b/src/hierarchy.c @@ -48,12 +48,12 @@ create_master(Display* dpy, int argc, char** argv, char* name, char *desc) return EXIT_FAILURE; } - c.type = XICreateMasterDevice; + c.type = XICreateMaster; c.name = argv[0]; c.sendCore = (argc >= 2) ? atoi(argv[1]) : 1; c.enable = (argc >= 3) ? atoi(argv[2]) : 1; - return XIChangeDeviceHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); + return XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); } /** @@ -81,7 +81,7 @@ remove_master(Display* dpy, int argc, char** argv, char *name, char *desc) return EXIT_FAILURE; } - r.type = XIRemoveMasterDevice; + r.type = XIRemoveMaster; r.device = info->deviceid; if (argc >= 2) { @@ -100,7 +100,7 @@ remove_master(Display* dpy, int argc, char** argv, char *name, char *desc) r.returnKeyboard = atoi(argv[3]); } - ret = XIChangeDeviceHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&r, 1); + ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&r, 1); return ret; } @@ -137,7 +137,7 @@ change_attachment(Display* dpy, int argc, char** argv, char *name, char* desc) c.device = sd_info->deviceid; c.newMaster = md_info->deviceid; - ret = XIChangeDeviceHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); + ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); return ret; } @@ -167,7 +167,7 @@ float_device(Display* dpy, int argc, char** argv, char* name, char* desc) c.type = XIDetachSlave; c.device = info->deviceid; - ret = XIChangeDeviceHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); + ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1); return ret; } diff --git a/src/test_xi2.c b/src/test_xi2.c index ba5bee6..b03b762 100644 --- a/src/test_xi2.c +++ b/src/test_xi2.c @@ -89,15 +89,16 @@ static void print_devicechangedevent(Display *dpy, XIDeviceChangedEvent *event) print_classes_xi2(dpy, event->classes, event->num_classes); } -static void print_hierarchychangedevent(XIDeviceHierarchyEvent *event) +static void print_hierarchychangedevent(XIHierarchyEvent *event) { int i; - printf(" Changes happened: %s %s %s %s %s %s %s\n", + printf(" Changes happened: %s %s %s %s %s %s %s %s\n", (event->flags & XIMasterAdded) ? "[new master]" : "", (event->flags & XIMasterRemoved) ? "[master removed]" : "", (event->flags & XISlaveAdded) ? "[new slave]" : "", (event->flags & XISlaveRemoved) ? "[slave removed]" : "", (event->flags & XISlaveAttached) ? "[slave attached]" : "", + (event->flags & XISlaveDetached) ? "[slave detached]" : "", (event->flags & XIDeviceEnabled) ? "[device enabled]" : "", (event->flags & XIDeviceDisabled) ? "[device disabled]" : ""); @@ -119,10 +120,22 @@ static void print_hierarchychangedevent(XIDeviceHierarchyEvent *event) use, event->info[i].attachment, (event->info[i].enabled) ? "enabled" : "disabled"); + if (event->info[i].flags) + { + printf(" changes: %s %s %s %s %s %s %s %s\n", + (event->info[i].flags & XIMasterAdded) ? "[new master]" : "", + (event->info[i].flags & XIMasterRemoved) ? "[master removed]" : "", + (event->info[i].flags & XISlaveAdded) ? "[new slave]" : "", + (event->info[i].flags & XISlaveRemoved) ? "[slave removed]" : "", + (event->info[i].flags & XISlaveAttached) ? "[slave attached]" : "", + (event->info[i].flags & XISlaveDetached) ? "[slave detached]" : "", + (event->info[i].flags & XIDeviceEnabled) ? "[device enabled]" : "", + (event->info[i].flags & XIDeviceDisabled) ? "[device disabled]" : ""); + } } } -static void print_rawevent(XIRawDeviceEvent *event) +static void print_rawevent(XIRawEvent *event) { int i; double *val, *raw_val; @@ -205,7 +218,7 @@ test_sync_grab(Display *display, Window win) { int loop = 3; int rc; - XIDeviceEventMask mask; + XIEventMask mask; /* Select for motion events */ mask.deviceid = XIAllDevices; @@ -252,7 +265,7 @@ test_xi2(Display *display, char *name, char *desc) { - XIDeviceEventMask mask; + XIEventMask mask; Window win; list(display, argc, argv, name, desc); @@ -276,7 +289,7 @@ test_xi2(Display *display, SetBit(mask.mask, XI_FocusOut); SetBit(mask.mask, XI_HierarchyChanged); SetBit(mask.mask, XI_PropertyEvent); - XISelectEvent(display, win, &mask, 1); + XISelectEvents(display, win, &mask, 1); XSync(display, False); { @@ -300,7 +313,7 @@ test_xi2(Display *display, mask.deviceid = XIAllMasterDevices; memset(mask.mask, 0, 2); SetBit(mask.mask, XI_RawEvent); - XISelectEvent(display, DefaultRootWindow(display), &mask, 1); + XISelectEvents(display, DefaultRootWindow(display), &mask, 1); free(mask.mask); @@ -330,10 +343,10 @@ test_xi2(Display *display, (XIDeviceChangedEvent*)event); break; case XI_HierarchyChanged: - print_hierarchychangedevent((XIDeviceHierarchyEvent*)event); + print_hierarchychangedevent((XIHierarchyEvent*)event); break; case XI_RawEvent: - print_rawevent((XIRawDeviceEvent*)event); + print_rawevent((XIRawEvent*)event); break; case XI_Enter: case XI_Leave: |