~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to cfb/cfballpriv.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Xorg: cfballpriv.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $
 
3
 *
 
4
Copyright 1991, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of The Open Group shall not be
 
23
used in advertising or otherwise to promote the sale, use or other dealings
 
24
in this Software without prior written authorization from The Open Group.
 
25
 *
 
26
 * Author:  Keith Packard, MIT X Consortium
 
27
 */
 
28
/* $XFree86: xc/programs/Xserver/cfb/cfballpriv.c,v 1.11 2001/01/30 22:06:15 tsi Exp $ */
 
29
 
 
30
#ifdef HAVE_DIX_CONFIG_H
 
31
#include <dix-config.h>
 
32
#endif
 
33
 
 
34
#include <X11/X.h>
 
35
#include <X11/Xmd.h>
 
36
#include "servermd.h"
 
37
#include "scrnintstr.h"
 
38
#include "pixmapstr.h"
 
39
#include "resource.h"
 
40
#include "colormap.h"
 
41
#include "colormapst.h"
 
42
#include "cfb.h"
 
43
#include "mi.h"
 
44
#include "mistruct.h"
 
45
#include "dix.h"
 
46
#include "cfbmskbits.h"
 
47
#include "mibstore.h"
 
48
 
 
49
#if 1 || PSZ==8
 
50
int cfbWindowPrivateIndex = -1;
 
51
int cfbGCPrivateIndex = -1;
 
52
#endif
 
53
#ifdef CFB_NEED_SCREEN_PRIVATE
 
54
int cfbScreenPrivateIndex = -1;
 
55
static unsigned long cfbGeneration = 0;
 
56
#endif
 
57
 
 
58
 
 
59
Bool
 
60
cfbAllocatePrivates(pScreen, window_index, gc_index)
 
61
    ScreenPtr   pScreen;
 
62
    int         *window_index, *gc_index;
 
63
{
 
64
    if (!window_index || !gc_index ||
 
65
        (*window_index == -1 && *gc_index == -1))
 
66
    {
 
67
        if (!mfbAllocatePrivates(pScreen,
 
68
                                 &cfbWindowPrivateIndex, &cfbGCPrivateIndex))
 
69
            return FALSE;
 
70
        if (window_index)
 
71
            *window_index = cfbWindowPrivateIndex;
 
72
        if (gc_index)
 
73
            *gc_index = cfbGCPrivateIndex;
 
74
    }
 
75
    else
 
76
    {
 
77
        cfbWindowPrivateIndex = *window_index;
 
78
        cfbGCPrivateIndex = *gc_index;
 
79
    }
 
80
    if (!AllocateWindowPrivate(pScreen, cfbWindowPrivateIndex,
 
81
                               sizeof(cfbPrivWin)) ||
 
82
        !AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
 
83
        return FALSE;
 
84
#ifdef CFB_NEED_SCREEN_PRIVATE
 
85
    if (cfbGeneration != serverGeneration)
 
86
    {
 
87
      cfbScreenPrivateIndex = AllocateScreenPrivateIndex ();
 
88
      cfbGeneration = serverGeneration;
 
89
    }
 
90
    if (cfbScreenPrivateIndex == -1)
 
91
        return FALSE;
 
92
#endif
 
93
    return TRUE;
 
94
}