diff --git a/Xi/exevents.c b/Xi/exevents.c index 128414d6b..f2ec099f5 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2928,7 +2928,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, /* If the input focus is PointerRootWin, send the event to where * the pointer is if possible, then perhaps propagate up to root. */ if (inputFocus == PointerRootWin) - inputFocus = GetCurrentRootWindow(d); + inputFocus = InputDevCurrentRootWindow(d); if (IsParent(inputFocus, spriteWin)) { effectiveFocus = inputFocus; diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index 19eb8cad1..cafe823dc 100644 --- a/Xi/xiquerypointer.c +++ b/Xi/xiquerypointer.c @@ -131,7 +131,7 @@ ProcXIQueryPointer(ClientPtr client) .RepType = X_XIQueryPointer, .sequenceNumber = client->sequence, .length = 6, - .root = (GetCurrentRootWindow(pDev))->drawable.id, + .root = (InputDevCurrentRootWindow(pDev))->drawable.id, .root_x = double_to_fp1616(pSprite->hot.x), .root_y = double_to_fp1616(pSprite->hot.y), .child = None diff --git a/dix/devices.c b/dix/devices.c index e5507e3df..30a86a380 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2692,7 +2692,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) WindowPtr currentRoot; if (dev->spriteInfo->sprite) - currentRoot = GetCurrentRootWindow(dev); + currentRoot = InputDevCurrentRootWindow(dev); else /* new device auto-set to floating */ currentRoot = screenInfo.screens[0]->root; diff --git a/dix/enterleave.c b/dix/enterleave.c index 5432ddc74..2e634dac8 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -1444,7 +1444,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, sprite->win); DeviceFocusOutEvents(dev, sprite->win, - GetCurrentRootWindow(dev), mode, + InputDevCurrentRootWindow(dev), mode, NotifyPointer); } /* Notify all the roots */ @@ -1469,7 +1469,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root); if (to == PointerRootWin) { - DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, + DeviceFocusInEvents(dev, InputDevCurrentRootWindow(dev), sprite->win, mode, NotifyPointer); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win); } @@ -1480,14 +1480,14 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, sprite->win); DeviceFocusOutEvents(dev, sprite->win, - GetCurrentRootWindow(dev), mode, + InputDevCurrentRootWindow(dev), mode, NotifyPointer); } for (i = 0; i < nscreens; i++) DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); if (to->parent != NullWindow) - DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode, + DeviceFocusInEvents(dev, InputDevCurrentRootWindow(dev), to, mode, NotifyNonlinearVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); if (IsParent(to, sprite->win)) diff --git a/dix/events.c b/dix/events.c index b9378691b..c462d8e31 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1020,7 +1020,7 @@ PostNewCursor(DeviceIntPtr pDev) * @return root window where dev's sprite is located */ WindowPtr -GetCurrentRootWindow(DeviceIntPtr dev) +InputDevCurrentRootWindow(DeviceIntPtr dev) { return RootWindow(dev->spriteInfo->sprite); } @@ -1163,9 +1163,9 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) * must be valid. At this point, it hasn't been filled in yet, so * we do it here. The long expression below is necessary to get * the current root window; the apparently reasonable alternative - * GetCurrentRootWindow()->drawable.id doesn't give you the right + * InputDevCurrentRootWindow()->drawable.id doesn't give you the right * answer on the first motion event after a screen change because - * the data that GetCurrentRootWindow relies on hasn't been + * the data that InputDevCurrentRootWindow relies on hasn't been * updated yet. */ if (ev->any.type == ET_Motion) @@ -1704,7 +1704,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) DoEnterLeaveEvents(mouse, mouse->id, grab->window, mouse->spriteInfo->sprite->win, NotifyUngrab); if (grab->confineTo) - ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); + ConfineCursorToWindow(mouse, InputDevCurrentRootWindow(mouse), FALSE, FALSE); PostNewCursor(mouse); if (!wasImplicit && grab->grabtype == XI2) @@ -5035,7 +5035,7 @@ ProcGrabPointer(ClientPtr client) grab = device->deviceGrab.grab; if (grab && grab->confineTo && !confineTo) - ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, FALSE); + ConfineCursorToWindow(device, InputDevCurrentRootWindow(device), FALSE, FALSE); mask.core = stuff->eventMask; @@ -5361,7 +5361,7 @@ ProcQueryPointer(ClientPtr client) .sequenceNumber = client->sequence, .length = 0, .mask = event_get_corestate(mouse, keyboard), - .root = (GetCurrentRootWindow(mouse))->drawable.id, + .root = (InputDevCurrentRootWindow(mouse))->drawable.id, .rootX = pSprite->hot.x, .rootY = pSprite->hot.y, .child = None @@ -5528,7 +5528,7 @@ ProcSendEvent(ClientPtr client) /* If the input focus is PointerRootWin, send the event to where the pointer is if possible, then perhaps propagate up to root. */ if (inputFocus == PointerRootWin) - inputFocus = GetCurrentRootWindow(dev); + inputFocus = InputDevCurrentRootWindow(dev); if (IsParent(inputFocus, pSprite->win)) { effectiveFocus = inputFocus; diff --git a/dix/input_priv.h b/dix/input_priv.h index d63f1ddb3..3ae0cb640 100644 --- a/dix/input_priv.h +++ b/dix/input_priv.h @@ -385,4 +385,13 @@ CursorPtr InputDevGetSpriteCursor(DeviceIntPtr pDev) void ConfineToShape(RegionPtr region, int *px, int *py) _X_ATTRIBUTE_NONNULL_ARG(1,2,3); +/* + * @brief get root window the input device is currently on + * + * @param pDev pointer to input device structure + * @return pointer to current root window + */ +WindowPtr InputDevCurrentRootWindow(DeviceIntPtr pDev) + _X_ATTRIBUTE_NONNULL_ARG(1); + #endif /* _XSERVER_INPUT_PRIV_H */ diff --git a/include/dix.h b/include/dix.h index d9cf17723..7964371e3 100644 --- a/include/dix.h +++ b/include/dix.h @@ -235,9 +235,6 @@ extern _X_EXPORT Bool IsParent(WindowPtr /* maybeparent */ , WindowPtr /* child */ ); -extern _X_EXPORT WindowPtr -GetCurrentRootWindow(DeviceIntPtr pDev); - extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); diff --git a/randr/rrpointer.c b/randr/rrpointer.c index bd394530a..79fa16347 100644 --- a/randr/rrpointer.c +++ b/randr/rrpointer.c @@ -22,6 +22,7 @@ #include #include "dix/cursor_priv.h" +#include "dix/input_priv.h" #include "randrstr.h" #include "inputstr.h" @@ -145,7 +146,7 @@ RRPointerScreenConfigured(ScreenPtr pScreen) for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (IsPointerDevice(pDev)) { - pRoot = GetCurrentRootWindow(pDev); + pRoot = InputDevCurrentRootWindow(pDev); pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL; if (pScreen == pCurrentScreen) {