fs = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1)));
- if(nr < 0 || nr >= (fs ? video_resolutions_count : video_resolutions_hardcoded_count))
+ if(nr < -1 || nr >= (fs ? video_resolutions_count : video_resolutions_hardcoded_count))
{
PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
}
+ else if(nr == -1)
+ {
+ vid_mode_t *m = VID_GetDesktopMode();
+ if (m)
+ {
+ PRVM_G_VECTOR(OFS_RETURN)[0] = m->width;
+ PRVM_G_VECTOR(OFS_RETURN)[1] = m->height;
+ PRVM_G_VECTOR(OFS_RETURN)[2] = m->pixelheight_num / (prvm_vec_t) m->pixelheight_denom;
+ }
+ else
+ {
+ PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
+ PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
+ PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
+ }
+ }
else
{
video_resolution_t *r = &((fs ? video_resolutions : video_resolutions_hardcoded)[nr]);
int pixelheight_num, pixelheight_denom;
}
vid_mode_t;
+vid_mode_t *VID_GetDesktopMode(void);
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount);
size_t VID_SortModes(vid_mode_t *modes, size_t count, qboolean usebpp, qboolean userefreshrate, qboolean useaspect);
void VID_Soft_SharedSetup(void);
return value;
}
+vid_mode_t *VID_GetDesktopMode(void)
+{
+ return NULL; // FIXME add desktopfullscreen
+}
+
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
{
CGDirectDisplayID mainDisplay = CGMainDisplayID();
static qboolean vid_isdesktopfullscreen = false;
static qboolean vid_isoverrideredirect = false;
+static vid_mode_t desktop_mode;
static Visual *vidx11_visual;
static Colormap vidx11_colormap;
vidx11_screen = DefaultScreen(vidx11_display);
root = RootWindow(vidx11_display, vidx11_screen);
+ desktop_mode.width = DisplayWidth(vidx11_display, vidx11_screen);
+ desktop_mode.height = DisplayHeight(vidx11_display, vidx11_screen);
+ desktop_mode.bpp = DefaultDepth(vidx11_display, vidx11_screen);
+ desktop_mode.refreshrate = 60; // FIXME
+ desktop_mode.pixelheight_num = 1; // FIXME
+ desktop_mode.pixelheight_denom = 1; // FIXME
+
// Get video mode list
MajorVersion = MinorVersion = 0;
if (!XF86VidModeQueryVersion(vidx11_display, &MajorVersion, &MinorVersion))
vidx11_screen = DefaultScreen(vidx11_display);
root = RootWindow(vidx11_display, vidx11_screen);
+ desktop_mode.width = DisplayWidth(vidx11_display, vidx11_screen);
+ desktop_mode.height = DisplayHeight(vidx11_display, vidx11_screen);
+ desktop_mode.bpp = DefaultDepth(vidx11_display, vidx11_screen);
+ desktop_mode.refreshrate = 60; // FIXME
+ desktop_mode.pixelheight_num = 1; // FIXME
+ desktop_mode.pixelheight_denom = 1; // FIXME
+
// Get video mode list
MajorVersion = MinorVersion = 0;
if (!XF86VidModeQueryVersion(vidx11_display, &MajorVersion, &MinorVersion))
VID_ApplyJoyState(&joystate);
}
+vid_mode_t *VID_GetDesktopMode(void)
+{
+ return &desktop_mode;
+}
+
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
{
if(vidmode_ext)
{
}
+vid_mode_t *VID_GetDesktopMode(void)
+{
+ return NULL;
+}
+
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
{
return 0;
static int window_flags;
#endif
static SDL_Surface *vid_softsurface;
+static vid_mode_t desktop_mode;
/////////////////////////
// Input handling
// Knghtbrd: should do platform-specific extension string function here
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;
+ desktop_mode.width = vi->current_w;
+ desktop_mode.height = vi->current_h;
+ desktop_mode.bpp = vi->vfmt->BitsPerPixel;
+ desktop_mode.pixelheight_num = 1;
+ desktop_mode.pixelheight_denom = 1; // SDL does not provide this
+ if (mode->fullscreen) {
+ if (vid_desktopfullscreen.integer)
+ {
+ mode->width = vi->current_w;
+ mode->height = vi->current_h;
+ mode->bitsperpixel = vi->vfmt->BitsPerPixel;
+ }
+ flags |= SDL_FULLSCREEN;
+ vid_isfullscreen = true;
+ }
+ }
#else
- if (vid_desktopfullscreen.integer)
- windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
- else
- windowflags |= SDL_WINDOW_FULLSCREEN;
-#endif
- vid_isfullscreen = true;
+ {
+ if (mode->fullscreen) {
+ if (vid_desktopfullscreen.integer)
+ windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+ else
+ windowflags |= SDL_WINDOW_FULLSCREEN;
+ vid_isfullscreen = true;
+ }
}
+#endif
//flags |= SDL_HWSURFACE;
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
}
}
+vid_mode_t *VID_GetDesktopMode(void)
+{
+#if SDL_MAJOR_VERSION != 1
+ SDL_DisplayMode mode;
+ int bpp;
+ Uint32 rmask, gmask, bmask, amask;
+ SDL_GetDesktopDisplayMode(0, &mode);
+ SDL_PixelFormatEnumToMasks(mode.format, &bpp, &rmask, &gmask, &bmask, &amask);
+ modes[k].width = mode.w;
+ modes[k].height = mode.h;
+ modes[k].bpp = bpp;
+ modes[k].refreshrate = mode.refreshrate;
+ modes[k].pixelheight_num = 1;
+ modes[k].pixelheight_denom = 1; // SDL does not provide this
+#endif
+ return &desktop_mode;
+}
+
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
{
size_t k = 0;
continue;
modes[k].width = mode.w;
modes[k].height = mode.h;
+ // FIXME bpp?
modes[k].refreshrate = mode.refresh_rate;
modes[k].pixelheight_num = 1;
- modes[k].pixelheight_num = 1;
modes[k].pixelheight_denom = 1; // SDL does not provide this
k++;
}
};
static DEVMODE gdevmode, initialdevmode;
+static vid_mode_t desktop_mode;
static qboolean vid_initialized = false;
static qboolean vid_wassuspended = false;
static qboolean vid_usingmouse = false;
memset(&initialdevmode, 0, sizeof(initialdevmode));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &initialdevmode);
+ desktop_mode.width = initialdevmode.dmPelsWidth;
+ desktop_mode.height = initialdevmode.dmPelsHeight;
+ desktop_mode.bpp = initialdevmode.dmBitsPerPel;
+ desktop_mode.refreshrate = initialdevmode.dmDisplayFrequency;
+ desktop_mode.pixelheight_num = 1;
+ desktop_mode.pixelheight_denom = 1; // Win32 apparently does not provide this (FIXME)
+
IN_Init();
}
#endif
}
+Vid_mode_t *VID_GetDesktopMode(void)
+{
+ return &desktop_mode;
+}
+
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
{
int i;