dix: rename IsParent() to WindowIsParent()

Spending it a more fitting 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 17:13:51 +02:00
parent abcd627d40
commit 6fc8b593a4
5 changed files with 39 additions and 39 deletions

View File

@ -2930,7 +2930,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
if (inputFocus == PointerRootWin) if (inputFocus == PointerRootWin)
inputFocus = InputDevCurrentRootWindow(d); inputFocus = InputDevCurrentRootWindow(d);
if (IsParent(inputFocus, spriteWin)) { if (WindowIsParent(inputFocus, spriteWin)) {
effectiveFocus = inputFocus; effectiveFocus = inputFocus;
pWin = spriteWin; pWin = spriteWin;
} }

View File

@ -551,7 +551,7 @@ int OtherClientGone(void *value, XID id);
* @param child the alleged child * @param child the alleged child
* @return TRUE if `child` is a child window of `parent` * @return TRUE if `child` is a child window of `parent`
*/ */
Bool IsParent(WindowPtr parent, WindowPtr child) Bool WindowIsParent(WindowPtr parent, WindowPtr child)
_X_ATTRIBUTE_NONNULL_ARG(1,2); _X_ATTRIBUTE_NONNULL_ARG(1,2);
#endif /* _XSERVER_DIX_PRIV_H */ #endif /* _XSERVER_DIX_PRIV_H */

View File

