diff options
author | Franklin Wei <git@fwei.tk> | 2017-01-21 15:18:31 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-12-23 21:01:26 -0500 |
commit | a855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch) | |
tree | 8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/src/video/Xext | |
parent | 01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff) | |
download | rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip |
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL
for Rockbox.
Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/src/video/Xext')
23 files changed, 8525 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/video/Xext/README b/apps/plugins/sdl/src/video/Xext/README new file mode 100644 index 0000000000..a16ea68444 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/README | |||
@@ -0,0 +1,10 @@ | |||
1 | |||
2 | The reason these libraries are built outside of the standard XFree86 | ||
3 | tree is so that they can be linked as shared object code directly into | ||
4 | SDL without causing any symbol collisions with code in the application. | ||
5 | |||
6 | You can't link static library code into shared libraries on non-x86 | ||
7 | Linux platforms. Since these libraries haven't become standard yet, | ||
8 | we'll just include them directly. | ||
9 | |||
10 | These sources are synchronized with XFree86 4.2.1 | ||
diff --git a/apps/plugins/sdl/src/video/Xext/XME/xme.c b/apps/plugins/sdl/src/video/Xext/XME/xme.c new file mode 100644 index 0000000000..2cead35ada --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/XME/xme.c | |||
@@ -0,0 +1,410 @@ | |||
1 | /* | ||
2 | * Copyright 1993-2001 by Xi Graphics, Inc. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Please see the LICENSE file accompanying this distribution for licensing | ||
6 | * information. | ||
7 | * | ||
8 | * Please send any bug fixes and modifications to src@xig.com. | ||
9 | * | ||
10 | * $XiGId: xme.c,v 1.2 2001/11/30 21:56:59 jon Exp $ | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #define NEED_EVENTS | ||
15 | #define NEED_REPLIES | ||
16 | |||
17 | /* Apparently some X11 systems can't include this multiple times... */ | ||
18 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
19 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
20 | #include <X11/Xlibint.h> | ||
21 | #endif | ||
22 | |||
23 | #include <X11/Xthreads.h> | ||
24 | #include <X11/Xmd.h> | ||
25 | #include <X11/Xproto.h> | ||
26 | #include "../extensions/Xext.h" | ||
27 | #include "../extensions/extutil.h" | ||
28 | |||
29 | /*****************************************************************************/ | ||
30 | |||
31 | |||
32 | #define XIGMISC_PROTOCOL_NAME "XiG-SUNDRY-NONSTANDARD" | ||
33 | #define XIGMISC_MAJOR_VERSION 2 | ||
34 | #define XIGMISC_MINOR_VERSION 0 | ||
35 | |||
36 | #define XiGMiscNumberEvents 0 | ||
37 | |||
38 | #define X_XiGMiscQueryVersion 0 | ||
39 | #define X_XiGMiscQueryViews 1 | ||
40 | #define X_XiGMiscQueryResolutions 2 | ||
41 | #define X_XiGMiscChangeResolution 3 | ||
42 | #define X_XiGMiscFullScreen 4 | ||
43 | |||
44 | #define sz_xXiGMiscQueryVersionReq 8 | ||
45 | #define sz_xXiGMiscQueryViewsReq 8 | ||
46 | #define sz_xXiGMiscQueryResolutionsReq 8 | ||
47 | #define sz_xXiGMiscChangeResolutionReq 16 | ||
48 | #define sz_xXiGMiscFullScreenReq 16 | ||
49 | |||
50 | #define sz_xXiGMiscQueryVersionReply 32 | ||
51 | #define sz_xXiGMiscQueryViewsReply 32 | ||
52 | #define sz_xXiGMiscQueryResolutionsReply 32 | ||
53 | #define sz_xXiGMiscQueryFullScreenReply 32 | ||
54 | |||
55 | /*******************************************************************/ | ||
56 | |||
57 | typedef struct { | ||
58 | CARD8 reqType; /* always codes->major_opcode */ | ||
59 | CARD8 xigmiscReqType; /* always X_XiGMiscQueryVersion */ | ||
60 | CARD16 length; | ||
61 | CARD16 major; | ||
62 | CARD16 minor; | ||
63 | } xXiGMiscQueryVersionReq; | ||
64 | |||
65 | typedef struct { | ||
66 | CARD8 reqType; /* always codes->major_opcode */ | ||
67 | CARD8 xigmiscReqType; /* always X_XiGMiscQueryViews */ | ||
68 | CARD16 length; | ||
69 | CARD8 screen; | ||
70 | CARD8 pad0; | ||
71 | CARD16 pad1; | ||
72 | } xXiGMiscQueryViewsReq; | ||
73 | |||
74 | typedef struct { | ||
75 | CARD8 reqType; /* always codes->major_opcode */ | ||
76 | CARD8 xigmiscReqType; /* always X_XiGMiscQueryResolutions */ | ||
77 | CARD16 length; | ||
78 | CARD8 screen; | ||
79 | CARD8 view; | ||
80 | CARD16 pad0; | ||
81 | } xXiGMiscQueryResolutionsReq; | ||
82 | |||
83 | typedef struct { | ||
84 | CARD8 reqType; /* always codes->major_opcode */ | ||
85 | CARD8 xigmiscReqType; /* always X_XiGMiscChangeResolution */ | ||
86 | CARD16 length; | ||
87 | CARD8 screen; | ||
88 | CARD8 view; | ||
89 | CARD16 pad0; | ||
90 | CARD16 width; | ||
91 | CARD16 height; | ||
92 | INT32 refresh; | ||
93 | } xXiGMiscChangeResolutionReq; | ||
94 | |||
95 | typedef struct { | ||
96 | CARD8 reqType; /* always codes->major_opcode */ | ||
97 | CARD8 xigmiscReqType; /* always X_XiGMiscFullScreen */ | ||
98 | CARD16 length; | ||
99 | CARD8 screen; | ||
100 | CARD8 pad0; | ||
101 | CARD16 pad1; | ||
102 | CARD32 window; | ||
103 | CARD32 cmap; | ||
104 | } xXiGMiscFullScreenReq; | ||
105 | |||
106 | /*******************************************************************/ | ||
107 | |||
108 | typedef struct { | ||
109 | BYTE type; /* X_Reply */ | ||
110 | CARD8 pad0; | ||
111 | CARD16 sequenceNumber; | ||
112 | CARD32 length; | ||
113 | CARD16 major; | ||
114 | CARD16 minor; | ||
115 | CARD32 pad1; | ||
116 | CARD32 pad2; | ||
117 | CARD32 pad3; | ||
118 | CARD32 pad4; | ||
119 | CARD32 pad5; | ||
120 | } xXiGMiscQueryVersionReply; | ||
121 | |||
122 | typedef struct { | ||
123 | BYTE type; /* X_Reply */ | ||
124 | CARD8 pad0; | ||
125 | CARD16 sequenceNumber; | ||
126 | CARD32 length; | ||
127 | CARD32 nviews; | ||
128 | CARD32 pad1; | ||
129 | CARD32 pad2; | ||
130 | CARD32 pad3; | ||
131 | CARD32 pad4; | ||
132 | CARD32 pad5; | ||
133 | } xXiGMiscQueryViewsReply; | ||
134 | |||
135 | typedef struct { | ||
136 | BYTE type; /* X_Reply */ | ||
137 | CARD8 pad0; | ||
138 | CARD16 sequenceNumber; | ||
139 | CARD32 length; | ||
140 | CARD16 active; | ||
141 | CARD16 nresolutions; | ||
142 | CARD32 pad1; | ||
143 | CARD32 pad2; | ||
144 | CARD32 pad3; | ||
145 | CARD32 pad4; | ||
146 | CARD32 pad5; | ||
147 | } xXiGMiscQueryResolutionsReply; | ||
148 | |||
149 | typedef struct { | ||
150 | BYTE type; /* X_Reply */ | ||
151 | BOOL success; | ||
152 | CARD16 sequenceNumber; | ||
153 | CARD32 length; | ||
154 | CARD32 pad1; | ||
155 | CARD32 pad2; | ||
156 | CARD32 pad3; | ||
157 | CARD32 pad4; | ||
158 | CARD32 pad5; | ||
159 | CARD32 pad6; | ||
160 | } xXiGMiscFullScreenReply; | ||
161 | |||
162 | /*******************************************************************/ | ||
163 | |||
164 | typedef struct { | ||
165 | INT16 x; | ||
166 | INT16 y; | ||
167 | CARD16 w; | ||
168 | CARD16 h; | ||
169 | } XiGMiscViewInfo; | ||
170 | |||
171 | typedef struct { | ||
172 | CARD16 width; | ||
173 | CARD16 height; | ||
174 | INT32 refresh; | ||
175 | } XiGMiscResolutionInfo; | ||
176 | |||
177 | /*****************************************************************************/ | ||
178 | |||
179 | static XExtensionInfo *xigmisc_info = NULL; | ||
180 | static char *xigmisc_extension_name = XIGMISC_PROTOCOL_NAME; | ||
181 | |||
182 | #define XiGMiscCheckExtension(dpy,i,val) \ | ||
183 | XextCheckExtension (dpy, i, xigmisc_extension_name, val) | ||
184 | #define XiGMiscSimpleCheckExtension(dpy,i) \ | ||
185 | XextSimpleCheckExtension (dpy, i, xigmisc_extension_name) | ||
186 | |||
187 | #if defined(__STDC__) && !defined(UNIXCPP) | ||
188 | #define XiGMiscGetReq(name,req,info) GetReq (name, req); \ | ||
189 | req->reqType = info->codes->major_opcode; \ | ||
190 | req->xigmiscReqType = X_##name; | ||
191 | |||
192 | #define XiGMiscGetReqExtra(name,n,req,info) GetReqExtra (name, n, req); \ | ||
193 | req->reqType = info->codes->major_opcode; \ | ||
194 | req->xigmicReqType = X_##name; | ||
195 | #else | ||
196 | #define XiGMiscGetReq(name,req,info) GetReq (name, req); \ | ||
197 | req->reqType = info->codes->major_opcode; \ | ||
198 | req->xigmiscReqType = X_/**/name; | ||
199 | #define XiGMiscGetReqExtra(name,n,req,info) GetReqExtra (name, n, req); \ | ||
200 | req->reqType = info->codes->major_opcode; \ | ||
201 | req->xigmiscReqType = X_/**/name; | ||
202 | #endif | ||
203 | |||
204 | |||
205 | |||
206 | /* | ||
207 | * find_display - locate the display info block | ||
208 | */ | ||
209 | static int XiGMiscCloseDisplay(); | ||
210 | |||
211 | static XExtensionHooks xigmisc_extension_hooks = { | ||
212 | NULL, /* create_gc */ | ||
213 | NULL, /* copy_gc */ | ||
214 | NULL, /* flush_gc */ | ||
215 | NULL, /* free_gc */ | ||
216 | NULL, /* create_font */ | ||
217 | NULL, /* free_font */ | ||
218 | XiGMiscCloseDisplay, /* close_display */ | ||
219 | NULL, /* wire_to_event */ | ||
220 | NULL, /* event_to_wire */ | ||
221 | NULL, /* error */ | ||
222 | NULL, /* error_string */ | ||
223 | }; | ||
224 | |||
225 | |||
226 | static XEXT_GENERATE_CLOSE_DISPLAY (XiGMiscCloseDisplay, xigmisc_info) | ||
227 | |||
228 | static XEXT_GENERATE_FIND_DISPLAY (XiGMiscFindDisplay, xigmisc_info, | ||
229 | xigmisc_extension_name, | ||
230 | &xigmisc_extension_hooks, XiGMiscNumberEvents, NULL) | ||
231 | |||
232 | |||
233 | /*****************************************************************************/ | ||
234 | |||
235 | Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor) | ||
236 | { | ||
237 | int opcode, event, error; | ||
238 | xXiGMiscQueryVersionReq *req; | ||
239 | xXiGMiscQueryVersionReply rep; | ||
240 | XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); | ||
241 | |||
242 | if (!XQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error)) | ||
243 | return xFalse; | ||
244 | |||
245 | XiGMiscCheckExtension(dpy, info, xFalse); | ||
246 | |||
247 | LockDisplay (dpy); | ||
248 | XiGMiscGetReq (XiGMiscQueryVersion, req, info); | ||
249 | |||
250 | req->major = XIGMISC_MAJOR_VERSION; | ||
251 | req->minor = XIGMISC_MINOR_VERSION; | ||
252 | |||
253 | if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { | ||
254 | UnlockDisplay(dpy); | ||
255 | SyncHandle(); | ||
256 | return xFalse; | ||
257 | } | ||
258 | |||
259 | *major = rep.major; | ||
260 | *minor = rep.minor; | ||
261 | UnlockDisplay(dpy); | ||
262 | SyncHandle(); | ||
263 | |||
264 | return xTrue; | ||
265 | } | ||
266 | |||
267 | int XiGMiscQueryViews(Display *dpy, int screen, XiGMiscViewInfo **pviews) | ||
268 | { | ||
269 | int n, size; | ||
270 | XiGMiscViewInfo *views; | ||
271 | xXiGMiscQueryViewsReq *req; | ||
272 | xXiGMiscQueryViewsReply rep; | ||
273 | XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); | ||
274 | XiGMiscCheckExtension(dpy, info, 0); | ||
275 | |||
276 | LockDisplay (dpy); | ||
277 | XiGMiscGetReq (XiGMiscQueryViews, req, info); | ||
278 | req->screen = screen; | ||
279 | |||
280 | if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { | ||
281 | UnlockDisplay(dpy); | ||
282 | SyncHandle(); | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | n = rep.nviews; | ||
287 | |||
288 | if (n > 0) { | ||
289 | size = sizeof(XiGMiscViewInfo) * n; | ||
290 | views = (XiGMiscViewInfo*)Xmalloc(size); | ||
291 | if (!views) { | ||
292 | _XEatData(dpy, (unsigned long)size); | ||
293 | UnlockDisplay(dpy); | ||
294 | SyncHandle(); | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | _XReadPad(dpy, (void*)views, size); | ||
299 | |||
300 | *pviews = views; | ||
301 | } | ||
302 | |||
303 | UnlockDisplay(dpy); | ||
304 | SyncHandle(); | ||
305 | |||
306 | return n; | ||
307 | } | ||
308 | |||
309 | int XiGMiscQueryResolutions(Display *dpy, int screen, int view, int *pactive, XiGMiscResolutionInfo **presolutions) | ||
310 | { | ||
311 | int n, size; | ||
312 | XiGMiscResolutionInfo *resolutions; | ||
313 | xXiGMiscQueryResolutionsReq *req; | ||
314 | xXiGMiscQueryResolutionsReply rep; | ||
315 | XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); | ||
316 | XiGMiscCheckExtension(dpy, info, 0); | ||
317 | |||
318 | LockDisplay (dpy); | ||
319 | XiGMiscGetReq (XiGMiscQueryResolutions, req, info); | ||
320 | req->screen = screen; | ||
321 | req->view = view; | ||
322 | |||
323 | if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { | ||
324 | UnlockDisplay(dpy); | ||
325 | SyncHandle(); | ||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | n = rep.nresolutions; | ||
330 | |||
331 | if (n > 0) { | ||
332 | size = sizeof(XiGMiscResolutionInfo) * n; | ||
333 | resolutions = (XiGMiscResolutionInfo*)Xmalloc(size); | ||
334 | if (!resolutions) { | ||
335 | _XEatData(dpy, (unsigned long)size); | ||
336 | UnlockDisplay(dpy); | ||
337 | SyncHandle(); | ||
338 | return 0; | ||
339 | } | ||
340 | |||
341 | _XReadPad(dpy, (void*)resolutions, size); | ||
342 | |||
343 | *presolutions = resolutions; | ||
344 | *pactive = rep.active; | ||
345 | } | ||
346 | |||
347 | UnlockDisplay(dpy); | ||
348 | SyncHandle(); | ||
349 | |||
350 | return n; | ||
351 | } | ||
352 | |||
353 | void XiGMiscChangeResolution(Display *dpy, int screen, int view, int width, int height, int refresh) | ||
354 | { | ||
355 | xXiGMiscChangeResolutionReq *req; | ||
356 | XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); | ||
357 | |||
358 | XiGMiscSimpleCheckExtension(dpy, info); | ||
359 | |||
360 | LockDisplay (dpy); | ||
361 | XiGMiscGetReq (XiGMiscChangeResolution, req, info); | ||
362 | req->screen = screen; | ||
363 | req->view = view; | ||
364 | req->width = width; | ||
365 | req->height = height; | ||
366 | req->refresh = refresh; | ||
367 | |||
368 | UnlockDisplay(dpy); | ||
369 | SyncHandle(); | ||
370 | } | ||
371 | |||
372 | |||
373 | Bool XiGMiscFullScreen(Display *dpy, int screen, XID window, XID cmap) | ||
374 | { | ||
375 | xXiGMiscFullScreenReq *req; | ||
376 | xXiGMiscFullScreenReply rep; | ||
377 | XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); | ||
378 | |||
379 | XiGMiscCheckExtension(dpy, info, xFalse); | ||
380 | |||
381 | LockDisplay (dpy); | ||
382 | XiGMiscGetReq (XiGMiscFullScreen, req, info); | ||
383 | req->screen = screen; | ||
384 | req->pad0 = 0; | ||
385 | req->pad1 = 0; | ||
386 | req->window = window; | ||
387 | req->cmap = cmap; | ||
388 | |||
389 | if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { | ||
390 | UnlockDisplay(dpy); | ||
391 | SyncHandle(); | ||
392 | return xFalse; | ||
393 | } | ||
394 | |||
395 | UnlockDisplay(dpy); | ||
396 | SyncHandle(); | ||
397 | |||
398 | return (rep.success ? xTrue : xFalse); | ||
399 | } | ||
400 | |||
401 | |||
402 | /* SDL addition from Ryan: free memory used by xme. */ | ||
403 | void XiGMiscDestroy(void) | ||
404 | { | ||
405 | if (xigmisc_info) { | ||
406 | XextDestroyExtension(xigmisc_info); | ||
407 | xigmisc_info = NULL; | ||
408 | } | ||
409 | } | ||
410 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/Xinerama/Xinerama.c b/apps/plugins/sdl/src/video/Xext/Xinerama/Xinerama.c new file mode 100644 index 0000000000..4ff42ebfe9 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xinerama/Xinerama.c | |||
@@ -0,0 +1,324 @@ | |||
1 | /* $Xorg: XPanoramiX.c,v 1.4 2000/08/17 19:45:51 cpqbld Exp $ */ | ||
2 | /***************************************************************** | ||
3 | Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | of this software and associated documentation files (the "Software"), to deal | ||
6 | in the Software without restriction, including without limitation the rights | ||
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | copies of the Software. | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
16 | DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, | ||
17 | BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, | ||
18 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
19 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
20 | |||
21 | Except as contained in this notice, the name of Digital Equipment Corporation | ||
22 | shall not be used in advertising or otherwise to promote the sale, use or other | ||
23 | dealings in this Software without prior written authorization from Digital | ||
24 | Equipment Corporation. | ||
25 | ******************************************************************/ | ||
26 | /* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.2 2001/07/23 17:20:28 dawes Exp $ */ | ||
27 | |||
28 | #define NEED_EVENTS | ||
29 | #define NEED_REPLIES | ||
30 | |||
31 | /* Apparently some X11 systems can't include this multiple times... */ | ||
32 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
33 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
34 | #include <X11/Xlibint.h> | ||
35 | #endif | ||
36 | |||
37 | #include <X11/Xutil.h> | ||
38 | #include "../extensions/Xext.h" | ||
39 | #include "../extensions/extutil.h" /* in ../include */ | ||
40 | #include "../extensions/panoramiXext.h" | ||
41 | #include "../extensions/panoramiXproto.h" /* in ../include */ | ||
42 | #include "../extensions/Xinerama.h" | ||
43 | |||
44 | static XExtensionInfo _panoramiX_ext_info_data; | ||
45 | static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data; | ||
46 | static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME; | ||
47 | |||
48 | #define PanoramiXCheckExtension(dpy,i,val) \ | ||
49 | XextCheckExtension (dpy, i, panoramiX_extension_name, val) | ||
50 | #define PanoramiXSimpleCheckExtension(dpy,i) \ | ||
51 | XextSimpleCheckExtension (dpy, i, panoramiX_extension_name) | ||
52 | |||
53 | static int close_display(); | ||
54 | static /* const */ XExtensionHooks panoramiX_extension_hooks = { | ||
55 | NULL, /* create_gc */ | ||
56 | NULL, /* copy_gc */ | ||
57 | NULL, /* flush_gc */ | ||
58 | NULL, /* free_gc */ | ||
59 | NULL, /* create_font */ | ||
60 | NULL, /* free_font */ | ||
61 | close_display, /* close_display */ | ||
62 | NULL, /* wire_to_event */ | ||
63 | NULL, /* event_to_wire */ | ||
64 | NULL, /* error */ | ||
65 | NULL, /* error_string */ | ||
66 | }; | ||
67 | |||
68 | static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info, | ||
69 | panoramiX_extension_name, | ||
70 | &panoramiX_extension_hooks, | ||
71 | 0, NULL) | ||
72 | |||
73 | static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info) | ||
74 | |||
75 | |||
76 | |||
77 | /**************************************************************************** | ||
78 | * * | ||
79 | * PanoramiX public interfaces * | ||
80 | * * | ||
81 | ****************************************************************************/ | ||
82 | |||
83 | Bool SDL_NAME(XPanoramiXQueryExtension) ( | ||
84 | Display *dpy, | ||
85 | int *event_basep, | ||
86 | int *error_basep | ||
87 | ) | ||
88 | { | ||
89 | XExtDisplayInfo *info = find_display (dpy); | ||
90 | |||
91 | if (XextHasExtension(info)) { | ||
92 | *event_basep = info->codes->first_event; | ||
93 | *error_basep = info->codes->first_error; | ||
94 | return True; | ||
95 | } else { | ||
96 | return False; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | |||
101 | Status SDL_NAME(XPanoramiXQueryVersion)( | ||
102 | Display *dpy, | ||
103 | int *major_versionp, | ||
104 | int *minor_versionp | ||
105 | ) | ||
106 | { | ||
107 | XExtDisplayInfo *info = find_display (dpy); | ||
108 | xPanoramiXQueryVersionReply rep; | ||
109 | register xPanoramiXQueryVersionReq *req; | ||
110 | |||
111 | PanoramiXCheckExtension (dpy, info, 0); | ||
112 | |||
113 | LockDisplay (dpy); | ||
114 | GetReq (PanoramiXQueryVersion, req); | ||
115 | req->reqType = info->codes->major_opcode; | ||
116 | req->panoramiXReqType = X_PanoramiXQueryVersion; | ||
117 | req->clientMajor = PANORAMIX_MAJOR_VERSION; | ||
118 | req->clientMinor = PANORAMIX_MINOR_VERSION; | ||
119 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
120 | UnlockDisplay (dpy); | ||
121 | SyncHandle (); | ||
122 | return 0; | ||
123 | } | ||
124 | *major_versionp = rep.majorVersion; | ||
125 | *minor_versionp = rep.minorVersion; | ||
126 | UnlockDisplay (dpy); | ||
127 | SyncHandle (); | ||
128 | return 1; | ||
129 | } | ||
130 | |||
131 | SDL_NAME(XPanoramiXInfo) *SDL_NAME(XPanoramiXAllocInfo)(void) | ||
132 | { | ||
133 | return (SDL_NAME(XPanoramiXInfo) *) Xmalloc (sizeof (SDL_NAME(XPanoramiXInfo))); | ||
134 | } | ||
135 | |||
136 | Status SDL_NAME(XPanoramiXGetState) ( | ||
137 | Display *dpy, | ||
138 | Drawable drawable, | ||
139 | SDL_NAME(XPanoramiXInfo) *panoramiX_info | ||
140 | ) | ||
141 | { | ||
142 | XExtDisplayInfo *info = find_display (dpy); | ||
143 | xPanoramiXGetStateReply rep; | ||
144 | register xPanoramiXGetStateReq *req; | ||
145 | |||
146 | PanoramiXCheckExtension (dpy, info, 0); | ||
147 | |||
148 | LockDisplay (dpy); | ||
149 | GetReq (PanoramiXGetState, req); | ||
150 | req->reqType = info->codes->major_opcode; | ||
151 | req->panoramiXReqType = X_PanoramiXGetState; | ||
152 | req->window = drawable; | ||
153 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
154 | UnlockDisplay (dpy); | ||
155 | SyncHandle (); | ||
156 | return 0; | ||
157 | } | ||
158 | UnlockDisplay (dpy); | ||
159 | SyncHandle (); | ||
160 | panoramiX_info->window = rep.window; | ||
161 | panoramiX_info->State = rep.state; | ||
162 | return 1; | ||
163 | } | ||
164 | |||
165 | Status SDL_NAME(XPanoramiXGetScreenCount) ( | ||
166 | Display *dpy, | ||
167 | Drawable drawable, | ||
168 | SDL_NAME(XPanoramiXInfo) *panoramiX_info | ||
169 | ) | ||
170 | { | ||
171 | XExtDisplayInfo *info = find_display (dpy); | ||
172 | xPanoramiXGetScreenCountReply rep; | ||
173 | register xPanoramiXGetScreenCountReq *req; | ||
174 | |||
175 | PanoramiXCheckExtension (dpy, info, 0); | ||
176 | |||
177 | LockDisplay (dpy); | ||
178 | GetReq (PanoramiXGetScreenCount, req); | ||
179 | req->reqType = info->codes->major_opcode; | ||
180 | req->panoramiXReqType = X_PanoramiXGetScreenCount; | ||
181 | req->window = drawable; | ||
182 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
183 | UnlockDisplay (dpy); | ||
184 | SyncHandle (); | ||
185 | return 0; | ||
186 | } | ||
187 | UnlockDisplay (dpy); | ||
188 | SyncHandle (); | ||
189 | panoramiX_info->window = rep.window; | ||
190 | panoramiX_info->ScreenCount = rep.ScreenCount; | ||
191 | return 1; | ||
192 | } | ||
193 | |||
194 | Status SDL_NAME(XPanoramiXGetScreenSize) ( | ||
195 | Display *dpy, | ||
196 | Drawable drawable, | ||
197 | int screen_num, | ||
198 | SDL_NAME(XPanoramiXInfo) *panoramiX_info | ||
199 | ) | ||
200 | { | ||
201 | XExtDisplayInfo *info = find_display (dpy); | ||
202 | xPanoramiXGetScreenSizeReply rep; | ||
203 | register xPanoramiXGetScreenSizeReq *req; | ||
204 | |||
205 | PanoramiXCheckExtension (dpy, info, 0); | ||
206 | |||
207 | LockDisplay (dpy); | ||
208 | GetReq (PanoramiXGetScreenSize, req); | ||
209 | req->reqType = info->codes->major_opcode; | ||
210 | req->panoramiXReqType = X_PanoramiXGetScreenSize; | ||
211 | req->window = drawable; | ||
212 | req->screen = screen_num; /* need to define */ | ||
213 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
214 | UnlockDisplay (dpy); | ||
215 | SyncHandle (); | ||
216 | return 0; | ||
217 | } | ||
218 | UnlockDisplay (dpy); | ||
219 | SyncHandle (); | ||
220 | panoramiX_info->window = rep.window; | ||
221 | panoramiX_info->screen = rep.screen; | ||
222 | panoramiX_info->width = rep.width; | ||
223 | panoramiX_info->height = rep.height; | ||
224 | return 1; | ||
225 | } | ||
226 | |||
227 | /*******************************************************************\ | ||
228 | Alternate interface to make up for shortcomings in the original, | ||
229 | namely, the omission of the screen origin. The new interface is | ||
230 | in the "Xinerama" namespace instead of "PanoramiX". | ||
231 | \*******************************************************************/ | ||
232 | |||
233 | Bool SDL_NAME(XineramaQueryExtension) ( | ||
234 | Display *dpy, | ||
235 | int *event_base, | ||
236 | int *error_base | ||
237 | ) | ||
238 | { | ||
239 | return SDL_NAME(XPanoramiXQueryExtension)(dpy, event_base, error_base); | ||
240 | } | ||
241 | |||
242 | Status SDL_NAME(XineramaQueryVersion)( | ||
243 | Display *dpy, | ||
244 | int *major, | ||
245 | int *minor | ||
246 | ) | ||
247 | { | ||
248 | return SDL_NAME(XPanoramiXQueryVersion)(dpy, major, minor); | ||
249 | } | ||
250 | |||
251 | Bool SDL_NAME(XineramaIsActive)(Display *dpy) | ||
252 | { | ||
253 | xXineramaIsActiveReply rep; | ||
254 | xXineramaIsActiveReq *req; | ||
255 | XExtDisplayInfo *info = find_display (dpy); | ||
256 | |||
257 | if(!XextHasExtension(info)) | ||
258 | return False; /* server doesn't even have the extension */ | ||
259 | |||
260 | LockDisplay (dpy); | ||
261 | GetReq (XineramaIsActive, req); | ||
262 | req->reqType = info->codes->major_opcode; | ||
263 | req->panoramiXReqType = X_XineramaIsActive; | ||
264 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
265 | UnlockDisplay (dpy); | ||
266 | SyncHandle (); | ||
267 | return False; | ||
268 | } | ||
269 | UnlockDisplay (dpy); | ||
270 | SyncHandle (); | ||
271 | return rep.state; | ||
272 | } | ||
273 | |||
274 | #include <stdio.h> | ||
275 | |||
276 | SDL_NAME(XineramaScreenInfo) * | ||
277 | SDL_NAME(XineramaQueryScreens)( | ||
278 | Display *dpy, | ||
279 | int *number | ||
280 | ) | ||
281 | { | ||
282 | XExtDisplayInfo *info = find_display (dpy); | ||
283 | xXineramaQueryScreensReply rep; | ||
284 | xXineramaQueryScreensReq *req; | ||
285 | SDL_NAME(XineramaScreenInfo) *scrnInfo = NULL; | ||
286 | |||
287 | PanoramiXCheckExtension (dpy, info, 0); | ||
288 | |||
289 | LockDisplay (dpy); | ||
290 | GetReq (XineramaQueryScreens, req); | ||
291 | req->reqType = info->codes->major_opcode; | ||
292 | req->panoramiXReqType = X_XineramaQueryScreens; | ||
293 | if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { | ||
294 | UnlockDisplay (dpy); | ||
295 | SyncHandle (); | ||
296 | return NULL; | ||
297 | } | ||
298 | |||
299 | if(rep.number) { | ||
300 | if((scrnInfo = Xmalloc(sizeof(SDL_NAME(XineramaScreenInfo)) * rep.number))) { | ||
301 | xXineramaScreenInfo scratch; | ||
302 | int i; | ||
303 | |||
304 | for(i = 0; i < rep.number; i++) { | ||
305 | _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo); | ||
306 | scrnInfo[i].screen_number = i; | ||
307 | scrnInfo[i].x_org = scratch.x_org; | ||
308 | scrnInfo[i].y_org = scratch.y_org; | ||
309 | scrnInfo[i].width = scratch.width; | ||
310 | scrnInfo[i].height = scratch.height; | ||
311 | } | ||
312 | |||
313 | *number = rep.number; | ||
314 | } else | ||
315 | _XEatData(dpy, rep.length << 2); | ||
316 | } | ||
317 | |||
318 | UnlockDisplay (dpy); | ||
319 | SyncHandle (); | ||
320 | return scrnInfo; | ||
321 | } | ||
322 | |||
323 | |||
324 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/Xv/Xv.c b/apps/plugins/sdl/src/video/Xext/Xv/Xv.c new file mode 100644 index 0000000000..7147b9e8cb --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xv/Xv.c | |||
@@ -0,0 +1,1151 @@ | |||
1 | /*********************************************************** | ||
2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, | ||
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | ||
4 | |||
5 | All Rights Reserved | ||
6 | |||
7 | Permission to use, copy, modify, and distribute this software and its | ||
8 | documentation for any purpose and without fee is hereby granted, | ||
9 | provided that the above copyright notice appear in all copies and that | ||
10 | both that copyright notice and this permission notice appear in | ||
11 | supporting documentation, and that the names of Digital or MIT not be | ||
12 | used in advertising or publicity pertaining to distribution of the | ||
13 | software without specific, written prior permission. | ||
14 | |||
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
21 | SOFTWARE. | ||
22 | |||
23 | ******************************************************************/ | ||
24 | /* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */ | ||
25 | /* | ||
26 | ** File: | ||
27 | ** | ||
28 | ** Xv.c --- Xv library extension module. | ||
29 | ** | ||
30 | ** Author: | ||
31 | ** | ||
32 | ** David Carver (Digital Workstation Engineering/Project Athena) | ||
33 | ** | ||
34 | ** Revisions: | ||
35 | ** | ||
36 | ** 26.06.91 Carver | ||
37 | ** - changed XvFreeAdaptors to XvFreeAdaptorInfo | ||
38 | ** - changed XvFreeEncodings to XvFreeEncodingInfo | ||
39 | ** | ||
40 | ** 11.06.91 Carver | ||
41 | ** - changed SetPortControl to SetPortAttribute | ||
42 | ** - changed GetPortControl to GetPortAttribute | ||
43 | ** - changed QueryBestSize | ||
44 | ** | ||
45 | ** 15.05.91 Carver | ||
46 | ** - version 2.0 upgrade | ||
47 | ** | ||
48 | ** 240.01.91 Carver | ||
49 | ** - version 1.4 upgrade | ||
50 | ** | ||
51 | */ | ||
52 | |||
53 | #include <stdio.h> | ||
54 | #include "Xvlibint.h" | ||
55 | #include "../extensions/Xext.h" | ||
56 | #include <X11/extensions/XShm.h> | ||
57 | #include "../extensions/extutil.h" | ||
58 | |||
59 | static XExtensionInfo _xv_info_data; | ||
60 | static XExtensionInfo *xv_info = &_xv_info_data; | ||
61 | static char *xv_extension_name = XvName; | ||
62 | |||
63 | #define XvCheckExtension(dpy, i, val) \ | ||
64 | XextCheckExtension(dpy, i, xv_extension_name, val) | ||
65 | |||
66 | static char *xv_error_string(); | ||
67 | static int xv_close_display(); | ||
68 | static Bool xv_wire_to_event(); | ||
69 | |||
70 | static XExtensionHooks xv_extension_hooks = { | ||
71 | NULL, /* create_gc */ | ||
72 | NULL, /* copy_gc */ | ||
73 | NULL, /* flush_gc */ | ||
74 | NULL, /* free_gc */ | ||
75 | NULL, /* create_font */ | ||
76 | NULL, /* free_font */ | ||
77 | xv_close_display, /* close_display */ | ||
78 | xv_wire_to_event, /* wire_to_event */ | ||
79 | NULL, /* event_to_wire */ | ||
80 | NULL, /* error */ | ||
81 | xv_error_string /* error_string */ | ||
82 | }; | ||
83 | |||
84 | |||
85 | static char *xv_error_list[] = | ||
86 | { | ||
87 | "BadPort", /* XvBadPort */ | ||
88 | "BadEncoding", /* XvBadEncoding */ | ||
89 | "BadControl" /* XvBadControl */ | ||
90 | }; | ||
91 | |||
92 | static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) | ||
93 | |||
94 | |||
95 | static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, | ||
96 | xv_extension_name, | ||
97 | &xv_extension_hooks, | ||
98 | XvNumEvents, NULL) | ||
99 | |||
100 | |||
101 | static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, | ||
102 | XvNumErrors, xv_error_list) | ||
103 | |||
104 | |||
105 | int | ||
106 | SDL_NAME(XvQueryExtension)( | ||
107 | Display *dpy, | ||
108 | unsigned int *p_version, | ||
109 | unsigned int *p_revision, | ||
110 | unsigned int *p_requestBase, | ||
111 | unsigned int *p_eventBase, | ||
112 | unsigned int *p_errorBase | ||
113 | ){ | ||
114 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
115 | xvQueryExtensionReq *req; | ||
116 | xvQueryExtensionReply rep; | ||
117 | |||
118 | XvCheckExtension(dpy, info, XvBadExtension); | ||
119 | |||
120 | LockDisplay(dpy); | ||
121 | |||
122 | XvGetReq(QueryExtension, req); | ||
123 | |||
124 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
125 | UnlockDisplay(dpy); | ||
126 | SyncHandle(); | ||
127 | return XvBadExtension; | ||
128 | } | ||
129 | |||
130 | *p_version = rep.version; | ||
131 | *p_revision = rep.revision; | ||
132 | *p_requestBase = info->codes->major_opcode; | ||
133 | *p_eventBase = info->codes->first_event; | ||
134 | *p_errorBase = info->codes->first_error; | ||
135 | |||
136 | UnlockDisplay(dpy); | ||
137 | SyncHandle(); | ||
138 | |||
139 | return Success; | ||
140 | } | ||
141 | |||
142 | int | ||
143 | SDL_NAME(XvQueryAdaptors)( | ||
144 | Display *dpy, | ||
145 | Window window, | ||
146 | unsigned int *p_nAdaptors, | ||
147 | SDL_NAME(XvAdaptorInfo) **p_pAdaptors | ||
148 | ){ | ||
149 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
150 | xvQueryAdaptorsReq *req; | ||
151 | xvQueryAdaptorsReply rep; | ||
152 | int size,ii,jj; | ||
153 | char *name; | ||
154 | SDL_NAME(XvAdaptorInfo) *pas, *pa; | ||
155 | SDL_NAME(XvFormat) *pfs, *pf; | ||
156 | char *buffer; | ||
157 | union | ||
158 | { | ||
159 | char *buffer; | ||
160 | char *string; | ||
161 | xvAdaptorInfo *pa; | ||
162 | xvFormat *pf; | ||
163 | } u; | ||
164 | |||
165 | XvCheckExtension(dpy, info, XvBadExtension); | ||
166 | |||
167 | LockDisplay(dpy); | ||
168 | |||
169 | XvGetReq(QueryAdaptors, req); | ||
170 | req->window = window; | ||
171 | |||
172 | /* READ THE REPLY */ | ||
173 | |||
174 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
175 | UnlockDisplay(dpy); | ||
176 | SyncHandle(); | ||
177 | return(XvBadReply); | ||
178 | } | ||
179 | |||
180 | size = rep.length << 2; | ||
181 | if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { | ||
182 | UnlockDisplay(dpy); | ||
183 | SyncHandle(); | ||
184 | return(XvBadAlloc); | ||
185 | } | ||
186 | _XRead (dpy, buffer, size); | ||
187 | |||
188 | u.buffer = buffer; | ||
189 | |||
190 | /* GET INPUT ADAPTORS */ | ||
191 | |||
192 | if (rep.num_adaptors == 0) { | ||
193 | pas = NULL; | ||
194 | } else { | ||
195 | size = rep.num_adaptors*sizeof(SDL_NAME(XvAdaptorInfo)); | ||
196 | if ((pas=(SDL_NAME(XvAdaptorInfo) *)Xmalloc(size))==NULL) { | ||
197 | Xfree(buffer); | ||
198 | UnlockDisplay(dpy); | ||
199 | SyncHandle(); | ||
200 | return(XvBadAlloc); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | /* INIT ADAPTOR FIELDS */ | ||
205 | |||
206 | pa = pas; | ||
207 | for (ii=0; ii<rep.num_adaptors; ii++) { | ||
208 | pa->num_adaptors = 0; | ||
209 | pa->name = (char *)NULL; | ||
210 | pa->formats = (SDL_NAME(XvFormat) *)NULL; | ||
211 | pa++; | ||
212 | } | ||
213 | |||
214 | pa = pas; | ||
215 | for (ii=0; ii<rep.num_adaptors; ii++) { | ||
216 | pa->type = u.pa->type; | ||
217 | pa->base_id = u.pa->base_id; | ||
218 | pa->num_ports = u.pa->num_ports; | ||
219 | pa->num_formats = u.pa->num_formats; | ||
220 | pa->num_adaptors = rep.num_adaptors - ii; | ||
221 | |||
222 | /* GET ADAPTOR NAME */ | ||
223 | |||
224 | size = u.pa->name_size; | ||
225 | u.buffer += (sz_xvAdaptorInfo + 3) & ~3; | ||
226 | |||
227 | if ( (name = (char *)Xmalloc(size+1)) == NULL) | ||
228 | { | ||
229 | SDL_NAME(XvFreeAdaptorInfo)(pas); | ||
230 | Xfree(buffer); | ||
231 | UnlockDisplay(dpy); | ||
232 | SyncHandle(); | ||
233 | return(XvBadAlloc); | ||
234 | } | ||
235 | SDL_strlcpy(name, u.string, size); | ||
236 | pa->name = name; | ||
237 | |||
238 | u.buffer += (size + 3) & ~3; | ||
239 | |||
240 | /* GET FORMATS */ | ||
241 | |||
242 | size = pa->num_formats*sizeof(SDL_NAME(XvFormat)); | ||
243 | if ((pfs=(SDL_NAME(XvFormat) *)Xmalloc(size))==NULL) { | ||
244 | SDL_NAME(XvFreeAdaptorInfo)(pas); | ||
245 | Xfree(buffer); | ||
246 | UnlockDisplay(dpy); | ||
247 | SyncHandle(); | ||
248 | return(XvBadAlloc); | ||
249 | } | ||
250 | |||
251 | pf = pfs; | ||
252 | for (jj=0; jj<pa->num_formats; jj++) { | ||
253 | pf->depth = u.pf->depth; | ||
254 | pf->visual_id = u.pf->visual; | ||
255 | pf++; | ||
256 | |||
257 | u.buffer += (sz_xvFormat + 3) & ~3; | ||
258 | } | ||
259 | |||
260 | pa->formats = pfs; | ||
261 | |||
262 | pa++; | ||
263 | |||
264 | } | ||
265 | |||
266 | *p_nAdaptors = rep.num_adaptors; | ||
267 | *p_pAdaptors = pas; | ||
268 | |||
269 | Xfree(buffer); | ||
270 | UnlockDisplay(dpy); | ||
271 | SyncHandle(); | ||
272 | |||
273 | return (Success); | ||
274 | } | ||
275 | |||
276 | |||
277 | void | ||
278 | SDL_NAME(XvFreeAdaptorInfo)(SDL_NAME(XvAdaptorInfo) *pAdaptors) | ||
279 | { | ||
280 | |||
281 | SDL_NAME(XvAdaptorInfo) *pa; | ||
282 | int ii; | ||
283 | |||
284 | if (!pAdaptors) return; | ||
285 | |||
286 | pa = pAdaptors; | ||
287 | |||
288 | for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++) | ||
289 | { | ||
290 | if (pa->name) | ||
291 | { | ||
292 | Xfree(pa->name); | ||
293 | } | ||
294 | if (pa->formats) | ||
295 | { | ||
296 | Xfree(pa->formats); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | Xfree(pAdaptors); | ||
301 | } | ||
302 | |||
303 | int | ||
304 | SDL_NAME(XvQueryEncodings)( | ||
305 | Display *dpy, | ||
306 | XvPortID port, | ||
307 | unsigned int *p_nEncodings, | ||
308 | SDL_NAME(XvEncodingInfo) **p_pEncodings | ||
309 | ){ | ||
310 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
311 | xvQueryEncodingsReq *req; | ||
312 | xvQueryEncodingsReply rep; | ||
313 | int size, jj; | ||
314 | char *name; | ||
315 | SDL_NAME(XvEncodingInfo) *pes, *pe; | ||
316 | char *buffer; | ||
317 | union | ||
318 | { | ||
319 | char *buffer; | ||
320 | char *string; | ||
321 | xvEncodingInfo *pe; | ||
322 | } u; | ||
323 | |||
324 | XvCheckExtension(dpy, info, XvBadExtension); | ||
325 | |||
326 | LockDisplay(dpy); | ||
327 | |||
328 | XvGetReq(QueryEncodings, req); | ||
329 | req->port = port; | ||
330 | |||
331 | /* READ THE REPLY */ | ||
332 | |||
333 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
334 | UnlockDisplay(dpy); | ||
335 | SyncHandle(); | ||
336 | return(XvBadReply); | ||
337 | } | ||
338 | |||
339 | size = rep.length << 2; | ||
340 | if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) { | ||
341 | UnlockDisplay(dpy); | ||
342 | SyncHandle(); | ||
343 | return(XvBadAlloc); | ||
344 | } | ||
345 | _XRead (dpy, buffer, size); | ||
346 | |||
347 | u.buffer = buffer; | ||
348 | |||
349 | /* GET ENCODINGS */ | ||
350 | |||
351 | size = rep.num_encodings*sizeof(SDL_NAME(XvEncodingInfo)); | ||
352 | if ( (pes = (SDL_NAME(XvEncodingInfo) *)Xmalloc(size)) == NULL) { | ||
353 | Xfree(buffer); | ||
354 | UnlockDisplay(dpy); | ||
355 | SyncHandle(); | ||
356 | return(XvBadAlloc); | ||
357 | } | ||
358 | |||
359 | /* INITIALIZE THE ENCODING POINTER */ | ||
360 | |||
361 | pe = pes; | ||
362 | for (jj=0; jj<rep.num_encodings; jj++) { | ||
363 | pe->name = (char *)NULL; | ||
364 | pe->num_encodings = 0; | ||
365 | pe++; | ||
366 | } | ||
367 | |||
368 | pe = pes; | ||
369 | for (jj=0; jj<rep.num_encodings; jj++) { | ||
370 | pe->encoding_id = u.pe->encoding; | ||
371 | pe->width = u.pe->width; | ||
372 | pe->height = u.pe->height; | ||
373 | pe->rate.numerator = u.pe->rate.numerator; | ||
374 | pe->rate.denominator = u.pe->rate.denominator; | ||
375 | pe->num_encodings = rep.num_encodings - jj; | ||
376 | |||
377 | size = u.pe->name_size; | ||
378 | u.buffer += (sz_xvEncodingInfo + 3) & ~3; | ||
379 | |||
380 | if ( (name = (char *)Xmalloc(size+1)) == NULL) { | ||
381 | Xfree(buffer); | ||
382 | UnlockDisplay(dpy); | ||
383 | SyncHandle(); | ||
384 | return(XvBadAlloc); | ||
385 | } | ||
386 | SDL_strlcpy(name, u.string, size); | ||
387 | pe->name = name; | ||
388 | pe++; | ||
389 | |||
390 | u.buffer += (size + 3) & ~3; | ||
391 | } | ||
392 | |||
393 | *p_nEncodings = rep.num_encodings; | ||
394 | *p_pEncodings = pes; | ||
395 | |||
396 | Xfree(buffer); | ||
397 | UnlockDisplay(dpy); | ||
398 | SyncHandle(); | ||
399 | |||
400 | return (Success); | ||
401 | } | ||
402 | |||
403 | void | ||
404 | SDL_NAME(XvFreeEncodingInfo)(SDL_NAME(XvEncodingInfo) *pEncodings) | ||
405 | { | ||
406 | |||
407 | SDL_NAME(XvEncodingInfo) *pe; | ||
408 | int ii; | ||
409 | |||
410 | if (!pEncodings) return; | ||
411 | |||
412 | pe = pEncodings; | ||
413 | |||
414 | for (ii=0; ii<pEncodings->num_encodings; ii++, pe++) { | ||
415 | if (pe->name) Xfree(pe->name); | ||
416 | } | ||
417 | |||
418 | Xfree(pEncodings); | ||
419 | } | ||
420 | |||
421 | int | ||
422 | SDL_NAME(XvPutVideo)( | ||
423 | Display *dpy, | ||
424 | XvPortID port, | ||
425 | Drawable d, | ||
426 | GC gc, | ||
427 | int vx, int vy, | ||
428 | unsigned int vw, unsigned int vh, | ||
429 | int dx, int dy, | ||
430 | unsigned int dw, unsigned int dh | ||
431 | ){ | ||
432 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
433 | xvPutVideoReq *req; | ||
434 | |||
435 | XvCheckExtension(dpy, info, XvBadExtension); | ||
436 | |||
437 | LockDisplay(dpy); | ||
438 | |||
439 | FlushGC(dpy, gc); | ||
440 | |||
441 | XvGetReq(PutVideo, req); | ||
442 | |||
443 | req->port = port; | ||
444 | req->drawable = d; | ||
445 | req->gc = gc->gid; | ||
446 | req->vid_x = vx; | ||
447 | req->vid_y = vy; | ||
448 | req->vid_w = vw; | ||
449 | req->vid_h = vh; | ||
450 | req->drw_x = dx; | ||
451 | req->drw_y = dy; | ||
452 | req->drw_w = dw; | ||
453 | req->drw_h = dh; | ||
454 | |||
455 | UnlockDisplay(dpy); | ||
456 | SyncHandle(); | ||
457 | |||
458 | return Success; | ||
459 | } | ||
460 | |||
461 | int | ||
462 | SDL_NAME(XvPutStill)( | ||
463 | Display *dpy, | ||
464 | XvPortID port, | ||
465 | Drawable d, | ||
466 | GC gc, | ||
467 | int vx, int vy, | ||
468 | unsigned int vw, unsigned int vh, | ||
469 | int dx, int dy, | ||
470 | unsigned int dw, unsigned int dh | ||
471 | ){ | ||
472 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
473 | xvPutStillReq *req; | ||
474 | |||
475 | XvCheckExtension(dpy, info, XvBadExtension); | ||
476 | |||
477 | LockDisplay(dpy); | ||
478 | |||
479 | FlushGC(dpy, gc); | ||
480 | |||
481 | XvGetReq(PutStill, req); | ||
482 | req->port = port; | ||
483 | req->drawable = d; | ||
484 | req->gc = gc->gid; | ||
485 | req->vid_x = vx; | ||
486 | req->vid_y = vy; | ||
487 | req->vid_w = vw; | ||
488 | req->vid_h = vh; | ||
489 | req->drw_x = dx; | ||
490 | req->drw_y = dy; | ||
491 | req->drw_w = dw; | ||
492 | req->drw_h = dh; | ||
493 | |||
494 | UnlockDisplay(dpy); | ||
495 | SyncHandle(); | ||
496 | |||
497 | return Success; | ||
498 | } | ||
499 | |||
500 | int | ||
501 | SDL_NAME(XvGetVideo)( | ||
502 | Display *dpy, | ||
503 | XvPortID port, | ||
504 | Drawable d, | ||
505 | GC gc, | ||
506 | int vx, int vy, | ||
507 | unsigned int vw, unsigned int vh, | ||
508 | int dx, int dy, | ||
509 | unsigned int dw, unsigned int dh | ||
510 | ){ | ||
511 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
512 | xvGetVideoReq *req; | ||
513 | |||
514 | XvCheckExtension(dpy, info, XvBadExtension); | ||
515 | |||
516 | LockDisplay(dpy); | ||
517 | |||
518 | FlushGC(dpy, gc); | ||
519 | |||
520 | XvGetReq(GetVideo, req); | ||
521 | req->port = port; | ||
522 | req->drawable = d; | ||
523 | req->gc = gc->gid; | ||
524 | req->vid_x = vx; | ||
525 | req->vid_y = vy; | ||
526 | req->vid_w = vw; | ||
527 | req->vid_h = vh; | ||
528 | req->drw_x = dx; | ||
529 | req->drw_y = dy; | ||
530 | req->drw_w = dw; | ||
531 | req->drw_h = dh; | ||
532 | |||
533 | UnlockDisplay(dpy); | ||
534 | SyncHandle(); | ||
535 | |||
536 | return Success; | ||
537 | } | ||
538 | |||
539 | int | ||
540 | SDL_NAME(XvGetStill)( | ||
541 | Display *dpy, | ||
542 | XvPortID port, | ||
543 | Drawable d, | ||
544 | GC gc, | ||
545 | int vx, int vy, | ||
546 | unsigned int vw, unsigned int vh, | ||
547 | int dx, int dy, | ||
548 | unsigned int dw, unsigned int dh | ||
549 | ){ | ||
550 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
551 | xvGetStillReq *req; | ||
552 | |||
553 | XvCheckExtension(dpy, info, XvBadExtension); | ||
554 | |||
555 | LockDisplay(dpy); | ||
556 | |||
557 | FlushGC(dpy, gc); | ||
558 | |||
559 | XvGetReq(GetStill, req); | ||
560 | req->port = port; | ||
561 | req->drawable = d; | ||
562 | req->gc = gc->gid; | ||
563 | req->vid_x = vx; | ||
564 | req->vid_y = vy; | ||
565 | req->vid_w = vw; | ||
566 | req->vid_h = vh; | ||
567 | req->drw_x = dx; | ||
568 | req->drw_y = dy; | ||
569 | req->drw_w = dw; | ||
570 | req->drw_h = dh; | ||
571 | |||
572 | UnlockDisplay(dpy); | ||
573 | SyncHandle(); | ||
574 | |||
575 | return Success; | ||
576 | } | ||
577 | |||
578 | int | ||
579 | SDL_NAME(XvStopVideo)( | ||
580 | Display *dpy, | ||
581 | XvPortID port, | ||
582 | Drawable draw | ||
583 | ){ | ||
584 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
585 | xvStopVideoReq *req; | ||
586 | |||
587 | XvCheckExtension(dpy, info, XvBadExtension); | ||
588 | |||
589 | LockDisplay(dpy); | ||
590 | |||
591 | XvGetReq(StopVideo, req); | ||
592 | req->port = port; | ||
593 | req->drawable = draw; | ||
594 | |||
595 | UnlockDisplay(dpy); | ||
596 | SyncHandle(); | ||
597 | |||
598 | return Success; | ||
599 | } | ||
600 | |||
601 | int | ||
602 | SDL_NAME(XvGrabPort)( | ||
603 | Display *dpy, | ||
604 | XvPortID port, | ||
605 | Time time | ||
606 | ){ | ||
607 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
608 | int result; | ||
609 | xvGrabPortReply rep; | ||
610 | xvGrabPortReq *req; | ||
611 | |||
612 | XvCheckExtension(dpy, info, XvBadExtension); | ||
613 | |||
614 | LockDisplay(dpy); | ||
615 | |||
616 | XvGetReq(GrabPort, req); | ||
617 | req->port = port; | ||
618 | req->time = time; | ||
619 | |||
620 | if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) | ||
621 | rep.result = GrabSuccess; | ||
622 | |||
623 | result = rep.result; | ||
624 | |||
625 | UnlockDisplay(dpy); | ||
626 | SyncHandle(); | ||
627 | |||
628 | return result; | ||
629 | } | ||
630 | |||
631 | int | ||
632 | SDL_NAME(XvUngrabPort)( | ||
633 | Display *dpy, | ||
634 | XvPortID port, | ||
635 | Time time | ||
636 | ){ | ||
637 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
638 | xvUngrabPortReq *req; | ||
639 | |||
640 | XvCheckExtension(dpy, info, XvBadExtension); | ||
641 | |||
642 | LockDisplay(dpy); | ||
643 | |||
644 | XvGetReq(UngrabPort, req); | ||
645 | req->port = port; | ||
646 | req->time = time; | ||
647 | |||
648 | UnlockDisplay(dpy); | ||
649 | SyncHandle(); | ||
650 | |||
651 | return Success; | ||
652 | } | ||
653 | |||
654 | int | ||
655 | SDL_NAME(XvSelectVideoNotify)( | ||
656 | Display *dpy, | ||
657 | Drawable drawable, | ||
658 | Bool onoff | ||
659 | ){ | ||
660 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
661 | xvSelectVideoNotifyReq *req; | ||
662 | |||
663 | XvCheckExtension(dpy, info, XvBadExtension); | ||
664 | |||
665 | LockDisplay(dpy); | ||
666 | |||
667 | XvGetReq(SelectVideoNotify, req); | ||
668 | req->drawable = drawable; | ||
669 | req->onoff = onoff; | ||
670 | |||
671 | UnlockDisplay(dpy); | ||
672 | SyncHandle(); | ||
673 | |||
674 | return Success; | ||
675 | } | ||
676 | |||
677 | int | ||
678 | SDL_NAME(XvSelectPortNotify)( | ||
679 | Display *dpy, | ||
680 | XvPortID port, | ||
681 | Bool onoff | ||
682 | ){ | ||
683 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
684 | xvSelectPortNotifyReq *req; | ||
685 | |||
686 | XvCheckExtension(dpy, info, XvBadExtension); | ||
687 | |||
688 | LockDisplay(dpy); | ||
689 | |||
690 | XvGetReq(SelectPortNotify, req); | ||
691 | req->port = port; | ||
692 | req->onoff = onoff; | ||
693 | |||
694 | UnlockDisplay(dpy); | ||
695 | SyncHandle(); | ||
696 | |||
697 | return Success; | ||
698 | } | ||
699 | |||
700 | int | ||
701 | SDL_NAME(XvSetPortAttribute) ( | ||
702 | Display *dpy, | ||
703 | XvPortID port, | ||
704 | Atom attribute, | ||
705 | int value | ||
706 | ) | ||
707 | { | ||
708 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
709 | xvSetPortAttributeReq *req; | ||
710 | |||
711 | XvCheckExtension(dpy, info, XvBadExtension); | ||
712 | |||
713 | LockDisplay(dpy); | ||
714 | |||
715 | XvGetReq(SetPortAttribute, req); | ||
716 | req->port = port; | ||
717 | req->attribute = attribute; | ||
718 | req->value = value; | ||
719 | |||
720 | UnlockDisplay(dpy); | ||
721 | SyncHandle(); | ||
722 | |||
723 | return (Success); | ||
724 | } | ||
725 | |||
726 | int | ||
727 | SDL_NAME(XvGetPortAttribute) ( | ||
728 | Display *dpy, | ||
729 | XvPortID port, | ||
730 | Atom attribute, | ||
731 | int *p_value | ||
732 | ) | ||
733 | { | ||
734 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
735 | xvGetPortAttributeReq *req; | ||
736 | xvGetPortAttributeReply rep; | ||
737 | |||
738 | XvCheckExtension(dpy, info, XvBadExtension); | ||
739 | |||
740 | LockDisplay(dpy); | ||
741 | |||
742 | XvGetReq(GetPortAttribute, req); | ||
743 | req->port = port; | ||
744 | req->attribute = attribute; | ||
745 | |||
746 | /* READ THE REPLY */ | ||
747 | |||
748 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
749 | UnlockDisplay(dpy); | ||
750 | SyncHandle(); | ||
751 | return(XvBadReply); | ||
752 | } | ||
753 | |||
754 | *p_value = rep.value; | ||
755 | |||
756 | UnlockDisplay(dpy); | ||
757 | SyncHandle(); | ||
758 | |||
759 | return (Success); | ||
760 | } | ||
761 | |||
762 | int | ||
763 | SDL_NAME(XvQueryBestSize)( | ||
764 | Display *dpy, | ||
765 | XvPortID port, | ||
766 | Bool motion, | ||
767 | unsigned int vid_w, | ||
768 | unsigned int vid_h, | ||
769 | unsigned int drw_w, | ||
770 | unsigned int drw_h, | ||
771 | unsigned int *p_actual_width, | ||
772 | unsigned int *p_actual_height | ||
773 | ) | ||
774 | { | ||
775 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
776 | xvQueryBestSizeReq *req; | ||
777 | xvQueryBestSizeReply rep; | ||
778 | |||
779 | XvCheckExtension(dpy, info, XvBadExtension); | ||
780 | |||
781 | LockDisplay(dpy); | ||
782 | |||
783 | XvGetReq(QueryBestSize, req); | ||
784 | req->port = port; | ||
785 | req->motion = motion; | ||
786 | req->vid_w = vid_w; | ||
787 | req->vid_h = vid_h; | ||
788 | req->drw_w = drw_w; | ||
789 | req->drw_h = drw_h; | ||
790 | |||
791 | /* READ THE REPLY */ | ||
792 | |||
793 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
794 | UnlockDisplay(dpy); | ||
795 | SyncHandle(); | ||
796 | return(XvBadReply); | ||
797 | } | ||
798 | |||
799 | *p_actual_width = rep.actual_width; | ||
800 | *p_actual_height = rep.actual_height; | ||
801 | |||
802 | UnlockDisplay(dpy); | ||
803 | SyncHandle(); | ||
804 | |||
805 | return (Success); | ||
806 | } | ||
807 | |||
808 | |||
809 | SDL_NAME(XvAttribute)* | ||
810 | SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num) | ||
811 | { | ||
812 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
813 | xvQueryPortAttributesReq *req; | ||
814 | xvQueryPortAttributesReply rep; | ||
815 | SDL_NAME(XvAttribute) *ret = NULL; | ||
816 | |||
817 | *num = 0; | ||
818 | |||
819 | XvCheckExtension(dpy, info, NULL); | ||
820 | |||
821 | LockDisplay(dpy); | ||
822 | |||
823 | XvGetReq(QueryPortAttributes, req); | ||
824 | req->port = port; | ||
825 | |||
826 | /* READ THE REPLY */ | ||
827 | |||
828 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
829 | UnlockDisplay(dpy); | ||
830 | SyncHandle(); | ||
831 | return ret; | ||
832 | } | ||
833 | |||
834 | if(rep.num_attributes) { | ||
835 | int size = (rep.num_attributes * sizeof(SDL_NAME(XvAttribute))) + rep.text_size; | ||
836 | |||
837 | if((ret = Xmalloc(size))) { | ||
838 | char* marker = (char*)(&ret[rep.num_attributes]); | ||
839 | xvAttributeInfo Info; | ||
840 | int i; | ||
841 | |||
842 | for(i = 0; i < rep.num_attributes; i++) { | ||
843 | _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo); | ||
844 | ret[i].flags = (int)Info.flags; | ||
845 | ret[i].min_value = Info.min; | ||
846 | ret[i].max_value = Info.max; | ||
847 | ret[i].name = marker; | ||
848 | _XRead(dpy, marker, Info.size); | ||
849 | marker += Info.size; | ||
850 | (*num)++; | ||
851 | } | ||
852 | } else | ||
853 | _XEatData(dpy, rep.length << 2); | ||
854 | } | ||
855 | |||
856 | UnlockDisplay(dpy); | ||
857 | SyncHandle(); | ||
858 | |||
859 | return ret; | ||
860 | } | ||
861 | |||
862 | SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( | ||
863 | Display *dpy, | ||
864 | XvPortID port, | ||
865 | int *num | ||
866 | ){ | ||
867 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
868 | xvListImageFormatsReq *req; | ||
869 | xvListImageFormatsReply rep; | ||
870 | SDL_NAME(XvImageFormatValues) *ret = NULL; | ||
871 | |||
872 | *num = 0; | ||
873 | |||
874 | XvCheckExtension(dpy, info, NULL); | ||
875 | |||
876 | LockDisplay(dpy); | ||
877 | |||
878 | XvGetReq(ListImageFormats, req); | ||
879 | req->port = port; | ||
880 | |||
881 | /* READ THE REPLY */ | ||
882 | |||
883 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { | ||
884 | UnlockDisplay(dpy); | ||
885 | SyncHandle(); | ||
886 | return NULL; | ||
887 | } | ||
888 | |||
889 | if(rep.num_formats) { | ||
890 | int size = (rep.num_formats * sizeof(SDL_NAME(XvImageFormatValues))); | ||
891 | |||
892 | if((ret = Xmalloc(size))) { | ||
893 | xvImageFormatInfo Info; | ||
894 | int i; | ||
895 | |||
896 | for(i = 0; i < rep.num_formats; i++) { | ||
897 | _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); | ||
898 | ret[i].id = Info.id; | ||
899 | ret[i].type = Info.type; | ||
900 | ret[i].byte_order = Info.byte_order; | ||
901 | memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); | ||
902 | ret[i].bits_per_pixel = Info.bpp; | ||
903 | ret[i].format = Info.format; | ||
904 | ret[i].num_planes = Info.num_planes; | ||
905 | ret[i].depth = Info.depth; | ||
906 | ret[i].red_mask = Info.red_mask; | ||
907 | ret[i].green_mask = Info.green_mask; | ||
908 | ret[i].blue_mask = Info.blue_mask; | ||
909 | ret[i].y_sample_bits = Info.y_sample_bits; | ||
910 | ret[i].u_sample_bits = Info.u_sample_bits; | ||
911 | ret[i].v_sample_bits = Info.v_sample_bits; | ||
912 | ret[i].horz_y_period = Info.horz_y_period; | ||
913 | ret[i].horz_u_period = Info.horz_u_period; | ||
914 | ret[i].horz_v_period = Info.horz_v_period; | ||
915 | ret[i].vert_y_period = Info.vert_y_period; | ||
916 | ret[i].vert_u_period = Info.vert_u_period; | ||
917 | ret[i].vert_v_period = Info.vert_v_period; | ||
918 | memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); | ||
919 | ret[i].scanline_order = Info.scanline_order; | ||
920 | (*num)++; | ||
921 | } | ||
922 | } else | ||
923 | _XEatData(dpy, rep.length << 2); | ||
924 | } | ||
925 | |||
926 | UnlockDisplay(dpy); | ||
927 | SyncHandle(); | ||
928 | |||
929 | return ret; | ||
930 | } | ||
931 | |||
932 | SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( | ||
933 | Display *dpy, | ||
934 | XvPortID port, | ||
935 | int id, | ||
936 | char *data, | ||
937 | int width, | ||
938 | int height | ||
939 | ) { | ||
940 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
941 | xvQueryImageAttributesReq *req; | ||
942 | xvQueryImageAttributesReply rep; | ||
943 | SDL_NAME(XvImage) *ret = NULL; | ||
944 | |||
945 | XvCheckExtension(dpy, info, NULL); | ||
946 | |||
947 | LockDisplay(dpy); | ||
948 | |||
949 | XvGetReq(QueryImageAttributes, req); | ||
950 | req->id = id; | ||
951 | req->port = port; | ||
952 | req->width = width; | ||
953 | req->height = height; | ||
954 | |||
955 | /* READ THE REPLY */ | ||
956 | |||
957 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
958 | UnlockDisplay(dpy); | ||
959 | SyncHandle(); | ||
960 | return NULL; | ||
961 | } | ||
962 | |||
963 | if((ret = (SDL_NAME(XvImage)*)Xmalloc(sizeof(SDL_NAME(XvImage)) + (rep.num_planes << 3)))) { | ||
964 | ret->id = id; | ||
965 | ret->width = rep.width; | ||
966 | ret->height = rep.height; | ||
967 | ret->data_size = rep.data_size; | ||
968 | ret->num_planes = rep.num_planes; | ||
969 | ret->pitches = (int*)(&ret[1]); | ||
970 | ret->offsets = ret->pitches + rep.num_planes; | ||
971 | ret->data = data; | ||
972 | ret->obdata = NULL; | ||
973 | _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); | ||
974 | _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); | ||
975 | } else | ||
976 | _XEatData(dpy, rep.length << 2); | ||
977 | |||
978 | UnlockDisplay(dpy); | ||
979 | SyncHandle(); | ||
980 | return ret; | ||
981 | } | ||
982 | |||
983 | SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) ( | ||
984 | Display *dpy, | ||
985 | XvPortID port, | ||
986 | int id, | ||
987 | char *data, | ||
988 | int width, | ||
989 | int height, | ||
990 | XShmSegmentInfo *shminfo | ||
991 | ){ | ||
992 | SDL_NAME(XvImage) *ret; | ||
993 | |||
994 | ret = SDL_NAME(XvCreateImage)(dpy, port, id, data, width, height); | ||
995 | |||
996 | if(ret) ret->obdata = (XPointer)shminfo; | ||
997 | |||
998 | return ret; | ||
999 | } | ||
1000 | |||
1001 | int SDL_NAME(XvPutImage) ( | ||
1002 | Display *dpy, | ||
1003 | XvPortID port, | ||
1004 | Drawable d, | ||
1005 | GC gc, | ||
1006 | SDL_NAME(XvImage) *image, | ||
1007 | int src_x, | ||
1008 | int src_y, | ||
1009 | unsigned int src_w, | ||
1010 | unsigned int src_h, | ||
1011 | int dest_x, | ||
1012 | int dest_y, | ||
1013 | unsigned int dest_w, | ||
1014 | unsigned int dest_h | ||
1015 | ){ | ||
1016 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
1017 | xvPutImageReq *req; | ||
1018 | int len; | ||
1019 | |||
1020 | XvCheckExtension(dpy, info, XvBadExtension); | ||
1021 | |||
1022 | LockDisplay(dpy); | ||
1023 | |||
1024 | FlushGC(dpy, gc); | ||
1025 | |||
1026 | XvGetReq(PutImage, req); | ||
1027 | |||
1028 | req->port = port; | ||
1029 | req->drawable = d; | ||
1030 | req->gc = gc->gid; | ||
1031 | req->id = image->id; | ||
1032 | req->src_x = src_x; | ||
1033 | req->src_y = src_y; | ||
1034 | req->src_w = src_w; | ||
1035 | req->src_h = src_h; | ||
1036 | req->drw_x = dest_x; | ||
1037 | req->drw_y = dest_y; | ||
1038 | req->drw_w = dest_w; | ||
1039 | req->drw_h = dest_h; | ||
1040 | req->width = image->width; | ||
1041 | req->height = image->height; | ||
1042 | |||
1043 | len = (image->data_size + 3) >> 2; | ||
1044 | SetReqLen(req, len, len); | ||
1045 | |||
1046 | /* Yes it's kindof lame that we are sending the whole thing, | ||
1047 | but for video all of it may be needed even if displaying | ||
1048 | only a subsection, and I don't want to go through the | ||
1049 | trouble of creating subregions to send */ | ||
1050 | Data(dpy, (char *)image->data, image->data_size); | ||
1051 | |||
1052 | UnlockDisplay(dpy); | ||
1053 | SyncHandle(); | ||
1054 | |||
1055 | return Success; | ||
1056 | } | ||
1057 | |||
1058 | int SDL_NAME(XvShmPutImage) ( | ||
1059 | Display *dpy, | ||
1060 | XvPortID port, | ||
1061 | Drawable d, | ||
1062 | GC gc, | ||
1063 | SDL_NAME(XvImage) *image, | ||
1064 | int src_x, | ||
1065 | int src_y, | ||
1066 | unsigned int src_w, | ||
1067 | unsigned int src_h, | ||
1068 | int dest_x, | ||
1069 | int dest_y, | ||
1070 | unsigned int dest_w, | ||
1071 | unsigned int dest_h, | ||
1072 | Bool send_event | ||
1073 | ){ | ||
1074 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
1075 | XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; | ||
1076 | xvShmPutImageReq *req; | ||
1077 | |||
1078 | XvCheckExtension(dpy, info, XvBadExtension); | ||
1079 | |||
1080 | LockDisplay(dpy); | ||
1081 | |||
1082 | FlushGC(dpy, gc); | ||
1083 | |||
1084 | XvGetReq(ShmPutImage, req); | ||
1085 | |||
1086 | req->port = port; | ||
1087 | req->drawable = d; | ||
1088 | req->gc = gc->gid; | ||
1089 | req->shmseg = shminfo->shmseg; | ||
1090 | req->id = image->id; | ||
1091 | req->src_x = src_x; | ||
1092 | req->src_y = src_y; | ||
1093 | req->src_w = src_w; | ||
1094 | req->src_h = src_h; | ||
1095 | req->drw_x = dest_x; | ||
1096 | req->drw_y = dest_y; | ||
1097 | req->drw_w = dest_w; | ||
1098 | req->drw_h = dest_h; | ||
1099 | req->offset = image->data - shminfo->shmaddr; | ||
1100 | req->width = image->width; | ||
1101 | req->height = image->height; | ||
1102 | req->send_event = send_event; | ||
1103 | |||
1104 | UnlockDisplay(dpy); | ||
1105 | SyncHandle(); | ||
1106 | |||
1107 | return Success; | ||
1108 | } | ||
1109 | |||
1110 | |||
1111 | static Bool | ||
1112 | xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) | ||
1113 | { | ||
1114 | XExtDisplayInfo *info = xv_find_display(dpy); | ||
1115 | SDL_NAME(XvEvent) *re = (SDL_NAME(XvEvent) *)host; | ||
1116 | xvEvent *event = (xvEvent *)wire; | ||
1117 | |||
1118 | XvCheckExtension(dpy, info, False); | ||
1119 | |||
1120 | switch((event->u.u.type & 0x7F) - info->codes->first_event) | ||
1121 | { | ||
1122 | case XvVideoNotify: | ||
1123 | re->xvvideo.type = event->u.u.type & 0x7f; | ||
1124 | re->xvvideo.serial = | ||
1125 | _XSetLastRequestRead(dpy, (xGenericReply *)event); | ||
1126 | re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); | ||
1127 | re->xvvideo.display = dpy; | ||
1128 | re->xvvideo.time = event->u.videoNotify.time; | ||
1129 | re->xvvideo.reason = event->u.videoNotify.reason; | ||
1130 | re->xvvideo.drawable = event->u.videoNotify.drawable; | ||
1131 | re->xvvideo.port_id = event->u.videoNotify.port; | ||
1132 | break; | ||
1133 | case XvPortNotify: | ||
1134 | re->xvport.type = event->u.u.type & 0x7f; | ||
1135 | re->xvport.serial = | ||
1136 | _XSetLastRequestRead(dpy, (xGenericReply *)event); | ||
1137 | re->xvport.send_event = ((event->u.u.type & 0x80) != 0); | ||
1138 | re->xvport.display = dpy; | ||
1139 | re->xvport.time = event->u.portNotify.time; | ||
1140 | re->xvport.port_id = event->u.portNotify.port; | ||
1141 | re->xvport.attribute = event->u.portNotify.attribute; | ||
1142 | re->xvport.value = event->u.portNotify.value; | ||
1143 | break; | ||
1144 | default: | ||
1145 | return False; | ||
1146 | } | ||
1147 | |||
1148 | return (True); | ||
1149 | } | ||
1150 | |||
1151 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/Xv/Xvlibint.h b/apps/plugins/sdl/src/video/Xext/Xv/Xvlibint.h new file mode 100644 index 0000000000..20df706dc7 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xv/Xvlibint.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /*********************************************************** | ||
2 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, | ||
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | ||
4 | |||
5 | All Rights Reserved | ||
6 | |||
7 | Permission to use, copy, modify, and distribute this software and its | ||
8 | documentation for any purpose and without fee is hereby granted, | ||
9 | provided that the above copyright notice appear in all copies and that | ||
10 | both that copyright notice and this permission notice appear in | ||
11 | supporting documentation, and that the names of Digital or MIT not be | ||
12 | used in advertising or publicity pertaining to distribution of the | ||
13 | software without specific, written prior permission. | ||
14 | |||
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
21 | SOFTWARE. | ||
22 | |||
23 | ******************************************************************/ | ||
24 | /* $XFree86: xc/lib/Xv/Xvlibint.h,v 1.5 2001/07/25 15:04:53 dawes Exp $ */ | ||
25 | |||
26 | #ifndef XVLIBINT_H | ||
27 | #define XVLIBINT_H | ||
28 | /* | ||
29 | ** File: | ||
30 | ** | ||
31 | ** Xvlibint.h --- Xv library internal header file | ||
32 | ** | ||
33 | ** Author: | ||
34 | ** | ||
35 | ** David Carver (Digital Workstation Engineering/Project Athena) | ||
36 | ** | ||
37 | ** Revisions: | ||
38 | ** | ||
39 | ** 01.24.91 Carver | ||
40 | ** - version 1.4 upgrade | ||
41 | ** | ||
42 | */ | ||
43 | |||
44 | #define NEED_REPLIES | ||
45 | |||
46 | /* Apparently some X11 systems can't include this multiple times... */ | ||
47 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
48 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
49 | #include <X11/Xlibint.h> | ||
50 | #endif | ||
51 | |||
52 | #include "../extensions/Xvproto.h" | ||
53 | #include "../extensions/Xvlib.h" | ||
54 | |||
55 | #if !defined(UNIXCPP) | ||
56 | #define XvGetReq(name, req) \ | ||
57 | WORD64ALIGN\ | ||
58 | if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\ | ||
59 | _XFlush(dpy);\ | ||
60 | req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\ | ||
61 | req->reqType = info->codes->major_opcode;\ | ||
62 | req->xvReqType = xv_##name; \ | ||
63 | req->length = (SIZEOF(xv##name##Req))>>2;\ | ||
64 | dpy->bufptr += SIZEOF(xv##name##Req);\ | ||
65 | dpy->request++ | ||
66 | |||
67 | #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ | ||
68 | #define XvGetReq(name, req) \ | ||
69 | WORD64ALIGN\ | ||
70 | if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\ | ||
71 | _XFlush(dpy);\ | ||
72 | req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ | ||
73 | req->reqType = info->codes->major_opcode;\ | ||
74 | req->xvReqType = xv_/**/name;\ | ||
75 | req->length = (SIZEOF(xv/**/name/**/Req))>>2;\ | ||
76 | dpy->bufptr += SIZEOF(xv/**/name/**/Req);\ | ||
77 | dpy->request++ | ||
78 | #endif | ||
79 | |||
80 | |||
81 | #endif /* XVLIBINT_H */ | ||
diff --git a/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA.c b/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA.c new file mode 100644 index 0000000000..fc729f1257 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA.c | |||
@@ -0,0 +1,721 @@ | |||
1 | /* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.19 2001/08/18 02:41:30 dawes Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 1995 Jon Tombs | ||
5 | Copyright (c) 1995,1996 The XFree86 Project, Inc | ||
6 | |||
7 | */ | ||
8 | |||
9 | /* THIS IS NOT AN X CONSORTIUM STANDARD */ | ||
10 | |||
11 | #ifdef __EMX__ /* needed here to override certain constants in X headers */ | ||
12 | #define INCL_DOS | ||
13 | #define INCL_DOSIOCTL | ||
14 | #include <os2.h> | ||
15 | #endif | ||
16 | |||
17 | #if defined(linux) | ||
18 | #define HAS_MMAP_ANON | ||
19 | #include <sys/types.h> | ||
20 | #include <sys/mman.h> | ||
21 | /*#include <asm/page.h>*/ /* PAGE_SIZE */ | ||
22 | #define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */ | ||
23 | #define HAS_GETPAGESIZE | ||
24 | #endif /* linux */ | ||
25 | |||
26 | #if defined(CSRG_BASED) | ||
27 | #define HAS_MMAP_ANON | ||
28 | #define HAS_GETPAGESIZE | ||
29 | #include <sys/types.h> | ||
30 | #include <sys/mman.h> | ||
31 | #endif /* CSRG_BASED */ | ||
32 | |||
33 | #if defined(DGUX) | ||
34 | #define HAS_GETPAGESIZE | ||
35 | #define MMAP_DEV_ZERO | ||
36 | #include <sys/types.h> | ||
37 | #include <sys/mman.h> | ||
38 | #include <unistd.h> | ||
39 | #endif /* DGUX */ | ||
40 | |||
41 | #if defined(SVR4) && !defined(DGUX) | ||
42 | #define MMAP_DEV_ZERO | ||
43 | #include <sys/types.h> | ||
44 | #include <sys/mman.h> | ||
45 | #include <unistd.h> | ||
46 | #endif /* SVR4 && !DGUX */ | ||
47 | |||
48 | #if defined(sun) && !defined(SVR4) /* SunOS */ | ||
49 | #define MMAP_DEV_ZERO /* doesn't SunOS have MAP_ANON ?? */ | ||
50 | #define HAS_GETPAGESIZE | ||
51 | #include <sys/types.h> | ||
52 | #include <sys/mman.h> | ||
53 | #endif /* sun && !SVR4 */ | ||
54 | |||
55 | #ifdef XNO_SYSCONF | ||
56 | #undef _SC_PAGESIZE | ||
57 | #endif | ||
58 | |||
59 | #define NEED_EVENTS | ||
60 | #define NEED_REPLIES | ||
61 | |||
62 | /* Apparently some X11 systems can't include this multiple times... */ | ||
63 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
64 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
65 | #include <X11/Xlibint.h> | ||
66 | #endif | ||
67 | |||
68 | #include "../extensions/xf86dga.h" | ||
69 | #include "../extensions/xf86dgastr.h" | ||
70 | #include "../extensions/Xext.h" | ||
71 | #include "../extensions/extutil.h" | ||
72 | |||
73 | extern XExtDisplayInfo* SDL_NAME(xdga_find_display)(Display*); | ||
74 | extern char *SDL_NAME(xdga_extension_name); | ||
75 | |||
76 | #define XF86DGACheckExtension(dpy,i,val) \ | ||
77 | XextCheckExtension (dpy, i, SDL_NAME(xdga_extension_name), val) | ||
78 | |||
79 | /***************************************************************************** | ||
80 | * * | ||
81 | * public XFree86-DGA Extension routines * | ||
82 | * * | ||
83 | *****************************************************************************/ | ||
84 | |||
85 | Bool SDL_NAME(XF86DGAQueryExtension) ( | ||
86 | Display *dpy, | ||
87 | int *event_basep, | ||
88 | int *error_basep | ||
89 | ){ | ||
90 | return SDL_NAME(XDGAQueryExtension)(dpy, event_basep, error_basep); | ||
91 | } | ||
92 | |||
93 | Bool SDL_NAME(XF86DGAQueryVersion)( | ||
94 | Display* dpy, | ||
95 | int* majorVersion, | ||
96 | int* minorVersion | ||
97 | ){ | ||
98 | return SDL_NAME(XDGAQueryVersion)(dpy, majorVersion, minorVersion); | ||
99 | } | ||
100 | |||
101 | Bool SDL_NAME(XF86DGAGetVideoLL)( | ||
102 | Display* dpy, | ||
103 | int screen, | ||
104 | int *offset, | ||
105 | int *width, | ||
106 | int *bank_size, | ||
107 | int *ram_size | ||
108 | ){ | ||
109 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
110 | xXF86DGAGetVideoLLReply rep; | ||
111 | xXF86DGAGetVideoLLReq *req; | ||
112 | |||
113 | XF86DGACheckExtension (dpy, info, False); | ||
114 | |||
115 | LockDisplay(dpy); | ||
116 | GetReq(XF86DGAGetVideoLL, req); | ||
117 | req->reqType = info->codes->major_opcode; | ||
118 | req->dgaReqType = X_XF86DGAGetVideoLL; | ||
119 | req->screen = screen; | ||
120 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
121 | UnlockDisplay(dpy); | ||
122 | SyncHandle(); | ||
123 | return False; | ||
124 | } | ||
125 | |||
126 | *offset = /*(char *)*/rep.offset; | ||
127 | *width = rep.width; | ||
128 | *bank_size = rep.bank_size; | ||
129 | *ram_size = rep.ram_size; | ||
130 | |||
131 | UnlockDisplay(dpy); | ||
132 | SyncHandle(); | ||
133 | return True; | ||
134 | } | ||
135 | |||
136 | |||
137 | Bool SDL_NAME(XF86DGADirectVideoLL)( | ||
138 | Display* dpy, | ||
139 | int screen, | ||
140 | int enable | ||
141 | ){ | ||
142 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
143 | xXF86DGADirectVideoReq *req; | ||
144 | |||
145 | XF86DGACheckExtension (dpy, info, False); | ||
146 | |||
147 | LockDisplay(dpy); | ||
148 | GetReq(XF86DGADirectVideo, req); | ||
149 | req->reqType = info->codes->major_opcode; | ||
150 | req->dgaReqType = X_XF86DGADirectVideo; | ||
151 | req->screen = screen; | ||
152 | req->enable = enable; | ||
153 | UnlockDisplay(dpy); | ||
154 | SyncHandle(); | ||
155 | XSync(dpy,False); | ||
156 | return True; | ||
157 | } | ||
158 | |||
159 | Bool SDL_NAME(XF86DGAGetViewPortSize)( | ||
160 | Display* dpy, | ||
161 | int screen, | ||
162 | int *width, | ||
163 | int *height | ||
164 | ){ | ||
165 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
166 | xXF86DGAGetViewPortSizeReply rep; | ||
167 | xXF86DGAGetViewPortSizeReq *req; | ||
168 | |||
169 | XF86DGACheckExtension (dpy, info, False); | ||
170 | |||
171 | LockDisplay(dpy); | ||
172 | GetReq(XF86DGAGetViewPortSize, req); | ||
173 | req->reqType = info->codes->major_opcode; | ||
174 | req->dgaReqType = X_XF86DGAGetViewPortSize; | ||
175 | req->screen = screen; | ||
176 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
177 | UnlockDisplay(dpy); | ||
178 | SyncHandle(); | ||
179 | return False; | ||
180 | } | ||
181 | |||
182 | *width = rep.width; | ||
183 | *height = rep.height; | ||
184 | |||
185 | UnlockDisplay(dpy); | ||
186 | SyncHandle(); | ||
187 | return True; | ||
188 | } | ||
189 | |||
190 | |||
191 | Bool SDL_NAME(XF86DGASetViewPort)( | ||
192 | Display* dpy, | ||
193 | int screen, | ||
194 | int x, | ||
195 | int y | ||
196 | ){ | ||
197 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
198 | xXF86DGASetViewPortReq *req; | ||
199 | |||
200 | XF86DGACheckExtension (dpy, info, False); | ||
201 | |||
202 | LockDisplay(dpy); | ||
203 | GetReq(XF86DGASetViewPort, req); | ||
204 | req->reqType = info->codes->major_opcode; | ||
205 | req->dgaReqType = X_XF86DGASetViewPort; | ||
206 | req->screen = screen; | ||
207 | req->x = x; | ||
208 | req->y = y; | ||
209 | UnlockDisplay(dpy); | ||
210 | SyncHandle(); | ||
211 | XSync(dpy,False); | ||
212 | return True; | ||
213 | } | ||
214 | |||
215 | |||
216 | Bool SDL_NAME(XF86DGAGetVidPage)( | ||
217 | Display* dpy, | ||
218 | int screen, | ||
219 | int *vpage | ||
220 | ){ | ||
221 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
222 | xXF86DGAGetVidPageReply rep; | ||
223 | xXF86DGAGetVidPageReq *req; | ||
224 | |||
225 | XF86DGACheckExtension (dpy, info, False); | ||
226 | |||
227 | LockDisplay(dpy); | ||
228 | GetReq(XF86DGAGetVidPage, req); | ||
229 | req->reqType = info->codes->major_opcode; | ||
230 | req->dgaReqType = X_XF86DGAGetVidPage; | ||
231 | req->screen = screen; | ||
232 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
233 | UnlockDisplay(dpy); | ||
234 | SyncHandle(); | ||
235 | return False; | ||
236 | } | ||
237 | |||
238 | *vpage = rep.vpage; | ||
239 | UnlockDisplay(dpy); | ||
240 | SyncHandle(); | ||
241 | return True; | ||
242 | } | ||
243 | |||
244 | |||
245 | Bool SDL_NAME(XF86DGASetVidPage)( | ||
246 | Display* dpy, | ||
247 | int screen, | ||
248 | int vpage | ||
249 | ){ | ||
250 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
251 | xXF86DGASetVidPageReq *req; | ||
252 | |||
253 | XF86DGACheckExtension (dpy, info, False); | ||
254 | |||
255 | LockDisplay(dpy); | ||
256 | GetReq(XF86DGASetVidPage, req); | ||
257 | req->reqType = info->codes->major_opcode; | ||
258 | req->dgaReqType = X_XF86DGASetVidPage; | ||
259 | req->screen = screen; | ||
260 | req->vpage = vpage; | ||
261 | UnlockDisplay(dpy); | ||
262 | SyncHandle(); | ||
263 | XSync(dpy,False); | ||
264 | return True; | ||
265 | } | ||
266 | |||
267 | Bool SDL_NAME(XF86DGAInstallColormap)( | ||
268 | Display* dpy, | ||
269 | int screen, | ||
270 | Colormap cmap | ||
271 | ){ | ||
272 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
273 | xXF86DGAInstallColormapReq *req; | ||
274 | |||
275 | XF86DGACheckExtension (dpy, info, False); | ||
276 | |||
277 | LockDisplay(dpy); | ||
278 | GetReq(XF86DGAInstallColormap, req); | ||
279 | req->reqType = info->codes->major_opcode; | ||
280 | req->dgaReqType = X_XF86DGAInstallColormap; | ||
281 | req->screen = screen; | ||
282 | req->id = cmap; | ||
283 | UnlockDisplay(dpy); | ||
284 | SyncHandle(); | ||
285 | XSync(dpy,False); | ||
286 | return True; | ||
287 | } | ||
288 | |||
289 | Bool SDL_NAME(XF86DGAQueryDirectVideo)( | ||
290 | Display *dpy, | ||
291 | int screen, | ||
292 | int *flags | ||
293 | ){ | ||
294 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
295 | xXF86DGAQueryDirectVideoReply rep; | ||
296 | xXF86DGAQueryDirectVideoReq *req; | ||
297 | |||
298 | XF86DGACheckExtension (dpy, info, False); | ||
299 | |||
300 | LockDisplay(dpy); | ||
301 | GetReq(XF86DGAQueryDirectVideo, req); | ||
302 | req->reqType = info->codes->major_opcode; | ||
303 | req->dgaReqType = X_XF86DGAQueryDirectVideo; | ||
304 | req->screen = screen; | ||
305 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
306 | UnlockDisplay(dpy); | ||
307 | SyncHandle(); | ||
308 | return False; | ||
309 | } | ||
310 | *flags = rep.flags; | ||
311 | UnlockDisplay(dpy); | ||
312 | SyncHandle(); | ||
313 | return True; | ||
314 | } | ||
315 | |||
316 | Bool SDL_NAME(XF86DGAViewPortChanged)( | ||
317 | Display *dpy, | ||
318 | int screen, | ||
319 | int n | ||
320 | ){ | ||
321 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
322 | xXF86DGAViewPortChangedReply rep; | ||
323 | xXF86DGAViewPortChangedReq *req; | ||
324 | |||
325 | XF86DGACheckExtension (dpy, info, False); | ||
326 | |||
327 | LockDisplay(dpy); | ||
328 | GetReq(XF86DGAViewPortChanged, req); | ||
329 | req->reqType = info->codes->major_opcode; | ||
330 | req->dgaReqType = X_XF86DGAViewPortChanged; | ||
331 | req->screen = screen; | ||
332 | req->n = n; | ||
333 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
334 | UnlockDisplay(dpy); | ||
335 | SyncHandle(); | ||
336 | return False; | ||
337 | } | ||
338 | UnlockDisplay(dpy); | ||
339 | SyncHandle(); | ||
340 | return rep.result; | ||
341 | } | ||
342 | |||
343 | |||
344 | |||
345 | /* Helper functions */ | ||
346 | |||
347 | #include <X11/Xmd.h> | ||
348 | #include "../extensions/xf86dga.h" | ||
349 | #include <stdlib.h> | ||
350 | #include <stdio.h> | ||
351 | #include <fcntl.h> | ||
352 | #if defined(ISC) | ||
353 | # define HAS_SVR3_MMAP | ||
354 | # include <sys/types.h> | ||
355 | # include <errno.h> | ||
356 | |||
357 | # include <sys/at_ansi.h> | ||
358 | # include <sys/kd.h> | ||
359 | |||
360 | # include <sys/sysmacros.h> | ||
361 | # include <sys/immu.h> | ||
362 | # include <sys/region.h> | ||
363 | |||
364 | # include <sys/mmap.h> | ||
365 | #else | ||
366 | # if !defined(Lynx) | ||
367 | # if !defined(__EMX__) | ||
368 | # include <sys/mman.h> | ||
369 | # endif | ||
370 | # else | ||
371 | # include <sys/types.h> | ||
372 | # include <errno.h> | ||
373 | # include <smem.h> | ||
374 | # endif | ||
375 | #endif | ||
376 | #include <sys/wait.h> | ||
377 | #include <signal.h> | ||
378 | #include <unistd.h> | ||
379 | |||
380 | #if defined(SVR4) && !defined(sun) && !defined(SCO325) | ||
381 | #define DEV_MEM "/dev/pmem" | ||
382 | #elif defined(SVR4) && defined(sun) | ||
383 | #define DEV_MEM "/dev/xsvc" | ||
384 | #else | ||
385 | #define DEV_MEM "/dev/mem" | ||
386 | #endif | ||
387 | |||
388 | typedef struct { | ||
389 | unsigned long physaddr; /* actual requested physical address */ | ||
390 | unsigned long size; /* actual requested map size */ | ||
391 | unsigned long delta; /* delta to account for page alignment */ | ||
392 | void * vaddr; /* mapped address, without the delta */ | ||
393 | int refcount; /* reference count */ | ||
394 | } MapRec, *MapPtr; | ||
395 | |||
396 | typedef struct { | ||
397 | Display * display; | ||
398 | int screen; | ||
399 | MapPtr map; | ||
400 | } ScrRec, *ScrPtr; | ||
401 | |||
402 | static int mapFd = -1; | ||
403 | static int numMaps = 0; | ||
404 | static int numScrs = 0; | ||
405 | static MapPtr *mapList = NULL; | ||
406 | static ScrPtr *scrList = NULL; | ||
407 | |||
408 | static MapPtr | ||
409 | AddMap(void) | ||
410 | { | ||
411 | MapPtr *old; | ||
412 | |||
413 | old = mapList; | ||
414 | mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1)); | ||
415 | if (!mapList) { | ||
416 | mapList = old; | ||
417 | return NULL; | ||
418 | } | ||
419 | mapList[numMaps] = malloc(sizeof(MapRec)); | ||
420 | if (!mapList[numMaps]) | ||
421 | return NULL; | ||
422 | return mapList[numMaps++]; | ||
423 | } | ||
424 | |||
425 | static ScrPtr | ||
426 | AddScr(void) | ||
427 | { | ||
428 | ScrPtr *old; | ||
429 | |||
430 | old = scrList; | ||
431 | scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1)); | ||
432 | if (!scrList) { | ||
433 | scrList = old; | ||
434 | return NULL; | ||
435 | } | ||
436 | scrList[numScrs] = malloc(sizeof(ScrRec)); | ||
437 | if (!scrList[numScrs]) | ||
438 | return NULL; | ||
439 | return scrList[numScrs++]; | ||
440 | } | ||
441 | |||
442 | static MapPtr | ||
443 | FindMap(unsigned long address, unsigned long size) | ||
444 | { | ||
445 | int i; | ||
446 | |||
447 | for (i = 0; i < numMaps; i++) { | ||
448 | if (mapList[i]->physaddr == address && | ||
449 | mapList[i]->size == size) | ||
450 | return mapList[i]; | ||
451 | } | ||
452 | return NULL; | ||
453 | } | ||
454 | |||
455 | static ScrPtr | ||
456 | FindScr(Display *display, int screen) | ||
457 | { | ||
458 | int i; | ||
459 | |||
460 | for (i = 0; i < numScrs; i++) { | ||
461 | if (scrList[i]->display == display && | ||
462 | scrList[i]->screen == screen) | ||
463 | return scrList[i]; | ||
464 | } | ||
465 | return NULL; | ||
466 | } | ||
467 | |||
468 | static void * | ||
469 | MapPhysAddress(unsigned long address, unsigned long size) | ||
470 | { | ||
471 | unsigned long offset, delta; | ||
472 | int pagesize = -1; | ||
473 | void *vaddr; | ||
474 | MapPtr mp; | ||
475 | #if defined(ISC) && defined(HAS_SVR3_MMAP) | ||
476 | struct kd_memloc mloc; | ||
477 | #elif defined(__EMX__) | ||
478 | APIRET rc; | ||
479 | ULONG action; | ||
480 | HFILE hfd; | ||
481 | #endif | ||
482 | |||
483 | if ((mp = FindMap(address, size))) { | ||
484 | mp->refcount++; | ||
485 | return (void *)((unsigned long)mp->vaddr + mp->delta); | ||
486 | } | ||
487 | |||
488 | #if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE) | ||
489 | pagesize = sysconf(_SC_PAGESIZE); | ||
490 | #endif | ||
491 | #ifdef _SC_PAGE_SIZE | ||
492 | if (pagesize == -1) | ||
493 | pagesize = sysconf(_SC_PAGE_SIZE); | ||
494 | #endif | ||
495 | #ifdef HAS_GETPAGESIZE | ||
496 | if (pagesize == -1) | ||
497 | pagesize = getpagesize(); | ||
498 | #endif | ||
499 | #ifdef PAGE_SIZE | ||
500 | if (pagesize == -1) | ||
501 | pagesize = PAGE_SIZE; | ||
502 | #endif | ||
503 | if (pagesize == -1) | ||
504 | pagesize = 4096; | ||
505 | |||
506 | delta = address % pagesize; | ||
507 | offset = address - delta; | ||
508 | |||
509 | #if defined(ISC) && defined(HAS_SVR3_MMAP) | ||
510 | if (mapFd < 0) { | ||
511 | if ((mapFd = open("/dev/mmap", O_RDWR)) < 0) | ||
512 | return NULL; | ||
513 | } | ||
514 | mloc.vaddr = (char *)0; | ||
515 | mloc.physaddr = (char *)offset; | ||
516 | mloc.length = size + delta; | ||
517 | mloc.ioflg=1; | ||
518 | |||
519 | if ((vaddr = (void *)ioctl(mapFd, MAP, &mloc)) == (void *)-1) | ||
520 | return NULL; | ||
521 | #elif defined (__EMX__) | ||
522 | /* | ||
523 | * Dragon warning here! /dev/pmap$ is never closed, except on progam exit. | ||
524 | * Consecutive calling of this routine will make PMAP$ driver run out | ||
525 | * of memory handles. Some umap/close mechanism should be provided | ||
526 | */ | ||
527 | |||
528 | rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN, | ||
529 | OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL); | ||
530 | if (rc != 0) | ||
531 | return NULL; | ||
532 | { | ||
533 | struct map_ioctl { | ||
534 | union { | ||
535 | ULONG phys; | ||
536 | void* user; | ||
537 | } a; | ||
538 | ULONG size; | ||
539 | } pmap,dmap; | ||
540 | ULONG plen,dlen; | ||
541 | #define XFREE86_PMAP 0x76 | ||
542 | #define PMAP_MAP 0x44 | ||
543 | |||
544 | pmap.a.phys = offset; | ||
545 | pmap.size = size + delta; | ||
546 | rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP, | ||
547 | (PULONG)&pmap, sizeof(pmap), &plen, | ||
548 | (PULONG)&dmap, sizeof(dmap), &dlen); | ||
549 | if (rc == 0) { | ||
550 | vaddr = dmap.a.user; | ||
551 | } | ||
552 | } | ||
553 | if (rc != 0) | ||
554 | return NULL; | ||
555 | #elif defined (Lynx) | ||
556 | vaddr = (void *)smem_create("XF86DGA", (char *)offset, | ||
557 | size + delta, SM_READ|SM_WRITE); | ||
558 | #else | ||
559 | #ifndef MAP_FILE | ||
560 | #define MAP_FILE 0 | ||
561 | #endif | ||
562 | if (mapFd < 0) { | ||
563 | if ((mapFd = open(DEV_MEM, O_RDWR)) < 0) | ||
564 | return NULL; | ||
565 | } | ||
566 | vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE, | ||
567 | MAP_FILE | MAP_SHARED, mapFd, (off_t)offset); | ||
568 | if (vaddr == (void *)-1) | ||
569 | return NULL; | ||
570 | #endif | ||
571 | |||
572 | if (!vaddr) { | ||
573 | if (!(mp = AddMap())) | ||
574 | return NULL; | ||
575 | mp->physaddr = address; | ||
576 | mp->size = size; | ||
577 | mp->delta = delta; | ||
578 | mp->vaddr = vaddr; | ||
579 | mp->refcount = 1; | ||
580 | } | ||
581 | return (void *)((unsigned long)vaddr + delta); | ||
582 | } | ||
583 | |||
584 | /* | ||
585 | * Still need to find a clean way of detecting the death of a DGA app | ||
586 | * and returning things to normal - Jon | ||
587 | * This is here to help debugging without rebooting... Also C-A-BS | ||
588 | * should restore text mode. | ||
589 | */ | ||
590 | |||
591 | int | ||
592 | SDL_NAME(XF86DGAForkApp)(int screen) | ||
593 | { | ||
594 | pid_t pid; | ||
595 | int status; | ||
596 | int i; | ||
597 | |||
598 | /* fork the app, parent hangs around to clean up */ | ||
599 | if ((pid = fork()) > 0) { | ||
600 | ScrPtr sp; | ||
601 | |||
602 | waitpid(pid, &status, 0); | ||
603 | for (i = 0; i < numScrs; i++) { | ||
604 | sp = scrList[i]; | ||
605 | SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0); | ||
606 | XSync(sp->display, False); | ||
607 | } | ||
608 | if (WIFEXITED(status)) | ||
609 | _exit(0); | ||
610 | else | ||
611 | _exit(-1); | ||
612 | } | ||
613 | return pid; | ||
614 | } | ||
615 | |||
616 | |||
617 | Bool | ||
618 | SDL_NAME(XF86DGADirectVideo)( | ||
619 | Display *dis, | ||
620 | int screen, | ||
621 | int enable | ||
622 | ){ | ||
623 | ScrPtr sp; | ||
624 | MapPtr mp = NULL; | ||
625 | |||
626 | if ((sp = FindScr(dis, screen))) | ||
627 | mp = sp->map; | ||
628 | |||
629 | if (enable & XF86DGADirectGraphics) { | ||
630 | #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \ | ||
631 | && !defined(__EMX__) | ||
632 | if (mp && mp->vaddr) | ||
633 | mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE); | ||
634 | #endif | ||
635 | } else { | ||
636 | #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \ | ||
637 | && !defined(__EMX__) | ||
638 | if (mp && mp->vaddr) | ||
639 | mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ); | ||
640 | #elif defined(Lynx) | ||
641 | /* XXX this doesn't allow enable after disable */ | ||
642 | smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH); | ||
643 | smem_remove("XF86DGA"); | ||
644 | #endif | ||
645 | } | ||
646 | |||
647 | SDL_NAME(XF86DGADirectVideoLL)(dis, screen, enable); | ||
648 | return 1; | ||
649 | } | ||
650 | |||
651 | |||
652 | static void | ||
653 | XF86cleanup(int sig) | ||
654 | { | ||
655 | ScrPtr sp; | ||
656 | int i; | ||
657 | static char beenhere = 0; | ||
658 | |||
659 | if (beenhere) | ||
660 | _exit(3); | ||
661 | beenhere = 1; | ||
662 | |||
663 | for (i = 0; i < numScrs; i++) { | ||
664 | sp = scrList[i]; | ||
665 | SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0); | ||
666 | XSync(sp->display, False); | ||
667 | } | ||
668 | _exit(3); | ||
669 | } | ||
670 | |||
671 | Bool | ||
672 | SDL_NAME(XF86DGAGetVideo)( | ||
673 | Display *dis, | ||
674 | int screen, | ||
675 | char **addr, | ||
676 | int *width, | ||
677 | int *bank, | ||
678 | int *ram | ||
679 | ){ | ||
680 | /*unsigned long*/ int offset; | ||
681 | static int beenHere = 0; | ||
682 | ScrPtr sp; | ||
683 | MapPtr mp; | ||
684 | |||
685 | if (!(sp = FindScr(dis, screen))) { | ||
686 | if (!(sp = AddScr())) { | ||
687 | fprintf(stderr, "XF86DGAGetVideo: malloc failure\n"); | ||
688 | exit(-2); | ||
689 | } | ||
690 | sp->display = dis; | ||
691 | sp->screen = screen; | ||
692 | sp->map = NULL; | ||
693 | } | ||
694 | |||
695 | SDL_NAME(XF86DGAGetVideoLL)(dis, screen , &offset, width, bank, ram); | ||
696 | |||
697 | *addr = MapPhysAddress(offset, *bank); | ||
698 | if (*addr == NULL) { | ||
699 | fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n", | ||
700 | strerror(errno)); | ||
701 | exit(-2); | ||
702 | } | ||
703 | |||
704 | if ((mp = FindMap(offset, *bank))) | ||
705 | sp->map = mp; | ||
706 | |||
707 | if (!beenHere) { | ||
708 | beenHere = 1; | ||
709 | atexit((void(*)(void))XF86cleanup); | ||
710 | /* one shot XF86cleanup attempts */ | ||
711 | signal(SIGSEGV, XF86cleanup); | ||
712 | #ifdef SIGBUS | ||
713 | signal(SIGBUS, XF86cleanup); | ||
714 | #endif | ||
715 | signal(SIGHUP, XF86cleanup); | ||
716 | signal(SIGFPE, XF86cleanup); | ||
717 | } | ||
718 | |||
719 | return 1; | ||
720 | } | ||
721 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA2.c b/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA2.c new file mode 100644 index 0000000000..11d4fddc6a --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xxf86dga/XF86DGA2.c | |||
@@ -0,0 +1,993 @@ | |||
1 | /* $XFree86: xc/lib/Xxf86dga/XF86DGA2.c,v 1.18 2001/08/17 13:27:51 dawes Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 1995 Jon Tombs | ||
5 | Copyright (c) 1995,1996 The XFree86 Project, Inc | ||
6 | |||
7 | */ | ||
8 | |||
9 | /* THIS IS NOT AN X CONSORTIUM STANDARD */ | ||
10 | |||
11 | #ifdef __EMX__ /* needed here to override certain constants in X headers */ | ||
12 | #define INCL_DOS | ||
13 | #define INCL_DOSIOCTL | ||
14 | #include <os2.h> | ||
15 | #endif | ||
16 | |||
17 | #define NEED_EVENTS | ||
18 | #define NEED_REPLIES | ||
19 | |||
20 | /* Apparently some X11 systems can't include this multiple times... */ | ||
21 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
22 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
23 | #include <X11/Xlibint.h> | ||
24 | #endif | ||
25 | |||
26 | #include "../extensions/xf86dga.h" | ||
27 | #include "../extensions/xf86dgastr.h" | ||
28 | #include "../extensions/Xext.h" | ||
29 | #include "../extensions/extutil.h" | ||
30 | #include <stdio.h> | ||
31 | |||
32 | #if defined(ENABLE_FBCON) /* Needed for framebuffer console support */ | ||
33 | #include <sys/ioctl.h> | ||
34 | #include <linux/fb.h> | ||
35 | #endif | ||
36 | |||
37 | /* If you change this, change the Bases[] array below as well */ | ||
38 | #define MAX_HEADS 16 | ||
39 | |||
40 | char *SDL_NAME(xdga_extension_name) = XF86DGANAME; | ||
41 | |||
42 | static XExtensionInfo _xdga_info_data; | ||
43 | static XExtensionInfo *xdga_info = &_xdga_info_data; | ||
44 | |||
45 | |||
46 | Bool SDL_NAME(XDGAMapFramebuffer)(int, char *, unsigned char*, CARD32, CARD32, CARD32); | ||
47 | void SDL_NAME(XDGAUnmapFramebuffer)(int); | ||
48 | unsigned char* SDL_NAME(XDGAGetMappedMemory)(int); | ||
49 | |||
50 | #define XDGACheckExtension(dpy,i,val) \ | ||
51 | XextCheckExtension (dpy, i, SDL_NAME(xdga_extension_name), val) | ||
52 | |||
53 | /***************************************************************************** | ||
54 | * * | ||
55 | * private utility routines * | ||
56 | * * | ||
57 | *****************************************************************************/ | ||
58 | |||
59 | static int xdga_close_display(Display *dpy, XExtCodes *codes); | ||
60 | static Bool xdga_wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev); | ||
61 | static Status xdga_event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev); | ||
62 | |||
63 | static XExtensionHooks xdga_extension_hooks = { | ||
64 | NULL, /* create_gc */ | ||
65 | NULL, /* copy_gc */ | ||
66 | NULL, /* flush_gc */ | ||
67 | NULL, /* free_gc */ | ||
68 | NULL, /* create_font */ | ||
69 | NULL, /* free_font */ | ||
70 | xdga_close_display, /* close_display */ | ||
71 | xdga_wire_to_event, /* wire_to_event */ | ||
72 | xdga_event_to_wire, /* event_to_wire */ | ||
73 | NULL, /* error */ | ||
74 | NULL, /* error_string */ | ||
75 | }; | ||
76 | |||
77 | static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info) | ||
78 | |||
79 | |||
80 | XEXT_GENERATE_FIND_DISPLAY (SDL_NAME(xdga_find_display), xdga_info, | ||
81 | "XFree86-DGA", | ||
82 | &xdga_extension_hooks, | ||
83 | 0, NULL) | ||
84 | |||
85 | |||
86 | static Status | ||
87 | xdga_event_to_wire( | ||
88 | Display *dpy, | ||
89 | XEvent *event, | ||
90 | xEvent *wire_ev | ||
91 | ){ | ||
92 | return True; | ||
93 | } | ||
94 | |||
95 | static Bool | ||
96 | xdga_wire_to_event( | ||
97 | Display *dpy, | ||
98 | XEvent *event, | ||
99 | xEvent *wire_ev | ||
100 | ){ | ||
101 | dgaEvent *wire = (dgaEvent *) wire_ev; | ||
102 | SDL_NAME(XDGAButtonEvent) *bevent; | ||
103 | SDL_NAME(XDGAKeyEvent) *kevent; | ||
104 | SDL_NAME(XDGAMotionEvent) *mevent; | ||
105 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
106 | |||
107 | XDGACheckExtension (dpy, info, False); | ||
108 | |||
109 | switch((wire->u.u.type & 0x7f) - info->codes->first_event) { | ||
110 | case MotionNotify: | ||
111 | mevent = (SDL_NAME(XDGAMotionEvent)*)event; | ||
112 | mevent->type = wire->u.u.type & 0x7F; | ||
113 | mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); | ||
114 | mevent->display = dpy; | ||
115 | mevent->screen = wire->u.event.screen; | ||
116 | mevent->time = wire->u.event.time; | ||
117 | mevent->state = wire->u.event.state; | ||
118 | mevent->dx = wire->u.event.dx; | ||
119 | mevent->dy = wire->u.event.dy; | ||
120 | return True; | ||
121 | case ButtonPress: | ||
122 | case ButtonRelease: | ||
123 | bevent = (SDL_NAME(XDGAButtonEvent)*)event; | ||
124 | bevent->type = wire->u.u.type & 0x7F; | ||
125 | bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); | ||
126 | bevent->display = dpy; | ||
127 | bevent->screen = wire->u.event.screen; | ||
128 | bevent->time = wire->u.event.time; | ||
129 | bevent->state = wire->u.event.state; | ||
130 | bevent->button = wire->u.u.detail; | ||
131 | return True; | ||
132 | case KeyPress: | ||
133 | case KeyRelease: | ||
134 | kevent = (SDL_NAME(XDGAKeyEvent)*)event; | ||
135 | kevent->type = wire->u.u.type & 0x7F; | ||
136 | kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); | ||
137 | kevent->display = dpy; | ||
138 | kevent->screen = wire->u.event.screen; | ||
139 | kevent->time = wire->u.event.time; | ||
140 | kevent->state = wire->u.event.state; | ||
141 | kevent->keycode = wire->u.u.detail; | ||
142 | return True; | ||
143 | } | ||
144 | |||
145 | return False; | ||
146 | } | ||
147 | |||
148 | |||
149 | Bool SDL_NAME(XDGAQueryExtension) ( | ||
150 | Display *dpy, | ||
151 | int *event_basep, | ||
152 | int *error_basep | ||
153 | ){ | ||
154 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
155 | |||
156 | if (XextHasExtension(info)) { | ||
157 | *event_basep = info->codes->first_event; | ||
158 | *error_basep = info->codes->first_error; | ||
159 | return True; | ||
160 | } else { | ||
161 | return False; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | |||
166 | Bool SDL_NAME(XDGAQueryVersion)( | ||
167 | Display *dpy, | ||
168 | int *majorVersion, | ||
169 | int *minorVersion | ||
170 | ){ | ||
171 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
172 | xXDGAQueryVersionReply rep; | ||
173 | xXDGAQueryVersionReq *req; | ||
174 | |||
175 | XDGACheckExtension (dpy, info, False); | ||
176 | |||
177 | LockDisplay(dpy); | ||
178 | GetReq(XDGAQueryVersion, req); | ||
179 | req->reqType = info->codes->major_opcode; | ||
180 | req->dgaReqType = X_XDGAQueryVersion; | ||
181 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
182 | UnlockDisplay(dpy); | ||
183 | SyncHandle(); | ||
184 | return False; | ||
185 | } | ||
186 | *majorVersion = rep.majorVersion; | ||
187 | *minorVersion = rep.minorVersion; | ||
188 | UnlockDisplay(dpy); | ||
189 | SyncHandle(); | ||
190 | if (*majorVersion >= 2) | ||
191 | { | ||
192 | int i, j; | ||
193 | |||
194 | for (i = 0, j = info->codes->first_event; | ||
195 | i < XF86DGANumberEvents; | ||
196 | i++, j++) | ||
197 | { | ||
198 | XESetWireToEvent(dpy, j, xdga_wire_to_event); | ||
199 | XESetEventToWire(dpy, j, xdga_event_to_wire); | ||
200 | } | ||
201 | SDL_NAME(XDGASetClientVersion)(dpy); | ||
202 | } | ||
203 | return True; | ||
204 | } | ||
205 | |||
206 | Bool SDL_NAME(XDGASetClientVersion)( | ||
207 | Display *dpy | ||
208 | ){ | ||
209 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
210 | xXDGASetClientVersionReq *req; | ||
211 | |||
212 | XDGACheckExtension (dpy, info, False); | ||
213 | |||
214 | LockDisplay(dpy); | ||
215 | GetReq(XDGASetClientVersion, req); | ||
216 | req->reqType = info->codes->major_opcode; | ||
217 | req->dgaReqType = X_XDGASetClientVersion; | ||
218 | req->major = XDGA_MAJOR_VERSION; | ||
219 | req->minor = XDGA_MINOR_VERSION; | ||
220 | UnlockDisplay(dpy); | ||
221 | SyncHandle(); | ||
222 | return True; | ||
223 | } | ||
224 | |||
225 | Bool SDL_NAME(XDGAOpenFramebuffer)( | ||
226 | Display *dpy, | ||
227 | int screen | ||
228 | ){ | ||
229 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
230 | xXDGAOpenFramebufferReply rep; | ||
231 | xXDGAOpenFramebufferReq *req; | ||
232 | char *deviceName = NULL; | ||
233 | Bool ret; | ||
234 | |||
235 | XDGACheckExtension (dpy, info, False); | ||
236 | |||
237 | LockDisplay(dpy); | ||
238 | GetReq(XDGAOpenFramebuffer, req); | ||
239 | req->reqType = info->codes->major_opcode; | ||
240 | req->dgaReqType = X_XDGAOpenFramebuffer; | ||
241 | req->screen = screen; | ||
242 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
243 | UnlockDisplay(dpy); | ||
244 | SyncHandle(); | ||
245 | return False; | ||
246 | } | ||
247 | |||
248 | if(rep.length) { | ||
249 | deviceName = Xmalloc(rep.length << 2); | ||
250 | _XRead(dpy, deviceName, rep.length << 2); | ||
251 | } | ||
252 | |||
253 | ret = SDL_NAME(XDGAMapFramebuffer)(screen, deviceName, | ||
254 | (unsigned char*)(long)rep.mem1, | ||
255 | rep.size, rep.offset, rep.extra); | ||
256 | |||
257 | if(deviceName) | ||
258 | Xfree(deviceName); | ||
259 | |||
260 | UnlockDisplay(dpy); | ||
261 | SyncHandle(); | ||
262 | return ret; | ||
263 | } | ||
264 | |||
265 | void SDL_NAME(XDGACloseFramebuffer)( | ||
266 | Display *dpy, | ||
267 | int screen | ||
268 | ){ | ||
269 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
270 | xXDGACloseFramebufferReq *req; | ||
271 | |||
272 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
273 | |||
274 | SDL_NAME(XDGAUnmapFramebuffer)(screen); | ||
275 | |||
276 | LockDisplay(dpy); | ||
277 | GetReq(XDGACloseFramebuffer, req); | ||
278 | req->reqType = info->codes->major_opcode; | ||
279 | req->dgaReqType = X_XDGACloseFramebuffer; | ||
280 | req->screen = screen; | ||
281 | UnlockDisplay(dpy); | ||
282 | SyncHandle(); | ||
283 | } | ||
284 | |||
285 | |||
286 | |||
287 | SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)( | ||
288 | Display *dpy, | ||
289 | int screen, | ||
290 | int *num | ||
291 | ){ | ||
292 | XExtDisplayInfo *dinfo = SDL_NAME(xdga_find_display) (dpy); | ||
293 | xXDGAQueryModesReply rep; | ||
294 | xXDGAQueryModesReq *req; | ||
295 | SDL_NAME(XDGAMode) *modes = NULL; | ||
296 | |||
297 | *num = 0; | ||
298 | |||
299 | XDGACheckExtension (dpy, dinfo, NULL); | ||
300 | |||
301 | LockDisplay(dpy); | ||
302 | GetReq(XDGAQueryModes, req); | ||
303 | req->reqType = dinfo->codes->major_opcode; | ||
304 | req->dgaReqType = X_XDGAQueryModes; | ||
305 | req->screen = screen; | ||
306 | |||
307 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
308 | if(rep.length) { | ||
309 | xXDGAModeInfo info; | ||
310 | int i, size; | ||
311 | char *offset; | ||
312 | |||
313 | size = rep.length << 2; | ||
314 | size -= rep.number * sz_xXDGAModeInfo; /* find text size */ | ||
315 | modes = (SDL_NAME(XDGAMode)*)Xmalloc((rep.number * sizeof(SDL_NAME(XDGAMode))) + size); | ||
316 | offset = (char*)(&modes[rep.number]); /* start of text */ | ||
317 | |||
318 | |||
319 | if(modes) { | ||
320 | for(i = 0; i < rep.number; i++) { | ||
321 | _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo); | ||
322 | |||
323 | modes[i].num = info.num; | ||
324 | modes[i].verticalRefresh = | ||
325 | (float)info.vsync_num / (float)info.vsync_den; | ||
326 | modes[i].flags = info.flags; | ||
327 | modes[i].imageWidth = info.image_width; | ||
328 | modes[i].imageHeight = info.image_height; | ||
329 | modes[i].pixmapWidth = info.pixmap_width; | ||
330 | modes[i].pixmapHeight = info.pixmap_height; | ||
331 | modes[i].bytesPerScanline = info.bytes_per_scanline; | ||
332 | modes[i].byteOrder = info.byte_order; | ||
333 | modes[i].depth = info.depth; | ||
334 | modes[i].bitsPerPixel = info.bpp; | ||
335 | modes[i].redMask = info.red_mask; | ||
336 | modes[i].greenMask = info.green_mask; | ||
337 | modes[i].blueMask = info.blue_mask; | ||
338 | modes[i].visualClass = info.visual_class; | ||
339 | modes[i].viewportWidth = info.viewport_width; | ||
340 | modes[i].viewportHeight = info.viewport_height; | ||
341 | modes[i].xViewportStep = info.viewport_xstep; | ||
342 | modes[i].yViewportStep = info.viewport_ystep; | ||
343 | modes[i].maxViewportX = info.viewport_xmax; | ||
344 | modes[i].maxViewportY = info.viewport_ymax; | ||
345 | modes[i].viewportFlags = info.viewport_flags; | ||
346 | modes[i].reserved1 = info.reserved1; | ||
347 | modes[i].reserved2 = info.reserved2; | ||
348 | |||
349 | _XRead(dpy, offset, info.name_size); | ||
350 | modes[i].name = offset; | ||
351 | offset += info.name_size; | ||
352 | } | ||
353 | *num = rep.number; | ||
354 | } else | ||
355 | _XEatData(dpy, rep.length << 2); | ||
356 | } | ||
357 | } | ||
358 | |||
359 | UnlockDisplay(dpy); | ||
360 | SyncHandle(); | ||
361 | |||
362 | return modes; | ||
363 | } | ||
364 | |||
365 | |||
366 | SDL_NAME(XDGADevice) * | ||
367 | SDL_NAME(XDGASetMode)( | ||
368 | Display *dpy, | ||
369 | int screen, | ||
370 | int mode | ||
371 | ){ | ||
372 | XExtDisplayInfo *dinfo = SDL_NAME(xdga_find_display) (dpy); | ||
373 | xXDGASetModeReply rep; | ||
374 | xXDGASetModeReq *req; | ||
375 | SDL_NAME(XDGADevice) *dev = NULL; | ||
376 | Pixmap pid; | ||
377 | |||
378 | XDGACheckExtension (dpy, dinfo, NULL); | ||
379 | |||
380 | LockDisplay(dpy); | ||
381 | GetReq(XDGASetMode, req); | ||
382 | req->reqType = dinfo->codes->major_opcode; | ||
383 | req->dgaReqType = X_XDGASetMode; | ||
384 | req->screen = screen; | ||
385 | req->mode = mode; | ||
386 | req->pid = pid = XAllocID(dpy); | ||
387 | |||
388 | if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
389 | if(rep.length) { | ||
390 | xXDGAModeInfo info; | ||
391 | int size; | ||
392 | |||
393 | size = rep.length << 2; | ||
394 | size -= sz_xXDGAModeInfo; /* get text size */ | ||
395 | |||
396 | dev = (SDL_NAME(XDGADevice)*)Xmalloc(sizeof(SDL_NAME(XDGADevice)) + size); | ||
397 | |||
398 | if(dev) { | ||
399 | _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo); | ||
400 | |||
401 | dev->mode.num = info.num; | ||
402 | dev->mode.verticalRefresh = | ||
403 | (float)info.vsync_num / (float)info.vsync_den; | ||
404 | dev->mode.flags = info.flags; | ||
405 | dev->mode.imageWidth = info.image_width; | ||
406 | dev->mode.imageHeight = info.image_height; | ||
407 | dev->mode.pixmapWidth = info.pixmap_width; | ||
408 | dev->mode.pixmapHeight = info.pixmap_height; | ||
409 | dev->mode.bytesPerScanline = info.bytes_per_scanline; | ||
410 | dev->mode.byteOrder = info.byte_order; | ||
411 | dev->mode.depth = info.depth; | ||
412 | dev->mode.bitsPerPixel = info.bpp; | ||
413 | dev->mode.redMask = info.red_mask; | ||
414 | dev->mode.greenMask = info.green_mask; | ||
415 | dev->mode.blueMask = info.blue_mask; | ||
416 | dev->mode.visualClass = info.visual_class; | ||
417 | dev->mode.viewportWidth = info.viewport_width; | ||
418 | dev->mode.viewportHeight = info.viewport_height; | ||
419 | dev->mode.xViewportStep = info.viewport_xstep; | ||
420 | dev->mode.yViewportStep = info.viewport_ystep; | ||
421 | dev->mode.maxViewportX = info.viewport_xmax; | ||
422 | dev->mode.maxViewportY = info.viewport_ymax; | ||
423 | dev->mode.viewportFlags = info.viewport_flags; | ||
424 | dev->mode.reserved1 = info.reserved1; | ||
425 | dev->mode.reserved2 = info.reserved2; | ||
426 | |||
427 | dev->mode.name = (char*)(&dev[1]); | ||
428 | _XRead(dpy, dev->mode.name, info.name_size); | ||
429 | |||
430 | dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0; | ||
431 | dev->data = SDL_NAME(XDGAGetMappedMemory)(screen); | ||
432 | |||
433 | if(dev->data) | ||
434 | dev->data += rep.offset; | ||
435 | } | ||
436 | /* not sure what to do if the allocation fails */ | ||
437 | } | ||
438 | } | ||
439 | |||
440 | UnlockDisplay(dpy); | ||
441 | SyncHandle(); | ||
442 | |||
443 | return dev; | ||
444 | } | ||
445 | |||
446 | |||
447 | void SDL_NAME(XDGASetViewport)( | ||
448 | Display *dpy, | ||
449 | int screen, | ||
450 | int x, | ||
451 | int y, | ||
452 | int flags | ||
453 | ){ | ||
454 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
455 | xXDGASetViewportReq *req; | ||
456 | |||
457 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
458 | |||
459 | LockDisplay(dpy); | ||
460 | GetReq(XDGASetViewport, req); | ||
461 | req->reqType = info->codes->major_opcode; | ||
462 | req->dgaReqType = X_XDGASetViewport; | ||
463 | req->screen = screen; | ||
464 | req->x = x; | ||
465 | req->y = y; | ||
466 | req->flags = flags; | ||
467 | UnlockDisplay(dpy); | ||
468 | SyncHandle(); | ||
469 | } | ||
470 | |||
471 | |||
472 | void SDL_NAME(XDGAInstallColormap)( | ||
473 | Display *dpy, | ||
474 | int screen, | ||
475 | Colormap cmap | ||
476 | ){ | ||
477 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
478 | xXDGAInstallColormapReq *req; | ||
479 | |||
480 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
481 | |||
482 | LockDisplay(dpy); | ||
483 | GetReq(XDGAInstallColormap, req); | ||
484 | req->reqType = info->codes->major_opcode; | ||
485 | req->dgaReqType = X_XDGAInstallColormap; | ||
486 | req->screen = screen; | ||
487 | req->cmap = cmap; | ||
488 | UnlockDisplay(dpy); | ||
489 | SyncHandle(); | ||
490 | } | ||
491 | |||
492 | void SDL_NAME(XDGASelectInput)( | ||
493 | Display *dpy, | ||
494 | int screen, | ||
495 | long mask | ||
496 | ){ | ||
497 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
498 | xXDGASelectInputReq *req; | ||
499 | |||
500 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
501 | |||
502 | LockDisplay(dpy); | ||
503 | GetReq(XDGASelectInput, req); | ||
504 | req->reqType = info->codes->major_opcode; | ||
505 | req->dgaReqType = X_XDGASelectInput; | ||
506 | req->screen = screen; | ||
507 | req->mask = mask; | ||
508 | UnlockDisplay(dpy); | ||
509 | SyncHandle(); | ||
510 | } | ||
511 | |||
512 | void SDL_NAME(XDGAFillRectangle)( | ||
513 | Display *dpy, | ||
514 | int screen, | ||
515 | int x, | ||
516 | int y, | ||
517 | unsigned int width, | ||
518 | unsigned int height, | ||
519 | unsigned long color | ||
520 | ){ | ||
521 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
522 | xXDGAFillRectangleReq *req; | ||
523 | |||
524 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
525 | |||
526 | LockDisplay(dpy); | ||
527 | GetReq(XDGAFillRectangle, req); | ||
528 | req->reqType = info->codes->major_opcode; | ||
529 | req->dgaReqType = X_XDGAFillRectangle; | ||
530 | req->screen = screen; | ||
531 | req->x = x; | ||
532 | req->y = y; | ||
533 | req->width = width; | ||
534 | req->height = height; | ||
535 | req->color = color; | ||
536 | UnlockDisplay(dpy); | ||
537 | SyncHandle(); | ||
538 | } | ||
539 | |||
540 | void SDL_NAME(XDGACopyArea)( | ||
541 | Display *dpy, | ||
542 | int screen, | ||
543 | int srcx, | ||
544 | int srcy, | ||
545 | unsigned int width, | ||
546 | unsigned int height, | ||
547 | int dstx, | ||
548 | int dsty | ||
549 | ){ | ||
550 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
551 | xXDGACopyAreaReq *req; | ||
552 | |||
553 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
554 | |||
555 | LockDisplay(dpy); | ||
556 | GetReq(XDGACopyArea, req); | ||
557 | req->reqType = info->codes->major_opcode; | ||
558 | req->dgaReqType = X_XDGACopyArea; | ||
559 | req->screen = screen; | ||
560 | req->srcx = srcx; | ||
561 | req->srcy = srcy; | ||
562 | req->width = width; | ||
563 | req->height = height; | ||
564 | req->dstx = dstx; | ||
565 | req->dsty = dsty; | ||
566 | UnlockDisplay(dpy); | ||
567 | SyncHandle(); | ||
568 | } | ||
569 | |||
570 | void SDL_NAME(XDGACopyTransparentArea)( | ||
571 | Display *dpy, | ||
572 | int screen, | ||
573 | int srcx, | ||
574 | int srcy, | ||
575 | unsigned int width, | ||
576 | unsigned int height, | ||
577 | int dstx, | ||
578 | int dsty, | ||
579 | unsigned long key | ||
580 | ){ | ||
581 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
582 | xXDGACopyTransparentAreaReq *req; | ||
583 | |||
584 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
585 | |||
586 | LockDisplay(dpy); | ||
587 | GetReq(XDGACopyTransparentArea, req); | ||
588 | req->reqType = info->codes->major_opcode; | ||
589 | req->dgaReqType = X_XDGACopyTransparentArea; | ||
590 | req->screen = screen; | ||
591 | req->srcx = srcx; | ||
592 | req->srcy = srcy; | ||
593 | req->width = width; | ||
594 | req->height = height; | ||
595 | req->dstx = dstx; | ||
596 | req->dsty = dsty; | ||
597 | req->key = key; | ||
598 | UnlockDisplay(dpy); | ||
599 | SyncHandle(); | ||
600 | } | ||
601 | |||
602 | |||
603 | int SDL_NAME(XDGAGetViewportStatus)( | ||
604 | Display *dpy, | ||
605 | int screen | ||
606 | ){ | ||
607 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
608 | xXDGAGetViewportStatusReply rep; | ||
609 | xXDGAGetViewportStatusReq *req; | ||
610 | int status = 0; | ||
611 | |||
612 | XDGACheckExtension (dpy, info, 0); | ||
613 | |||
614 | LockDisplay(dpy); | ||
615 | GetReq(XDGAGetViewportStatus, req); | ||
616 | req->reqType = info->codes->major_opcode; | ||
617 | req->dgaReqType = X_XDGAGetViewportStatus; | ||
618 | req->screen = screen; | ||
619 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) | ||
620 | status = rep.status; | ||
621 | UnlockDisplay(dpy); | ||
622 | SyncHandle(); | ||
623 | return status; | ||
624 | } | ||
625 | |||
626 | void SDL_NAME(XDGASync)( | ||
627 | Display *dpy, | ||
628 | int screen | ||
629 | ){ | ||
630 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
631 | xXDGASyncReply rep; | ||
632 | xXDGASyncReq *req; | ||
633 | |||
634 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
635 | |||
636 | LockDisplay(dpy); | ||
637 | GetReq(XDGASync, req); | ||
638 | req->reqType = info->codes->major_opcode; | ||
639 | req->dgaReqType = X_XDGASync; | ||
640 | req->screen = screen; | ||
641 | _XReply(dpy, (xReply *)&rep, 0, xFalse); | ||
642 | UnlockDisplay(dpy); | ||
643 | SyncHandle(); | ||
644 | } | ||
645 | |||
646 | |||
647 | void SDL_NAME(XDGAChangePixmapMode)( | ||
648 | Display *dpy, | ||
649 | int screen, | ||
650 | int *x, | ||
651 | int *y, | ||
652 | int mode | ||
653 | ){ | ||
654 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
655 | xXDGAChangePixmapModeReq *req; | ||
656 | xXDGAChangePixmapModeReply rep; | ||
657 | |||
658 | XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name)); | ||
659 | |||
660 | LockDisplay(dpy); | ||
661 | GetReq(XDGAChangePixmapMode, req); | ||
662 | req->reqType = info->codes->major_opcode; | ||
663 | req->dgaReqType = X_XDGAChangePixmapMode; | ||
664 | req->screen = screen; | ||
665 | req->x = *x; | ||
666 | req->y = *y; | ||
667 | req->flags = mode; | ||
668 | _XReply(dpy, (xReply *)&rep, 0, xFalse); | ||
669 | *x = rep.x; | ||
670 | *y = rep.y; | ||
671 | UnlockDisplay(dpy); | ||
672 | SyncHandle(); | ||
673 | } | ||
674 | |||
675 | Colormap SDL_NAME(XDGACreateColormap)( | ||
676 | Display *dpy, | ||
677 | int screen, | ||
678 | SDL_NAME(XDGADevice) *dev, | ||
679 | int alloc | ||
680 | ){ | ||
681 | XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy); | ||
682 | xXDGACreateColormapReq *req; | ||
683 | Colormap cid; | ||
684 | |||
685 | XDGACheckExtension (dpy, info, -1); | ||
686 | |||
687 | LockDisplay(dpy); | ||
688 | GetReq(XDGACreateColormap, req); | ||
689 | req->reqType = info->codes->major_opcode; | ||
690 | req->dgaReqType = X_XDGACreateColormap; | ||
691 | req->screen = screen; | ||
692 | req->mode = dev->mode.num; | ||
693 | req->alloc = alloc; | ||
694 | cid = req->id = XAllocID(dpy); | ||
695 | UnlockDisplay(dpy); | ||
696 | SyncHandle(); | ||
697 | |||
698 | return cid; | ||
699 | } | ||
700 | |||
701 | |||
702 | void SDL_NAME(XDGAKeyEventToXKeyEvent)( | ||
703 | SDL_NAME(XDGAKeyEvent)* dk, | ||
704 | XKeyEvent* xk | ||
705 | ){ | ||
706 | xk->type = dk->type; | ||
707 | xk->serial = dk->serial; | ||
708 | xk->send_event = False; | ||
709 | xk->display = dk->display; | ||
710 | xk->window = RootWindow(dk->display, dk->screen); | ||
711 | xk->root = xk->window; | ||
712 | xk->subwindow = None; | ||
713 | xk->time = dk->time; | ||
714 | xk->x = xk->y = xk->x_root = xk->y_root = 0; | ||
715 | xk->state = dk->state; | ||
716 | xk->keycode = dk->keycode; | ||
717 | xk->same_screen = True; | ||
718 | } | ||
719 | |||
720 | #include <X11/Xmd.h> | ||
721 | #include <stdlib.h> | ||
722 | #include <stdio.h> | ||
723 | #include <fcntl.h> | ||
724 | #if defined(ISC) | ||
725 | # define HAS_SVR3_MMAP | ||
726 | # include <sys/types.h> | ||
727 | # include <errno.h> | ||
728 | |||
729 | # include <sys/at_ansi.h> | ||
730 | # include <sys/kd.h> | ||
731 | |||
732 | # include <sys/sysmacros.h> | ||
733 | # include <sys/immu.h> | ||
734 | # include <sys/region.h> | ||
735 | |||
736 | # include <sys/mmap.h> | ||
737 | #else | ||
738 | # if !defined(Lynx) | ||
739 | # if !defined(__EMX__) | ||
740 | # include <sys/mman.h> | ||
741 | # endif | ||
742 | # else | ||
743 | # include <sys/types.h> | ||
744 | # include <errno.h> | ||
745 | # include <smem.h> | ||
746 | # endif | ||
747 | #endif | ||
748 | #include <sys/wait.h> | ||
749 | #include <signal.h> | ||
750 | #include <unistd.h> | ||
751 | |||
752 | #if defined(SVR4) && !defined(sun) && !defined(SCO325) | ||
753 | #define DEV_MEM "/dev/pmem" | ||
754 | #elif defined(SVR4) && defined(sun) | ||
755 | #define DEV_MEM "/dev/xsvc" | ||
756 | #else | ||
757 | #define DEV_MEM "/dev/mem" | ||
758 | #endif | ||
759 | |||
760 | |||
761 | |||
762 | typedef struct _DGAMapRec{ | ||
763 | unsigned char *physical; | ||
764 | unsigned char *virtual; | ||
765 | CARD32 size; | ||
766 | int fd; | ||
767 | int screen; | ||
768 | struct _DGAMapRec *next; | ||
769 | } DGAMapRec, *DGAMapPtr; | ||
770 | |||
771 | static Bool | ||
772 | DGAMapPhysical(int, char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr); | ||
773 | static void DGAUnmapPhysical(DGAMapPtr); | ||
774 | |||
775 | static DGAMapPtr _Maps = NULL; | ||
776 | |||
777 | |||
778 | unsigned char* | ||
779 | SDL_NAME(XDGAGetMappedMemory)(int screen) | ||
780 | { | ||
781 | DGAMapPtr pMap = _Maps; | ||
782 | unsigned char *pntr = NULL; | ||
783 | |||
784 | while(pMap != NULL) { | ||
785 | if(pMap->screen == screen) { | ||
786 | pntr = pMap->virtual; | ||
787 | break; | ||
788 | } | ||
789 | pMap = pMap->next; | ||
790 | } | ||
791 | |||
792 | return pntr; | ||
793 | } | ||
794 | |||
795 | Bool | ||
796 | SDL_NAME(XDGAMapFramebuffer)( | ||
797 | int screen, | ||
798 | char *name, /* optional device name */ | ||
799 | unsigned char* base, /* physical memory */ | ||
800 | CARD32 size, /* size */ | ||
801 | CARD32 offset, /* optional offset */ | ||
802 | CARD32 extra /* optional extra data */ | ||
803 | ){ | ||
804 | DGAMapPtr pMap = _Maps; | ||
805 | Bool result; | ||
806 | |||
807 | /* is it already mapped ? */ | ||
808 | while(pMap != NULL) { | ||
809 | if(pMap->screen == screen) | ||
810 | return True; | ||
811 | pMap = pMap->next; | ||
812 | } | ||
813 | |||
814 | if(extra & XDGANeedRoot) { | ||
815 | /* we should probably check if we have root permissions and | ||
816 | return False here */ | ||
817 | |||
818 | } | ||
819 | |||
820 | pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec)); | ||
821 | |||
822 | result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap); | ||
823 | |||
824 | if(result) { | ||
825 | pMap->next = _Maps; | ||
826 | _Maps = pMap; | ||
827 | } else | ||
828 | Xfree(pMap); | ||
829 | |||
830 | return result; | ||
831 | } | ||
832 | |||
833 | void | ||
834 | SDL_NAME(XDGAUnmapFramebuffer)(int screen) | ||
835 | { | ||
836 | DGAMapPtr pMap = _Maps; | ||
837 | DGAMapPtr pPrev = NULL; | ||
838 | |||
839 | /* is it already mapped */ | ||
840 | while(pMap != NULL) { | ||
841 | if(pMap->screen == screen) | ||
842 | break; | ||
843 | pPrev = pMap; | ||
844 | pMap = pMap->next; | ||
845 | } | ||
846 | |||
847 | if(!pMap) | ||
848 | return; | ||
849 | |||
850 | DGAUnmapPhysical(pMap); | ||
851 | |||
852 | if(!pPrev) | ||
853 | _Maps = pMap->next; | ||
854 | else | ||
855 | pPrev->next = pMap->next; | ||
856 | |||
857 | Xfree(pMap); | ||
858 | } | ||
859 | |||
860 | |||
861 | static Bool | ||
862 | DGAMapPhysical( | ||
863 | int screen, | ||
864 | char *name, /* optional device name */ | ||
865 | unsigned char* base, /* physical memory */ | ||
866 | CARD32 size, /* size */ | ||
867 | CARD32 offset, /* optional offset */ | ||
868 | CARD32 extra, /* optional extra data */ | ||
869 | DGAMapPtr pMap | ||
870 | ) { | ||
871 | #if defined(ISC) && defined(HAS_SVR3_MMAP) | ||
872 | struct kd_memloc mloc; | ||
873 | #elif defined(__EMX__) | ||
874 | APIRET rc; | ||
875 | ULONG action; | ||
876 | HFILE hfd; | ||
877 | #endif | ||
878 | |||
879 | base += offset; | ||
880 | |||
881 | pMap->screen = screen; | ||
882 | pMap->physical = base; | ||
883 | pMap->size = size; | ||
884 | |||
885 | #if defined(ISC) && defined(HAS_SVR3_MMAP) | ||
886 | if ((pMap->fd = open("/dev/mmap", O_RDWR)) < 0) | ||
887 | return False; | ||
888 | mloc.vaddr = (char *)0; | ||
889 | mloc.physaddr = (char *)base; | ||
890 | mloc.length = size; | ||
891 | mloc.ioflg=1; | ||
892 | |||
893 | if ((pMap->virtual = (void *)ioctl(pMap->fd, MAP, &mloc)) == (void *)-1) | ||
894 | return False; | ||
895 | #elif defined (__EMX__) | ||
896 | /* | ||
897 | * Dragon warning here! /dev/pmap$ is never closed, except on progam exit. | ||
898 | * Consecutive calling of this routine will make PMAP$ driver run out | ||
899 | * of memory handles. Some umap/close mechanism should be provided | ||
900 | */ | ||
901 | |||
902 | rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN, | ||
903 | OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL); | ||
904 | if (rc != 0) | ||
905 | return False; | ||
906 | { | ||
907 | struct map_ioctl { | ||
908 | union { | ||
909 | ULONG phys; | ||
910 | void* user; | ||
911 | } a; | ||
912 | ULONG size; | ||
913 | } pmap,dmap; | ||
914 | ULONG plen,dlen; | ||
915 | #define XFREE86_PMAP 0x76 | ||
916 | #define PMAP_MAP 0x44 | ||
917 | |||
918 | pmap.a.phys = base; | ||
919 | pmap.size = size; | ||
920 | rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP, | ||
921 | (PULONG)&pmap, sizeof(pmap), &plen, | ||
922 | (PULONG)&dmap, sizeof(dmap), &dlen); | ||
923 | if (rc == 0) { | ||
924 | pMap->virtual = dmap.a.user; | ||
925 | } | ||
926 | } | ||
927 | if (rc != 0) | ||
928 | return False; | ||
929 | #elif defined (Lynx) | ||
930 | pMap->virtual = smem_create("XF86DGA", (char*)base, size, SM_READ|SM_WRITE); | ||
931 | #else | ||
932 | #ifndef MAP_FILE | ||
933 | #define MAP_FILE 0 | ||
934 | #endif | ||
935 | if (!name) | ||
936 | name = DEV_MEM; | ||
937 | if ((pMap->fd = open(name, O_RDWR)) < 0) | ||
938 | #if defined(ENABLE_FBCON) | ||
939 | { /* /dev/fb0 fallback added by Sam Lantinga <hercules@lokigames.com> */ | ||
940 | /* Try to fall back to /dev/fb on Linux - FIXME: verify the device */ | ||
941 | struct fb_fix_screeninfo finfo; | ||
942 | |||
943 | if ((pMap->fd = open("/dev/fb0", O_RDWR)) < 0) { | ||
944 | return False; | ||
945 | } | ||
946 | /* The useable framebuffer console memory may not be the whole | ||
947 | framebuffer that X has access to. :-( | ||
948 | */ | ||
949 | if ( ioctl(pMap->fd, FBIOGET_FSCREENINFO, &finfo) < 0 ) { | ||
950 | close(pMap->fd); | ||
951 | return False; | ||
952 | } | ||
953 | /* Warning: On PPC, the size and virtual need to be offset by: | ||
954 | (((long)finfo.smem_start) - | ||
955 | (((long)finfo.smem_start)&~(PAGE_SIZE-1))) | ||
956 | */ | ||
957 | base = 0; | ||
958 | size = pMap->size = finfo.smem_len; | ||
959 | } | ||
960 | #else | ||
961 | return False; | ||
962 | #endif | ||
963 | pMap->virtual = mmap(NULL, size, PROT_READ | PROT_WRITE, | ||
964 | MAP_FILE | MAP_SHARED, pMap->fd, (off_t)((size_t)base)); | ||
965 | if (pMap->virtual == (void *)-1) | ||
966 | return False; | ||
967 | #endif | ||
968 | |||
969 | #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \ | ||
970 | && !defined(__EMX__) | ||
971 | mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE); | ||
972 | #endif | ||
973 | |||
974 | return True; | ||
975 | } | ||
976 | |||
977 | |||
978 | |||
979 | static void | ||
980 | DGAUnmapPhysical(DGAMapPtr pMap) | ||
981 | { | ||
982 | #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \ | ||
983 | && !defined(__EMX__) | ||
984 | mprotect(pMap->virtual,pMap->size, PROT_READ); | ||
985 | #elif defined(Lynx) | ||
986 | /* XXX this doesn't allow enable after disable */ | ||
987 | smem_create(NULL, pMap->virtual, pMap->size, SM_DETACH); | ||
988 | smem_remove("XF86DGA"); | ||
989 | #endif | ||
990 | |||
991 | |||
992 | /* We need to unmap and close too !!!!!!!!!!*/ | ||
993 | } | ||
diff --git a/apps/plugins/sdl/src/video/Xext/Xxf86vm/XF86VMode.c b/apps/plugins/sdl/src/video/Xext/Xxf86vm/XF86VMode.c new file mode 100644 index 0000000000..5cb21905af --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/Xxf86vm/XF86VMode.c | |||
@@ -0,0 +1,1226 @@ | |||
1 | /* $XConsortium: XF86VMode.c /main/2 1995/11/14 18:17:58 kaleb $ */ | ||
2 | /* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.32 2001/07/25 15:04:54 dawes Exp $ */ | ||
3 | /* | ||
4 | |||
5 | Copyright (c) 1995 Kaleb S. KEITHLEY | ||
6 | |||
7 | Permission is hereby granted, free of charge, to any person obtaining | ||
8 | a copy of this software and associated documentation files (the | ||
9 | "Software"), to deal in the Software without restriction, including | ||
10 | without limitation the rights to use, copy, modify, merge, publish, | ||
11 | distribute, sublicense, and/or sell copies of the Software, and to | ||
12 | permit persons to whom the Software is furnished to do so, subject to | ||
13 | the following conditions: | ||
14 | |||
15 | The above copyright notice and this permission notice shall be | ||
16 | included in all copies or substantial portions of the Software. | ||
17 | |||
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
21 | IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES | ||
22 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
24 | OTHER DEALINGS IN THE SOFTWARE. | ||
25 | |||
26 | Except as contained in this notice, the name of Kaleb S. KEITHLEY | ||
27 | shall not be used in advertising or otherwise to promote the sale, use | ||
28 | or other dealings in this Software without prior written authorization | ||
29 | from Kaleb S. KEITHLEY. | ||
30 | |||
31 | */ | ||
32 | /* $XConsortium: XF86VMode.c /main/4 1996/01/16 07:52:25 kaleb CHECKEDOUT $ */ | ||
33 | |||
34 | /* THIS IS NOT AN X CONSORTIUM STANDARD */ | ||
35 | |||
36 | #define NEED_EVENTS | ||
37 | #define NEED_REPLIES | ||
38 | |||
39 | #ifndef XBUILD_IN_CLIENT | ||
40 | /* Apparently some X11 systems can't include this multiple times... */ | ||
41 | #ifndef SDL_INCLUDED_XLIBINT_H | ||
42 | #define SDL_INCLUDED_XLIBINT_H 1 | ||
43 | #include <X11/Xlibint.h> | ||
44 | #endif | ||
45 | #include "../extensions/xf86vmstr.h" | ||
46 | #include "../extensions/Xext.h" | ||
47 | #include "../extensions/extutil.h" | ||
48 | #else | ||
49 | #include "include/extensions/xf86vmstr.h" | ||
50 | #include "include/extensions/Xext.h" | ||
51 | #include "include/extensions/extutil.h" | ||
52 | #endif | ||
53 | |||
54 | #ifdef DEBUG | ||
55 | #include <stdio.h> | ||
56 | #endif | ||
57 | |||
58 | #ifndef MODE_BAD | ||
59 | #define MODE_BAD 255 | ||
60 | #endif | ||
61 | |||
62 | static XExtensionInfo _xf86vidmode_info_data; | ||
63 | static XExtensionInfo *xf86vidmode_info = &_xf86vidmode_info_data; | ||
64 | static char *xf86vidmode_extension_name = XF86VIDMODENAME; | ||
65 | |||
66 | #define XF86VidModeCheckExtension(dpy,i,val) \ | ||
67 | XextCheckExtension (dpy, i, xf86vidmode_extension_name, val) | ||
68 | |||
69 | /***************************************************************************** | ||
70 | * * | ||
71 | * private utility routines * | ||
72 | * * | ||
73 | *****************************************************************************/ | ||
74 | |||
75 | static XEXT_CLOSE_DISPLAY_PROTO(close_display); | ||
76 | static /* const */ XExtensionHooks xf86vidmode_extension_hooks = { | ||
77 | NULL, /* create_gc */ | ||
78 | NULL, /* copy_gc */ | ||
79 | NULL, /* flush_gc */ | ||
80 | NULL, /* free_gc */ | ||
81 | NULL, /* create_font */ | ||
82 | NULL, /* free_font */ | ||
83 | close_display, /* close_display */ | ||
84 | NULL, /* wire_to_event */ | ||
85 | NULL, /* event_to_wire */ | ||
86 | NULL, /* error */ | ||
87 | NULL, /* error_string */ | ||
88 | }; | ||
89 | |||
90 | static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86vidmode_info, | ||
91 | xf86vidmode_extension_name, | ||
92 | &xf86vidmode_extension_hooks, | ||
93 | 0, NULL) | ||
94 | |||
95 | static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86vidmode_info) | ||
96 | |||
97 | |||
98 | /***************************************************************************** | ||
99 | * * | ||
100 | * public XFree86-VidMode Extension routines * | ||
101 | * * | ||
102 | *****************************************************************************/ | ||
103 | |||
104 | Bool | ||
105 | SDL_NAME(XF86VidModeQueryExtension) (dpy, event_basep, error_basep) | ||
106 | Display *dpy; | ||
107 | int *event_basep, *error_basep; | ||
108 | { | ||
109 | XExtDisplayInfo *info = find_display (dpy); | ||
110 | |||
111 | if (XextHasExtension(info)) { | ||
112 | *event_basep = info->codes->first_event; | ||
113 | *error_basep = info->codes->first_error; | ||
114 | return True; | ||
115 | } else { | ||
116 | return False; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | Bool | ||
121 | SDL_NAME(XF86VidModeQueryVersion)(dpy, majorVersion, minorVersion) | ||
122 | Display* dpy; | ||
123 | int* majorVersion; | ||
124 | int* minorVersion; | ||
125 | { | ||
126 | XExtDisplayInfo *info = find_display (dpy); | ||
127 | xXF86VidModeQueryVersionReply rep; | ||
128 | xXF86VidModeQueryVersionReq *req; | ||
129 | |||
130 | XF86VidModeCheckExtension (dpy, info, False); | ||
131 | |||
132 | LockDisplay(dpy); | ||
133 | GetReq(XF86VidModeQueryVersion, req); | ||
134 | req->reqType = info->codes->major_opcode; | ||
135 | req->xf86vidmodeReqType = X_XF86VidModeQueryVersion; | ||
136 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
137 | UnlockDisplay(dpy); | ||
138 | SyncHandle(); | ||
139 | return False; | ||
140 | } | ||
141 | *majorVersion = rep.majorVersion; | ||
142 | *minorVersion = rep.minorVersion; | ||
143 | UnlockDisplay(dpy); | ||
144 | SyncHandle(); | ||
145 | if (*majorVersion >= 2) | ||
146 | SDL_NAME(XF86VidModeSetClientVersion)(dpy); | ||
147 | return True; | ||
148 | } | ||
149 | |||
150 | Bool | ||
151 | SDL_NAME(XF86VidModeSetClientVersion)(Display *dpy) | ||
152 | { | ||
153 | XExtDisplayInfo *info = find_display(dpy); | ||
154 | xXF86VidModeSetClientVersionReq *req; | ||
155 | |||
156 | XF86VidModeCheckExtension(dpy, info, False); | ||
157 | |||
158 | LockDisplay(dpy); | ||
159 | GetReq(XF86VidModeSetClientVersion, req); | ||
160 | req->reqType = info->codes->major_opcode; | ||
161 | req->xf86vidmodeReqType = X_XF86VidModeSetClientVersion; | ||
162 | req->major = XF86VIDMODE_MAJOR_VERSION; | ||
163 | req->minor = XF86VIDMODE_MINOR_VERSION; | ||
164 | UnlockDisplay(dpy); | ||
165 | SyncHandle(); | ||
166 | return True; | ||
167 | } | ||
168 | |||
169 | Bool | ||
170 | SDL_NAME(XF86VidModeSetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamma) *Gamma) | ||
171 | { | ||
172 | XExtDisplayInfo *info = find_display(dpy); | ||
173 | xXF86VidModeSetGammaReq *req; | ||
174 | |||
175 | XF86VidModeCheckExtension(dpy, info, False); | ||
176 | |||
177 | LockDisplay(dpy); | ||
178 | GetReq(XF86VidModeSetGamma, req); | ||
179 | req->reqType = info->codes->major_opcode; | ||
180 | req->xf86vidmodeReqType = X_XF86VidModeSetGamma; | ||
181 | req->screen = screen; | ||
182 | req->red = (CARD32)(Gamma->red * 10000.); | ||
183 | req->green = (CARD32)(Gamma->green * 10000.); | ||
184 | req->blue = (CARD32)(Gamma->blue * 10000.); | ||
185 | UnlockDisplay(dpy); | ||
186 | SyncHandle(); | ||
187 | return True; | ||
188 | } | ||
189 | |||
190 | Bool | ||
191 | SDL_NAME(XF86VidModeGetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamma) *Gamma) | ||
192 | { | ||
193 | XExtDisplayInfo *info = find_display (dpy); | ||
194 | xXF86VidModeGetGammaReply rep; | ||
195 | xXF86VidModeGetGammaReq *req; | ||
196 | |||
197 | XF86VidModeCheckExtension (dpy, info, False); | ||
198 | |||
199 | LockDisplay(dpy); | ||
200 | GetReq(XF86VidModeGetGamma, req); | ||
201 | req->reqType = info->codes->major_opcode; | ||
202 | req->xf86vidmodeReqType = X_XF86VidModeGetGamma; | ||
203 | req->screen = screen; | ||
204 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
205 | UnlockDisplay(dpy); | ||
206 | SyncHandle(); | ||
207 | return False; | ||
208 | } | ||
209 | Gamma->red = ((float)rep.red) / 10000.; | ||
210 | Gamma->green = ((float)rep.green) / 10000.; | ||
211 | Gamma->blue = ((float)rep.blue) / 10000.; | ||
212 | UnlockDisplay(dpy); | ||
213 | SyncHandle(); | ||
214 | return True; | ||
215 | } | ||
216 | |||
217 | Bool | ||
218 | SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline) | ||
219 | Display* dpy; | ||
220 | int screen; | ||
221 | int* dotclock; | ||
222 | SDL_NAME(XF86VidModeModeLine)* modeline; | ||
223 | { | ||
224 | XExtDisplayInfo *info = find_display (dpy); | ||
225 | xXF86VidModeGetModeLineReply rep; | ||
226 | xXF86OldVidModeGetModeLineReply oldrep; | ||
227 | xXF86VidModeGetModeLineReq *req; | ||
228 | int majorVersion, minorVersion; | ||
229 | |||
230 | XF86VidModeCheckExtension (dpy, info, False); | ||
231 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
232 | |||
233 | LockDisplay(dpy); | ||
234 | GetReq(XF86VidModeGetModeLine, req); | ||
235 | req->reqType = info->codes->major_opcode; | ||
236 | req->xf86vidmodeReqType = X_XF86VidModeGetModeLine; | ||
237 | req->screen = screen; | ||
238 | |||
239 | if (majorVersion < 2) { | ||
240 | if (!_XReply(dpy, (xReply *)&oldrep, | ||
241 | (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) { | ||
242 | UnlockDisplay(dpy); | ||
243 | SyncHandle(); | ||
244 | return False; | ||
245 | } | ||
246 | *dotclock = oldrep.dotclock; | ||
247 | modeline->hdisplay = oldrep.hdisplay; | ||
248 | modeline->hsyncstart = oldrep.hsyncstart; | ||
249 | modeline->hsyncend = oldrep.hsyncend; | ||
250 | modeline->htotal = oldrep.htotal; | ||
251 | modeline->hskew = 0; | ||
252 | modeline->vdisplay = oldrep.vdisplay; | ||
253 | modeline->vsyncstart = oldrep.vsyncstart; | ||
254 | modeline->vsyncend = oldrep.vsyncend; | ||
255 | modeline->vtotal = oldrep.vtotal; | ||
256 | modeline->flags = oldrep.flags; | ||
257 | modeline->privsize = oldrep.privsize; | ||
258 | } else { | ||
259 | if (!_XReply(dpy, (xReply *)&rep, | ||
260 | (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) { | ||
261 | UnlockDisplay(dpy); | ||
262 | SyncHandle(); | ||
263 | return False; | ||
264 | } | ||
265 | *dotclock = rep.dotclock; | ||
266 | modeline->hdisplay = rep.hdisplay; | ||
267 | modeline->hsyncstart = rep.hsyncstart; | ||
268 | modeline->hsyncend = rep.hsyncend; | ||
269 | modeline->htotal = rep.htotal; | ||
270 | modeline->hskew = rep.hskew; | ||
271 | modeline->vdisplay = rep.vdisplay; | ||
272 | modeline->vsyncstart = rep.vsyncstart; | ||
273 | modeline->vsyncend = rep.vsyncend; | ||
274 | modeline->vtotal = rep.vtotal; | ||
275 | modeline->flags = rep.flags; | ||
276 | modeline->privsize = rep.privsize; | ||
277 | } | ||
278 | |||
279 | if (modeline->privsize > 0) { | ||
280 | if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) { | ||
281 | _XEatData(dpy, (modeline->privsize) * sizeof(INT32)); | ||
282 | Xfree(modeline->private); | ||
283 | return False; | ||
284 | } | ||
285 | _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32)); | ||
286 | } else { | ||
287 | modeline->private = NULL; | ||
288 | } | ||
289 | UnlockDisplay(dpy); | ||
290 | SyncHandle(); | ||
291 | return True; | ||
292 | } | ||
293 | |||
294 | Bool | ||
295 | SDL_NAME(XF86VidModeGetAllModeLines)(dpy, screen, modecount, modelinesPtr) | ||
296 | Display* dpy; | ||
297 | int screen; | ||
298 | int* modecount; | ||
299 | SDL_NAME(XF86VidModeModeInfo) ***modelinesPtr; | ||
300 | { | ||
301 | XExtDisplayInfo *info = find_display (dpy); | ||
302 | xXF86VidModeGetAllModeLinesReply rep; | ||
303 | xXF86VidModeGetAllModeLinesReq *req; | ||
304 | SDL_NAME(XF86VidModeModeInfo) *mdinfptr, **modelines; | ||
305 | xXF86VidModeModeInfo xmdline; | ||
306 | xXF86OldVidModeModeInfo oldxmdline; | ||
307 | int i; | ||
308 | int majorVersion, minorVersion; | ||
309 | Bool protocolBug = False; | ||
310 | |||
311 | XF86VidModeCheckExtension (dpy, info, False); | ||
312 | |||
313 | /* | ||
314 | * Note: There was a bug in the protocol implementation in versions | ||
315 | * 0.x with x < 8 (the .private field wasn't being passed over the wire). | ||
316 | * Check the server's version, and accept the old format if appropriate. | ||
317 | */ | ||
318 | |||
319 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
320 | if (majorVersion == 0 && minorVersion < 8) { | ||
321 | protocolBug = True; | ||
322 | #ifdef DEBUG | ||
323 | fprintf(stderr, "XF86VidModeGetAllModeLines: Warning: Xserver is" | ||
324 | "running an old version (%d.%d)\n", majorVersion, | ||
325 | minorVersion); | ||
326 | #endif | ||
327 | } | ||
328 | |||
329 | LockDisplay(dpy); | ||
330 | GetReq(XF86VidModeGetAllModeLines, req); | ||
331 | req->reqType = info->codes->major_opcode; | ||
332 | req->xf86vidmodeReqType = X_XF86VidModeGetAllModeLines; | ||
333 | req->screen = screen; | ||
334 | if (!_XReply(dpy, (xReply *)&rep, | ||
335 | (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xReply)) >> 2, xFalse)) { | ||
336 | UnlockDisplay(dpy); | ||
337 | SyncHandle(); | ||
338 | return False; | ||
339 | } | ||
340 | |||
341 | *modecount = rep.modecount; | ||
342 | |||
343 | if (!(modelines = (SDL_NAME(XF86VidModeModeInfo) **) Xcalloc(rep.modecount, | ||
344 | sizeof(SDL_NAME(XF86VidModeModeInfo) *) | ||
345 | +sizeof(SDL_NAME(XF86VidModeModeInfo))))) { | ||
346 | if (majorVersion < 2) | ||
347 | _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo)); | ||
348 | else | ||
349 | _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo)); | ||
350 | Xfree(modelines); | ||
351 | UnlockDisplay(dpy); | ||
352 | SyncHandle(); | ||
353 | return False; | ||
354 | } | ||
355 | mdinfptr = (SDL_NAME(XF86VidModeModeInfo) *) ( | ||
356 | (char *) modelines | ||
357 | + rep.modecount*sizeof(SDL_NAME(XF86VidModeModeInfo) *) | ||
358 | ); | ||
359 | |||
360 | for (i = 0; i < rep.modecount; i++) { | ||
361 | modelines[i] = mdinfptr++; | ||
362 | if (majorVersion < 2) { | ||
363 | _XRead(dpy, (char*)&oldxmdline, sizeof(xXF86OldVidModeModeInfo)); | ||
364 | modelines[i]->dotclock = oldxmdline.dotclock; | ||
365 | modelines[i]->hdisplay = oldxmdline.hdisplay; | ||
366 | modelines[i]->hsyncstart = oldxmdline.hsyncstart; | ||
367 | modelines[i]->hsyncend = oldxmdline.hsyncend; | ||
368 | modelines[i]->htotal = oldxmdline.htotal; | ||
369 | modelines[i]->hskew = 0; | ||
370 | modelines[i]->vdisplay = oldxmdline.vdisplay; | ||
371 | modelines[i]->vsyncstart = oldxmdline.vsyncstart; | ||
372 | modelines[i]->vsyncend = oldxmdline.vsyncend; | ||
373 | modelines[i]->vtotal = oldxmdline.vtotal; | ||
374 | modelines[i]->flags = oldxmdline.flags; | ||
375 | if (protocolBug) { | ||
376 | modelines[i]->privsize = 0; | ||
377 | modelines[i]->private = NULL; | ||
378 | } else { | ||
379 | modelines[i]->privsize = oldxmdline.privsize; | ||
380 | if (oldxmdline.privsize > 0) { | ||
381 | if (!(modelines[i]->private = | ||
382 | Xcalloc(oldxmdline.privsize, sizeof(INT32)))) { | ||
383 | _XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32)); | ||
384 | Xfree(modelines[i]->private); | ||
385 | } else { | ||
386 | _XRead(dpy, (char*)modelines[i]->private, | ||
387 | oldxmdline.privsize * sizeof(INT32)); | ||
388 | } | ||
389 | } else { | ||
390 | modelines[i]->private = NULL; | ||
391 | } | ||
392 | } | ||
393 | } else { | ||
394 | _XRead(dpy, (char*)&xmdline, sizeof(xXF86VidModeModeInfo)); | ||
395 | modelines[i]->dotclock = xmdline.dotclock; | ||
396 | modelines[i]->hdisplay = xmdline.hdisplay; | ||
397 | modelines[i]->hsyncstart = xmdline.hsyncstart; | ||
398 | modelines[i]->hsyncend = xmdline.hsyncend; | ||
399 | modelines[i]->htotal = xmdline.htotal; | ||
400 | modelines[i]->hskew = xmdline.hskew; | ||
401 | modelines[i]->vdisplay = xmdline.vdisplay; | ||
402 | modelines[i]->vsyncstart = xmdline.vsyncstart; | ||
403 | modelines[i]->vsyncend = xmdline.vsyncend; | ||
404 | modelines[i]->vtotal = xmdline.vtotal; | ||
405 | modelines[i]->flags = xmdline.flags; | ||
406 | if (protocolBug) { | ||
407 | modelines[i]->privsize = 0; | ||
408 | modelines[i]->private = NULL; | ||
409 | } else { | ||
410 | modelines[i]->privsize = xmdline.privsize; | ||
411 | if (xmdline.privsize > 0) { | ||
412 | if (!(modelines[i]->private = | ||
413 | Xcalloc(xmdline.privsize, sizeof(INT32)))) { | ||
414 | _XEatData(dpy, (xmdline.privsize) * sizeof(INT32)); | ||
415 | Xfree(modelines[i]->private); | ||
416 | } else { | ||
417 | _XRead(dpy, (char*)modelines[i]->private, | ||
418 | xmdline.privsize * sizeof(INT32)); | ||
419 | } | ||
420 | } else { | ||
421 | modelines[i]->private = NULL; | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | } | ||
426 | *modelinesPtr = modelines; | ||
427 | UnlockDisplay(dpy); | ||
428 | SyncHandle(); | ||
429 | return True; | ||
430 | } | ||
431 | |||
432 | /* | ||
433 | * GetReq replacement for use with VidMode protocols earlier than 2.0 | ||
434 | */ | ||
435 | #if !defined(UNIXCPP) || defined(ANSICPP) | ||
436 | #define GetOldReq(name, oldname, req) \ | ||
437 | WORD64ALIGN\ | ||
438 | if ((dpy->bufptr + SIZEOF(x##oldname##Req)) > dpy->bufmax)\ | ||
439 | _XFlush(dpy);\ | ||
440 | req = (x##oldname##Req *)(dpy->last_req = dpy->bufptr);\ | ||
441 | req->reqType = X_##name;\ | ||
442 | req->length = (SIZEOF(x##oldname##Req))>>2;\ | ||
443 | dpy->bufptr += SIZEOF(x##oldname##Req);\ | ||
444 | dpy->request++ | ||
445 | |||
446 | #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ | ||
447 | #define GetOldReq(name, oldname, req) \ | ||
448 | WORD64ALIGN\ | ||
449 | if ((dpy->bufptr + SIZEOF(x/**/oldname/**/Req)) > dpy->bufmax)\ | ||
450 | _XFlush(dpy);\ | ||
451 | req = (x/**/oldname/**/Req *)(dpy->last_req = dpy->bufptr);\ | ||
452 | req->reqType = X_/**/name;\ | ||
453 | req->length = (SIZEOF(x/**/oldname/**/Req))>>2;\ | ||
454 | dpy->bufptr += SIZEOF(x/**/oldname/**/Req);\ | ||
455 | dpy->request++ | ||
456 | #endif | ||
457 | |||
458 | Bool | ||
459 | SDL_NAME(XF86VidModeAddModeLine) (dpy, screen, newmodeline, aftermodeline) | ||
460 | Display *dpy; | ||
461 | int screen; | ||
462 | SDL_NAME(XF86VidModeModeInfo)* newmodeline; | ||
463 | SDL_NAME(XF86VidModeModeInfo)* aftermodeline; | ||
464 | { | ||
465 | XExtDisplayInfo *info = find_display (dpy); | ||
466 | xXF86VidModeAddModeLineReq *req; | ||
467 | xXF86OldVidModeAddModeLineReq *oldreq; | ||
468 | int majorVersion, minorVersion; | ||
469 | |||
470 | XF86VidModeCheckExtension (dpy, info, False); | ||
471 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
472 | |||
473 | LockDisplay(dpy); | ||
474 | if (majorVersion < 2) { | ||
475 | GetOldReq(XF86VidModeAddModeLine, XF86OldVidModeAddModeLine, oldreq); | ||
476 | oldreq->reqType = info->codes->major_opcode; | ||
477 | oldreq->xf86vidmodeReqType = X_XF86VidModeAddModeLine; | ||
478 | oldreq->screen = screen; | ||
479 | oldreq->dotclock = newmodeline->dotclock; | ||
480 | oldreq->hdisplay = newmodeline->hdisplay; | ||
481 | oldreq->hsyncstart = newmodeline->hsyncstart; | ||
482 | oldreq->hsyncend = newmodeline->hsyncend; | ||
483 | oldreq->htotal = newmodeline->htotal; | ||
484 | oldreq->vdisplay = newmodeline->vdisplay; | ||
485 | oldreq->vsyncstart = newmodeline->vsyncstart; | ||
486 | oldreq->vsyncend = newmodeline->vsyncend; | ||
487 | oldreq->vtotal = newmodeline->vtotal; | ||
488 | oldreq->flags = newmodeline->flags; | ||
489 | oldreq->privsize = newmodeline->privsize; | ||
490 | if (aftermodeline != NULL) { | ||
491 | oldreq->after_dotclock = aftermodeline->dotclock; | ||
492 | oldreq->after_hdisplay = aftermodeline->hdisplay; | ||
493 | oldreq->after_hsyncstart = aftermodeline->hsyncstart; | ||
494 | oldreq->after_hsyncend = aftermodeline->hsyncend; | ||
495 | oldreq->after_htotal = aftermodeline->htotal; | ||
496 | oldreq->after_vdisplay = aftermodeline->vdisplay; | ||
497 | oldreq->after_vsyncstart = aftermodeline->vsyncstart; | ||
498 | oldreq->after_vsyncend = aftermodeline->vsyncend; | ||
499 | oldreq->after_vtotal = aftermodeline->vtotal; | ||
500 | oldreq->after_flags = aftermodeline->flags; | ||
501 | } else { | ||
502 | oldreq->after_dotclock = 0; | ||
503 | oldreq->after_hdisplay = 0; | ||
504 | oldreq->after_hsyncstart = 0; | ||
505 | oldreq->after_hsyncend = 0; | ||
506 | oldreq->after_htotal = 0; | ||
507 | oldreq->after_vdisplay = 0; | ||
508 | oldreq->after_vsyncstart = 0; | ||
509 | oldreq->after_vsyncend = 0; | ||
510 | oldreq->after_vtotal = 0; | ||
511 | oldreq->after_flags = 0; | ||
512 | } | ||
513 | if (newmodeline->privsize) { | ||
514 | oldreq->length += newmodeline->privsize; | ||
515 | Data32(dpy, (long *) newmodeline->private, | ||
516 | newmodeline->privsize * sizeof(INT32)); | ||
517 | } | ||
518 | } else { | ||
519 | GetReq(XF86VidModeAddModeLine, req); | ||
520 | req->reqType = info->codes->major_opcode; | ||
521 | req->xf86vidmodeReqType = X_XF86VidModeAddModeLine; | ||
522 | req->screen = screen; | ||
523 | req->dotclock = newmodeline->dotclock; | ||
524 | req->hdisplay = newmodeline->hdisplay; | ||
525 | req->hsyncstart = newmodeline->hsyncstart; | ||
526 | req->hsyncend = newmodeline->hsyncend; | ||
527 | req->htotal = newmodeline->htotal; | ||
528 | req->hskew = newmodeline->hskew; | ||
529 | req->vdisplay = newmodeline->vdisplay; | ||
530 | req->vsyncstart = newmodeline->vsyncstart; | ||
531 | req->vsyncend = newmodeline->vsyncend; | ||
532 | req->vtotal = newmodeline->vtotal; | ||
533 | req->flags = newmodeline->flags; | ||
534 | req->privsize = newmodeline->privsize; | ||
535 | if (aftermodeline != NULL) { | ||
536 | req->after_dotclock = aftermodeline->dotclock; | ||
537 | req->after_hdisplay = aftermodeline->hdisplay; | ||
538 | req->after_hsyncstart = aftermodeline->hsyncstart; | ||
539 | req->after_hsyncend = aftermodeline->hsyncend; | ||
540 | req->after_htotal = aftermodeline->htotal; | ||
541 | req->after_hskew = aftermodeline->hskew; | ||
542 | req->after_vdisplay = aftermodeline->vdisplay; | ||
543 | req->after_vsyncstart = aftermodeline->vsyncstart; | ||
544 | req->after_vsyncend = aftermodeline->vsyncend; | ||
545 | req->after_vtotal = aftermodeline->vtotal; | ||
546 | req->after_flags = aftermodeline->flags; | ||
547 | } else { | ||
548 | req->after_dotclock = 0; | ||
549 | req->after_hdisplay = 0; | ||
550 | req->after_hsyncstart = 0; | ||
551 | req->after_hsyncend = 0; | ||
552 | req->after_htotal = 0; | ||
553 | req->after_hskew = 0; | ||
554 | req->after_vdisplay = 0; | ||
555 | req->after_vsyncstart = 0; | ||
556 | req->after_vsyncend = 0; | ||
557 | req->after_vtotal = 0; | ||
558 | req->after_flags = 0; | ||
559 | } | ||
560 | if (newmodeline->privsize) { | ||
561 | req->length += newmodeline->privsize; | ||
562 | Data32(dpy, (long *) newmodeline->private, | ||
563 | newmodeline->privsize * sizeof(INT32)); | ||
564 | } | ||
565 | } | ||
566 | UnlockDisplay(dpy); | ||
567 | SyncHandle(); | ||
568 | return True; | ||
569 | } | ||
570 | |||
571 | Bool | ||
572 | SDL_NAME(XF86VidModeDeleteModeLine) (dpy, screen, modeline) | ||
573 | Display *dpy; | ||
574 | int screen; | ||
575 | SDL_NAME(XF86VidModeModeInfo)* modeline; | ||
576 | { | ||
577 | XExtDisplayInfo *info = find_display (dpy); | ||
578 | xXF86VidModeDeleteModeLineReq *req; | ||
579 | xXF86OldVidModeDeleteModeLineReq *oldreq; | ||
580 | int majorVersion, minorVersion; | ||
581 | |||
582 | XF86VidModeCheckExtension (dpy, info, 0); | ||
583 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
584 | |||
585 | LockDisplay(dpy); | ||
586 | if (majorVersion < 2) { | ||
587 | GetOldReq(XF86VidModeDeleteModeLine, XF86OldVidModeDeleteModeLine, oldreq); | ||
588 | oldreq->reqType = info->codes->major_opcode; | ||
589 | oldreq->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine; | ||
590 | oldreq->screen = screen; | ||
591 | oldreq->dotclock = modeline->dotclock; | ||
592 | oldreq->hdisplay = modeline->hdisplay; | ||
593 | oldreq->hsyncstart = modeline->hsyncstart; | ||
594 | oldreq->hsyncend = modeline->hsyncend; | ||
595 | oldreq->htotal = modeline->htotal; | ||
596 | oldreq->vdisplay = modeline->vdisplay; | ||
597 | oldreq->vsyncstart = modeline->vsyncstart; | ||
598 | oldreq->vsyncend = modeline->vsyncend; | ||
599 | oldreq->vtotal = modeline->vtotal; | ||
600 | oldreq->flags = modeline->flags; | ||
601 | oldreq->privsize = modeline->privsize; | ||
602 | if (modeline->privsize) { | ||
603 | oldreq->length += modeline->privsize; | ||
604 | Data32(dpy, (long *) modeline->private, | ||
605 | modeline->privsize * sizeof(INT32)); | ||
606 | } | ||
607 | } else { | ||
608 | GetReq(XF86VidModeDeleteModeLine, req); | ||
609 | req->reqType = info->codes->major_opcode; | ||
610 | req->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine; | ||
611 | req->screen = screen; | ||
612 | req->dotclock = modeline->dotclock; | ||
613 | req->hdisplay = modeline->hdisplay; | ||
614 | req->hsyncstart = modeline->hsyncstart; | ||
615 | req->hsyncend = modeline->hsyncend; | ||
616 | req->htotal = modeline->htotal; | ||
617 | req->hskew = modeline->hskew; | ||
618 | req->vdisplay = modeline->vdisplay; | ||
619 | req->vsyncstart = modeline->vsyncstart; | ||
620 | req->vsyncend = modeline->vsyncend; | ||
621 | req->vtotal = modeline->vtotal; | ||
622 | req->flags = modeline->flags; | ||
623 | req->privsize = modeline->privsize; | ||
624 | if (modeline->privsize) { | ||
625 | req->length += modeline->privsize; | ||
626 | Data32(dpy, (long *) modeline->private, | ||
627 | modeline->privsize * sizeof(INT32)); | ||
628 | } | ||
629 | } | ||
630 | UnlockDisplay(dpy); | ||
631 | SyncHandle(); | ||
632 | return True; | ||
633 | } | ||
634 | |||
635 | Bool | ||
636 | SDL_NAME(XF86VidModeModModeLine) (dpy, screen, modeline) | ||
637 | Display *dpy; | ||
638 | int screen; | ||
639 | SDL_NAME(XF86VidModeModeLine)* modeline; | ||
640 | { | ||
641 | XExtDisplayInfo *info = find_display (dpy); | ||
642 | xXF86VidModeModModeLineReq *req; | ||
643 | xXF86OldVidModeModModeLineReq *oldreq; | ||
644 | int majorVersion, minorVersion; | ||
645 | |||
646 | XF86VidModeCheckExtension (dpy, info, 0); | ||
647 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
648 | |||
649 | LockDisplay(dpy); | ||
650 | if (majorVersion < 2) { | ||
651 | GetOldReq(XF86VidModeModModeLine, XF86OldVidModeModModeLine, oldreq); | ||
652 | oldreq->reqType = info->codes->major_opcode; | ||
653 | oldreq->xf86vidmodeReqType = X_XF86VidModeModModeLine; | ||
654 | oldreq->screen = screen; | ||
655 | oldreq->hdisplay = modeline->hdisplay; | ||
656 | oldreq->hsyncstart = modeline->hsyncstart; | ||
657 | oldreq->hsyncend = modeline->hsyncend; | ||
658 | oldreq->htotal = modeline->htotal; | ||
659 | oldreq->vdisplay = modeline->vdisplay; | ||
660 | oldreq->vsyncstart = modeline->vsyncstart; | ||
661 | oldreq->vsyncend = modeline->vsyncend; | ||
662 | oldreq->vtotal = modeline->vtotal; | ||
663 | oldreq->flags = modeline->flags; | ||
664 | oldreq->privsize = modeline->privsize; | ||
665 | if (modeline->privsize) { | ||
666 | oldreq->length += modeline->privsize; | ||
667 | Data32(dpy, (long *) modeline->private, | ||
668 | modeline->privsize * sizeof(INT32)); | ||
669 | } | ||
670 | } else { | ||
671 | GetReq(XF86VidModeModModeLine, req); | ||
672 | req->reqType = info->codes->major_opcode; | ||
673 | req->xf86vidmodeReqType = X_XF86VidModeModModeLine; | ||
674 | req->screen = screen; | ||
675 | req->hdisplay = modeline->hdisplay; | ||
676 | req->hsyncstart = modeline->hsyncstart; | ||
677 | req->hsyncend = modeline->hsyncend; | ||
678 | req->htotal = modeline->htotal; | ||
679 | req->hskew = modeline->hskew; | ||
680 | req->vdisplay = modeline->vdisplay; | ||
681 | req->vsyncstart = modeline->vsyncstart; | ||
682 | req->vsyncend = modeline->vsyncend; | ||
683 | req->vtotal = modeline->vtotal; | ||
684 | req->flags = modeline->flags; | ||
685 | req->privsize = modeline->privsize; | ||
686 | if (modeline->privsize) { | ||
687 | req->length += modeline->privsize; | ||
688 | Data32(dpy, (long *) modeline->private, | ||
689 | modeline->privsize * sizeof(INT32)); | ||
690 | } | ||
691 | } | ||
692 | UnlockDisplay(dpy); | ||
693 | SyncHandle(); | ||
694 | return True; | ||
695 | } | ||
696 | |||
697 | Status | ||
698 | SDL_NAME(XF86VidModeValidateModeLine) (dpy, screen, modeline) | ||
699 | Display *dpy; | ||
700 | int screen; | ||
701 | SDL_NAME(XF86VidModeModeInfo)* modeline; | ||
702 | { | ||
703 | XExtDisplayInfo *info = find_display (dpy); | ||
704 | xXF86VidModeValidateModeLineReq *req; | ||
705 | xXF86OldVidModeValidateModeLineReq *oldreq; | ||
706 | xXF86VidModeValidateModeLineReply rep; | ||
707 | int majorVersion, minorVersion; | ||
708 | |||
709 | XF86VidModeCheckExtension (dpy, info, 0); | ||
710 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
711 | |||
712 | LockDisplay(dpy); | ||
713 | |||
714 | if (majorVersion < 2) { | ||
715 | GetOldReq(XF86VidModeValidateModeLine, XF86OldVidModeValidateModeLine, oldreq); | ||
716 | oldreq->reqType = info->codes->major_opcode; | ||
717 | oldreq->xf86vidmodeReqType = X_XF86VidModeValidateModeLine; | ||
718 | oldreq->screen = screen; | ||
719 | oldreq->dotclock = modeline->dotclock; | ||
720 | oldreq->hdisplay = modeline->hdisplay; | ||
721 | oldreq->hsyncstart = modeline->hsyncstart; | ||
722 | oldreq->hsyncend = modeline->hsyncend; | ||
723 | oldreq->htotal = modeline->htotal; | ||
724 | oldreq->vdisplay = modeline->vdisplay; | ||
725 | oldreq->vsyncstart = modeline->vsyncstart; | ||
726 | oldreq->vsyncend = modeline->vsyncend; | ||
727 | oldreq->vtotal = modeline->vtotal; | ||
728 | oldreq->flags = modeline->flags; | ||
729 | oldreq->privsize = modeline->privsize; | ||
730 | if (modeline->privsize) { | ||
731 | oldreq->length += modeline->privsize; | ||
732 | Data32(dpy, (long *) modeline->private, | ||
733 | modeline->privsize * sizeof(INT32)); | ||
734 | } | ||
735 | } else { | ||
736 | GetReq(XF86VidModeValidateModeLine, req); | ||
737 | req->reqType = info->codes->major_opcode; | ||
738 | req->xf86vidmodeReqType = X_XF86VidModeValidateModeLine; | ||
739 | req->screen = screen; | ||
740 | req->dotclock = modeline->dotclock; | ||
741 | req->hdisplay = modeline->hdisplay; | ||
742 | req->hsyncstart = modeline->hsyncstart; | ||
743 | req->hsyncend = modeline->hsyncend; | ||
744 | req->htotal = modeline->htotal; | ||
745 | req->hskew = modeline->hskew; | ||
746 | req->vdisplay = modeline->vdisplay; | ||
747 | req->vsyncstart = modeline->vsyncstart; | ||
748 | req->vsyncend = modeline->vsyncend; | ||
749 | req->vtotal = modeline->vtotal; | ||
750 | req->flags = modeline->flags; | ||
751 | req->privsize = modeline->privsize; | ||
752 | if (modeline->privsize) { | ||
753 | req->length += modeline->privsize; | ||
754 | Data32(dpy, (long *) modeline->private, | ||
755 | modeline->privsize * sizeof(INT32)); | ||
756 | } | ||
757 | } | ||
758 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
759 | UnlockDisplay(dpy); | ||
760 | SyncHandle(); | ||
761 | return MODE_BAD; | ||
762 | } | ||
763 | UnlockDisplay(dpy); | ||
764 | SyncHandle(); | ||
765 | return rep.status; | ||
766 | } | ||
767 | |||
768 | Bool | ||
769 | SDL_NAME(XF86VidModeSwitchMode)(dpy, screen, zoom) | ||
770 | Display* dpy; | ||
771 | int screen; | ||
772 | int zoom; | ||
773 | { | ||
774 | XExtDisplayInfo *info = find_display (dpy); | ||
775 | xXF86VidModeSwitchModeReq *req; | ||
776 | |||
777 | XF86VidModeCheckExtension (dpy, info, False); | ||
778 | |||
779 | LockDisplay(dpy); | ||
780 | GetReq(XF86VidModeSwitchMode, req); | ||
781 | req->reqType = info->codes->major_opcode; | ||
782 | req->xf86vidmodeReqType = X_XF86VidModeSwitchMode; | ||
783 | req->screen = screen; | ||
784 | req->zoom = zoom; | ||
785 | UnlockDisplay(dpy); | ||
786 | SyncHandle(); | ||
787 | return True; | ||
788 | } | ||
789 | |||
790 | Bool | ||
791 | SDL_NAME(XF86VidModeSwitchToMode)(dpy, screen, modeline) | ||
792 | Display* dpy; | ||
793 | int screen; | ||
794 | SDL_NAME(XF86VidModeModeInfo)* modeline; | ||
795 | { | ||
796 | XExtDisplayInfo *info = find_display (dpy); | ||
797 | xXF86VidModeSwitchToModeReq *req; | ||
798 | xXF86OldVidModeSwitchToModeReq *oldreq; | ||
799 | int majorVersion, minorVersion; | ||
800 | Bool protocolBug = False; | ||
801 | |||
802 | XF86VidModeCheckExtension (dpy, info, False); | ||
803 | |||
804 | /* | ||
805 | * Note: There was a bug in the protocol implementation in versions | ||
806 | * 0.x with x < 8 (the .private field wasn't expected to be sent over | ||
807 | * the wire). Check the server's version, and accept the old format | ||
808 | * if appropriate. | ||
809 | */ | ||
810 | |||
811 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
812 | if (majorVersion == 0 && minorVersion < 8) { | ||
813 | protocolBug = True; | ||
814 | #ifdef DEBUG | ||
815 | fprintf(stderr, "XF86VidModeSwitchToMode: Warning: Xserver is" | ||
816 | "running an old version (%d.%d)\n", majorVersion, | ||
817 | minorVersion); | ||
818 | #endif | ||
819 | } | ||
820 | |||
821 | LockDisplay(dpy); | ||
822 | if (majorVersion < 2) { | ||
823 | GetOldReq(XF86VidModeSwitchToMode, XF86OldVidModeSwitchToMode, oldreq); | ||
824 | oldreq->reqType = info->codes->major_opcode; | ||
825 | oldreq->xf86vidmodeReqType = X_XF86VidModeSwitchToMode; | ||
826 | oldreq->screen = screen; | ||
827 | oldreq->dotclock = modeline->dotclock; | ||
828 | oldreq->hdisplay = modeline->hdisplay; | ||
829 | oldreq->hsyncstart = modeline->hsyncstart; | ||
830 | oldreq->hsyncend = modeline->hsyncend; | ||
831 | oldreq->htotal = modeline->htotal; | ||
832 | oldreq->vdisplay = modeline->vdisplay; | ||
833 | oldreq->vsyncstart = modeline->vsyncstart; | ||
834 | oldreq->vsyncend = modeline->vsyncend; | ||
835 | oldreq->vtotal = modeline->vtotal; | ||
836 | oldreq->flags = modeline->flags; | ||
837 | if (protocolBug) { | ||
838 | oldreq->privsize = 0; | ||
839 | } else { | ||
840 | oldreq->privsize = modeline->privsize; | ||
841 | if (modeline->privsize) { | ||
842 | oldreq->length += modeline->privsize; | ||
843 | Data32(dpy, (long *) modeline->private, | ||
844 | modeline->privsize * sizeof(INT32)); | ||
845 | } | ||
846 | } | ||
847 | } else { | ||
848 | GetReq(XF86VidModeSwitchToMode, req); | ||
849 | req->reqType = info->codes->major_opcode; | ||
850 | req->xf86vidmodeReqType = X_XF86VidModeSwitchToMode; | ||
851 | req->screen = screen; | ||
852 | req->dotclock = modeline->dotclock; | ||
853 | req->hdisplay = modeline->hdisplay; | ||
854 | req->hsyncstart = modeline->hsyncstart; | ||
855 | req->hsyncend = modeline->hsyncend; | ||
856 | req->htotal = modeline->htotal; | ||
857 | req->hskew = modeline->hskew; | ||
858 | req->vdisplay = modeline->vdisplay; | ||
859 | req->vsyncstart = modeline->vsyncstart; | ||
860 | req->vsyncend = modeline->vsyncend; | ||
861 | req->vtotal = modeline->vtotal; | ||
862 | req->flags = modeline->flags; | ||
863 | if (protocolBug) { | ||
864 | req->privsize = 0; | ||
865 | } else { | ||
866 | req->privsize = modeline->privsize; | ||
867 | if (modeline->privsize) { | ||
868 | req->length += modeline->privsize; | ||
869 | Data32(dpy, (long *) modeline->private, | ||
870 | modeline->privsize * sizeof(INT32)); | ||
871 | } | ||
872 | } | ||
873 | } | ||
874 | UnlockDisplay(dpy); | ||
875 | SyncHandle(); | ||
876 | return True; | ||
877 | } | ||
878 | |||
879 | Bool | ||
880 | SDL_NAME(XF86VidModeLockModeSwitch)(dpy, screen, lock) | ||
881 | Display* dpy; | ||
882 | int screen; | ||
883 | int lock; | ||
884 | { | ||
885 | XExtDisplayInfo *info = find_display (dpy); | ||
886 | xXF86VidModeLockModeSwitchReq *req; | ||
887 | |||
888 | XF86VidModeCheckExtension (dpy, info, False); | ||
889 | |||
890 | LockDisplay(dpy); | ||
891 | GetReq(XF86VidModeLockModeSwitch, req); | ||
892 | req->reqType = info->codes->major_opcode; | ||
893 | req->xf86vidmodeReqType = X_XF86VidModeLockModeSwitch; | ||
894 | req->screen = screen; | ||
895 | req->lock = lock; | ||
896 | UnlockDisplay(dpy); | ||
897 | SyncHandle(); | ||
898 | return True; | ||
899 | } | ||
900 | |||
901 | Bool | ||
902 | SDL_NAME(XF86VidModeGetMonitor)(dpy, screen, monitor) | ||
903 | Display* dpy; | ||
904 | int screen; | ||
905 | SDL_NAME(XF86VidModeMonitor)* monitor; | ||
906 | { | ||
907 | XExtDisplayInfo *info = find_display (dpy); | ||
908 | xXF86VidModeGetMonitorReply rep; | ||
909 | xXF86VidModeGetMonitorReq *req; | ||
910 | CARD32 syncrange; | ||
911 | int i; | ||
912 | |||
913 | XF86VidModeCheckExtension (dpy, info, False); | ||
914 | |||
915 | LockDisplay(dpy); | ||
916 | GetReq(XF86VidModeGetMonitor, req); | ||
917 | req->reqType = info->codes->major_opcode; | ||
918 | req->xf86vidmodeReqType = X_XF86VidModeGetMonitor; | ||
919 | req->screen = screen; | ||
920 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
921 | UnlockDisplay(dpy); | ||
922 | SyncHandle(); | ||
923 | return False; | ||
924 | } | ||
925 | monitor->nhsync = rep.nhsync; | ||
926 | monitor->nvsync = rep.nvsync; | ||
927 | #if 0 | ||
928 | monitor->bandwidth = (float)rep.bandwidth / 1e6; | ||
929 | #endif | ||
930 | if (rep.vendorLength) { | ||
931 | if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) { | ||
932 | _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 + | ||
933 | ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3)); | ||
934 | UnlockDisplay(dpy); | ||
935 | SyncHandle(); | ||
936 | return False; | ||
937 | } | ||
938 | } else { | ||
939 | monitor->vendor = NULL; | ||
940 | } | ||
941 | if (rep.modelLength) { | ||
942 | if (!(monitor->model = Xcalloc(rep.modelLength + 1, 1))) { | ||
943 | _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 + | ||
944 | ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3)); | ||
945 | if (monitor->vendor) | ||
946 | Xfree(monitor->vendor); | ||
947 | UnlockDisplay(dpy); | ||
948 | SyncHandle(); | ||
949 | return False; | ||
950 | } | ||
951 | } else { | ||
952 | monitor->model = NULL; | ||
953 | } | ||
954 | if (!(monitor->hsync = Xcalloc(rep.nhsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) { | ||
955 | _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 + | ||
956 | ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3)); | ||
957 | |||
958 | if (monitor->vendor) | ||
959 | Xfree(monitor->vendor); | ||
960 | if (monitor->model) | ||
961 | Xfree(monitor->model); | ||
962 | UnlockDisplay(dpy); | ||
963 | SyncHandle(); | ||
964 | return False; | ||
965 | } | ||
966 | if (!(monitor->vsync = Xcalloc(rep.nvsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) { | ||
967 | _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 + | ||
968 | ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3)); | ||
969 | if (monitor->vendor) | ||
970 | Xfree(monitor->vendor); | ||
971 | if (monitor->model) | ||
972 | Xfree(monitor->model); | ||
973 | Xfree(monitor->hsync); | ||
974 | UnlockDisplay(dpy); | ||
975 | SyncHandle(); | ||
976 | return False; | ||
977 | } | ||
978 | for (i = 0; i < rep.nhsync; i++) { | ||
979 | _XRead(dpy, (char *)&syncrange, 4); | ||
980 | monitor->hsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0; | ||
981 | monitor->hsync[i].hi = (float)(syncrange >> 16) / 100.0; | ||
982 | } | ||
983 | for (i = 0; i < rep.nvsync; i++) { | ||
984 | _XRead(dpy, (char *)&syncrange, 4); | ||
985 | monitor->vsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0; | ||
986 | monitor->vsync[i].hi = (float)(syncrange >> 16) / 100.0; | ||
987 | } | ||
988 | if (rep.vendorLength) | ||
989 | _XReadPad(dpy, monitor->vendor, rep.vendorLength); | ||
990 | else | ||
991 | monitor->vendor = ""; | ||
992 | if (rep.modelLength) | ||
993 | _XReadPad(dpy, monitor->model, rep.modelLength); | ||
994 | else | ||
995 | monitor->model = ""; | ||
996 | |||
997 | UnlockDisplay(dpy); | ||
998 | SyncHandle(); | ||
999 | return True; | ||
1000 | } | ||
1001 | |||
1002 | Bool | ||
1003 | SDL_NAME(XF86VidModeGetViewPort)(dpy, screen, x, y) | ||
1004 | Display* dpy; | ||
1005 | int screen; | ||
1006 | int *x, *y; | ||
1007 | { | ||
1008 | XExtDisplayInfo *info = find_display (dpy); | ||
1009 | xXF86VidModeGetViewPortReply rep; | ||
1010 | xXF86VidModeGetViewPortReq *req; | ||
1011 | int majorVersion, minorVersion; | ||
1012 | Bool protocolBug = False; | ||
1013 | |||
1014 | XF86VidModeCheckExtension (dpy, info, False); | ||
1015 | |||
1016 | /* | ||
1017 | * Note: There was a bug in the protocol implementation in versions | ||
1018 | * 0.x with x < 8 (no reply was sent, so the client would hang) | ||
1019 | * Check the server's version, and don't wait for a reply with older | ||
1020 | * versions. | ||
1021 | */ | ||
1022 | |||
1023 | SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion); | ||
1024 | if (majorVersion == 0 && minorVersion < 8) { | ||
1025 | protocolBug = True; | ||
1026 | #ifdef DEBUG | ||
1027 | fprintf(stderr, "XF86VidModeGetViewPort: Warning: Xserver is" | ||
1028 | "running an old version (%d.%d)\n", majorVersion, | ||
1029 | minorVersion); | ||
1030 | #endif | ||
1031 | } | ||
1032 | LockDisplay(dpy); | ||
1033 | GetReq(XF86VidModeGetViewPort, req); | ||
1034 | req->reqType = info->codes->major_opcode; | ||
1035 | req->xf86vidmodeReqType = X_XF86VidModeGetViewPort; | ||
1036 | req->screen = screen; | ||
1037 | if (protocolBug) { | ||
1038 | *x = 0; | ||
1039 | *y = 0; | ||
1040 | } else { | ||
1041 | if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { | ||
1042 | UnlockDisplay(dpy); | ||
1043 | SyncHandle(); | ||
1044 | return False; | ||
1045 | } | ||
1046 | *x = rep.x; | ||
1047 | *y = rep.y; | ||
1048 | } | ||
1049 | |||
1050 | UnlockDisplay(dpy); | ||
1051 | SyncHandle(); | ||
1052 | return True; | ||
1053 | } | ||
1054 | |||
1055 | Bool | ||
1056 | SDL_NAME(XF86VidModeSetViewPort)(dpy, screen, x, y) | ||
1057 | Display* dpy; | ||
1058 | int screen; | ||
1059 | int x, y; | ||
1060 | { | ||
1061 | XExtDisplayInfo *info = find_display (dpy); | ||
1062 | xXF86VidModeSetViewPortReq *req; | ||
1063 | |||
1064 | XF86VidModeCheckExtension (dpy, info, False); | ||
1065 | |||
1066 | LockDisplay(dpy); | ||
1067 | GetReq(XF86VidModeSetViewPort, req); | ||
1068 | req->reqType = info->codes->major_opcode; | ||
1069 | req->xf86vidmodeReqType = X_XF86VidModeSetViewPort; | ||
1070 | req->screen = screen; | ||
1071 | req->x = x; | ||
1072 | req->y = y; | ||
1073 | |||
1074 | UnlockDisplay(dpy); | ||
1075 | SyncHandle(); | ||
1076 | return True; | ||
1077 | } | ||
1078 | |||
1079 | Bool | ||
1080 | SDL_NAME(XF86VidModeGetDotClocks)(dpy, screen, | ||
1081 | flagsPtr, numclocksPtr, maxclocksPtr, clocksPtr) | ||
1082 | Display* dpy; | ||
1083 | int screen; | ||
1084 | int *flagsPtr, *numclocksPtr, *maxclocksPtr, *clocksPtr[]; | ||
1085 | { | ||
1086 | XExtDisplayInfo *info = find_display (dpy); | ||
1087 | xXF86VidModeGetDotClocksReply rep; | ||
1088 | xXF86VidModeGetDotClocksReq *req; | ||
1089 | int i, *dotclocks; | ||
1090 | CARD32 dotclk; | ||
1091 | |||
1092 | XF86VidModeCheckExtension (dpy, info, False); | ||
1093 | |||
1094 | LockDisplay(dpy); | ||
1095 | GetReq(XF86VidModeGetDotClocks, req); | ||
1096 | req->reqType = info->codes->major_opcode; | ||
1097 | req->xf86vidmodeReqType = X_XF86VidModeGetDotClocks; | ||
1098 | req->screen = screen; | ||
1099 | if (!_XReply(dpy, (xReply *)&rep, | ||
1100 | (SIZEOF(xXF86VidModeGetDotClocksReply) - SIZEOF(xReply)) >> 2, xFalse)) | ||
1101 | { | ||
1102 | UnlockDisplay(dpy); | ||
1103 | SyncHandle(); | ||
1104 | return False; | ||
1105 | } | ||
1106 | *numclocksPtr = rep.clocks; | ||
1107 | *maxclocksPtr = rep.maxclocks; | ||
1108 | *flagsPtr = rep.flags; | ||
1109 | |||
1110 | if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) { | ||
1111 | _XEatData(dpy, (rep.clocks) * 4); | ||
1112 | Xfree(dotclocks); | ||
1113 | UnlockDisplay(dpy); | ||
1114 | SyncHandle(); | ||
1115 | return False; | ||
1116 | } | ||
1117 | |||
1118 | for (i = 0; i < rep.clocks; i++) { | ||
1119 | _XRead(dpy, (char*)&dotclk, 4); | ||
1120 | dotclocks[i] = dotclk; | ||
1121 | } | ||
1122 | *clocksPtr = dotclocks; | ||
1123 | UnlockDisplay(dpy); | ||
1124 | SyncHandle(); | ||
1125 | return True; | ||
1126 | } | ||
1127 | |||
1128 | Bool | ||
1129 | SDL_NAME(XF86VidModeSetGammaRamp) ( | ||
1130 | Display *dpy, | ||
1131 | int screen, | ||
1132 | int size, | ||
1133 | unsigned short *red, | ||
1134 | unsigned short *green, | ||
1135 | unsigned short *blue | ||
1136 | ) | ||
1137 | { | ||
1138 | int length = (size + 1) & ~1; | ||
1139 | XExtDisplayInfo *info = find_display (dpy); | ||
1140 | xXF86VidModeSetGammaRampReq *req; | ||
1141 | |||
1142 | XF86VidModeCheckExtension (dpy, info, False); | ||
1143 | LockDisplay(dpy); | ||
1144 | GetReq(XF86VidModeSetGammaRamp, req); | ||
1145 | req->reqType = info->codes->major_opcode; | ||
1146 | req->xf86vidmodeReqType = X_XF86VidModeSetGammaRamp; | ||
1147 | req->screen = screen; | ||
1148 | req->length += (length >> 1) * 3; | ||
1149 | req->size = size; | ||
1150 | _XSend(dpy, (char*)red, size * 2); | ||
1151 | _XSend(dpy, (char*)green, size * 2); | ||
1152 | _XSend(dpy, (char*)blue, size * 2); | ||
1153 | UnlockDisplay(dpy); | ||
1154 | SyncHandle(); | ||
1155 | return True; | ||
1156 | } | ||
1157 | |||
1158 | |||
1159 | Bool | ||
1160 | SDL_NAME(XF86VidModeGetGammaRamp) ( | ||
1161 | Display *dpy, | ||
1162 | int screen, | ||
1163 | int size, | ||
1164 | unsigned short *red, | ||
1165 | unsigned short *green, | ||
1166 | unsigned short *blue | ||
1167 | ) | ||
1168 | { | ||
1169 | XExtDisplayInfo *info = find_display (dpy); | ||
1170 | xXF86VidModeGetGammaRampReq *req; | ||
1171 | xXF86VidModeGetGammaRampReply rep; | ||
1172 | |||
1173 | XF86VidModeCheckExtension (dpy, info, False); | ||
1174 | |||
1175 | LockDisplay(dpy); | ||
1176 | GetReq(XF86VidModeGetGammaRamp, req); | ||
1177 | req->reqType = info->codes->major_opcode; | ||
1178 | req->xf86vidmodeReqType = X_XF86VidModeGetGammaRamp; | ||
1179 | req->screen = screen; | ||
1180 | req->size = size; | ||
1181 | if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { | ||
1182 | UnlockDisplay (dpy); | ||
1183 | SyncHandle (); | ||
1184 | return False; | ||
1185 | } | ||
1186 | if(rep.size) { | ||
1187 | _XRead(dpy, (char*)red, rep.size << 1); | ||
1188 | _XRead(dpy, (char*)green, rep.size << 1); | ||
1189 | _XRead(dpy, (char*)blue, rep.size << 1); | ||
1190 | } | ||
1191 | |||
1192 | UnlockDisplay(dpy); | ||
1193 | SyncHandle(); | ||
1194 | return True; | ||
1195 | } | ||
1196 | |||
1197 | Bool SDL_NAME(XF86VidModeGetGammaRampSize)( | ||
1198 | Display *dpy, | ||
1199 | int screen, | ||
1200 | int *size | ||
1201 | ) | ||
1202 | { | ||
1203 | XExtDisplayInfo *info = find_display (dpy); | ||
1204 | xXF86VidModeGetGammaRampSizeReq *req; | ||
1205 | xXF86VidModeGetGammaRampSizeReply rep; | ||
1206 | |||
1207 | *size = 0; | ||
1208 | |||
1209 | XF86VidModeCheckExtension (dpy, info, False); | ||
1210 | |||
1211 | LockDisplay(dpy); | ||
1212 | GetReq(XF86VidModeGetGammaRampSize, req); | ||
1213 | req->reqType = info->codes->major_opcode; | ||
1214 | req->xf86vidmodeReqType = X_XF86VidModeGetGammaRampSize; | ||
1215 | req->screen = screen; | ||
1216 | if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { | ||
1217 | UnlockDisplay (dpy); | ||
1218 | SyncHandle (); | ||
1219 | return False; | ||
1220 | } | ||
1221 | *size = rep.size; | ||
1222 | UnlockDisplay(dpy); | ||
1223 | SyncHandle(); | ||
1224 | return True; | ||
1225 | } | ||
1226 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/Xext.h b/apps/plugins/sdl/src/video/Xext/extensions/Xext.h new file mode 100644 index 0000000000..9edf3194b4 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/Xext.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | Copyright 1989, 1998 The Open Group | ||
3 | |||
4 | Permission to use, copy, modify, distribute, and sell this software and its | ||
5 | documentation for any purpose is hereby granted without fee, provided that | ||
6 | the above copyright notice appear in all copies and that both that | ||
7 | copyright notice and this permission notice appear in supporting | ||
8 | documentation. | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
17 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
19 | |||
20 | Except as contained in this notice, the name of The Open Group shall not be | ||
21 | used in advertising or otherwise to promote the sale, use or other dealings | ||
22 | in this Software without prior written authorization from The Open Group. | ||
23 | */ | ||
24 | /* $XFree86: xc/include/extensions/Xext.h,v 1.7 2005/01/27 03:03:09 dawes Exp $ */ | ||
25 | |||
26 | #ifndef _XEXT_H_ | ||
27 | #define _XEXT_H_ | ||
28 | |||
29 | #include <X11/Xfuncproto.h> | ||
30 | |||
31 | _XFUNCPROTOBEGIN | ||
32 | |||
33 | typedef int (*XExtensionErrorHandler)(Display *, _Xconst char *, | ||
34 | _Xconst char *); | ||
35 | |||
36 | extern XExtensionErrorHandler XSetExtensionErrorHandler( | ||
37 | XExtensionErrorHandler handler | ||
38 | ); | ||
39 | |||
40 | extern int XMissingExtension( | ||
41 | Display* /* dpy */, | ||
42 | _Xconst char* /* ext_name */ | ||
43 | ); | ||
44 | |||
45 | _XFUNCPROTOEND | ||
46 | |||
47 | #define X_EXTENSION_UNKNOWN "unknown" | ||
48 | #define X_EXTENSION_MISSING "missing" | ||
49 | |||
50 | #endif /* _XEXT_H_ */ | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/Xinerama.h b/apps/plugins/sdl/src/video/Xext/extensions/Xinerama.h new file mode 100644 index 0000000000..54f2fe17d2 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/Xinerama.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* $XFree86: xc/include/extensions/Xinerama.h,v 3.2 2000/03/01 01:04:20 dawes Exp $ */ | ||
2 | |||
3 | #ifndef _Xinerama_h | ||
4 | #define _Xinerama_h | ||
5 | |||
6 | #include "SDL_name.h" | ||
7 | |||
8 | typedef struct { | ||
9 | int screen_number; | ||
10 | short x_org; | ||
11 | short y_org; | ||
12 | short width; | ||
13 | short height; | ||
14 | } SDL_NAME(XineramaScreenInfo); | ||
15 | |||
16 | Bool SDL_NAME(XineramaQueryExtension) ( | ||
17 | Display *dpy, | ||
18 | int *event_base, | ||
19 | int *error_base | ||
20 | ); | ||
21 | |||
22 | Status SDL_NAME(XineramaQueryVersion)( | ||
23 | Display *dpy, | ||
24 | int *major, | ||
25 | int *minor | ||
26 | ); | ||
27 | |||
28 | Bool SDL_NAME(XineramaIsActive)(Display *dpy); | ||
29 | |||
30 | |||
31 | /* | ||
32 | Returns the number of heads and a pointer to an array of | ||
33 | structures describing the position and size of the individual | ||
34 | heads. Returns NULL and number = 0 if Xinerama is not active. | ||
35 | |||
36 | Returned array should be freed with XFree(). | ||
37 | */ | ||
38 | |||
39 | SDL_NAME(XineramaScreenInfo) * | ||
40 | SDL_NAME(XineramaQueryScreens)( | ||
41 | Display *dpy, | ||
42 | int *number | ||
43 | ); | ||
44 | |||
45 | #endif /* _Xinerama_h */ | ||
46 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/Xv.h b/apps/plugins/sdl/src/video/Xext/extensions/Xv.h new file mode 100644 index 0000000000..a6a027195f --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/Xv.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /*********************************************************** | ||
2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, | ||
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | ||
4 | |||
5 | All Rights Reserved | ||
6 | |||
7 | Permission to use, copy, modify, and distribute this software and its | ||
8 | documentation for any purpose and without fee is hereby granted, | ||
9 | provided that the above copyright notice appear in all copies and that | ||
10 | both that copyright notice and this permission notice appear in | ||
11 | supporting documentation, and that the names of Digital or MIT not be | ||
12 | used in advertising or publicity pertaining to distribution of the | ||
13 | software without specific, written prior permission. | ||
14 | |||
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
21 | SOFTWARE. | ||
22 | |||
23 | ******************************************************************/ | ||
24 | /* $XFree86: xc/include/extensions/Xv.h,v 1.5 1999/12/11 19:28:48 mvojkovi Exp $ */ | ||
25 | |||
26 | #ifndef XV_H | ||
27 | #define XV_H | ||
28 | /* | ||
29 | ** File: | ||
30 | ** | ||
31 | ** Xv.h --- Xv shared library and server header file | ||
32 | ** | ||
33 | ** Author: | ||
34 | ** | ||
35 | ** David Carver (Digital Workstation Engineering/Project Athena) | ||
36 | ** | ||
37 | ** Revisions: | ||
38 | ** | ||
39 | ** 05.15.91 Carver | ||
40 | ** - version 2.0 upgrade | ||
41 | ** | ||
42 | ** 01.24.91 Carver | ||
43 | ** - version 1.4 upgrade | ||
44 | ** | ||
45 | */ | ||
46 | |||
47 | #include <X11/X.h> | ||
48 | |||
49 | #define XvName "XVideo" | ||
50 | #define XvVersion 2 | ||
51 | #define XvRevision 2 | ||
52 | |||
53 | /* Symbols */ | ||
54 | |||
55 | typedef XID XvPortID; | ||
56 | typedef XID XvEncodingID; | ||
57 | |||
58 | #define XvNone 0 | ||
59 | |||
60 | #define XvInput 0 | ||
61 | #define XvOutput 1 | ||
62 | |||
63 | #define XvInputMask (1L<<XvInput) | ||
64 | #define XvOutputMask (1L<<XvOutput) | ||
65 | #define XvVideoMask 0x00000004 | ||
66 | #define XvStillMask 0x00000008 | ||
67 | #define XvImageMask 0x00000010 | ||
68 | |||
69 | /* These two are not client viewable */ | ||
70 | #define XvPixmapMask 0x00010000 | ||
71 | #define XvWindowMask 0x00020000 | ||
72 | |||
73 | |||
74 | #define XvGettable 0x01 | ||
75 | #define XvSettable 0x02 | ||
76 | |||
77 | #define XvRGB 0 | ||
78 | #define XvYUV 1 | ||
79 | |||
80 | #define XvPacked 0 | ||
81 | #define XvPlanar 1 | ||
82 | |||
83 | #define XvTopToBottom 0 | ||
84 | #define XvBottomToTop 1 | ||
85 | |||
86 | |||
87 | /* Events */ | ||
88 | |||
89 | #define XvVideoNotify 0 | ||
90 | #define XvPortNotify 1 | ||
91 | #define XvNumEvents 2 | ||
92 | |||
93 | /* Video Notify Reasons */ | ||
94 | |||
95 | #define XvStarted 0 | ||
96 | #define XvStopped 1 | ||
97 | #define XvBusy 2 | ||
98 | #define XvPreempted 3 | ||
99 | #define XvHardError 4 | ||
100 | #define XvLastReason 4 | ||
101 | |||
102 | #define XvNumReasons (XvLastReason + 1) | ||
103 | |||
104 | #define XvStartedMask (1L<<XvStarted) | ||
105 | #define XvStoppedMask (1L<<XvStopped) | ||
106 | #define XvBusyMask (1L<<XvBusy) | ||
107 | #define XvPreemptedMask (1L<<XvPreempted) | ||
108 | #define XvHardErrorMask (1L<<XvHardError) | ||
109 | |||
110 | #define XvAnyReasonMask ((1L<<XvNumReasons) - 1) | ||
111 | #define XvNoReasonMask 0 | ||
112 | |||
113 | /* Errors */ | ||
114 | |||
115 | #define XvBadPort 0 | ||
116 | #define XvBadEncoding 1 | ||
117 | #define XvBadControl 2 | ||
118 | #define XvNumErrors 3 | ||
119 | |||
120 | /* Status */ | ||
121 | |||
122 | #define XvBadExtension 1 | ||
123 | #define XvAlreadyGrabbed 2 | ||
124 | #define XvInvalidTime 3 | ||
125 | #define XvBadReply 4 | ||
126 | #define XvBadAlloc 5 | ||
127 | |||
128 | #endif /* XV_H */ | ||
129 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/Xvlib.h b/apps/plugins/sdl/src/video/Xext/extensions/Xvlib.h new file mode 100644 index 0000000000..0d0a55da40 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/Xvlib.h | |||
@@ -0,0 +1,433 @@ | |||
1 | /*********************************************************** | ||
2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, | ||
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | ||
4 | |||
5 | All Rights Reserved | ||
6 | |||
7 | Permission to use, copy, modify, and distribute this software and its | ||
8 | documentation for any purpose and without fee is hereby granted, | ||
9 | provided that the above copyright notice appear in all copies and that | ||
10 | both that copyright notice and this permission notice appear in | ||
11 | supporting documentation, and that the names of Digital or MIT not be | ||
12 | used in advertising or publicity pertaining to distribution of the | ||
13 | software without specific, written prior permission. | ||
14 | |||
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
21 | SOFTWARE. | ||
22 | |||
23 | ******************************************************************/ | ||
24 | /* $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ */ | ||
25 | |||
26 | #ifndef XVLIB_H | ||
27 | #define XVLIB_H | ||
28 | /* | ||
29 | ** File: | ||
30 | ** | ||
31 | ** Xvlib.h --- Xv library public header file | ||
32 | ** | ||
33 | ** Author: | ||
34 | ** | ||
35 | ** David Carver (Digital Workstation Engineering/Project Athena) | ||
36 | ** | ||
37 | ** Revisions: | ||
38 | ** | ||
39 | ** 26.06.91 Carver | ||
40 | ** - changed XvFreeAdaptors to XvFreeAdaptorInfo | ||
41 | ** - changed XvFreeEncodings to XvFreeEncodingInfo | ||
42 | ** | ||
43 | ** 11.06.91 Carver | ||
44 | ** - changed SetPortControl to SetPortAttribute | ||
45 | ** - changed GetPortControl to GetPortAttribute | ||
46 | ** - changed QueryBestSize | ||
47 | ** | ||
48 | ** 05.15.91 Carver | ||
49 | ** - version 2.0 upgrade | ||
50 | ** | ||
51 | ** 01.24.91 Carver | ||
52 | ** - version 1.4 upgrade | ||
53 | ** | ||
54 | */ | ||
55 | |||
56 | #include <X11/Xfuncproto.h> | ||
57 | #include "Xv.h" | ||
58 | #include "SDL_name.h" | ||
59 | |||
60 | typedef struct { | ||
61 | int numerator; | ||
62 | int denominator; | ||
63 | } SDL_NAME(XvRational); | ||
64 | |||
65 | typedef struct { | ||
66 | int flags; /* XvGettable, XvSettable */ | ||
67 | int min_value; | ||
68 | int max_value; | ||
69 | char *name; | ||
70 | } SDL_NAME(XvAttribute); | ||
71 | |||
72 | typedef struct { | ||
73 | XvEncodingID encoding_id; | ||
74 | char *name; | ||
75 | unsigned long width; | ||
76 | unsigned long height; | ||
77 | SDL_NAME(XvRational) rate; | ||
78 | unsigned long num_encodings; | ||
79 | } SDL_NAME(XvEncodingInfo); | ||
80 | |||
81 | typedef struct { | ||
82 | char depth; | ||
83 | unsigned long visual_id; | ||
84 | } SDL_NAME(XvFormat); | ||
85 | |||
86 | typedef struct { | ||
87 | XvPortID base_id; | ||
88 | unsigned long num_ports; | ||
89 | char type; | ||
90 | char *name; | ||
91 | unsigned long num_formats; | ||
92 | SDL_NAME(XvFormat) *formats; | ||
93 | unsigned long num_adaptors; | ||
94 | } SDL_NAME(XvAdaptorInfo); | ||
95 | |||
96 | typedef struct { | ||
97 | int type; | ||
98 | unsigned long serial; /* # of last request processed by server */ | ||
99 | Bool send_event; /* true if this came from a SendEvent request */ | ||
100 | Display *display; /* Display the event was read from */ | ||
101 | Drawable drawable; /* drawable */ | ||
102 | unsigned long reason; /* what generated this event */ | ||
103 | XvPortID port_id; /* what port */ | ||
104 | Time time; /* milliseconds */ | ||
105 | } SDL_NAME(XvVideoNotifyEvent); | ||
106 | |||
107 | typedef struct { | ||
108 | int type; | ||
109 | unsigned long serial; /* # of last request processed by server */ | ||
110 | Bool send_event; /* true if this came from a SendEvent request */ | ||
111 | Display *display; /* Display the event was read from */ | ||
112 | XvPortID port_id; /* what port */ | ||
113 | Time time; /* milliseconds */ | ||
114 | Atom attribute; /* atom that identifies attribute */ | ||
115 | long value; /* value of attribute */ | ||
116 | } SDL_NAME(XvPortNotifyEvent); | ||
117 | |||
118 | typedef union { | ||
119 | int type; | ||
120 | SDL_NAME(XvVideoNotifyEvent) xvvideo; | ||
121 | SDL_NAME(XvPortNotifyEvent) xvport; | ||
122 | long pad[24]; | ||
123 | } SDL_NAME(XvEvent); | ||
124 | |||
125 | typedef struct { | ||
126 | int id; /* Unique descriptor for the format */ | ||
127 | int type; /* XvRGB, XvYUV */ | ||
128 | int byte_order; /* LSBFirst, MSBFirst */ | ||
129 | char guid[16]; /* Globally Unique IDentifier */ | ||
130 | int bits_per_pixel; | ||
131 | int format; /* XvPacked, XvPlanar */ | ||
132 | int num_planes; | ||
133 | |||
134 | /* for RGB formats only */ | ||
135 | int depth; | ||
136 | unsigned int red_mask; | ||
137 | unsigned int green_mask; | ||
138 | unsigned int blue_mask; | ||
139 | |||
140 | /* for YUV formats only */ | ||
141 | unsigned int y_sample_bits; | ||
142 | unsigned int u_sample_bits; | ||
143 | unsigned int v_sample_bits; | ||
144 | unsigned int horz_y_period; | ||
145 | unsigned int horz_u_period; | ||
146 | unsigned int horz_v_period; | ||
147 | unsigned int vert_y_period; | ||
148 | unsigned int vert_u_period; | ||
149 | unsigned int vert_v_period; | ||
150 | char component_order[32]; /* eg. UYVY */ | ||
151 | int scanline_order; /* XvTopToBottom, XvBottomToTop */ | ||
152 | } SDL_NAME(XvImageFormatValues); | ||
153 | |||
154 | typedef struct { | ||
155 | int id; | ||
156 | int width, height; | ||
157 | int data_size; /* bytes */ | ||
158 | int num_planes; | ||
159 | int *pitches; /* bytes */ | ||
160 | int *offsets; /* bytes */ | ||
161 | char *data; | ||
162 | XPointer obdata; | ||
163 | } SDL_NAME(XvImage); | ||
164 | |||
165 | _XFUNCPROTOBEGIN | ||
166 | |||
167 | extern int SDL_NAME(XvQueryExtension)( | ||
168 | #if NeedFunctionPrototypes | ||
169 | Display* /* display */, | ||
170 | unsigned int* /* p_version */, | ||
171 | unsigned int* /* p_revision */, | ||
172 | unsigned int* /* p_requestBase */, | ||
173 | unsigned int* /* p_eventBase */, | ||
174 | unsigned int* /* p_errorBase */ | ||
175 | #endif | ||
176 | ); | ||
177 | |||
178 | extern int SDL_NAME(XvQueryAdaptors)( | ||
179 | #if NeedFunctionPrototypes | ||
180 | Display* /* display */, | ||
181 | Window /* window */, | ||
182 | unsigned int* /* p_nAdaptors */, | ||
183 | SDL_NAME(XvAdaptorInfo)** /* p_pAdaptors */ | ||
184 | #endif | ||
185 | ); | ||
186 | |||
187 | extern int SDL_NAME(XvQueryEncodings)( | ||
188 | #if NeedFunctionPrototypes | ||
189 | Display* /* display */, | ||
190 | XvPortID /* port */, | ||
191 | unsigned int* /* p_nEncoding */, | ||
192 | SDL_NAME(XvEncodingInfo)** /* p_pEncoding */ | ||
193 | #endif | ||
194 | ); | ||
195 | |||
196 | extern int SDL_NAME(XvPutVideo)( | ||
197 | #if NeedFunctionPrototypes | ||
198 | Display* /* display */, | ||
199 | XvPortID /* port */, | ||
200 | Drawable /* d */, | ||
201 | GC /* gc */, | ||
202 | int /* vx */, | ||
203 | int /* vy */, | ||
204 | unsigned int /* vw */, | ||
205 | unsigned int /* vh */, | ||
206 | int /* dx */, | ||
207 | int /* dy */, | ||
208 | unsigned int /* dw */, | ||
209 | unsigned int /* dh */ | ||
210 | #endif | ||
211 | ); | ||
212 | |||
213 | extern int SDL_NAME(XvPutStill)( | ||
214 | #if NeedFunctionPrototypes | ||
215 | Display* /* display */, | ||
216 | XvPortID /* port */, | ||
217 | Drawable /* d */, | ||
218 | GC /* gc */, | ||
219 | int /* vx */, | ||
220 | int /* vy */, | ||
221 | unsigned int /* vw */, | ||
222 | unsigned int /* vh */, | ||
223 | int /* dx */, | ||
224 | int /* dy */, | ||
225 | unsigned int /* dw */, | ||
226 | unsigned int /* dh */ | ||
227 | #endif | ||
228 | ); | ||
229 | |||
230 | extern int SDL_NAME(XvGetVideo)( | ||
231 | #if NeedFunctionPrototypes | ||
232 | Display* /* display */, | ||
233 | XvPortID /* port */, | ||
234 | Drawable /* d */, | ||
235 | GC /* gc */, | ||
236 | int /* vx */, | ||
237 | int /* vy */, | ||
238 | unsigned int /* vw */, | ||
239 | unsigned int /* vh */, | ||
240 | int /* dx */, | ||
241 | int /* dy */, | ||
242 | unsigned int /* dw */, | ||
243 | unsigned int /* dh */ | ||
244 | #endif | ||
245 | ); | ||
246 | |||
247 | extern int SDL_NAME(XvGetStill)( | ||
248 | #if NeedFunctionPrototypes | ||
249 | Display* /* display */, | ||
250 | XvPortID /* port */, | ||
251 | Drawable /* d */, | ||
252 | GC /* gc */, | ||
253 | int /* vx */, | ||
254 | int /* vy */, | ||
255 | unsigned int /* vw */, | ||
256 | unsigned int /* vh */, | ||
257 | int /* dx */, | ||
258 | int /* dy */, | ||
259 | unsigned int /* dw */, | ||
260 | unsigned int /* dh */ | ||
261 | #endif | ||
262 | ); | ||
263 | |||
264 | extern int SDL_NAME(XvStopVideo)( | ||
265 | #if NeedFunctionPrototypes | ||
266 | Display* /* display */, | ||
267 | XvPortID /* port */, | ||
268 | Drawable /* drawable */ | ||
269 | #endif | ||
270 | ); | ||
271 | |||
272 | extern int SDL_NAME(XvGrabPort)( | ||
273 | #if NeedFunctionPrototypes | ||
274 | Display* /* display */, | ||
275 | XvPortID /* port */, | ||
276 | Time /* time */ | ||
277 | #endif | ||
278 | ); | ||
279 | |||
280 | extern int SDL_NAME(XvUngrabPort)( | ||
281 | #if NeedFunctionPrototypes | ||
282 | Display* /* display */, | ||
283 | XvPortID /* port */, | ||
284 | Time /* time */ | ||
285 | #endif | ||
286 | ); | ||
287 | |||
288 | extern int SDL_NAME(XvSelectVideoNotify)( | ||
289 | #if NeedFunctionPrototypes | ||
290 | Display* /* display */, | ||
291 | Drawable /* drawable */, | ||
292 | Bool /* onoff */ | ||
293 | #endif | ||
294 | ); | ||
295 | |||
296 | extern int SDL_NAME(XvSelectPortNotify)( | ||
297 | #if NeedFunctionPrototypes | ||
298 | Display* /* display */, | ||
299 | XvPortID /* port */, | ||
300 | Bool /* onoff */ | ||
301 | #endif | ||
302 | ); | ||
303 | |||
304 | extern int SDL_NAME(XvSetPortAttribute)( | ||
305 | #if NeedFunctionPrototypes | ||
306 | Display* /* display */, | ||
307 | XvPortID /* port */, | ||
308 | Atom /* attribute */, | ||
309 | int /* value */ | ||
310 | #endif | ||
311 | ); | ||
312 | |||
313 | extern int SDL_NAME(XvGetPortAttribute)( | ||
314 | #if NeedFunctionPrototypes | ||
315 | Display* /* display */, | ||
316 | XvPortID /* port */, | ||
317 | Atom /* attribute */, | ||
318 | int* /* p_value */ | ||
319 | #endif | ||
320 | ); | ||
321 | |||
322 | extern int SDL_NAME(XvQueryBestSize)( | ||
323 | #if NeedFunctionPrototypes | ||
324 | Display* /* display */, | ||
325 | XvPortID /* port */, | ||
326 | Bool /* motion */, | ||
327 | unsigned int /* vid_w */, | ||
328 | unsigned int /* vid_h */, | ||
329 | unsigned int /* drw_w */, | ||
330 | unsigned int /* drw_h */, | ||
331 | unsigned int* /* p_actual_width */, | ||
332 | unsigned int* /* p_actual_width */ | ||
333 | #endif | ||
334 | ); | ||
335 | |||
336 | extern SDL_NAME(XvAttribute)* SDL_NAME(XvQueryPortAttributes)( | ||
337 | #if NeedFunctionPrototypes | ||
338 | Display* /* display */, | ||
339 | XvPortID /* port */, | ||
340 | int* /* number */ | ||
341 | #endif | ||
342 | ); | ||
343 | |||
344 | |||
345 | extern void SDL_NAME(XvFreeAdaptorInfo)( | ||
346 | #if NeedFunctionPrototypes | ||
347 | SDL_NAME(XvAdaptorInfo)* /* adaptors */ | ||
348 | #endif | ||
349 | ); | ||
350 | |||
351 | extern void SDL_NAME(XvFreeEncodingInfo)( | ||
352 | #if NeedFunctionPrototypes | ||
353 | SDL_NAME(XvEncodingInfo)* /* encodings */ | ||
354 | #endif | ||
355 | ); | ||
356 | |||
357 | |||
358 | extern SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( | ||
359 | #if NeedFunctionPrototypes | ||
360 | Display *display, | ||
361 | XvPortID port_id, | ||
362 | int *count_return | ||
363 | #endif | ||
364 | ); | ||
365 | |||
366 | extern SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( | ||
367 | #if NeedFunctionPrototypes | ||
368 | Display *display, | ||
369 | XvPortID port, | ||
370 | int id, | ||
371 | char *data, | ||
372 | int width, | ||
373 | int height | ||
374 | #endif | ||
375 | ); | ||
376 | |||
377 | extern int SDL_NAME(XvPutImage) ( | ||
378 | #if NeedFunctionPrototypes | ||
379 | Display *display, | ||
380 | XvPortID id, | ||
381 | Drawable d, | ||
382 | GC gc, | ||
383 | SDL_NAME(XvImage) *image, | ||
384 | int src_x, | ||
385 | int src_y, | ||
386 | unsigned int src_w, | ||
387 | unsigned int src_h, | ||
388 | int dest_x, | ||
389 | int dest_y, | ||
390 | unsigned int dest_w, | ||
391 | unsigned int dest_h | ||
392 | #endif | ||
393 | ); | ||
394 | |||
395 | extern int SDL_NAME(XvShmPutImage) ( | ||
396 | #if NeedFunctionPrototypes | ||
397 | Display *display, | ||
398 | XvPortID id, | ||
399 | Drawable d, | ||
400 | GC gc, | ||
401 | SDL_NAME(XvImage) *image, | ||
402 | int src_x, | ||
403 | int src_y, | ||
404 | unsigned int src_w, | ||
405 | unsigned int src_h, | ||
406 | int dest_x, | ||
407 | int dest_y, | ||
408 | unsigned int dest_w, | ||
409 | unsigned int dest_h, | ||
410 | Bool send_event | ||
411 | #endif | ||
412 | ); | ||
413 | |||
414 | #ifdef _XSHM_H_ | ||
415 | |||
416 | extern SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) ( | ||
417 | #if NeedFunctionPrototypes | ||
418 | Display *display, | ||
419 | XvPortID port, | ||
420 | int id, | ||
421 | char* data, | ||
422 | int width, | ||
423 | int height, | ||
424 | XShmSegmentInfo *shminfo | ||
425 | #endif | ||
426 | ); | ||
427 | |||
428 | #endif | ||
429 | |||
430 | |||
431 | _XFUNCPROTOEND | ||
432 | |||
433 | #endif /* XVLIB_H */ | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/Xvproto.h b/apps/plugins/sdl/src/video/Xext/extensions/Xvproto.h new file mode 100644 index 0000000000..b4d8f22cdc --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/Xvproto.h | |||
@@ -0,0 +1,604 @@ | |||
1 | /*********************************************************** | ||
2 | Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, | ||
3 | and the Massachusetts Institute of Technology, Cambridge, Massachusetts. | ||
4 | |||
5 | All Rights Reserved | ||
6 | |||
7 | Permission to use, copy, modify, and distribute this software and its | ||
8 | documentation for any purpose and without fee is hereby granted, | ||
9 | provided that the above copyright notice appear in all copies and that | ||
10 | both that copyright notice and this permission notice appear in | ||
11 | supporting documentation, and that the names of Digital or MIT not be | ||
12 | used in advertising or publicity pertaining to distribution of the | ||
13 | software without specific, written prior permission. | ||
14 | |||
15 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | ||
16 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | ||
17 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | ||
18 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | ||
19 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | ||
20 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
21 | SOFTWARE. | ||
22 | |||
23 | ******************************************************************/ | ||
24 | /* $XFree86: xc/include/extensions/Xvproto.h,v 1.6 2001/05/07 21:37:12 tsi Exp $ */ | ||
25 | |||
26 | #ifndef XVPROTO_H | ||
27 | #define XVPROTO_H | ||
28 | /* | ||
29 | ** File: | ||
30 | ** | ||
31 | ** Xvproto.h --- Xv protocol header file | ||
32 | ** | ||
33 | ** Author: | ||
34 | ** | ||
35 | ** David Carver (Digital Workstation Engineering/Project Athena) | ||
36 | ** | ||
37 | ** Revisions: | ||
38 | ** | ||
39 | ** 11.06.91 Carver | ||
40 | ** - changed SetPortControl to SetPortAttribute | ||
41 | ** - changed GetPortControl to GetPortAttribute | ||
42 | ** - changed QueryBestSize | ||
43 | ** | ||
44 | ** 15.05.91 Carver | ||
45 | ** - version 2.0 upgrade | ||
46 | ** | ||
47 | ** 24.01.91 Carver | ||
48 | ** - version 1.4 upgrade | ||
49 | ** | ||
50 | */ | ||
51 | |||
52 | #include <X11/Xmd.h> | ||
53 | |||
54 | /* Symbols: These are undefined at the end of this file to restore the | ||
55 | values they have in Xv.h */ | ||
56 | |||
57 | #define XvPortID CARD32 | ||
58 | #define XvEncodingID CARD32 | ||
59 | #define ShmSeg CARD32 | ||
60 | #define VisualID CARD32 | ||
61 | #define Drawable CARD32 | ||
62 | #define GContext CARD32 | ||
63 | #define Time CARD32 | ||
64 | #define Atom CARD32 | ||
65 | |||
66 | /* Structures */ | ||
67 | |||
68 | typedef struct { | ||
69 | INT32 numerator B32; | ||
70 | INT32 denominator B32; | ||
71 | } xvRational; | ||
72 | #define sz_xvRational 8 | ||
73 | |||
74 | typedef struct { | ||
75 | XvPortID base_id B32; | ||
76 | CARD16 name_size B16; | ||
77 | CARD16 num_ports B16; | ||
78 | CARD16 num_formats B16; | ||
79 | CARD8 type; | ||
80 | CARD8 pad; | ||
81 | } xvAdaptorInfo; | ||
82 | #define sz_xvAdaptorInfo 12 | ||
83 | |||
84 | typedef struct { | ||
85 | XvEncodingID encoding B32; | ||
86 | CARD16 name_size B16; | ||
87 | CARD16 width B16, height B16; | ||
88 | xvRational rate; | ||
89 | CARD16 pad B16; | ||
90 | } xvEncodingInfo; | ||
91 | #define sz_xvEncodingInfo (12 + sz_xvRational) | ||
92 | |||
93 | typedef struct { | ||
94 | VisualID visual B32; | ||
95 | CARD8 depth; | ||
96 | CARD8 pad1; | ||
97 | CARD16 pad2 B16; | ||
98 | } xvFormat; | ||
99 | #define sz_xvFormat 8 | ||
100 | |||
101 | typedef struct { | ||
102 | CARD32 flags B32; | ||
103 | INT32 min B32; | ||
104 | INT32 max B32; | ||
105 | CARD32 size B32; | ||
106 | } xvAttributeInfo; | ||
107 | #define sz_xvAttributeInfo 16 | ||
108 | |||
109 | typedef struct { | ||
110 | CARD32 id B32; | ||
111 | CARD8 type; | ||
112 | CARD8 byte_order; | ||
113 | CARD16 pad1 B16; | ||
114 | CARD8 guid[16]; | ||
115 | CARD8 bpp; | ||
116 | CARD8 num_planes; | ||
117 | CARD16 pad2 B16; | ||
118 | CARD8 depth; | ||
119 | CARD8 pad3; | ||
120 | CARD16 pad4 B16; | ||
121 | CARD32 red_mask B32; | ||
122 | CARD32 green_mask B32; | ||
123 | CARD32 blue_mask B32; | ||
124 | CARD8 format; | ||
125 | CARD8 pad5; | ||
126 | CARD16 pad6 B16; | ||
127 | CARD32 y_sample_bits B32; | ||
128 | CARD32 u_sample_bits B32; | ||
129 | CARD32 v_sample_bits B32; | ||
130 | CARD32 horz_y_period B32; | ||
131 | CARD32 horz_u_period B32; | ||
132 | CARD32 horz_v_period B32; | ||
133 | CARD32 vert_y_period B32; | ||
134 | CARD32 vert_u_period B32; | ||
135 | CARD32 vert_v_period B32; | ||
136 | CARD8 comp_order[32]; | ||
137 | CARD8 scanline_order; | ||
138 | CARD8 pad7; | ||
139 | CARD16 pad8 B16; | ||
140 | CARD32 pad9 B32; | ||
141 | CARD32 pad10 B32; | ||
142 | } xvImageFormatInfo; | ||
143 | #define sz_xvImageFormatInfo 128 | ||
144 | |||
145 | |||
146 | /* Requests */ | ||
147 | |||
148 | #define xv_QueryExtension 0 | ||
149 | #define xv_QueryAdaptors 1 | ||
150 | #define xv_QueryEncodings 2 | ||
151 | #define xv_GrabPort 3 | ||
152 | #define xv_UngrabPort 4 | ||
153 | #define xv_PutVideo 5 | ||
154 | #define xv_PutStill 6 | ||
155 | #define xv_GetVideo 7 | ||
156 | #define xv_GetStill 8 | ||
157 | #define xv_StopVideo 9 | ||
158 | #define xv_SelectVideoNotify 10 | ||
159 | #define xv_SelectPortNotify 11 | ||
160 | #define xv_QueryBestSize 12 | ||
161 | #define xv_SetPortAttribute 13 | ||
162 | #define xv_GetPortAttribute 14 | ||
163 | #define xv_QueryPortAttributes 15 | ||
164 | #define xv_ListImageFormats 16 | ||
165 | #define xv_QueryImageAttributes 17 | ||
166 | #define xv_PutImage 18 | ||
167 | #define xv_ShmPutImage 19 | ||
168 | #define xv_LastRequest xv_ShmPutImage | ||
169 | |||
170 | #define xvNumRequests (xv_LastRequest + 1) | ||
171 | |||
172 | typedef struct { | ||
173 | CARD8 reqType; | ||
174 | CARD8 xvReqType; | ||
175 | CARD16 length B16; | ||
176 | } xvQueryExtensionReq; | ||
177 | #define sz_xvQueryExtensionReq 4 | ||
178 | |||
179 | typedef struct { | ||
180 | CARD8 reqType; | ||
181 | CARD8 xvReqType; | ||
182 | CARD16 length B16; | ||
183 | CARD32 window B32; | ||
184 | } xvQueryAdaptorsReq; | ||
185 | #define sz_xvQueryAdaptorsReq 8 | ||
186 | |||
187 | typedef struct { | ||
188 | CARD8 reqType; | ||
189 | CARD8 xvReqType; | ||
190 | CARD16 length B16; | ||
191 | CARD32 port B32; | ||
192 | } xvQueryEncodingsReq; | ||
193 | #define sz_xvQueryEncodingsReq 8 | ||
194 | |||
195 | typedef struct { | ||
196 | CARD8 reqType; | ||
197 | CARD8 xvReqType; | ||
198 | CARD16 length B16; | ||
199 | XvPortID port B32; | ||
200 | Drawable drawable B32; | ||
201 | GContext gc B32; | ||
202 | INT16 vid_x B16; | ||
203 | INT16 vid_y B16; | ||
204 | CARD16 vid_w B16; | ||
205 | CARD16 vid_h B16; | ||
206 | INT16 drw_x B16; | ||
207 | INT16 drw_y B16; | ||
208 | CARD16 drw_w B16; | ||
209 | CARD16 drw_h B16; | ||
210 | } xvPutVideoReq; | ||
211 | #define sz_xvPutVideoReq 32 | ||
212 | |||
213 | typedef struct { | ||
214 | CARD8 reqType; | ||
215 | CARD8 xvReqType; | ||
216 | CARD16 length B16; | ||
217 | XvPortID port B32; | ||
218 | Drawable drawable B32; | ||
219 | GContext gc B32; | ||
220 | INT16 vid_x B16; | ||
221 | INT16 vid_y B16; | ||
222 | CARD16 vid_w B16; | ||
223 | CARD16 vid_h B16; | ||
224 | INT16 drw_x B16; | ||
225 | INT16 drw_y B16; | ||
226 | CARD16 drw_w B16; | ||
227 | CARD16 drw_h B16; | ||
228 | } xvPutStillReq; | ||
229 | #define sz_xvPutStillReq 32 | ||
230 | |||
231 | typedef struct { | ||
232 | CARD8 reqType; | ||
233 | CARD8 xvReqType; | ||
234 | CARD16 length B16; | ||
235 | XvPortID port B32; | ||
236 | Drawable drawable B32; | ||
237 | GContext gc B32; | ||
238 | INT16 vid_x B16; | ||
239 | INT16 vid_y B16; | ||
240 | CARD16 vid_w B16; | ||
241 | CARD16 vid_h B16; | ||
242 | INT16 drw_x B16; | ||
243 | INT16 drw_y B16; | ||
244 | CARD16 drw_w B16; | ||
245 | CARD16 drw_h B16; | ||
246 | } xvGetVideoReq; | ||
247 | #define sz_xvGetVideoReq 32 | ||
248 | |||
249 | typedef struct { | ||
250 | CARD8 reqType; | ||
251 | CARD8 xvReqType; | ||
252 | CARD16 length B16; | ||
253 | XvPortID port B32; | ||
254 | Drawable drawable B32; | ||
255 | GContext gc B32; | ||
256 | INT16 vid_x B16; | ||
257 | INT16 vid_y B16; | ||
258 | CARD16 vid_w B16; | ||
259 | CARD16 vid_h B16; | ||
260 | INT16 drw_x B16; | ||
261 | INT16 drw_y B16; | ||
262 | CARD16 drw_w B16; | ||
263 | CARD16 drw_h B16; | ||
264 | } xvGetStillReq; | ||
265 | #define sz_xvGetStillReq 32 | ||
266 | |||
267 | typedef struct { | ||
268 | CARD8 reqType; | ||
269 | CARD8 xvReqType; | ||
270 | CARD16 length B16; | ||
271 | XvPortID port B32; | ||
272 | Time time B32; | ||
273 | } xvGrabPortReq; | ||
274 | #define sz_xvGrabPortReq 12 | ||
275 | |||
276 | typedef struct { | ||
277 | CARD8 reqType; | ||
278 | CARD8 xvReqType; | ||
279 | CARD16 length B16; | ||
280 | XvPortID port B32; | ||
281 | Time time B32; | ||
282 | } xvUngrabPortReq; | ||
283 | #define sz_xvUngrabPortReq 12 | ||
284 | |||
285 | typedef struct { | ||
286 | CARD8 reqType; | ||
287 | CARD8 xvReqType; | ||
288 | CARD16 length B16; | ||
289 | Drawable drawable B32; | ||
290 | BOOL onoff; | ||
291 | CARD8 pad1; | ||
292 | CARD16 pad2; | ||
293 | } xvSelectVideoNotifyReq; | ||
294 | #define sz_xvSelectVideoNotifyReq 12 | ||
295 | |||
296 | typedef struct { | ||
297 | CARD8 reqType; | ||
298 | CARD8 xvReqType; | ||
299 | CARD16 length B16; | ||
300 | XvPortID port B32; | ||
301 | BOOL onoff; | ||
302 | CARD8 pad1; | ||
303 | CARD16 pad2; | ||
304 | } xvSelectPortNotifyReq; | ||
305 | #define sz_xvSelectPortNotifyReq 12 | ||
306 | |||
307 | typedef struct { | ||
308 | CARD8 reqType; | ||
309 | CARD8 xvReqType; | ||
310 | CARD16 length B16; | ||
311 | XvPortID port B32; | ||
312 | Drawable drawable B32; | ||
313 | } xvStopVideoReq; | ||
314 | #define sz_xvStopVideoReq 12 | ||
315 | |||
316 | typedef struct { | ||
317 | CARD8 reqType; | ||
318 | CARD8 xvReqType; | ||
319 | CARD16 length B16; | ||
320 | XvPortID port B32; | ||
321 | Atom attribute B32; | ||
322 | INT32 value B32; | ||
323 | } xvSetPortAttributeReq; | ||
324 | #define sz_xvSetPortAttributeReq 16 | ||
325 | |||
326 | typedef struct { | ||
327 | CARD8 reqType; | ||
328 | CARD8 xvReqType; | ||
329 | CARD16 length B16; | ||
330 | XvPortID port B32; | ||
331 | Atom attribute B32; | ||
332 | } xvGetPortAttributeReq; | ||
333 | #define sz_xvGetPortAttributeReq 12 | ||
334 | |||
335 | typedef struct { | ||
336 | CARD8 reqType; | ||
337 | CARD8 xvReqType; | ||
338 | CARD16 length B16; | ||
339 | XvPortID port B32; | ||
340 | CARD16 vid_w B16; | ||
341 | CARD16 vid_h B16; | ||
342 | CARD16 drw_w B16; | ||
343 | CARD16 drw_h B16; | ||
344 | CARD8 motion; | ||
345 | CARD8 pad1; | ||
346 | CARD16 pad2 B16; | ||
347 | } xvQueryBestSizeReq; | ||
348 | #define sz_xvQueryBestSizeReq 20 | ||
349 | |||
350 | typedef struct { | ||
351 | CARD8 reqType; | ||
352 | CARD8 xvReqType; | ||
353 | CARD16 length B16; | ||
354 | XvPortID port B32; | ||
355 | } xvQueryPortAttributesReq; | ||
356 | #define sz_xvQueryPortAttributesReq 8 | ||
357 | |||
358 | typedef struct { | ||
359 | CARD8 reqType; | ||
360 | CARD8 xvReqType; | ||
361 | CARD16 length B16; | ||
362 | XvPortID port B32; | ||
363 | Drawable drawable B32; | ||
364 | GContext gc B32; | ||
365 | CARD32 id B32; | ||
366 | INT16 src_x B16; | ||
367 | INT16 src_y B16; | ||
368 | CARD16 src_w B16; | ||
369 | CARD16 src_h B16; | ||
370 | INT16 drw_x B16; | ||
371 | INT16 drw_y B16; | ||
372 | CARD16 drw_w B16; | ||
373 | CARD16 drw_h B16; | ||
374 | CARD16 width B16; | ||
375 | CARD16 height B16; | ||
376 | } xvPutImageReq; | ||
377 | #define sz_xvPutImageReq 40 | ||
378 | |||
379 | typedef struct { | ||
380 | CARD8 reqType; | ||
381 | CARD8 xvReqType; | ||
382 | CARD16 length B16; | ||
383 | XvPortID port B32; | ||
384 | Drawable drawable B32; | ||
385 | GContext gc B32; | ||
386 | ShmSeg shmseg B32; | ||
387 | CARD32 id B32; | ||
388 | CARD32 offset B32; | ||
389 | INT16 src_x B16; | ||
390 | INT16 src_y B16; | ||
391 | CARD16 src_w B16; | ||
392 | CARD16 src_h B16; | ||
393 | INT16 drw_x B16; | ||
394 | INT16 drw_y B16; | ||
395 | CARD16 drw_w B16; | ||
396 | CARD16 drw_h B16; | ||
397 | CARD16 width B16; | ||
398 | CARD16 height B16; | ||
399 | CARD8 send_event; | ||
400 | CARD8 pad1; | ||
401 | CARD16 pad2 B16; | ||
402 | } xvShmPutImageReq; | ||
403 | #define sz_xvShmPutImageReq 52 | ||
404 | |||
405 | typedef struct { | ||
406 | CARD8 reqType; | ||
407 | CARD8 xvReqType; | ||
408 | CARD16 length B16; | ||
409 | XvPortID port B32; | ||
410 | } xvListImageFormatsReq; | ||
411 | #define sz_xvListImageFormatsReq 8 | ||
412 | |||
413 | typedef struct { | ||
414 | CARD8 reqType; | ||
415 | CARD8 xvReqType; | ||
416 | CARD16 length B16; | ||
417 | CARD32 port B32; | ||
418 | CARD32 id B32; | ||
419 | CARD16 width B16; | ||
420 | CARD16 height B16; | ||
421 | } xvQueryImageAttributesReq; | ||
422 | #define sz_xvQueryImageAttributesReq 16 | ||
423 | |||
424 | |||
425 | /* Replies */ | ||
426 | |||
427 | typedef struct _QueryExtensionReply { | ||
428 | BYTE type; /* X_Reply */ | ||
429 | CARD8 padb1; | ||
430 | CARD16 sequenceNumber B16; | ||
431 | CARD32 length B32; | ||
432 | CARD16 version B16; | ||
433 | CARD16 revision B16; | ||
434 | CARD32 padl4 B32; | ||
435 | CARD32 padl5 B32; | ||
436 | CARD32 padl6 B32; | ||
437 | CARD32 padl7 B32; | ||
438 | CARD32 padl8 B32; | ||
439 | } xvQueryExtensionReply; | ||
440 | #define sz_xvQueryExtensionReply 32 | ||
441 | |||
442 | typedef struct _QueryAdaptorsReply { | ||
443 | BYTE type; /* X_Reply */ | ||
444 | CARD8 padb1; | ||
445 | CARD16 sequenceNumber B16; | ||
446 | CARD32 length B32; | ||
447 | CARD16 num_adaptors B16; | ||
448 | CARD16 pads3 B16; | ||
449 | CARD32 padl4 B32; | ||
450 | CARD32 padl5 B32; | ||
451 | CARD32 padl6 B32; | ||
452 | CARD32 padl7 B32; | ||
453 | CARD32 padl8 B32; | ||
454 | } xvQueryAdaptorsReply; | ||
455 | #define sz_xvQueryAdaptorsReply 32 | ||
456 | |||
457 | typedef struct _QueryEncodingsReply { | ||
458 | BYTE type; /* X_Reply */ | ||
459 | CARD8 padb1; | ||
460 | CARD16 sequenceNumber B16; | ||
461 | CARD32 length B32; | ||
462 | CARD16 num_encodings B16; | ||
463 | CARD32 padl3 B32; | ||
464 | CARD32 padl4 B32; | ||
465 | CARD32 padl5 B32; | ||
466 | CARD32 padl6 B32; | ||
467 | CARD32 padl7 B32; | ||
468 | CARD32 padl8 B32; | ||
469 | } xvQueryEncodingsReply; | ||
470 | #define sz_xvQueryEncodingsReply 32 | ||
471 | |||
472 | typedef struct { | ||
473 | BYTE type; /* X_Reply */ | ||
474 | BYTE result; | ||
475 | CARD16 sequenceNumber B16; | ||
476 | CARD32 length B32; /* 0 */ | ||
477 | CARD32 padl3 B32; | ||
478 | CARD32 padl4 B32; | ||
479 | CARD32 padl5 B32; | ||
480 | CARD32 padl6 B32; | ||
481 | CARD32 padl7 B32; | ||
482 | CARD32 padl8 B32; | ||
483 | } xvGrabPortReply; | ||
484 | #define sz_xvGrabPortReply 32 | ||
485 | |||
486 | typedef struct { | ||
487 | BYTE type; /* X_Reply */ | ||
488 | BYTE padb1; | ||
489 | CARD16 sequenceNumber B16; | ||
490 | CARD32 length B32; /* 0 */ | ||
491 | INT32 value B32; | ||
492 | CARD32 padl4 B32; | ||
493 | CARD32 padl5 B32; | ||
494 | CARD32 padl6 B32; | ||
495 | CARD32 padl7 B32; | ||
496 | CARD32 padl8 B32; | ||
497 | } xvGetPortAttributeReply; | ||
498 | #define sz_xvGetPortAttributeReply 32 | ||
499 | |||
500 | typedef struct { | ||
501 | BYTE type; /* X_Reply */ | ||
502 | BYTE padb1; | ||
503 | CARD16 sequenceNumber B16; | ||
504 | CARD32 length B32; /* 0 */ | ||
505 | CARD16 actual_width B16; | ||
506 | CARD16 actual_height B16; | ||
507 | CARD32 padl4 B32; | ||
508 | CARD32 padl5 B32; | ||
509 | CARD32 padl6 B32; | ||
510 | CARD32 padl7 B32; | ||
511 | CARD32 padl8 B32; | ||
512 | } xvQueryBestSizeReply; | ||
513 | #define sz_xvQueryBestSizeReply 32 | ||
514 | |||
515 | typedef struct { | ||
516 | BYTE type; /* X_Reply */ | ||
517 | BYTE padb1; | ||
518 | CARD16 sequenceNumber B16; | ||
519 | CARD32 length B32; /* 0 */ | ||
520 | CARD32 num_attributes B32; | ||
521 | CARD32 text_size B32; | ||
522 | CARD32 padl5 B32; | ||
523 | CARD32 padl6 B32; | ||
524 | CARD32 padl7 B32; | ||
525 | CARD32 padl8 B32; | ||
526 | } xvQueryPortAttributesReply; | ||
527 | #define sz_xvQueryPortAttributesReply 32 | ||
528 | |||
529 | typedef struct { | ||
530 | BYTE type; /* X_Reply */ | ||
531 | BYTE padb1; | ||
532 | CARD16 sequenceNumber B16; | ||
533 | CARD32 length B32; | ||
534 | CARD32 num_formats B32; | ||
535 | CARD32 padl4 B32; | ||
536 | CARD32 padl5 B32; | ||
537 | CARD32 padl6 B32; | ||
538 | CARD32 padl7 B32; | ||
539 | CARD32 padl8 B32; | ||
540 | } xvListImageFormatsReply; | ||
541 | #define sz_xvListImageFormatsReply 32 | ||
542 | |||
543 | typedef struct { | ||
544 | BYTE type; /* X_Reply */ | ||
545 | BYTE padb1; | ||
546 | CARD16 sequenceNumber B16; | ||
547 | CARD32 length B32; | ||
548 | CARD32 num_planes B32; | ||
549 | CARD32 data_size B32; | ||
550 | CARD16 width B16; | ||
551 | CARD16 height B16; | ||
552 | CARD32 padl6 B32; | ||
553 | CARD32 padl7 B32; | ||
554 | CARD32 padl8 B32; | ||
555 | } xvQueryImageAttributesReply; | ||
556 | #define sz_xvQueryImageAttributesReply 32 | ||
557 | |||
558 | /* DEFINE EVENT STRUCTURE */ | ||
559 | |||
560 | typedef struct { | ||
561 | union { | ||
562 | struct { | ||
563 | BYTE type; | ||
564 | BYTE detail; | ||
565 | CARD16 sequenceNumber B16; | ||
566 | } u; | ||
567 | struct { | ||
568 | BYTE type; | ||
569 | BYTE reason; | ||
570 | CARD16 sequenceNumber B16; | ||
571 | Time time B32; | ||
572 | Drawable drawable B32; | ||
573 | XvPortID port B32; | ||
574 | CARD32 padl5 B32; | ||
575 | CARD32 padl6 B32; | ||
576 | CARD32 padl7 B32; | ||
577 | CARD32 padl8 B32; | ||
578 | } videoNotify; | ||
579 | struct { | ||
580 | BYTE type; | ||
581 | BYTE padb1; | ||
582 | CARD16 sequenceNumber B16; | ||
583 | Time time B32; | ||
584 | XvPortID port B32; | ||
585 | Atom attribute B32; | ||
586 | INT32 value B32; | ||
587 | CARD32 padl6 B32; | ||
588 | CARD32 padl7 B32; | ||
589 | CARD32 padl8 B32; | ||
590 | } portNotify; | ||
591 | } u; | ||
592 | } xvEvent; | ||
593 | |||
594 | #undef XvPortID | ||
595 | #undef XvEncodingID | ||
596 | #undef ShmSeg | ||
597 | #undef VisualID | ||
598 | #undef Drawable | ||
599 | #undef GContext | ||
600 | #undef Time | ||
601 | #undef Atom | ||
602 | |||
603 | #endif /* XVPROTO_H */ | ||
604 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/extutil.h b/apps/plugins/sdl/src/video/Xext/extensions/extutil.h new file mode 100644 index 0000000000..f3a741ea22 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/extutil.h | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | * $Xorg: extutil.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ | ||
3 | * | ||
4 | Copyright 1989, 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: Jim Fulton, MIT The Open Group | ||
27 | * | ||
28 | * Xlib Extension-Writing Utilities | ||
29 | * | ||
30 | * This package contains utilities for writing the client API for various | ||
31 | * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND | ||
32 | * ARE SUBJECT TO CHANGE! | ||
33 | */ | ||
34 | /* $XFree86: xc/include/extensions/extutil.h,v 1.9 2001/12/14 19:53:28 dawes Exp $ */ | ||
35 | |||
36 | #ifndef _EXTUTIL_H_ | ||
37 | #define _EXTUTIL_H_ | ||
38 | |||
39 | #include "SDL_stdinc.h" /* For portable string functions */ | ||
40 | |||
41 | #include "./Xext.h" | ||
42 | |||
43 | /* | ||
44 | * We need to keep a list of open displays since the Xlib display list isn't | ||
45 | * public. We also have to per-display info in a separate block since it isn't | ||
46 | * stored directly in the Display structure. | ||
47 | */ | ||
48 | typedef struct _XExtDisplayInfo { | ||
49 | struct _XExtDisplayInfo *next; /* keep a linked list */ | ||
50 | Display *display; /* which display this is */ | ||
51 | XExtCodes *codes; /* the extension protocol codes */ | ||
52 | XPointer data; /* extra data for extension to use */ | ||
53 | } XExtDisplayInfo; | ||
54 | |||
55 | typedef struct _XExtensionInfo { | ||
56 | XExtDisplayInfo *head; /* start of list */ | ||
57 | XExtDisplayInfo *cur; /* most recently used */ | ||
58 | int ndisplays; /* number of displays */ | ||
59 | } XExtensionInfo; | ||
60 | |||
61 | typedef struct _XExtensionHooks { | ||
62 | int (*create_gc)( | ||
63 | #if NeedNestedPrototypes | ||
64 | Display* /* display */, | ||
65 | GC /* gc */, | ||
66 | XExtCodes* /* codes */ | ||
67 | #endif | ||
68 | ); | ||
69 | int (*copy_gc)( | ||
70 | #if NeedNestedPrototypes | ||
71 | Display* /* display */, | ||
72 | GC /* gc */, | ||
73 | XExtCodes* /* codes */ | ||
74 | #endif | ||
75 | ); | ||
76 | int (*flush_gc)( | ||
77 | #if NeedNestedPrototypes | ||
78 | Display* /* display */, | ||
79 | GC /* gc */, | ||
80 | XExtCodes* /* codes */ | ||
81 | #endif | ||
82 | ); | ||
83 | int (*free_gc)( | ||
84 | #if NeedNestedPrototypes | ||
85 | Display* /* display */, | ||
86 | GC /* gc */, | ||
87 | XExtCodes* /* codes */ | ||
88 | #endif | ||
89 | ); | ||
90 | int (*create_font)( | ||
91 | #if NeedNestedPrototypes | ||
92 | Display* /* display */, | ||
93 | XFontStruct* /* fs */, | ||
94 | XExtCodes* /* codes */ | ||
95 | #endif | ||
96 | ); | ||
97 | int (*free_font)( | ||
98 | #if NeedNestedPrototypes | ||
99 | Display* /* display */, | ||
100 | XFontStruct* /* fs */, | ||
101 | XExtCodes* /* codes */ | ||
102 | #endif | ||
103 | ); | ||
104 | int (*close_display)( | ||
105 | #if NeedNestedPrototypes | ||
106 | Display* /* display */, | ||
107 | XExtCodes* /* codes */ | ||
108 | #endif | ||
109 | ); | ||
110 | Bool (*wire_to_event)( | ||
111 | #if NeedNestedPrototypes | ||
112 | Display* /* display */, | ||
113 | XEvent* /* re */, | ||
114 | xEvent* /* event */ | ||
115 | #endif | ||
116 | ); | ||
117 | Status (*event_to_wire)( | ||
118 | #if NeedNestedPrototypes | ||
119 | Display* /* display */, | ||
120 | XEvent* /* re */, | ||
121 | xEvent* /* event */ | ||
122 | #endif | ||
123 | ); | ||
124 | int (*error)( | ||
125 | #if NeedNestedPrototypes | ||
126 | Display* /* display */, | ||
127 | xError* /* err */, | ||
128 | XExtCodes* /* codes */, | ||
129 | int* /* ret_code */ | ||
130 | #endif | ||
131 | ); | ||
132 | char *(*error_string)( | ||
133 | #if NeedNestedPrototypes | ||
134 | Display* /* display */, | ||
135 | int /* code */, | ||
136 | XExtCodes* /* codes */, | ||
137 | char* /* buffer */, | ||
138 | int /* nbytes */ | ||
139 | #endif | ||
140 | ); | ||
141 | } XExtensionHooks; | ||
142 | |||
143 | extern XExtensionInfo *XextCreateExtension( | ||
144 | #if NeedFunctionPrototypes | ||
145 | void | ||
146 | #endif | ||
147 | ); | ||
148 | extern void XextDestroyExtension( | ||
149 | #if NeedFunctionPrototypes | ||
150 | XExtensionInfo* /* info */ | ||
151 | #endif | ||
152 | ); | ||
153 | extern XExtDisplayInfo *XextAddDisplay( | ||
154 | #if NeedFunctionPrototypes | ||
155 | XExtensionInfo* /* extinfo */, | ||
156 | Display* /* dpy */, | ||
157 | char* /* ext_name */, | ||
158 | XExtensionHooks* /* hooks */, | ||
159 | int /* nevents */, | ||
160 | XPointer /* data */ | ||
161 | #endif | ||
162 | ); | ||
163 | extern int XextRemoveDisplay( | ||
164 | #if NeedFunctionPrototypes | ||
165 | XExtensionInfo* /* extinfo */, | ||
166 | Display* /* dpy */ | ||
167 | #endif | ||
168 | ); | ||
169 | extern XExtDisplayInfo *XextFindDisplay( | ||
170 | #if NeedFunctionPrototypes | ||
171 | XExtensionInfo* /* extinfo */, | ||
172 | Display* /* dpy */ | ||
173 | #endif | ||
174 | ); | ||
175 | |||
176 | #define XextHasExtension(i) ((i) && ((i)->codes)) | ||
177 | #define XextCheckExtension(dpy,i,name,val) \ | ||
178 | if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } | ||
179 | #define XextSimpleCheckExtension(dpy,i,name) \ | ||
180 | if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } | ||
181 | |||
182 | |||
183 | /* | ||
184 | * helper macros to generate code that is common to all extensions; caller | ||
185 | * should prefix it with static if extension source is in one file; this | ||
186 | * could be a utility function, but have to stack 6 unused arguments for | ||
187 | * something that is called many, many times would be bad. | ||
188 | */ | ||
189 | #define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ | ||
190 | XExtDisplayInfo *proc (Display *dpy) \ | ||
191 | { \ | ||
192 | XExtDisplayInfo *dpyinfo; \ | ||
193 | if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ | ||
194 | if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ | ||
195 | dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ | ||
196 | return dpyinfo; \ | ||
197 | } | ||
198 | |||
199 | #define XEXT_FIND_DISPLAY_PROTO(proc) \ | ||
200 | XExtDisplayInfo *proc(Display *dpy) | ||
201 | |||
202 | #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ | ||
203 | int proc (Display *dpy, XExtCodes *codes) \ | ||
204 | { \ | ||
205 | return XextRemoveDisplay (extinfo, dpy); \ | ||
206 | } | ||
207 | |||
208 | #define XEXT_CLOSE_DISPLAY_PROTO(proc) \ | ||
209 | int proc(Display *dpy, XExtCodes *codes) | ||
210 | |||
211 | #define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ | ||
212 | char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ | ||
213 | { \ | ||
214 | code -= codes->first_error; \ | ||
215 | if (code >= 0 && code < nerr) { \ | ||
216 | char tmp[256]; \ | ||
217 | SDL_snprintf (tmp, SDL_arraysize(tmp), "%s.%d", extname, code); \ | ||
218 | XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ | ||
219 | return buf; \ | ||
220 | } \ | ||
221 | return (char *)0; \ | ||
222 | } | ||
223 | |||
224 | #define XEXT_ERROR_STRING_PROTO(proc) \ | ||
225 | char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) | ||
226 | #endif | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/panoramiXext.h b/apps/plugins/sdl/src/video/Xext/extensions/panoramiXext.h new file mode 100644 index 0000000000..e89d8917bb --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/panoramiXext.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* $Xorg: panoramiXext.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ | ||
2 | /***************************************************************** | ||
3 | Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | of this software and associated documentation files (the "Software"), to deal | ||
6 | in the Software without restriction, including without limitation the rights | ||
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | copies of the Software. | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
16 | DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, | ||
17 | BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, | ||
18 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
19 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
20 | |||
21 | Except as contained in this notice, the name of Digital Equipment Corporation | ||
22 | shall not be used in advertising or otherwise to promote the sale, use or other | ||
23 | dealings in this Software without prior written authorization from Digital | ||
24 | Equipment Corporation. | ||
25 | ******************************************************************/ | ||
26 | /* | ||
27 | * PanoramiX definitions | ||
28 | */ | ||
29 | /* $XFree86: xc/include/extensions/panoramiXext.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ | ||
30 | |||
31 | #include "SDL_name.h" | ||
32 | |||
33 | /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ | ||
34 | |||
35 | #define PANORAMIX_MAJOR_VERSION 1 /* current version number */ | ||
36 | #define PANORAMIX_MINOR_VERSION 1 | ||
37 | |||
38 | typedef struct { | ||
39 | Window window; /* PanoramiX window - may not exist */ | ||
40 | int screen; | ||
41 | int State; /* PanroamiXOff, PanoramiXOn */ | ||
42 | int width; /* width of this screen */ | ||
43 | int height; /* height of this screen */ | ||
44 | int ScreenCount; /* real physical number of screens */ | ||
45 | XID eventMask; /* selected events for this client */ | ||
46 | } SDL_NAME(XPanoramiXInfo); | ||
47 | |||
48 | extern SDL_NAME(XPanoramiXInfo) *SDL_NAME(XPanoramiXAllocInfo) ( | ||
49 | #if NeedFunctionPrototypes | ||
50 | void | ||
51 | #endif | ||
52 | ); | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/panoramiXproto.h b/apps/plugins/sdl/src/video/Xext/extensions/panoramiXproto.h new file mode 100644 index 0000000000..fe3826eb3b --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/panoramiXproto.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ | ||
2 | /***************************************************************** | ||
3 | Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | of this software and associated documentation files (the "Software"), to deal | ||
6 | in the Software without restriction, including without limitation the rights | ||
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | copies of the Software. | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
16 | DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, | ||
17 | BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, | ||
18 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
19 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
20 | |||
21 | Except as contained in this notice, the name of Digital Equipment Corporation | ||
22 | shall not be used in advertising or otherwise to promote the sale, use or other | ||
23 | dealings in this Software without prior written authorization from Digital | ||
24 | Equipment Corporation. | ||
25 | ******************************************************************/ | ||
26 | /* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ | ||
27 | |||
28 | /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ | ||
29 | |||
30 | #ifndef _PANORAMIXPROTO_H_ | ||
31 | #define _PANORAMIXPROTO_H_ | ||
32 | |||
33 | #define PANORAMIX_PROTOCOL_NAME "XINERAMA" | ||
34 | |||
35 | #define X_PanoramiXQueryVersion 0 | ||
36 | #define X_PanoramiXGetState 1 | ||
37 | #define X_PanoramiXGetScreenCount 2 | ||
38 | #define X_PanoramiXGetScreenSize 3 | ||
39 | |||
40 | #define X_XineramaIsActive 4 | ||
41 | #define X_XineramaQueryScreens 5 | ||
42 | |||
43 | typedef struct _PanoramiXQueryVersion { | ||
44 | CARD8 reqType; /* always PanoramiXReqCode */ | ||
45 | CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ | ||
46 | CARD16 length B16; | ||
47 | CARD8 clientMajor; | ||
48 | CARD8 clientMinor; | ||
49 | CARD16 unused B16; | ||
50 | } xPanoramiXQueryVersionReq; | ||
51 | |||
52 | #define sz_xPanoramiXQueryVersionReq 8 | ||
53 | |||
54 | typedef struct { | ||
55 | CARD8 type; /* must be X_Reply */ | ||
56 | CARD8 pad1; /* unused */ | ||
57 | CARD16 sequenceNumber B16; /* last sequence number */ | ||
58 | CARD32 length B32; /* 0 */ | ||
59 | CARD16 majorVersion B16; | ||
60 | CARD16 minorVersion B16; | ||
61 | CARD32 pad2 B32; /* unused */ | ||
62 | CARD32 pad3 B32; /* unused */ | ||
63 | CARD32 pad4 B32; /* unused */ | ||
64 | CARD32 pad5 B32; /* unused */ | ||
65 | CARD32 pad6 B32; /* unused */ | ||
66 | } xPanoramiXQueryVersionReply; | ||
67 | |||
68 | #define sz_xPanoramiXQueryVersionReply 32 | ||
69 | |||
70 | |||
71 | typedef struct _PanoramiXGetState { | ||
72 | CARD8 reqType; /* always PanoramiXReqCode */ | ||
73 | CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ | ||
74 | CARD16 length B16; | ||
75 | CARD32 window B32; | ||
76 | } xPanoramiXGetStateReq; | ||
77 | #define sz_xPanoramiXGetStateReq 8 | ||
78 | |||
79 | typedef struct { | ||
80 | BYTE type; | ||
81 | BYTE state; | ||
82 | CARD16 sequenceNumber B16; | ||
83 | CARD32 length B32; | ||
84 | CARD32 window B32; | ||
85 | CARD32 pad1 B32; /* unused */ | ||
86 | CARD32 pad2 B32; /* unused */ | ||
87 | CARD32 pad3 B32; /* unused */ | ||
88 | CARD32 pad4 B32; /* unused */ | ||
89 | CARD32 pad5 B32; /* unused */ | ||
90 | } xPanoramiXGetStateReply; | ||
91 | |||
92 | #define sz_panoramiXGetStateReply 32 | ||
93 | |||
94 | typedef struct _PanoramiXGetScreenCount { | ||
95 | CARD8 reqType; /* always PanoramiXReqCode */ | ||
96 | CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ | ||
97 | CARD16 length B16; | ||
98 | CARD32 window B32; | ||
99 | } xPanoramiXGetScreenCountReq; | ||
100 | #define sz_xPanoramiXGetScreenCountReq 8 | ||
101 | |||
102 | typedef struct { | ||
103 | BYTE type; | ||
104 | BYTE ScreenCount; | ||
105 | CARD16 sequenceNumber B16; | ||
106 | CARD32 length B32; | ||
107 | CARD32 window B32; | ||
108 | CARD32 pad1 B32; /* unused */ | ||
109 | CARD32 pad2 B32; /* unused */ | ||
110 | CARD32 pad3 B32; /* unused */ | ||
111 | CARD32 pad4 B32; /* unused */ | ||
112 | CARD32 pad5 B32; /* unused */ | ||
113 | } xPanoramiXGetScreenCountReply; | ||
114 | #define sz_panoramiXGetScreenCountReply 32 | ||
115 | |||
116 | typedef struct _PanoramiXGetScreenSize { | ||
117 | CARD8 reqType; /* always PanoramiXReqCode */ | ||
118 | CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ | ||
119 | CARD16 length B16; | ||
120 | CARD32 window B32; | ||
121 | CARD32 screen B32; | ||
122 | } xPanoramiXGetScreenSizeReq; | ||
123 | #define sz_xPanoramiXGetScreenSizeReq 12 | ||
124 | |||
125 | typedef struct { | ||
126 | BYTE type; | ||
127 | CARD8 pad1; | ||
128 | CARD16 sequenceNumber B16; | ||
129 | CARD32 length B32; | ||
130 | CARD32 width B32; | ||
131 | CARD32 height B32; | ||
132 | CARD32 window B32; | ||
133 | CARD32 screen B32; | ||
134 | CARD32 pad2 B32; /* unused */ | ||
135 | CARD32 pad3 B32; /* unused */ | ||
136 | } xPanoramiXGetScreenSizeReply; | ||
137 | #define sz_panoramiXGetScreenSizeReply 32 | ||
138 | |||
139 | /************ Alternate protocol ******************/ | ||
140 | |||
141 | typedef struct { | ||
142 | CARD8 reqType; | ||
143 | CARD8 panoramiXReqType; | ||
144 | CARD16 length B16; | ||
145 | } xXineramaIsActiveReq; | ||
146 | #define sz_xXineramaIsActiveReq 4 | ||
147 | |||
148 | typedef struct { | ||
149 | BYTE type; | ||
150 | CARD8 pad1; | ||
151 | CARD16 sequenceNumber B16; | ||
152 | CARD32 length B32; | ||
153 | CARD32 state B32; | ||
154 | CARD32 pad2 B32; | ||
155 | CARD32 pad3 B32; | ||
156 | CARD32 pad4 B32; | ||
157 | CARD32 pad5 B32; | ||
158 | CARD32 pad6 B32; | ||
159 | } xXineramaIsActiveReply; | ||
160 | #define sz_XineramaIsActiveReply 32 | ||
161 | |||
162 | |||
163 | typedef struct { | ||
164 | CARD8 reqType; | ||
165 | CARD8 panoramiXReqType; | ||
166 | CARD16 length B16; | ||
167 | } xXineramaQueryScreensReq; | ||
168 | #define sz_xXineramaQueryScreensReq 4 | ||
169 | |||
170 | typedef struct { | ||
171 | BYTE type; | ||
172 | CARD8 pad1; | ||
173 | CARD16 sequenceNumber B16; | ||
174 | CARD32 length B32; | ||
175 | CARD32 number B32; | ||
176 | CARD32 pad2 B32; | ||
177 | CARD32 pad3 B32; | ||
178 | CARD32 pad4 B32; | ||
179 | CARD32 pad5 B32; | ||
180 | CARD32 pad6 B32; | ||
181 | } xXineramaQueryScreensReply; | ||
182 | #define sz_XineramaQueryScreensReply 32 | ||
183 | |||
184 | typedef struct { | ||
185 | INT16 x_org B16; | ||
186 | INT16 y_org B16; | ||
187 | CARD16 width B16; | ||
188 | CARD16 height B16; | ||
189 | } xXineramaScreenInfo; | ||
190 | #define sz_XineramaScreenInfo 8 | ||
191 | |||
192 | #endif | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86dga.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga.h new file mode 100644 index 0000000000..c71ef4b14a --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga.h | |||
@@ -0,0 +1,265 @@ | |||
1 | /* | ||
2 | Copyright (c) 1999 XFree86 Inc | ||
3 | */ | ||
4 | /* $XFree86: xc/include/extensions/xf86dga.h,v 3.21 2001/08/01 00:44:36 tsi Exp $ */ | ||
5 | |||
6 | #ifndef _XF86DGA_H_ | ||
7 | #define _XF86DGA_H_ | ||
8 | |||
9 | #include <X11/Xfuncproto.h> | ||
10 | #include "xf86dga1.h" | ||
11 | #include "SDL_name.h" | ||
12 | |||
13 | #define X_XDGAQueryVersion 0 | ||
14 | |||
15 | /* 1 through 9 are in xf86dga1.h */ | ||
16 | |||
17 | /* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */ | ||
18 | |||
19 | #define X_XDGAQueryModes 12 | ||
20 | #define X_XDGASetMode 13 | ||
21 | #define X_XDGASetViewport 14 | ||
22 | #define X_XDGAInstallColormap 15 | ||
23 | #define X_XDGASelectInput 16 | ||
24 | #define X_XDGAFillRectangle 17 | ||
25 | #define X_XDGACopyArea 18 | ||
26 | #define X_XDGACopyTransparentArea 19 | ||
27 | #define X_XDGAGetViewportStatus 20 | ||
28 | #define X_XDGASync 21 | ||
29 | #define X_XDGAOpenFramebuffer 22 | ||
30 | #define X_XDGACloseFramebuffer 23 | ||
31 | #define X_XDGASetClientVersion 24 | ||
32 | #define X_XDGAChangePixmapMode 25 | ||
33 | #define X_XDGACreateColormap 26 | ||
34 | |||
35 | |||
36 | #define XDGAConcurrentAccess 0x00000001 | ||
37 | #define XDGASolidFillRect 0x00000002 | ||
38 | #define XDGABlitRect 0x00000004 | ||
39 | #define XDGABlitTransRect 0x00000008 | ||
40 | #define XDGAPixmap 0x00000010 | ||
41 | |||
42 | #define XDGAInterlaced 0x00010000 | ||
43 | #define XDGADoublescan 0x00020000 | ||
44 | |||
45 | #define XDGAFlipImmediate 0x00000001 | ||
46 | #define XDGAFlipRetrace 0x00000002 | ||
47 | |||
48 | #define XDGANeedRoot 0x00000001 | ||
49 | |||
50 | #define XF86DGANumberEvents 7 | ||
51 | |||
52 | #define XDGAPixmapModeLarge 0 | ||
53 | #define XDGAPixmapModeSmall 1 | ||
54 | |||
55 | #define XF86DGAClientNotLocal 0 | ||
56 | #define XF86DGANoDirectVideoMode 1 | ||
57 | #define XF86DGAScreenNotActive 2 | ||
58 | #define XF86DGADirectNotActivated 3 | ||
59 | #define XF86DGAOperationNotSupported 4 | ||
60 | #define XF86DGANumberErrors (XF86DGAOperationNotSupported + 1) | ||
61 | |||
62 | |||
63 | typedef struct { | ||
64 | int num; /* A unique identifier for the mode (num > 0) */ | ||
65 | char *name; /* name of mode given in the XF86Config */ | ||
66 | float verticalRefresh; | ||
67 | int flags; /* DGA_CONCURRENT_ACCESS, etc... */ | ||
68 | int imageWidth; /* linear accessible portion (pixels) */ | ||
69 | int imageHeight; | ||
70 | int pixmapWidth; /* Xlib accessible portion (pixels) */ | ||
71 | int pixmapHeight; /* both fields ignored if no concurrent access */ | ||
72 | int bytesPerScanline; | ||
73 | int byteOrder; /* MSBFirst, LSBFirst */ | ||
74 | int depth; | ||
75 | int bitsPerPixel; | ||
76 | unsigned long redMask; | ||
77 | unsigned long greenMask; | ||
78 | unsigned long blueMask; | ||
79 | short visualClass; | ||
80 | int viewportWidth; | ||
81 | int viewportHeight; | ||
82 | int xViewportStep; /* viewport position granularity */ | ||
83 | int yViewportStep; | ||
84 | int maxViewportX; /* max viewport origin */ | ||
85 | int maxViewportY; | ||
86 | int viewportFlags; /* types of page flipping possible */ | ||
87 | int reserved1; | ||
88 | int reserved2; | ||
89 | } SDL_NAME(XDGAMode); | ||
90 | |||
91 | |||
92 | typedef struct { | ||
93 | SDL_NAME(XDGAMode) mode; | ||
94 | unsigned char *data; | ||
95 | Pixmap pixmap; | ||
96 | } SDL_NAME(XDGADevice); | ||
97 | |||
98 | |||
99 | #ifndef _XF86DGA_SERVER_ | ||
100 | _XFUNCPROTOBEGIN | ||
101 | |||
102 | typedef struct { | ||
103 | int type; | ||
104 | unsigned long serial; | ||
105 | Display *display; | ||
106 | int screen; | ||
107 | Time time; | ||
108 | unsigned int state; | ||
109 | unsigned int button; | ||
110 | } SDL_NAME(XDGAButtonEvent); | ||
111 | |||
112 | typedef struct { | ||
113 | int type; | ||
114 | unsigned long serial; | ||
115 | Display *display; | ||
116 | int screen; | ||
117 | Time time; | ||
118 | unsigned int state; | ||
119 | unsigned int keycode; | ||
120 | } SDL_NAME(XDGAKeyEvent); | ||
121 | |||
122 | typedef struct { | ||
123 | int type; | ||
124 | unsigned long serial; | ||
125 | Display *display; | ||
126 | int screen; | ||
127 | Time time; | ||
128 | unsigned int state; | ||
129 | int dx; | ||
130 | int dy; | ||
131 | } SDL_NAME(XDGAMotionEvent); | ||
132 | |||
133 | typedef union { | ||
134 | int type; | ||
135 | SDL_NAME(XDGAButtonEvent) xbutton; | ||
136 | SDL_NAME(XDGAKeyEvent) xkey; | ||
137 | SDL_NAME(XDGAMotionEvent) xmotion; | ||
138 | long pad[24]; | ||
139 | } SDL_NAME(XDGAEvent); | ||
140 | |||
141 | Bool SDL_NAME(XDGAQueryExtension)( | ||
142 | Display *dpy, | ||
143 | int *eventBase, | ||
144 | int *erroBase | ||
145 | ); | ||
146 | |||
147 | Bool SDL_NAME(XDGAQueryVersion)( | ||
148 | Display *dpy, | ||
149 | int *majorVersion, | ||
150 | int *minorVersion | ||
151 | ); | ||
152 | |||
153 | SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)( | ||
154 | Display *dpy, | ||
155 | int screen, | ||
156 | int *num | ||
157 | ); | ||
158 | |||
159 | SDL_NAME(XDGADevice)* SDL_NAME(XDGASetMode)( | ||
160 | Display *dpy, | ||
161 | int screen, | ||
162 | int mode | ||
163 | ); | ||
164 | |||
165 | Bool SDL_NAME(XDGAOpenFramebuffer)( | ||
166 | Display *dpy, | ||
167 | int screen | ||
168 | ); | ||
169 | |||
170 | void SDL_NAME(XDGACloseFramebuffer)( | ||
171 | Display *dpy, | ||
172 | int screen | ||
173 | ); | ||
174 | |||
175 | void SDL_NAME(XDGASetViewport)( | ||
176 | Display *dpy, | ||
177 | int screen, | ||
178 | int x, | ||
179 | int y, | ||
180 | int flags | ||
181 | ); | ||
182 | |||
183 | void SDL_NAME(XDGAInstallColormap)( | ||
184 | Display *dpy, | ||
185 | int screen, | ||
186 | Colormap cmap | ||
187 | ); | ||
188 | |||
189 | Colormap SDL_NAME(XDGACreateColormap)( | ||
190 | Display *dpy, | ||
191 | int screen, | ||
192 | SDL_NAME(XDGADevice) *device, | ||
193 | int alloc | ||
194 | ); | ||
195 | |||
196 | void SDL_NAME(XDGASelectInput)( | ||
197 | Display *dpy, | ||
198 | int screen, | ||
199 | long event_mask | ||
200 | ); | ||
201 | |||
202 | void SDL_NAME(XDGAFillRectangle)( | ||
203 | Display *dpy, | ||
204 | int screen, | ||
205 | int x, | ||
206 | int y, | ||
207 | unsigned int width, | ||
208 | unsigned int height, | ||
209 | unsigned long color | ||
210 | ); | ||
211 | |||
212 | |||
213 | void SDL_NAME(XDGACopyArea)( | ||
214 | Display *dpy, | ||
215 | int screen, | ||
216 | int srcx, | ||
217 | int srcy, | ||
218 | unsigned int width, | ||
219 | unsigned int height, | ||
220 | int dstx, | ||
221 | int dsty | ||
222 | ); | ||
223 | |||
224 | |||
225 | void SDL_NAME(XDGACopyTransparentArea)( | ||
226 | Display *dpy, | ||
227 | int screen, | ||
228 | int srcx, | ||
229 | int srcy, | ||
230 | unsigned int width, | ||
231 | unsigned int height, | ||
232 | int dstx, | ||
233 | int dsty, | ||
234 | unsigned long key | ||
235 | ); | ||
236 | |||
237 | int SDL_NAME(XDGAGetViewportStatus)( | ||
238 | Display *dpy, | ||
239 | int screen | ||
240 | ); | ||
241 | |||
242 | void SDL_NAME(XDGASync)( | ||
243 | Display *dpy, | ||
244 | int screen | ||
245 | ); | ||
246 | |||
247 | Bool SDL_NAME(XDGASetClientVersion)( | ||
248 | Display *dpy | ||
249 | ); | ||
250 | |||
251 | void SDL_NAME(XDGAChangePixmapMode)( | ||
252 | Display *dpy, | ||
253 | int screen, | ||
254 | int *x, | ||
255 | int *y, | ||
256 | int mode | ||
257 | ); | ||
258 | |||
259 | |||
260 | void SDL_NAME(XDGAKeyEventToXKeyEvent)(SDL_NAME(XDGAKeyEvent)* dk, XKeyEvent* xk); | ||
261 | |||
262 | |||
263 | _XFUNCPROTOEND | ||
264 | #endif /* _XF86DGA_SERVER_ */ | ||
265 | #endif /* _XF86DGA_H_ */ | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1.h new file mode 100644 index 0000000000..4a49e9f385 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 1995 Jon Tombs | ||
5 | Copyright (c) 1995 XFree86 Inc | ||
6 | |||
7 | */ | ||
8 | |||
9 | /************************************************************************ | ||
10 | |||
11 | THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE | ||
12 | |||
13 | ************************************************************************/ | ||
14 | |||
15 | #ifndef _XF86DGA1_H_ | ||
16 | #define _XF86DGA1_H_ | ||
17 | |||
18 | #include <X11/Xfuncproto.h> | ||
19 | #include "SDL_name.h" | ||
20 | |||
21 | #define X_XF86DGAQueryVersion 0 | ||
22 | #define X_XF86DGAGetVideoLL 1 | ||
23 | #define X_XF86DGADirectVideo 2 | ||
24 | #define X_XF86DGAGetViewPortSize 3 | ||
25 | #define X_XF86DGASetViewPort 4 | ||
26 | #define X_XF86DGAGetVidPage 5 | ||
27 | #define X_XF86DGASetVidPage 6 | ||
28 | #define X_XF86DGAInstallColormap 7 | ||
29 | #define X_XF86DGAQueryDirectVideo 8 | ||
30 | #define X_XF86DGAViewPortChanged 9 | ||
31 | |||
32 | #define XF86DGADirectPresent 0x0001 | ||
33 | #define XF86DGADirectGraphics 0x0002 | ||
34 | #define XF86DGADirectMouse 0x0004 | ||
35 | #define XF86DGADirectKeyb 0x0008 | ||
36 | #define XF86DGAHasColormap 0x0100 | ||
37 | #define XF86DGADirectColormap 0x0200 | ||
38 | |||
39 | |||
40 | |||
41 | |||
42 | #ifndef _XF86DGA_SERVER_ | ||
43 | |||
44 | _XFUNCPROTOBEGIN | ||
45 | |||
46 | Bool SDL_NAME(XF86DGAQueryVersion)( | ||
47 | #if NeedFunctionPrototypes | ||
48 | Display* /* dpy */, | ||
49 | int* /* majorVersion */, | ||
50 | int* /* minorVersion */ | ||
51 | #endif | ||
52 | ); | ||
53 | |||
54 | Bool SDL_NAME(XF86DGAQueryExtension)( | ||
55 | #if NeedFunctionPrototypes | ||
56 | Display* /* dpy */, | ||
57 | int* /* event_base */, | ||
58 | int* /* error_base */ | ||
59 | #endif | ||
60 | ); | ||
61 | |||
62 | Status SDL_NAME(XF86DGAGetVideoLL)( | ||
63 | #if NeedFunctionPrototypes | ||
64 | Display* /* dpy */, | ||
65 | int /* screen */, | ||
66 | int * /* base addr */, | ||
67 | int * /* width */, | ||
68 | int * /* bank_size */, | ||
69 | int * /* ram_size */ | ||
70 | #endif | ||
71 | ); | ||
72 | |||
73 | Status SDL_NAME(XF86DGAGetVideo)( | ||
74 | #if NeedFunctionPrototypes | ||
75 | Display* /* dpy */, | ||
76 | int /* screen */, | ||
77 | char ** /* base addr */, | ||
78 | int * /* width */, | ||
79 | int * /* bank_size */, | ||
80 | int * /* ram_size */ | ||
81 | #endif | ||
82 | ); | ||
83 | |||
84 | Status SDL_NAME(XF86DGADirectVideo)( | ||
85 | #if NeedFunctionPrototypes | ||
86 | Display* /* dpy */, | ||
87 | int /* screen */, | ||
88 | int /* enable */ | ||
89 | #endif | ||
90 | ); | ||
91 | |||
92 | Status SDL_NAME(XF86DGADirectVideoLL)( | ||
93 | #if NeedFunctionPrototypes | ||
94 | Display* /* dpy */, | ||
95 | int /* screen */, | ||
96 | int /* enable */ | ||
97 | #endif | ||
98 | ); | ||
99 | |||
100 | Status SDL_NAME(XF86DGAGetViewPortSize)( | ||
101 | #if NeedFunctionPrototypes | ||
102 | Display* /* dpy */, | ||
103 | int /* screen */, | ||
104 | int * /* width */, | ||
105 | int * /* height */ | ||
106 | #endif | ||
107 | ); | ||
108 | |||
109 | Status SDL_NAME(XF86DGASetViewPort)( | ||
110 | #if NeedFunctionPrototypes | ||
111 | Display* /* dpy */, | ||
112 | int /* screen */, | ||
113 | int x /* X */, | ||
114 | int y /* Y */ | ||
115 | #endif | ||
116 | ); | ||
117 | |||
118 | Status SDL_NAME(XF86DGAGetVidPage)( | ||
119 | #if NeedFunctionPrototypes | ||
120 | Display* /* dpy */, | ||
121 | int /* screen */, | ||
122 | int * /* vid page */ | ||
123 | #endif | ||
124 | ); | ||
125 | |||
126 | Status SDL_NAME(XF86DGASetVidPage)( | ||
127 | #if NeedFunctionPrototypes | ||
128 | Display* /* dpy */, | ||
129 | int /* screen */, | ||
130 | int /* vid page */ | ||
131 | #endif | ||
132 | ); | ||
133 | |||
134 | Status SDL_NAME(XF86DGAInstallColormap)( | ||
135 | #if NeedFunctionPrototypes | ||
136 | Display* /* dpy */, | ||
137 | int /* screen */, | ||
138 | Colormap /*Colormap */ | ||
139 | #endif | ||
140 | ); | ||
141 | |||
142 | int SDL_NAME(XF86DGAForkApp)( | ||
143 | #if NeedFunctionPrototypes | ||
144 | int screen | ||
145 | #endif | ||
146 | ); | ||
147 | |||
148 | Status SDL_NAME(XF86DGAQueryDirectVideo)( | ||
149 | #if NeedFunctionPrototypes | ||
150 | Display * /* dpy */, | ||
151 | int /* screen */, | ||
152 | int * /* flags */ | ||
153 | #endif | ||
154 | ); | ||
155 | |||
156 | Bool SDL_NAME(XF86DGAViewPortChanged)( | ||
157 | #if NeedFunctionPrototypes | ||
158 | Display * /* dpy */, | ||
159 | int /* screen */, | ||
160 | int /* n */ | ||
161 | #endif | ||
162 | ); | ||
163 | |||
164 | |||
165 | _XFUNCPROTOEND | ||
166 | |||
167 | #endif /* _XF86DGA_SERVER_ */ | ||
168 | |||
169 | #endif /* _XF86DGA1_H_ */ | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1str.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1str.h new file mode 100644 index 0000000000..5695fbd13b --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86dga1str.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* $XFree86: xc/include/extensions/xf86dga1str.h,v 1.2 1999/05/03 12:15:37 dawes Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 1995 Jon Tombs | ||
5 | Copyright (c) 1995 XFree86 Inc. | ||
6 | |||
7 | */ | ||
8 | |||
9 | #ifndef _XF86DGASTR1_H_ | ||
10 | #define _XF86DGASTR1_H_ | ||
11 | |||
12 | typedef struct _XF86DGAQueryVersion { | ||
13 | CARD8 reqType; /* always DGAReqCode */ | ||
14 | CARD8 dgaReqType; /* always X_DGAQueryVersion */ | ||
15 | CARD16 length B16; | ||
16 | } xXF86DGAQueryVersionReq; | ||
17 | #define sz_xXF86DGAQueryVersionReq 4 | ||
18 | |||
19 | typedef struct { | ||
20 | BYTE type; /* X_Reply */ | ||
21 | BOOL pad1; | ||
22 | CARD16 sequenceNumber B16; | ||
23 | CARD32 length B32; | ||
24 | CARD16 majorVersion B16; /* major version of DGA protocol */ | ||
25 | CARD16 minorVersion B16; /* minor version of DGA protocol */ | ||
26 | CARD32 pad2 B32; | ||
27 | CARD32 pad3 B32; | ||
28 | CARD32 pad4 B32; | ||
29 | CARD32 pad5 B32; | ||
30 | CARD32 pad6 B32; | ||
31 | } xXF86DGAQueryVersionReply; | ||
32 | #define sz_xXF86DGAQueryVersionReply 32 | ||
33 | |||
34 | typedef struct _XF86DGAGetVideoLL { | ||
35 | CARD8 reqType; /* always DGAReqCode */ | ||
36 | CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */ | ||
37 | CARD16 length B16; | ||
38 | CARD16 screen B16; | ||
39 | CARD16 pad B16; | ||
40 | } xXF86DGAGetVideoLLReq; | ||
41 | #define sz_xXF86DGAGetVideoLLReq 8 | ||
42 | |||
43 | typedef struct _XF86DGAInstallColormap{ | ||
44 | CARD8 reqType; | ||
45 | CARD8 dgaReqType; | ||
46 | CARD16 length B16; | ||
47 | CARD16 screen B16; | ||
48 | CARD16 pad2; | ||
49 | CARD32 id B32; /* colormap. */ | ||
50 | } xXF86DGAInstallColormapReq; | ||
51 | #define sz_xXF86DGAInstallColormapReq 12 | ||
52 | |||
53 | |||
54 | typedef struct { | ||
55 | BYTE type; | ||
56 | BOOL pad1; | ||
57 | CARD16 sequenceNumber B16; | ||
58 | CARD32 length B32; | ||
59 | CARD32 offset B32; | ||
60 | CARD32 width B32; | ||
61 | CARD32 bank_size B32; | ||
62 | CARD32 ram_size B32; | ||
63 | CARD32 pad4 B32; | ||
64 | CARD32 pad5 B32; | ||
65 | } xXF86DGAGetVideoLLReply; | ||
66 | #define sz_xXF86DGAGetVideoLLReply 32 | ||
67 | |||
68 | typedef struct _XF86DGADirectVideo { | ||
69 | CARD8 reqType; /* always DGAReqCode */ | ||
70 | CARD8 dgaReqType; /* always X_XF86DGADirectVideo */ | ||
71 | CARD16 length B16; | ||
72 | CARD16 screen B16; | ||
73 | CARD16 enable B16; | ||
74 | } xXF86DGADirectVideoReq; | ||
75 | #define sz_xXF86DGADirectVideoReq 8 | ||
76 | |||
77 | |||
78 | typedef struct _XF86DGAGetViewPortSize { | ||
79 | CARD8 reqType; /* always DGAReqCode */ | ||
80 | CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */ | ||
81 | CARD16 length B16; | ||
82 | CARD16 screen B16; | ||
83 | CARD16 pad B16; | ||
84 | } xXF86DGAGetViewPortSizeReq; | ||
85 | #define sz_xXF86DGAGetViewPortSizeReq 8 | ||
86 | |||
87 | typedef struct { | ||
88 | BYTE type; | ||
89 | BOOL pad1; | ||
90 | CARD16 sequenceNumber B16; | ||
91 | CARD32 length B32; | ||
92 | CARD32 width B32; | ||
93 | CARD32 height B32; | ||
94 | CARD32 pad2 B32; | ||
95 | CARD32 pad3 B32; | ||
96 | CARD32 pad4 B32; | ||
97 | CARD32 pad5 B32; | ||
98 | } xXF86DGAGetViewPortSizeReply; | ||
99 | #define sz_xXF86DGAGetViewPortSizeReply 32 | ||
100 | |||
101 | typedef struct _XF86DGASetViewPort { | ||
102 | CARD8 reqType; /* always DGAReqCode */ | ||
103 | CARD8 dgaReqType; /* always X_XF86DGASetViewPort */ | ||
104 | CARD16 length B16; | ||
105 | CARD16 screen B16; | ||
106 | CARD16 pad B16; | ||
107 | CARD32 x B32; | ||
108 | CARD32 y B32; | ||
109 | } xXF86DGASetViewPortReq; | ||
110 | #define sz_xXF86DGASetViewPortReq 16 | ||
111 | |||
112 | typedef struct _XF86DGAGetVidPage { | ||
113 | CARD8 reqType; /* always DGAReqCode */ | ||
114 | CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */ | ||
115 | CARD16 length B16; | ||
116 | CARD16 screen B16; | ||
117 | CARD16 pad B16; | ||
118 | } xXF86DGAGetVidPageReq; | ||
119 | #define sz_xXF86DGAGetVidPageReq 8 | ||
120 | |||
121 | typedef struct { | ||
122 | BYTE type; | ||
123 | BOOL pad1; | ||
124 | CARD16 sequenceNumber B16; | ||
125 | CARD32 length B32; | ||
126 | CARD32 vpage B32; | ||
127 | CARD32 pad B32; | ||
128 | CARD32 pad2 B32; | ||
129 | CARD32 pad3 B32; | ||
130 | CARD32 pad4 B32; | ||
131 | CARD32 pad5 B32; | ||
132 | } xXF86DGAGetVidPageReply; | ||
133 | #define sz_xXF86DGAGetVidPageReply 32 | ||
134 | |||
135 | |||
136 | typedef struct _XF86DGASetVidPage { | ||
137 | CARD8 reqType; /* always DGAReqCode */ | ||
138 | CARD8 dgaReqType; /* always X_XF86DGASetVidPage */ | ||
139 | CARD16 length B16; | ||
140 | CARD16 screen B16; | ||
141 | CARD16 vpage B16; | ||
142 | } xXF86DGASetVidPageReq; | ||
143 | #define sz_xXF86DGASetVidPageReq 8 | ||
144 | |||
145 | |||
146 | typedef struct _XF86DGAQueryDirectVideo { | ||
147 | CARD8 reqType; /* always DGAReqCode */ | ||
148 | CARD8 dgaReqType; /* always X_DGAQueryVersion */ | ||
149 | CARD16 length B16; | ||
150 | CARD16 screen B16; | ||
151 | CARD16 pad B16; | ||
152 | } xXF86DGAQueryDirectVideoReq; | ||
153 | #define sz_xXF86DGAQueryDirectVideoReq 8 | ||
154 | |||
155 | typedef struct { | ||
156 | BYTE type; | ||
157 | BOOL pad1; | ||
158 | CARD16 sequenceNumber B16; | ||
159 | CARD32 length B32; | ||
160 | CARD32 flags B32; | ||
161 | CARD32 pad B32; | ||
162 | CARD32 pad2 B32; | ||
163 | CARD32 pad3 B32; | ||
164 | CARD32 pad4 B32; | ||
165 | CARD32 pad5 B32; | ||
166 | } xXF86DGAQueryDirectVideoReply; | ||
167 | #define sz_xXF86DGAQueryDirectVideoReply 32 | ||
168 | |||
169 | |||
170 | typedef struct _XF86DGAViewPortChanged { | ||
171 | CARD8 reqType; /* always DGAReqCode */ | ||
172 | CARD8 dgaReqType; /* always X_DGAQueryVersion */ | ||
173 | CARD16 length B16; | ||
174 | CARD16 screen B16; | ||
175 | CARD16 n B16; | ||
176 | } xXF86DGAViewPortChangedReq; | ||
177 | #define sz_xXF86DGAViewPortChangedReq 8 | ||
178 | |||
179 | typedef struct { | ||
180 | BYTE type; | ||
181 | BOOL pad1; | ||
182 | CARD16 sequenceNumber B16; | ||
183 | CARD32 length B32; | ||
184 | CARD32 result B32; | ||
185 | CARD32 pad B32; | ||
186 | CARD32 pad2 B32; | ||
187 | CARD32 pad3 B32; | ||
188 | CARD32 pad4 B32; | ||
189 | CARD32 pad5 B32; | ||
190 | } xXF86DGAViewPortChangedReply; | ||
191 | #define sz_xXF86DGAViewPortChangedReply 32 | ||
192 | |||
193 | #endif /* _XF86DGASTR1_H_ */ | ||
194 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86dgastr.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86dgastr.h new file mode 100644 index 0000000000..b249feb3c6 --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86dgastr.h | |||
@@ -0,0 +1,344 @@ | |||
1 | /* $XFree86: xc/include/extensions/xf86dgastr.h,v 3.14 2001/08/01 00:44:36 tsi Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 1995 Jon Tombs | ||
5 | Copyright (c) 1995 XFree86 Inc. | ||
6 | |||
7 | */ | ||
8 | |||
9 | #ifndef _XF86DGASTR_H_ | ||
10 | #define _XF86DGASTR_H_ | ||
11 | |||
12 | #include "xf86dga1str.h" | ||
13 | |||
14 | #define XF86DGANAME "XFree86-DGA" | ||
15 | |||
16 | #define XDGA_MAJOR_VERSION 2 /* current version numbers */ | ||
17 | #define XDGA_MINOR_VERSION 0 | ||
18 | |||
19 | |||
20 | typedef struct _XDGAQueryVersion { | ||
21 | CARD8 reqType; /* always DGAReqCode */ | ||
22 | CARD8 dgaReqType; /* always X_DGAQueryVersion */ | ||
23 | CARD16 length B16; | ||
24 | } xXDGAQueryVersionReq; | ||
25 | #define sz_xXDGAQueryVersionReq 4 | ||
26 | |||
27 | typedef struct { | ||
28 | BYTE type; /* X_Reply */ | ||
29 | BOOL pad1; | ||
30 | CARD16 sequenceNumber B16; | ||
31 | CARD32 length B32; | ||
32 | CARD16 majorVersion B16; /* major version of DGA protocol */ | ||
33 | CARD16 minorVersion B16; /* minor version of DGA protocol */ | ||
34 | CARD32 pad2 B32; | ||
35 | CARD32 pad3 B32; | ||
36 | CARD32 pad4 B32; | ||
37 | CARD32 pad5 B32; | ||
38 | CARD32 pad6 B32; | ||
39 | } xXDGAQueryVersionReply; | ||
40 | #define sz_xXDGAQueryVersionReply 32 | ||
41 | |||
42 | typedef struct _XDGAQueryModes { | ||
43 | CARD8 reqType; | ||
44 | CARD8 dgaReqType; | ||
45 | CARD16 length B16; | ||
46 | CARD32 screen B32; | ||
47 | } xXDGAQueryModesReq; | ||
48 | #define sz_xXDGAQueryModesReq 8 | ||
49 | |||
50 | typedef struct { | ||
51 | BYTE type; /* X_Reply */ | ||
52 | BOOL pad1; | ||
53 | CARD16 sequenceNumber B16; | ||
54 | CARD32 length B32; | ||
55 | CARD32 number B32; /* number of modes available */ | ||
56 | CARD32 pad2 B32; | ||
57 | CARD32 pad3 B32; | ||
58 | CARD32 pad4 B32; | ||
59 | CARD32 pad5 B32; | ||
60 | CARD32 pad6 B32; | ||
61 | } xXDGAQueryModesReply; | ||
62 | #define sz_xXDGAQueryModesReply 32 | ||
63 | |||
64 | |||
65 | typedef struct _XDGASetMode { | ||
66 | CARD8 reqType; | ||
67 | CARD8 dgaReqType; | ||
68 | CARD16 length B16; | ||
69 | CARD32 screen B32; | ||
70 | CARD32 mode B32; /* mode number to init */ | ||
71 | CARD32 pid B32; /* Pixmap descriptor */ | ||
72 | } xXDGASetModeReq; | ||
73 | #define sz_xXDGASetModeReq 16 | ||
74 | |||
75 | typedef struct { | ||
76 | BYTE type; /* X_Reply */ | ||
77 | BOOL pad1; | ||
78 | CARD16 sequenceNumber B16; | ||
79 | CARD32 length B32; | ||
80 | CARD32 offset B32; /* offset into framebuffer map */ | ||
81 | CARD32 flags B32; | ||
82 | CARD32 pad2 B32; | ||
83 | CARD32 pad3 B32; | ||
84 | CARD32 pad4 B32; | ||
85 | CARD32 pad5 B32; | ||
86 | } xXDGASetModeReply; | ||
87 | #define sz_xXDGASetModeReply 32 | ||
88 | |||
89 | typedef struct { | ||
90 | CARD8 byte_order; | ||
91 | CARD8 depth; | ||
92 | CARD16 num B16; | ||
93 | CARD16 bpp B16; | ||
94 | CARD16 name_size B16; | ||
95 | CARD32 vsync_num B32; | ||
96 | CARD32 vsync_den B32; | ||
97 | CARD32 flags B32; | ||
98 | CARD16 image_width B16; | ||
99 | CARD16 image_height B16; | ||
100 | CARD16 pixmap_width B16; | ||
101 | CARD16 pixmap_height B16; | ||
102 | CARD32 bytes_per_scanline B32; | ||
103 | CARD32 red_mask B32; | ||
104 | CARD32 green_mask B32; | ||
105 | CARD32 blue_mask B32; | ||
106 | CARD16 visual_class B16; | ||
107 | CARD16 pad1 B16; | ||
108 | CARD16 viewport_width B16; | ||
109 | CARD16 viewport_height B16; | ||
110 | CARD16 viewport_xstep B16; | ||
111 | CARD16 viewport_ystep B16; | ||
112 | CARD16 viewport_xmax B16; | ||
113 | CARD16 viewport_ymax B16; | ||
114 | CARD32 viewport_flags B32; | ||
115 | CARD32 reserved1 B32; | ||
116 | CARD32 reserved2 B32; | ||
117 | } xXDGAModeInfo; | ||
118 | #define sz_xXDGAModeInfo 72 | ||
119 | |||
120 | typedef struct _XDGAOpenFramebuffer { | ||
121 | CARD8 reqType; | ||
122 | CARD8 dgaReqType; | ||
123 | CARD16 length B16; | ||
124 | CARD32 screen B32; | ||
125 | } xXDGAOpenFramebufferReq; | ||
126 | #define sz_xXDGAOpenFramebufferReq 8 | ||
127 | |||
128 | typedef struct { | ||
129 | BYTE type; /* X_Reply */ | ||
130 | BOOL pad1; | ||
131 | CARD16 sequenceNumber B16; | ||
132 | CARD32 length B32; /* device name size if there is one */ | ||
133 | CARD32 mem1 B32; /* physical memory */ | ||
134 | CARD32 mem2 B32; /* spillover for _alpha_ */ | ||
135 | CARD32 size B32; /* size of map in bytes */ | ||
136 | CARD32 offset B32; /* optional offset into device */ | ||
137 | CARD32 extra B32; /* extra info associated with the map */ | ||
138 | CARD32 pad2 B32; | ||
139 | } xXDGAOpenFramebufferReply; | ||
140 | #define sz_xXDGAOpenFramebufferReply 32 | ||
141 | |||
142 | |||
143 | typedef struct _XDGACloseFramebuffer { | ||
144 | CARD8 reqType; | ||
145 | CARD8 dgaReqType; | ||
146 | CARD16 length B16; | ||
147 | CARD32 screen B32; | ||
148 | } xXDGACloseFramebufferReq; | ||
149 | #define sz_xXDGACloseFramebufferReq 8 | ||
150 | |||
151 | |||
152 | typedef struct _XDGASetViewport { | ||
153 | CARD8 reqType; | ||
154 | CARD8 dgaReqType; | ||
155 | CARD16 length B16; | ||
156 | CARD32 screen B32; | ||
157 | CARD16 x B16; | ||
158 | CARD16 y B16; | ||
159 | CARD32 flags B32; | ||
160 | } xXDGASetViewportReq; | ||
161 | #define sz_xXDGASetViewportReq 16 | ||
162 | |||
163 | |||
164 | typedef struct _XDGAInstallColormap { | ||
165 | CARD8 reqType; | ||
166 | CARD8 dgaReqType; | ||
167 | CARD16 length B16; | ||
168 | CARD32 screen B32; | ||
169 | CARD32 cmap B32; | ||
170 | } xXDGAInstallColormapReq; | ||
171 | #define sz_xXDGAInstallColormapReq 12 | ||
172 | |||
173 | typedef struct _XDGASelectInput { | ||
174 | CARD8 reqType; | ||
175 | CARD8 dgaReqType; | ||
176 | CARD16 length B16; | ||
177 | CARD32 screen B32; | ||
178 | CARD32 mask B32; | ||
179 | } xXDGASelectInputReq; | ||
180 | #define sz_xXDGASelectInputReq 12 | ||
181 | |||
182 | typedef struct _XDGAFillRectangle { | ||
183 | CARD8 reqType; | ||
184 | CARD8 dgaReqType; | ||
185 | CARD16 length B16; | ||
186 | CARD32 screen B32; | ||
187 | CARD16 x B16; | ||
188 | CARD16 y B16; | ||
189 | CARD16 width B16; | ||
190 | CARD16 height B16; | ||
191 | CARD32 color B32; | ||
192 | } xXDGAFillRectangleReq; | ||
193 | #define sz_xXDGAFillRectangleReq 20 | ||
194 | |||
195 | |||
196 | typedef struct _XDGACopyArea { | ||
197 | CARD8 reqType; | ||
198 | CARD8 dgaReqType; | ||
199 | CARD16 length B16; | ||
200 | CARD32 screen B32; | ||
201 | CARD16 srcx B16; | ||
202 | CARD16 srcy B16; | ||
203 | CARD16 width B16; | ||
204 | CARD16 height B16; | ||
205 | CARD16 dstx B16; | ||
206 | CARD16 dsty B16; | ||
207 | } xXDGACopyAreaReq; | ||
208 | #define sz_xXDGACopyAreaReq 20 | ||
209 | |||
210 | typedef struct _XDGACopyTransparentArea { | ||
211 | CARD8 reqType; | ||
212 | CARD8 dgaReqType; | ||
213 | CARD16 length B16; | ||
214 | CARD32 screen B32; | ||
215 | CARD16 srcx B16; | ||
216 | CARD16 srcy B16; | ||
217 | CARD16 width B16; | ||
218 | CARD16 height B16; | ||
219 | CARD16 dstx B16; | ||
220 | CARD16 dsty B16; | ||
221 | CARD32 key B32; | ||
222 | } xXDGACopyTransparentAreaReq; | ||
223 | #define sz_xXDGACopyTransparentAreaReq 24 | ||
224 | |||
225 | |||
226 | typedef struct _XDGAGetViewportStatus { | ||
227 | CARD8 reqType; | ||
228 | CARD8 dgaReqType; | ||
229 | CARD16 length B16; | ||
230 | CARD32 screen B32; | ||
231 | } xXDGAGetViewportStatusReq; | ||
232 | #define sz_xXDGAGetViewportStatusReq 8 | ||
233 | |||
234 | typedef struct { | ||
235 | BYTE type; | ||
236 | BOOL pad1; | ||
237 | CARD16 sequenceNumber B16; | ||
238 | CARD32 length B32; | ||
239 | CARD32 status B32; | ||
240 | CARD32 pad2 B32; | ||
241 | CARD32 pad3 B32; | ||
242 | CARD32 pad4 B32; | ||
243 | CARD32 pad5 B32; | ||
244 | CARD32 pad6 B32; | ||
245 | } xXDGAGetViewportStatusReply; | ||
246 | #define sz_xXDGAGetViewportStatusReply 32 | ||
247 | |||
248 | typedef struct _XDGASync { | ||
249 | CARD8 reqType; | ||
250 | CARD8 dgaReqType; | ||
251 | CARD16 length B16; | ||
252 | CARD32 screen B32; | ||
253 | } xXDGASyncReq; | ||
254 | #define sz_xXDGASyncReq 8 | ||
255 | |||
256 | typedef struct { | ||
257 | BYTE type; | ||
258 | BOOL pad1; | ||
259 | CARD16 sequenceNumber B16; | ||
260 | CARD32 length B32; | ||
261 | CARD32 pad2 B32; | ||
262 | CARD32 pad3 B32; | ||
263 | CARD32 pad4 B32; | ||
264 | CARD32 pad5 B32; | ||
265 | CARD32 pad6 B32; | ||
266 | CARD32 pad7 B32; | ||
267 | } xXDGASyncReply; | ||
268 | #define sz_xXDGASyncReply 32 | ||
269 | |||
270 | typedef struct _XDGASetClientVersion { | ||
271 | CARD8 reqType; | ||
272 | CARD8 dgaReqType; | ||
273 | CARD16 length B16; | ||
274 | CARD16 major B16; | ||
275 | CARD16 minor B16; | ||
276 | } xXDGASetClientVersionReq; | ||
277 | #define sz_xXDGASetClientVersionReq 8 | ||
278 | |||
279 | |||
280 | typedef struct { | ||
281 | CARD8 reqType; | ||
282 | CARD8 dgaReqType; | ||
283 | CARD16 length B16; | ||
284 | CARD32 screen B32; | ||
285 | CARD16 x B16; | ||
286 | CARD16 y B16; | ||
287 | CARD32 flags B32; | ||
288 | } xXDGAChangePixmapModeReq; | ||
289 | #define sz_xXDGAChangePixmapModeReq 16 | ||
290 | |||
291 | typedef struct { | ||
292 | BYTE type; | ||
293 | BOOL pad1; | ||
294 | CARD16 sequenceNumber B16; | ||
295 | CARD32 length B32; | ||
296 | CARD16 x B16; | ||
297 | CARD16 y B16; | ||
298 | CARD32 pad3 B32; | ||
299 | CARD32 pad4 B32; | ||
300 | CARD32 pad5 B32; | ||
301 | CARD32 pad6 B32; | ||
302 | CARD32 pad7 B32; | ||
303 | } xXDGAChangePixmapModeReply; | ||
304 | #define sz_xXDGAChangePixmapModeReply 32 | ||
305 | |||
306 | typedef struct _XDGACreateColormap { | ||
307 | CARD8 reqType; | ||
308 | CARD8 dgaReqType; | ||
309 | CARD16 length B16; | ||
310 | CARD32 screen B32; | ||
311 | CARD32 id B32; | ||
312 | CARD32 mode B32; | ||
313 | CARD8 alloc; | ||
314 | CARD8 pad1; | ||
315 | CARD16 pad2; | ||
316 | } xXDGACreateColormapReq; | ||
317 | #define sz_xXDGACreateColormapReq 20 | ||
318 | |||
319 | |||
320 | typedef struct { | ||
321 | union { | ||
322 | struct { | ||
323 | BYTE type; | ||
324 | BYTE detail; | ||
325 | CARD16 sequenceNumber B16; | ||
326 | } u; | ||
327 | struct { | ||
328 | CARD32 pad0 B32; | ||
329 | CARD32 time B32; | ||
330 | INT16 dx B16; | ||
331 | INT16 dy B16; | ||
332 | INT16 screen B16; | ||
333 | CARD16 state B16; | ||
334 | CARD32 pad1 B32; | ||
335 | CARD32 pad2 B32; | ||
336 | CARD32 pad3 B32; | ||
337 | CARD32 pad4 B32; | ||
338 | } event; | ||
339 | } u; | ||
340 | } dgaEvent; | ||
341 | |||
342 | |||
343 | #endif /* _XF86DGASTR_H_ */ | ||
344 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86vmode.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86vmode.h new file mode 100644 index 0000000000..eb56c0e8da --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86vmode.h | |||
@@ -0,0 +1,314 @@ | |||
1 | /* $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright 1995 Kaleb S. KEITHLEY | ||
5 | |||
6 | Permission is hereby granted, free of charge, to any person obtaining | ||
7 | a copy of this software and associated documentation files (the | ||
8 | "Software"), to deal in the Software without restriction, including | ||
9 | without limitation the rights to use, copy, modify, merge, publish, | ||
10 | distribute, sublicense, and/or sell copies of the Software, and to | ||
11 | permit persons to whom the Software is furnished to do so, subject to | ||
12 | the following conditions: | ||
13 | |||
14 | The above copyright notice and this permission notice shall be | ||
15 | included in all copies or substantial portions of the Software. | ||
16 | |||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
20 | IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES | ||
21 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
23 | OTHER DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | Except as contained in this notice, the name of Kaleb S. KEITHLEY | ||
26 | shall not be used in advertising or otherwise to promote the sale, use | ||
27 | or other dealings in this Software without prior written authorization | ||
28 | from Kaleb S. KEITHLEY | ||
29 | |||
30 | */ | ||
31 | /* $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */ | ||
32 | |||
33 | /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ | ||
34 | |||
35 | #ifndef _XF86VIDMODE_H_ | ||
36 | #define _XF86VIDMODE_H_ | ||
37 | |||
38 | #include <X11/Xfuncproto.h> | ||
39 | #include <X11/Xmd.h> | ||
40 | #include "SDL_name.h" | ||
41 | |||
42 | #define X_XF86VidModeQueryVersion 0 | ||
43 | #define X_XF86VidModeGetModeLine 1 | ||
44 | #define X_XF86VidModeModModeLine 2 | ||
45 | #define X_XF86VidModeSwitchMode 3 | ||
46 | #define X_XF86VidModeGetMonitor 4 | ||
47 | #define X_XF86VidModeLockModeSwitch 5 | ||
48 | #define X_XF86VidModeGetAllModeLines 6 | ||
49 | #define X_XF86VidModeAddModeLine 7 | ||
50 | #define X_XF86VidModeDeleteModeLine 8 | ||
51 | #define X_XF86VidModeValidateModeLine 9 | ||
52 | #define X_XF86VidModeSwitchToMode 10 | ||
53 | #define X_XF86VidModeGetViewPort 11 | ||
54 | #define X_XF86VidModeSetViewPort 12 | ||
55 | /* new for version 2.x of this extension */ | ||
56 | #define X_XF86VidModeGetDotClocks 13 | ||
57 | #define X_XF86VidModeSetClientVersion 14 | ||
58 | #define X_XF86VidModeSetGamma 15 | ||
59 | #define X_XF86VidModeGetGamma 16 | ||
60 | #define X_XF86VidModeGetGammaRamp 17 | ||
61 | #define X_XF86VidModeSetGammaRamp 18 | ||
62 | #define X_XF86VidModeGetGammaRampSize 19 | ||
63 | |||
64 | #define CLKFLAG_PROGRAMABLE 1 | ||
65 | |||
66 | #ifdef XF86VIDMODE_EVENTS | ||
67 | #define XF86VidModeNotify 0 | ||
68 | #define XF86VidModeNumberEvents (XF86VidModeNotify + 1) | ||
69 | |||
70 | #define XF86VidModeNotifyMask 0x00000001 | ||
71 | |||
72 | #define XF86VidModeNonEvent 0 | ||
73 | #define XF86VidModeModeChange 1 | ||
74 | #else | ||
75 | #define XF86VidModeNumberEvents 0 | ||
76 | #endif | ||
77 | |||
78 | #define XF86VidModeBadClock 0 | ||
79 | #define XF86VidModeBadHTimings 1 | ||
80 | #define XF86VidModeBadVTimings 2 | ||
81 | #define XF86VidModeModeUnsuitable 3 | ||
82 | #define XF86VidModeExtensionDisabled 4 | ||
83 | #define XF86VidModeClientNotLocal 5 | ||
84 | #define XF86VidModeZoomLocked 6 | ||
85 | #define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1) | ||
86 | |||
87 | #ifndef _XF86VIDMODE_SERVER_ | ||
88 | |||
89 | typedef struct { | ||
90 | unsigned short hdisplay; | ||
91 | unsigned short hsyncstart; | ||
92 | unsigned short hsyncend; | ||
93 | unsigned short htotal; | ||
94 | unsigned short hskew; | ||
95 | unsigned short vdisplay; | ||
96 | unsigned short vsyncstart; | ||
97 | unsigned short vsyncend; | ||
98 | unsigned short vtotal; | ||
99 | unsigned int flags; | ||
100 | int privsize; | ||
101 | #if defined(__cplusplus) || defined(c_plusplus) | ||
102 | /* private is a C++ reserved word */ | ||
103 | INT32 *c_private; | ||
104 | #else | ||
105 | INT32 *private; | ||
106 | #endif | ||
107 | } SDL_NAME(XF86VidModeModeLine); | ||
108 | |||
109 | typedef struct { | ||
110 | unsigned int dotclock; | ||
111 | unsigned short hdisplay; | ||
112 | unsigned short hsyncstart; | ||
113 | unsigned short hsyncend; | ||
114 | unsigned short htotal; | ||
115 | unsigned short hskew; | ||
116 | unsigned short vdisplay; | ||
117 | unsigned short vsyncstart; | ||
118 | unsigned short vsyncend; | ||
119 | unsigned short vtotal; | ||
120 | unsigned int flags; | ||
121 | int privsize; | ||
122 | #if defined(__cplusplus) || defined(c_plusplus) | ||
123 | /* private is a C++ reserved word */ | ||
124 | INT32 *c_private; | ||
125 | #else | ||
126 | INT32 *private; | ||
127 | #endif | ||
128 | } SDL_NAME(XF86VidModeModeInfo); | ||
129 | |||
130 | typedef struct { | ||
131 | float hi; | ||
132 | float lo; | ||
133 | } SDL_NAME(XF86VidModeSyncRange); | ||
134 | |||
135 | typedef struct { | ||
136 | char* vendor; | ||
137 | char* model; | ||
138 | float EMPTY; | ||
139 | unsigned char nhsync; | ||
140 | SDL_NAME(XF86VidModeSyncRange)* hsync; | ||
141 | unsigned char nvsync; | ||
142 | SDL_NAME(XF86VidModeSyncRange)* vsync; | ||
143 | } SDL_NAME(XF86VidModeMonitor); | ||
144 | |||
145 | typedef struct { | ||
146 | int type; /* of event */ | ||
147 | unsigned long serial; /* # of last request processed by server */ | ||
148 | Bool send_event; /* true if this came from a SendEvent req */ | ||
149 | Display *display; /* Display the event was read from */ | ||
150 | Window root; /* root window of event screen */ | ||
151 | int state; /* What happened */ | ||
152 | int kind; /* What happened */ | ||
153 | Bool forced; /* extents of new region */ | ||
154 | Time time; /* event timestamp */ | ||
155 | } SDL_NAME(XF86VidModeNotifyEvent); | ||
156 | |||
157 | typedef struct { | ||
158 | float red; /* Red Gamma value */ | ||
159 | float green; /* Green Gamma value */ | ||
160 | float blue; /* Blue Gamma value */ | ||
161 | } SDL_NAME(XF86VidModeGamma); | ||
162 | |||
163 | |||
164 | #define SDL_XF86VidModeSelectNextMode(disp, scr) \ | ||
165 | SDL_NAME(XF86VidModeSwitchMode)(disp, scr, 1) | ||
166 | #define SDL_XF86VidModeSelectPrevMode(disp, scr) \ | ||
167 | SDL_NAME(XF86VidModeSwitchMode)(disp, scr, -1) | ||
168 | |||
169 | _XFUNCPROTOBEGIN | ||
170 | |||
171 | Bool SDL_NAME(XF86VidModeQueryVersion)( | ||
172 | Display* /* dpy */, | ||
173 | int* /* majorVersion */, | ||
174 | int* /* minorVersion */ | ||
175 | ); | ||
176 | |||
177 | Bool SDL_NAME(XF86VidModeQueryExtension)( | ||
178 | Display* /* dpy */, | ||
179 | int* /* event_base */, | ||
180 | int* /* error_base */ | ||
181 | ); | ||
182 | |||
183 | Bool SDL_NAME(XF86VidModeSetClientVersion)( | ||
184 | Display* /* dpy */ | ||
185 | ); | ||
186 | |||
187 | Bool SDL_NAME(XF86VidModeGetModeLine)( | ||
188 | Display* /* dpy */, | ||
189 | int /* screen */, | ||
190 | int* /* dotclock */, | ||
191 | SDL_NAME(XF86VidModeModeLine)* /* modeline */ | ||
192 | ); | ||
193 | |||
194 | Bool SDL_NAME(XF86VidModeGetAllModeLines)( | ||
195 | Display* /* dpy */, | ||
196 | int /* screen */, | ||
197 | int* /* modecount */, | ||
198 | SDL_NAME(XF86VidModeModeInfo)*** /* modelinesPtr */ | ||
199 | ); | ||
200 | |||
201 | Bool SDL_NAME(XF86VidModeAddModeLine)( | ||
202 | Display* /* dpy */, | ||
203 | int /* screen */, | ||
204 | SDL_NAME(XF86VidModeModeInfo)* /* new modeline */, | ||
205 | SDL_NAME(XF86VidModeModeInfo)* /* after modeline */ | ||
206 | ); | ||
207 | |||
208 | Bool SDL_NAME(XF86VidModeDeleteModeLine)( | ||
209 | Display* /* dpy */, | ||
210 | int /* screen */, | ||
211 | SDL_NAME(XF86VidModeModeInfo)* /* modeline */ | ||
212 | ); | ||
213 | |||
214 | Bool SDL_NAME(XF86VidModeModModeLine)( | ||
215 | Display* /* dpy */, | ||
216 | int /* screen */, | ||
217 | SDL_NAME(XF86VidModeModeLine)* /* modeline */ | ||
218 | ); | ||
219 | |||
220 | Status SDL_NAME(XF86VidModeValidateModeLine)( | ||
221 | Display* /* dpy */, | ||
222 | int /* screen */, | ||
223 | SDL_NAME(XF86VidModeModeInfo)* /* modeline */ | ||
224 | ); | ||
225 | |||
226 | Bool SDL_NAME(XF86VidModeSwitchMode)( | ||
227 | Display* /* dpy */, | ||
228 | int /* screen */, | ||
229 | int /* zoom */ | ||
230 | ); | ||
231 | |||
232 | Bool SDL_NAME(XF86VidModeSwitchToMode)( | ||
233 | Display* /* dpy */, | ||
234 | int /* screen */, | ||
235 | SDL_NAME(XF86VidModeModeInfo)* /* modeline */ | ||
236 | ); | ||
237 | |||
238 | Bool SDL_NAME(XF86VidModeLockModeSwitch)( | ||
239 | Display* /* dpy */, | ||
240 | int /* screen */, | ||
241 | int /* lock */ | ||
242 | ); | ||
243 | |||
244 | Bool SDL_NAME(XF86VidModeGetMonitor)( | ||
245 | Display* /* dpy */, | ||
246 | int /* screen */, | ||
247 | SDL_NAME(XF86VidModeMonitor)* /* monitor */ | ||
248 | ); | ||
249 | |||
250 | Bool SDL_NAME(XF86VidModeGetViewPort)( | ||
251 | Display* /* dpy */, | ||
252 | int /* screen */, | ||
253 | int* /* x return */, | ||
254 | int* /* y return */ | ||
255 | ); | ||
256 | |||
257 | Bool SDL_NAME(XF86VidModeSetViewPort)( | ||
258 | Display* /* dpy */, | ||
259 | int /* screen */, | ||
260 | int /* x */, | ||
261 | int /* y */ | ||
262 | ); | ||
263 | |||
264 | Bool SDL_NAME(XF86VidModeGetDotClocks)( | ||
265 | Display* /* dpy */, | ||
266 | int /* screen */, | ||
267 | int* /* flags return */, | ||
268 | int* /* number of clocks return */, | ||
269 | int* /* max dot clock return */, | ||
270 | int** /* clocks return */ | ||
271 | ); | ||
272 | |||
273 | Bool SDL_NAME(XF86VidModeGetGamma)( | ||
274 | Display* /* dpy */, | ||
275 | int /* screen */, | ||
276 | SDL_NAME(XF86VidModeGamma)* /* Gamma */ | ||
277 | ); | ||
278 | |||
279 | Bool SDL_NAME(XF86VidModeSetGamma)( | ||
280 | Display* /* dpy */, | ||
281 | int /* screen */, | ||
282 | SDL_NAME(XF86VidModeGamma)* /* Gamma */ | ||
283 | ); | ||
284 | |||
285 | Bool SDL_NAME(XF86VidModeSetGammaRamp)( | ||
286 | Display* /* dpy */, | ||
287 | int /* screen */, | ||
288 | int /* size */, | ||
289 | unsigned short* /* red array */, | ||
290 | unsigned short* /* green array */, | ||
291 | unsigned short* /* blue array */ | ||
292 | ); | ||
293 | |||
294 | Bool SDL_NAME(XF86VidModeGetGammaRamp)( | ||
295 | Display* /* dpy */, | ||
296 | int /* screen */, | ||
297 | int /* size */, | ||
298 | unsigned short* /* red array */, | ||
299 | unsigned short* /* green array */, | ||
300 | unsigned short* /* blue array */ | ||
301 | ); | ||
302 | |||
303 | Bool SDL_NAME(XF86VidModeGetGammaRampSize)( | ||
304 | Display* /* dpy */, | ||
305 | int /* screen */, | ||
306 | int* /* size */ | ||
307 | ); | ||
308 | |||
309 | |||
310 | _XFUNCPROTOEND | ||
311 | |||
312 | #endif | ||
313 | |||
314 | #endif | ||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xf86vmstr.h b/apps/plugins/sdl/src/video/Xext/extensions/xf86vmstr.h new file mode 100644 index 0000000000..0c3078d5aa --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xf86vmstr.h | |||
@@ -0,0 +1,546 @@ | |||
1 | /* $XFree86: xc/include/extensions/xf86vmstr.h,v 3.27 2001/08/01 00:44:36 tsi Exp $ */ | ||
2 | /* | ||
3 | |||
4 | Copyright 1995 Kaleb S. KEITHLEY | ||
5 | |||
6 | Permission is hereby granted, free of charge, to any person obtaining | ||
7 | a copy of this software and associated documentation files (the | ||
8 | "Software"), to deal in the Software without restriction, including | ||
9 | without limitation the rights to use, copy, modify, merge, publish, | ||
10 | distribute, sublicense, and/or sell copies of the Software, and to | ||
11 | permit persons to whom the Software is furnished to do so, subject to | ||
12 | the following conditions: | ||
13 | |||
14 | The above copyright notice and this permission notice shall be | ||
15 | included in all copies or substantial portions of the Software. | ||
16 | |||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
20 | IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES | ||
21 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
23 | OTHER DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | Except as contained in this notice, the name of Kaleb S. KEITHLEY | ||
26 | shall not be used in advertising or otherwise to promote the sale, use | ||
27 | or other dealings in this Software without prior written authorization | ||
28 | from Kaleb S. KEITHLEY | ||
29 | |||
30 | */ | ||
31 | /* $Xorg: xf86vmstr.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */ | ||
32 | |||
33 | /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ | ||
34 | |||
35 | #ifndef _XF86VIDMODESTR_H_ | ||
36 | #define _XF86VIDMODESTR_H_ | ||
37 | |||
38 | #include "xf86vmode.h" | ||
39 | |||
40 | #define XF86VIDMODENAME "XFree86-VidModeExtension" | ||
41 | |||
42 | #define XF86VIDMODE_MAJOR_VERSION 2 /* current version numbers */ | ||
43 | #define XF86VIDMODE_MINOR_VERSION 1 | ||
44 | /* | ||
45 | * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm. | ||
46 | * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune | ||
47 | * client. | ||
48 | * major version 2 == uses new protocol version in XFree86 4.0. | ||
49 | */ | ||
50 | |||
51 | typedef struct _XF86VidModeQueryVersion { | ||
52 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
53 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */ | ||
54 | CARD16 length B16; | ||
55 | } xXF86VidModeQueryVersionReq; | ||
56 | #define sz_xXF86VidModeQueryVersionReq 4 | ||
57 | |||
58 | typedef struct { | ||
59 | BYTE type; /* X_Reply */ | ||
60 | BOOL pad1; | ||
61 | CARD16 sequenceNumber B16; | ||
62 | CARD32 length B32; | ||
63 | CARD16 majorVersion B16; /* major version of XF86VidMode */ | ||
64 | CARD16 minorVersion B16; /* minor version of XF86VidMode */ | ||
65 | CARD32 pad2 B32; | ||
66 | CARD32 pad3 B32; | ||
67 | CARD32 pad4 B32; | ||
68 | CARD32 pad5 B32; | ||
69 | CARD32 pad6 B32; | ||
70 | } xXF86VidModeQueryVersionReply; | ||
71 | #define sz_xXF86VidModeQueryVersionReply 32 | ||
72 | |||
73 | typedef struct _XF86VidModeGetModeLine { | ||
74 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
75 | CARD8 xf86vidmodeReqType; | ||
76 | CARD16 length B16; | ||
77 | CARD16 screen B16; | ||
78 | CARD16 pad B16; | ||
79 | } xXF86VidModeGetModeLineReq, | ||
80 | xXF86VidModeGetAllModeLinesReq, | ||
81 | xXF86VidModeGetMonitorReq, | ||
82 | xXF86VidModeGetViewPortReq, | ||
83 | xXF86VidModeGetDotClocksReq; | ||
84 | #define sz_xXF86VidModeGetModeLineReq 8 | ||
85 | #define sz_xXF86VidModeGetAllModeLinesReq 8 | ||
86 | #define sz_xXF86VidModeGetMonitorReq 8 | ||
87 | #define sz_xXF86VidModeGetViewPortReq 8 | ||
88 | #define sz_xXF86VidModeGetDotClocksReq 8 | ||
89 | |||
90 | typedef struct { | ||
91 | BYTE type; /* X_Reply */ | ||
92 | BOOL pad1; | ||
93 | CARD16 sequenceNumber B16; | ||
94 | CARD32 length B32; | ||
95 | CARD32 dotclock B32; | ||
96 | CARD16 hdisplay B16; | ||
97 | CARD16 hsyncstart B16; | ||
98 | CARD16 hsyncend B16; | ||
99 | CARD16 htotal B16; | ||
100 | CARD16 hskew B16; | ||
101 | CARD16 vdisplay B16; | ||
102 | CARD16 vsyncstart B16; | ||
103 | CARD16 vsyncend B16; | ||
104 | CARD16 vtotal B16; | ||
105 | CARD16 pad2 B16; | ||
106 | CARD32 flags B32; | ||
107 | CARD32 reserved1 B32; | ||
108 | CARD32 reserved2 B32; | ||
109 | CARD32 reserved3 B32; | ||
110 | CARD32 privsize B32; | ||
111 | } xXF86VidModeGetModeLineReply; | ||
112 | #define sz_xXF86VidModeGetModeLineReply 52 | ||
113 | |||
114 | /* 0.x version */ | ||
115 | typedef struct { | ||
116 | BYTE type; /* X_Reply */ | ||
117 | BOOL pad1; | ||
118 | CARD16 sequenceNumber B16; | ||
119 | CARD32 length B32; | ||
120 | CARD32 dotclock B32; | ||
121 | CARD16 hdisplay B16; | ||
122 | CARD16 hsyncstart B16; | ||
123 | CARD16 hsyncend B16; | ||
124 | CARD16 htotal B16; | ||
125 | CARD16 vdisplay B16; | ||
126 | CARD16 vsyncstart B16; | ||
127 | CARD16 vsyncend B16; | ||
128 | CARD16 vtotal B16; | ||
129 | CARD32 flags B32; | ||
130 | CARD32 privsize B32; | ||
131 | } xXF86OldVidModeGetModeLineReply; | ||
132 | #define sz_xXF86OldVidModeGetModeLineReply 36 | ||
133 | |||
134 | typedef struct { | ||
135 | CARD32 dotclock B32; | ||
136 | CARD16 hdisplay B16; | ||
137 | CARD16 hsyncstart B16; | ||
138 | CARD16 hsyncend B16; | ||
139 | CARD16 htotal B16; | ||
140 | CARD32 hskew B16; | ||
141 | CARD16 vdisplay B16; | ||
142 | CARD16 vsyncstart B16; | ||
143 | CARD16 vsyncend B16; | ||
144 | CARD16 vtotal B16; | ||
145 | CARD16 pad1 B16; | ||
146 | CARD32 flags B32; | ||
147 | CARD32 reserved1 B32; | ||
148 | CARD32 reserved2 B32; | ||
149 | CARD32 reserved3 B32; | ||
150 | CARD32 privsize B32; | ||
151 | } xXF86VidModeModeInfo; | ||
152 | |||
153 | /* 0.x version */ | ||
154 | typedef struct { | ||
155 | CARD32 dotclock B32; | ||
156 | CARD16 hdisplay B16; | ||
157 | CARD16 hsyncstart B16; | ||
158 | CARD16 hsyncend B16; | ||
159 | CARD16 htotal B16; | ||
160 | CARD16 vdisplay B16; | ||
161 | CARD16 vsyncstart B16; | ||
162 | CARD16 vsyncend B16; | ||
163 | CARD16 vtotal B16; | ||
164 | CARD32 flags B32; | ||
165 | CARD32 privsize B32; | ||
166 | } xXF86OldVidModeModeInfo; | ||
167 | |||
168 | typedef struct { | ||
169 | BYTE type; /* X_Reply */ | ||
170 | BOOL pad1; | ||
171 | CARD16 sequenceNumber B16; | ||
172 | CARD32 length B32; | ||
173 | CARD32 modecount B32; | ||
174 | CARD32 pad2 B32; | ||
175 | CARD32 pad3 B32; | ||
176 | CARD32 pad4 B32; | ||
177 | CARD32 pad5 B32; | ||
178 | CARD32 pad6 B32; | ||
179 | } xXF86VidModeGetAllModeLinesReply; | ||
180 | #define sz_xXF86VidModeGetAllModeLinesReply 32 | ||
181 | |||
182 | typedef struct _XF86VidModeAddModeLine { | ||
183 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
184 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ | ||
185 | CARD16 length B16; | ||
186 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
187 | CARD32 dotclock B32; | ||
188 | CARD16 hdisplay B16; | ||
189 | CARD16 hsyncstart B16; | ||
190 | CARD16 hsyncend B16; | ||
191 | CARD16 htotal B16; | ||
192 | CARD16 hskew B16; | ||
193 | CARD16 vdisplay B16; | ||
194 | CARD16 vsyncstart B16; | ||
195 | CARD16 vsyncend B16; | ||
196 | CARD16 vtotal B16; | ||
197 | CARD16 pad1 B16; | ||
198 | CARD32 flags B32; | ||
199 | CARD32 reserved1 B32; | ||
200 | CARD32 reserved2 B32; | ||
201 | CARD32 reserved3 B32; | ||
202 | CARD32 privsize B32; | ||
203 | CARD32 after_dotclock B32; | ||
204 | CARD16 after_hdisplay B16; | ||
205 | CARD16 after_hsyncstart B16; | ||
206 | CARD16 after_hsyncend B16; | ||
207 | CARD16 after_htotal B16; | ||
208 | CARD16 after_hskew B16; | ||
209 | CARD16 after_vdisplay B16; | ||
210 | CARD16 after_vsyncstart B16; | ||
211 | CARD16 after_vsyncend B16; | ||
212 | CARD16 after_vtotal B16; | ||
213 | CARD16 pad2 B16; | ||
214 | CARD32 after_flags B32; | ||
215 | CARD32 reserved4 B32; | ||
216 | CARD32 reserved5 B32; | ||
217 | CARD32 reserved6 B32; | ||
218 | } xXF86VidModeAddModeLineReq; | ||
219 | #define sz_xXF86VidModeAddModeLineReq 92 | ||
220 | |||
221 | /* 0.x version */ | ||
222 | typedef struct _XF86OldVidModeAddModeLine { | ||
223 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
224 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ | ||
225 | CARD16 length B16; | ||
226 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
227 | CARD32 dotclock B32; | ||
228 | CARD16 hdisplay B16; | ||
229 | CARD16 hsyncstart B16; | ||
230 | CARD16 hsyncend B16; | ||
231 | CARD16 htotal B16; | ||
232 | CARD16 vdisplay B16; | ||
233 | CARD16 vsyncstart B16; | ||
234 | CARD16 vsyncend B16; | ||
235 | CARD16 vtotal B16; | ||
236 | CARD32 flags B32; | ||
237 | CARD32 privsize B32; | ||
238 | CARD32 after_dotclock B32; | ||
239 | CARD16 after_hdisplay B16; | ||
240 | CARD16 after_hsyncstart B16; | ||
241 | CARD16 after_hsyncend B16; | ||
242 | CARD16 after_htotal B16; | ||
243 | CARD16 after_vdisplay B16; | ||
244 | CARD16 after_vsyncstart B16; | ||
245 | CARD16 after_vsyncend B16; | ||
246 | CARD16 after_vtotal B16; | ||
247 | CARD32 after_flags B32; | ||
248 | } xXF86OldVidModeAddModeLineReq; | ||
249 | #define sz_xXF86OldVidModeAddModeLineReq 60 | ||
250 | |||
251 | typedef struct _XF86VidModeModModeLine { | ||
252 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
253 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */ | ||
254 | CARD16 length B16; | ||
255 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
256 | CARD16 hdisplay B16; | ||
257 | CARD16 hsyncstart B16; | ||
258 | CARD16 hsyncend B16; | ||
259 | CARD16 htotal B16; | ||
260 | CARD16 hskew B16; | ||
261 | CARD16 vdisplay B16; | ||
262 | CARD16 vsyncstart B16; | ||
263 | CARD16 vsyncend B16; | ||
264 | CARD16 vtotal B16; | ||
265 | CARD16 pad1 B16; | ||
266 | CARD32 flags B32; | ||
267 | CARD32 reserved1 B32; | ||
268 | CARD32 reserved2 B32; | ||
269 | CARD32 reserved3 B32; | ||
270 | CARD32 privsize B32; | ||
271 | } xXF86VidModeModModeLineReq; | ||
272 | #define sz_xXF86VidModeModModeLineReq 48 | ||
273 | |||
274 | /* 0.x version */ | ||
275 | typedef struct _XF86OldVidModeModModeLine { | ||
276 | CARD8 reqType; /* always XF86OldVidModeReqCode */ | ||
277 | CARD8 xf86vidmodeReqType; /* always X_XF86OldVidModeModModeLine */ | ||
278 | CARD16 length B16; | ||
279 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
280 | CARD16 hdisplay B16; | ||
281 | CARD16 hsyncstart B16; | ||
282 | CARD16 hsyncend B16; | ||
283 | CARD16 htotal B16; | ||
284 | CARD16 vdisplay B16; | ||
285 | CARD16 vsyncstart B16; | ||
286 | CARD16 vsyncend B16; | ||
287 | CARD16 vtotal B16; | ||
288 | CARD32 flags B32; | ||
289 | CARD32 privsize B32; | ||
290 | } xXF86OldVidModeModModeLineReq; | ||
291 | #define sz_xXF86OldVidModeModModeLineReq 32 | ||
292 | |||
293 | typedef struct _XF86VidModeValidateModeLine { | ||
294 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
295 | CARD8 xf86vidmodeReqType; | ||
296 | CARD16 length B16; | ||
297 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
298 | CARD32 dotclock B32; | ||
299 | CARD16 hdisplay B16; | ||
300 | CARD16 hsyncstart B16; | ||
301 | CARD16 hsyncend B16; | ||
302 | CARD16 htotal B16; | ||
303 | CARD16 hskew B16; | ||
304 | CARD16 vdisplay B16; | ||
305 | CARD16 vsyncstart B16; | ||
306 | CARD16 vsyncend B16; | ||
307 | CARD16 vtotal B16; | ||
308 | CARD16 pad1 B16; | ||
309 | CARD32 flags B32; | ||
310 | CARD32 reserved1 B32; | ||
311 | CARD32 reserved2 B32; | ||
312 | CARD32 reserved3 B32; | ||
313 | CARD32 privsize B32; | ||
314 | } xXF86VidModeDeleteModeLineReq, | ||
315 | xXF86VidModeValidateModeLineReq, | ||
316 | xXF86VidModeSwitchToModeReq; | ||
317 | #define sz_xXF86VidModeDeleteModeLineReq 52 | ||
318 | #define sz_xXF86VidModeValidateModeLineReq 52 | ||
319 | #define sz_xXF86VidModeSwitchToModeReq 52 | ||
320 | |||
321 | /* 0.x version */ | ||
322 | typedef struct _XF86OldVidModeValidateModeLine { | ||
323 | CARD8 reqType; /* always XF86OldVidModeReqCode */ | ||
324 | CARD8 xf86vidmodeReqType; | ||
325 | CARD16 length B16; | ||
326 | CARD32 screen B32; /* could be CARD16 but need the pad */ | ||
327 | CARD32 dotclock B32; | ||
328 | CARD16 hdisplay B16; | ||
329 | CARD16 hsyncstart B16; | ||
330 | CARD16 hsyncend B16; | ||
331 | CARD16 htotal B16; | ||
332 | CARD16 vdisplay B16; | ||
333 | CARD16 vsyncstart B16; | ||
334 | CARD16 vsyncend B16; | ||
335 | CARD16 vtotal B16; | ||
336 | CARD32 flags B32; | ||
337 | CARD32 privsize B32; | ||
338 | } xXF86OldVidModeDeleteModeLineReq, | ||
339 | xXF86OldVidModeValidateModeLineReq, | ||
340 | xXF86OldVidModeSwitchToModeReq; | ||
341 | #define sz_xXF86OldVidModeDeleteModeLineReq 36 | ||
342 | #define sz_xXF86OldVidModeValidateModeLineReq 36 | ||
343 | #define sz_xXF86OldVidModeSwitchToModeReq 36 | ||
344 | |||
345 | typedef struct _XF86VidModeSwitchMode { | ||
346 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
347 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */ | ||
348 | CARD16 length B16; | ||
349 | CARD16 screen B16; | ||
350 | CARD16 zoom B16; | ||
351 | } xXF86VidModeSwitchModeReq; | ||
352 | #define sz_xXF86VidModeSwitchModeReq 8 | ||
353 | |||
354 | typedef struct _XF86VidModeLockModeSwitch { | ||
355 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
356 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */ | ||
357 | CARD16 length B16; | ||
358 | CARD16 screen B16; | ||
359 | CARD16 lock B16; | ||
360 | } xXF86VidModeLockModeSwitchReq; | ||
361 | #define sz_xXF86VidModeLockModeSwitchReq 8 | ||
362 | |||
363 | typedef struct { | ||
364 | BYTE type; /* X_Reply */ | ||
365 | BOOL pad1; | ||
366 | CARD16 sequenceNumber B16; | ||
367 | CARD32 length B32; | ||
368 | CARD32 status B32; | ||
369 | CARD32 pad2 B32; | ||
370 | CARD32 pad3 B32; | ||
371 | CARD32 pad4 B32; | ||
372 | CARD32 pad5 B32; | ||
373 | CARD32 pad6 B32; | ||
374 | } xXF86VidModeValidateModeLineReply; | ||
375 | #define sz_xXF86VidModeValidateModeLineReply 32 | ||
376 | |||
377 | typedef struct { | ||
378 | BYTE type; /* X_Reply */ | ||
379 | BOOL pad1; | ||
380 | CARD16 sequenceNumber B16; | ||
381 | CARD32 length B32; | ||
382 | CARD8 vendorLength; | ||
383 | CARD8 modelLength; | ||
384 | CARD8 nhsync; | ||
385 | CARD8 nvsync; | ||
386 | CARD32 pad2 B32; | ||
387 | CARD32 pad3 B32; | ||
388 | CARD32 pad4 B32; | ||
389 | CARD32 pad5 B32; | ||
390 | CARD32 pad6 B32; | ||
391 | } xXF86VidModeGetMonitorReply; | ||
392 | #define sz_xXF86VidModeGetMonitorReply 32 | ||
393 | |||
394 | typedef struct { | ||
395 | BYTE type; | ||
396 | BOOL pad1; | ||
397 | CARD16 sequenceNumber B16; | ||
398 | CARD32 length B32; | ||
399 | CARD32 x B32; | ||
400 | CARD32 y B32; | ||
401 | CARD32 pad2 B32; | ||
402 | CARD32 pad3 B32; | ||
403 | CARD32 pad4 B32; | ||
404 | CARD32 pad5 B32; | ||
405 | } xXF86VidModeGetViewPortReply; | ||
406 | #define sz_xXF86VidModeGetViewPortReply 32 | ||
407 | |||
408 | typedef struct _XF86VidModeSetViewPort { | ||
409 | CARD8 reqType; /* always VidModeReqCode */ | ||
410 | CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */ | ||
411 | CARD16 length B16; | ||
412 | CARD16 screen B16; | ||
413 | CARD16 pad B16; | ||
414 | CARD32 x B32; | ||
415 | CARD32 y B32; | ||
416 | } xXF86VidModeSetViewPortReq; | ||
417 | #define sz_xXF86VidModeSetViewPortReq 16 | ||
418 | |||
419 | typedef struct { | ||
420 | BYTE type; | ||
421 | BOOL pad1; | ||
422 | CARD16 sequenceNumber B16; | ||
423 | CARD32 length B32; | ||
424 | CARD32 flags B32; | ||
425 | CARD32 clocks B32; | ||
426 | CARD32 maxclocks B32; | ||
427 | CARD32 pad2 B32; | ||
428 | CARD32 pad3 B32; | ||
429 | CARD32 pad4 B32; | ||
430 | } xXF86VidModeGetDotClocksReply; | ||
431 | #define sz_xXF86VidModeGetDotClocksReply 32 | ||
432 | |||
433 | typedef struct _XF86VidModeSetClientVersion { | ||
434 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
435 | CARD8 xf86vidmodeReqType; | ||
436 | CARD16 length B16; | ||
437 | CARD16 major B16; | ||
438 | CARD16 minor B16; | ||
439 | } xXF86VidModeSetClientVersionReq; | ||
440 | #define sz_xXF86VidModeSetClientVersionReq 8 | ||
441 | |||
442 | typedef struct _XF86VidModeGetGamma { | ||
443 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
444 | CARD8 xf86vidmodeReqType; | ||
445 | CARD16 length B16; | ||
446 | CARD16 screen B16; | ||
447 | CARD16 pad B16; | ||
448 | CARD32 pad1 B32; | ||
449 | CARD32 pad2 B32; | ||
450 | CARD32 pad3 B32; | ||
451 | CARD32 pad4 B32; | ||
452 | CARD32 pad5 B32; | ||
453 | CARD32 pad6 B32; | ||
454 | } xXF86VidModeGetGammaReq; | ||
455 | #define sz_xXF86VidModeGetGammaReq 32 | ||
456 | |||
457 | typedef struct { | ||
458 | BYTE type; | ||
459 | BOOL pad; | ||
460 | CARD16 sequenceNumber B16; | ||
461 | CARD32 length B32; | ||
462 | CARD32 red B32; | ||
463 | CARD32 green B32; | ||
464 | CARD32 blue B32; | ||
465 | CARD32 pad1 B32; | ||
466 | CARD32 pad2 B32; | ||
467 | CARD32 pad3 B32; | ||
468 | } xXF86VidModeGetGammaReply; | ||
469 | #define sz_xXF86VidModeGetGammaReply 32 | ||
470 | |||
471 | typedef struct _XF86VidModeSetGamma { | ||
472 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
473 | CARD8 xf86vidmodeReqType; | ||
474 | CARD16 length B16; | ||
475 | CARD16 screen B16; | ||
476 | CARD16 pad B16; | ||
477 | CARD32 red B32; | ||
478 | CARD32 green B32; | ||
479 | CARD32 blue B32; | ||
480 | CARD32 pad1 B32; | ||
481 | CARD32 pad2 B32; | ||
482 | CARD32 pad3 B32; | ||
483 | } xXF86VidModeSetGammaReq; | ||
484 | #define sz_xXF86VidModeSetGammaReq 32 | ||
485 | |||
486 | |||
487 | typedef struct _XF86VidModeSetGammaRamp { | ||
488 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
489 | CARD8 xf86vidmodeReqType; | ||
490 | CARD16 length B16; | ||
491 | CARD16 screen B16; | ||
492 | CARD16 size B16; | ||
493 | } xXF86VidModeSetGammaRampReq; | ||
494 | #define sz_xXF86VidModeSetGammaRampReq 8 | ||
495 | |||
496 | typedef struct _XF86VidModeGetGammaRamp { | ||
497 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
498 | CARD8 xf86vidmodeReqType; | ||
499 | CARD16 length B16; | ||
500 | CARD16 screen B16; | ||
501 | CARD16 size B16; | ||
502 | } xXF86VidModeGetGammaRampReq; | ||
503 | #define sz_xXF86VidModeGetGammaRampReq 8 | ||
504 | |||
505 | typedef struct { | ||
506 | BYTE type; | ||
507 | BOOL pad; | ||
508 | CARD16 sequenceNumber B16; | ||
509 | CARD32 length B32; | ||
510 | CARD16 size B16; | ||
511 | CARD16 pad0 B16; | ||
512 | CARD32 pad1 B32; | ||
513 | CARD32 pad2 B32; | ||
514 | CARD32 pad3 B32; | ||
515 | CARD32 pad4 B32; | ||
516 | CARD32 pad5 B32; | ||
517 | } xXF86VidModeGetGammaRampReply; | ||
518 | #define sz_xXF86VidModeGetGammaRampReply 32 | ||
519 | |||
520 | typedef struct _XF86VidModeGetGammaRampSize { | ||
521 | CARD8 reqType; /* always XF86VidModeReqCode */ | ||
522 | CARD8 xf86vidmodeReqType; | ||
523 | CARD16 length B16; | ||
524 | CARD16 screen B16; | ||
525 | CARD16 pad B16; | ||
526 | } xXF86VidModeGetGammaRampSizeReq; | ||
527 | #define sz_xXF86VidModeGetGammaRampSizeReq 8 | ||
528 | |||
529 | typedef struct { | ||
530 | BYTE type; | ||
531 | BOOL pad; | ||
532 | CARD16 sequenceNumber B16; | ||
533 | CARD32 length B32; | ||
534 | CARD16 size B16; | ||
535 | CARD16 pad0 B16; | ||
536 | CARD32 pad1 B32; | ||
537 | CARD32 pad2 B32; | ||
538 | CARD32 pad3 B32; | ||
539 | CARD32 pad4 B32; | ||
540 | CARD32 pad5 B32; | ||
541 | } xXF86VidModeGetGammaRampSizeReply; | ||
542 | #define sz_xXF86VidModeGetGammaRampSizeReply 32 | ||
543 | |||
544 | |||
545 | #endif /* _XF86VIDMODESTR_H_ */ | ||
546 | |||
diff --git a/apps/plugins/sdl/src/video/Xext/extensions/xme.h b/apps/plugins/sdl/src/video/Xext/extensions/xme.h new file mode 100644 index 0000000000..f550623c9f --- /dev/null +++ b/apps/plugins/sdl/src/video/Xext/extensions/xme.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright 1993-2001 by Xi Graphics, Inc. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Please see the LICENSE file accompanying this distribution for licensing | ||
6 | * information. | ||
7 | * | ||
8 | * Please send any bug fixes and modifications to src@xig.com. | ||
9 | * | ||
10 | * $XiGId: xme.h,v 1.1.1.1 2001/11/19 19:01:10 jon Exp $ | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | |||
15 | #ifndef _XME_H_INCLUDED | ||
16 | #define _XME_H_INCLUDED | ||
17 | |||
18 | typedef struct { | ||
19 | short x; | ||
20 | short y; | ||
21 | unsigned short w; | ||
22 | unsigned short h; | ||
23 | } XiGMiscViewInfo; | ||
24 | |||
25 | typedef struct { | ||
26 | unsigned short width; | ||
27 | unsigned short height; | ||
28 | int refresh; | ||
29 | } XiGMiscResolutionInfo; | ||
30 | |||
31 | extern Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor); | ||
32 | extern int XiGMiscQueryViews(Display *dpy, int screen, | ||
33 | XiGMiscViewInfo **pviews); | ||
34 | extern int XiGMiscQueryResolutions(Display *dpy, int screen, int view, | ||
35 | int *pactive, | ||
36 | XiGMiscResolutionInfo **presolutions); | ||
37 | extern void XiGMiscChangeResolution(Display *dpy, int screen, int view, | ||
38 | int width, int height, int refresh); | ||
39 | |||
40 | /* SDL addition from Ryan: free memory used by xme. */ | ||
41 | extern void XiGMiscDestroy(void); | ||
42 | |||
43 | #endif /* _XME_H_INCLUDED */ | ||
44 | |||
45 | |||