summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-11-29 10:56:51 +0000
committeralberth <alberth@openttd.org>2009-11-29 10:56:51 +0000
commit01d4eba14049c7af8166241ce33404f88a7f68df (patch)
treefa902119c033b4c3baf423a71d8cf53214b1a8c9
parent45327a588be1154a25b35d1c8b94d05768890b76 (diff)
downloadopenttd-01d4eba14049c7af8166241ce33404f88a7f68df.tar.xz
(svn r18335) -Codechange: Further reduction of nested_root NULL-ness checking.
-rw-r--r--src/window.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/window.cpp b/src/window.cpp
index deed06c70..95dcce7a0 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -485,8 +485,6 @@ void Window::SetDirty() const
*/
void Window::ReInit(int rx, int ry)
{
- if (this->nested_root == NULL) return; // Only nested widget windows can re-initialize.
-
this->SetDirty(); // Mark whole current window as dirty.
/* Save current size. */
@@ -800,14 +798,13 @@ void Window::InitializeData(WindowClass cls, int window_number, uint32 desc_flag
/* Further set up window properties,
* this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
- this->resize.step_width = (this->nested_root != NULL) ? this->nested_root->resize_x : 1;
- this->resize.step_height = (this->nested_root != NULL) ? this->nested_root->resize_y : 1;
+ this->resize.step_width = this->nested_root->resize_x;
+ this->resize.step_height = this->nested_root->resize_y;
/* Give focus to the opened window unless it is the OSK window or a text box
* of focused window has focus (so we don't interrupt typing). But if the new
* window has a text box, then take focus anyway. */
- bool has_editbox = this->nested_root != NULL && this->nested_root->GetWidgetOfType(WWT_EDITBOX) != NULL;
- if (this->window_class != WC_OSK && (!EditBoxInGlobalFocus() || has_editbox)) SetFocusedWindow(this);
+ if (this->window_class != WC_OSK && (!EditBoxInGlobalFocus() || this->nested_root->GetWidgetOfType(WWT_EDITBOX) != NULL)) SetFocusedWindow(this);
/* Hacky way of specifying always-on-top windows. These windows are
* always above other windows because they are moved below them.
@@ -1585,11 +1582,10 @@ static bool HandleWindowDragging()
x = _cursor.pos.x - _drag_delta.x;
}
- if (w->nested_root != NULL) {
- /* Nested widgets also allow resize.step_width and/or resize.step_height to become 0 which means no resize is possible. */
- if (w->resize.step_width == 0) x = 0;
- if (w->resize.step_height == 0) y = 0;
- }
+ /* resize.step_width and/or resize.step_height may be 0, which means no resize is possible. */
+ if (w->resize.step_width == 0) x = 0;
+ if (w->resize.step_height == 0) y = 0;
+
/* X and Y has to go by step.. calculate it.
* The cast to int is necessary else x/y are implicitly casted to
* unsigned int, which won't work. */