diff options
author | Daniel Stone <daniel@fooishbar.org> | 2006-09-24 19:58:56 +0300 |
---|---|---|
committer | Daniel Stone <daniels@endtroducing.fooishbar.org> | 2006-09-24 19:58:56 +0300 |
commit | ba84e84575b4167b0c6298e86a860b0741e2d2a3 (patch) | |
tree | 11c22fcbfbc9a106e15c34189d8597ae1763c2f8 /src | |
parent | 93d3c2c45ccd9a806342746c4df33c684a284dd6 (diff) | |
parent | 576c5794cf4b786dfc183c9b6f0a387cad4a5460 (diff) |
Merge branch 'input-hotplug'
Diffstat (limited to 'src')
-rw-r--r-- | src/XChgDCtl.c | 48 | ||||
-rw-r--r-- | src/XExtInt.c | 28 | ||||
-rw-r--r-- | src/XGetDCtl.c | 47 |
3 files changed, 114 insertions, 9 deletions
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; } |