annotate src/video/Xext/extensions/extutil.h @ 2185:2032348afed1

This code adds support for DirectColor visuals to SDL 1.3. The support uses part of the Xmu library. To ensure that the library is available and to keep people form having to install yet another library I have added the essential parts of Xmu in src/video/extensions/XmuStdCmap and an include file in src/video/extensions. The support makes use of standard X11 mechanisms to create color maps and make sure that an application uses the same color map for each window/visual combination. This should make it possible for gamma support to be implemented based on a single color map per application. Hurm... it looks like "make indent" modified a few extra files. Those are getting committed too.
author Bob Pendleton <bob@pendleton.com>
date Thu, 12 Jul 2007 20:00:50 +0000
parents c121d94672cb
children
rev   line source
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * $Xorg: extutil.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 *
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 Copyright 1989, 1998 The Open Group
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 Permission to use, copy, modify, distribute, and sell this software and its
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 documentation for any purpose is hereby granted without fee, provided that
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 the above copyright notice appear in all copies and that both that
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 copyright notice and this permission notice appear in supporting
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 documentation.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 The above copyright notice and this permission notice shall be included in
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 all copies or substantial portions of the Software.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 Except as contained in this notice, the name of The Open Group shall not be
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 used in advertising or otherwise to promote the sale, use or other dealings
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 in this Software without prior written authorization from The Open Group.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 *
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 * Author: Jim Fulton, MIT The Open Group
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 *
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 * Xlib Extension-Writing Utilities
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 *
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 * This package contains utilities for writing the client API for various
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 * ARE SUBJECT TO CHANGE!
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 /* $XFree86: xc/include/extensions/extutil.h,v 1.9 2001/12/14 19:53:28 dawes Exp $ */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #ifndef _EXTUTIL_H_
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 #define _EXTUTIL_H_
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
39 #include "SDL_stdinc.h" /* For portable string functions */
1379
c0a74f199ecf Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents: 1168
diff changeset
40
1599
ecba4bbaf9c2 More dynamic X11 mangling...should fix NetBSD builds. And hopefully doesn't
Ryan C. Gordon <icculus@icculus.org>
parents: 1575
diff changeset
41 #include "./Xext.h"
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 /*
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 * We need to keep a list of open displays since the Xlib display list isn't
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 * public. We also have to per-display info in a separate block since it isn't
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 * stored directly in the Display structure.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
48 typedef struct _XExtDisplayInfo
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
49 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
50 struct _XExtDisplayInfo *next; /* keep a linked list */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
51 Display *display; /* which display this is */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
52 XExtCodes *codes; /* the extension protocol codes */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
53 XPointer data; /* extra data for extension to use */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 } XExtDisplayInfo;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
56 typedef struct _XExtensionInfo
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
57 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
58 XExtDisplayInfo *head; /* start of list */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
59 XExtDisplayInfo *cur; /* most recently used */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
60 int ndisplays; /* number of displays */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 } XExtensionInfo;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
63 typedef struct _XExtensionHooks
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
64 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
65 int (*create_gc) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
67 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
68 GC /* gc */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
69 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
71 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
72 int (*copy_gc) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
74 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
75 GC /* gc */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
76 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
78 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
79 int (*flush_gc) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
81 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
82 GC /* gc */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
83 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
85 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
86 int (*free_gc) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
88 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
89 GC /* gc */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
90 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
92 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
93 int (*create_font) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
95 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
96 XFontStruct * /* fs */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
97 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
99 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
100 int (*free_font) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
102 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
103 XFontStruct * /* fs */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
104 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
106 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
107 int (*close_display) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
109 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
110 XExtCodes * /* codes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
112 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
113 Bool(*wire_to_event) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
115 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
116 XEvent * /* re */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
117 xEvent * /* event */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
119 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
120 Status(*event_to_wire) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
122 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
123 XEvent * /* re */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
124 xEvent * /* event */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
126 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
127 int (*error) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
129 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
130 xError * /* err */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
131 XExtCodes * /* codes */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
132 int * /* ret_code */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
134 );
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
135 char *(*error_string) (
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 #if NeedNestedPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
137 Display * /* display */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
138 int /* code */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
139 XExtCodes * /* codes */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
140 char * /* buffer */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
141 int /* nbytes */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
143 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 } XExtensionHooks;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 extern XExtensionInfo *XextCreateExtension(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 #if NeedFunctionPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
148 void
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
150 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 extern void XextDestroyExtension(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 #if NeedFunctionPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
153 XExtensionInfo * /* info */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
155 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 extern XExtDisplayInfo *XextAddDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 #if NeedFunctionPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
158 XExtensionInfo * /* extinfo */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
159 Display * /* dpy */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
160 char * /* ext_name */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
161 XExtensionHooks * /* hooks */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
162 int /* nevents */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
163 XPointer /* data */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
165 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 extern int XextRemoveDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 #if NeedFunctionPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
168 XExtensionInfo * /* extinfo */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
169 Display * /* dpy */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
171 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 extern XExtDisplayInfo *XextFindDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 #if NeedFunctionPrototypes
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
174 XExtensionInfo * /* extinfo */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
175 Display * /* dpy */
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
177 );
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 #define XextHasExtension(i) ((i) && ((i)->codes))
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 #define XextCheckExtension(dpy,i,name,val) \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
181 if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 #define XextSimpleCheckExtension(dpy,i,name) \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
183 if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 /*
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 * helper macros to generate code that is common to all extensions; caller
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 * should prefix it with static if extension source is in one file; this
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 * could be a utility function, but have to stack 6 unused arguments for
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 * something that is called many, many times would be bad.
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 #define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 XExtDisplayInfo *proc (Display *dpy) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 { \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 XExtDisplayInfo *dpyinfo; \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
196 if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
197 if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
198 dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 return dpyinfo; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 }
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 #define XEXT_FIND_DISPLAY_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 XExtDisplayInfo *proc(Display *dpy)
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 int proc (Display *dpy, XExtCodes *codes) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 { \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
208 return XextRemoveDisplay (extinfo, dpy); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 }
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 #define XEXT_CLOSE_DISPLAY_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 int proc(Display *dpy, XExtCodes *codes)
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 #define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 { \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 code -= codes->first_error; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 if (code >= 0 && code < nerr) { \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 char tmp[256]; \
1379
c0a74f199ecf Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents: 1168
diff changeset
220 SDL_snprintf (tmp, SDL_arraysize(tmp), "%s.%d", extname, code); \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
221 XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 return buf; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 } \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 return (char *)0; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 }
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 #define XEXT_ERROR_STRING_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1599
diff changeset
230 /* vi: set ts=4 sw=4 expandtab: */