Feature: Make news and errors close hotkeys configurable

This commit is contained in:
dP
2020-07-05 21:18:35 +03:00
committed by Michael Lutz
parent 8f3d1ec970
commit 0110fa12da
5 changed files with 40 additions and 18 deletions

View File

@@ -315,13 +315,6 @@ public:
if (_window_system_initialized) ShowFirstError();
}
EventState OnKeyPress(WChar key, uint16 keycode) override
{
if (keycode != WKC_SPACE) return ES_NOT_HANDLED;
delete this;
return ES_HANDLED;
}
/**
* Check whether the currently shown error message was critical or not.
* @return True iff the message was critical.
@@ -424,6 +417,18 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
}
}
/**
* Close active error message window
* @return true if a window was closed.
*/
bool HideActiveErrorMessage() {
ErrmsgWindow *w = (ErrmsgWindow*)FindWindowById(WC_ERRMSG, 0);
if (w == nullptr) return false;
delete w;
return true;
}
/**
* Schedule a list of errors.
* Note: This does not try to display the error now. This is useful if the window system is not yet running.