[PR #3394] [MERGED] Use standard 1px window borders on NC Island Window #25341

Open
opened 2026-01-31 09:08:53 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3394
Author: @beviu
Created: 10/31/2019
Status: Merged
Merged: 11/4/2019
Merged by: @DHowett-MSFT

Base: masterHead: better-window-frame


📝 Commits (10+)

  • 6744d21 test things
  • 1d33e22 Fix DwmExtendFrameIntoClientArea values
  • 1dd0ee6 Fix WM_NCHITTEST handling
  • cd73d35 Position the XAML island window correctly
  • 02a5e18 Fix weird colors in drag bar and hide old title bar buttons
  • 19d67a5 Fix the window's position when maximized
  • 214f086 Add comment
  • e08d973 Add support for dark theme on the frame
  • e37ace4 Changes for PR
  • 046633c DRY shared code between conhost and new terminal

📊 Changes

15 files changed (+438 additions, -650 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+13 -1)
📝 src/cascadia/TerminalApp/App.h (+1 -0)
📝 src/cascadia/TerminalApp/App.idl (+1 -0)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+13 -42)
📝 src/cascadia/WindowsTerminal/BaseWindow.h (+15 -3)
📝 src/cascadia/WindowsTerminal/IslandWindow.cpp (+1 -10)
📝 src/cascadia/WindowsTerminal/IslandWindow.h (+1 -3)
📝 src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp (+324 -559)
📝 src/cascadia/WindowsTerminal/NonClientIslandWindow.h (+26 -16)
📝 src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj (+1 -1)
src/types/ThemeUtils.cpp (+19 -0)
src/types/inc/ThemeUtils.h (+8 -0)
📝 src/types/lib/types.vcxproj (+4 -2)
📝 src/types/lib/types.vcxproj.filters (+10 -13)
📝 src/types/sources.inc (+1 -0)

📄 Description

Summary of the Pull Request

