diff options
Diffstat (limited to 'x11-libs/libXi/files/libXi-xi2.1.patch')
-rw-r--r-- | x11-libs/libXi/files/libXi-xi2.1.patch | 355 |
1 files changed, 355 insertions, 0 deletions
diff --git a/x11-libs/libXi/files/libXi-xi2.1.patch b/x11-libs/libXi/files/libXi-xi2.1.patch new file mode 100644 index 0000000..398a697 --- /dev/null +++ b/x11-libs/libXi/files/libXi-xi2.1.patch @@ -0,0 +1,355 @@ +--- a/include/X11/extensions/XInput2.h ++++ b/include/X11/extensions/XInput2.h +@@ -135,6 +135,25 @@ typedef struct + + typedef struct + { ++ int type; ++ int sourceid; ++ int mode; ++ int num_touches; ++} XITouchClassInfo; ++ ++typedef struct ++{ ++ int type; ++ int sourceid; ++ int number; ++ Atom label; ++ double min; ++ double max; ++ int resolution; ++} XITouchValuatorClassInfo; ++ ++typedef struct ++{ + int deviceid; + char *name; + int use; +@@ -292,6 +311,20 @@ typedef struct { + int what; + } XIPropertyEvent; + ++typedef struct { ++ int type; /* GenericEvent */ ++ unsigned long serial; /* # of last request processed by server */ ++ Bool send_event; /* true if this came from a SendEvent request */ ++ Display *display; /* Display the event was read from */ ++ int extension; /* XI extension offset */ ++ int evtype; ++ Time time; ++ int deviceid; ++ int sourceid; ++ unsigned int touchid; ++ unsigned int flags; ++} XITouchOwnershipEvent; ++ + _XFUNCPROTOBEGIN + + extern Bool XIQueryPointer( +@@ -415,6 +448,13 @@ extern Status XIAllowEvents( + Time time + ); + ++extern Status XIAllowTouchEvents( ++ Display* display, ++ int deviceid, ++ unsigned long touchid, ++ int event_mode ++); ++ + extern int XIGrabButton( + Display* display, + int deviceid, +@@ -466,6 +506,17 @@ extern int XIGrabFocusIn( + int num_modifiers, + XIGrabModifiers *modifiers_inout + ); ++ ++extern int XIGrabTouchBegin( ++ Display* display, ++ int deviceid, ++ Window grab_window, ++ int owner_events, ++ XIEventMask *mask, ++ int num_modifiers, ++ XIGrabModifiers *modifiers_inout ++); ++ + extern Status XIUngrabButton( + Display* display, + int deviceid, +@@ -496,6 +547,14 @@ extern Status XIUngrabFocusIn( + Display* display, + int deviceid, + Window grab_window, ++ int num_modifiers, ++ XIGrabModifiers *modifiers ++); ++ ++extern Status XIUngrabTouchBegin( ++ Display* display, ++ int deviceid, ++ Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers + ); +--- a/src/XExtInt.c ++++ b/src/XExtInt.c +@@ -146,6 +146,9 @@ static int + wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie); + static int + wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie); ++static int ++wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in, ++ XGenericEventCookie *cookie); + + static /* const */ XEvent emptyevent; + +@@ -268,7 +271,8 @@ static XExtensionVersion versions[] = { + XI_Add_DevicePresenceNotify_Minor}, + {XI_Present, XI_Add_DeviceProperties_Major, + XI_Add_DeviceProperties_Minor}, +-{XI_Present, XI_2_Major, XI_2_Minor} ++{XI_Present, XI_2_Major, XI_2_Minor}, ++{XI_Present, XI_2_Major, XI_2_1_Minor} + }; + + /*********************************************************************** +@@ -924,6 +928,10 @@ XInputWireToCookie( + case XI_ButtonRelease: + case XI_KeyPress: + case XI_KeyRelease: ++ case XI_TouchBegin: ++ case XI_TouchUpdate: ++ case XI_TouchUpdateUnowned: ++ case XI_TouchEnd: + *cookie = *(XGenericEventCookie*)save; + if (!wireToDeviceEvent((xXIDeviceEvent*)event, cookie)) + { +@@ -950,7 +958,16 @@ XInputWireToCookie( + break; + } + return ENQUEUE_EVENT; +- ++ case XI_TouchOwnership: ++ *cookie = *(XGenericEventCookie*)save; ++ if (!wireToTouchOwnershipEvent((xXITouchOwnershipEvent*)event, ++ cookie)) ++ { ++ printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n", ++ ge->evtype); ++ break; ++ } ++ return ENQUEUE_EVENT; + case XI_RawKeyPress: + case XI_RawKeyRelease: + case XI_RawButtonPress: +@@ -1037,6 +1054,12 @@ sizeDeviceClassType(int type, int num_el + case XIValuatorClass: + l = sizeof(XIValuatorClassInfo); + break; ++ case XITouchClass: ++ l = sizeof(XITouchClassInfo); ++ break; ++ case XITouchValuatorClass: ++ l = sizeof(XITouchValuatorClassInfo); ++ break; + default: + printf("sizeDeviceClassType: unknown type %d\n", type); + break; +@@ -1239,6 +1262,22 @@ copyPropertyEvent(XGenericEventCookie *c + } + + static Bool ++copyTouchOwnershipEvent(XGenericEventCookie *cookie_in, ++ XGenericEventCookie *cookie_out) ++{ ++ XITouchOwnershipEvent *in, *out; ++ ++ in = cookie_in->data; ++ ++ out = cookie_out->data = malloc(sizeof(XITouchOwnershipEvent)); ++ if (!out) ++ return False; ++ ++ *out = *in; ++ return True; ++} ++ ++static Bool + copyRawEvent(XGenericEventCookie *cookie_in, + XGenericEventCookie *cookie_out) + { +@@ -1297,8 +1336,15 @@ XInputCopyCookie(Display *dpy, XGenericE + case XI_ButtonRelease: + case XI_KeyPress: + case XI_KeyRelease: ++ case XI_TouchBegin: ++ case XI_TouchUpdate: ++ case XI_TouchUpdateUnowned: ++ case XI_TouchEnd: + ret = copyDeviceEvent(in, out); + break; ++ case XI_TouchOwnership: ++ ret = copyTouchOwnershipEvent(in, out); ++ break; + case XI_DeviceChanged: + ret = copyDeviceChangedEvent(in, out); + break; +@@ -1427,6 +1473,12 @@ size_classes(xXIAnyInfo* from, int nclas + case XIValuatorClass: + l = sizeDeviceClassType(XIValuatorClass, 0); + break; ++ case XITouchClass: ++ l = sizeDeviceClassType(XITouchClass, 0); ++ break; ++ case XITouchValuatorClass: ++ l = sizeDeviceClassType(XITouchValuatorClass, 0); ++ break; + } + + len += l; +@@ -1527,6 +1579,35 @@ copy_classes(XIDeviceInfo* to, xXIAnyInf + + } + break; ++ case XITouchClass: ++ { ++ XITouchClassInfo *cls_lib; ++ xXITouchInfo *cls_wire; ++ ++ cls_wire = (xXITouchInfo*)any_wire; ++ cls_lib = next_block(&ptr_lib, sizeof(XITouchClassInfo)); ++ ++ cls_lib->mode = cls_wire->mode; ++ cls_lib->num_touches = cls_wire->num_touches; ++ } ++ break; ++ case XITouchValuatorClass: ++ { ++ XITouchValuatorClassInfo *cls_lib; ++ xXITouchValuatorInfo *cls_wire; ++ ++ cls_wire = (xXITouchValuatorInfo*)any_wire; ++ cls_lib = next_block(&ptr_lib, ++ sizeof(XITouchValuatorClassInfo)); ++ ++ cls_lib->number = cls_wire->number; ++ cls_lib->label = cls_wire->label; ++ /* FIXME: fractional parts */ ++ cls_lib->min = cls_wire->min.integral; ++ cls_lib->max = cls_wire->max.integral; ++ cls_lib->resolution = cls_wire->resolution; ++ } ++ break; + } + len += any_wire->length * 4; + ptr_wire += any_wire->length * 4; +@@ -1697,6 +1778,28 @@ wireToEnterLeave(xXIEnterEvent *in, XGen + + return 1; + } ++ ++static int ++wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in, ++ XGenericEventCookie *cookie) ++{ ++ XITouchOwnershipEvent *out = malloc(sizeof(XITouchOwnershipEvent)); ++ ++ cookie->data = out; ++ ++ out->type = in->type; ++ out->display = cookie->display; ++ out->extension = in->extension; ++ out->evtype = in->evtype; ++ out->send_event = ((in->type & 0x80) != 0); ++ out->time = in->time; ++ out->deviceid = in->deviceid; ++ out->sourceid = in->sourceid; ++ out->touchid = in->touchid; ++ out->flags = in->flags; ++ ++ return 1; ++} + + static int + wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie) +--- a/src/XIAllowEvents.c ++++ b/src/XIAllowEvents.c +@@ -51,3 +51,27 @@ XIAllowEvents(Display *dpy, int deviceid + SyncHandle(); + return Success; + } ++ ++Status ++XIAllowTouchEvents(Display *dpy, int deviceid, unsigned long touchid, ++ int event_mode) ++{ ++ xXIAllowTouchEventsReq *req; ++ ++ XExtDisplayInfo *extinfo = XInput_find_display(dpy); ++ ++ LockDisplay(dpy); ++ if (_XiCheckExtInit(dpy, XInput_2_1, extinfo) == -1) ++ return (NoSuchExtension); ++ ++ GetReq(XIAllowTouchEvents, req); ++ req->reqType = extinfo->codes->major_opcode; ++ req->ReqType = X_XIAllowTouchEvents; ++ req->deviceid = deviceid; ++ req->touchid = touchid; ++ req->mode = event_mode; ++ ++ UnlockDisplay(dpy); ++ SyncHandle(); ++ return Success; ++} +--- a/src/XIPassiveGrab.c ++++ b/src/XIPassiveGrab.c +@@ -145,6 +145,25 @@ XIGrabFocusIn(Display *dpy, int deviceid + modifiers_inout); + } + ++int ++XIGrabTouchBegin(Display *dpy, int deviceid, Window grab_window, ++ Bool owner_events, XIEventMask *mask, ++ int num_modifiers, XIGrabModifiers *modifiers_inout) ++{ ++ XExtDisplayInfo *extinfo = XInput_find_display(dpy); ++ ++ LockDisplay(dpy); ++ if (_XiCheckExtInit(dpy, XInput_2_1, extinfo) == -1) ++ return -1; ++ ++ UnlockDisplay(dpy); ++ ++ return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeTouchBegin, 0, ++ grab_window, None, GrabModeAsync, GrabModeAsync, ++ owner_events, mask, num_modifiers, ++ modifiers_inout); ++} ++ + static int + _XIPassiveUngrabDevice(Display* dpy, int deviceid, int grabtype, int detail, + Window grab_window, int num_modifiers, XIGrabModifiers *modifiers) +@@ -208,3 +227,19 @@ XIUngrabFocusIn(Display* display, int de + return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeFocusIn, 0, + grab_window, num_modifiers, modifiers); + } ++ ++int ++XIUngrabTouchBegin(Display* display, int deviceid, Window grab_window, ++ int num_modifiers, XIGrabModifiers *modifiers) ++{ ++ XExtDisplayInfo *extinfo = XInput_find_display(display); ++ ++ LockDisplay(display); ++ if (_XiCheckExtInit(display, XInput_2_1, extinfo) == -1) ++ return -1; ++ ++ UnlockDisplay(display); ++ ++ return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeTouchBegin, 0, ++ grab_window, num_modifiers, modifiers); ++} |