From 150771e7aabf4c864b0b970c5b8d773634793abe Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 4 Jun 2013 09:07:26 +0200 Subject: xwininfo fontconfig libX11 libXau libXdmcp libXext mesa libXinerama libxcb libxcb/xcb-proto libfontenc pixman xkbcomp mkfontscale xkeyboard-config git update 4 Jun 2013 xserver commit c21344add2fc589df83b29be5831c36a372201bd libxcb commit 9ae84ad187e2ba440c40f44b8eb21c82c2fdbf12 libxcb/xcb-proto commit bdfedfa57a13ff805580cfacafc70f9cc55df363 xkeyboard-config commit dad9ade4e83d1ef5a517fcc4cc9ad3a79b47acce libX11 commit 8496122eb00ce6cd5d2308ee54f64b68c378e455 libXdmcp commit 0b443c1b769b9c9a3b45b4252afe07e18b709ff4 libXext commit d8366afbb0d2e4fbb1e419b1187f490522270bea libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff libXau commit 899790011304c4029e15abf410e49ce7cec17e0a xkbcomp commit ed582f4fccd4e23abcfba8b3b03649fea6414f44 pixman commit 2acfac5f8e097ee2ae225d986f981b55d65dd152 mkfontscale commit 19e2cb7c6a3ec2c5b1bc0d24866fa685eef0ee13 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 fontconfig commit cd9b1033a68816a7acfbba1718ba0aa5888f6ec7 mesa commit 7bafd88c153e395274b632e7eae4bc9fc3aec1d2 --- xorg-server/Xi/chgdctl.c | 6 ++ xorg-server/Xi/devbell.c | 3 +- xorg-server/Xi/exevents.c | 179 +++++++++++++++++++++-------------------- xorg-server/Xi/extinit.c | 38 ++++----- xorg-server/Xi/setdval.c | 3 + xorg-server/Xi/setmode.c | 4 + xorg-server/Xi/ungrdevb.c | 2 +- xorg-server/Xi/ungrdevk.c | 2 +- xorg-server/Xi/xibarriers.c | 12 +++ xorg-server/Xi/xibarriers.h | 4 +- xorg-server/Xi/xigrabdev.c | 15 +++- xorg-server/Xi/xipassivegrab.c | 2 +- 12 files changed, 155 insertions(+), 115 deletions(-) (limited to 'xorg-server/Xi') diff --git a/xorg-server/Xi/chgdctl.c b/xorg-server/Xi/chgdctl.c index 31d3a57f3..d078aa248 100644 --- a/xorg-server/Xi/chgdctl.c +++ b/xorg-server/Xi/chgdctl.c @@ -122,6 +122,12 @@ ProcXChangeDeviceControl(ClientPtr client) if (ret != Success) goto out; + /* XTest devices are special, none of the below apply to them anyway */ + if (IsXTestDevice(dev, NULL)) { + ret = BadMatch; + goto out; + } + rep = (xChangeDeviceControlReply) { .repType = X_Reply, .RepType = X_ChangeDeviceControl, diff --git a/xorg-server/Xi/devbell.c b/xorg-server/Xi/devbell.c index c75b94dee..202c8de18 100644 --- a/xorg-server/Xi/devbell.c +++ b/xorg-server/Xi/devbell.c @@ -142,7 +142,8 @@ ProcXDeviceBell(ClientPtr client) newpercent = base + newpercent; else newpercent = base - newpercent + stuff->percent; + if (proc == NULL) + return BadValue; (*proc) (newpercent, dev, ctrl, class); - return Success; } diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 6779139b5..2bbc6f091 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -1036,46 +1036,21 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti, static void ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti) { - int rc; ClientPtr client; XID error; + GrabPtr grab = ti->listeners[0].grab; - rc = dixLookupClient(&client, ti->listeners[0].listener, serverClient, - DixSendAccess); - if (rc != Success) { - ErrorF("[Xi] Failed to lookup early accepting client.\n"); - return; - } + BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB && + ti->listeners[0].type != LISTENER_POINTER_GRAB); + BUG_RETURN(!grab); + + client = rClient(grab); if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id, - ti->listeners[0].window->drawable.id, &error) != - Success) + ti->listeners[0].window->drawable.id, &error) != Success) ErrorF("[Xi] Failed to accept touch grab after early acceptance.\n"); } -/** - * Generate and deliver a TouchEnd event. - * - * @param dev The device to deliver the event for. - * @param ti The touch point record to deliver the event for. - * @param flags Internal event flags. The called does not need to provide - * TOUCH_CLIENT_ID and TOUCH_POINTER_EMULATED, this function will ensure - * they are set appropriately. - * @param resource The client resource to deliver to, or 0 for all clients. - */ -static void -EmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource) -{ - InternalEvent event; - - flags |= TOUCH_CLIENT_ID; - if (ti->emulate_pointer) - flags |= TOUCH_POINTER_EMULATED; - TouchDeliverDeviceClassesChangedEvent(ti, GetTimeInMillis(), resource); - GetDixTouchEnd(&event, dev, ti, flags); - DeliverTouchEvents(dev, ti, &event, resource); -} - /** * Find the oldest touch that still has a pointer emulation client. * @@ -1127,10 +1102,10 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchOwnershipEvent *ev) { TouchListener *listener = &ti->listeners[0]; /* new owner */ + int accepted_early = listener->state == LISTENER_EARLY_ACCEPT; /* Deliver the ownership */ - if (listener->state == LISTENER_AWAITING_OWNER || - listener->state == LISTENER_EARLY_ACCEPT) + if (listener->state == LISTENER_AWAITING_OWNER || accepted_early) DeliverTouchEvents(dev, ti, (InternalEvent *) ev, listener->listener); else if (listener->state == LISTENER_AWAITING_BEGIN) { @@ -1144,15 +1119,24 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryReplay(ti, dev, listener->listener); } - /* If we've just removed the last grab and the touch has physically - * ended, send a TouchEnd event too and finalise the touch. */ - if (ti->num_listeners == 1 && ti->num_grabs == 0 && ti->pending_finish) { - EmitTouchEnd(dev, ti, 0, 0); - TouchEndTouch(dev, ti); - return; + /* New owner has Begin/Update but not end. If touch is pending_finish, + * emulate the TouchEnd now */ + if (ti->pending_finish) { + TouchEmitTouchEnd(dev, ti, 0, 0); + + /* If the last owner is not a touch grab, finalise the touch, we + won't get more correspondence on this. + */ + if (ti->num_listeners == 1 && + (ti->num_grabs == 0 || + listener->grab->grabtype != XI2 || + !xi2mask_isset(listener->grab->xi2mask, dev, XI_TouchBegin))) { + TouchEndTouch(dev, ti); + return; + } } - if (listener->state == LISTENER_EARLY_ACCEPT) + if (accepted_early) ActivateEarlyAccept(dev, ti); } @@ -1196,7 +1180,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, for (i = 0; i < ti->num_listeners; i++) { if (ti->listeners[i].listener == resource) { if (ti->listeners[i].state != LISTENER_HAS_END) - EmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource); + TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource); break; } } @@ -1223,9 +1207,16 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, * touchpoint if it is pending finish. */ static void -ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, - TouchOwnershipEvent *ev) +ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev, + DeviceIntPtr dev) { + TouchPointInfoPtr ti = TouchFindByClientID(dev, ev->touchid); + + if (!ti) { + DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n", + dev->name, ev->type, ev->touchid); + return; + } if (ev->reason == XIRejectTouch) TouchRejected(dev, ti, ev->resource, ev); @@ -1236,12 +1227,12 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, * already seen the end. This ensures that the touch record is ended in * the server. */ if (ti->listeners[0].state == LISTENER_HAS_END) - EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener); + TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener); /* The touch owner has accepted the touch. Send TouchEnd events to * everyone else, and truncate the list of listeners. */ for (i = 1; i < ti->num_listeners; i++) - EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[i].listener); + TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[i].listener); while (ti->num_listeners > 1) TouchRemoveListener(ti, ti->listeners[1].listener); @@ -1410,7 +1401,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, } if (!deliveries) - DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype); + deliveries = DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype); /* We must accept the touch sequence once a pointer listener has * received one event past ButtonPress. */ @@ -1418,8 +1409,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, !(ev->device_event.flags & TOUCH_CLIENT_ID)) TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch); - if (ev->any.type == ET_TouchEnd && - !(ev->device_event.flags & TOUCH_CLIENT_ID) && + if (deliveries && ev->any.type == ET_TouchEnd && !dev->button->buttonsDown && dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) { (*dev->deviceGrab.DeactivateGrab) (dev); @@ -1438,8 +1428,11 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, */ if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) { TouchListener *l; + GrabPtr g; devgrab = dev->deviceGrab.grab; + g = AllocGrab(devgrab); + BUG_WARN(!g); *dev->deviceGrab.sync.event = ev->device_event; @@ -1448,8 +1441,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, * event selection. Thus, we update the last listener in the array. */ l = &ti->listeners[ti->num_listeners - 1]; - l->listener = devgrab->resource; - l->grab = devgrab; + l->listener = g->resource; + l->grab = g; //l->resource_type = RT_NONE; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) @@ -1538,12 +1531,9 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) if (!t) return; - if (ev->any.type == ET_TouchOwnership) - touchid = ev->touch_ownership_event.touchid; - else - touchid = ev->device_event.touchid; + touchid = ev->device_event.touchid; - if (type == ET_TouchBegin) { + if (type == ET_TouchBegin && !(ev->device_event.flags & TOUCH_REPLAYING)) { ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid, emulate_pointer); } @@ -1610,23 +1600,19 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) * called after event type mutation. Touch end events are always processed * in order to end touch records. */ /* FIXME: check this */ - if ((type == ET_TouchBegin && !TouchBuildSprite(dev, ti, ev)) || + if ((type == ET_TouchBegin && + !(ev->device_event.flags & TOUCH_REPLAYING) && + !TouchBuildSprite(dev, ti, ev)) || (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0)) return; - /* TouchOwnership events are handled separately from the rest, as they - * have more complex semantics. */ - if (ev->any.type == ET_TouchOwnership) - ProcessTouchOwnershipEvent(dev, ti, &ev->touch_ownership_event); - else { - TouchCopyValuatorData(&ev->device_event, ti); - /* WARNING: the event type may change to TouchUpdate in - * DeliverTouchEvents if a TouchEnd was delivered to a grabbing - * owner */ - DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0); - if (ev->any.type == ET_TouchEnd) - TouchEndTouch(dev, ti); - } + TouchCopyValuatorData(&ev->device_event, ti); + /* WARNING: the event type may change to TouchUpdate in + * DeliverTouchEvents if a TouchEnd was delivered to a grabbing + * owner */ + DeliverTouchEvents(dev, ti, ev, ev->device_event.resource); + if (ev->any.type == ET_TouchEnd) + TouchEndTouch(dev, ti); if (emulate_pointer) UpdateDeviceState(dev, &ev->device_event); @@ -1820,10 +1806,14 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) break; case ET_TouchBegin: case ET_TouchUpdate: - case ET_TouchOwnership: case ET_TouchEnd: ProcessTouchEvent(ev, device); break; + case ET_TouchOwnership: + /* TouchOwnership events are handled separately from the rest, as they + * have more complex semantics. */ + ProcessTouchOwnershipEvent(&ev->touch_ownership_event, device); + break; case ET_BarrierHit: case ET_BarrierLeave: ProcessBarrierEvent(ev, device); @@ -1848,6 +1838,14 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, listener->type == LISTENER_POINTER_GRAB) { rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab, xi2mask); + if (rc == Success) { + listener->state = LISTENER_IS_OWNER; + /* async grabs cannot replay, so automatically accept this touch */ + if (dev->deviceGrab.grab && + dev->deviceGrab.fromPassiveGrab && + dev->deviceGrab.grab->pointerMode == GrabModeAsync) + ActivateEarlyAccept(dev, ti); + } goto out; } @@ -1865,7 +1863,7 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, if (has_ownershipmask) TouchSendOwnershipEvent(dev, ti, 0, listener->listener); - if (!has_ownershipmask || listener->type == LISTENER_REGULAR) + if (listener->type == LISTENER_REGULAR) state = LISTENER_HAS_ACCEPTED; else state = LISTENER_IS_OWNER; @@ -1888,13 +1886,13 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev, rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab, xi2mask); - if (ti->num_listeners > 1) { - ev->any.type = ET_TouchUpdate; - ev->device_event.flags |= TOUCH_PENDING_END; - if (!(ev->device_event.flags & TOUCH_CLIENT_ID)) - ti->pending_finish = TRUE; - } - + /* Once we send a TouchEnd to a legacy listener, we're already well + * past the accepting/rejecting stage (can only happen on + * GrabModeSync + replay. This listener now gets the end event, + * and we can continue. + */ + if (rc == Success) + listener->state = LISTENER_HAS_END; goto out; } @@ -1920,7 +1918,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev, rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev); if ((ti->num_listeners > 1 || - listener->state != LISTENER_HAS_ACCEPTED) && + (ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) && (ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) { ev->any.type = ET_TouchUpdate; ev->device_event.flags |= TOUCH_PENDING_END; @@ -2021,6 +2019,9 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev) { ProximityClassPtr proxc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->proximity != NULL, FALSE); + proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec)); if (!proxc) return FALSE; @@ -2046,10 +2047,10 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, { AxisInfoPtr ax; - if (!dev || !dev->valuator || (minval > maxval && mode == Absolute)) - return FALSE; - if (axnum >= dev->valuator->numAxes) - return FALSE; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->valuator == NULL, FALSE); + BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE); + BUG_RETURN_VAL(minval > maxval && mode == Absolute, FALSE); ax = dev->valuator->axes + axnum; @@ -2079,8 +2080,9 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, InternalEvent dce; DeviceIntPtr master; - if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes) - return FALSE; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->valuator == NULL, FALSE); + BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE); switch (type) { case SCROLL_TYPE_VERTICAL: @@ -2220,8 +2222,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, } /** - * Grab the given key. If grabtype is XI, the key is a keycode. If - * grabtype is XI2, the key is a keysym. + * Grab the given key. */ int GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, @@ -2845,7 +2846,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, (deliveryMask & DeviceButtonGrabMask)) { GrabPtr tempGrab; - tempGrab = AllocGrab(); + tempGrab = AllocGrab(NULL); if (!tempGrab) return; diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c index 619d0e468..a49a42152 100644 --- a/xorg-server/Xi/extinit.c +++ b/xorg-server/Xi/extinit.c @@ -848,24 +848,24 @@ SBarrierEvent(xXIBarrierEvent * from, *to = *from; - swaps(&from->sequenceNumber); - swapl(&from->length); - swaps(&from->evtype); - swapl(&from->time); - swaps(&from->deviceid); - swaps(&from->sourceid); - swapl(&from->event); - swapl(&from->root); - swapl(&from->root_x); - swapl(&from->root_y); - - swapl(&from->dx.integral); - swapl(&from->dx.frac); - swapl(&from->dy.integral); - swapl(&from->dy.frac); - swapl(&from->dtime); - swapl(&from->barrier); - swapl(&from->eventid); + swaps(&to->sequenceNumber); + swapl(&to->length); + swaps(&to->evtype); + swapl(&to->time); + swaps(&to->deviceid); + swaps(&to->sourceid); + swapl(&to->event); + swapl(&to->root); + swapl(&to->root_x); + swapl(&to->root_y); + + swapl(&to->dx.integral); + swapl(&to->dx.frac); + swapl(&to->dy.integral); + swapl(&to->dy.frac); + swapl(&to->dtime); + swapl(&to->barrier); + swapl(&to->eventid); } /** Event swapping function for XI2 events. */ @@ -1171,6 +1171,8 @@ IResetProc(ExtensionEntry * unused) free(xi_all_devices.name); free(xi_all_master_devices.name); + + XIBarrierReset(); } /*********************************************************************** diff --git a/xorg-server/Xi/setdval.c b/xorg-server/Xi/setdval.c index 4c9c99f55..463e4f38c 100644 --- a/xorg-server/Xi/setdval.c +++ b/xorg-server/Xi/setdval.c @@ -110,6 +110,9 @@ ProcXSetDeviceValuators(ClientPtr client) if (dev->valuator == NULL) return BadMatch; + if (IsXTestDevice(dev, NULL)) + return BadMatch; + if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) return BadValue; diff --git a/xorg-server/Xi/setmode.c b/xorg-server/Xi/setmode.c index 535655257..5ed09136e 100644 --- a/xorg-server/Xi/setmode.c +++ b/xorg-server/Xi/setmode.c @@ -104,6 +104,10 @@ ProcXSetDeviceMode(ClientPtr client) return rc; if (dev->valuator == NULL) return BadMatch; + + if (IsXTestDevice(dev, NULL)) + return BadMatch; + if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) rep.status = AlreadyGrabbed; else diff --git a/xorg-server/Xi/ungrdevb.c b/xorg-server/Xi/ungrdevb.c index c4632fadc..b02510ea0 100644 --- a/xorg-server/Xi/ungrdevb.c +++ b/xorg-server/Xi/ungrdevb.c @@ -127,7 +127,7 @@ ProcXUngrabDeviceButton(ClientPtr client) (stuff->modifiers & ~AllModifiersMask)) return BadValue; - temporaryGrab = AllocGrab(); + temporaryGrab = AllocGrab(NULL); if (!temporaryGrab) return BadAlloc; diff --git a/xorg-server/Xi/ungrdevk.c b/xorg-server/Xi/ungrdevk.c index 3273878d3..f98117168 100644 --- a/xorg-server/Xi/ungrdevk.c +++ b/xorg-server/Xi/ungrdevk.c @@ -134,7 +134,7 @@ ProcXUngrabDeviceKey(ClientPtr client) (stuff->modifiers & ~AllModifiersMask)) return BadValue; - temporaryGrab = AllocGrab(); + temporaryGrab = AllocGrab(NULL); if (!temporaryGrab) return BadAlloc; diff --git a/xorg-server/Xi/xibarriers.c b/xorg-server/Xi/xibarriers.c index fccab8615..6732ce9dc 100644 --- a/xorg-server/Xi/xibarriers.c +++ b/xorg-server/Xi/xibarriers.c @@ -917,3 +917,15 @@ XIBarrierInit(void) return PointerBarrierType; } + +void +XIBarrierReset(void) +{ + int i; + for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; + BarrierScreenPtr cs = GetBarrierScreen(pScreen); + free(cs); + SetBarrierScreen(pScreen, NULL); + } +} diff --git a/xorg-server/Xi/xibarriers.h b/xorg-server/Xi/xibarriers.h index 11e84ec9f..f61b48214 100644 --- a/xorg-server/Xi/xibarriers.h +++ b/xorg-server/Xi/xibarriers.h @@ -36,8 +36,8 @@ int XIDestroyPointerBarrier(ClientPtr client, xXFixesDestroyPointerBarrierReq * stuff); -Bool -XIBarrierInit(void); +Bool XIBarrierInit(void); +void XIBarrierReset(void); int SProcXIBarrierReleasePointer(ClientPtr client); int ProcXIBarrierReleasePointer(ClientPtr client); diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c index 09186e84f..63d95bc1c 100644 --- a/xorg-server/Xi/xigrabdev.c +++ b/xorg-server/Xi/xigrabdev.c @@ -67,6 +67,8 @@ ProcXIGrabDevice(ClientPtr client) uint8_t status; GrabMask mask = { 0 }; int mask_len; + unsigned int keyboard_mode; + unsigned int pointer_mode; REQUEST(xXIGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq); @@ -78,6 +80,15 @@ ProcXIGrabDevice(ClientPtr client) if (!IsMaster(dev)) stuff->paired_device_mode = GrabModeAsync; + if (IsKeyboardDevice(dev)) { + keyboard_mode = stuff->grab_mode; + pointer_mode = stuff->paired_device_mode; + } + else { + keyboard_mode = stuff->paired_device_mode; + pointer_mode = stuff->grab_mode; + } + if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1], stuff->mask_len * 4) != Success) return BadValue; @@ -91,8 +102,8 @@ ProcXIGrabDevice(ClientPtr client) xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1], mask_len); - ret = GrabDevice(client, dev, stuff->grab_mode, - stuff->paired_device_mode, + ret = GrabDevice(client, dev, pointer_mode, + keyboard_mode, stuff->grab_window, stuff->owner_events, stuff->time, diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c index 62a3a469f..eccec0ab8 100644 --- a/xorg-server/Xi/xipassivegrab.c +++ b/xorg-server/Xi/xipassivegrab.c @@ -307,7 +307,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client) mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD); - tempGrab = AllocGrab(); + tempGrab = AllocGrab(NULL); if (!tempGrab) return BadAlloc; -- cgit v1.2.3