~ubuntu-branches/ubuntu/quantal/xorg-server/quantal-proposed

« back to all changes in this revision

Viewing changes to miext/rootless/rootlessValTree.c

  • Committer: Package Import Robot
  • Author(s): Bryce Harrington, Maarten Lankhorst, Bryce Harrington
  • Date: 2012-06-04 19:12:23 UTC
  • mfrom: (0.11.40 sid)
  • Revision ID: package-import@ubuntu.com-20120604191223-7gt8pm5dtw7k340f
Tags: 2:1.12.1.902-1ubuntu1
[ Maarten Lankhorst ]
* Refresh patches to apply on x-server 1.12
  - patch-x-indent.sh from xorg-pkg-tools was used to redo coding style
* Deleted following patches because they have been committed upstream
  - 224_return_BadWindow_not_BadMatch.diff
  - 225_non-root_config_paths.patch
  - 505_query_pointer_touchscreen.patch
  - 506_touchscreen_pointer_emulation_checks.patch
  - 507_touchscreen_fixes.patch
* Non-trivial refresh of 500_pointer_barrier_thresholds.diff, based on 
  xorg-edgers
* Rest was refreshed with patch-x-indent.sh to survive coding style changes
* Add upstream patches for proper device disabling:
  - 510-dix-return-early-from-DisableDevice-if-the-device-is.patch
  - 511-dix-move-freeing-the-sprite-into-a-function.patch
  - 512-dix-free-the-sprite-when-disabling-the-device.patch
  - 513-dix-disable-non-sprite-owners-first-when-disabling-p.patch
  - 514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch
  - 515-dix-disable-all-devices-before-shutdown.patch

[ Bryce Harrington ]
* Drop 209_add_legacy_bgnone_option.patch: lightdm and other *dm's have
  switched to the new standard -background option.  No need to continue
  providing the legacy -nr synonym.
* Drop 201_report-real-dpi.patch:  Commented out in series.
* Drop 198_nohwaccess.patch: Rootless-X no longer a development focus
  for us; the patch would need reworked anyway to provide proper
  support.
* Drop 166_nullptr_xinerama_keyrepeat.patch: Fixed differently upstream
  in commit 24e682d0, as verified by original reporter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
  * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
87
87
  *             In particular, much improved code for window mapping and
88
88
  *             circulating.
89
 
  *             Bob Scheifler -- avoid miComputeClips for unmapped windows,
90
 
  *                              valdata changes
 
89
  *             Bob Scheifler -- avoid miComputeClips for unmapped windows,
 
90
  *                              valdata changes
91
91
  */
92
92
#ifdef HAVE_DIX_CONFIG_H
93
93
#include <dix-config.h>
94
94
#endif
95
95
 
96
 
#include <stddef.h> /* For NULL */
 
96
#include <stddef.h>             /* For NULL */
97
97
#include    <X11/X.h>
98
98
#include    "scrnintstr.h"
99
99
#include    "validate.h"
104
104
 
105
105
#include    "globals.h"
106
106
 
107
 
int RootlessMiValidateTree (WindowPtr pRoot, WindowPtr pChild, VTKind kind);
 
107
int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, VTKind kind);
108
108
 
109
109
/*
110
110
 * Compute the visibility of a shaped window
111
111
 */
112
112
static int
113
 
RootlessShapedWindowIn (RegionPtr universe,
114
 
                        RegionPtr bounding, BoxPtr rect, int x, int y)
 
113
RootlessShapedWindowIn(RegionPtr universe,
 
114
                       RegionPtr bounding, BoxPtr rect, int x, int y)
