]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_wgl.c
Don't allow a higher depth than the desktop when using a windowed mode on Win32....
[xonotic/darkplaces.git] / vid_wgl.c
index 2f98be1f892a09de617dceec9834be36167f3ee6..fed809b0213e54ab80464d69ffe83b00f98a6fc8 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "resource.h"
 #include <commctrl.h>
 
+// Tell startup code that we have a client
 int cl_available = true;
 
 int (WINAPI *qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *);
@@ -431,14 +432,6 @@ ClearAllStates
 */
 void ClearAllStates (void)
 {
-       int             i;
-
-// send an up event for each key, to make sure the server clears them all
-       for (i=0 ; i<256 ; i++)
-       {
-               Key_Event (i, 0, false);
-       }
-
        Key_ClearStates ();
        IN_ClearStates ();
 }
@@ -476,7 +469,6 @@ void AppActivate(BOOL fActive, BOOL minimize)
 
        if (fActive)
        {
-               vid_allowhwgamma = true;
                if (vid_isfullscreen)
                {
                        if (vid_wassuspended)
@@ -493,7 +485,6 @@ void AppActivate(BOOL fActive, BOOL minimize)
 
        if (!fActive)
        {
-               vid_allowhwgamma = false;
                vid_usingmouse = false;
                IN_DeactivateMouse ();
                IN_ShowMouse ();
@@ -760,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");
@@ -811,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)
                {
@@ -818,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;
@@ -1323,7 +1322,7 @@ void IN_MouseMove (usercmd_t *cmd)
        if (!mouseactive)
        {
                GetCursorPos (&current_pos);
-               ui_mouseupdate(current_pos.x - window_x, current_pos.y - window_y);
+               //ui_mouseupdate(current_pos.x - window_x, current_pos.y - window_y);
                in_mouse_x = in_mouse_y = 0;
                return;
        }