2019-11-07 22:10:58 +01:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
2020-08-21 00:44:37 +02:00
|
|
|
import "TerminalPage.idl";
|
|
|
|
import "ShortcutActionDispatch.idl";
|
|
|
|
import "IDirectKeyListener.idl";
|
2019-11-07 22:10:58 +01:00
|
|
|
|
|
|
|
namespace TerminalApp
|
|
|
|
{
|
2020-08-28 05:49:16 +02:00
|
|
|
struct InitialPosition
|
|
|
|
{
|
|
|
|
Int64 X;
|
|
|
|
Int64 Y;
|
|
|
|
};
|
|
|
|
|
2020-07-01 21:43:28 +02:00
|
|
|
[default_interface] runtimeclass AppLogic : IDirectKeyListener, IDialogPresenter
|
2020-05-04 22:56:15 +02:00
|
|
|
{
|
2019-11-07 22:10:58 +01:00
|
|
|
AppLogic();
|
|
|
|
|
|
|
|
// For your own sanity, it's better to do setup outside the ctor.
|
|
|
|
// If you do any setup in the ctor that ends up throwing an exception,
|
|
|
|
// then it might look like TermApp just failed to activate, which will
|
|
|
|
// cause you to chase down the rabbit hole of "why is TermApp not
|
|
|
|
// registered?" when it definitely is.
|
|
|
|
void Create();
|
2019-11-26 01:30:45 +01:00
|
|
|
|
2019-12-09 20:07:08 +01:00
|
|
|
Boolean IsUwp();
|
2019-11-26 01:30:45 +01:00
|
|
|
void RunAsUwp();
|
2020-03-11 16:52:09 +01:00
|
|
|
Boolean IsElevated();
|
2019-11-07 22:10:58 +01:00
|
|
|
|
2020-01-27 16:34:12 +01:00
|
|
|
Int32 SetStartupCommandline(String[] commands);
|
Add `Microsoft.Terminal.Remoting.dll` (#8607)
Adds a `Microsoft.Terminal.Remoting.dll` to our solution. This DLL will
be responsible for all the Monarch/Peasant work that's been described in
#7240 & #8135.
This PR does _not_ implement the Monarch/Peasant architecture in any
significant way. The goal of this PR is to just to establish the project
layout, and the most basic connections. This should make reviewing the
actual meat of the implementation (in a later PR) easier. It will also
give us the opportunity to include some of the basic weird things we're
doing (with `CoRegisterClass`) in the Terminal _now_, and get them
selfhosted, before building on them too much.
This PR does have windows registering the `Monarch` class with COM. When
windows are created, they'll as the Monarch if they should create a new
window or not. In this PR, the Monarch will always reply "yes, please
make a new window".
Similar to other projects in our solution, we're adding 3 projects here:
* `Microsoft.Terminal.Remoting.lib`: the actual implementation, as a
static lib.
* `Microsoft.Terminal.Remoting.dll`: The implementation linked as a DLL,
for use in `WindowsTerminal.exe`.
* `Remoting.UnitTests.dll`: A unit test dll that links with the static
lib.
There are plenty of TODOs scattered about the code. Clearly, most of
this isn't implemented yet, but I do have more WIP branches. I'm using
[`projects/5`](https://github.com/microsoft/terminal/projects/5) as my
notation for TODOs that are too small for an issue, but are part of the
whole Process Model 2.0 work.
## References
* #5000 - this is the process model megathread
* #7240 - The process model 2.0 spec.
* #8135 - the window management spec. (please review me, I have 0/3
signoffs even after the discussion we had 😢)
* #8171 - the Monarch/peasant sample. (please review me, I have 1/2)
## PR Checklist
* [x] Closes nothing, this is just infrastructure
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated
2021-01-07 23:59:37 +01:00
|
|
|
Int32 ExecuteCommandline(String[] commands);
|
2020-05-04 22:56:15 +02:00
|
|
|
String ParseCommandlineMessage { get; };
|
|
|
|
Boolean ShouldExitEarly { get; };
|
2020-01-27 16:34:12 +01:00
|
|
|
|
2019-11-07 22:10:58 +01:00
|
|
|
void LoadSettings();
|
|
|
|
Windows.UI.Xaml.UIElement GetRoot();
|
|
|
|
|
|
|
|
String Title { get; };
|
|
|
|
|
2020-07-14 23:02:18 +02:00
|
|
|
Boolean FocusMode { get; };
|
|
|
|
Boolean Fullscreen { get; };
|
|
|
|
Boolean AlwaysOnTop { get; };
|
|
|
|
|
Add support for running a `wt` commandline in the curent window WITH A KEYBINDING (#6537)
## Summary of the Pull Request
Adds a execute commandline action (`wt`), which lets a user bind a key to a specific `wt` commandline. This commandline will get parsed and run _in the current window_.
## References
* Related to #4472
* Related to #5400 - I need this for the commandline mode of the Command Palette
* Related to #5970
## PR Checklist
* [x] Closes oh, there's not actually an issue for this.
* [x] I work here
* [x] Tests added/passed
* [ ] Requires documentation to be updated - yes it does
## Detailed Description of the Pull Request / Additional comments
One important part of this change concerns how panes are initialized at runtime. We've had some persistent trouble with initializing multiple panes, because they rely on knowing how big they'll actually be, to be able to determine if they can split again.
We previously worked around this by ignoring the size check when we were in "startup", processing an initial commandline. This PR however requires us to be able to know the initial size of a pane at runtime, but before the parents have necessarily been added to the tree, or had their renderer's set up.
This led to the development of `Pane::PreCalculateCanSplit`, which is very highly similar to `Pane::PreCalculateAutoSplit`. This method attempts to figure out how big a pane _will_ take, before the parent has necessarily laid out.
This also involves a small change to `TermControl`, because if its renderer hasn't been set up yet, it'll always think the font is `{0, fontHeight}`, which will let the Terminal keep splitting in the x direction. This change also makes the TermControl set up a renderer to get the real font size when it hasn't yet been initialized.
## Validation Steps Performed
This was what the json blob I was using for testing evolved into
```json
{
"command": {
"action":"wt",
"commandline": "new-tab cmd.exe /k #work 15 ; split-pane cmd.exe /k #work 15 ; split-pane cmd.exe /k media-commandline ; new-tab powershell dev\\symbols.ps1 ; new-tab -p \"Ubuntu\" ; new-tab -p \"haunter.gif\" ; focus-tab -t 0",
},
"keys": ["ctrl+shift+n"]
}
```
I also added some tests.
# TODO
* [x] Creating a `{ "command": "wt" }` action without a commandline will spawn a new `wt.exe` process?
- Probably should just do nothing for the empty string
2020-07-17 23:05:29 +02:00
|
|
|
Windows.Foundation.Size GetLaunchDimensions(UInt32 dpi);
|
|
|
|
|
2020-08-28 05:49:16 +02:00
|
|
|
InitialPosition GetInitialPosition(Int64 defaultInitialX, Int64 defaultInitialY);
|
2019-11-07 22:10:58 +01:00
|
|
|
Windows.UI.Xaml.ElementTheme GetRequestedTheme();
|
2020-10-06 18:56:59 +02:00
|
|
|
Microsoft.Terminal.Settings.Model.LaunchMode GetLaunchMode();
|
2019-11-07 22:10:58 +01:00
|
|
|
Boolean GetShowTabsInTitlebar();
|
2020-11-02 19:51:29 +01:00
|
|
|
Boolean GetInitialAlwaysOnTop();
|
2020-01-08 22:19:23 +01:00
|
|
|
Single CalcSnappedDimension(Boolean widthOrHeight, Single dimension);
|
2019-11-07 22:10:58 +01:00
|
|
|
void TitlebarClicked();
|
|
|
|
void WindowCloseButtonClicked();
|
|
|
|
|
2020-11-18 23:24:11 +01:00
|
|
|
UInt64 GetLastActiveControlTaskbarState();
|
|
|
|
UInt64 GetLastActiveControlTaskbarProgress();
|
|
|
|
|
2020-07-01 21:43:28 +02:00
|
|
|
// See IDialogPresenter and TerminalPage's DialogPresenter for more
|
|
|
|
// information.
|
|
|
|
Windows.Foundation.IAsyncOperation<Windows.UI.Xaml.Controls.ContentDialogResult> ShowDialog(Windows.UI.Xaml.Controls.ContentDialog dialog);
|
|
|
|
|
2019-11-07 22:10:58 +01:00
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
|
|
|
|
event Windows.Foundation.TypedEventHandler<Object, String> TitleChanged;
|
|
|
|
event Windows.Foundation.TypedEventHandler<Object, LastTabClosedEventArgs> LastTabClosed;
|
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.ElementTheme> RequestedThemeChanged;
|
2020-07-14 23:02:18 +02:00
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> FocusModeChanged;
|
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> FullscreenChanged;
|
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> AlwaysOnTopChanged;
|
2020-11-18 23:55:10 +01:00
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> RaiseVisualBell;
|
2020-11-18 23:24:11 +01:00
|
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> SetTaskbarProgress;
|
2019-11-07 22:10:58 +01:00
|
|
|
}
|
|
|
|
}
|