diff options
Diffstat (limited to 'xorg-server/dix/window.c')
-rw-r--r-- | xorg-server/dix/window.c | 129 |
1 files changed, 46 insertions, 83 deletions
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c index cdd12dca6..e70531af6 100644 --- a/xorg-server/dix/window.c +++ b/xorg-server/dix/window.c @@ -1886,8 +1886,7 @@ AnyWindowOverlapsMe(WindowPtr pWin, WindowPtr pHead, BoxPtr box) if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) - && ShapeOverlap(pWin, box, pSib, sbox) - ) + && ShapeOverlap(pWin, box, pSib, sbox)) return TRUE; } } @@ -1905,8 +1904,7 @@ IOverlapAnyWindow(WindowPtr pWin, BoxPtr box) if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) - && ShapeOverlap(pWin, box, pSib, sbox) - ) + && ShapeOverlap(pWin, box, pSib, sbox)) return TRUE; } } @@ -2174,8 +2172,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) else pSib = pWin->nextSib; - if ((!pWin->overrideRedirect) && (RedirectSend(pParent) - )) { + if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) { xEvent event = { .u.configureRequest.window = pWin->drawable.id, .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None, @@ -2508,28 +2505,29 @@ RealizeTree(WindowPtr pWin) } } -static WindowPtr windowDisableMapUnmapEvents; - -void -DisableMapUnmapEvents(WindowPtr pWin) -{ - assert(windowDisableMapUnmapEvents == NULL); - - windowDisableMapUnmapEvents = pWin; -} - -void -EnableMapUnmapEvents(WindowPtr pWin) +static Bool +MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client) { - assert(windowDisableMapUnmapEvents != NULL); + xEvent event = { + .u.mapRequest.window = pWin->drawable.id, + .u.mapRequest.parent = pParent->drawable.id + }; + event.u.u.type = MapRequest; - windowDisableMapUnmapEvents = NULL; + return MaybeDeliverEventsToClient(pParent, &event, 1, + SubstructureRedirectMask, + client) == 1; } -static Bool -MapUnmapEventsEnabled(WindowPtr pWin) +static void +DeliverMapNotify(WindowPtr pWin) { - return pWin != windowDisableMapUnmapEvents; + xEvent event = { + .u.mapNotify.window = pWin->drawable.id, + .u.mapNotify.override = pWin->overrideRedirect, + }; + event.u.u.type = MapNotify; + DeliverEvents(pWin, &event, 1, NullWindow); } /***** @@ -2551,7 +2549,7 @@ MapWindow(WindowPtr pWin, ClientPtr client) if (pWin->mapped) return Success; - /* general check for permission to map window */ + /* general check for permission to map window */ if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, pWin, RT_NONE, NULL, DixShowAccess) != Success) return Success; @@ -2560,29 +2558,13 @@ MapWindow(WindowPtr pWin, ClientPtr client) if ((pParent = pWin->parent)) { Bool anyMarked; - if ((!pWin->overrideRedirect) && (RedirectSend(pParent) - )) { - xEvent event = { - .u.mapRequest.window = pWin->drawable.id, - .u.mapRequest.parent = pParent->drawable.id - }; - event.u.u.type = MapRequest; - - if (MaybeDeliverEventsToClient(pParent, &event, 1, - SubstructureRedirectMask, - client) == 1) + if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) + if (MaybeDeliverMapRequest(pWin, pParent, client)) return Success; - } pWin->mapped = TRUE; - if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { - xEvent event = { - .u.mapNotify.window = pWin->drawable.id, - .u.mapNotify.override = pWin->overrideRedirect, - }; - event.u.u.type = MapNotify; - DeliverEvents(pWin, &event, 1, NullWindow); - } + if (SubStrSend(pWin, pParent)) + DeliverMapNotify(pWin); if (!pParent->realized) return Success; @@ -2644,28 +2626,13 @@ MapSubwindows(WindowPtr pParent, ClientPtr client) anyMarked = FALSE; for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (!pWin->mapped) { - if (parentRedirect && !pWin->overrideRedirect) { - xEvent event = { - .u.mapRequest.window = pWin->drawable.id, - .u.mapRequest.parent = pParent->drawable.id - }; - event.u.u.type = MapRequest; - - if (MaybeDeliverEventsToClient(pParent, &event, 1, - SubstructureRedirectMask, - client) == 1) + if (parentRedirect && !pWin->overrideRedirect) + if (MaybeDeliverMapRequest(pWin, pParent, client)) continue; - } pWin->mapped = TRUE; - if (parentNotify || StrSend(pWin)) { - xEvent event = { - .u.mapNotify.window = pWin->drawable.id, - .u.mapNotify.override = pWin->overrideRedirect - }; - event.u.u.type = MapNotify; - DeliverEvents(pWin, &event, 1, NullWindow); - } + if (parentNotify || StrSend(pWin)) + DeliverMapNotify(pWin); if (!pFirstMapped) pFirstMapped = pWin; @@ -2726,8 +2693,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure) } #endif (*Unrealize) (pChild); - if (MapUnmapEventsEnabled(pWin)) - DeleteWindowFromAnyEvents(pChild, FALSE); + DeleteWindowFromAnyEvents(pChild, FALSE); if (pChild->viewable) { pChild->viewable = FALSE; (*MarkUnrealizedWindow) (pChild, pWin, fromConfigure); @@ -2746,6 +2712,17 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure) } } +static void +DeliverUnmapNotify(WindowPtr pWin, Bool fromConfigure) +{ + xEvent event = { + .u.unmapNotify.window = pWin->drawable.id, + .u.unmapNotify.fromConfigure = fromConfigure + }; + event.u.u.type = UnmapNotify; + DeliverEvents(pWin, &event, 1, NullWindow); +} + /***** * UnmapWindow * If the window is already unmapped, this request has no effect. @@ -2764,14 +2741,8 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure) if ((!pWin->mapped) || (!(pParent = pWin->parent))) return Success; - if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { - xEvent event = { - .u.unmapNotify.window = pWin->drawable.id, - .u.unmapNotify.fromConfigure = fromConfigure - }; - event.u.u.type = UnmapNotify; - DeliverEvents(pWin, &event, 1, NullWindow); - } + if (SubStrSend(pWin, pParent)) + DeliverUnmapNotify(pWin, fromConfigure); if (wasViewable && !fromConfigure) { pWin->valdata = UnmapValData; (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin); @@ -2822,14 +2793,8 @@ UnmapSubwindows(WindowPtr pWin) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) { if (pChild->mapped) { - if (parentNotify || StrSend(pChild)) { - xEvent event = { - .u.unmapNotify.window = pChild->drawable.id, - .u.unmapNotify.fromConfigure = xFalse - }; - event.u.u.type = UnmapNotify; - DeliverEvents(pChild, &event, 1, NullWindow); - } + if (parentNotify || StrSend(pChild)) + DeliverUnmapNotify(pChild, xFalse); if (pChild->viewable) { pChild->valdata = UnmapValData; anyMarked = TRUE; @@ -2956,8 +2921,6 @@ SendVisibilityNotify(WindowPtr pWin) xEvent event; unsigned int visibility = pWin->visibility; - if (!MapUnmapEventsEnabled(pWin)) - return; #ifdef PANORAMIX /* This is not quite correct yet, but it's close */ if (!noPanoramiXExtension) { |