115
115
{
116
 
    BoxRec  box;
117
 
    register BoxPtr  boundBox;
118
 
    int     nbox;
119
 
    Bool    someIn, someOut;
 
116
    BoxRec box;
 
117
    register BoxPtr boundBox;
 
118
    int nbox;
 
119
    Bool someIn, someOut;
120
120
    register int t, x1, y1, x2, y2;
121
121
 
122
 
    nbox = RegionNumRects (bounding);
123
 
    boundBox = RegionRects (bounding);
 
122
    nbox = RegionNumRects(bounding);
 
123
    boundBox = RegionRects(bounding);
124
124
    someIn = someOut = FALSE;
125
125
    x1 = rect->x1;
126
126
    y1 = rect->y1;
127
127
    x2 = rect->x2;
128
128
    y2 = rect->y2;
129
 
    while (nbox--)
130
 
    {
131
 
        if ((t = boundBox->x1 + x) < x1)
132
 
            t = x1;
133
 
        box.x1 = t;
134
 
        if ((t = boundBox->y1 + y) < y1)
135
 
            t = y1;
136
 
        box.y1 = t;
137
 
        if ((t = boundBox->x2 + x) > x2)
138
 
            t = x2;
139
 
        box.x2 = t;
140
 
        if ((t = boundBox->y2 + y) > y2)
141
 
            t = y2;
142
 
        box.y2 = t;
143
 
        if (box.x1 > box.x2)
144
 
            box.x2 = box.x1;
145
 
        if (box.y1 > box.y2)
146
 
            box.y2 = box.y1;
147
 
        switch (RegionContainsRect(universe, &box))
148
 
        {
149
 
        case rgnIN:
150
 
            if (someOut)
151
 
                return rgnPART;
152
 
            someIn = TRUE;
153
 
            break;
154
 
        case rgnOUT:
155
 
            if (someIn)
156
 
                return rgnPART;
157
 
            someOut = TRUE;
158
 
            break;
159
 
        default:
160
 
            return rgnPART;
161
 
        }
162
 
        boundBox++;
 
129
    while (nbox--) {
 
130
        if ((t = boundBox->x1 + x) < x1)
 
131
            t = x1;
 
132
        box.x1 = t;
 
133
        if ((t = boundBox->y1 + y) < y1)
 
134
            t = y1;
 
135
        box.y1 = t;
 
136
        if ((t = boundBox->x2 + x) > x2)
 
137
            t = x2;
 
138
        box.x2 = t;
 
139
        if ((t = boundBox->y2 + y) > y2)
 
140
            t = y2;
 
141
        box.y2 = t;
 
142
        if (box.x1 > box.x2)
 
143
            box.x2 = box.x1;
 
144
        if (box.y1 > box.y2)
 
145
            box.y2 = box.y1;
 
146
        switch (RegionContainsRect(universe, &box)) {
 
147
        case rgnIN:
 
148
            if (someOut)
 
149
                return rgnPART;
 
150
            someIn = TRUE;
 
151
            break;
 
152
        case rgnOUT:
 
153
            if (someIn)
 
154
                return rgnPART;
 
155
            someOut = TRUE;
 
156
            break;
 
157
        default:
 
158
            return rgnPART;
 
159
        }
 
160
        boundBox++;
163
161
    }
164
162
    if (someIn)
165
 
        return rgnIN;
 
163
        return rgnIN;
166
164
    return rgnOUT;
167
165
}
168
166
 
170
168
                                    HasBorder(w) && \
171
169
                                    (w)->backgroundState == ParentRelative)
172
170
 
173
 
 
174
171
/*
175
172
 *-----------------------------------------------------------------------
176
173
 * RootlessComputeClips --
188
185
 *-----------------------------------------------------------------------
189
186
 */
190
187
static void
191
 
RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen, 
192
 
                      RegionPtr universe, VTKind kind, RegionPtr exposed)
 
188
RootlessComputeClips(WindowPtr pParent, ScreenPtr pScreen,
 
189
                     RegionPtr universe, VTKind kind, RegionPtr exposed)
