dix: unexport, document and rename GetCurrentRootWindow()

Not used by any drivers, so no need to keep it exported.
Also spending it for a better fitter name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-23 15:07:02 +02:00
parent 9e93d51e41
commit 32a0109615
8 changed files with 25 additions and 18 deletions

View File

@ -2928,7 +2928,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
/* If the input focus is PointerRootWin, send the event to where /* If the input focus is PointerRootWin, send the event to where
* the pointer is if possible, then perhaps propagate up to root. */ * the pointer is if possible, then perhaps propagate up to root. */
if (inputFocus == PointerRootWin) if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(d); inputFocus = InputDevCurrentRootWindow(d);
if (IsParent(inputFocus, spriteWin)) { if (IsParent(inputFocus, spriteWin)) {
effectiveFocus = inputFocus; effectiveFocus = inputFocus;

View File

@ -131,7 +131,7 @@ ProcXIQueryPointer(ClientPtr client)
.RepType = X_XIQueryPointer, .RepType = X_XIQueryPointer,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 6, .length = 6,
.root = (GetCurrentRootWindow(pDev))->drawable.id, .root = (InputDevCurrentRootWindow(pDev))->drawable.id,
.root_x = double_to_fp1616(pSprite->hot.x), .root_x = double_to_fp1616(pSprite->hot.x),
.root_y = double_to_fp1616(pSprite->hot.y), .root_y = double_to_fp1616(pSprite->hot.y),
.child = None .child = None

View File

@ -2692,7 +2692,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
WindowPtr currentRoot; WindowPtr currentRoot;
if (dev->spriteInfo->sprite) if (dev->spriteInfo->sprite)
currentRoot = GetCurrentRootWindow(dev); currentRoot = InputDevCurrentRootWindow(dev);
else /* new device auto-set to floating */ else /* new device auto-set to floating */
currentRoot = screenInfo.screens[0]->root; currentRoot = screenInfo.screens[0]->root;

View File

@ -1444,7 +1444,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win); sprite->win);
DeviceFocusOutEvents(dev, sprite->win, DeviceFocusOutEvents(dev, sprite->win,
GetCurrentRootWindow(dev), mode, InputDevCurrentRootWindow(dev), mode,
NotifyPointer); NotifyPointer);
} }
/* Notify all the roots */ /* Notify all the roots */
@ -1469,7 +1469,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
DeviceFocusEvent(dev, XI_FocusIn, mode, in, DeviceFocusEvent(dev, XI_FocusIn, mode, in,
screenInfo.screens[i]->root); screenInfo.screens[i]->root);
if (to == PointerRootWin) { if (to == PointerRootWin) {
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, DeviceFocusInEvents(dev, InputDevCurrentRootWindow(dev), sprite->win,
mode, NotifyPointer); mode, NotifyPointer);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win); 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, DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win); sprite->win);
DeviceFocusOutEvents(dev, sprite->win, DeviceFocusOutEvents(dev, sprite->win,
GetCurrentRootWindow(dev), mode, InputDevCurrentRootWindow(dev), mode,
NotifyPointer); NotifyPointer);
} }
for (i = 0; i < nscreens; i++) for (i = 0; i < nscreens; i++)
DeviceFocusEvent(dev, XI_FocusOut, mode, out, DeviceFocusEvent(dev, XI_FocusOut, mode, out,
screenInfo.screens[i]->root); screenInfo.screens[i]->root);
if (to->parent != NullWindow) if (to->parent != NullWindow)
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode, DeviceFocusInEvents(dev, InputDevCurrentRootWindow(dev), to, mode,
NotifyNonlinearVirtual); NotifyNonlinearVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
if (IsParent(to, sprite->win)) if (IsParent(to, sprite->win))

View File

