Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11video.c @ 1659:14717b52abc0 SDL-1.3
Merge trunk-1.3-3
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 17 May 2006 08:18:28 +0000 |
parents | e49147870aac |
children | 782fd950bd46 |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c Mon May 01 06:58:33 2006 +0000 +++ b/src/video/x11/SDL_x11video.c Wed May 17 08:18:28 2006 +0000 @@ -197,7 +197,7 @@ (((e->error_code == BadRequest)&&(e->request_code == vm_error)) || ((e->error_code > vm_error) && (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) { -#ifdef XFREE86_DEBUG +#ifdef X11_DEBUG { char errmsg[1024]; XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); printf("VidMode error: %s\n", errmsg); @@ -212,7 +212,7 @@ if ( (dga_error >= 0) && ((e->error_code > dga_error) && (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { -#ifdef XFREE86_DEBUG +#ifdef X11_DEBUG { char errmsg[1024]; XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); printf("DGA error: %s\n", errmsg); @@ -244,7 +244,7 @@ static int (*Xext_handler)(Display *, _Xconst char *, _Xconst char *) = NULL; static int xext_errhandler(Display *d, _Xconst char *ext, _Xconst char *reason) { -#ifdef XFREE86_DEBUG +#ifdef X11_DEBUG printf("Xext error inside SDL (may be harmless):\n"); printf(" Extension \"%s\" %s on display \"%s\".\n", ext, reason, XDisplayString(d)); @@ -310,18 +310,14 @@ /* Create auxiliary (toplevel) windows with the current visual */ static void create_aux_windows(_THIS) { - Atom _NET_WM_NAME; - Atom _NET_WM_ICON_NAME; + int x = 0, y = 0; char classname[1024]; XSetWindowAttributes xattr; XWMHints *hints; - XTextProperty titleprop, titlepropUTF8, iconprop, iconpropUTF8; int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen)); /* Look up some useful Atoms */ WM_DELETE_WINDOW = XInternAtom(SDL_Display, "WM_DELETE_WINDOW", False); - _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False); - _NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); /* Don't create any extra windows if we are being managed */ if ( SDL_windowid ) { @@ -333,13 +329,19 @@ if(FSwindow) XDestroyWindow(SDL_Display, FSwindow); +#if SDL_VIDEO_DRIVER_X11_VIDMODE + if ( use_xinerama ) { + x = xinerama_info.x_org; + y = xinerama_info.y_org; + } +#endif xattr.override_redirect = True; xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0; xattr.border_pixel = 0; xattr.colormap = SDL_XColorMap; FSwindow = XCreateWindow(SDL_Display, SDL_Root, - xinerama_x, xinerama_y, 32, 32, 0, + x, y, 32, 32, 0, this->hidden->depth, InputOutput, SDL_Visual, CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap, @@ -365,21 +367,16 @@ } hints = NULL; - titleprop.value = titlepropUTF8.value = NULL; - iconprop.value = iconpropUTF8.value = NULL; if(WMwindow) { /* All window attributes must survive the recreation */ hints = XGetWMHints(SDL_Display, WMwindow); - XGetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); - XGetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); - XGetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); - XGetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); XDestroyWindow(SDL_Display, WMwindow); } /* Create the window for windowed management */ /* (reusing the xattr structure above) */ - WMwindow = XCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0, + WMwindow = XCreateWindow(SDL_Display, SDL_Root, + x, y, 32, 32, 0, this->hidden->depth, InputOutput, SDL_Visual, CWBackPixel | CWBorderPixel | CWColormap, &xattr); @@ -392,22 +389,7 @@ } XSetWMHints(SDL_Display, WMwindow, hints); XFree(hints); - if(titleprop.value) { - XSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); - XFree(titleprop.value); - } - if(titlepropUTF8.value) { - XSetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME); - XFree(titlepropUTF8.value); - } - if(iconprop.value) { - XSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); - XFree(iconprop.value); - } - if(iconpropUTF8.value) { - XSetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME); - XFree(iconpropUTF8.value); - } + X11_SetCaptionNoLock(this, this->wm_title, this->wm_icon); XSelectInput(SDL_Display, WMwindow, FocusChangeMask | KeyPressMask | KeyReleaseMask @@ -562,6 +544,10 @@ } X11_SaveVidModeGamma(this); + /* Save DPMS and screensaver settings */ + X11_SaveScreenSaver(SDL_Display, &screensaver_timeout, &dpms_enabled); + X11_DisableScreenSaver(SDL_Display); + /* See if we have been passed a window to use */ SDL_windowid = SDL_getenv("SDL_WINDOWID"); @@ -1382,11 +1368,15 @@ SDL_free(SDL_iconcolors); SDL_iconcolors = NULL; } + /* Restore gamma settings if they've changed */ if ( SDL_GetAppState() & SDL_APPACTIVE ) { X11_SwapVidModeGamma(this); } + /* Restore DPMS and screensaver settings */ + X11_RestoreScreenSaver(SDL_Display, screensaver_timeout, dpms_enabled); + /* Free that blank cursor */ if ( SDL_BlankCursor != NULL ) { this->FreeWMCursor(this, SDL_BlankCursor);