[PR #15165] [MERGED] Manually hide our DesktopWindowXamlSource #30462

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/15165
Author: @zadjii-msft
Created: 4/11/2023
Status: Merged
Merged: 4/14/2023
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/b/6507-DesktopWindowXamlSource


📝 Commits (3)

  • 7edd442 Manually hide our DesktopWindowXamlSource
  • d14e622 Merge branch 'main' into dev/migrie/b/6507-DesktopWindowXamlSource
  • 5523e44 after talking with XAML folks, this is the solution

📊 Changes

3 files changed (+29 additions, -2 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+22 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.cpp (+5 -0)
📝 src/cascadia/WindowsTerminal/IslandWindow.h (+2 -2)

📄 Description

As discussed in #6507

Newer builds of Windows do this automatically. However, this was spotted in the wild on 1.18. It's possible the threading changes created a situation where the OS-side fix no longer applied to us. So let's just do it manually. It doesn't have any side effects.

I saw this once on Win11, but couldn't repro it this morning when I tried to add this fix. I'm just gonna assume this worked, despite the fact that I can't repro it on win11 anymore.

closes #6507

See also #14957

detailed description

WindowsXamlManager::XamlCore::Initialize calls ConfigureCoreWindow, which creates a CoreWindow on the thread

Problem is, we're calling that on the main thread (which doesn't have any windows), and then eventually creating a DesktopWindowXamlSource on a second thread for the actual window

It's not that it "manages a window", it's that it "manages xaml on Windows OS". just use ICoreWindowInterop -- QI for ICoreWindowInterop and call get_WindowHandle.

Also see:


🔄 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/15165 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/11/2023 **Status:** ✅ Merged **Merged:** 4/14/2023 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/b/6507-DesktopWindowXamlSource` --- ### 📝 Commits (3) - [`7edd442`](https://github.com/microsoft/terminal/commit/7edd4422b3a00dee051877af8a9407fe512b18a2) Manually hide our DesktopWindowXamlSource - [`d14e622`](https://github.com/microsoft/terminal/commit/d14e622cc7e8d2a605d444b06a2c788aa0dbc695) Merge branch 'main' into dev/migrie/b/6507-DesktopWindowXamlSource - [`5523e44`](https://github.com/microsoft/terminal/commit/5523e44dd32f5f3a3e06360c90b9b0a5f1bfd57a) after talking with XAML folks, this is the solution ### 📊 Changes **3 files changed** (+29 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+22 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.cpp` (+5 -0) 📝 `src/cascadia/WindowsTerminal/IslandWindow.h` (+2 -2) </details> ### 📄 Description As discussed in #6507 Newer builds of Windows do this automatically. However, this was spotted in the wild on 1.18. It's possible the threading changes created a situation where the OS-side fix no longer applied to us. So let's just do it manually. It doesn't have any side effects. I saw this once on Win11, but couldn't repro it this morning when I tried to add this fix. I'm just gonna assume this worked, despite the fact that I can't repro it on win11 anymore. closes #6507 See also #14957 ## detailed description > `WindowsXamlManager::XamlCore::Initialize` calls `ConfigureCoreWindow`, which creates a `CoreWindow` on the thread > Problem is, we're calling that on the main thread (which doesn't have _any_ windows), and then eventually creating a `DesktopWindowXamlSource` on a second thread for the actual window > It's not that it "manages a window", it's that it "manages xaml on Windows OS". just use ICoreWindowInterop -- QI for ICoreWindowInterop and call get_WindowHandle. Also see: * [ICoreWindowInterop](https://learn.microsoft.com/en-us/windows/win32/api/corewindow/nn-corewindow-icorewindowinterop) * [WindowsXamlManager.InitializeForCurrentThread](https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.hosting.windowsxamlmanager.initializeforcurrentthread?view=winrt-22621#windows-ui-xaml-hosting-windowsxamlmanager-initializeforcurrentthread) * The source code in `onecoreuap\windows\dxaml\xcp\dxaml\lib\WindowsXamlManager_Partial.*` * os.2020!6102020 which fixed MSFT:33498969, MSFT:27807465, MSFT:21854264 --- <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:40:57 +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#30462