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;
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;
// 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);
XF86VidModeSetViewPort(vidx11_display, vidx11_screen, 0, 0);
}
- if(vid_isnetwmfullscreen)
+ if(vid_isdesktopfullscreen)
{
// make sure it's fullscreen
XEvent event;
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
vid_hidden = true;
vid_isfullscreen = false;
- vid_isnetwmfullscreen = false;
+ vid_isdesktopfullscreen = false;
vid_isvidmodefullscreen = false;
vid_isoverrideredirect = false;
vidx11_display = NULL;
#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"))
char vabuf[1024];
vid_isfullscreen = false;
- vid_isnetwmfullscreen = false;
+ vid_isdesktopfullscreen = false;
vid_isvidmodefullscreen = false;
vid_isoverrideredirect = false;
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");
if (mode->fullscreen)
{
- if(vid_isnetwmfullscreen)
+ if(vid_isdesktopfullscreen)
{
mask = CWBackPixel | CWColormap | CWSaveUnder | CWBackingStore | CWEventMask;
attr.backing_store = NotUseful;
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;
char vabuf[1024];
vid_isfullscreen = false;
- vid_isnetwmfullscreen = false;
+ vid_isdesktopfullscreen = false;
vid_isvidmodefullscreen = false;
vid_isoverrideredirect = false;
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");
if (mode->fullscreen)
{
- if(vid_isnetwmfullscreen)
+ if(vid_isdesktopfullscreen)
{
mask = CWBackPixel | CWColormap | CWSaveUnder | CWBackingStore | CWEventMask;
attr.backing_store = NotUseful;
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;
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);
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;
}
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;
}
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)"};
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);