-
Notifications
You must be signed in to change notification settings - Fork 9k
Closed
Labels
Area-UserInterfaceIssues pertaining to the user interface of the Console or TerminalIssues pertaining to the user interface of the Console or TerminalIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.The new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.Fix is checked in, but it might be 3-4 weeks until a release.
Milestone
Description
This is work that's following on from work that's being done for #1625.
I'm pulling the code for updating the drag region out of NonClientIslandWindow::OnSize into its own method. Unfortunately, both these methods need to do the following block of work:
const auto windowRect = GetWindowRect();
const auto width = windowRect.right - windowRect.left;
const auto height = windowRect.bottom - windowRect.top;
const auto scale = GetCurrentDpiScale();
const auto dpi = ::GetDpiForWindow(_window.get());
const auto dragY = ::GetSystemMetricsForDpi(SM_CYDRAG, dpi);
const auto dragX = ::GetSystemMetricsForDpi(SM_CXDRAG, dpi);
// If we're maximized, we don't want to use the frame as our margins,
// instead we want to use the margins from the maximization. If we included
// the left&right sides of the frame in this calculation while maximized,
// you' have a few pixels of the window border on the sides while maximized,
// which most apps do not have.
const auto bordersWidth = _isMaximized ?
(_maximizedMargins.cxLeftWidth + _maximizedMargins.cxRightWidth) :
(dragX * 2);
const auto bordersHeight = _isMaximized ?
(_maximizedMargins.cyBottomHeight + _maximizedMargins.cyTopHeight) :
(dragY * 2);
const auto windowsWidth = width - bordersWidth;
const auto windowsHeight = height - bordersHeight;
const auto xPos = _isMaximized ? _maximizedMargins.cxLeftWidth : dragX;
const auto yPos = _isMaximized ? _maximizedMargins.cyTopHeight : dragY;
const auto dragBarRect = GetDragAreaRect();
const auto nonClientHeight = dragBarRect.bottom - dragBarRect.top;Doing this twice is clearly ridiculous, and more likely than not, wrong.
I'm thinking that on the resize, we could probably just cache some of these values. I think this will also important for dealing with maximizing, cause I think know the maximize borders are wrong on non-primary displays.
Metadata
Metadata
Assignees
Labels
Area-UserInterfaceIssues pertaining to the user interface of the Console or TerminalIssues pertaining to the user interface of the Console or TerminalIssue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.The new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.Fix is checked in, but it might be 3-4 weeks until a release.