~ubuntu-branches/ubuntu/vivid/xorg-server/vivid

« back to all changes in this revision

Viewing changes to dix/window.c

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2013-07-03 12:03:57 UTC
  • mfrom: (1.1.56)
  • Revision ID: package-import@ubuntu.com-20130703120357-caosebpn11zu2zj0
Tags: 2:1.14.1-0ubuntu0.8
Use correct version for libxfixes3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
680
680
    if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
681
681
        fOK = FALSE;
682
682
        for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
683
 
            pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
 
683
            pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
684
684
            if ((depth == pDepth->depth) || (depth == 0)) {
685
685
                for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
686
686
                    if (visual == pDepth->vids[ivisual]) {
1886
1886
        if (pSib->mapped) {
1887
1887
            sbox = WindowExtents(pSib, &sboxrec);
1888
1888
            if (BOXES_OVERLAP(sbox, box)
1889
 
                && ShapeOverlap(pWin, box, pSib, sbox)
1890
 
                )
 
1889
                && ShapeOverlap(pWin, box, pSib, sbox))
1891
1890
                return TRUE;
1892
1891
        }
1893
1892
    }
1905
1904
        if (pSib->mapped) {
1906
1905
            sbox = WindowExtents(pSib, &sboxrec);
1907
1906
            if (BOXES_OVERLAP(sbox, box)
1908
 
                && ShapeOverlap(pWin, box, pSib, sbox)
1909
 
                )
 
1907
                && ShapeOverlap(pWin, box, pSib, sbox))
1910
1908
                return TRUE;
1911
1909
        }
1912
1910
    }
2174
2172
    else
2175
2173
        pSib = pWin->nextSib;
2176
2174
 
2177
 
    if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
2178
 
        )) {
 
2175
    if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) {
2179
2176
        xEvent event = {
2180
2177
            .u.configureRequest.window = pWin->drawable.id,
2181
2178
            .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None,
2508
2505
    }
2509
2506
}
2510
2507
 
2511
 
static WindowPtr windowDisableMapUnmapEvents;
2512
 
 
2513
 
void
2514
 
DisableMapUnmapEvents(WindowPtr pWin)
2515
 
{
2516
 
    assert(windowDisableMapUnmapEvents == NULL);
2517
 
 
2518
 
    windowDisableMapUnmapEvents = pWin;
2519
 
}
2520
 
 
2521
 
void
2522
 
EnableMapUnmapEvents(WindowPtr pWin)
2523
 
{
2524
 
    assert(windowDisableMapUnmapEvents != NULL);
2525
 
 
2526
 
    windowDisableMapUnmapEvents = NULL;
2527
 
}
2528
 
 
2529
2508
static Bool
2530
 
MapUnmapEventsEnabled(WindowPtr pWin)
2531
 
{
2532
 
    return pWin != windowDisableMapUnmapEvents;
 
2509
MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client)
 
2510
{
 
2511
    xEvent event = {
 
2512
        .u.mapRequest.window = pWin->drawable.id,
 
2513
        .u.mapRequest.parent = pParent->drawable.id
 
2514
    };
 
2515
    event.u.u.type = MapRequest;
 
2516
 
 
2517
    return MaybeDeliverEventsToClient(pParent, &event, 1,
 
2518
                                      SubstructureRedirectMask,
 
2519
                                      client) == 1;
 
2520
}
 
2521
 
 
2522
static void
 
2523
DeliverMapNotify(WindowPtr pWin)
 
2524
{
 
2525
    xEvent event = {
 
2526
        .u.mapNotify.window = pWin->drawable.id,
 
2527
        .u.mapNotify.override = pWin->overrideRedirect,
 
2528
    };
 
2529
    event.u.u.type = MapNotify;
 
2530
    DeliverEvents(pWin, &event, 1, NullWindow);
2533
2531
}
2534
2532
 
2535
2533
/*****
2551
2549
    if (pWin->mapped)
2552
2550
        return Success;
2553
2551
 
2554
 
    /*  general check for permission to map window */
 
2552
    /* general check for permission to map window */
2555
2553
    if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
2556
2554
                 pWin, RT_NONE, NULL, DixShowAccess) != Success)
2557
2555
        return Success;
2560
2558
    if ((pParent = pWin->parent)) {
2561
2559
        Bool anyMarked;
2562
2560
 
2563
 
        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
2564
 
            )) {
2565
 
            xEvent event = {
2566
 
                .u.mapRequest.window = pWin->drawable.id,
2567
 
                .u.mapRequest.parent = pParent->drawable.id
2568
 
            };
2569
 
            event.u.u.type = MapRequest;
2570
 
 
2571
 
            if (MaybeDeliverEventsToClient(pParent, &event, 1,
2572
 
                                           SubstructureRedirectMask,
2573
 
                                           client) == 1)
 
2561
        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)))
 
2562
            if (MaybeDeliverMapRequest(pWin, pParent, client))
2574
2563
                return Success;
2575
 
        }
2576
2564
 
2577
2565
        pWin->mapped = TRUE;
2578
 
        if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
2579
 
            xEvent event = {
2580
 
                .u.mapNotify.window = pWin->drawable.id,
2581
 
                .u.mapNotify.override = pWin->overrideRedirect,
2582
 
            };
