Skip to content
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

Add support for running the Terminal without _any_ windows #14944

Merged
merged 134 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from 132 commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
581acd4
I definitely want all of this. But I started down a path for refactor…
zadjii-msft Jan 30, 2023
a5255ba
I don't think I want any of these
zadjii-msft Jan 30, 2023
e6220b7
Revert "I don't think I want any of these"
zadjii-msft Jan 30, 2023
936c01f
Start splitting AppLogic into AppLogic and Window logic
zadjii-msft Jan 30, 2023
439b21f
this is dangerously close to compiling
zadjii-msft Jan 30, 2023
99bc280
It doesn't crash on launch. That's something. There's no startupActio…
zadjii-msft Jan 31, 2023
2195515
it launches
zadjii-msft Jan 31, 2023
5116ca1
I think the todo's that are left, we can move on without them for now.
zadjii-msft Jan 31, 2023
ef7e2ed
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Jan 31, 2023
af14c2b
[TO PARENT] Move the page ctor call, so that it can happen after the …
zadjii-msft Jan 31, 2023
d456210
Use the single AppLogic for all windows. Remove the _app references. …
zadjii-msft Jan 31, 2023
f5b030c
it runs!
zadjii-msft Jan 31, 2023
2c4613a
wow it just... worked
zadjii-msft Feb 1, 2023
7a3e2e0
Start rewriting WindowManager to facilitate the new process model
zadjii-msft Feb 1, 2023
f655296
This does successfully get a window on the screen, which is pretty im…
zadjii-msft Feb 1, 2023
274d62d
it's working
zadjii-msft Feb 1, 2023
e623299
notes
zadjii-msft Feb 1, 2023
47336c0
[ainulindale] Clean tear down the `App` when the process exits
zadjii-msft Feb 3, 2023
9924e23
[ainulindale] "fix" hot reload
zadjii-msft Feb 3, 2023
f06e484
[ainulindale] This I'm confident fixes some of the x-thread errors, b…
zadjii-msft Feb 7, 2023
2822c36
[ainulindale] Expand commands in the AppLogic, not on each page
zadjii-msft Feb 7, 2023
2332f0c
Don't try to snap on create if we're not prepared to snap
zadjii-msft Feb 8, 2023
4e7da2e
I guess this is just dead now
zadjii-msft Feb 8, 2023
23c4d4c
Move the initialization of the showHide Throttler after we init the d…
zadjii-msft Feb 8, 2023
761bd6a
This one was dead code, 34 TODOs left
zadjii-msft Feb 8, 2023
93e9dc5
I guess we need to just hardcode these sizes. Sad, but okay.
zadjii-msft Feb 8, 2023
d5396d1
UWP is dead
zadjii-msft Feb 8, 2023
07ff418
Plumb initial load result into the window on startup
zadjii-msft Feb 8, 2023
40fdbc1
Hey this comment was TODOne, 29 TODOs left
zadjii-msft Feb 8, 2023
4db381e
not totally happy with this, but I understand why. 29 TODOs left
zadjii-msft Feb 8, 2023
64257d8
This straight up isn't even used in main anymore, 26 TODOs left
zadjii-msft Feb 8, 2023
3026922
Fix the window name not updating as it changed. Added some notes, so,…
zadjii-msft Feb 8, 2023
84e228f
Start to move window restoration into the Emperor
zadjii-msft Feb 8, 2023
dc1ae9a
Starting to move these things to the right places
zadjii-msft Feb 8, 2023
8bb8391
move more window persist code around.
zadjii-msft Feb 8, 2023
0f4c4d8
It persists, but it doesn't restore yet.
zadjii-msft Feb 8, 2023
a5a9930
Hey look I brought two windows back into existence!...
zadjii-msft Feb 8, 2023
6e6d14e
We're getting closer to loading up the previous state, but it doesn't…
zadjii-msft Feb 8, 2023
3fb8e8c
Hey this worked!
zadjii-msft Feb 8, 2023
4d5f6d2
cleanup. 18 TODOs remain
zadjii-msft Feb 8, 2023
a7379ca
It so SO works
zadjii-msft Feb 9, 2023
0b79e81
Summoning works, except for making new windows, but DANG
zadjii-msft Feb 9, 2023
950ce6c
make pane brushes a member variable, which is good enough
zadjii-msft Feb 7, 2023
055da35
Readd ShouldImmediatelyHandoffToElevated
zadjii-msft Feb 9, 2023
b0726c2
Handle Quit actions
zadjii-msft Feb 9, 2023
e214624
Re-add support for the notification icon.
zadjii-msft Feb 9, 2023
c69f0bc
Quake logic seems to work again.
zadjii-msft Feb 9, 2023
7e91bdb
This actually seems to make the lifetime management worse - we just d…
zadjii-msft Feb 9, 2023
0395dc4
Revert "This actually seems to make the lifetime management worse - w…
zadjii-msft Feb 9, 2023
f904e5d
I give up and am moving on to the next TODOs. 8 TODOs remain
zadjii-msft Feb 10, 2023
4548729
Some additional cleanup of the WindowManager code
zadjii-msft Feb 10, 2023
7660937
and with that, we're ready to cleanup for review.
zadjii-msft Feb 10, 2023
0ad5b59
I think it's ready for review
zadjii-msft Feb 10, 2023
cfa6108
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/fore…
zadjii-msft Feb 10, 2023
e40575b
let's do it
zadjii-msft Feb 10, 2023
dffb416
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 10, 2023
a769933
merges are hard some times
zadjii-msft Feb 10, 2023
33685d9
bwahahahahaha
zadjii-msft Feb 13, 2023
a4f19a9
spel
zadjii-msft Feb 13, 2023
1ec8c0d
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 13, 2023
2621519
cleanup for review
zadjii-msft Feb 13, 2023
603a2ce
spel
zadjii-msft Feb 13, 2023
a9ac218
runformat
zadjii-msft Feb 13, 2023
82224bc
this was usnused
zadjii-msft Feb 13, 2023
d9d4d2e
get the tests to build, at least
zadjii-msft Feb 13, 2023
3f9deca
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 13, 2023
118bffa
fix the tests
zadjii-msft Feb 14, 2023
aa8b0c5
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 14, 2023
bc80943
the tests all...pass?
zadjii-msft Feb 14, 2023
667b658
I'm committing everything just in case, but I'm gonna revert and just…
zadjii-msft Feb 15, 2023
2bc578b
Revert "I'm committing everything just in case, but I'm gonna revert …
zadjii-msft Feb 15, 2023
62a4ee0
https://media.tenor.com/knFWHfkiwoUAAAAC/im-fine-hades.gif
zadjii-msft Feb 15, 2023
091f32c
a comment to go with the parent commit
zadjii-msft Feb 15, 2023
ecab57f
that was quite silly
zadjii-msft Feb 16, 2023
13257da
0 TODOs remain
zadjii-msft Feb 16, 2023
9a47396
[ainulindale] The Terminal shouldn't crash on a WM_SETTINGCHANGE
zadjii-msft Feb 23, 2023
273f2a8
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/fore…
zadjii-msft Feb 23, 2023
c79f27c
std::vectors are better
zadjii-msft Feb 27, 2023
b75fb24
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 27, 2023
cacb822
Dustin wanted a setting to opt-in to isolated mode, and this seems to…
zadjii-msft Feb 27, 2023
b589d09
Lots of PR nits
zadjii-msft Feb 28, 2023
0199aba
the last nits, I think
zadjii-msft Feb 28, 2023
5e23a72
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Feb 28, 2023
ada3f42
well that is an underwhelming codeformat commit. Thanks VS
zadjii-msft Feb 28, 2023
5164bff
hey that's a good point carlos
zadjii-msft Feb 28, 2023
7e2eb0d
Apply suggestions from code review
zadjii-msft Mar 2, 2023
5c852c3
some smaller nits
zadjii-msft Mar 2, 2023
1e331a0
Merge branch 'dev/migrie/oop/3/ainulindale' of https://github.com/mic…
zadjii-msft Mar 2, 2023
8e2c7a7
some cleanup
zadjii-msft Mar 2, 2023
08f6a53
This is gross but reduces the number of redundant copies of these bru…
zadjii-msft Mar 2, 2023
8803324
spelling is hard
zadjii-msft Mar 2, 2023
b983c69
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Mar 2, 2023
3aa083b
sure. It doesn't matter'
zadjii-msft Mar 2, 2023
2d6fbc9
Merge branch 'dev/migrie/oop/3/quenta-silmarillion' into dev/migrie/o…
zadjii-msft Mar 2, 2023
4182742
oh this SO could have been one commit
zadjii-msft Mar 2, 2023
9a9fa43
[ainulindale] Prevent a race between the Emperor and the window logic…
zadjii-msft Mar 6, 2023
b24cf61
some of the more minor cleanup elements
zadjii-msft Mar 7, 2023
3fa1017
one fewer IReference, thank gods
zadjii-msft Mar 7, 2023
5fe3fa5
some cleanup around expanding commands
zadjii-msft Mar 8, 2023
b0ca581
.detach so we don't std::explode()
zadjii-msft Mar 8, 2023
74af809
mmmm fresh cut code
zadjii-msft Mar 8, 2023
547b2c9
you never get used either
zadjii-msft Mar 8, 2023
6f6880c
this is more idomatic locking cause it's actually locking
zadjii-msft Mar 8, 2023
1dc2436
weak refs for fun and profit
zadjii-msft Mar 8, 2023
6e4b2e1
Guess what's LOAD BEARING
zadjii-msft Mar 9, 2023
7721813
pr nits
zadjii-msft Mar 9, 2023
6dead99
PR nits
zadjii-msft Mar 9, 2023
434abc2
Remove the need for TerminalPage to know the number of open windows
zadjii-msft Mar 9, 2023
1b59eb9
save this for later, we should only need ot look it up once
zadjii-msft Mar 9, 2023
39a9450
to wit, also make sure that there is a tablayout
zadjii-msft Mar 9, 2023
44b238e
Redo how ownership of WindowProperties works. This is cleaner by a go…
zadjii-msft Mar 9, 2023
073350e
fix the tests too
zadjii-msft Mar 10, 2023
ca511c9
this is why I don't use VS
zadjii-msft Mar 10, 2023
f70775a
I don't trust you phyllis
zadjii-msft Mar 10, 2023
81140a5
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Mar 10, 2023
339972e
tests build and pass again
zadjii-msft Mar 10, 2023
6d04353
yea we can fold this in
zadjii-msft Mar 10, 2023
1138416
hey let's make sure it still works
zadjii-msft Mar 10, 2023
9957e5c
I think that's the last of the nits
zadjii-msft Mar 10, 2023
6a0b1cd
Merge branch 'dev/migrie/oop/3/ainulindale' into dev/migrie/oop/3/fea…
zadjii-msft Mar 10, 2023
6aec80b
A hotfix for the selfhost build
zadjii-msft Mar 13, 2023
155bc98
[unchaining of melkor] Y'know, maybe this isn't a sensible default af…
zadjii-msft Mar 14, 2023
0808f94
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/fore…
zadjii-msft Mar 17, 2023
5b3dc08
last nits, let's do this
zadjii-msft Mar 17, 2023
59b07f1
Merge branch 'dev/migrie/oop/3/foreword' into dev/migrie/oop/3/ainuli…
zadjii-msft Mar 17, 2023
7142ae8
[ainulindale] fix defterm
zadjii-msft Mar 16, 2023
d55bb43
[ainulindale] windows should get activated when they're created
zadjii-msft Mar 16, 2023
11f9957
[ainulindale] Friendship ended with callbacks
zadjii-msft Mar 17, 2023
55ee49b
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/ainu…
zadjii-msft Mar 17, 2023
1e4cc33
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/ainu…
zadjii-msft Mar 17, 2023
d08d8ab
Merge remote-tracking branch 'origin/dev/migrie/oop/3/ainulindale' in…
zadjii-msft Mar 20, 2023
10913b8
Merge branch 'main' into dev/migrie/oop/3/feanor-and-the-unchaining-o…
zadjii-msft Mar 20, 2023
9942d55
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/fean…
zadjii-msft Mar 24, 2023
8329b52
Merge remote-tracking branch 'origin/main' into dev/migrie/oop/3/fean…
zadjii-msft Apr 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/cascadia/TerminalApp/AppLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,16 @@ namespace winrt::TerminalApp::implementation
globals.MinimizeToNotificationArea();
}

