mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r15669) -Change: Key presses that are not handles by an input box are no longer marked as handled but given to other OnKeyPress handlers. This makes the global shortcuts like F1 work again when an input box is open.
This commit is contained in:
parent
13fb01d07d
commit
2b0b9a6367
src
@ -993,8 +993,8 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key
|
||||
default:
|
||||
if (IsValidChar(key, this->afilter)) {
|
||||
if (InsertTextBufferChar(&this->text, key)) w->InvalidateWidget(wid);
|
||||
} else { // key wasn't caught. Continue only if standard entry specified
|
||||
state = (this->afilter == CS_ALPHANUMERAL) ? Window::ES_HANDLED : Window::ES_NOT_HANDLED;
|
||||
} else {
|
||||
state = Window::ES_NOT_HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1134,7 +1134,7 @@ struct QueryStringWindow : public QueryStringBaseWindow
|
||||
|
||||
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
||||
{
|
||||
EventState state;
|
||||
EventState state = ES_NOT_HANDLED;
|
||||
switch (this->HandleEditBoxKey(QUERY_STR_WIDGET_TEXT, key, keycode, state)) {
|
||||
default: NOT_REACHED();
|
||||
case HEBR_EDITING: {
|
||||
|
@ -1927,7 +1927,7 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
|
||||
|
||||
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
|
||||
{
|
||||
EventState state;
|
||||
EventState state = ES_NOT_HANDLED;
|
||||
switch (this->HandleEditBoxKey(4, key, keycode, state)) {
|
||||
default: break;
|
||||
|
||||
|
@ -1750,8 +1750,7 @@ void HandleKeypress(uint32 raw_key)
|
||||
/* Check if the focused window has a focused editbox */
|
||||
if (EditBoxInGlobalFocus()) {
|
||||
/* All input will in this case go to the focused window */
|
||||
_focused_window->OnKeyPress(key, keycode);
|
||||
return;
|
||||
if (_focused_window->OnKeyPress(key, keycode) == Window::ES_HANDLED) return;
|
||||
}
|
||||
|
||||
/* Call the event, start with the uppermost window. */
|
||||
|
Loading…
Reference in New Issue
Block a user