Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 27929) +++ src/lang/english.txt (working copy) @@ -237,7 +237,7 @@ STR_BUTTON_RENAME :{BLACK}Rename STR_TOOLTIP_CLOSE_WINDOW :{BLACK}Close window -STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}Window title - drag this to move window +STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}Window title - drag this to move window. Ctrl+Click to store current position as default STR_TOOLTIP_SHADE :{BLACK}Shade window - only show the title bar STR_TOOLTIP_DEBUG :{BLACK}Show NewGRF debug information STR_TOOLTIP_DEFSIZE :{BLACK}Resize window to default size. Ctrl+Click to store current size as default Index: src/lang/english_US.txt =================================================================== --- src/lang/english_US.txt (revision 27929) +++ src/lang/english_US.txt (working copy) @@ -237,7 +237,7 @@ STR_BUTTON_RENAME :{BLACK}Rename STR_TOOLTIP_CLOSE_WINDOW :{BLACK}Close window -STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}Window title - drag this to move window +STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}Window title - drag this to move window. Ctrl+Click to store current position as default STR_TOOLTIP_SHADE :{BLACK}Shade window - only show the title bar STR_TOOLTIP_DEBUG :{BLACK}Show NewGRF debug information STR_TOOLTIP_DEFSIZE :{BLACK}Resize window to default size. Ctrl+Click to store current size as default Index: src/table/window_settings.ini =================================================================== --- src/table/window_settings.ini (revision 27929) +++ src/table/window_settings.ini (working copy) @@ -50,6 +50,20 @@ min = 0 max = 32000 +[SDT_VAR] +var = pref_left +type = SLE_INT16 +def = -1 +min = -32000 +max = 32000 + +[SDT_VAR] +var = pref_top +type = SLE_INT16 +def = -1 +min = -1 +max = 32000 + [SDT_END] }; Index: src/window.cpp =================================================================== --- src/window.cpp (revision 27929) +++ src/window.cpp (working copy) @@ -101,6 +101,8 @@ pref_sticky(false), pref_width(0), pref_height(0), + pref_left(-1), + pref_top(-1), default_width_trad(def_width_trad), default_height_trad(def_height_trad) { @@ -691,7 +693,17 @@ return; case WWT_CAPTION: // 'Title bar' - StartWindowDrag(w); + if (_ctrl_pressed) { + if (_shift_pressed) { + w->window_desc->pref_left = -1; + w->window_desc->pref_top = -1; + } else { + w->window_desc->pref_left = w->left; + w->window_desc->pref_top = w->top; + } + } else { + StartWindowDrag(w); + } return; case WWT_RESIZEBOX: @@ -1702,12 +1714,16 @@ */ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) { - Point pt; + Point pt = { desc->pref_left, desc->pref_top }; const Window *w; int16 default_width = max(desc->GetDefaultWidth(), sm_width); int16 default_height = max(desc->GetDefaultHeight(), sm_height); + if (pt.y >= 0 && pt.y < _screen.height && + pt.x >= 10-default_width && pt.x < _screen.width-10) + return pt; + if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ && (w = FindWindowById(desc->parent_cls, window_number)) != NULL && w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) { Index: src/window_gui.h =================================================================== --- src/window_gui.h (revision 27929) +++ src/window_gui.h (working copy) @@ -185,6 +185,8 @@ bool pref_sticky; ///< Preferred stickyness. int16 pref_width; ///< User-preferred width of the window. Zero if unset. int16 pref_height; ///< User-preferred height of the window. Zero if unset. + int16 pref_left; + int16 pref_top; int16 GetDefaultWidth() const; int16 GetDefaultHeight() const;