bool AppLogic::AllowHeadless()
{
if (!_loadedInitialSettings)
{
// Load settings if we haven't already
ReloadSettings();
}
return _settings.GlobalSettings().AllowHeadless();
}

TerminalApp::TerminalWindow AppLogic::CreateNewWindow()
{
if (_settings == nullptr)
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/AppLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace winrt::TerminalApp::implementation

Microsoft::Terminal::Settings::Model::Theme Theme();
bool IsolatedMode();
bool AllowHeadless();
bool RequestsTrayIcon();

TerminalApp::TerminalWindow CreateNewWindow();
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/AppLogic.idl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace TerminalApp
// Selected settings to expose
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
Boolean IsolatedMode { get; };
Boolean AllowHeadless { get; };
Boolean RequestsTrayIcon { get; };

FindTargetWindowResult FindTargetWindow(String[] args);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/GlobalAppSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
INHERITABLE_SETTING(Boolean, EnableColorSelection);
INHERITABLE_SETTING(Boolean, IsolatedMode);
INHERITABLE_SETTING(Boolean, AllowHeadless);

Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
void AddColorScheme(ColorScheme scheme);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/MTSMSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Author(s):
X(bool, TrimPaste, "trimPaste", true) \
X(bool, EnableColorSelection, "experimental.enableColorSelection", false) \
X(winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry>, NewTabMenu, "newTabMenu", winrt::single_threaded_vector<Model::NewTabMenuEntry>({ Model::RemainingProfilesEntry{} })) \
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
X(bool, IsolatedMode, "compatibility.isolatedMode", false)

#define MTSM_PROFILE_SETTINGS(X) \
Expand Down
10 changes: 9 additions & 1 deletion src/cascadia/WindowsTerminal/WindowEmperor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ void WindowEmperor::_windowExitedHandler(uint64_t senderID)
return w->Peasant().GetID() == senderID;
});