193
190
{
194
 
    int                 dx,
195
 
                        dy;
196
 
    RegionRec           childUniverse;
197
 
    register WindowPtr  pChild;
198
 
    int                 oldVis, newVis;
199
 
    BoxRec              borderSize;
200
 
    RegionRec           childUnion;
201
 
    Bool                overlap;
202
 
    RegionPtr           borderVisible;
 
191
    int dx, dy;
 
192
    RegionRec childUniverse;
 
193
    register WindowPtr pChild;
 
194
    int oldVis, newVis;
 
195
    BoxRec borderSize;
 
196
    RegionRec childUnion;
 
197
    Bool overlap;
 
198
    RegionPtr borderVisible;
 
199
 
203
200
    /*
204
201
     * Figure out the new visibility of this window.
205
202
     * The extent of the universe should be the same as the extent of
210
207
     */
211
208
    borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
212
209
    borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
213
 
    dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
 
210
    dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
 
211
        wBorderWidth(pParent);
214
212
    if (dx > 32767)
215
 
        dx = 32767;
 
213
        dx = 32767;
216
214
    borderSize.x2 = dx;
217
 
    dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
 
215
    dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
 
216
        wBorderWidth(pParent);
218
217
    if (dy > 32767)
219
 
        dy = 32767;
 
218
        dy = 32767;
220
219
    borderSize.y2 = dy;
221
220
 
222
221
    oldVis = pParent->visibility;
223
 
    switch (RegionContainsRect(universe, &borderSize))
224
 
    {
 
222
    switch (RegionContainsRect(universe, &borderSize)) {
225
223
    case rgnIN:
226
 
            newVis = VisibilityUnobscured;
227
 
            break;
228
 
        case rgnPART:
229
 
            newVis = VisibilityPartiallyObscured;
230
 
            {
231
 
                RegionPtr   pBounding;
 
224
        newVis = VisibilityUnobscured;
 
225
        break;
 
226
    case rgnPART:
 
227
        newVis = VisibilityPartiallyObscured;
 
228
        {
 
229
            RegionPtr pBounding;
232
230
 
233
 
                if ((pBounding = wBoundingShape (pParent)))
234
 
                {
235
 
                    switch (RootlessShapedWindowIn (universe,
236
 
                                                    pBounding, &borderSize,
237
 
                                                    pParent->drawable.x,
238
 
                                                    pParent->drawable.y))
239
 
                    {
240
 
                    case rgnIN:
241
 
                        newVis = VisibilityUnobscured;
242
 
                        break;
243
 
                    case rgnOUT:
244
 
                        newVis = VisibilityFullyObscured;
245
 
                        break;
246
 
                    }
247
 
                }
248
 
            }
249
 
            break;
250
 
        default:
251
 
            newVis = VisibilityFullyObscured;
252
 
            break;
 
231
            if ((pBounding = wBoundingShape(pParent))) {
 
232
                switch (RootlessShapedWindowIn(universe,
 
233
                                               pBounding, &borderSize,
 
234
                                               pParent->drawable.x,
 
235
                                               pParent->drawable.y)) {
 
236
                case rgnIN:
 
237
                    newVis = VisibilityUnobscured;
 
238
                    break;
 
239
                case rgnOUT:
 
240
                    newVis = VisibilityFullyObscured;
 
241
                    break;
 
242
                }
 
243
            }
 
244
        }
 
245
        break;
 
246
    default:
 
247
        newVis = VisibilityFullyObscured;
 
248
        break;
253
249
    }
254
250
 
255
251
    pParent->visibility = newVis;
256
252
    if (oldVis != newVis &&
257
 
        ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
258
 
        SendVisibilityNotify(pParent);
 
253
        ((pParent->
 
254
          eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
 
255
        SendVisibilityNotify(pParent);
259
256
 
260
257
    dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
261
258
    dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
268
265
    case VTMap:
269
266
    case VTStack:
270
267
    case VTUnmap:
271
 
        break;
 
268
        break;
272
269
    case VTMove:
273
 
        if ((oldVis == newVis) &&
274
 
            ((oldVis == VisibilityFullyObscured) ||
275
 
             (oldVis == VisibilityUnobscured)))
276
 
        {
277
 
            pChild = pParent;
278
 
            while (1)
279
 
            {
280
 
                if (pChild->viewable)
281
 
                {
282
 
                    if (pChild->visibility != VisibilityFullyObscured)
283
 
                    {
284
 
                        RegionTranslate(&pChild->borderClip,
285
 
                                                      dx, dy);
286
 
                        RegionTranslate(&pChild->clipList,
287
 
                                                      dx, dy);
288
 
                        pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
289
 
                        if (pScreen->ClipNotify)
290
 
                            (* pScreen->ClipNotify) (pChild, dx, dy);
 
270
        if ((oldVis == newVis) &&
 
271
            ((oldVis == VisibilityFullyObscured) ||
 
272
             (oldVis == VisibilityUnobscured))) {
 
273
            pChild = pParent;
 
274
            while (1) {
 
275
                if (pChild->viewable) {
 
276
                    if (pChild->visibility != VisibilityFullyObscured) {
 
277
                        RegionTranslate(&pChild->borderClip, dx, dy);
 
278
                        RegionTranslate(&pChild->clipList, dx, dy);
 
279
                        pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
 
280
                        if (pScreen->ClipNotify)
 
281
                            (*pScreen->ClipNotify) (pChild, dx, dy);
291
282
 
292
 
                    }
293
 
                    if (pChild->valdata)
294
 
                    {
295
 
                        RegionNull(&pChild->valdata->after.borderExposed);
296
 
                        if (HasParentRelativeBorder(pChild))
297
 
                          {
298
 
                            RegionSubtract(&pChild->valdata->after.borderExposed,
299
 
                                           &pChild->borderClip,
300
 
                                           &pChild->winSize);
301
 
                        }
302
 
                        RegionNull(&pChild->valdata->after.exposed);
303
 
                    }
304
 
                    if (pChild->firstChild)
305
 
                    {
306
 
                        pChild = pChild->firstChild;
307
 
                        continue;
308
 
                    }
309
 
                }
310
 
                while (!pChild->nextSib && (pChild != pParent))
311
 
                    pChild = pChild->parent;
312
 
                if (pChild == pParent)
313
 
                    break;
314
 
                pChild = pChild->nextSib;
315
 
            }
316
 
            return;
317
 
        }
318
 
        /* fall through */
 
283
                    }
 
284
                    if (pChild->valdata) {
 
285
                        RegionNull(&pChild->valdata->after.borderExposed);
 
286
                        if (HasParentRelativeBorder(pChild)) {
 
287
                            RegionSubtract(&pChild->valdata->after.
 
288
                                           borderExposed, &pChild->borderClip,
 
289
                                           &pChild->winSize);
 
290
                        }
 
291
                        RegionNull(&pChild->valdata->after.exposed);
 
292
                    }
 
293
                    if (pChild->firstChild) {
 
294
                        pChild = pChild->firstChild;
 
295
                        continue;
 
296
                    }
 
297
                }
 
298
                while (!pChild->nextSib && (pChild != pParent))
 
299
                    pChild = pChild->parent;
 
300
                if (pChild == pParent)
 
301
                    break;
 
302
                pChild = pChild->nextSib;
 
303
            }
 
304
            return;
 
305
        }
 
306
        /* fall through */
319
307
    default:
320
 
        /*
321
 
         * To calculate exposures correctly, we have to translate the old
322
 
         * borderClip and clipList regions to the window's new location so there
323
 
         * is a correspondence between pieces of the new and old clipping regions.
324
 
         */
325
 
        if (dx || dy) 
326
 
        {
327
 
            /*
328
 
             * We translate the old clipList because that will be exposed or copied
329
 
             * if gravity is right.
330
 
             */
331
 
            RegionTranslate(&pParent->borderClip, dx, dy);
332
 
            RegionTranslate(&pParent->clipList, dx, dy);
333
 
        } 
334
 
        break;
 
308
        /*
 
309
         * To calculate exposures correctly, we have to translate the old
 
310
         * borderClip and clipList regions to the window's new location so there
 
311
         * is a correspondence between pieces of the new and old clipping regions.
 
312
         */
 
313
        if (dx || dy) {
 
314
            /*
 
315
             * We translate the old clipList because that will be exposed or copied
 
316
             * if gravity is right.
 
317
             */
 
318
            RegionTranslate(&pParent->borderClip, dx, dy);
 
319
            RegionTranslate(&pParent->clipList, dx, dy);
 
320
        }
 
321
        break;
335
322
    case VTBroken:
336
 
        RegionEmpty(&pParent->borderClip);
337
 
        RegionEmpty(&pParent->clipList);
338
 
        break;
 
323
        RegionEmpty(&pParent->borderClip);
 
324
        RegionEmpty(&pParent->clipList);
 
325
        break;
339
326
    }
340
327
 
341
328
    borderVisible = pParent->valdata->before.borderVisible;
351
338
     * This leaves a region of pieces that weren't exposed before.
352
339
     */
353
340
 
354
 
    if (HasBorder (pParent))
355
 
    {
356
 
        if (borderVisible)
357
 
        {
358
 
            /*
359
 
             * when the border changes shape, the old visible portions
360
 
             * of the border will be saved by DIX in borderVisible --
361
 
             * use that region and destroy it
362
 
             */
363
 
            RegionSubtract(exposed, universe, borderVisible);
364
 
            RegionDestroy(borderVisible);
365
 
        }
366
 
        else
367
 
        {
368
 
            RegionSubtract(exposed, universe, &pParent->borderClip);
369
 
        }
370
 
        if (HasParentRelativeBorder(pParent) && (dx || dy)) {
371
 
            RegionSubtract(&pParent->valdata->after.borderExposed,
372
 
                                  universe,
373
 
                                  &pParent->winSize);
374
 
        } else {
375
 
            RegionSubtract(&pParent->valdata->after.borderExposed,
376
 
                               exposed, &pParent->winSize);
377
 
        }
378
 
 
379
 
        RegionCopy(&pParent->borderClip, universe);
380
 
    
381
 
        /*
382
 
         * To get the right clipList for the parent, and to make doubly sure
383
 
         * that no child overlaps the parent's border, we remove the parent's
384
 
         * border from the universe before proceeding.
385
 
         */
386
 
    
387
 
        RegionIntersect(universe, universe, &pParent->winSize);
 
341
    if (HasBorder(pParent)) {
 
342
        if (borderVisible) {
 
343
            /*
 
344
             * when the border changes shape, the old visible portions
 
345
             * of the border will be saved by DIX in borderVisible --
 
346
             * use that region and destroy it
 
347
             */
 
348
            RegionSubtract(exposed, universe, borderVisible);
 
349
            RegionDestroy(borderVisible);
 
350
        }
 
351
        else {
 
352
            RegionSubtract(exposed, universe, &pParent->borderClip);
 
353
        }
 
354
        if (HasParentRelativeBorder(pParent) && (dx || dy)) {
 
355
            RegionSubtract(&pParent->valdata->after.borderExposed,
 
356
                           universe, &pParent->winSize);
 
357
        }
 
358
        else {
 
359
            RegionSubtract(&pParent->valdata->after.borderExposed,
 
360
                           exposed, &pParent->winSize);
 
361
        }
 
362
 
 
363
        RegionCopy(&pParent->borderClip, universe);
 
364
 
 
365
        /*
 
366
         * To get the right clipList for the parent, and to make doubly sure
 
367
         * that no child overlaps the parent's border, we remove the parent's
 
368
         * border from the universe before proceeding.
 
369
         */
 
370
 
 
371
        RegionIntersect(universe, universe, &pParent->winSize);
388
372
    }
389
373
    else
390
 
        RegionCopy(&pParent->borderClip, universe);
391
 
    
392
 
    if ((pChild = pParent->firstChild) && pParent->mapped)
393
 
    {
394
 
        RegionNull(&childUniverse);
395
 
        RegionNull(&childUnion);
396
 
        if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
397
 
            ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
398
 
             (pChild->drawable.x < pParent->lastChild->drawable.x)))
399
 
        {
400
 
            for (; pChild; pChild = pChild->nextSib)
401
 
            {
402
 
                if (pChild->viewable)
403
 
                    RegionAppend(&childUnion, &pChild->borderSize);
404
 
            }
405
 
        }
406
 
        else
407
 
        {
408
 
            for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
409
 
            {
410
 
                if (pChild->viewable)
411
 
                    RegionAppend(&childUnion, &pChild->borderSize);
412
 
            }
413
 
        }
414
 
        RegionValidate(&childUnion, &overlap);
415
 
 
416
 
        for (pChild = pParent->firstChild;
417
 
             pChild;
418
 
             pChild = pChild->nextSib)
419
 
        {
420
 
            if (pChild->viewable) {
421
 
                /*
422
 
                 * If the child is viewable, we want to remove its extents
423
 
                 * from the current universe, but we only re-clip it if
424
 
                 * it's been marked.
425
 
                 */
426
 
                if (pChild->valdata) {
427
 
                    /*
428
 
                     * Figure out the new universe from the child's
429
 
                     * perspective and recurse.
430
 
                     */
431
 
                    RegionIntersect(&childUniverse,
432
 
                                            universe,
433
 
                                            &pChild->borderSize);
434
 
                    RootlessComputeClips (pChild, pScreen, &childUniverse, 
435
 
                                          kind, exposed);
436
 
                }
437
 
                /*
438
 
                 * Once the child has been processed, we remove its extents
439
 
                 * from the current universe, thus denying its space to any
440
 
                 * other sibling.
441
 
                 */
442
 
                if (overlap)
443
 
                    RegionSubtract(universe, universe,
444
 
                                          &pChild->borderSize);
445
 
            }
446
 
        }
447
 
        if (!overlap)
448
 
            RegionSubtract(universe, universe, &childUnion);
449
 
        RegionUninit(&childUnion);
450
 
        RegionUninit(&childUniverse);
451
 
    } /* if any children */
 
374
        RegionCopy(&pParent->borderClip, universe);
 
375
 
 
376
    if ((pChild = pParent->firstChild) && pParent->mapped) {
 
377
        RegionNull(&childUniverse);
 
378
        RegionNull(&childUnion);
 
379
        if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
 
380
            ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
 
381
             (pChild->drawable.x < pParent->lastChild->drawable.x))) {
 
382
            for (; pChild; pChild = pChild->nextSib) {
 
383
                if (pChild->viewable)
 
384
                    RegionAppend(&childUnion, &pChild->borderSize);
 
385
            }
 
386
        }
 
387
        else {
 
388
            for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) {
 
389
                if (pChild->viewable)
 
390
                    RegionAppend(&childUnion, &pChild->borderSize);
 
391
            }
 
392
        }
 
393
        RegionValidate(&childUnion, &overlap);
 
394
 
 
395
        for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) {
 
396
            if (pChild->viewable) {
 
397
                /*
 
398
                 * If the child is viewable, we want to remove its extents
 
399
                 * from the current universe, but we only re-clip it if
 
400
                 * it's been marked.
 
401
                 */
 
402
                if (pChild->valdata) {
 
403
                    /*
 
404
                     * Figure out the new universe from the child's
 
405
                     * perspective and recurse.
 
406
                     */
 
407
                    RegionIntersect(&childUniverse,
 
408
                                    universe, &pChild->borderSize);
 
409
                    RootlessComputeClips(pChild, pScreen, &childUniverse,
 
410
                                         kind, exposed);
 
411
                }
 
412
                /*
 
413
                 * Once the child has been processed, we remove its extents
 
414
                 * from the current universe, thus denying its space to any
 
415
                 * other sibling.
 
416
                 */
 
417
                if (overlap)
 
418
                    RegionSubtract(universe, universe, &pChild->borderSize);
 
419
            }
 
420
        }
 
