summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-06 02:31:47 +0000
committerbelugas <belugas@openttd.org>2007-12-06 02:31:47 +0000
commit7edf28529dad8d0619d10c27a480eeca7a896321 (patch)
tree197485baf9d0d317504f4c787e98776786d15b18 /src/window.cpp
parent49d632c31b47501217d54623b989a35df5672aad (diff)
downloadopenttd-7edf28529dad8d0619d10c27a480eeca7a896321.tar.xz
(svn r11578) -Codechange: Introduce the window default flag WDF_TEXTENTRY which specifies that the window holding it is actually one that enables an edit box.
Use this flag when dispatching a key event instead of using some hard coded window IDs. This should ease a little bit the creation of new edit aware windows.
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 33063fbeb..b20ae4b68 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1676,10 +1676,6 @@ void HandleKeypress(uint32 key)
{
Window* const *wz;
WindowEvent e;
- /* Stores if a window with a textfield for typing is open
- * If this is the case, keypress events are only passed to windows with text fields and
- * to thein this main toolbar. */
- bool query_open = false;
/*
* During the generation of the world, there might be
@@ -1698,28 +1694,12 @@ void HandleKeypress(uint32 key)
e.we.keypress.keycode = GB(key, 16, 16);
e.we.keypress.cont = true;
- /* check if we have a query string window open before allowing hotkeys */
- if (FindWindowById(WC_QUERY_STRING, 0) != NULL ||
- FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL ||
- FindWindowById(WC_GENERATE_LANDSCAPE, 0) != NULL ||
- FindWindowById(WC_CONSOLE, 0) != NULL ||
- FindWindowById(WC_SAVELOAD, 0) != NULL ||
- FindWindowById(WC_COMPANY_PASSWORD_WINDOW, 0) != NULL) {
- query_open = true;
- }
-
/* Call the event, start with the uppermost window. */
for (wz = _last_z_window; wz != _z_windows;) {
Window *w = *--wz;
- /* if a query window is open, only call the event for certain window types */
- if (query_open &&
- w->window_class != WC_QUERY_STRING &&
- w->window_class != WC_SEND_NETWORK_MSG &&
- w->window_class != WC_GENERATE_LANDSCAPE &&
- w->window_class != WC_CONSOLE &&
- w->window_class != WC_SAVELOAD &&
- w->window_class != WC_COMPANY_PASSWORD_WINDOW) {
+ /* Only call the event for the windows declared as been text entry enabled */
+ if (!(w->desc_flags & WDF_TEXTENTRY)) {
continue;
}
w->wndproc(w, &e);