...
 
Commits (2)
...@@ -1063,16 +1063,6 @@ boolean CON_Responder(event_t *ev) ...@@ -1063,16 +1063,6 @@ boolean CON_Responder(event_t *ev)
else if (key == KEY_KPADSLASH) else if (key == KEY_KPADSLASH)
key = '/'; key = '/';
// capslock
if (key == KEY_CAPSLOCK) // it's a toggle.
{
if (capslock)
capslock = false;
else
capslock = true;
return true;
}
if (key >= 'a' && key <= 'z') if (key >= 'a' && key <= 'z')
{ {
if (capslock ^ shiftdown) if (capslock ^ shiftdown)
......
...@@ -176,37 +176,11 @@ void D_PostEvent_end(void) {}; ...@@ -176,37 +176,11 @@ void D_PostEvent_end(void) {};
#endif #endif
// modifier keys // modifier keys
// Now handled in I_OsPolling
UINT8 shiftdown = 0; // 0x1 left, 0x2 right UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does. boolean capslock = 0; // gee i wonder what this does.
//
// D_ModifierKeyResponder
// Sets global shift/ctrl/alt variables, never actually eats events
//
static inline void D_ModifierKeyResponder(event_t *ev)
{
if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown |= 0x1; return;
case KEY_RSHIFT: shiftdown |= 0x2; return;
case KEY_LCTRL: ctrldown |= 0x1; return;
case KEY_RCTRL: ctrldown |= 0x2; return;
case KEY_LALT: altdown |= 0x1; return;
case KEY_RALT: altdown |= 0x2; return;
default: return;
}
else if (ev->type == ev_keyup) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown &= ~0x1; return;
case KEY_RSHIFT: shiftdown &= ~0x2; return;
case KEY_LCTRL: ctrldown &= ~0x1; return;
case KEY_RCTRL: ctrldown &= ~0x2; return;
case KEY_LALT: altdown &= ~0x1; return;
case KEY_RALT: altdown &= ~0x2; return;
default: return;
}
}
// //
// D_ProcessEvents // D_ProcessEvents
...@@ -220,9 +194,6 @@ void D_ProcessEvents(void) ...@@ -220,9 +194,6 @@ void D_ProcessEvents(void)
{ {
ev = &events[eventtail]; ev = &events[eventtail];
// Set global shift/ctrl/alt down variables
D_ModifierKeyResponder(ev); // never eats events
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
......
...@@ -1101,16 +1101,6 @@ boolean HU_Responder(event_t *ev) ...@@ -1101,16 +1101,6 @@ boolean HU_Responder(event_t *ev)
c = (INT32)ev->data1; c = (INT32)ev->data1;
// capslock (now handled outside of chat on so that it works everytime......)
if (c && c == KEY_CAPSLOCK) // it's a toggle.
{
if (capslock)
capslock = false;
else
capslock = true;
return true;
}
#ifndef NONET #ifndef NONET
if (!chat_on) if (!chat_on)
{ {
......
...@@ -580,8 +580,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) ...@@ -580,8 +580,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
if (cv_usemouse.value) I_StartupMouse(); if (cv_usemouse.value) I_StartupMouse();
} }
//else firsttimeonmouse = SDL_FALSE; //else firsttimeonmouse = SDL_FALSE;
capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
} }
else if (!mousefocus && !kbfocus) else if (!mousefocus && !kbfocus)
{ {
...@@ -939,6 +937,8 @@ void I_StartupMouse(void) ...@@ -939,6 +937,8 @@ void I_StartupMouse(void)
// //
void I_OsPolling(void) void I_OsPolling(void)
{ {
SDL_Keymod mod;
if (consolevent) if (consolevent)
I_GetConsoleEvents(); I_GetConsoleEvents();
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
...@@ -951,6 +951,18 @@ void I_OsPolling(void) ...@@ -951,6 +951,18 @@ void I_OsPolling(void)
I_GetMouseEvents(); I_GetMouseEvents();
I_GetEvent(); I_GetEvent();
mod = SDL_GetModState();
/* Handle here so that our state is always synched with the system. */
shiftdown = ctrldown = altdown = 0;
capslock = false;
if (mod & KMOD_LSHIFT) shiftdown |= 1;
if (mod & KMOD_RSHIFT) shiftdown |= 2;
if (mod & KMOD_LCTRL) ctrldown |= 1;
if (mod & KMOD_RCTRL) ctrldown |= 2;
if (mod & KMOD_LALT) altdown |= 1;
if (mod & KMOD_RALT) altdown |= 2;
if (mod & KMOD_CAPS) capslock = true;
} }
// //
......