421
        if (!overlap)
 
422
            RegionSubtract(universe, universe, &childUnion);
 
423
        RegionUninit(&childUnion);
 
424
        RegionUninit(&childUniverse);
 
425
    }                           /* if any children */
452
426
 
453
427
    /*
454
428
     * 'universe' now contains the new clipList for the parent window.
457
431
     * new, just as for the border.
458
432
     */
459
433
 
460
 
    if (oldVis == VisibilityFullyObscured ||
461
 
        oldVis == VisibilityNotViewable)
462
 
    {
463
 
        RegionCopy(&pParent->valdata->after.exposed, universe);
 
434
    if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) {
 
435
        RegionCopy(&pParent->valdata->after.exposed, universe);
464
436
    }
465
437
    else if (newVis != VisibilityFullyObscured &&
466
 
             newVis != VisibilityNotViewable)
467
 
    {
468
 
        RegionSubtract(&pParent->valdata->after.exposed,
469
 
                               universe, &pParent->clipList);
 
438
             newVis != VisibilityNotViewable) {
 
439
        RegionSubtract(&pParent->valdata->after.exposed,
 
440
                       universe, &pParent->clipList);
470
441
    }
471
442
 
472
443
    /* HACK ALERT - copying contents of regions, instead of regions */
473
444
    {
474
 
        RegionRec   tmp;
 
445
        RegionRec tmp;
475
446
 
476
 
        tmp = pParent->clipList;
477
 
        pParent->clipList = *universe;
478
 
        *universe = tmp;
 
447
        tmp = pParent->clipList;
 
448
        pParent->clipList = *universe;
 
449
        *universe = tmp;
479
450
    }