I put the standard Windows window borders on the Windows Terminal window (can you read that?).
(It's only on the left, bottom and right though, on the top I had to use a hack because of the title bar)

Light mode, color in title bar disabled:
frame

Light mode, color in title bar enabled:
frame color

Dark mode, color in title bar disabled:
frame dark

Dark mode, color in title bar enabled:
frame dark color

High contrast mode (with Settings app on right to compare):
high contrast

Note: the title bar should probably be purple like in Win32 apps but it isn't either in the UWP apps (Settings, classic Edge, …) so I don't really know.

References

PR Checklist

  • Closes #3064, closes #1307, closes #3136, closes #1897, closes #3222, closes #1859, closes #2268 and maybe more?
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

We take the standard window frame except that we remove the top part (see NonClientIslandWindow::_OnNcCalcSize), then we put little 1 pixel wide top border back in the client area using DwmExtendFrameIntoClientArea and then we put the XAML island and the drag bar on top.

Most of this PR is comments to explain how the code works and also removing complex code that was needed to handle the weird cases when the borders were custom.

I've also refactored a little bit the NonClientIslandWindow class.

Validation Steps Performed


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/3394 **Author:** [@beviu](https://github.com/beviu) **Created:** 10/31/2019 **Status:** ✅ Merged **Merged:** 11/4/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `better-window-frame` --- ### 📝 Commits (10+) - [`6744d21`](https://github.com/microsoft/terminal/commit/6744d211f8106a8d2dd470a7fedb14a57124ad6f) test things - [`1d33e22`](https://github.com/microsoft/terminal/commit/1d33e229083105561c3f28c0e4822e64dbfae6d6) Fix DwmExtendFrameIntoClientArea values - [`1dd0ee6`](https://github.com/microsoft/terminal/commit/1dd0ee61bfc5bdbd7e00dbf435a2f3879433a11f) Fix WM_NCHITTEST handling - [`cd73d35`](https://github.com/microsoft/terminal/commit/cd73d353a1616f1a3c042e7c5fd69cca359779ac) Position the XAML island window correctly - [`02a5e18`](https://github.com/microsoft/terminal/commit/02a5e1865450684d2c7bfc80c3993a780d0bf151) Fix weird colors in drag bar and hide old title bar buttons - [`19d67a5`](https://github.com/microsoft/terminal/commit/19d67a5db0a48661e395764c4da787a89ff5fde8) Fix the window's position when maximized - [`214f086`](https://github.com/microsoft/terminal/commit/214f086b8dcf488d12a13c7264cb25fd450f7225) Add comment - [`e08d973`](https://github.com/microsoft/terminal/commit/e08d9735987132a6d60cdf6b966c95c3d1ed2c73) Add support for dark theme on the frame - [`e37ace4`](https://github.com/microsoft/terminal/commit/e37ace47b6516d0c2414cc00b8c4942b7bc6a1ee) Changes for PR - [`046633c`](https://github.com/microsoft/terminal/commit/046633cd63530b9600de068b2ca223f557318873) DRY shared code between conhost and new terminal ### 📊 Changes **15 files changed** (+438 additions, -650 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+13 -1) 📝 `src/cascadia/TerminalApp/App.h` (+1 -0) 📝 `src/cascadia/TerminalApp/App.idl` (+1 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+13 -42) 📝 `src/cascadia/WindowsTerminal/BaseWindow.h` (+15 -3) 📝 `src/cascadia/WindowsTerminal/IslandWindow.cpp` (+1 -10) 📝 `src/cascadia/WindowsTerminal/IslandWindow.h` (+1 -3) 📝 `src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp` (+324 -559) 📝 `src/cascadia/WindowsTerminal/NonClientIslandWindow.h` (+26 -16) 📝 `src/cascadia/WindowsTerminal/WindowsTerminal.vcxproj` (+1 -1) ➕ `src/types/ThemeUtils.cpp` (+19 -0) ➕ `src/types/inc/ThemeUtils.h` (+8 -0) 📝 `src/types/lib/types.vcxproj` (+4 -2) 📝 `src/types/lib/types.vcxproj.filters` (+10 -13) 📝 `src/types/sources.inc` (+1 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request I put the standard Windows window borders on the Windows Terminal window (can you read that?). (It's only on the left, bottom and right though, on the top I had to use a hack because of the title bar) Light mode, color in title bar disabled: ![frame](https://user-images.githubusercontent.com/56923875/67972211-87d2ed80-fc0e-11e9-8a89-d0a218a6fc36.png) Light mode, color in title bar enabled: ![frame color](https://user-images.githubusercontent.com/56923875/67972645-63c3dc00-fc0f-11e9-9218-f229cdf7dfa7.png) Dark mode, color in title bar disabled: ![frame dark](https://user-images.githubusercontent.com/56923875/67972668-6cb4ad80-fc0f-11e9-943e-3b5bd9f5079e.png) Dark mode, color in title bar enabled: ![frame dark color](https://user-images.githubusercontent.com/56923875/67972679-72aa8e80-fc0f-11e9-9da0-8308a85359a5.png) High contrast mode (with Settings app on right to compare): ![high contrast](https://user-images.githubusercontent.com/56923875/68075465-7b829800-fda8-11e9-8427-7069d636d666.png) Note: the title bar should probably be purple like in Win32 apps but it isn't either in the UWP apps (Settings, classic Edge, …) so I don't really know. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #3064, closes #1307, closes #3136, closes #1897, closes #3222, closes #1859, closes #2268 and maybe more? * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments We take the standard window frame except that we remove the top part (see `NonClientIslandWindow::_OnNcCalcSize`), then we put little 1 pixel wide top border back in the client area using `DwmExtendFrameIntoClientArea` and then we put the XAML island and the drag bar on top. Most of this PR is comments to explain how the code works and also removing complex code that was needed to handle the weird cases when the borders were custom. I've also refactored a little bit the `NonClientIslandWindow` class. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:08:53 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25341