diff --git a/src/Screen.cpp b/src/Screen.cpp index ba91803110..5dde427fa0 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -167,12 +167,22 @@ void Screen::Update( float fDeltaTime ) } } -/* ScreenManager sends input here first. Overlay screens can use it to get a first - * pass at input. Return true if the input was handled and should not be passed - * to lower screens, or false if not handled. If true is returned, Input() will - * not be called, either. Normal screens should not overload this function. */ +/* ScreenManager sends input here if the screen is an overlay. Overlay screens + * can use it to get a first pass at input. Returns true if the input was + * handled and should not be passed to lower screens, or false if not handled. + * If true is returned, neither OverlayInput() nor Input() will not be called + * for any screen lower on the stack. Normal screens should not overload this + * function. */ bool Screen::OverlayInput( const InputEventPlus &input ) { + // Allow overlays to respond to codes + Message msg(""); + if( m_Codes.InputMessage(input, msg) ) + { + this->HandleMessage( msg ); + return true; + } + return false; } diff --git a/src/ScreenDebugOverlay.cpp b/src/ScreenDebugOverlay.cpp index 0e6eeb29b5..485d6d1165 100644 --- a/src/ScreenDebugOverlay.cpp +++ b/src/ScreenDebugOverlay.cpp @@ -498,7 +498,7 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input ) } } - return false; + return Screen::OverlayInput(input); } diff --git a/src/ScreenInstallOverlay.cpp b/src/ScreenInstallOverlay.cpp index 03f9651b5a..0bdac59ee7 100644 --- a/src/ScreenInstallOverlay.cpp +++ b/src/ScreenInstallOverlay.cpp @@ -326,7 +326,7 @@ bool ScreenInstallOverlay::OverlayInput( const InputEventPlus &input ) } */ - return false; + return Screen::OverlayInput(input); } void ScreenInstallOverlay::Update( float fDeltaTime ) diff --git a/src/ScreenSyncOverlay.cpp b/src/ScreenSyncOverlay.cpp index f8580fde21..263f01bd78 100644 --- a/src/ScreenSyncOverlay.cpp +++ b/src/ScreenSyncOverlay.cpp @@ -155,10 +155,10 @@ static LocalizedString SYNC_CHANGES_REVERTED ("ScreenSyncOverlay","Sync changes bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) { if( !IsGameplay() ) - return false; + return Screen::OverlayInput(input); if( input.DeviceI.device != DEVICE_KEYBOARD ) - return false; + return Screen::OverlayInput(input); enum Action { @@ -186,7 +186,7 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) break; default: - return false; + return Screen::OverlayInput(input); } if( GAMESTATE->IsCourseMode() && a != ChangeGlobalOffset ) @@ -198,11 +198,8 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input ) switch( a ) { case RevertSyncChanges: - switch( input.type ) - { - case IET_FIRST_PRESS: break; - default: return false; - } + if( input.type != IET_FIRST_PRESS ) + return false; SCREENMAN->SystemMessage( SYNC_CHANGES_REVERTED ); AdjustSync::RevertSyncChanges(); break;