~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to iplan2p4/iplwindow.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86: xc/programs/Xserver/iplan2p4/iplwindow.c,v 3.0tsi Exp $ */
2
 
/* $XConsortium: iplwindow.c,v 5.22 94/04/17 20:29:07 dpw Exp $ */
3
 
/***********************************************************
4
 
 
5
 
Copyright (c) 1987  X Consortium
6
 
 
7
 
Permission is hereby granted, free of charge, to any person obtaining a copy
8
 
of this software and associated documentation files (the "Software"), to deal
9
 
in the Software without restriction, including without limitation the rights
10
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
 
copies of the Software, and to permit persons to whom the Software is
12
 
furnished to do so, subject to the following conditions:
13
 
 
14
 
The above copyright notice and this permission notice shall be included in
15
 
all copies or substantial portions of the Software.
16
 
 
17
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20
 
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 
 
24
 
Except as contained in this notice, the name of the X Consortium shall not be
25
 
used in advertising or otherwise to promote the sale, use or other dealings
26
 
in this Software without prior written authorization from the X Consortium.
27
 
 
28
 
 
29
 
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30
 
 
31
 
                        All Rights Reserved
32
 
 
33
 
Permission to use, copy, modify, and distribute this software and its 
34
 
documentation for any purpose and without fee is hereby granted, 
35
 
provided that the above copyright notice appear in all copies and that
36
 
both that copyright notice and this permission notice appear in 
37
 
supporting documentation, and that the name of Digital not be
38
 
used in advertising or publicity pertaining to distribution of the
39
 
software without specific, written prior permission.  
40
 
 
41
 
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42
 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43
 
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45
 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46
 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47
 
SOFTWARE.
48
 
 
49
 
******************************************************************/
50
 
 
51
 
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
52
 
interleaved planes */
53
 
 
54
 
#ifdef HAVE_DIX_CONFIG_H
55
 
#include <dix-config.h>
56
 
#endif
57
 
 
58
 
#include <X11/X.h>
59
 
#include "scrnintstr.h"
60
 
#include "windowstr.h"
61
 
#include "ipl.h"
62
 
#include "mistruct.h"
63
 
#include "regionstr.h"
64
 
#include "iplmskbits.h"
65
 
 
66
 
extern WindowPtr *WindowTable;
67
 
 
68
 
Bool
69
 
iplCreateWindow(pWin)
70
 
    WindowPtr pWin;
71
 
{
72
 
    iplPrivWin *pPrivWin;
73
 
 
74
 
    pPrivWin = iplGetWindowPrivate(pWin);
75
 
    pPrivWin->pRotatedBorder = NullPixmap;
76
 
    pPrivWin->pRotatedBackground = NullPixmap;
77
 
    pPrivWin->fastBackground = FALSE;
78
 
    pPrivWin->fastBorder = FALSE;
79
 
    pPrivWin->oldRotate.x = 0;
80
 
    pPrivWin->oldRotate.y = 0;
81
 
 
82
 
#ifdef PIXMAP_PER_WINDOW
83
 
    /* Setup pointer to Screen pixmap */
84
 
    pWin->devPrivates[frameWindowPrivateIndex].ptr =
85
 
        (pointer) iplGetScreenPixmap(pWin->drawable.pScreen);
86
 
#endif
87
 
 
88
 
    return TRUE;
89
 
}
90
 
 
91
 
Bool
92
 
iplDestroyWindow(pWin)
93
 
    WindowPtr pWin;
94
 
