From 5eecf3e5cb6da881ca4095561d19dfc4364d2823 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 30 May 2009 11:01:05 +0000 Subject: (svn r16463) -Cleanup: Code style fixes. --- src/misc_gui.cpp | 6 +++--- src/window.cpp | 6 +++--- src/window_gui.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 651f85f12..14340e829 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1072,11 +1072,11 @@ bool HandleCaret(Textbuf *tb) bool QueryString::HasEditBoxFocus(const Window *w, int wid) const { - return ((w->window_class == WC_OSK && + return (w->window_class == WC_OSK && _focused_window == w->parent && - w->parent->focused_widget && + w->parent->focused_widget != NULL && w->parent->focused_widget->type == WWT_EDITBOX) || - w->IsWidgetGloballyFocused(wid)); + w->IsWidgetGloballyFocused(wid); } HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state) diff --git a/src/window.cpp b/src/window.cpp index 191fc5b31..2009f15dd 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -289,7 +289,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click) * So unless the clicked widget is the caption bar, change focus to this widget */ if (wi->type != WWT_CAPTION) { /* Close the OSK window if a edit box loses focus */ - if (w->focused_widget && w->focused_widget->type == WWT_EDITBOX && // An edit box was previously selected + if (w->focused_widget != NULL && w->focused_widget->type == WWT_EDITBOX && // An edit box was previously selected w->focused_widget != wi && // and focus is going to change w->window_class != WC_OSK) { // and it is not the OSK window DeleteWindowById(WC_OSK, 0); @@ -297,7 +297,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click) if (w->focused_widget != wi) { /* Repaint the widget that loss focus. A focused edit box may else leave the caret left on the screen */ - if (w->focused_widget) w->InvalidateWidget(w->focused_widget - w->widget); + if (w->focused_widget != NULL) w->InvalidateWidget(w->focused_widget - w->widget); focused_widget_changed = true; w->focused_widget = wi; } @@ -812,7 +812,7 @@ void Window::Initialize(int x, int y, int min_width, int min_height, this->width = min_width; this->height = min_height; AssignWidgetToWindow(this, widget); - this->focused_widget = 0; + this->focused_widget = NULL; this->resize.width = min_width; this->resize.height = min_height; this->resize.step_width = 1; diff --git a/src/window_gui.h b/src/window_gui.h index 6f30a49a3..4de82d9db 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -272,7 +272,7 @@ public: { if (widget_index < this->widget_count) { /* Repaint the widget that loss focus. A focused edit box may else leave the caret left on the screen */ - if (this->focused_widget && this->focused_widget - this->widget != widget_index) { + if (this->focused_widget != NULL && this->focused_widget - this->widget != widget_index) { this->InvalidateWidget(this->focused_widget - this->widget); } this->focused_widget = &this->widget[widget_index]; -- cgit v1.2.3-54-g00ecf