@ -144,7 +144,7 @@ FirstPointerChild(WindowPtr win)
int i; int i;
for (i = 0; i < MAXDEVICES; i++) { for (i = 0; i < MAXDEVICES; i++) {
if (PointerWindows[i] && IsParent(win, PointerWindows[i])) if (PointerWindows[i] && WindowIsParent(win, PointerWindows[i]))
return PointerWindows[i]; return PointerWindows[i];
} }
@ -165,7 +165,7 @@ FirstFocusChild(WindowPtr win)
for (i = 0; i < MAXDEVICES; i++) { for (i = 0; i < MAXDEVICES; i++) {
if (FocusWindows[i] && FocusWindows[i] != PointerRootWin && if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
IsParent(win, FocusWindows[i])) WindowIsParent(win, FocusWindows[i]))
return FocusWindows[i]; return FocusWindows[i];
} }
@ -219,7 +219,7 @@ static WindowPtr
CommonAncestor(WindowPtr a, WindowPtr b) CommonAncestor(WindowPtr a, WindowPtr b)
{ {
for (b = b->parent; b; b = b->parent) for (b = b->parent; b; b = b->parent)
if (IsParent(b, a)) if (WindowIsParent(b, a))
return b; return b;
return NullWindow; return NullWindow;
} }
@ -545,9 +545,9 @@ CoreEnterLeaveEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
LeaveWindow(dev); LeaveWindow(dev);
if (IsParent(from, to)) if (WindowIsParent(from, to))
CoreEnterLeaveToDescendant(dev, from, to, mode); CoreEnterLeaveToDescendant(dev, from, to, mode);
else if (IsParent(to, from)) else if (WindowIsParent(to, from))
CoreEnterLeaveToAncestor(dev, from, to, mode); CoreEnterLeaveToAncestor(dev, from, to, mode);
else else
CoreEnterLeaveNonLinear(dev, from, to, mode); CoreEnterLeaveNonLinear(dev, from, to, mode);
@ -559,14 +559,14 @@ static void
DeviceEnterLeaveEvents(DeviceIntPtr dev, DeviceEnterLeaveEvents(DeviceIntPtr dev,
int sourceid, WindowPtr from, WindowPtr to, int mode) int sourceid, WindowPtr from, WindowPtr to, int mode)
{ {
if (IsParent(from, to)) { if (WindowIsParent(from, to)) {
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior,
from, None); from, None);
DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual); DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to, DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to,
None); None);
} }
else if (IsParent(to, from)) { else if (WindowIsParent(to, from)) {
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor,
from, None); from, None);
DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual); DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
@ -966,12 +966,12 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
if (!P) if (!P)
return; return;
if (!IsParent(pwin_parent, P)) if (!WindowIsParent(pwin_parent, P))
if (!(pwin_parent == P && inclusive)) if (!(pwin_parent == P && inclusive))
return; return;
if (exclude != None && exclude != PointerRootWin && if (exclude != None && exclude != PointerRootWin &&
(IsParent(exclude, P) || IsParent(P, exclude))) (WindowIsParent(exclude, P) || WindowIsParent(P, exclude)))
return; return;
stopAt = (inclusive) ? pwin_parent->parent : pwin_parent; stopAt = (inclusive) ? pwin_parent->parent : pwin_parent;
@ -1013,10 +1013,10 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
P = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); P = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
if (!P || P == exclude || (pwin_parent != P && !IsParent(pwin_parent, P))) if (!P || P == exclude || (pwin_parent != P && !WindowIsParent(pwin_parent, P)))
return; return;
if (exclude != None && (IsParent(exclude, P) || IsParent(P, exclude))) if (exclude != None && (WindowIsParent(exclude, P) || WindowIsParent(P, exclude)))
return; return;
CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive); CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive);
@ -1268,7 +1268,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
B != PointerRootWin) { B != PointerRootWin) {
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
if (ptrwin && IsParent(root, ptrwin)) if (ptrwin && WindowIsParent(root, ptrwin))
CoreFocusOutNotifyPointerEvents(dev, root, None, mode, CoreFocusOutNotifyPointerEvents(dev, root, None, mode,
TRUE); TRUE);
} }
@ -1408,9 +1408,9 @@ CoreFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
CoreFocusToPointerRootOrNone(dev, from, to, mode); CoreFocusToPointerRootOrNone(dev, from, to, mode);
else if ((from == NullWindow) || (from == PointerRootWin)) else if ((from == NullWindow) || (from == PointerRootWin))
CoreFocusFromPointerRootOrNone(dev, from, to, mode); CoreFocusFromPointerRootOrNone(dev, from, to, mode);
else if (IsParent(from, to)) else if (WindowIsParent(from, to))
CoreFocusToDescendant(dev, from, to, mode); CoreFocusToDescendant(dev, from, to, mode);
else if (IsParent(to, from)) else if (WindowIsParent(to, from))
CoreFocusToAncestor(dev, from, to, mode); CoreFocusToAncestor(dev, from, to, mode);
else else
CoreFocusNonLinear(dev, from, to, mode); CoreFocusNonLinear(dev, from, to, mode);
@ -1453,7 +1453,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
screenInfo.screens[i]->root); screenInfo.screens[i]->root);
} }
else { else {
if (IsParent(from, sprite->win)) { if (WindowIsParent(from, sprite->win)) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win); sprite->win);
DeviceFocusOutEvents(dev, sprite->win, from, mode, DeviceFocusOutEvents(dev, sprite->win, from, mode,
@ -1490,26 +1490,26 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
DeviceFocusInEvents(dev, InputDevCurrentRootWindow(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 (WindowIsParent(to, sprite->win))
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer); DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
} }
else { else {
if (IsParent(to, from)) { if (WindowIsParent(to, from)) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from); DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual); DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
if ((IsParent(to, sprite->win)) && if ((WindowIsParent(to, sprite->win)) &&
(sprite->win != from) && (sprite->win != from) &&
(!IsParent(from, sprite->win)) && (!WindowIsParent(from, sprite->win)) &&
(!IsParent(sprite->win, from))) (!WindowIsParent(sprite->win, from)))
DeviceFocusInEvents(dev, to, sprite->win, mode, DeviceFocusInEvents(dev, to, sprite->win, mode,
NotifyPointer); NotifyPointer);
} }
else if (IsParent(from, to)) { else if (WindowIsParent(from, to)) {
if ((IsParent(from, sprite->win)) && if ((WindowIsParent(from, sprite->win)) &&
(sprite->win != from) && (sprite->win != from) &&
(!IsParent(to, sprite->win)) && (!WindowIsParent(to, sprite->win)) &&
(!IsParent(sprite->win, to))) { (!WindowIsParent(sprite->win, to))) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win); sprite->win);
DeviceFocusOutEvents(dev, sprite->win, from, mode, DeviceFocusOutEvents(dev, sprite->win, from, mode,
@ -1524,7 +1524,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
WindowPtr common = CommonAncestor(to, from); WindowPtr common = CommonAncestor(to, from);
/* common == NullWindow ==> different screens */ /* common == NullWindow ==> different screens */
if (IsParent(from, sprite->win)) if (WindowIsParent(from, sprite->win))
DeviceFocusOutEvents(dev, sprite->win, from, mode, DeviceFocusOutEvents(dev, sprite->win, from, mode,
NotifyPointer); NotifyPointer);
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from); DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
@ -1535,7 +1535,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
DeviceFocusInEvents(dev, common, to, mode, DeviceFocusInEvents(dev, common, to, mode,
NotifyNonlinearVirtual); NotifyNonlinearVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
if (IsParent(to, sprite->win)) if (WindowIsParent(to, sprite->win))
DeviceFocusInEvents(dev, to, sprite->win, mode, DeviceFocusInEvents(dev, to, sprite->win, mode,
NotifyPointer); NotifyPointer);
} }

View File

@ -967,7 +967,7 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
* @returns true if b is a descendent of a * @returns true if b is a descendent of a
*/ */
Bool Bool
IsParent(WindowPtr a, WindowPtr b) WindowIsParent(WindowPtr a, WindowPtr b)
{ {
for (b = b->parent; b; b = b->parent) for (b = b->parent; b; b = b->parent)
if (b == a) if (b == a)
@ -995,7 +995,7 @@ PostNewCursor(DeviceIntPtr pDev)
ChangeToCursor(pDev, grab->cursor); ChangeToCursor(pDev, grab->cursor);
return; return;
} }
if (IsParent(grab->window, pSprite->win)) if (WindowIsParent(grab->window, pSprite->win))
win = pSprite->win; win = pSprite->win;
else else
win = grab->window; win = grab->window;
@ -3066,7 +3066,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
if (!dev->deviceGrab.fromPassiveGrab || if (!dev->deviceGrab.fromPassiveGrab ||
dev->deviceGrab.grab->type != XI_FocusIn || dev->deviceGrab.grab->type != XI_FocusIn ||
dev->deviceGrab.grab->window == win || dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win)) WindowIsParent(dev->deviceGrab.grab->window, win))
return FALSE; return FALSE;
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
(*dev->deviceGrab.DeactivateGrab) (dev); (*dev->deviceGrab.DeactivateGrab) (dev);
@ -3107,7 +3107,7 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
if (!dev->deviceGrab.fromPassiveGrab || if (!dev->deviceGrab.fromPassiveGrab ||
dev->deviceGrab.grab->type != XI_Enter || dev->deviceGrab.grab->type != XI_Enter ||
dev->deviceGrab.grab->window == win || dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win)) WindowIsParent(dev->deviceGrab.grab->window, win))
return FALSE; return FALSE;
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
(*dev->deviceGrab.DeactivateGrab) (dev); (*dev->deviceGrab.DeactivateGrab) (dev);
@ -4208,7 +4208,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd); DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd);
return; return;
} }
if ((focus == window) || IsParent(focus, window)) { if ((focus == window) || WindowIsParent(focus, window)) {
if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd)) if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd))
return; return;
} }
@ -4382,7 +4382,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
deliveries = DeliverDeviceEvents(pSprite->win, event, grab, deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
NullWindow, thisDev); NullWindow, thisDev);
else if (focus && (focus == pSprite->win || else if (focus && (focus == pSprite->win ||
IsParent(focus, pSprite->win))) WindowIsParent(focus, pSprite->win)))
deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
thisDev); thisDev);
else if (focus) else if (focus)
@ -4704,7 +4704,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
event.u.enterLeave.mode = mode; event.u.enterLeave.mode = mode;
focus = (keybd) ? keybd->focus->win : None; focus = (keybd) ? keybd->focus->win : None;
if ((focus != NoneWin) && if ((focus != NoneWin) &&
((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) ((pWin == focus) || (focus == PointerRootWin) || WindowIsParent(focus, pWin)))
event.u.enterLeave.flags |= ELFlagFocus; event.u.enterLeave.flags |= ELFlagFocus;
if ((mask & GetEventFilter(mouse, &event))) { if ((mask & GetEventFilter(mouse, &event))) {
@ -4788,7 +4788,7 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
focus = (kbd) ? kbd->focus->win : None; focus = (kbd) ? kbd->focus->win : None;
if ((focus != NoneWin) && if ((focus != NoneWin) &&
((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) ((pWin == focus) || (focus == PointerRootWin) || WindowIsParent(focus, pWin)))
event->focus = TRUE; event->focus = TRUE;
FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin, FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin,
@ -5531,7 +5531,7 @@ ProcSendEvent(ClientPtr client)
if (inputFocus == PointerRootWin) if (inputFocus == PointerRootWin)
inputFocus = InputDevCurrentRootWindow(dev); inputFocus = InputDevCurrentRootWindow(dev);
if (IsParent(inputFocus, pSprite->win)) { if (WindowIsParent(inputFocus, pSprite->win)) {
effectiveFocus = inputFocus; effectiveFocus = inputFocus;
pWin = pSprite->win; pWin = pSprite->win;
} }
@ -5952,7 +5952,7 @@ CheckCursorConfinement(WindowPtr pWin)
if (grab && (confineTo = grab->confineTo)) { if (grab && (confineTo = grab->confineTo)) {
if (!BorderSizeNotEmpty(pDev, confineTo)) if (!BorderSizeNotEmpty(pDev, confineTo))
(*pDev->deviceGrab.DeactivateGrab) (pDev); (*pDev->deviceGrab.DeactivateGrab) (pDev);
else if ((pWin == confineTo) || IsParent(pWin, confineTo)) else if ((pWin == confineTo) || WindowIsParent(pWin, confineTo))
ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE);
} }
} }

View File

@ -3252,7 +3252,7 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
if (xwl_seat->focus_window == NULL && if (xwl_seat->focus_window == NULL &&
xwl_seat->last_focus_window != NULL && xwl_seat->last_focus_window != NULL &&
(xwl_seat->last_focus_window->toplevel == window || (xwl_seat->last_focus_window->toplevel == window ||
IsParent(xwl_seat->last_focus_window->toplevel, window))) WindowIsParent(xwl_seat->last_focus_window->toplevel, window)))
return TRUE; return TRUE;
return FALSE; return FALSE;