Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 1361:19418e4422cb
New configure-based build system. Still work in progress, but much improved
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 16 Feb 2006 10:11:48 +0000 |
parents | c71e05b4dc2e |
children | c0a74f199ecf |
comparison
equal
deleted
inserted
replaced
1360:70a9cfb4cf1b | 1361:19418e4422cb |
---|---|
37 #include "SDL_endian.h" | 37 #include "SDL_endian.h" |
38 #include "SDL_timer.h" | 38 #include "SDL_timer.h" |
39 #include "SDL_thread.h" | 39 #include "SDL_thread.h" |
40 #include "SDL_video.h" | 40 #include "SDL_video.h" |
41 #include "SDL_mouse.h" | 41 #include "SDL_mouse.h" |
42 #include "SDL_sysvideo.h" | 42 #include "../SDL_sysvideo.h" |
43 #include "SDL_pixels_c.h" | 43 #include "../SDL_pixels_c.h" |
44 #include "SDL_events_c.h" | 44 #include "../../events/SDL_events_c.h" |
45 #include "SDL_x11video.h" | 45 #include "SDL_x11video.h" |
46 #include "SDL_x11wm_c.h" | 46 #include "SDL_x11wm_c.h" |
47 #include "SDL_x11mouse_c.h" | 47 #include "SDL_x11mouse_c.h" |
48 #include "SDL_x11events_c.h" | 48 #include "SDL_x11events_c.h" |
49 #include "SDL_x11modes_c.h" | 49 #include "SDL_x11modes_c.h" |
50 #include "SDL_x11image_c.h" | 50 #include "SDL_x11image_c.h" |
51 #include "SDL_x11yuv_c.h" | 51 #include "SDL_x11yuv_c.h" |
52 #include "SDL_x11gl_c.h" | 52 #include "SDL_x11gl_c.h" |
53 #include "SDL_x11gamma_c.h" | 53 #include "SDL_x11gamma_c.h" |
54 #include "blank_cursor.h" | 54 #include "../blank_cursor.h" |
55 | 55 |
56 /* Initialization/Query functions */ | 56 /* Initialization/Query functions */ |
57 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat); | 57 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat); |
58 static SDL_Surface *X11_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | 58 static SDL_Surface *X11_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
59 static int X11_ToggleFullScreen(_THIS, int on); | 59 static int X11_ToggleFullScreen(_THIS, int on); |
123 device->VideoInit = X11_VideoInit; | 123 device->VideoInit = X11_VideoInit; |
124 device->ListModes = X11_ListModes; | 124 device->ListModes = X11_ListModes; |
125 device->SetVideoMode = X11_SetVideoMode; | 125 device->SetVideoMode = X11_SetVideoMode; |
126 device->ToggleFullScreen = X11_ToggleFullScreen; | 126 device->ToggleFullScreen = X11_ToggleFullScreen; |
127 device->UpdateMouse = X11_UpdateMouse; | 127 device->UpdateMouse = X11_UpdateMouse; |
128 #ifdef XFREE86_XV | 128 #if SDL_VIDEO_DRIVER_X11_XV |
129 device->CreateYUVOverlay = X11_CreateYUVOverlay; | 129 device->CreateYUVOverlay = X11_CreateYUVOverlay; |
130 #endif | 130 #endif |
131 device->SetColors = X11_SetColors; | 131 device->SetColors = X11_SetColors; |
132 device->UpdateRects = NULL; | 132 device->UpdateRects = NULL; |
133 device->VideoQuit = X11_VideoQuit; | 133 device->VideoQuit = X11_VideoQuit; |
142 device->FreeHWSurface = X11_FreeHWSurface; | 142 device->FreeHWSurface = X11_FreeHWSurface; |
143 device->SetGamma = X11_SetVidModeGamma; | 143 device->SetGamma = X11_SetVidModeGamma; |
144 device->GetGamma = X11_GetVidModeGamma; | 144 device->GetGamma = X11_GetVidModeGamma; |
145 device->SetGammaRamp = X11_SetGammaRamp; | 145 device->SetGammaRamp = X11_SetGammaRamp; |
146 device->GetGammaRamp = NULL; | 146 device->GetGammaRamp = NULL; |
147 #ifdef HAVE_OPENGL_X11 | 147 #if SDL_VIDEO_OPENGL_GLX |
148 device->GL_LoadLibrary = X11_GL_LoadLibrary; | 148 device->GL_LoadLibrary = X11_GL_LoadLibrary; |
149 device->GL_GetProcAddress = X11_GL_GetProcAddress; | 149 device->GL_GetProcAddress = X11_GL_GetProcAddress; |
150 device->GL_GetAttribute = X11_GL_GetAttribute; | 150 device->GL_GetAttribute = X11_GL_GetAttribute; |
151 device->GL_MakeCurrent = X11_GL_MakeCurrent; | 151 device->GL_MakeCurrent = X11_GL_MakeCurrent; |
152 device->GL_SwapBuffers = X11_GL_SwapBuffers; | 152 device->GL_SwapBuffers = X11_GL_SwapBuffers; |
177 | 177 |
178 /* Normal X11 error handler routine */ | 178 /* Normal X11 error handler routine */ |
179 static int (*X_handler)(Display *, XErrorEvent *) = NULL; | 179 static int (*X_handler)(Display *, XErrorEvent *) = NULL; |
180 static int x_errhandler(Display *d, XErrorEvent *e) | 180 static int x_errhandler(Display *d, XErrorEvent *e) |
181 { | 181 { |
182 #ifdef XFREE86_VM | 182 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
183 extern int vm_error; | 183 extern int vm_error; |
184 #endif | 184 #endif |
185 #ifdef XFREE86_DGAMOUSE | 185 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE |
186 extern int dga_error; | 186 extern int dga_error; |
187 #endif | 187 #endif |
188 | 188 |
189 #ifdef XFREE86_VM | 189 #if SDL_VIDEO_DRIVER_X11_VIDMODE |
190 /* VidMode errors are non-fatal. :) */ | 190 /* VidMode errors are non-fatal. :) */ |
191 /* Are the errors offset by one from the error base? | 191 /* Are the errors offset by one from the error base? |
192 e.g. the error base is 143, the code is 148, and the | 192 e.g. the error base is 143, the code is 148, and the |
193 actual error is XF86VidModeExtensionDisabled (4) ? | 193 actual error is XF86VidModeExtensionDisabled (4) ? |
194 */ | 194 */ |
202 printf("VidMode error: %s\n", errmsg); | 202 printf("VidMode error: %s\n", errmsg); |
203 } | 203 } |
204 #endif | 204 #endif |
205 return(0); | 205 return(0); |
206 } | 206 } |
207 #endif /* XFREE86_VM */ | 207 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ |
208 | 208 |
209 #ifdef XFREE86_DGAMOUSE | 209 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE |
210 /* DGA errors can be non-fatal. :) */ | 210 /* DGA errors can be non-fatal. :) */ |
211 if ( (dga_error >= 0) && | 211 if ( (dga_error >= 0) && |
212 ((e->error_code > dga_error) && | 212 ((e->error_code > dga_error) && |
213 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { | 213 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { |
214 #ifdef XFREE86_DEBUG | 214 #ifdef XFREE86_DEBUG |
217 printf("DGA error: %s\n", errmsg); | 217 printf("DGA error: %s\n", errmsg); |
218 } | 218 } |
219 #endif | 219 #endif |
220 return(0); | 220 return(0); |
221 } | 221 } |
222 #endif /* XFREE86_DGAMOUSE */ | 222 #endif /* SDL_VIDEO_DRIVER_X11_DGAMOUSE */ |
223 | 223 |
224 return(X_handler(d,e)); | 224 return(X_handler(d,e)); |
225 } | 225 } |
226 | 226 |
227 /* X11 I/O error handler routine */ | 227 /* X11 I/O error handler routine */ |
449 local_X11 = 1; | 449 local_X11 = 1; |
450 } else { | 450 } else { |
451 local_X11 = 0; | 451 local_X11 = 0; |
452 } | 452 } |
453 SDL_Display = pXOpenDisplay(display); | 453 SDL_Display = pXOpenDisplay(display); |
454 #if defined(__osf__) && defined(X11_DYNAMIC) | 454 #if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC) |
455 /* On Tru64 if linking without -lX11, it fails and you get following message. | 455 /* On Tru64 if linking without -lX11, it fails and you get following message. |
456 * Xlib: connection to ":0.0" refused by server | 456 * Xlib: connection to ":0.0" refused by server |
457 * Xlib: XDM authorization key matches an existing client! | 457 * Xlib: XDM authorization key matches an existing client! |
458 * | 458 * |
459 * It succeeds if retrying 1 second later | 459 * It succeeds if retrying 1 second later |