comparison src/video/x11/SDL_x11video.c @ 1765:c2c6ff414ef5

Fixed bug #45 Improved Xinerama support. Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment variable, currently supported on X11 Xinerama configurations. Only use the VidMode extension on the primary head.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 04 May 2006 16:51:07 +0000
parents 5cf11b00b900
children ae9f6be81810
comparison
equal deleted inserted replaced
1764:4b2f27334dce 1765:c2c6ff414ef5
195 */ 195 */
196 if ( (vm_error >= 0) && 196 if ( (vm_error >= 0) &&
197 (((e->error_code == BadRequest)&&(e->request_code == vm_error)) || 197 (((e->error_code == BadRequest)&&(e->request_code == vm_error)) ||
198 ((e->error_code > vm_error) && 198 ((e->error_code > vm_error) &&
199 (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) { 199 (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) {
200 #ifdef XFREE86_DEBUG 200 #ifdef X11_DEBUG
201 { char errmsg[1024]; 201 { char errmsg[1024];
202 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); 202 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
203 printf("VidMode error: %s\n", errmsg); 203 printf("VidMode error: %s\n", errmsg);
204 } 204 }
205 #endif 205 #endif
210 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE 210 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE
211 /* DGA errors can be non-fatal. :) */ 211 /* DGA errors can be non-fatal. :) */
212 if ( (dga_error >= 0) && 212 if ( (dga_error >= 0) &&
213 ((e->error_code > dga_error) && 213 ((e->error_code > dga_error) &&
214 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { 214 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) {
215 #ifdef XFREE86_DEBUG 215 #ifdef X11_DEBUG
216 { char errmsg[1024]; 216 { char errmsg[1024];
217 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); 217 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
218 printf("DGA error: %s\n", errmsg); 218 printf("DGA error: %s\n", errmsg);
219 } 219 }
220 #endif 220 #endif
242 } 242 }
243 243
244 static int (*Xext_handler)(Display *, _Xconst char *, _Xconst char *) = NULL; 244 static int (*Xext_handler)(Display *, _Xconst char *, _Xconst char *) = NULL;
245 static int xext_errhandler(Display *d, _Xconst char *ext, _Xconst char *reason) 245 static int xext_errhandler(Display *d, _Xconst char *ext, _Xconst char *reason)
246 { 246 {
247 #ifdef XFREE86_DEBUG 247 #ifdef X11_DEBUG
248 printf("Xext error inside SDL (may be harmless):\n"); 248 printf("Xext error inside SDL (may be harmless):\n");
249 printf(" Extension \"%s\" %s on display \"%s\".\n", 249 printf(" Extension \"%s\" %s on display \"%s\".\n",
250 ext, reason, XDisplayString(d)); 250 ext, reason, XDisplayString(d));
251 #endif 251 #endif
252 252
308 } 308 }
309 309
310 /* Create auxiliary (toplevel) windows with the current visual */ 310 /* Create auxiliary (toplevel) windows with the current visual */
311 static void create_aux_windows(_THIS) 311 static void create_aux_windows(_THIS)
312 { 312 {
313 int x = 0, y = 0;
313 Atom _NET_WM_NAME; 314 Atom _NET_WM_NAME;
314 Atom _NET_WM_ICON_NAME; 315 Atom _NET_WM_ICON_NAME;
315 char classname[1024]; 316 char classname[1024];
316 XSetWindowAttributes xattr; 317 XSetWindowAttributes xattr;
317 XWMHints *hints; 318 XWMHints *hints;
331 } 332 }
332 333
333 if(FSwindow) 334 if(FSwindow)
334 XDestroyWindow(SDL_Display, FSwindow); 335 XDestroyWindow(SDL_Display, FSwindow);
335 336
337 #if SDL_VIDEO_DRIVER_X11_VIDMODE
338 if ( use_xinerama ) {
339 x = xinerama_info.x_org;
340 y = xinerama_info.y_org;
341 }
342 #endif
336 xattr.override_redirect = True; 343 xattr.override_redirect = True;
337 xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0; 344 xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0;
338 xattr.border_pixel = 0; 345 xattr.border_pixel = 0;
339 xattr.colormap = SDL_XColorMap; 346 xattr.colormap = SDL_XColorMap;
340 347
341 FSwindow = XCreateWindow(SDL_Display, SDL_Root, 348 FSwindow = XCreateWindow(SDL_Display, SDL_Root,
342 xinerama_x, xinerama_y, 32, 32, 0, 349 x, y, 32, 32, 0,
343 this->hidden->depth, InputOutput, SDL_Visual, 350 this->hidden->depth, InputOutput, SDL_Visual,
344 CWOverrideRedirect | CWBackPixel | CWBorderPixel 351 CWOverrideRedirect | CWBackPixel | CWBorderPixel
345 | CWColormap, 352 | CWColormap,
346 &xattr); 353 &xattr);
347 354
377 XDestroyWindow(SDL_Display, WMwindow); 384 XDestroyWindow(SDL_Display, WMwindow);
378 } 385 }
379 386
380 /* Create the window for windowed management */ 387 /* Create the window for windowed management */
381 /* (reusing the xattr structure above) */ 388 /* (reusing the xattr structure above) */
382 WMwindow = XCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0, 389 WMwindow = XCreateWindow(SDL_Display, SDL_Root,
390 x, y, 32, 32, 0,
383 this->hidden->depth, InputOutput, SDL_Visual, 391 this->hidden->depth, InputOutput, SDL_Visual,
384 CWBackPixel | CWBorderPixel | CWColormap, 392 CWBackPixel | CWBorderPixel | CWColormap,
385 &xattr); 393 &xattr);
386 394
387 /* Set the input hints so we get keyboard input */ 395 /* Set the input hints so we get keyboard input */