Skip to content

Commit

Permalink
Shift the island up by 1px when maximized (#10746)
Browse files Browse the repository at this point in the history
For inexplicable reasons, the top row of pixels on our tabs, new tab
button, and caption buttons is totally unclickable. The mouse simply
refuses to interact with them. So when we're maximized, on certain
monitor configurations, this results in the top row of pixels not
reacting to clicks at all.

To obey Fitt's Law, we're gonna hackily shift the entire island up one
pixel. That will result in the top row of pixels in the window actually
being the _second_ row of pixels for those buttons, which will make them
clickable. It's perhaps not the right fix, but it works.

After discussion, we think this is a fine fix for this. We don't think
anyone's going to miss the top row of pixels on the TabView. The original
bug is painful enough for the subset of users it impacts that this is an
acceptable trade. Should a better fix be found, we can absolutely do that
instead.

Closes #7422
  • Loading branch information
zadjii-msft authored and DHowett committed Aug 25, 2021
1 parent 988dad3 commit d87b490
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ downsides
dze
dzhe
Enum'd
Fitt
formattings
ftp
geeksforgeeks
Expand Down
16 changes: 15 additions & 1 deletion src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,21 @@ void NonClientIslandWindow::_OnMaximizeChange() noexcept
// sizes of our child XAML Islands to match our new sizing.
void NonClientIslandWindow::_UpdateIslandPosition(const UINT windowWidth, const UINT windowHeight)
{
const auto topBorderHeight = Utils::ClampToShortMax(_GetTopBorderHeight(), 0);
const auto originalTopHeight = _GetTopBorderHeight();
// GH#7422
// !! BODGY !!
//
// For inexplicable reasons, the top row of pixels on our tabs, new tab
// button, and caption buttons is totally un-clickable. The mouse simply
// refuses to interact with them. So when we're maximized, on certain
// monitor configurations, this results in the top row of pixels not
// reacting to clicks at all. To obey Fitt's Law, we're gonna shift
// the entire island up one pixel. That will result in the top row of pixels
// in the window actually being the _second_ row of pixels for those
// buttons, which will make them clickable. It's perhaps not the right fix,
// but it works.
// _GetTopBorderHeight() returns 0 when we're maximized.
const short topBorderHeight = ::base::saturated_cast<short>((originalTopHeight == 0) ? -1 : originalTopHeight);

const COORD newIslandPos = { 0, topBorderHeight };

Expand Down

0 comments on commit d87b490

Please sign in to comment.