Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11video.h @ 1324:42e95163d553
Favor using pthread_mutexattr_settype() on Linux.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 03 Feb 2006 06:33:54 +0000 |
parents | c9b51268668f |
children | d12a63a8d95a |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 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 | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
242
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifndef _SDL_x11video_h | |
24 #define _SDL_x11video_h | |
25 | |
26 #include <X11/Xlib.h> | |
27 #include <X11/Xutil.h> | |
28 #include <X11/Xatom.h> | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
769
diff
changeset
|
29 |
0 | 30 #ifdef XFREE86_DGAMOUSE |
1306
0c105755b110
Changed references to XFree86 to Xext to match change in directory structure.
Ryan C. Gordon <icculus@icculus.org>
parents:
1242
diff
changeset
|
31 #include <Xext/extensions/xf86dga.h> |
0 | 32 #endif |
33 #ifdef XFREE86_VM | |
1306
0c105755b110
Changed references to XFree86 to Xext to match change in directory structure.
Ryan C. Gordon <icculus@icculus.org>
parents:
1242
diff
changeset
|
34 #include <Xext/extensions/xf86vmode.h> |
0 | 35 #endif |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
36 #ifdef HAVE_XIGXME |
1306
0c105755b110
Changed references to XFree86 to Xext to match change in directory structure.
Ryan C. Gordon <icculus@icculus.org>
parents:
1242
diff
changeset
|
37 #include <Xext/extensions/xme.h> |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
38 #endif |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
39 |
0 | 40 #include <string.h> |
41 | |
42 #include "SDL_mouse.h" | |
43 #include "SDL_sysvideo.h" | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
769
diff
changeset
|
44 #include "SDL_x11dyn.h" |
0 | 45 |
46 /* Hidden "this" pointer for the video functions */ | |
47 #define _THIS SDL_VideoDevice *this | |
48 | |
49 /* Private display data */ | |
50 struct SDL_PrivateVideoData { | |
51 int local_X11; /* Flag: true if local display */ | |
52 Display *X11_Display; /* Used for events and window management */ | |
53 Display *GFX_Display; /* Used for graphics and colormap stuff */ | |
54 Visual *SDL_Visual; /* The visual used by our window */ | |
55 Window WMwindow; /* Input window, managed by window manager */ | |
56 Window FSwindow; /* Fullscreen window, completely unmanaged */ | |
57 Window SDL_Window; /* Shared by both displays (no X security?) */ | |
58 Atom WM_DELETE_WINDOW; /* "close-window" protocol atom */ | |
59 WMcursor *BlankCursor; /* The invisible cursor */ | |
1178
9867f3d86e44
Real Unicode support for X11. Based on updated version of this patch:
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
60 XIM X11_IM; /* Used to communicate with the input method (IM) server */ |
9867f3d86e44
Real Unicode support for X11. Based on updated version of this patch:
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
61 XIC X11_IC; /* Used for retaining the state, properties, and semantics of communication with the input method (IM) server */ |
0 | 62 |
63 char *SDL_windowid; /* Flag: true if we have been passed a window */ | |
64 | |
65 /* Direct Graphics Access extension information */ | |
66 int using_dga; | |
67 | |
68 #ifndef NO_SHARED_MEMORY | |
69 /* MIT shared memory extension information */ | |
70 int use_mitshm; | |
71 XShmSegmentInfo shminfo; | |
72 #endif | |
73 | |
74 /* The variables used for displaying graphics */ | |
75 XImage *Ximage; /* The X image for our window */ | |
76 GC gc; /* The graphic context for drawing */ | |
77 | |
78 /* The current width and height of the fullscreen mode */ | |
79 int current_w; | |
80 int current_h; | |
81 | |
82 /* Support for internal mouse warping */ | |
83 struct { | |
84 int x; | |
85 int y; | |
86 } mouse_last; | |
87 struct { | |
88 int numerator; | |
89 int denominator; | |
90 int threshold; | |
91 } mouse_accel; | |
92 int mouse_relative; | |
93 | |
94 /* The current list of available video modes */ | |
95 SDL_Rect **modelist; | |
96 | |
97 /* available visuals of interest to us, sorted deepest first */ | |
98 struct { | |
99 Visual *visual; | |
100 int depth; /* number of significant bits/pixel */ | |
101 int bpp; /* pixel quantum in bits */ | |
102 } visuals[2*5]; /* at most 2 entries for 8, 15, 16, 24, 32 */ | |
103 int nvisuals; | |
104 | |
105 Visual *vis; /* current visual in use */ | |
106 int depth; /* current visual depth (not bpp) */ | |
107 | |
108 /* Variables used by the X11 video mode code */ | |
109 #ifdef XFREE86_VM | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
270
diff
changeset
|
110 SDL_NAME(XF86VidModeModeInfo) saved_mode; |
0 | 111 struct { |
112 int x, y; | |
113 } saved_view; | |
114 #endif | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
115 #ifdef HAVE_XIGXME /* XiG XME fullscreen */ |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
116 int use_xme; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
117 XiGMiscResolutionInfo saved_res; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
118 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
119 |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
120 int xinerama_x; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
121 int xinerama_y; |
0 | 122 int use_vidmode; |
123 int currently_fullscreen; | |
124 | |
125 /* Automatic mode switching support (entering/leaving fullscreen) */ | |
126 Uint32 switch_waiting; | |
127 Uint32 switch_time; | |
128 | |
129 /* Prevent too many XSync() calls */ | |
130 int blit_queued; | |
131 | |
132 /* Colormap handling */ | |
133 Colormap DisplayColormap; /* The default display colormap */ | |
134 Colormap XColorMap; /* The current window colormap */ | |
135 int *XPixels; /* pixels value allocation counts */ | |
136 float gamma_saved[3]; /* Saved gamma values for VidMode gamma */ | |
137 int gamma_changed; /* flag: has VidMode gamma been modified? */ | |
138 | |
139 short *iconcolors; /* List of colors used by the icon */ | |
140 }; | |
141 | |
142 /* Old variable names */ | |
143 #define local_X11 (this->hidden->local_X11) | |
144 #define SDL_Display (this->hidden->X11_Display) | |
145 #define GFX_Display (this->hidden->GFX_Display) | |
146 #define SDL_Screen DefaultScreen(this->hidden->X11_Display) | |
147 #define SDL_Visual (this->hidden->vis) | |
148 #define SDL_Root RootWindow(SDL_Display, SDL_Screen) | |
149 #define WMwindow (this->hidden->WMwindow) | |
150 #define FSwindow (this->hidden->FSwindow) | |
151 #define SDL_Window (this->hidden->SDL_Window) | |
152 #define WM_DELETE_WINDOW (this->hidden->WM_DELETE_WINDOW) | |
153 #define SDL_BlankCursor (this->hidden->BlankCursor) | |
1178
9867f3d86e44
Real Unicode support for X11. Based on updated version of this patch:
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
154 #define SDL_IM (this->hidden->X11_IM) |
9867f3d86e44
Real Unicode support for X11. Based on updated version of this patch:
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
155 #define SDL_IC (this->hidden->X11_IC) |
0 | 156 #define SDL_windowid (this->hidden->SDL_windowid) |
157 #define using_dga (this->hidden->using_dga) | |
158 #define use_mitshm (this->hidden->use_mitshm) | |
159 #define shminfo (this->hidden->shminfo) | |
160 #define SDL_Ximage (this->hidden->Ximage) | |
161 #define SDL_GC (this->hidden->gc) | |
162 #define current_w (this->hidden->current_w) | |
163 #define current_h (this->hidden->current_h) | |
164 #define mouse_last (this->hidden->mouse_last) | |
165 #define mouse_accel (this->hidden->mouse_accel) | |
166 #define mouse_relative (this->hidden->mouse_relative) | |
167 #define SDL_modelist (this->hidden->modelist) | |
168 #define saved_mode (this->hidden->saved_mode) | |
169 #define saved_view (this->hidden->saved_view) | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
170 #define use_xme (this->hidden->use_xme) |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
171 #define saved_res (this->hidden->saved_res) |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
172 #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
|
173 #define xinerama_y (this->hidden->xinerama_y) |
0 | 174 #define use_vidmode (this->hidden->use_vidmode) |
175 #define currently_fullscreen (this->hidden->currently_fullscreen) | |
176 #define switch_waiting (this->hidden->switch_waiting) | |
177 #define switch_time (this->hidden->switch_time) | |
178 #define blit_queued (this->hidden->blit_queued) | |
179 #define SDL_DisplayColormap (this->hidden->DisplayColormap) | |
180 #define SDL_PrivateColormap (this->hidden->PrivateColormap) | |
181 #define SDL_XColorMap (this->hidden->XColorMap) | |
182 #define SDL_XPixels (this->hidden->XPixels) | |
183 #define gamma_saved (this->hidden->gamma_saved) | |
184 #define gamma_changed (this->hidden->gamma_changed) | |
185 #define SDL_iconcolors (this->hidden->iconcolors) | |
186 /* Some versions of XFree86 have bugs - detect if this is one of them */ | |
187 #define BUGGY_XFREE86(condition, buggy_version) \ | |
188 ((strcmp(ServerVendor(SDL_Display), "The XFree86 Project, Inc") == 0) && \ | |
189 (VendorRelease(SDL_Display) condition buggy_version)) | |
190 | |
191 #endif /* _SDL_x11video_h */ |