From: molivier Date: Tue, 27 Jan 2004 08:12:54 +0000 (+0000) Subject: Don't allow a higher depth than the desktop when using a windowed mode on Win32.... X-Git-Tag: xonotic-v0.1.0preview~6145 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=455faeb1bee79f41a289ae5ccd4c064cf5945233;p=xonotic%2Fdarkplaces.git 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 --- 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;