From 6fc8b593a4c25f22139dbaa051cbfdf83bc85a12 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 23 May 2025 17:13:51 +0200 Subject: [PATCH] dix: rename IsParent() to WindowIsParent() Spending it a more fitting name. Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/exevents.c | 2 +- dix/dix_priv.h | 2 +- dix/enterleave.c | 52 ++++++++++++++++++------------------ dix/events.c | 20 +++++++------- hw/xwayland/xwayland-input.c | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 7a91ceca0..802403d41 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2930,7 +2930,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (inputFocus == PointerRootWin) inputFocus = InputDevCurrentRootWindow(d); - if (IsParent(inputFocus, spriteWin)) { + if (WindowIsParent(inputFocus, spriteWin)) { effectiveFocus = inputFocus; pWin = spriteWin; } diff --git a/dix/dix_priv.h b/dix/dix_priv.h index 56a2882bc..6d6402568 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -551,7 +551,7 @@ int OtherClientGone(void *value, XID id); * @param child the alleged child * @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); #endif /* _XSERVER_DIX_PRIV_H */ diff --git a/dix/enterleave.c b/dix/enterleave.c index 2e634dac8..3835900c7 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -144,7 +144,7 @@ FirstPointerChild(WindowPtr win) int i; for (i = 0; i < MAXDEVICES; i++) { - if (PointerWindows[i] && IsParent(win, PointerWindows[i])) + if (PointerWindows[i] && WindowIsParent(win, PointerWindows[i])) return PointerWindows[i]; } @@ -165,7 +165,7 @@ FirstFocusChild(WindowPtr win) for (i = 0; i < MAXDEVICES; i++) { if (FocusWindows[i] && FocusWindows[i] != PointerRootWin && - IsParent(win, FocusWindows[i])) + WindowIsParent(win, FocusWindows[i])) return FocusWindows[i]; } @@ -219,7 +219,7 @@ static WindowPtr CommonAncestor(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) - if (IsParent(b, a)) + if (WindowIsParent(b, a)) return b; return NullWindow; } @@ -545,9 +545,9 @@ CoreEnterLeaveEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) LeaveWindow(dev); - if (IsParent(from, to)) + if (WindowIsParent(from, to)) CoreEnterLeaveToDescendant(dev, from, to, mode); - else if (IsParent(to, from)) + else if (WindowIsParent(to, from)) CoreEnterLeaveToAncestor(dev, from, to, mode); else CoreEnterLeaveNonLinear(dev, from, to, mode); @@ -559,14 +559,14 @@ static void DeviceEnterLeaveEvents(DeviceIntPtr dev, int sourceid, WindowPtr from, WindowPtr to, int mode) { - if (IsParent(from, to)) { + if (WindowIsParent(from, to)) { DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, from, None); DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual); DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to, None); } - else if (IsParent(to, from)) { + else if (WindowIsParent(to, from)) { DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, from, None); DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual); @@ -966,12 +966,12 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev, if (!P) return; - if (!IsParent(pwin_parent, P)) + if (!WindowIsParent(pwin_parent, P)) if (!(pwin_parent == P && inclusive)) return; if (exclude != None && exclude != PointerRootWin && - (IsParent(exclude, P) || IsParent(P, exclude))) + (WindowIsParent(exclude, P) || WindowIsParent(P, exclude))) return; stopAt = (inclusive) ? pwin_parent->parent : pwin_parent; @@ -1013,10 +1013,10 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev, 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; - if (exclude != None && (IsParent(exclude, P) || IsParent(P, exclude))) + if (exclude != None && (WindowIsParent(exclude, P) || WindowIsParent(P, exclude))) return; CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive); @@ -1268,7 +1268,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, B != PointerRootWin) { WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT)); - if (ptrwin && IsParent(root, ptrwin)) + if (ptrwin && WindowIsParent(root, ptrwin)) CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE); } @@ -1408,9 +1408,9 @@ CoreFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) CoreFocusToPointerRootOrNone(dev, from, to, mode); else if ((from == NullWindow) || (from == PointerRootWin)) CoreFocusFromPointerRootOrNone(dev, from, to, mode); - else if (IsParent(from, to)) + else if (WindowIsParent(from, to)) CoreFocusToDescendant(dev, from, to, mode); - else if (IsParent(to, from)) + else if (WindowIsParent(to, from)) CoreFocusToAncestor(dev, from, to, mode); else CoreFocusNonLinear(dev, from, to, mode); @@ -1453,7 +1453,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) screenInfo.screens[i]->root); } else { - if (IsParent(from, sprite->win)) { + if (WindowIsParent(from, sprite->win)) { DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, sprite->win); 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, NotifyNonlinearVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); - if (IsParent(to, sprite->win)) + if (WindowIsParent(to, sprite->win)) DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer); } else { - if (IsParent(to, from)) { + if (WindowIsParent(to, from)) { DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from); DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to); - if ((IsParent(to, sprite->win)) && + if ((WindowIsParent(to, sprite->win)) && (sprite->win != from) && - (!IsParent(from, sprite->win)) && - (!IsParent(sprite->win, from))) + (!WindowIsParent(from, sprite->win)) && + (!WindowIsParent(sprite->win, from))) DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer); } - else if (IsParent(from, to)) { - if ((IsParent(from, sprite->win)) && + else if (WindowIsParent(from, to)) { + if ((WindowIsParent(from, sprite->win)) && (sprite->win != from) && - (!IsParent(to, sprite->win)) && - (!IsParent(sprite->win, to))) { + (!WindowIsParent(to, sprite->win)) && + (!WindowIsParent(sprite->win, to))) { DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer, sprite->win); DeviceFocusOutEvents(dev, sprite->win, from, mode, @@ -1524,7 +1524,7 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode) WindowPtr common = CommonAncestor(to, from); /* common == NullWindow ==> different screens */ - if (IsParent(from, sprite->win)) + if (WindowIsParent(from, sprite->win)) DeviceFocusOutEvents(dev, sprite->win, from, mode, NotifyPointer); 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, NotifyNonlinearVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); - if (IsParent(to, sprite->win)) + if (WindowIsParent(to, sprite->win)) DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer); } diff --git a/dix/events.c b/dix/events.c index ad25ba2e0..9386c05ca 100644 --- a/dix/events.c +++ b/dix/events.c @@ -967,7 +967,7 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) * @returns true if b is a descendent of a */ Bool -IsParent(WindowPtr a, WindowPtr b) +WindowIsParent(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) @@ -995,7 +995,7 @@ PostNewCursor(DeviceIntPtr pDev) ChangeToCursor(pDev, grab->cursor); return; } - if (IsParent(grab->window, pSprite->win)) + if (WindowIsParent(grab->window, pSprite->win)) win = pSprite->win; else win = grab->window; @@ -3066,7 +3066,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) if (!dev->deviceGrab.fromPassiveGrab || dev->deviceGrab.grab->type != XI_FocusIn || dev->deviceGrab.grab->window == win || - IsParent(dev->deviceGrab.grab->window, win)) + WindowIsParent(dev->deviceGrab.grab->window, win)) return FALSE; DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); (*dev->deviceGrab.DeactivateGrab) (dev); @@ -3107,7 +3107,7 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) if (!dev->deviceGrab.fromPassiveGrab || dev->deviceGrab.grab->type != XI_Enter || dev->deviceGrab.grab->window == win || - IsParent(dev->deviceGrab.grab->window, win)) + WindowIsParent(dev->deviceGrab.grab->window, win)) return FALSE; DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); (*dev->deviceGrab.DeactivateGrab) (dev); @@ -4208,7 +4208,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd); return; } - if ((focus == window) || IsParent(focus, window)) { + if ((focus == window) || WindowIsParent(focus, window)) { if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd)) return; } @@ -4382,7 +4382,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, deliveries = DeliverDeviceEvents(pSprite->win, event, grab, NullWindow, thisDev); else if (focus && (focus == pSprite->win || - IsParent(focus, pSprite->win))) + WindowIsParent(focus, pSprite->win))) deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, thisDev); else if (focus) @@ -4704,7 +4704,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse, event.u.enterLeave.mode = mode; focus = (keybd) ? keybd->focus->win : None; if ((focus != NoneWin) && - ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) + ((pWin == focus) || (focus == PointerRootWin) || WindowIsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; if ((mask & GetEventFilter(mouse, &event))) { @@ -4788,7 +4788,7 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse, focus = (kbd) ? kbd->focus->win : None; if ((focus != NoneWin) && - ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) + ((pWin == focus) || (focus == PointerRootWin) || WindowIsParent(focus, pWin))) event->focus = TRUE; FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin, @@ -5531,7 +5531,7 @@ ProcSendEvent(ClientPtr client) if (inputFocus == PointerRootWin) inputFocus = InputDevCurrentRootWindow(dev); - if (IsParent(inputFocus, pSprite->win)) { + if (WindowIsParent(inputFocus, pSprite->win)) { effectiveFocus = inputFocus; pWin = pSprite->win; } @@ -5952,7 +5952,7 @@ CheckCursorConfinement(WindowPtr pWin) if (grab && (confineTo = grab->confineTo)) { if (!BorderSizeNotEmpty(pDev, confineTo)) (*pDev->deviceGrab.DeactivateGrab) (pDev); - else if ((pWin == confineTo) || IsParent(pWin, confineTo)) + else if ((pWin == confineTo) || WindowIsParent(pWin, confineTo)) ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE); } } diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index f7a8d2165..d9d03709f 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -3252,7 +3252,7 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window) if (xwl_seat->focus_window == NULL && xwl_seat->last_focus_window != NULL && (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 FALSE;