summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
committeralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
commitb144a5451cb451d91bacafd80cab04640d1c1af1 (patch)
tree9eb3dc83f5dfd3b398f76ce3784fef22cdd5767b /src/misc_gui.cpp
parent1a4934ef070aee3e506603707850de28c7f872cd (diff)
downloadopenttd-b144a5451cb451d91bacafd80cab04640d1c1af1.tar.xz
(svn r16516) -Codechange: Added click and drag handling for nested widgets.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index bcd152e82..076e74231 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1072,11 +1072,10 @@ bool HandleCaret(Textbuf *tb)
bool QueryString::HasEditBoxFocus(const Window *w, int wid) const
{
- return (w->window_class == WC_OSK &&
- _focused_window == w->parent &&
- w->parent->focused_widget != NULL &&
- w->parent->focused_widget->type == WWT_EDITBOX) ||
- w->IsWidgetGloballyFocused(wid);
+ if (w->IsWidgetGloballyFocused(wid)) return true;
+ if (w->window_class != WC_OSK || _focused_window != w->parent) return false;
+ return (w->parent->focused_widget != NULL && w->parent->focused_widget->type == WWT_EDITBOX) ||
+ (w->parent->nested_focus != NULL && w->parent->nested_focus->type == WWT_EDITBOX);
}
HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state)