[PR #1898] Don't NCPAINT our window, PAINT our window #24702

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

Original Pull Request: https://github.com/microsoft/terminal/pull/1898

State: closed
Merged: Yes


Summary of the Pull Request

Fixes the round corners and lack of shadow on the window introduced in #929.
image

References

This introduces the problem discussed in #1897

PR Checklist

Detailed Description of the Pull Request / Additional comments

  • If we handle WM_NCPAINT, we don't get shadows. We also get the legacy rounded top window corners, because of some kernel insanity. The whole point of DwmExtendFrameIntoClientArea is that we can just PAINT the entire window, instead of trying to do NC_PAINT tricks. So, we need to move the entire NCPAINT we had into PAINT.
  • We also need to remove the margins we were setting. If we leave a top margin, the system caption buttons will try and draw into that area. Since we don't want those, we need to make sure the top margin is 0, so they have no space to draw into.
  • I also split out the DragSizeChanged handler from OnSize. I don't know why, but having it inside OnSize would cause the xaml island content to go black when moving the window from a secondary normal DPI display back to a high DPI primary display.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/1898 **State:** closed **Merged:** Yes --- <!-- 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 Fixes the round corners and lack of shadow on the window introduced in #929. ![image](https://user-images.githubusercontent.com/18356694/60923472-931b9b00-a264-11e9-97a5-7b36f0dbfde2.png) <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References This introduces the problem discussed in #1897 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Touches some #1625 bits. Closes #872 * [x] you better believe I work here * [ ] Tests make me cry * [x] Requires documentation to be updated - no <!-- 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 * If we handle `WM_NCPAINT`, we _don't_ get shadows. We also get the legacy rounded top window corners, because of some kernel insanity. The whole point of `DwmExtendFrameIntoClientArea` is that we can just `PAINT` the entire window, instead of trying to do `NC_PAINT` tricks. So, we need to move the entire NCPAINT we had into PAINT. * We also need to remove the margins we were setting. If we leave a top margin, the system caption buttons will try and draw into that area. Since we don't want those, we need to make sure the top margin is 0, so they have no space to draw into. * I also split out the DragSizeChanged handler from OnSize. I don't know why, but having it inside OnSize would cause the xaml island content to go black when moving the window from a secondary normal DPI display back to a high DPI primary display.
claunia added the pull-request label 2026-01-31 09:04:51 +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#24702