Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11video.h @ 270:37fa1484f71b
From: "Mattias Engdeg�rd" <f91-men@nada.kth.se>
To: slouken@devolution.com
Subject: Re: [SDL] Question about SDL_FillRect()
I benchmarked with and without clipping UpdateRects and was unable to find
any difference on my moderately slow machine. Anyway, I haven't added
clipping in this patch, but fixed a couple of bugs and generally cleaned
up some of the X11 image code. Most importantly, UpdateRects now checks
for both zero height and width. Also, I eliminated the entire code to
byteswap X11 images since X11 can do that automatically if you ask it
nicely :-)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 18 Jan 2002 22:02:03 +0000 |
parents | e8157fcb3114 |
children | eadc0746dfaf |
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 | |
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 #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 */ | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
50 #ifdef HAVE_XIGXME |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
51 #include <X11/extensions/xme.h> |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
52 #endif |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
53 |
0 | 54 #include <string.h> |
55 | |
56 #include "SDL_mouse.h" | |
57 #include "SDL_sysvideo.h" | |
58 | |
59 /* Hidden "this" pointer for the video functions */ | |
60 #define _THIS SDL_VideoDevice *this | |
61 | |
62 /* Private display data */ | |
63 struct SDL_PrivateVideoData { | |
64 int local_X11; /* Flag: true if local display */ | |
65 Display *X11_Display; /* Used for events and window management */ | |
66 Display *GFX_Display; /* Used for graphics and colormap stuff */ | |
67 Visual *SDL_Visual; /* The visual used by our window */ | |
68 Window WMwindow; /* Input window, managed by window manager */ | |
69 Window FSwindow; /* Fullscreen window, completely unmanaged */ | |
70 Window SDL_Window; /* Shared by both displays (no X security?) */ | |
71 Atom WM_DELETE_WINDOW; /* "close-window" protocol atom */ | |
72 WMcursor *BlankCursor; /* The invisible cursor */ | |
73 | |
74 char *SDL_windowid; /* Flag: true if we have been passed a window */ | |
75 | |
76 /* Direct Graphics Access extension information */ | |
77 int using_dga; | |
78 | |
79 #ifndef NO_SHARED_MEMORY | |
80 /* MIT shared memory extension information */ | |
81 int use_mitshm; | |
82 XShmSegmentInfo shminfo; | |
83 #endif | |
84 | |
85 /* The variables used for displaying graphics */ | |
86 XImage *Ximage; /* The X image for our window */ | |
87 GC gc; /* The graphic context for drawing */ | |
88 | |
89 /* The current width and height of the fullscreen mode */ | |
90 int current_w; | |
91 int current_h; | |
92 | |
93 /* Support for internal mouse warping */ | |
94 struct { | |
95 int x; | |
96 int y; | |
97 } mouse_last; | |
98 struct { | |
99 int numerator; | |
100 int denominator; | |
101 int threshold; | |
102 } mouse_accel; | |
103 int mouse_relative; | |
104 | |
105 /* The current list of available video modes */ | |
106 SDL_Rect **modelist; | |
107 | |
108 /* available visuals of interest to us, sorted deepest first */ | |
109 struct { | |
110 Visual *visual; | |
111 int depth; /* number of significant bits/pixel */ | |
112 int bpp; /* pixel quantum in bits */ | |
113 } visuals[2*5]; /* at most 2 entries for 8, 15, 16, 24, 32 */ | |
114 int nvisuals; | |
115 | |
116 Visual *vis; /* current visual in use */ | |
117 int depth; /* current visual depth (not bpp) */ | |
118 | |
119 /* Variables used by the X11 video mode code */ | |
120 #ifdef XFREE86_VM | |
121 XF86VidModeModeInfo saved_mode; | |
122 struct { | |
123 int x, y; | |
124 } saved_view; | |
125 #endif | |
242
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
126 #ifdef HAVE_XIGXME /* XiG XME fullscreen */ |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
127 int use_xme; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
128 XiGMiscResolutionInfo saved_res; |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
129 #endif |
4bcb29d3769c
Added support for Xi Graphics XME fullscreen extension
Sam Lantinga <slouken@libsdl.org>
parents:
227
diff
changeset
|
130 |
227
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
131 int xinerama_x; |
24878c14b391
Added X11 Xinerama support - fullscreen starts on screen 0
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
132 int xinerama_y; |
0 | 133 int use_vidmode; |
134 int currently_fullscreen; | |
135 | |
136 /* Automatic mode switching support (entering/leaving fullscreen) */ | |
137 Uint32 switch_waiting; | |
138 Uint32 switch_time; | |
139 | |
140 /* Prevent too many XSync() calls */ | |
141 int blit_queued; | |
142 | |
143 /* Colormap handling */ | |
144 Colormap DisplayColormap; /* The default display colormap */ | |
145 Colormap XColorMap; /* The current window colormap */ | |
146 int *XPixels; /* pixels value allocation counts */ | |
147 float gamma_saved[3]; /* Saved gamma values for VidMode gamma */ | |
148 int gamma_changed; /* flag: has VidMode gamma been modified? */ | |
149 | |
150 short *iconcolors; /* List of colors used by the icon */ | |
151 }; | |
152 | |
153 /* Old variable names */ | |
154 #define local_X11 (this->hidden->local_X11) | |
155 #define SDL_Display (this->hidden->X11_Display) | |
156 #define GFX_Display (this->hidden->GFX_Display) | |
157 #define SDL_Screen DefaultScreen(this->hidden->X11_Display) | |
158 | |
159 #define SDL_Visual (this->hidden->vis) | |
160 | |
161 #define SDL_Root RootWindow(SDL_Display, SDL_Screen) | |
162 #define WMwindow (this->hidden->WMwindow) | |
163 #define FSwindow (this->hidden->FSwindow) | |
164 #define SDL_Window (this->hidden->SDL_Window) | |
165 #define WM_DELETE_WINDOW (this->hidden->WM_DELETE_WINDOW) | |
166 #define SDL_BlankCursor (this->hidden->BlankCursor) | |
167 #define SDL_windowid (this->hidden->SDL_windowid) | |
168 #define using_dga (this->hidden->using_dga) | |
169 #define use_mitshm (this->hidden->use_mitshm) | |
170 #define shminfo (this->hidden->shminfo) | |
171 #define SDL_Ximage (this->hidden->Ximage) | |
172 #define SDL_GC (this->hidden->gc) | |
173 #define current_w (this->hidden->current_w) | |
174 #define current_h (this->hidden->current_h) | |
175 #define mouse_last (this->hidden->mouse_last) | |
176 #define mouse_accel (this->hidden->mouse_accel) | |
177 #define mouse_relative (this->hidden->mouse_relative) | |
178 #define SDL_modelist (this->hidden->modelist) | |
179 #define saved_mode (this->hidden->saved_mode) | |
180 #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
|
181 #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
|
182 #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
|
183 #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
|
184 #define xinerama_y (this->hidden->xinerama_y) |
0 | 185 #define use_vidmode (this->hidden->use_vidmode) |
186 #define currently_fullscreen (this->hidden->currently_fullscreen) | |
187 #define switch_waiting (this->hidden->switch_waiting) | |
188 #define switch_time (this->hidden->switch_time) | |
189 #define blit_queued (this->hidden->blit_queued) | |
190 #define SDL_DisplayColormap (this->hidden->DisplayColormap) | |
191 #define SDL_PrivateColormap (this->hidden->PrivateColormap) | |
192 #define SDL_XColorMap (this->hidden->XColorMap) | |
193 #define SDL_XPixels (this->hidden->XPixels) | |
194 #define gamma_saved (this->hidden->gamma_saved) | |
195 #define gamma_changed (this->hidden->gamma_changed) | |
196 #define SDL_iconcolors (this->hidden->iconcolors) | |
197 | |
198 /* Some versions of XFree86 have bugs - detect if this is one of them */ | |
199 #define BUGGY_XFREE86(condition, buggy_version) \ | |
200 ((strcmp(ServerVendor(SDL_Display), "The XFree86 Project, Inc") == 0) && \ | |
201 (VendorRelease(SDL_Display) condition buggy_version)) | |
202 | |
203 #endif /* _SDL_x11video_h */ |