{
95
 
    iplPrivWin *pPrivWin;
96
 
 
97
 
    pPrivWin = iplGetWindowPrivate(pWin);
98
 
 
99
 
    if (pPrivWin->pRotatedBorder)
100
 
        (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
101
 
    if (pPrivWin->pRotatedBackground)
102
 
        (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground);
103
 
    return(TRUE);
104
 
}
105
 
 
106
 
/*ARGSUSED*/
107
 
Bool
108
 
iplMapWindow(pWindow)
109
 
    WindowPtr pWindow;
110
 
{
111
 
    return(TRUE);
112
 
}
113
 
 
114
 
/* (x, y) is the upper left corner of the window on the screen 
115
 
   do we really need to pass this?  (is it a;ready in pWin->absCorner?)
116
 
   we only do the rotation for pixmaps that are 32 bits wide (padded
117
 
or otherwise.)
118
 
   iplChangeWindowAttributes() has already put a copy of the pixmap
119
 
in pPrivWin->pRotated*
120
 
*/
121
 
/*ARGSUSED*/
122
 
Bool
123
 
iplPositionWindow(pWin, x, y)
124
 
    WindowPtr pWin;
125
 
    int x, y;
126
 
{
127
 
    iplPrivWin *pPrivWin;
128
 
    int setxy = 0;
129
 
 
130
 
    pPrivWin = iplGetWindowPrivate(pWin);
131
 
    if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground)
132
 
    {
133
 
        iplXRotatePixmap(pPrivWin->pRotatedBackground,
134
 
                      pWin->drawable.x - pPrivWin->oldRotate.x);
135
 
        iplYRotatePixmap(pPrivWin->pRotatedBackground,
136
 
                      pWin->drawable.y - pPrivWin->oldRotate.y);
137
 
        setxy = 1;
138
 
    }
139
 
 
140
 
    if (!pWin->borderIsPixel && pPrivWin->fastBorder)
141
 
    {
142
 
        while (pWin->backgroundState == ParentRelative)
143
 
            pWin = pWin->parent;
144
 
        iplXRotatePixmap(pPrivWin->pRotatedBorder,
145
 
                      pWin->drawable.x - pPrivWin->oldRotate.x);
146
 
        iplYRotatePixmap(pPrivWin->pRotatedBorder,
147
 
                      pWin->drawable.y - pPrivWin->oldRotate.y);
148
 
        setxy = 1;
149
 
    }
150
 
    if (setxy)
151
 
    {
152
 
        pPrivWin->oldRotate.x = pWin->drawable.x;
153
 
        pPrivWin->oldRotate.y = pWin->drawable.y;
154
 
    }
155
 
    return (TRUE);
156
 
}
157
 
 
158
 
/*ARGSUSED*/
159
 
Bool
160
 
iplUnmapWindow(pWindow)
161
 
    WindowPtr pWindow;
162
 
{
163
 
    return (TRUE);
164
 
}
165
 
 
166
 
/* UNCLEAN!
167
 
   this code calls the bitblt helper code directly.
168
 
 
169
 
   iplCopyWindow copies only the parts of the destination that are
170
 
visible in the source.
171
 
*/
172
 
 
173
 
 
174
 
void 
175
 
iplCopyWindow(pWin, ptOldOrg, prgnSrc)
176
 
    WindowPtr pWin;
177
 
    DDXPointRec ptOldOrg;
178
 
    RegionPtr prgnSrc;
179
 
{
180
 
    DDXPointPtr pptSrc;
181
 
    register DDXPointPtr ppt;
182
 
    RegionRec rgnDst;
183
 
    register BoxPtr pbox;
184
 
    register int dx, dy;
185
 
    register int i, nbox;
186
 
    WindowPtr pwinRoot;
187
 
 
188
 
    pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
189
 
 
190
 
    REGION_NULL(pWin->drawable.pScreen, &rgnDst);
191
 
 
192
 
    dx = ptOldOrg.x - pWin->drawable.x;
193
 
    dy = ptOldOrg.y - pWin->drawable.y;
194
 
    REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
195
 
    REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
196
 
 
197
 
    pbox = REGION_RECTS(&rgnDst);
198
 
    nbox = REGION_NUM_RECTS(&rgnDst);
199
 
    if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
200
 
    {
201
 
        REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
202
 
        return;
203
 
    }
204
 
    ppt = pptSrc;
205
 
 
206
 
    for (i = nbox; --i >= 0; ppt++, pbox++)
207
 
    {
208
 
        ppt->x = pbox->x1 + dx;
209
 
        ppt->y = pbox->y1 + dy;
210
 
    }
211
 
 
212
 
    iplDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
213
 
                GXcopy, &rgnDst, pptSrc, ~0L);
214
 
    DEALLOCATE_LOCAL(pptSrc);
215
 
    REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
216
 
}
217
 
 
218
 
 
219
 
 
220
 
/* swap in correct PaintWindow* routine.  If we can use a fast output
221
 
routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
222
 
of it in devPrivates[iplWindowPrivateIndex].ptr.
223
 
*/
224
 
Bool
225
 
iplChangeWindowAttributes(pWin, mask)
226
 
    WindowPtr pWin;
227
 
    unsigned long mask;
228
 
