]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
rename netwmfullscreen to desktopfullscreen; implement in other drivers (except agl)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Sep 2013 19:38:35 +0000 (19:38 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Sep 2013 19:38:35 +0000 (19:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12005 d7cf8633-e32d-0410-b094-e92efae38249

menu.c
vid.h
vid_glx.c
vid_sdl.c
vid_shared.c
vid_wgl.c

diff --git a/menu.c b/menu.c
index d1311ca35d85823bd840614e3b2b6fd02e1ec136..b5270e285096a52f2fa33db0ee9d6e7ee2258daf 100644 (file)
--- 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 650d322358d859905f999e94a0ef0176d7c560ff..901c8f716807cac95a2cbadad0e5b3583b3b01c5 100644 (file)
--- 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;
index c066555cd12b19ada0a9f026fb7f86d89ae0c6ae..b9c72d46e5197ac6c0acb8eed348ab253681bcaf 100644 (file)
--- 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;
index 3211eaa17f55814a48b5dfdbdd9d800a5c6392a3..9fff961384005f85c53818c1a6a25c1f7214a9c7 100644 (file)
--- 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;
        }
index 175c75122ecca2130e8a142b9cec15751163cdfe..2d6497e508e80efe14cc1517f5ec7a1286e2af2f 100644 (file)
@@ -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);
index f427957024fdf9bb50735e2f58dbf4836867ac81..fb21fad7db2ffae31036674e654891dbb44c2daa 100644 (file)
--- 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;