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

@@ -31,6 +31,8 @@
#include "tilehighlight_func.h"
#include "hotkeys.h"
#include "guitimer_func.h"
#include "error.h"
#include "news_gui.h"
#include "saveload/saveload.h"
@@ -235,6 +237,8 @@ enum {
GHK_CHAT_ALL,
GHK_CHAT_COMPANY,
GHK_CHAT_SERVER,
GHK_CLOSE_NEWS,
GHK_CLOSE_ERROR,
};
struct MainWindow : Window
@@ -427,6 +431,14 @@ struct MainWindow : Window
}
break;
case GHK_CLOSE_NEWS: // close active news window
if (!HideActiveNewsMessage()) return ES_NOT_HANDLED;
break;
case GHK_CLOSE_ERROR: // close active error window
if (!HideActiveErrorMessage()) return ES_NOT_HANDLED;
break;
default: return ES_NOT_HANDLED;
}
return ES_HANDLED;
@@ -520,6 +532,8 @@ static Hotkey global_hotkeys[] = {
Hotkey(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL),
Hotkey(_ghk_chat_company_keys, "chat_company", GHK_CHAT_COMPANY),
Hotkey(_ghk_chat_server_keys, "chat_server", GHK_CHAT_SERVER),
Hotkey(WKC_SPACE, "close_news", GHK_CLOSE_NEWS),
Hotkey(WKC_SPACE, "close_error", GHK_CLOSE_ERROR),
HOTKEY_LIST_END
};
HotkeyList MainWindow::hotkeys("global", global_hotkeys);