2583
 
            event.u.u.type = MapNotify;
2584
 
            DeliverEvents(pWin, &event, 1, NullWindow);
2585
 
        }
 
2566
        if (SubStrSend(pWin, pParent))
 
2567
            DeliverMapNotify(pWin);
2586
2568
 
2587
2569
        if (!pParent->realized)
2588
2570
            return Success;
2644
2626
    anyMarked = FALSE;
2645
2627
    for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) {
2646
2628
        if (!pWin->mapped) {
2647
 
            if (parentRedirect && !pWin->overrideRedirect) {
2648
 
                xEvent event = {
2649
 
                    .u.mapRequest.window = pWin->drawable.id,
2650
 
                    .u.mapRequest.parent = pParent->drawable.id
2651
 
                };
2652
 
                event.u.u.type = MapRequest;
2653
 
 
2654
 
                if (MaybeDeliverEventsToClient(pParent, &event, 1,
2655
 
                                               SubstructureRedirectMask,
2656
 
                                               client) == 1)
 
2629
            if (parentRedirect && !pWin->overrideRedirect)
 
2630
                if (MaybeDeliverMapRequest(pWin, pParent, client))
2657
2631
                    continue;
2658
 
            }
2659
2632
 
2660
2633
            pWin->mapped = TRUE;
2661
 
            if (parentNotify || StrSend(pWin)) {
2662
 
                xEvent event = {
2663
 
                    .u.mapNotify.window = pWin->drawable.id,
2664
 
                    .u.mapNotify.override = pWin->overrideRedirect
2665
 
                };
2666
 
                event.u.u.type = MapNotify;
2667
 
                DeliverEvents(pWin, &event, 1, NullWindow);
2668
 
            }
 
2634
            if (parentNotify || StrSend(pWin))
 
2635
                DeliverMapNotify(pWin);
2669
2636
 
2670
2637
            if (!pFirstMapped)
2671
2638
                pFirstMapped = pWin;
2726
2693
            }
2727
2694
#endif
2728
2695
            (*Unrealize) (pChild);
2729
 
            if (MapUnmapEventsEnabled(pWin))
2730
 
                DeleteWindowFromAnyEvents(pChild, FALSE);
 
2696
            DeleteWindowFromAnyEvents(pChild, FALSE);
2731
2697
            if (pChild->viewable) {
2732
2698
                pChild->viewable = FALSE;
2733
2699
                (*MarkUnrealizedWindow) (pChild, pWin, fromConfigure);
2746
2712
    }
2747
2713
}
2748
2714
 
 
2715
static void
 
2716
DeliverUnmapNotify(WindowPtr pWin, Bool fromConfigure)
 
2717
{
 
2718
    xEvent event = {
 
2719
        .u.unmapNotify.window = pWin->drawable.id,
 
2720
        .u.unmapNotify.fromConfigure = fromConfigure
 
2721
    };
 
2722
    event.u.u.type = UnmapNotify;
 
2723
    DeliverEvents(pWin, &event, 1, NullWindow);
 
2724
}
 
2725
 
2749
2726
/*****
2750
2727
 * UnmapWindow
2751
2728
 *    If the window is already unmapped, this request has no effect.
2764
2741
 
2765
2742
    if ((!pWin->mapped) || (!(pParent = pWin->parent)))
2766
2743
        return Success;
2767
 
    if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
2768
 
        xEvent event = {
2769
 
            .u.unmapNotify.window = pWin->drawable.id,
2770
 
            .u.unmapNotify.fromConfigure = fromConfigure
2771
 
        };
2772
 
        event.u.u.type = UnmapNotify;
2773
 
        DeliverEvents(pWin, &event, 1, NullWindow);
2774
 
    }
 
2744
    if (SubStrSend(pWin, pParent))
 
2745
        DeliverUnmapNotify(pWin, fromConfigure);
2775
2746
    if (wasViewable && !fromConfigure) {
2776
2747
        pWin->valdata = UnmapValData;
2777
2748
        (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin);
2822
2793
 
2823
2794
    for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
2824
2795
        if (pChild->mapped) {
2825
 
            if (parentNotify || StrSend(pChild)) {
2826
 
                xEvent event = {
2827
 
                    .u.unmapNotify.window = pChild->drawable.id,
2828
 
                    .u.unmapNotify.fromConfigure = xFalse
2829
 
                };
2830
 
                event.u.u.type = UnmapNotify;
2831
 
                DeliverEvents(pChild, &event, 1, NullWindow);
2832
 
            }
 
2796
            if (parentNotify || StrSend(pChild))
 
2797
                DeliverUnmapNotify(pChild, xFalse);
2833
2798
            if (pChild->viewable) {
2834
2799
                pChild->valdata = UnmapValData;
2835
2800
                anyMarked = TRUE;
2956
2921
    xEvent event;
2957
2922
    unsigned int visibility = pWin->visibility;
2958
2923
 
2959
 
    if (!MapUnmapEventsEnabled(pWin))
2960
 
        return;
2961
2924
#ifdef PANORAMIX
2962
2925
    /* This is not quite correct yet, but it's close */
2963
2926
    if (!noPanoramiXExtension) {