From 455faeb1bee79f41a289ae5ccd4c064cf5945233 Mon Sep 17 00:00:00 2001 From: molivier Date: Tue, 27 Jan 2004 08:12:54 +0000 Subject: [PATCH] Don't allow a higher depth than the desktop when using a windowed mode on Win32. It seems X11 already forbids this. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3840 d7cf8633-e32d-0410-b094-e92efae38249 --- vid_wgl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vid_wgl.c b/vid_wgl.c index 0448ba64..fed809b0 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -751,6 +751,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) HGLRC baseRC; int CenterX, CenterY; const char *gldrivername; + int depth; if (vid_initialized) Sys_Error("VID_InitMode called when video is already initialised\n"); @@ -802,6 +803,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) { hdc = GetDC (NULL); i = GetDeviceCaps(hdc, RASTERCAPS); + depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); ReleaseDC (NULL, hdc); if (i & RC_PALETTE) { @@ -809,6 +811,12 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) Con_Printf ("Can't run in non-RGB mode\n"); return false; } + if (bpp > depth) + { + VID_Shutdown(); + Con_Printf ("A higher desktop depth is required to run this video mode\n"); + return false; + } WindowStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; ExWindowStyle = 0; -- 2.39.2