Fix #671 - DemoWorld idle timer reset.
Fix the issue at the source. Instead of only reacting on GUI events, catch GUI, mousy, key and joystick events and reset the timer on any of them. Only then we're sure that mouse/keyboard/joystick movement definitely resets the timer. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11403 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
6708d2c31e
commit
790f1b2bde
@ -122,7 +122,18 @@ bool EventHandler::OnEvent (const SEvent &event)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// We do this (seemingly) overzealously to make sure that:
|
||||
// 1. It resets on any GUI events
|
||||
// 2. It resets on any mouse/joystick movement
|
||||
// 3. It resets on any keyboard presses
|
||||
if ((StateManager::get()->getGameState() == MENU)
|
||||
&& (event.EventType != EET_LOG_TEXT_EVENT )
|
||||
&& (event.EventType != EET_USER_EVENT ))
|
||||
{
|
||||
DemoWorld::resetIdleTime();
|
||||
}
|
||||
|
||||
if (event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
return onGUIEvent(event) == EVENT_BLOCK;
|
||||
@ -140,7 +151,7 @@ bool EventHandler::OnEvent (const SEvent &event)
|
||||
// Remember the mouse position
|
||||
m_mouse_pos.X = event.MouseInput.X;
|
||||
m_mouse_pos.Y = event.MouseInput.Y;
|
||||
|
||||
|
||||
// Notify the profiler of mouse events
|
||||
if(UserConfigParams::m_profiler_enabled &&
|
||||
event.EventType == EET_MOUSE_INPUT_EVENT &&
|
||||
@ -156,7 +167,8 @@ bool EventHandler::OnEvent (const SEvent &event)
|
||||
World::getWorld()->onMouseClick(event.MouseInput.X, event.MouseInput.Y);
|
||||
}
|
||||
|
||||
// FIXME? it may be a bit unclean that all input events go trough the gui module
|
||||
// FIXME? it may be a bit unclean that all input events go trough
|
||||
// the gui module
|
||||
const EventPropagation blockPropagation = input_manager->input(event);
|
||||
return blockPropagation == EVENT_BLOCK;
|
||||
}
|
||||
@ -658,8 +670,6 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
||||
if (event.GUIEvent.Caller == NULL) return EVENT_LET;
|
||||
const s32 id = event.GUIEvent.Caller->getID();
|
||||
|
||||
DemoWorld::resetIdleTime();
|
||||
|
||||
switch (event.GUIEvent.EventType)
|
||||
{
|
||||
case EGET_BUTTON_CLICKED:
|
||||
|
Loading…
x
Reference in New Issue
Block a user