XTest.c revision 072eb593
1a253d6aeSmrg/* 2a253d6aeSmrgCopyright 1990, 1991 by UniSoft Group Limited 3a253d6aeSmrg*/ 4a253d6aeSmrg 5a253d6aeSmrg/* 6a253d6aeSmrg 7a253d6aeSmrgCopyright 1992, 1993, 1998 The Open Group 8a253d6aeSmrg 9a253d6aeSmrgPermission to use, copy, modify, distribute, and sell this software and its 10a253d6aeSmrgdocumentation for any purpose is hereby granted without fee, provided that 11a253d6aeSmrgthe above copyright notice appear in all copies and that both that 12a253d6aeSmrgcopyright notice and this permission notice appear in supporting 13a253d6aeSmrgdocumentation. 14a253d6aeSmrg 15a253d6aeSmrgThe above copyright notice and this permission notice shall be included 16a253d6aeSmrgin all copies or substantial portions of the Software. 17a253d6aeSmrg 18a253d6aeSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19a253d6aeSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20a253d6aeSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21a253d6aeSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 22a253d6aeSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23a253d6aeSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24a253d6aeSmrgOTHER DEALINGS IN THE SOFTWARE. 25a253d6aeSmrg 26a253d6aeSmrgExcept as contained in this notice, the name of The Open Group shall 27a253d6aeSmrgnot be used in advertising or otherwise to promote the sale, use or 28a253d6aeSmrgother dealings in this Software without prior written authorization 29a253d6aeSmrgfrom The Open Group. 30a253d6aeSmrg 31a253d6aeSmrg*/ 32a253d6aeSmrg 33a253d6aeSmrg#include <X11/Xlibint.h> 34a253d6aeSmrg#include <X11/extensions/XTest.h> 35ea133fd7Smrg#include <X11/extensions/xtestproto.h> 36a253d6aeSmrg#include <X11/extensions/Xext.h> 37a253d6aeSmrg#include <X11/extensions/extutil.h> 38a253d6aeSmrg#include <X11/extensions/XInput.h> 39a253d6aeSmrg#include <X11/extensions/XIproto.h> 40a253d6aeSmrg 41a253d6aeSmrgstatic XExtensionInfo _xtest_info_data; 42a253d6aeSmrgstatic XExtensionInfo *xtest_info = &_xtest_info_data; 43347791aaSmrgstatic const char *xtest_extension_name = XTestExtensionName; 44a253d6aeSmrg 45a253d6aeSmrg#define XTestCheckExtension(dpy,i,val) \ 46a253d6aeSmrg XextCheckExtension (dpy, i, xtest_extension_name, val) 47a253d6aeSmrg 48a253d6aeSmrg#define XTestICheckExtension(dpy,i,val) \ 49a253d6aeSmrg XextCheckExtension (dpy, i, xtest_extension_name, val); \ 50a253d6aeSmrg if (!i->data) return val 51a253d6aeSmrg 52a253d6aeSmrg/***************************************************************************** 53a253d6aeSmrg * * 54a253d6aeSmrg * private utility routines * 55a253d6aeSmrg * * 56a253d6aeSmrg *****************************************************************************/ 57a253d6aeSmrg 58a253d6aeSmrgstatic int close_display(Display *dpy, XExtCodes *codes); 59a253d6aeSmrgstatic /* const */ XExtensionHooks xtest_extension_hooks = { 60a253d6aeSmrg NULL, /* create_gc */ 61a253d6aeSmrg NULL, /* copy_gc */ 62a253d6aeSmrg NULL, /* flush_gc */ 63a253d6aeSmrg NULL, /* free_gc */ 64a253d6aeSmrg NULL, /* create_font */ 65a253d6aeSmrg NULL, /* free_font */ 66a253d6aeSmrg close_display, /* close_display */ 67a253d6aeSmrg NULL, /* wire_to_event */ 68a253d6aeSmrg NULL, /* event_to_wire */ 69a253d6aeSmrg NULL, /* error */ 70a253d6aeSmrg NULL /* error_string */ 71a253d6aeSmrg}; 72a253d6aeSmrg 73a253d6aeSmrgstatic XPointer 74a253d6aeSmrgget_xinput_base(Display *dpy) 75a253d6aeSmrg{ 76a253d6aeSmrg int major_opcode, first_event, first_error; 77a253d6aeSmrg first_event = 0; 78a253d6aeSmrg 79a253d6aeSmrg XQueryExtension(dpy, INAME, &major_opcode, &first_event, &first_error); 80a253d6aeSmrg return (XPointer)(long)first_event; 81a253d6aeSmrg} 82a253d6aeSmrg 83a253d6aeSmrgstatic XEXT_GENERATE_FIND_DISPLAY (find_display, xtest_info, 8406f32fbeSmrg xtest_extension_name, 85a253d6aeSmrg &xtest_extension_hooks, XTestNumberEvents, 86a253d6aeSmrg get_xinput_base(dpy)) 87a253d6aeSmrg 88a253d6aeSmrgstatic XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtest_info) 89a253d6aeSmrg 90a253d6aeSmrg/***************************************************************************** 91a253d6aeSmrg * * 92a253d6aeSmrg * public routines * 93a253d6aeSmrg * * 94a253d6aeSmrg *****************************************************************************/ 95a253d6aeSmrg 96a253d6aeSmrgBool 97ea133fd7SmrgXTestQueryExtension (Display *dpy, 98ea133fd7Smrg int *event_base_return, int *error_base_return, 99ea133fd7Smrg int *major_return, int *minor_return) 100a253d6aeSmrg{ 101a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 102a253d6aeSmrg xXTestGetVersionReply rep; 103a253d6aeSmrg 104a253d6aeSmrg if (XextHasExtension(info)) { 105072eb593Smrg xXTestGetVersionReq *req; 106072eb593Smrg 107a253d6aeSmrg LockDisplay(dpy); 108a253d6aeSmrg GetReq(XTestGetVersion, req); 109a253d6aeSmrg req->reqType = info->codes->major_opcode; 110a253d6aeSmrg req->xtReqType = X_XTestGetVersion; 111a253d6aeSmrg req->majorVersion = XTestMajorVersion; 112a253d6aeSmrg req->minorVersion = XTestMinorVersion; 113a253d6aeSmrg if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { 114a253d6aeSmrg UnlockDisplay(dpy); 115a253d6aeSmrg SyncHandle(); 116a253d6aeSmrg return False; 117a253d6aeSmrg } 118a253d6aeSmrg UnlockDisplay(dpy); 119a253d6aeSmrg SyncHandle(); 120ea133fd7Smrg *event_base_return = info->codes->first_event; 121ea133fd7Smrg *error_base_return = info->codes->first_error; 122ea133fd7Smrg *major_return = rep.majorVersion; 123ea133fd7Smrg *minor_return = rep.minorVersion; 124a253d6aeSmrg return True; 125a253d6aeSmrg } else { 126a253d6aeSmrg return False; 127a253d6aeSmrg } 128a253d6aeSmrg} 129a253d6aeSmrg 130a253d6aeSmrgBool 131ea133fd7SmrgXTestCompareCursorWithWindow(Display *dpy, Window window, Cursor cursor) 132a253d6aeSmrg{ 133a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 134a253d6aeSmrg register xXTestCompareCursorReq *req; 135a253d6aeSmrg xXTestCompareCursorReply rep; 136a253d6aeSmrg 137a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 138a253d6aeSmrg 139a253d6aeSmrg LockDisplay(dpy); 140a253d6aeSmrg GetReq(XTestCompareCursor, req); 141a253d6aeSmrg req->reqType = info->codes->major_opcode; 142a253d6aeSmrg req->xtReqType = X_XTestCompareCursor; 143a253d6aeSmrg req->window = window; 144a253d6aeSmrg req->cursor = cursor; 145a253d6aeSmrg if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { 146a253d6aeSmrg UnlockDisplay(dpy); 147a253d6aeSmrg SyncHandle(); 148a253d6aeSmrg return False; 149a253d6aeSmrg } 150a253d6aeSmrg UnlockDisplay(dpy); 151a253d6aeSmrg SyncHandle(); 152a253d6aeSmrg return rep.same; 153a253d6aeSmrg} 154a253d6aeSmrg 155a253d6aeSmrgBool 156ea133fd7SmrgXTestCompareCurrentCursorWithWindow(Display *dpy, Window window) 157a253d6aeSmrg{ 158a253d6aeSmrg return XTestCompareCursorWithWindow(dpy, window, XTestCurrentCursor); 159a253d6aeSmrg} 160a253d6aeSmrg 161a253d6aeSmrgint 162ea133fd7SmrgXTestFakeKeyEvent(Display *dpy, unsigned int keycode, 163ea133fd7Smrg Bool is_press, unsigned long delay) 164a253d6aeSmrg{ 165a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 166a253d6aeSmrg register xXTestFakeInputReq *req; 167a253d6aeSmrg 168a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 169a253d6aeSmrg 170a253d6aeSmrg LockDisplay(dpy); 171a253d6aeSmrg GetReq(XTestFakeInput, req); 172a253d6aeSmrg req->reqType = info->codes->major_opcode; 173a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 174a253d6aeSmrg req->type = is_press ? KeyPress : KeyRelease; 175a253d6aeSmrg req->detail = keycode; 176a253d6aeSmrg req->time = delay; 177a253d6aeSmrg UnlockDisplay(dpy); 178a253d6aeSmrg SyncHandle(); 179a253d6aeSmrg return 1; 180a253d6aeSmrg} 181a253d6aeSmrg 182a253d6aeSmrgint 183ea133fd7SmrgXTestFakeButtonEvent(Display *dpy, unsigned int button, 184ea133fd7Smrg Bool is_press, unsigned long delay) 185a253d6aeSmrg{ 186a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 187a253d6aeSmrg register xXTestFakeInputReq *req; 188a253d6aeSmrg 189a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 190a253d6aeSmrg 191a253d6aeSmrg LockDisplay(dpy); 192a253d6aeSmrg GetReq(XTestFakeInput, req); 193a253d6aeSmrg req->reqType = info->codes->major_opcode; 194a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 195a253d6aeSmrg req->type = is_press ? ButtonPress : ButtonRelease; 196a253d6aeSmrg req->detail = button; 197a253d6aeSmrg req->time = delay; 198a253d6aeSmrg UnlockDisplay(dpy); 199a253d6aeSmrg SyncHandle(); 200a253d6aeSmrg return 1; 201a253d6aeSmrg} 202a253d6aeSmrg 203a253d6aeSmrgint 204ea133fd7SmrgXTestFakeMotionEvent(Display *dpy, int screen, int x, int y, unsigned long delay) 205a253d6aeSmrg{ 206a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 207a253d6aeSmrg register xXTestFakeInputReq *req; 208a253d6aeSmrg 209a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 210a253d6aeSmrg 211a253d6aeSmrg LockDisplay(dpy); 212a253d6aeSmrg GetReq(XTestFakeInput, req); 213a253d6aeSmrg req->reqType = info->codes->major_opcode; 214a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 215a253d6aeSmrg req->type = MotionNotify; 216a253d6aeSmrg req->detail = False; 217a253d6aeSmrg if (screen == -1) 218a253d6aeSmrg req->root = None; 219a253d6aeSmrg else 220a253d6aeSmrg req->root = RootWindow(dpy, screen); 221a253d6aeSmrg req->rootX = x; 222a253d6aeSmrg req->rootY = y; 223a253d6aeSmrg req->time = delay; 224a253d6aeSmrg UnlockDisplay(dpy); 225a253d6aeSmrg SyncHandle(); 226a253d6aeSmrg return 1; 227a253d6aeSmrg} 228a253d6aeSmrg 229a253d6aeSmrgint 230ea133fd7SmrgXTestFakeRelativeMotionEvent(Display *dpy, int dx, int dy, unsigned long delay) 231a253d6aeSmrg{ 232a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 233a253d6aeSmrg register xXTestFakeInputReq *req; 234a253d6aeSmrg 235a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 236a253d6aeSmrg 237a253d6aeSmrg LockDisplay(dpy); 238a253d6aeSmrg GetReq(XTestFakeInput, req); 239a253d6aeSmrg req->reqType = info->codes->major_opcode; 240a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 241a253d6aeSmrg req->type = MotionNotify; 242a253d6aeSmrg req->detail = True; 243a253d6aeSmrg req->root = None; 244a253d6aeSmrg req->rootX = dx; 245a253d6aeSmrg req->rootY = dy; 246a253d6aeSmrg req->time = delay; 247a253d6aeSmrg UnlockDisplay(dpy); 248a253d6aeSmrg SyncHandle(); 249a253d6aeSmrg return 1; 250a253d6aeSmrg} 251a253d6aeSmrg 252a253d6aeSmrgstatic void 253a253d6aeSmrgsend_axes( 254a253d6aeSmrg Display *dpy, 255a253d6aeSmrg XExtDisplayInfo *info, 256a253d6aeSmrg xXTestFakeInputReq *req, 257a253d6aeSmrg XDevice *dev, 258a253d6aeSmrg int first_axis, 259a253d6aeSmrg int *axes, 260a253d6aeSmrg int n_axes) 261a253d6aeSmrg{ 262a253d6aeSmrg deviceValuator ev; 263a253d6aeSmrg 264a253d6aeSmrg req->deviceid |= MORE_EVENTS; 265a253d6aeSmrg req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2); 266a253d6aeSmrg ev.type = XI_DeviceValuator + (long)info->data; 267a253d6aeSmrg ev.deviceid = dev->device_id; 268a253d6aeSmrg ev.first_valuator = first_axis; 269a253d6aeSmrg while (n_axes > 0) { 270072eb593Smrg int n = n_axes > 6 ? 6 : n_axes; 27125b89263Smrg ev.num_valuators = n; 272a253d6aeSmrg switch (n) { 273a253d6aeSmrg case 6: 274a253d6aeSmrg ev.valuator5 = *(axes+5); 275072eb593Smrg /* fallthrough */ 276a253d6aeSmrg case 5: 277a253d6aeSmrg ev.valuator4 = *(axes+4); 278072eb593Smrg /* fallthrough */ 279a253d6aeSmrg case 4: 280a253d6aeSmrg ev.valuator3 = *(axes+3); 281072eb593Smrg /* fallthrough */ 282a253d6aeSmrg case 3: 283a253d6aeSmrg ev.valuator2 = *(axes+2); 284072eb593Smrg /* fallthrough */ 285a253d6aeSmrg case 2: 286a253d6aeSmrg ev.valuator1 = *(axes+1); 287072eb593Smrg /* fallthrough */ 288a253d6aeSmrg case 1: 289a253d6aeSmrg ev.valuator0 = *axes; 290a253d6aeSmrg } 291a253d6aeSmrg Data(dpy, (char *)&ev, SIZEOF(xEvent)); 292a253d6aeSmrg axes += n; 293a253d6aeSmrg n_axes -= n; 294a253d6aeSmrg ev.first_valuator += n; 295a253d6aeSmrg } 296a253d6aeSmrg} 297a253d6aeSmrg 298a253d6aeSmrgint 299ea133fd7SmrgXTestFakeDeviceKeyEvent(Display *dpy, XDevice *dev, 300ea133fd7Smrg unsigned int keycode, Bool is_press, 301ea133fd7Smrg int *axes, int n_axes, unsigned long delay) 302a253d6aeSmrg{ 303a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 304a253d6aeSmrg register xXTestFakeInputReq *req; 305a253d6aeSmrg 306a253d6aeSmrg XTestICheckExtension (dpy, info, 0); 307a253d6aeSmrg 308a253d6aeSmrg LockDisplay(dpy); 309a253d6aeSmrg GetReq(XTestFakeInput, req); 310a253d6aeSmrg req->reqType = info->codes->major_opcode; 311a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 312a253d6aeSmrg req->type = is_press ? XI_DeviceKeyPress : XI_DeviceKeyRelease; 313a253d6aeSmrg req->type += (int)(long)info->data; 314a253d6aeSmrg req->detail = keycode; 315a253d6aeSmrg req->time = delay; 316a253d6aeSmrg req->deviceid = dev->device_id; 317a253d6aeSmrg if (n_axes) 318a253d6aeSmrg send_axes(dpy, info, req, dev, 0, axes, n_axes); 319a253d6aeSmrg UnlockDisplay(dpy); 320a253d6aeSmrg SyncHandle(); 321a253d6aeSmrg return 1; 322a253d6aeSmrg} 323a253d6aeSmrg 324a253d6aeSmrgint 325ea133fd7SmrgXTestFakeDeviceButtonEvent(Display *dpy, XDevice *dev, 326ea133fd7Smrg unsigned int button, Bool is_press, 327ea133fd7Smrg int *axes, int n_axes, unsigned long delay) 328a253d6aeSmrg{ 329a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 330a253d6aeSmrg register xXTestFakeInputReq *req; 331a253d6aeSmrg 332a253d6aeSmrg XTestICheckExtension (dpy, info, 0); 333a253d6aeSmrg 334a253d6aeSmrg LockDisplay(dpy); 335a253d6aeSmrg GetReq(XTestFakeInput, req); 336a253d6aeSmrg req->reqType = info->codes->major_opcode; 337a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 338a253d6aeSmrg req->type = is_press ? XI_DeviceButtonPress : XI_DeviceButtonRelease; 339a253d6aeSmrg req->type += (int)(long)info->data; 340a253d6aeSmrg req->detail = button; 341a253d6aeSmrg req->time = delay; 342a253d6aeSmrg req->deviceid = dev->device_id; 343a253d6aeSmrg if (n_axes) 344a253d6aeSmrg send_axes(dpy, info, req, dev, 0, axes, n_axes); 345a253d6aeSmrg UnlockDisplay(dpy); 346a253d6aeSmrg SyncHandle(); 347a253d6aeSmrg return 1; 348a253d6aeSmrg} 349a253d6aeSmrg 350a253d6aeSmrgint 351ea133fd7SmrgXTestFakeProximityEvent(Display *dpy, XDevice *dev, Bool in_prox, 352ea133fd7Smrg int *axes, int n_axes, unsigned long delay) 353a253d6aeSmrg{ 354a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 355a253d6aeSmrg register xXTestFakeInputReq *req; 356a253d6aeSmrg 357a253d6aeSmrg XTestICheckExtension (dpy, info, 0); 358a253d6aeSmrg 359a253d6aeSmrg LockDisplay(dpy); 360a253d6aeSmrg GetReq(XTestFakeInput, req); 361a253d6aeSmrg req->reqType = info->codes->major_opcode; 362a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 363a253d6aeSmrg req->type = in_prox ? XI_ProximityIn : XI_ProximityOut; 364a253d6aeSmrg req->type += (int)(long)info->data; 365a253d6aeSmrg req->time = delay; 366a253d6aeSmrg req->deviceid = dev->device_id; 367a253d6aeSmrg if (n_axes) 368a253d6aeSmrg send_axes(dpy, info, req, dev, 0, axes, n_axes); 369a253d6aeSmrg UnlockDisplay(dpy); 370a253d6aeSmrg SyncHandle(); 371a253d6aeSmrg return 1; 372a253d6aeSmrg} 373a253d6aeSmrg 374a253d6aeSmrgint 375ea133fd7SmrgXTestFakeDeviceMotionEvent(Display *dpy, XDevice *dev, 376ea133fd7Smrg Bool is_relative, int first_axis, 377ea133fd7Smrg int *axes, int n_axes, unsigned long delay) 378a253d6aeSmrg{ 379a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 380a253d6aeSmrg register xXTestFakeInputReq *req; 381a253d6aeSmrg 382a253d6aeSmrg XTestICheckExtension (dpy, info, 0); 383a253d6aeSmrg 384a253d6aeSmrg LockDisplay(dpy); 385a253d6aeSmrg GetReq(XTestFakeInput, req); 386a253d6aeSmrg req->reqType = info->codes->major_opcode; 387a253d6aeSmrg req->xtReqType = X_XTestFakeInput; 388a253d6aeSmrg req->type = XI_DeviceMotionNotify + (int)(long)info->data; 389a253d6aeSmrg req->detail = is_relative; 390a253d6aeSmrg req->time = delay; 391a253d6aeSmrg req->deviceid = dev->device_id; 392a253d6aeSmrg send_axes(dpy, info, req, dev, first_axis, axes, n_axes); 393a253d6aeSmrg UnlockDisplay(dpy); 394a253d6aeSmrg SyncHandle(); 395a253d6aeSmrg return 1; 396a253d6aeSmrg} 397a253d6aeSmrg 398a253d6aeSmrgint 399ea133fd7SmrgXTestGrabControl(Display *dpy, Bool impervious) 400a253d6aeSmrg{ 401a253d6aeSmrg XExtDisplayInfo *info = find_display (dpy); 402a253d6aeSmrg register xXTestGrabControlReq *req; 403a253d6aeSmrg 404a253d6aeSmrg XTestCheckExtension (dpy, info, 0); 405a253d6aeSmrg 406a253d6aeSmrg LockDisplay(dpy); 407a253d6aeSmrg GetReq(XTestGrabControl, req); 408a253d6aeSmrg req->reqType = info->codes->major_opcode; 409a253d6aeSmrg req->xtReqType = X_XTestGrabControl; 410a253d6aeSmrg req->impervious = impervious; 411a253d6aeSmrg UnlockDisplay(dpy); 412a253d6aeSmrg SyncHandle(); 413a253d6aeSmrg return 1; 414a253d6aeSmrg} 415a253d6aeSmrg 416a253d6aeSmrgvoid 417ea133fd7SmrgXTestSetGContextOfGC(GC gc, GContext gid) 418a253d6aeSmrg{ 419a253d6aeSmrg gc->gid = gid; 420a253d6aeSmrg} 421a253d6aeSmrg 422a253d6aeSmrgvoid 423ea133fd7SmrgXTestSetVisualIDOfVisual(Visual *visual, VisualID visualid) 424a253d6aeSmrg{ 425a253d6aeSmrg visual->visualid = visualid; 426a253d6aeSmrg} 427a253d6aeSmrg 428a253d6aeSmrgstatic xReq _dummy_request = { 429a253d6aeSmrg 0, 0, 0 430a253d6aeSmrg}; 431a253d6aeSmrg 432a253d6aeSmrgStatus 433ea133fd7SmrgXTestDiscard(Display *dpy) 434a253d6aeSmrg{ 435a253d6aeSmrg Bool something; 436a253d6aeSmrg 437a253d6aeSmrg LockDisplay(dpy); 438a253d6aeSmrg if ((something = (dpy->bufptr != dpy->buffer))) { 439072eb593Smrg for (char *ptr = dpy->buffer; 440a253d6aeSmrg ptr < dpy->bufptr; 441a253d6aeSmrg ptr += (((xReq *)ptr)->length << 2)) 442a253d6aeSmrg dpy->request--; 443a253d6aeSmrg dpy->bufptr = dpy->buffer; 444a253d6aeSmrg dpy->last_req = (char *)&_dummy_request; 445a253d6aeSmrg } 446a253d6aeSmrg UnlockDisplay(dpy); 447a253d6aeSmrg SyncHandle(); 448a253d6aeSmrg return something; 449a253d6aeSmrg} 450