-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Monarch/Peasant & Make UI single-threaded #18215
base: main
Are you sure you want to change the base?
Conversation
b39c5a7
to
7853853
Compare
@@ -170,7 +170,6 @@ namespace winrt::TerminalApp::implementation | |||
|
|||
const auto canDragDrop = CanDragDrop(); | |||
|
|||
_tabRow.PointerMoved({ get_weak(), &TerminalPage::_RestorePointerCursorHandler }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into TerminalControl
as a different workaround is needed for this functionality.
{ | ||
auto weakThis{ get_weak() }; | ||
co_await wil::resume_foreground(Dispatcher()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No multi-threading = No problem. (Suppress whitespace in the diff.)
<CurrentXamlPackage Include="@(AppxPackageRegistration)" | ||
Condition="'%(AppxPackageRegistration.Architecture)'=='$(Platform)' AND | ||
$([System.String]::new('%(AppxPackageRegistration.Filename)').StartsWith('Microsoft.UI.Xaml'))" /> | ||
<CurrentXamlPackage Include="@(AppxPackageRegistration)" Condition="'%(AppxPackageRegistration.Architecture)'=='$(Platform)' AND
 $([System.String]::new('%(AppxPackageRegistration.Filename)').StartsWith('Microsoft.UI.Xaml'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS mangled this :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
86/154! It's easy to review deletions ;)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
139/154
auto isCurrentlyDark = Theme::IsSystemInDarkTheme(); | ||
if (isCurrentlyDark != _currentSystemThemeIsDark) | ||
{ | ||
_currentSystemThemeIsDark = isCurrentlyDark; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 DH - Guessing this moved to the Message Window; confirm
{ | ||
runtimeclass CommandlineArgs | ||
{ | ||
CommandlineArgs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, these constructors are only necessary if they will be created from outside the DLL.
If not, you can remove the ctor from the IDL, and the FACTORY
from the header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's instantiated in the WindowEmperor
. Honestly, we could just move WindowEmperor
into TerminalApp and call it from main(). That may make things simpler, especially now that it's way smaller.
WindowRequestedArgs(String window, String content, Windows.Foundation.IReference<Windows.Foundation.Rect> bounds); | ||
|
||
UInt64 Id; | ||
String WindowName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw you had to make a change to make WindowName
writable. Is it possible to restrict that to the internal interface, so that it is not writable in the winmd
and idl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's being written the WindowEmperor
which is external. I was hoping to improve this design at a later time.
// On the foreground thread: | ||
co_await wil::resume_foreground(_rootGrid.Dispatcher()); | ||
_summonWindowRoutineBody(args); | ||
_summonWindowRoutineBody(std::move(args)); | ||
} | ||
|
||
// Method Description: | ||
// - As above. | ||
// BODGY: ARM64 BUILD FAILED WITH fatal error C1001: Internal compiler error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we got a new compiler, is this still valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not even a coroutine any longer, so we can probably dispense with the separation entirely...
ScopedResourceLoader loader{ L"TerminalApp/ContextMenu" }; | ||
const auto appNameLoc = loader.GetLocalizedString(L"AppName"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 DH - Loading up somebody else's resources - probably moved to Emperor
HWND GetMainWindow() const noexcept; | ||
AppHost* GetWindowById(uint64_t id) const noexcept; | ||
AppHost* GetWindowByName(std::wstring_view name) const noexcept; | ||
void CreateNewWindow(winrt::TerminalApp::WindowRequestedArgs args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not const&
?
bool _registerHotKey(const int index, const winrt::Microsoft::Terminal::Control::KeyChord& hotkey) noexcept; | ||
void _unregisterHotKey(const int index) noexcept; | ||
safe_void_coroutine _setupGlobalHotkeys(); | ||
enum class TriBool : uint8_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAHAHAHAHAHAHAHAHAHAH
hahahahahaha
hahah
std::optional<bool>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::optional<bool>
is two bools in a trench coat, so... meh.
...but yeah I could do that.
const auto absoluteWindowOrigin = CoreWindow::GetForCurrentThread().Bounds(); | ||
// Get the offset (margin + tabs, etc..) of the control within the window | ||
const auto controlOrigin = TransformToVisual(nullptr).TransformPoint({}); | ||
const auto inverseScale = 1.0f / static_cast<float>(XamlRoot().RasterizationScale()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these don't seem related to regicide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoreWindow::GetForCurrentThread().Bounds()
won't work anymore, so this had to be rewritten. I also chose to use the technically correct way to get the rasterization scale (we do it incorrectly everywhere, according to the docs).
This comment has been minimized.
This comment has been minimized.
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details. Unrecognized words (2)IInput Previously acknowledged words that are now absentbarbaz DISPATCHNOTIFY Ralph stb 🫥To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the [email protected]:microsoft/terminal.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/12038853251/attempts/1' Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionaryThis includes both expected items (2229) from .github/actions/spelling/expect/alphabet.txt
Consider adding them (in with:
extra_dictionaries:
cspell:cpp/src/lang-jargon.txt
cspell:swift/src/swift.txt
cspell:gaming-terms/dict/gaming-terms.txt
cspell:monkeyc/src/monkeyc_keywords.txt
cspell:cryptocurrencies/cryptocurrencies.txt To stop checking additional dictionaries, add (in check_extra_dictionaries: '' Errors (1)See the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. ✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later. If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉 If the flagged items are 🤯 false positivesIf items relate to a ...
|
As before, a minor refactor:
it into and deduplicating its functionality with
WindowEmperor
.a single instance), I wrote single-instance code with a NT mutex
and by yeeting data across processes with
WM_COPYDATA
.way faster. The more I tried to solve them the deeper I had to dig,
because you can't just put a mutex around
CascadiaSettings
.I then tried to seeif WinUI can run multiple windows on a single
thread and, as it turns out, it can.
So, I removed the multi- from the window threading.
So, to finish it up, I had to clean up the entire eventing system
around
WindowEmperor
, cleaned up all the coroutines,and cleaned up all the callbacks.
Closes #16733
Closes #17799
Closes #18176
Closes #18191
TODO: Find other issues
Validation Steps Performed