Add and enforce minimum width (#5599)
## Summary of the Pull Request Enforces a minimum width of 460 wide. This allows tabs to always be seen (albeit partially). NOTE: A minimum height was originally added to allow the About menu to be seen. This minimum height was removed from this PR because we don't foresee a circumstance where your Terminal is in that state, and you can't just resize it to make the content fit properly. ## References #4990 may be fixed/affected by this? ## PR Checklist * [X] Closes #4976 * [X] Will close issue #5418 upon verification ## Validation Steps Performed Here's some images of what the terminal looks like when it's at its minimum size: ### 100% scaling #### 100% scaling: one tab ![100% scaling: one tab](https://user-images.githubusercontent.com/11050425/80408686-76e0fd00-887c-11ea-8283-35871d24652a.png) #### 100% scaling: two tabs ![100% scaling: two tabs](https://user-images.githubusercontent.com/11050425/80408695-79435700-887c-11ea-9670-116cde320e07.png) #### 100% scaling: 3 tabs (scrolling enabled) ![100% scaling: 3 tabs (scrolling enabled)](https://user-images.githubusercontent.com/11050425/80408701-7c3e4780-887c-11ea-8ede-8b69d20d6f66.png) ### 200% scaling #### 200% scaling: one tab ![200% scaling: one tab](https://user-images.githubusercontent.com/11050425/80408783-9a0bac80-887c-11ea-8b62-bd064f89403d.png) #### 200% scaling: two tabs ![200% scaling: two tabs](https://user-images.githubusercontent.com/11050425/80408793-9c6e0680-887c-11ea-9301-344189281006.png) #### 200% scaling: 3 tabs (scrolling enabled) ![200% scaling: 3 tabs (scrolling enabled)](https://user-images.githubusercontent.com/11050425/80408799-9ed06080-887c-11ea-892a-ee8e329080c5.png)
This commit is contained in:
parent
9247ff081b
commit
db5d2fe0a5
|
@ -179,8 +179,14 @@ LRESULT IslandWindow::_OnSizing(const WPARAM wParam, const LPARAM lParam)
|
|||
// If this fails, we'll use the default of 96.
|
||||
GetDpiForMonitor(hmon, MDT_EFFECTIVE_DPI, &dpix, &dpiy);
|
||||
|
||||
const auto widthScale = base::ClampedNumeric<float>(dpix) / USER_DEFAULT_SCREEN_DPI;
|
||||
const long minWidthScaled = minimumWidth * widthScale;
|
||||
|
||||
const auto nonClientSize = GetTotalNonClientExclusiveSize(dpix);
|
||||
|
||||
auto clientWidth = winRect->right - winRect->left - nonClientSize.cx;
|
||||
clientWidth = std::max(minWidthScaled, clientWidth);
|
||||
|
||||
auto clientHeight = winRect->bottom - winRect->top - nonClientSize.cy;
|
||||
|
||||
if (wParam != WMSZ_TOP && wParam != WMSZ_BOTTOM)
|
||||
|
|
|
@ -102,4 +102,8 @@ protected:
|
|||
virtual void _SetIsFullscreen(const bool fullscreenEnabled);
|
||||
void _BackupWindowSizes(const bool currentIsInFullscreen);
|
||||
void _ApplyWindowSize();
|
||||
|
||||
private:
|
||||
// This minimum width allows for width the tabs fit
|
||||
static constexpr long minimumWidth = 460L;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue