annotate src/video/Xext/extensions/extutil.h @ 4249:429c8dd3175d SDL-1.2

Fixed bug #713 Don't clamp the mouse coordinates to the video surface size, instead clamp them to the last known window size. This allows users to get the correct mouse coordinates even if they don't call SDL_SetVideoMode() in response to an SDL_VIDEORESIZE event (used as a hack to retain the OpenGL context on Windows and Linux after a window resize)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 27 Sep 2009 05:18:43 +0000
parents ecba4bbaf9c2
children 782fd950bd46 c121d94672cb
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
1379
c0a74f199ecf Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents: 1168
diff changeset
39 #include "SDL_stdinc.h" /* For portable string functions */
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 */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 typedef struct _XExtDisplayInfo {
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 struct _XExtDisplayInfo *next; /* keep a linked list */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 Display *display; /* which display this is */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 XExtCodes *codes; /* the extension protocol codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 XPointer data; /* extra data for extension to use */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 } XExtDisplayInfo;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 typedef struct _XExtensionInfo {
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 XExtDisplayInfo *head; /* start of list */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 XExtDisplayInfo *cur; /* most recently used */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 int ndisplays; /* number of displays */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 } XExtensionInfo;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 typedef struct _XExtensionHooks {
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 int (*create_gc)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 GC /* gc */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 int (*copy_gc)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 GC /* gc */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 int (*flush_gc)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 GC /* gc */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 int (*free_gc)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 GC /* gc */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 int (*create_font)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 XFontStruct* /* fs */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 int (*free_font)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 XFontStruct* /* fs */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 int (*close_display)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 XExtCodes* /* codes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 Bool (*wire_to_event)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 XEvent* /* re */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 xEvent* /* event */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 Status (*event_to_wire)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 XEvent* /* re */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 xEvent* /* event */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 int (*error)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 xError* /* err */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 XExtCodes* /* codes */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 int* /* ret_code */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 char *(*error_string)(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 #if NeedNestedPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 Display* /* display */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 int /* code */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 XExtCodes* /* codes */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 char* /* buffer */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 int /* nbytes */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 } XExtensionHooks;
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 extern XExtensionInfo *XextCreateExtension(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 #if NeedFunctionPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 void
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 extern void XextDestroyExtension(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 #if NeedFunctionPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 XExtensionInfo* /* info */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 extern XExtDisplayInfo *XextAddDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 #if NeedFunctionPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 XExtensionInfo* /* extinfo */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 Display* /* dpy */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 char* /* ext_name */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 XExtensionHooks* /* hooks */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 int /* nevents */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 XPointer /* data */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 extern int XextRemoveDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 #if NeedFunctionPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 XExtensionInfo* /* extinfo */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 Display* /* dpy */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 extern XExtDisplayInfo *XextFindDisplay(
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 #if NeedFunctionPrototypes
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 XExtensionInfo* /* extinfo */,
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 Display* /* dpy */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 #endif
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 );
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 #define XextHasExtension(i) ((i) && ((i)->codes))
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 #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
178 if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 #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
180 if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 /*
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 * 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
185 * 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
186 * 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
187 * 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
188 */
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 #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
190 XExtDisplayInfo *proc (Display *dpy) \
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 XExtDisplayInfo *dpyinfo; \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
193 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
194 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
195 dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 return dpyinfo; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 }
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 #define XEXT_FIND_DISPLAY_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 XExtDisplayInfo *proc(Display *dpy)
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_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 int proc (Display *dpy, XExtCodes *codes) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 { \
1575
3ba88cb7eb1b Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents: 1379
diff changeset
205 return XextRemoveDisplay (extinfo, dpy); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 }
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 #define XEXT_CLOSE_DISPLAY_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 int proc(Display *dpy, XExtCodes *codes)
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_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 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
213 { \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 code -= codes->first_error; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 if (code >= 0 && code < nerr) { \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 char tmp[256]; \
1379
c0a74f199ecf Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents: 1168
diff changeset
217 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
218 XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
292
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 return buf; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 } \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 return (char *)0; \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 }
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 #define XEXT_ERROR_STRING_PROTO(proc) \
eadc0746dfaf Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 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
226 #endif