From 4be7a38446ddfede5ef88eda36c0e8c2e503ae49 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 15 Jan 2003 02:12:45 +0000 Subject: [PATCH] don't send spurious events for global keys --- stepmania/src/StepMania.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index c4303c4cbb..184bb6a573 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -321,8 +321,9 @@ static void HandleInputEvents(float fDeltaTime) DeviceInput DeviceI = (DeviceInput)ieArray[i]; InputEventType type = ieArray[i].type; - if(type == IET_FIRST_PRESS && DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F4)) + if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F4)) { + if(type != IET_FIRST_PRESS) continue; if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RALT)) || INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LALT)) ) { @@ -339,34 +340,32 @@ static void HandleInputEvents(float fDeltaTime) PREFSMAN->m_bWindowed = !PREFSMAN->m_bWindowed; ApplyGraphicOptions(); continue; - /* why fall through? other code shouldn't be using - * globally-bound keys -glenn */ - /* you're right. -Chris */ } } - else if( type == IET_FIRST_PRESS && DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) + else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) { + if(type != IET_FIRST_PRESS) continue; + // pressed F5. Toggle detail. if(PREFSMAN->m_iDisplayWidth != 640) { PREFSMAN->m_iDisplayWidth = 640; PREFSMAN->m_iDisplayHeight = 480; - ApplyGraphicOptions(); } else { PREFSMAN->m_iDisplayWidth = 320; PREFSMAN->m_iDisplayHeight = 240; - ApplyGraphicOptions(); } - + ApplyGraphicOptions(); } - if(type == IET_FIRST_PRESS && DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_RETURN)) + if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_RETURN)) { if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RALT)) || INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LALT)) ) { + if(type != IET_FIRST_PRESS) continue; /* alt-enter */ PREFSMAN->m_bWindowed = !PREFSMAN->m_bWindowed; ApplyGraphicOptions();