diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 597e3291e4..45af2f785d 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -391,8 +391,10 @@ public: top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; } - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && panel_nwi->current_y > panel_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 0e4f8ed9f5..5995bd27a9 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -422,8 +422,10 @@ public: int bottom = back_nwi->pos_y + back_nwi->current_y; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d59f5f80d4..aabcb5b3f0 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1012,8 +1012,10 @@ public: int bottom = cov->pos_y + cov->current_y; top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize the coverage text space if the text is not equally long as the window. */ - if (top != bottom) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { this->coverage_height += top - bottom; this->ReInit(); } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index a44ed3a5e7..03267323ba 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -972,8 +972,10 @@ struct BuildRoadStationWindow : public PickerWindowBase { int bottom = back_nwi->pos_y + back_nwi->current_y; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } }