=== modified file 'src/window.cpp' --- src/window.cpp 2008-05-10 16:08:58 +0000 +++ src/window.cpp 2008-05-10 16:12:20 +0000 @@ -945,21 +945,14 @@ e.we.create.data = data; this->HandleWindowEvent(&e); - /* Try to make windows smaller when our window is too small. - * w->(width|height) is normally the same as min_(width|height), - * but this way the GUIs can be made a little more dynamic; - * one can use the same spec for multiple windows and those - * can then determine the real minimum size of the window. */ + /* Window was created with minimum size. Sometimes, the initial window size is larger. + * In that case, resize the window. + */ if (this->width != pd.width || this->height != pd.height) { /* Think about the overlapping toolbars when determining the minimum window size */ - int free_height = _screen.height; - const Window *wt = FindWindowById(WC_STATUS_BAR, 0); - if (wt != NULL) free_height -= wt->height; - wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - if (wt != NULL) free_height -= wt->height; - - int enlarge_x = max(min(pd.width - this->width, _screen.width - this->width), 0); - int enlarge_y = max(min(pd.height - this->height, free_height - this->height), 0); + int enlarge_x = pd.width - this->width; + int enlarge_y = pd.height - this->height; + assert(enlarge_x >= 0 && enlarge_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 @@ -967,33 +960,18 @@ if (this->resize.step_width > 1) enlarge_x -= enlarge_x % (int)this->resize.step_width; if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height; - ResizeWindow(this, enlarge_x, enlarge_y); - - Point size; - Point diff; - size.x = this->width; - size.y = this->height; - diff.x = enlarge_x; - diff.y = enlarge_y; - this->OnResize(size, diff); - } - - int nx = this->left; - int ny = this->top; - - if (nx + this->width > _screen.width) nx -= (nx + this->width - _screen.width); - - const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - ny = max(ny, (wt == NULL || this == wt || pd.y == 0) ? 0 : wt->height); - nx = max(nx, 0); - - if (this->viewport != NULL) { - this->viewport->left += nx - this->left; - this->viewport->top += ny - this->top; - } - this->left = nx; - this->top = ny; - + if (enlarge_x > 0 || enlarge_y > 0) { + ResizeWindow(this, enlarge_x, enlarge_y); + + Point size; + Point diff; + size.x = this->width; + size.y = this->height; + diff.x = enlarge_x; + diff.y = enlarge_y; + this->OnResize(size, diff); + } + } this->SetDirty(); }