{
229
 
    register unsigned long index;
230
 
    register iplPrivWin *pPrivWin;
231
 
    int width;
232
 
    WindowPtr   pBgWin;
233
 
 
234
 
    pPrivWin = iplGetWindowPrivate(pWin);
235
 
 
236
 
    /*
237
 
     * When background state changes from ParentRelative and
238
 
     * we had previously rotated the fast border pixmap to match
239
 
     * the parent relative origin, rerotate to match window
240
 
     */
241
 
    if (mask & (CWBackPixmap | CWBackPixel) &&
242
 
        pWin->backgroundState != ParentRelative &&
243
 
        pPrivWin->fastBorder &&
244
 
        (pPrivWin->oldRotate.x != pWin->drawable.x ||
245
 
         pPrivWin->oldRotate.y != pWin->drawable.y))
246
 
    {
247
 
        iplXRotatePixmap(pPrivWin->pRotatedBorder,
248
 
                      pWin->drawable.x - pPrivWin->oldRotate.x);
249
 
        iplYRotatePixmap(pPrivWin->pRotatedBorder,
250
 
                      pWin->drawable.y - pPrivWin->oldRotate.y);
251
 
        pPrivWin->oldRotate.x = pWin->drawable.x;
252
 
        pPrivWin->oldRotate.y = pWin->drawable.y;
253
 
    }
254
 
    while(mask)
255
 
    {
256
 
        index = lowbit (mask);
257
 
        mask &= ~index;
258
 
        switch(index)
259
 
        {
260
 
        case CWBackPixmap:
261
 
            if (pWin->backgroundState == None)
262
 
            {
263
 
                pPrivWin->fastBackground = FALSE;
264
 
            }
265
 
            else if (pWin->backgroundState == ParentRelative)
266
 
            {
267
 
                pPrivWin->fastBackground = FALSE;
268
 
                /* Rotate border to match parent origin */
269
 
                if (pPrivWin->pRotatedBorder) {
270
 
                    for (pBgWin = pWin->parent;
271
 
                         pBgWin->backgroundState == ParentRelative;
272
 
                         pBgWin = pBgWin->parent);
273
 
                    iplXRotatePixmap(pPrivWin->pRotatedBorder,
274
 
                                  pBgWin->drawable.x - pPrivWin->oldRotate.x);
275
 
                    iplYRotatePixmap(pPrivWin->pRotatedBorder,
276
 
                                  pBgWin->drawable.y - pPrivWin->oldRotate.y);
277
 
                    pPrivWin->oldRotate.x = pBgWin->drawable.x;
278
 
                    pPrivWin->oldRotate.y = pBgWin->drawable.y;
279
 
                }
280
 
            }
281
 
            else if (((width = (pWin->background.pixmap->drawable.width))
282
 
                      <= INTER_PGSZ) && !(width & (width - 1)))
283
 
            {
284
 
                iplCopyRotatePixmap(pWin->background.pixmap,
285
 
                                    &pPrivWin->pRotatedBackground,
286
 
                                    pWin->drawable.x,
287
 
                                    pWin->drawable.y);
288
 
                if (pPrivWin->pRotatedBackground)
289
 
                {
290
 
                    pPrivWin->fastBackground = TRUE;
291
 
                    pPrivWin->oldRotate.x = pWin->drawable.x;
292
 
                    pPrivWin->oldRotate.y = pWin->drawable.y;
293
 
                }
294
 
                else
295
 
                {
296
 
                    pPrivWin->fastBackground = FALSE;
297
 
                }
298
 
            }
299
 
            else
300
 
            {
301
 
                pPrivWin->fastBackground = FALSE;
302
 
            }
303
 
            break;
304
 
 
305
 
        case CWBackPixel:
306
 
            pPrivWin->fastBackground = FALSE;
307
 
            break;
308
 
 
309
 
        case CWBorderPixmap:
310
 
            if (((width = (pWin->border.pixmap->drawable.width)) <= INTER_PGSZ) &&
311
 
                !(width & (width - 1)))
312
 
            {
313
 
                for (pBgWin = pWin;
314
 
                     pBgWin->backgroundState == ParentRelative;
315
 
                     pBgWin = pBgWin->parent);
316
 
                iplCopyRotatePixmap(pWin->border.pixmap,
317
 
                                    &pPrivWin->pRotatedBorder,
318
 
                                    pBgWin->drawable.x,
319
 
                                    pBgWin->drawable.y);
320
 
                if (pPrivWin->pRotatedBorder)
321
 
                {
322
 
                    pPrivWin->fastBorder = TRUE;
323
 
                    pPrivWin->oldRotate.x = pBgWin->drawable.x;
324
 
                    pPrivWin->oldRotate.y = pBgWin->drawable.y;
325
 
                }
326
 
                else
327
 
                {
328
 
                    pPrivWin->fastBorder = FALSE;
329
 
                }
330
 
            }
331
 
            else
332
 
            {
333
 
                pPrivWin->fastBorder = FALSE;
334
 
            }
335
 
            break;
336
 
         case CWBorderPixel:
337
 
            pPrivWin->fastBorder = FALSE;
338
 
            break;
339
 
        }
340
 
    }
341
 
    return (TRUE);
342
 
}
343