]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_wgl.c
changed most Sys_Error calls to Con_Printf with appropriate error returns
[xonotic/darkplaces.git] / vid_wgl.c
index 4c36b9a0f3edef63490f0445e2e66f28ba757dcd..0adee1c6c485435294a29aa1f71e51fd0923d8de 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -474,6 +474,7 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
        char    state[256];
        char    asciichar[4];
        int             vkey;
+       int             charlength;
        qboolean down = false;
 
        if ( uMsg == uiWheelMessage )
@@ -504,8 +505,12 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                        GetKeyboardState (state);
                        // alt/ctrl/shift tend to produce funky ToAscii values,
                        // and if it's not a single character we don't know care about it
-                       if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0) != 1)
+                       charlength = ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0);
+                       if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || charlength == 0)
                                asciichar[0] = 0;
+                       else if( charlength == 2 ) {
+                               asciichar[0] = asciichar[1];
+                       }
                        Key_Event (vkey, asciichar[0], down);
                        break;
 
@@ -690,7 +695,7 @@ void VID_Init(void)
        wc.lpszClassName = "DarkPlacesWindowClass";
 
        if (!RegisterClass (&wc))
-               Sys_Error("Couldn't register window class\n");
+               Con_Printf ("Couldn't register window class\n");
 
        IN_Init();
 }