From: divverent Date: Tue, 17 Sep 2013 19:38:35 +0000 (+0000) Subject: rename netwmfullscreen to desktopfullscreen; implement in other drivers (except agl) X-Git-Tag: xonotic-v0.8.0~132 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3bcfd24aa96ba851e8ba728a0c5e94dba19d44ad;p=xonotic%2Fdarkplaces.git rename netwmfullscreen to desktopfullscreen; implement in other drivers (except agl) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12005 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=ecfa97404a1e344f1617cca6a22863652cd9774e --- diff --git a/menu.c b/menu.c index d1311ca3..b5270e28 100644 --- a/menu.c +++ b/menu.c @@ -5307,6 +5307,8 @@ static void MP_Draw (void) // FIXME: this really shouldnt error out lest we have a very broken refdef state...? // or does it kill the server too? + PRVM_G_FLOAT(OFS_PARM0) = vid.width; + PRVM_G_FLOAT(OFS_PARM1) = vid.height; prog->ExecuteProgram(prog, PRVM_menufunction(m_draw),"m_draw() required"); // TODO: imo this should be moved into scene, too [1/27/2008 Andreas] diff --git a/vid.h b/vid.h index 650d3223..901c8f71 100644 --- a/vid.h +++ b/vid.h @@ -199,6 +199,7 @@ extern cvar_t vid_touchscreen_showkeyboard; extern cvar_t vid_touchscreen_supportshowkeyboard; extern cvar_t vid_stick_mouse; extern cvar_t vid_resizable; +extern cvar_t vid_desktopfullscreen; extern cvar_t vid_minwidth; extern cvar_t vid_minheight; extern cvar_t vid_sRGB; diff --git a/vid_glx.c b/vid_glx.c index c066555c..b9c72d46 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -129,7 +129,6 @@ static int vid_x11_gammarampsize = 0; cvar_t vid_dgamouse = {CVAR_SAVE, "vid_dgamouse", "0", "make use of DGA mouse input"}; static qboolean vid_usingdgamouse = false; #endif -cvar_t vid_netwmfullscreen = {CVAR_SAVE, "vid_netwmfullscreen", "0", "make use _NET_WM_STATE_FULLSCREEN; turn this off if fullscreen does not work for you"}; qboolean vidmode_ext = false; @@ -138,7 +137,7 @@ static int win_x, win_y; static XF86VidModeModeInfo init_vidmode, game_vidmode; static qboolean vid_isfullscreen = false; static qboolean vid_isvidmodefullscreen = false; -static qboolean vid_isnetwmfullscreen = false; +static qboolean vid_isdesktopfullscreen = false; static qboolean vid_isoverrideredirect = false; static Visual *vidx11_visual; @@ -654,11 +653,11 @@ static void HandleEvents(void) // window changed size/location win_x = event.xconfigure.x; win_y = event.xconfigure.y; - if((vid_resizable.integer < 2 || vid_isnetwmfullscreen) && (vid.width != event.xconfigure.width || vid.height != event.xconfigure.height)) + if((vid_resizable.integer < 2 || vid_isdesktopfullscreen) && (vid.width != event.xconfigure.width || vid.height != event.xconfigure.height)) { vid.width = event.xconfigure.width; vid.height = event.xconfigure.height; - if(vid_isnetwmfullscreen) + if(vid_isdesktopfullscreen) Con_Printf("NetWM fullscreen: actually using resolution %dx%d\n", vid.width, vid.height); else Con_DPrintf("Updating to ConfigureNotify resolution %dx%d\n", vid.width, vid.height); @@ -703,7 +702,7 @@ static void HandleEvents(void) XF86VidModeSetViewPort(vidx11_display, vidx11_screen, 0, 0); } - if(vid_isnetwmfullscreen) + if(vid_isdesktopfullscreen) { // make sure it's fullscreen XEvent event; @@ -745,7 +744,7 @@ static void HandleEvents(void) if (vid_isoverrideredirect) break; - if(vid_isnetwmfullscreen && event.xfocus.mode == NotifyNormal) + if(vid_isdesktopfullscreen && event.xfocus.mode == NotifyNormal) { // iconify netwm fullscreen window when it loses focus // when the user selects it in the taskbar, the window manager will map it again and send MapNotify @@ -866,7 +865,7 @@ void VID_Shutdown(void) vid_hidden = true; vid_isfullscreen = false; - vid_isnetwmfullscreen = false; + vid_isdesktopfullscreen = false; vid_isvidmodefullscreen = false; vid_isoverrideredirect = false; vidx11_display = NULL; @@ -974,7 +973,7 @@ void VID_Init(void) #ifdef USEDGA Cvar_RegisterVariable (&vid_dgamouse); #endif - Cvar_RegisterVariable (&vid_netwmfullscreen); + Cvar_RegisterVariable (&vid_desktopfullscreen); InitSig(); // trap evil signals // COMMANDLINEOPTION: Input: -nomouse disables mouse support (see also vid_mouse cvar) if (COM_CheckParm ("-nomouse")) @@ -1026,7 +1025,7 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) char vabuf[1024]; vid_isfullscreen = false; - vid_isnetwmfullscreen = false; + vid_isdesktopfullscreen = false; vid_isvidmodefullscreen = false; vid_isoverrideredirect = false; @@ -1064,10 +1063,10 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) if (mode->fullscreen) { - if(vid_netwmfullscreen.integer) + if(vid_desktopfullscreen.integer) { // TODO detect WM support - vid_isnetwmfullscreen = true; + vid_isdesktopfullscreen = true; vid_isfullscreen = true; // width and height will be filled in later Con_DPrintf("Using NetWM fullscreen mode\n"); @@ -1151,7 +1150,7 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) if (mode->fullscreen) { - if(vid_isnetwmfullscreen) + if(vid_isdesktopfullscreen) { mask = CWBackPixel | CWColormap | CWSaveUnder | CWBackingStore | CWEventMask; attr.backing_store = NotUseful; @@ -1224,7 +1223,7 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) clshints->res_class = strdup("DarkPlaces"); szhints = XAllocSizeHints(); - if(vid_resizable.integer == 0 && !vid_isnetwmfullscreen) + if(vid_resizable.integer == 0 && !vid_isdesktopfullscreen) { szhints->min_width = szhints->max_width = mode->width; szhints->min_height = szhints->max_height = mode->height; @@ -1326,7 +1325,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) char vabuf[1024]; vid_isfullscreen = false; - vid_isnetwmfullscreen = false; + vid_isdesktopfullscreen = false; vid_isvidmodefullscreen = false; vid_isoverrideredirect = false; @@ -1399,10 +1398,10 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) if (mode->fullscreen) { - if(vid_netwmfullscreen.integer) + if(vid_desktopfullscreen.integer) { // TODO detect WM support - vid_isnetwmfullscreen = true; + vid_isdesktopfullscreen = true; vid_isfullscreen = true; // width and height will be filled in later Con_DPrintf("Using NetWM fullscreen mode\n"); @@ -1486,7 +1485,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) if (mode->fullscreen) { - if(vid_isnetwmfullscreen) + if(vid_isdesktopfullscreen) { mask = CWBackPixel | CWColormap | CWSaveUnder | CWBackingStore | CWEventMask; attr.backing_store = NotUseful; @@ -1559,7 +1558,7 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) clshints->res_class = strdup("DarkPlaces"); szhints = XAllocSizeHints(); - if(vid_resizable.integer == 0 && !vid_isnetwmfullscreen) + if(vid_resizable.integer == 0 && !vid_isdesktopfullscreen) { szhints->min_width = szhints->max_width = mode->width; szhints->min_height = szhints->max_height = mode->height; diff --git a/vid_sdl.c b/vid_sdl.c index 3211eaa1..9fff9613 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1132,11 +1132,12 @@ void Sys_SendKeyEvents( void ) case SDL_VIDEOEXPOSE: break; case SDL_VIDEORESIZE: - if(vid_resizable.integer < 2) + if(vid_resizable.integer < 2 || vid_isfullscreen) { vid.width = event.resize.w; vid.height = event.resize.h; - screen = SDL_SetVideoMode(vid.width, vid.height, video_bpp, video_flags); + if (!vid_isfullscreen) + screen = SDL_SetVideoMode(vid.width, vid.height, video_bpp, video_flags); if (vid_softsurface) { SDL_FreeSurface(vid_softsurface); @@ -2475,9 +2476,16 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) vid_isfullscreen = false; if (mode->fullscreen) { #if SDL_MAJOR_VERSION == 1 + SDL_VideoInfo *vi = SDL_GetVideoInfo(); + mode->width = vi->current_w; + mode->height = vi->current_h; + mode->bitsperpixel = vi->vfmt->BitsPerPixel; flags |= SDL_FULLSCREEN; #else - windowflags |= SDL_WINDOW_FULLSCREEN; + if (vid_desktopfullscreen.integer) + windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + else + windowflags |= SDL_WINDOW_FULLSCREEN; #endif vid_isfullscreen = true; } @@ -2619,9 +2627,16 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) vid_isfullscreen = false; if (mode->fullscreen) { #if SDL_MAJOR_VERSION == 1 + SDL_VideoInfo *vi = SDL_GetVideoInfo(); + mode->width = vi->current_w; + mode->height = vi->current_h; + mode->bitsperpixel = vi->vfmt->BitsPerPixel; flags |= SDL_FULLSCREEN; #else - windowflags |= SDL_WINDOW_FULLSCREEN; + if (vid_desktopfullscreen.integer) + windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + else + windowflags |= SDL_WINDOW_FULLSCREEN; #endif vid_isfullscreen = true; } diff --git a/vid_shared.c b/vid_shared.c index 175c7512..2d6497e5 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -189,6 +189,7 @@ cvar_t vid_touchscreen_showkeyboard = {0, "vid_touchscreen_showkeyboard", "0", " cvar_t vid_touchscreen_supportshowkeyboard = {CVAR_READONLY, "vid_touchscreen_supportshowkeyboard", "0", "indicates if the platform supports a virtual keyboard"}; cvar_t vid_stick_mouse = {CVAR_SAVE, "vid_stick_mouse", "0", "have the mouse stuck in the center of the screen" }; cvar_t vid_resizable = {CVAR_SAVE, "vid_resizable", "0", "0: window not resizable, 1: resizable, 2: window can be resized but the framebuffer isn't adjusted" }; +cvar_t vid_desktopfullscreen = {CVAR_SAVE, "vid_desktopfullscreen", "0", "force desktop resolution for fullscreen; also use some OS dependent tricks for better fullscreen integration"}; cvar_t v_gamma = {CVAR_SAVE, "v_gamma", "1", "inverse gamma correction value, a brightness effect that does not affect white or black, and tends to make the image grey and dull"}; cvar_t v_contrast = {CVAR_SAVE, "v_contrast", "1", "brightness of white (values above 1 give a brighter image with increased color saturation, unlike v_gamma)"}; @@ -1770,6 +1771,7 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_touchscreen_supportshowkeyboard); Cvar_RegisterVariable(&vid_stick_mouse); Cvar_RegisterVariable(&vid_resizable); + Cvar_RegisterVariable(&vid_desktopfullscreen); Cvar_RegisterVariable(&vid_minwidth); Cvar_RegisterVariable(&vid_minheight); Cvar_RegisterVariable(&vid_gl13); diff --git a/vid_wgl.c b/vid_wgl.c index f4279570..fb21fad7 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -1012,7 +1012,15 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) vid_isfullscreen = false; if (fullscreen) { - if(vid_forcerefreshrate.integer) + if(vid_desktopfullscreen.integer) + { + foundmode = true; + gdevmode = initialdevmode; + width = mode->width = gdevmode.dmPelsWidth; + height = mode->height = gdevmode.dmPelsHeight; + bpp = mode->bitsperpixel = gdevmode.dmBitsPerPel; + } + else if(vid_forcerefreshrate.integer) { foundmode = true; gdevmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;