summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-16 17:58:27 +0000
committerrubidium <rubidium@openttd.org>2008-12-16 17:58:27 +0000
commit94a5f66427ec48fae8d939254916c48fcdf5b1ce (patch)
tree7f6e9a1062fc5034eb21ca5b1895d24cae43f965 /src/window.cpp
parentf1c7e4662a379fdc1f59e69c0823b7daae5a4958 (diff)
downloadopenttd-94a5f66427ec48fae8d939254916c48fcdf5b1ce.tar.xz
(svn r14679) -Fix [FS#2431]: opening the OSK on the chatbox did disable map scrolling (with keyboard) until another window with editbox was opened and closed. Just "refcount" the open edit boxes instead of setting/clearing a bit when opening/closing a window.
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index f12cd573f..f28d4dbdd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -461,7 +461,13 @@ Window::~Window()
if (this->viewport != NULL) DeleteWindowViewport(this);
this->SetDirty();
- free(this->widget);
+
+ if (this->widget != NULL) {
+ for (const Widget *wi = this->widget; wi->type != WWT_LAST; wi++) {
+ if (wi->type == WWT_EDITBOX) _no_scroll--;
+ }
+ free(this->widget);
+ }
}
/**
@@ -690,6 +696,10 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget)
w->widget = MallocT<Widget>(index);
memcpy(w->widget, widget, sizeof(*w->widget) * index);
w->widget_count = index - 1;
+
+ for (const Widget *wi = w->widget; wi->type != WWT_LAST; wi++) {
+ if (wi->type == WWT_EDITBOX) _no_scroll++;
+ }
} else {
w->widget = NULL;
w->widget_count = 0;