From c643c2b7bf480f5c27ff8606bda087f8bff3b154 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 1 Nov 2011 12:17:50 +1000 Subject: xfree86: duplicate name and driver from pInfo for NewInputDeviceRequest xorg.conf devices had the name and driver set in the DDX's InputInfoPtr list but not in the option list for those devices. That information was lost when passing the options into NewInputDeviceRequest. NIDR then refused to start the devices. Introduced in xorg-server-1.11.0-250-ge4cd24e Signed-off-by: Peter Hutterer Tested-by: James Cloos --- hw/xfree86/common/xf86Init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index a0fdf29ad..c1e48eed2 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -827,6 +827,8 @@ InitInput(int argc, char **argv) /* Initialize all configured input devices */ for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) { + (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "driver", (*pInfo)->driver); + (*pInfo)->options = xf86AddNewOption((*pInfo)->options, "identifier", (*pInfo)->name); /* If one fails, the others will too */ if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc) break; -- cgit v1.2.3 From 22715e465b415b3351b83b8279a4f44157f63199 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 27 Oct 2011 11:03:39 +1000 Subject: Xi: allow passive keygrabs on the XIAll(Master)Devices fake devices They don't have a KeyClassRec, but we must still allow passive grabs on them. Signed-off-by: Peter Hutterer Tested-by: Bastien Nocera Reviewed-by: Daniel Stone --- Xi/exevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 053c76f22..edf2c393f 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1495,7 +1495,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, rc = CheckGrabValues(client, param); if (rc != Success) return rc; - if (k == NULL) + if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL) return BadMatch; if (grabtype == GRABTYPE_XI) { -- cgit v1.2.3 From 11840595a1be9f2df7390bcc708cc176e60d3ef2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 3 Nov 2011 08:58:58 +1000 Subject: dix: Don't let a driver without a ProximityClassRec post events Signed-off-by: Peter Hutterer Reviewed-by: Jeremy Huddleston --- dix/getevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/getevents.c b/dix/getevents.c index df47b2b95..8798f6418 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1546,7 +1546,7 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const Val /* Sanity checks. */ if ((type != ProximityIn && type != ProximityOut) || !mask_in) return 0; - if (!pDev->valuator) + if (!pDev->valuator || !pDev->proximity) return 0; valuator_mask_copy(&mask, mask_in); -- cgit v1.2.3 From fc16917ad6f0d2722bfb5c5eeca955dd3bc4125a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 15 Apr 2011 13:32:10 +1000 Subject: include: export GetProximityEvents and QueueProximityEvents This is mainly needed for consistency with GetPointerEvents and friend. No-one seems to actually need this function from outside the usual DDXs. Signed-off-by: Peter Hutterer Reviewed-by: Jeremy Huddleston --- include/input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/input.h b/include/input.h index 5dd5c1bcf..9ef726f4e 100644 --- a/include/input.h +++ b/include/input.h @@ -463,13 +463,13 @@ extern _X_EXPORT void QueueKeyboardEvents( int key_code, const ValuatorMask *mask); -extern int GetProximityEvents( +extern _X_EXPORT int GetProximityEvents( InternalEvent *events, DeviceIntPtr pDev, int type, const ValuatorMask *mask); -extern void QueueProximityEvents( +extern _X_EXPORT void QueueProximityEvents( DeviceIntPtr pDev, int type, const ValuatorMask *mask); -- cgit v1.2.3 From 35ec24cf245e5ef676e98a0bf7c77296a3f1ff63 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 1 Aug 2011 14:14:02 +1000 Subject: input: replace remaining GetPairedDevice() with GetMaster() Wherever it's obvious which device we need (keyboard or pointer), use GetMaster() instead of GetPairedDevice(). It is more reliable in actually getting the device type we want. Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone --- Xi/exevents.c | 6 +++--- Xi/xiquerypointer.c | 2 +- dix/enterleave.c | 10 +++++----- dix/events.c | 23 ++++++++--------------- hw/xfree86/common/xf86DGA.c | 2 +- hw/xfree86/common/xf86Xinput.c | 2 +- xkb/xkbActions.c | 2 +- 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index edf2c393f..53db03629 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -104,7 +104,7 @@ int XIShouldNotify(ClientPtr client, DeviceIntPtr dev) { DeviceIntPtr current_ptr = PickPointer(client); - DeviceIntPtr current_kbd = GetPairedDevice(current_ptr); + DeviceIntPtr current_kbd = GetMaster(current_ptr, KEYBOARD_OR_FLOAT); if (dev == current_kbd || dev == current_ptr) return 1; @@ -903,13 +903,13 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) if (IsPointerDevice(device)) { - kbd = GetPairedDevice(device); + kbd = GetMaster(device, KEYBOARD_OR_FLOAT); mouse = device; if (!kbd->key) /* can happen with floating SDs */ kbd = NULL; } else { - mouse = GetPairedDevice(device); + mouse = GetMaster(device, POINTER_OR_FLOAT); kbd = device; if (!mouse->valuator || !mouse->button) /* may be float. SDs */ mouse = NULL; diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index 9e05eff30..d01a81394 100644 --- a/Xi/xiquerypointer.c +++ b/Xi/xiquerypointer.c @@ -109,7 +109,7 @@ ProcXIQueryPointer(ClientPtr client) MaybeStopHint(pDev, client); if (IsMaster(pDev)) - kbd = GetPairedDevice(pDev); + kbd = GetMaster(pDev, MASTER_KEYBOARD); else kbd = (pDev->key) ? pDev : NULL; diff --git a/dix/enterleave.c b/dix/enterleave.c index b1ee3fb32..a39e64001 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -766,7 +766,7 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev, { WindowPtr P, stopAt; - P = PointerWin(GetPairedDevice(dev)); + P = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); if (!P) return; @@ -821,7 +821,7 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev, { WindowPtr P; - P = PointerWin(GetPairedDevice(dev)); + P = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); if (!P || P == exclude || (pwin_parent != P && !IsParent(pwin_parent, P))) return; @@ -1087,7 +1087,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { root = screenInfo.screens[i]->root; - if (!HasOtherPointer(root, GetPairedDevice(dev)) && !FirstFocusChild(root)) + if (!HasOtherPointer(root, GetMaster(dev, POINTER_OR_FLOAT)) && !FirstFocusChild(root)) { /* If pointer was on PointerRootWin and changes to NoneWin, and * the pointer paired with dev is below the current root window, @@ -1095,7 +1095,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, if (dev->focus && dev->focus->win == PointerRootWin && B != PointerRootWin) { - WindowPtr ptrwin = PointerWin(GetPairedDevice(dev)); + WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); if (ptrwin && IsParent(root, ptrwin)) CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE); } @@ -1187,7 +1187,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, if (dev->focus && dev->focus->win == PointerRootWin && B != PointerRootWin) { - WindowPtr ptrwin = PointerWin(GetPairedDevice(dev)); + WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); if (ptrwin) CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE); } diff --git a/dix/events.c b/dix/events.c index f87d2bbf9..5e0dc5f17 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3698,10 +3698,7 @@ CheckPassiveGrabsOnWindow( gdev= grab->modifierDevice; if (grab->grabtype == GRABTYPE_CORE) { - if (IsPointerDevice(device)) - gdev = GetPairedDevice(device); - else - gdev = device; + gdev = GetMaster(device, KEYBOARD_OR_FLOAT); } else if (grab->grabtype == GRABTYPE_XI2) { /* if the device is an attached slave device, gdev must be the @@ -4000,8 +3997,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) } /* just deliver it to the focus window */ - ptr = GetPairedDevice(keybd); - + ptr = GetMaster(keybd, POINTER_OR_FLOAT); rc = EventToXI2(event, &xi2); if (rc == Success) @@ -4501,7 +4497,7 @@ CoreEnterLeaveEvent( GrabPtr grab = mouse->deviceGrab.grab; Mask mask; - keybd = GetPairedDevice(mouse); + keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT); if ((pWin == mouse->valuator->motionHintWindow) && (detail != NotifyInferior)) @@ -4719,10 +4715,7 @@ SetInputFocus( } time = ClientTimeToServerTime(ctime); - if (IsKeyboardDevice(dev)) - keybd = dev; - else - keybd = GetPairedDevice(dev); + keybd = GetMaster(dev, KEYBOARD_OR_FLOAT); if ((focusID == None) || (focusID == PointerRoot)) focusWin = (WindowPtr)(long)focusID; @@ -5197,7 +5190,7 @@ ProcQueryPointer(ClientPtr client) if (rc != Success && rc != BadAccess) return rc; - keyboard = GetPairedDevice(mouse); + keyboard = GetMaster(mouse, MASTER_KEYBOARD); pSprite = mouse->spriteInfo->sprite; if (mouse->valuator->motionHintWindow) @@ -5321,7 +5314,7 @@ ProcSendEvent(ClientPtr client) WindowPtr pWin; WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ DeviceIntPtr dev = PickPointer(client); - DeviceIntPtr keybd = GetPairedDevice(dev); + DeviceIntPtr keybd = GetMaster(dev, MASTER_KEYBOARD); SpritePtr pSprite = dev->spriteInfo->sprite; REQUEST(xSendEventReq); @@ -5594,7 +5587,7 @@ ProcGrabButton(ClientPtr client) } ptr = PickPointer(client); - modifierDevice = GetPairedDevice(ptr); + modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); if (stuff->pointerMode == GrabModeSync || stuff->keyboardMode == GrabModeSync) access_mode |= DixFreezeAccess; @@ -5651,7 +5644,7 @@ ProcUngrabButton(ClientPtr client) tempGrab.window = pWin; tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.pMask = NULL; - tempGrab.modifierDevice = GetPairedDevice(ptr); + tempGrab.modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); tempGrab.type = ButtonPress; tempGrab.detail.exact = stuff->button; tempGrab.grabtype = GRABTYPE_CORE; diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 74eb739e4..46e3005fa 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1016,7 +1016,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd) { KeyClassPtr keyc = keybd->key; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - DeviceIntPtr pointer = GetPairedDevice(keybd); + DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT); DeviceEvent ev; memset(&ev, 0, sizeof(ev)); diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index c3ffc27d0..7feb48c1e 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -1275,7 +1275,7 @@ xf86PostKeyEventM(DeviceIntPtr device, DeviceIntPtr pointer; /* Some pointers send key events, paired device is wrong then. */ - pointer = IsPointerDevice(device) ? device : GetPairedDevice(device); + pointer = GetMaster(device, POINTER_OR_FLOAT); if (miPointerGetScreen(pointer)) { int index = miPointerGetScreen(pointer)->myNum; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 000002a45..1e94d261c 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1203,7 +1203,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); if (keyEvent) tmpdev = dev; else - tmpdev = GetPairedDevice(dev); + tmpdev = GetMaster(dev, POINTER_OR_FLOAT); UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc); dev->public.processInputProc((InternalEvent*)event, tmpdev); -- cgit v1.2.3 From bb4aa1f263ad38c175bfda3b7e6c325260ce3f28 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Nov 2011 15:31:10 +1000 Subject: Xext: don't swap CARD8 in SProcSELinuxQueryVersion xselinux_ext.c: In function 'SELinuxSendItemsToClient': xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable] xselinux_ext.c: In function 'SProcSELinuxQueryVersion': xselinux_ext.c:532:62: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap xselinux_ext.c:533:62: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap Signed-off-by: Peter Hutterer Reviewed-by: Julien Cristau --- Xext/xselinux_ext.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 56f2d1ff2..641368a5c 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -526,11 +526,6 @@ ProcSELinuxDispatch(ClientPtr client) static int SProcSELinuxQueryVersion(ClientPtr client) { - REQUEST(SELinuxQueryVersionReq); - - REQUEST_SIZE_MATCH(SELinuxQueryVersionReq); - swaps(&stuff->client_major); - swaps(&stuff->client_minor); return ProcSELinuxQueryVersion(client); } -- cgit v1.2.3 From e7cb8f802adf6fc22e7a930c0dfc5c1076781c96 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Nov 2011 15:31:57 +1000 Subject: Xext: remove unused variable 'n' xselinux_ext.c: In function 'SELinuxSendItemsToClient': xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable] Signed-off-by: Peter Hutterer Reviewed-by: Julien Cristau --- Xext/xselinux_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 641368a5c..a18a36706 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -337,7 +337,7 @@ static int SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, int size, int count) { - int rc, k, n, pos = 0; + int rc, k, pos = 0; SELinuxListItemsReply rep; CARD32 *buf; -- cgit v1.2.3