Commit 369b7d53 authored by divverent's avatar divverent Committed by Rudolf Polzer

Manage resetting the key event state on video reinitialization centrally.

Fixes:
- No key state clear when SDL gets restarted.
- Key state clear was the wrong action - it allows all keys to get pressed
  again, but does not actually release anything in cl_input.c, so e.g. +jump
  binds stay pressed on vid_restart.

Only vid_wgl.c retains some vid-specific handling (reset of key state when
alt-tabbing out and back in) - there's a chance that we may need similar logic
in the other vid drivers; if so, it may be possible to do this in a shared
place too by watching for changes to vid_activewindow.

git-svn-id: svn://svn.icculus.org/twilight/trunk/[email protected] d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=23fba558
parent e890af00
......@@ -1989,14 +1989,3 @@ Key_ReleaseAll (void)
// now all keys are guaranteed down (once the event queue is unblocked)
// and only future events count
}
/*
===================
Key_ClearStates
===================
*/
void
Key_ClearStates (void)
{
memset(keydown, 0, sizeof(keydown));
}
......@@ -378,7 +378,6 @@ void Key_Shutdown(void);
void Key_Init_Cvars(void);
void Key_Event(int key, int ascii, qboolean down);
void Key_ReleaseAll (void);
void Key_ClearStates (void); // FIXME: should this function still exist? Or should Key_ReleaseAll be used instead when shutting down a vid driver?
void Key_EventQueue_Block(void);
void Key_EventQueue_Unblock(void);
......
......@@ -361,7 +361,6 @@ void VID_Shutdown(void)
vid_isfullscreen = false;
GL_CloseLibrary();
Key_ClearStates ();
}
// Since the event handler can be called at any time, we store the events for later processing
......
......@@ -881,7 +881,6 @@ void VID_Shutdown(void)
ctx = NULL;
GL_CloseLibrary();
Key_ClearStates ();
}
static void signal_handler(int sig)
......
......@@ -1850,6 +1850,7 @@ static int VID_Mode(int fullscreen, int width, int height, int bpp, float refres
static void VID_OpenSystems(void)
{
Key_ReleaseAll();
R_Modules_Start();
S_Startup();
}
......@@ -1858,6 +1859,7 @@ static void VID_CloseSystems(void)
{
S_Shutdown();
R_Modules_Shutdown();
Key_ReleaseAll();
}
qboolean vid_commandlinecheck = true;
......
......@@ -429,7 +429,7 @@ ClearAllStates
*/
static void ClearAllStates (void)
{
Key_ClearStates ();
Key_ReleaseAll();
if (vid_usingmouse)
mouse_oldbuttonstate = 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment