summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-17 23:25:18 +0000
committerDarkvater <darkvater@openttd.org>2005-05-17 23:25:18 +0000
commitcdb81c660c88dd3e4d6f57495734e32ae08556d4 (patch)
tree75fae0176d0d0f4f2783c4fe01f038b7a399c5f7
parent9fb4b2ef5558d316e8f684a43f8df24ee6303d37 (diff)
downloadopenttd-cdb81c660c88dd3e4d6f57495734e32ae08556d4.tar.xz
(svn r2348) - Fix: Do not scroll the game with the arrow keys when the chatbox is open
-rw-r--r--misc_gui.c12
-rw-r--r--network_gui.c2
-rw-r--r--ttd.h1
3 files changed, 9 insertions, 6 deletions
diff --git a/misc_gui.c b/misc_gui.c
index 63adec321..da59fd96b 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -930,7 +930,12 @@ void DrawEditBox(Window *w, int wid)
static void QueryStringWndProc(Window *w, WindowEvent *e)
{
static bool closed = false;
- switch(e->event) {
+ switch (e->event) {
+ case WE_CREATE:
+ SETBIT(_no_scroll, SCROLL_EDIT);
+ closed = false;
+ break;
+
case WE_PAINT:
SetDParam(0, WP(w,querystr_d).caption);
DrawWindowWidgets(w);
@@ -987,10 +992,6 @@ press_ok:;
}
} break;
- case WE_CREATE:
- closed = false;
- break;
-
case WE_DESTROY:
// If the window is not closed yet, it means it still needs to send a CANCEL
if (!closed) {
@@ -1039,7 +1040,6 @@ void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth,
DeleteWindowById(WC_SAVELOAD, 0);
w = AllocateWindowDesc(&_query_string_desc);
- SETBIT(_no_scroll, SCROLL_EDIT);
GetString(_edit_str_buf, str);
_edit_str_buf[realmaxlen] = '\0';
diff --git a/network_gui.c b/network_gui.c
index 833ab72d0..9f8ff15f2 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1363,6 +1363,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
switch (e->event) {
case WE_CREATE:
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0);
+ SETBIT(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
closed = false;
break;
@@ -1421,6 +1422,7 @@ press_ok:;
case WE_DESTROY:
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_DESTROY, 0, 0);
+ CLRBIT(_no_scroll, SCROLL_CHAT);
// If the window is not closed yet, it means it still needs to send a CANCEL
if (!closed) {
Window *parent = FindWindowById(WP(w,querystr_d).wnd_class, WP(w,querystr_d).wnd_num);
diff --git a/ttd.h b/ttd.h
index 018198779..96d247547 100644
--- a/ttd.h
+++ b/ttd.h
@@ -536,6 +536,7 @@ enum {
SCROLL_CON = 0,
SCROLL_EDIT = 1,
SCROLL_SAVE = 2,
+ SCROLL_CHAT = 4,
};
VARDEF byte _no_scroll;