diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 5526bf48b6..c6e55a6c7f 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1380,10 +1380,9 @@ struct ModifierKeyToggleWindow : Window { this->SetDirty(); } - EventState OnCTRLStateChange() override + void OnCTRLStateChangeAlways() override { this->UpdateButtons(); - return ES_NOT_HANDLED; } void OnShiftStateChange() override diff --git a/src/window.cpp b/src/window.cpp index 1d7a371428..92dc9981d3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2748,7 +2748,11 @@ void HandleCtrlChanged() /* Call the event, start with the uppermost window. */ Window *w; FOR_ALL_WINDOWS_FROM_FRONT(w) { - if (w->OnCTRLStateChange() == ES_HANDLED) return; + if (w->OnCTRLStateChange() == ES_HANDLED) break; + w->OnCTRLStateChangeAlways(); + } + FOR_ALL_WINDOWS_FROM_FRONT_FROM(w, w) { + w->OnCTRLStateChangeAlways(); } } diff --git a/src/window_gui.h b/src/window_gui.h index b79d617395..6cfbc8fb83 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -667,6 +667,11 @@ public: */ virtual EventState OnCTRLStateChange() { return ES_NOT_HANDLED; } + /** + * The state of the control key has changed, this is sent even if an OnCTRLStateChange handler has return ES_HANDLED + */ + virtual void OnCTRLStateChangeAlways() {} + /** * The state of the shift key has changed */