@ -1020,7 +1020,7 @@ PostNewCursor(DeviceIntPtr pDev)
* @return root window where dev's sprite is located * @return root window where dev's sprite is located
*/ */
WindowPtr WindowPtr
GetCurrentRootWindow(DeviceIntPtr dev) InputDevCurrentRootWindow(DeviceIntPtr dev)
{ {
return RootWindow(dev->spriteInfo->sprite); 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 * 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 * we do it here. The long expression below is necessary to get
* the current root window; the apparently reasonable alternative * 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 * 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. * updated yet.
*/ */
if (ev->any.type == ET_Motion) if (ev->any.type == ET_Motion)
@ -1704,7 +1704,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
DoEnterLeaveEvents(mouse, mouse->id, grab->window, DoEnterLeaveEvents(mouse, mouse->id, grab->window,
mouse->spriteInfo->sprite->win, NotifyUngrab); mouse->spriteInfo->sprite->win, NotifyUngrab);
if (grab->confineTo) if (grab->confineTo)
ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); ConfineCursorToWindow(mouse, InputDevCurrentRootWindow(mouse), FALSE, FALSE);
PostNewCursor(mouse); PostNewCursor(mouse);
if (!wasImplicit && grab->grabtype == XI2) if (!wasImplicit && grab->grabtype == XI2)
@ -5035,7 +5035,7 @@ ProcGrabPointer(ClientPtr client)
grab = device->deviceGrab.grab; grab = device->deviceGrab.grab;
if (grab && grab->confineTo && !confineTo) if (grab && grab->confineTo && !confineTo)
ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, FALSE); ConfineCursorToWindow(device, InputDevCurrentRootWindow(device), FALSE, FALSE);
mask.core = stuff->eventMask; mask.core = stuff->eventMask;
@ -5361,7 +5361,7 @@ ProcQueryPointer(ClientPtr client)
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0, .length = 0,
.mask = event_get_corestate(mouse, keyboard), .mask = event_get_corestate(mouse, keyboard),
.root = (GetCurrentRootWindow(mouse))->drawable.id, .root = (InputDevCurrentRootWindow(mouse))->drawable.id,
.rootX = pSprite->hot.x, .rootX = pSprite->hot.x,
.rootY = pSprite->hot.y, .rootY = pSprite->hot.y,
.child = None .child = None
@ -5528,7 +5528,7 @@ ProcSendEvent(ClientPtr client)
/* If the input focus is PointerRootWin, send the event to where /* If the input focus is PointerRootWin, send the event to where
the pointer is if possible, then perhaps propagate up to root. */ the pointer is if possible, then perhaps propagate up to root. */
if (inputFocus == PointerRootWin) if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(dev); inputFocus = InputDevCurrentRootWindow(dev);
if (IsParent(inputFocus, pSprite->win)) { if (IsParent(inputFocus, pSprite->win)) {
effectiveFocus = inputFocus; effectiveFocus = inputFocus;

View File

@ -385,4 +385,13 @@ CursorPtr InputDevGetSpriteCursor(DeviceIntPtr pDev)
void ConfineToShape(RegionPtr region, int *px, int *py) void ConfineToShape(RegionPtr region, int *px, int *py)
_X_ATTRIBUTE_NONNULL_ARG(1,2,3); _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 */ #endif /* _XSERVER_INPUT_PRIV_H */

View File

@ -235,9 +235,6 @@ extern _X_EXPORT Bool
IsParent(WindowPtr /* maybeparent */ , IsParent(WindowPtr /* maybeparent */ ,
WindowPtr /* child */ ); WindowPtr /* child */ );
extern _X_EXPORT WindowPtr
GetCurrentRootWindow(DeviceIntPtr pDev);
extern _X_EXPORT WindowPtr extern _X_EXPORT WindowPtr
GetSpriteWindow(DeviceIntPtr pDev); GetSpriteWindow(DeviceIntPtr pDev);

View File

@ -22,6 +22,7 @@
#include <dix-config.h> #include <dix-config.h>
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "dix/input_priv.h"
#include "randrstr.h" #include "randrstr.h"
#include "inputstr.h" #include "inputstr.h"
@ -145,7 +146,7 @@ RRPointerScreenConfigured(ScreenPtr pScreen)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (IsPointerDevice(pDev)) { if (IsPointerDevice(pDev)) {
pRoot = GetCurrentRootWindow(pDev); pRoot = InputDevCurrentRootWindow(pDev);
pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL; pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL;
if (pScreen == pCurrentScreen) { if (pScreen == pCurrentScreen) {