if (lockedWindows->size() == 0)
// When we run out of windows, exit our process if and only if:
// * We're not allowed to run headless OR
// * we've explicitly been told to "quit", which should fully exit the Terminal.
const bool noMoreWindows{ lockedWindows->size() == 0 };
const bool quitWhenLastWindowExits{ !_app.Logic().AllowHeadless() };
if (noMoreWindows &&
(_quitting || quitWhenLastWindowExits))
{
_close();
}
Expand Down Expand Up @@ -276,6 +282,8 @@ void WindowEmperor::_numberOfWindowsChanged(const winrt::Windows::Foundation::II
void WindowEmperor::_quitAllRequested(const winrt::Windows::Foundation::IInspectable&,
const winrt::Microsoft::Terminal::Remoting::QuitAllRequestedArgs& args)
{
_quitting = true;

// Make sure that the current timer is destroyed so that it doesn't attempt
// to run while we are in the middle of quitting.
if (_getWindowLayoutThrottler.has_value())
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/WindowsTerminal/WindowEmperor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class WindowEmperor : public std::enable_shared_from_this<WindowEmperor>

std::unique_ptr<NotificationIcon> _notificationIcon;

bool _quitting{ false };

void _windowStartedHandler(const std::shared_ptr<WindowThread>& sender);
void _windowExitedHandler(uint64_t senderID);

Expand Down