480
451
 
481
452
#ifdef NOTDEF
485
456
    pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
486
457
 
487
458
    if (pScreen->ClipNotify)
488
 
        (* pScreen->ClipNotify) (pParent, dx, dy);
 
459
        (*pScreen->ClipNotify) (pParent, dx, dy);
489
460
}
490
461
 
491
462
static void
492
463
RootlessTreeObscured(WindowPtr pParent)
493
464
{
494
465
    register WindowPtr pChild;
495
 
    register int    oldVis;
 
466
    register int oldVis;
496
467
 
497
468
    pChild = pParent;
498
 
    while (1)
499
 
    {
500
 
        if (pChild->viewable)
501
 
        {
502
 
            oldVis = pChild->visibility;
503
 
            if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
504
 
                ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
505
 
                SendVisibilityNotify(pChild);
506
 
            if (pChild->firstChild)
507
 
            {
508
 
                pChild = pChild->firstChild;
509
 
                continue;
510
 
            }
511
 
        }
512
 
        while (!pChild->nextSib && (pChild != pParent))
513
 
            pChild = pChild->parent;
514
 
        if (pChild == pParent)
515
 
            break;
516
 
        pChild = pChild->nextSib;
 
469
    while (1) {
 
470
        if (pChild->viewable) {
 
471
            oldVis = pChild->visibility;
 
472
            if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
 
473
                ((pChild->
 
474
                  eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
 
475
                SendVisibilityNotify(pChild);
 
476
            if (pChild->firstChild) {
 
477
                pChild = pChild->firstChild;
 
478
                continue;
 
479
            }
 
480
        }
 
481
        while (!pChild->nextSib && (pChild != pParent))
 
482
            pChild = pChild->parent;
 
483
        if (pChild == pParent)
 
484
            break;
 
485
        pChild = pChild->nextSib;
517
486
    }
518
487
}
519
488
 
551
520
   We need to make sure top-level windows don't clip each other, 
552
521
   and that top-level windows aren't clipped to the root window.
553
522
*/
554
 
/*ARGSUSED*/
 
523
 /*ARGSUSED*/
555
524
// fixme this is ugly
556
525
// Xprint/ValTree.c doesn't work, but maybe that method can?
557
 
int
558
 
RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */
559
 
                        WindowPtr pChild, /* First child of pRoot that was
560
 
                                           * affected */
561
 
                        VTKind kind /* What kind of configuration caused call */)
 
526
    int
 
527
RootlessMiValidateTree(WindowPtr pRoot, /* Parent to validate */
 
528
                       WindowPtr pChild,        /* First child of pRoot that was
 
529
                                                 * affected */
 
530
                       VTKind kind /* What kind of configuration caused call */
 
531
                       )
562
532
{
563
 
    RegionRec           childClip;  /* The new borderClip for the current
564
 
                                     * child */
565
 
    RegionRec           exposed;    /* For intermediate calculations */
566
 
    register ScreenPtr  pScreen;
567
 
    register WindowPtr  pWin;
 
533
    RegionRec childClip;        /* The new borderClip for the current
 
534
                                 * child */
 
535
    RegionRec exposed;          /* For intermediate calculations */
 
536
    register ScreenPtr pScreen;
 
537
    register WindowPtr pWin;
568
538
 
569
539
    pScreen = pRoot->drawable.pScreen;
570
540
    if (pChild == NullWindow)
571
 
        pChild = pRoot->firstChild;
 
541
        pChild = pRoot->firstChild;
572
542
 
573
543
    RegionNull(&childClip);
574
544
    RegionNull(&exposed);
575
545
 
576
 
    if (RegionBroken(&pRoot->clipList) &&
577
 
        !RegionBroken(&pRoot->borderClip))
578
 
    {
 
546
    if (RegionBroken(&pRoot->clipList) && !RegionBroken(&pRoot->borderClip)) {
579
547
        // fixme this might not work, but hopefully doesn't happen anyway.
580
548
        kind = VTBroken;
581
549
        RegionEmpty(&pRoot->clipList);
588
556
     * childClip is always reset to that child's size.
589
557
     */
590
558
 
591
 
    for (pWin = pChild;
592
 
         pWin != NullWindow;
593
 
         pWin = pWin->nextSib)
594
 
    {
 
559
    for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) {
595
560
        if (pWin->viewable) {
596
561
            if (pWin->valdata) {
597
562
                RegionCopy(&childClip, &pWin->borderSize);
598
 
                RootlessComputeClips (pWin, pScreen, &childClip, kind, &exposed);
599
 
            } else if (pWin->visibility == VisibilityNotViewable) {
 
563
                RootlessComputeClips(pWin, pScreen, &childClip, kind, &exposed);
 
564
            }
 
565
            else if (pWin->visibility == VisibilityNotViewable) {
600
566
                RootlessTreeObscured(pWin);
601
567
            }
602
 
        } else {
 
568
        }
 
569
        else {
603
570
            if (pWin->valdata) {
604
571
                RegionEmpty(&pWin->clipList);
605
572
                if (pScreen->ClipNotify)
606
 
                    (* pScreen->ClipNotify) (pWin, 0, 0);
 
573
                    (*pScreen->ClipNotify) (pWin, 0, 0);
607
574
                RegionEmpty(&pWin->borderClip);
608
575
                pWin->valdata = NULL;
609
576
            }