diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/XChgDCtl.c | 48 | ||||
-rw-r--r-- | src/XExtInt.c | 28 | ||||
-rw-r--r-- | src/XGetDCtl.c | 47 |
4 files changed, 116 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 3b34ffa..d443194 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.57]) -AC_INIT(libXi, 1.0.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi) +AC_INIT(libXi, 1.1.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE @@ -15,7 +15,7 @@ AC_PROG_CC AC_PROG_LIBTOOL # Checks for pkg-config packages -PKG_CHECK_MODULES(XI, xproto x11 xextproto xext inputproto) +PKG_CHECK_MODULES(XI, xproto x11 xextproto xext inputproto >= 1.4) AC_SUBST(XI_CFLAGS) AC_SUBST(XI_LIBS) diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c index be5d941..a196523 100644 --- a/src/XChgDCtl.c +++ b/src/XChgDCtl.c @@ -92,7 +92,7 @@ XChangeDeviceControl(dpy, dev, control, d) R = (XDeviceResolutionControl *) d; r.control = DEVICE_RESOLUTION; r.length = sizeof(xDeviceResolutionCtl) + - R->num_valuators * sizeof(int); + R->num_valuators * sizeof(int); r.first_valuator = R->first_valuator; r.num_valuators = R->num_valuators; req->length += ((unsigned)(r.length + 3) >> 2); @@ -107,6 +107,52 @@ XChangeDeviceControl(dpy, dev, control, d) } else return (rep.status); } + case DEVICE_TOUCHSCREEN: + { + XDeviceTSControl *T = (XDeviceTSControl *) d; + xDeviceTSCtl t; + + t.control = DEVICE_TOUCHSCREEN; + t.length = sizeof(t); + t.min_x = T->min_x; + t.max_x = T->max_x; + t.min_y = T->min_y; + t.max_y = T->max_y; + t.button_threshold = T->button_threshold; + + req->length += (sizeof(t) + 3) >> 2; + Data(dpy, (char *) &t, sizeof(t)); + + if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return NoSuchExtension; + } + else { + return rep.status; + } + } + case DEVICE_CORE: + { + XDeviceCoreControl *C = (XDeviceCoreControl *) d; + xDeviceCoreCtl c; + + c.control = DEVICE_CORE; + c.length = sizeof(c); + c.status = C->status; + + req->length += (sizeof(c) + 3) >> 2; + Data (dpy, (char *) &c, sizeof(c)); + + if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return NoSuchExtension; + } + else { + return rep.status; + } + } default: { xDeviceCtl u; diff --git a/src/XExtInt.c b/src/XExtInt.c index 811c0c3..e5baccb 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -122,7 +122,9 @@ XEXT_GENERATE_FIND_DISPLAY(XInput_find_display, xinput_info, {XI_Present, XI_Add_XSetDeviceValuators_Major, XI_Add_XSetDeviceValuators_Minor}, {XI_Present, XI_Add_XChangeDeviceControl_Major, - XI_Add_XChangeDeviceControl_Minor} + XI_Add_XChangeDeviceControl_Minor}, + {XI_Present, XI_Add_DevicePresenceNotify_Major, + XI_Add_DevicePresenceNotify_Minor} }; /*********************************************************************** @@ -251,6 +253,14 @@ Ones(mask) return (((y + (y >> 3)) & 030707070707) % 077); } +static int +_XiGetDevicePresenceNotifyEvent(Display * dpy) +{ + XExtDisplayInfo *info = XInput_find_display(dpy); + + return info->codes->first_event + XI_DevicePresenceNotify; +} + /*********************************************************************** * * Handle Input extension events. @@ -665,6 +675,22 @@ XInputWireToEvent(dpy, re, event) return (ENQUEUE_EVENT); } break; + + case XI_DevicePresenceNotify: + { + XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re; + devicePresenceNotify *ev2 = (devicePresenceNotify *) event; + + fprintf(stderr, "got DevicePresenceNotify event (reltype=%d)\n", + reltype); + + *ev = *(XDevicePresenceNotifyEvent *) save; + ev->window = 0; + ev->time = ev2->time; + return (ENQUEUE_EVENT); + } + break; + default: printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type); break; diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c index 9862dcc..139f7e7 100644 --- a/src/XGetDCtl.c +++ b/src/XGetDCtl.c @@ -61,13 +61,11 @@ SOFTWARE. #include <X11/extensions/extutil.h> #include "XIint.h" -XDeviceControl * XGetDeviceControl(dpy, dev, control) - register Display * - dpy; - XDevice * - dev; - int - control; +XDeviceControl * +XGetDeviceControl(dpy, dev, control) + register Display *dpy; + XDevice *dev; + int control; { int size = 0; int nbytes, i; @@ -116,6 +114,15 @@ XDeviceControl * XGetDeviceControl(dpy, dev, control) (3 * sizeof(int) * r->num_valuators); break; } + case DEVICE_TOUCHSCREEN: + { + size += sizeof(xDeviceTSState); + break; + } + case DEVICE_CORE: + { + size += sizeof(xDeviceCoreState); + } default: size += d->length; break; @@ -152,6 +159,32 @@ XDeviceControl * XGetDeviceControl(dpy, dev, control) *iptr++ = *iptr2++; break; } + case DEVICE_TOUCHSCREEN: + { + xDeviceTSState *t = (xDeviceTSState *) d; + XDeviceTSState *T = (XDeviceTSState *) Device; + + T->control = DEVICE_TOUCHSCREEN; + T->length = sizeof(T); + T->min_x = t->min_x; + T->max_x = t->max_x; + T->min_y = t->min_y; + T->max_y = t->max_y; + T->button_threshold = t->button_threshold; + + break; + } + case DEVICE_CORE: + { + xDeviceCoreState *c = (xDeviceCoreState *) d; + XDeviceCoreState *C = (XDeviceCoreState *) Device; + + C->control = DEVICE_CORE; + C->length = sizeof(C); + C->status = c->status; + + break; + } default: break; } |