Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11video.h @ 227:24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 03 Nov 2001 17:03:16 +0000 |
parents | 74212992fb08 |
children | 4bcb29d3769c |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@devolution.com | |
21 */ | |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_x11video_h | |
29 #define _SDL_x11video_h | |
30 | |
31 #include <X11/Xlib.h> | |
32 #include <X11/Xutil.h> | |
33 #include <X11/Xatom.h> | |
34 #ifndef NO_SHARED_MEMORY | |
35 #include <sys/ipc.h> | |
36 #include <sys/shm.h> | |
37 #include <X11/extensions/XShm.h> | |
38 #endif | |
39 #ifdef XFREE86_DGAMOUSE | |
40 #include <X11/extensions/xf86dga.h> | |
41 #endif | |
42 #ifdef XFREE86_VM | |
43 #include <X11/extensions/xf86vmode.h> | |
44 #ifdef XFREE86_VM_DYNAMIC_HACK | |
45 #define XVidMode(func, args) XF40VidMode##func args | |
46 #else | |
47 #define XVidMode(func, args) XF86VidMode##func args | |
48 #endif | |
49 #endif /* XFREE86_VM */ | |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
50 |
0 | 51 #include <string.h> |
52 | |
53 #include "SDL_mouse.h" | |
54 #include "SDL_sysvideo.h" | |
55 | |
56 /* Hidden "this" pointer for the video functions */ | |
57 #define _THIS SDL_VideoDevice *this | |
58 | |
59 /* Private display data */ | |
60 struct SDL_PrivateVideoData { | |
61 int local_X11; /* Flag: true if local display */ | |
62 Display *X11_Display; /* Used for events and window management */ | |
63 Display *GFX_Display; /* Used for graphics and colormap stuff */ | |
64 Visual *SDL_Visual; /* The visual used by our window */ | |
65 Window WMwindow; /* Input window, managed by window manager */ | |
66 Window FSwindow; /* Fullscreen window, completely unmanaged */ | |
67 Window SDL_Window; /* Shared by both displays (no X security?) */ | |
68 Atom WM_DELETE_WINDOW; /* "close-window" protocol atom */ | |
69 WMcursor *BlankCursor; /* The invisible cursor */ | |
70 | |
71 char *SDL_windowid; /* Flag: true if we have been passed a window */ | |
72 | |
73 /* Direct Graphics Access extension information */ | |
74 int using_dga; | |
75 | |
76 #ifndef NO_SHARED_MEMORY | |
77 /* MIT shared memory extension information */ | |
78 int use_mitshm; | |
79 XShmSegmentInfo shminfo; | |
80 #endif | |
81 | |
82 /* The variables used for displaying graphics */ | |
83 XImage *Ximage; /* The X image for our window */ | |
84 GC gc; /* The graphic context for drawing */ | |
85 int swap_pixels; /* Flag: true if display is swapped endian */ | |
86 | |
87 /* The current width and height of the fullscreen mode */ | |
88 int current_w; | |
89 int current_h; | |
90 | |
91 /* Support for internal mouse warping */ | |
92 struct { | |
93 int x; | |
94 int y; | |
95 } mouse_last; | |
96 struct { | |
97 int numerator; | |
98 int denominator; | |
99 int threshold; | |
100 } mouse_accel; | |
101 int mouse_relative; | |
102 | |
103 /* The current list of available video modes */ | |
104 SDL_Rect **modelist; | |
105 | |
106 /* available visuals of interest to us, sorted deepest first */ | |
107 struct { | |
108 Visual *visual; | |
109 int depth; /* number of significant bits/pixel */ | |
110 int bpp; /* pixel quantum in bits */ | |
111 } visuals[2*5]; /* at most 2 entries for 8, 15, 16, 24, 32 */ | |
112 int nvisuals; | |
113 | |
114 Visual *vis; /* current visual in use */ | |
115 int depth; /* current visual depth (not bpp) */ | |
116 | |
117 /* Variables used by the X11 video mode code */ | |
118 #ifdef XFREE86_VM | |
119 XF86VidModeModeInfo saved_mode; | |
120 struct { | |
121 int x, y; | |
122 } saved_view; | |
123 #endif | |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
124 int xinerama_x; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
125 int xinerama_y; |
0 | 126 int use_vidmode; |
127 int currently_fullscreen; | |
128 | |
129 /* Automatic mode switching support (entering/leaving fullscreen) */ | |
130 Uint32 switch_waiting; | |
131 Uint32 switch_time; | |
132 | |
133 /* Prevent too many XSync() calls */ | |
134 int blit_queued; | |
135 | |
136 /* Colormap handling */ | |
137 Colormap DisplayColormap; /* The default display colormap */ | |
138 Colormap XColorMap; /* The current window colormap */ | |
139 int *XPixels; /* pixels value allocation counts */ | |
140 float gamma_saved[3]; /* Saved gamma values for VidMode gamma */ | |
141 int gamma_changed; /* flag: has VidMode gamma been modified? */ | |
142 | |
143 short *iconcolors; /* List of colors used by the icon */ | |
144 }; | |
145 | |
146 /* Old variable names */ | |
147 #define local_X11 (this->hidden->local_X11) | |
148 #define SDL_Display (this->hidden->X11_Display) | |
149 #define GFX_Display (this->hidden->GFX_Display) | |
150 #define SDL_Screen DefaultScreen(this->hidden->X11_Display) | |
151 | |
152 #define SDL_Visual (this->hidden->vis) | |
153 | |
154 #define SDL_Root RootWindow(SDL_Display, SDL_Screen) | |
155 #define WMwindow (this->hidden->WMwindow) | |
156 #define FSwindow (this->hidden->FSwindow) | |
157 #define SDL_Window (this->hidden->SDL_Window) | |
158 #define WM_DELETE_WINDOW (this->hidden->WM_DELETE_WINDOW) | |
159 #define SDL_BlankCursor (this->hidden->BlankCursor) | |
160 #define SDL_windowid (this->hidden->SDL_windowid) | |
161 #define using_dga (this->hidden->using_dga) | |
162 #define use_mitshm (this->hidden->use_mitshm) | |
163 #define shminfo (this->hidden->shminfo) | |
164 #define SDL_Ximage (this->hidden->Ximage) | |
165 #define SDL_GC (this->hidden->gc) | |
166 #define swap_pixels (this->hidden->swap_pixels) | |
167 #define current_w (this->hidden->current_w) | |
168 #define current_h (this->hidden->current_h) | |
169 #define mouse_last (this->hidden->mouse_last) | |
170 #define mouse_accel (this->hidden->mouse_accel) | |
171 #define mouse_relative (this->hidden->mouse_relative) | |
172 #define SDL_modelist (this->hidden->modelist) | |
173 #define saved_mode (this->hidden->saved_mode) | |
174 #define saved_view (this->hidden->saved_view) | |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
175 #define xinerama_x (this->hidden->xinerama_x) |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
176 #define xinerama_y (this->hidden->xinerama_y) |
0 | 177 #define use_vidmode (this->hidden->use_vidmode) |
178 #define currently_fullscreen (this->hidden->currently_fullscreen) | |
179 #define switch_waiting (this->hidden->switch_waiting) | |
180 #define switch_time (this->hidden->switch_time) | |
181 #define blit_queued (this->hidden->blit_queued) | |
182 #define SDL_DisplayColormap (this->hidden->DisplayColormap) | |
183 #define SDL_PrivateColormap (this->hidden->PrivateColormap) | |
184 #define SDL_XColorMap (this->hidden->XColorMap) | |
185 #define SDL_XPixels (this->hidden->XPixels) | |
186 #define gamma_saved (this->hidden->gamma_saved) | |
187 #define gamma_changed (this->hidden->gamma_changed) | |
188 #define SDL_iconcolors (this->hidden->iconcolors) | |
189 | |
190 /* Some versions of XFree86 have bugs - detect if this is one of them */ | |
191 #define BUGGY_XFREE86(condition, buggy_version) \ | |
192 ((strcmp(ServerVendor(SDL_Display), "The XFree86 Project, Inc") == 0) && \ | |
193 (VendorRelease(SDL_Display) condition buggy_version)) | |
194 | |
195 #endif /* _SDL_x11video_h */ |