Commit Graph

3520 Commits

Author SHA1 Message Date
James Pack 5ca7991ded Disable the context menu command inside a zipped folder (#15236)
Closes #15190

(cherry picked from commit fea6eeddfd)
Service-Card-Id: 89001983
Service-Version: 1.17
2023-04-25 17:31:29 -05:00
Kevin Kostrzewa 31dc6d80c5 Fix focus issue when profile selected from nested menu entry (#15077)
Original bug report #15049
Relates to feature #1571

MenuFlyoutSubItem, when collapsing from profile selection, move focus
back to the titlebar.
An extra Closing event handler is needed to keep focus on the command
shell.

Closes #15049

(cherry picked from commit def3742a2e)
Service-Card-Id: 89002014
Service-Version: 1.17
2023-04-25 17:31:27 -05:00
James Pack 9ba0636590 Default to XamlRoot when unable to find focused object (#15189)
Default to XamlRoot when unable to find a focused object in
DirectKeyEvents

This may not be the most appropriate "fix" for this. Certainly open to
criticism and feedback. We are trapping the alt+space key chord on the
win32 side and forwarding it to the xaml side. There we try to find a
focused object by walking the xaml tree. If we are unable to find a
focused object we return false and do nothing. I suspect that the area
that has focus that prevents this from working normally is on the win32
side. Since we want to handle the system menu anyway and are explicitly
trapping that key combo and forwarding it on I thought this was the best
approach. If we cant find a focused object default to the xaml root.

System menu opens as it should.

Closes #14397

(cherry picked from commit 210414e5a8)
Service-Card-Id: 89001997
Service-Version: 1.17
2023-04-25 17:31:21 -05:00
Ben Constable 57264e0b2a Add automation heading level 1 to fix about dialog (#15200)
Add automation heading level 1 to fix the about dialog by adding an
automation property.

Allows screen reader to pick up that this is a heading and read
properly.

Closes #11912

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
(cherry picked from commit ffda8c4a95)
Service-Card-Id: 89001995
Service-Version: 1.17
2023-04-25 17:29:37 -05:00
James Pack f4da9c0e98 Add a warning when a proportional font is selected (#15195)
## Summary of the Pull Request
Add an infobar warning when a non-monospaced font is selected.
## References and Relevant Issues
#13389
## Detailed Description of the Pull Request / Additional comments
I initially had the `IsOpen` property of the infobar bound to the
`ShowAllFonts` checkbox property. However, I felt we could do better by
adding a property for it since there was already a method defined to
inspect whether the selected font was in the `MonoSpaceFontList`.
## Validation Steps Performed
Warning shows up when a non-monospaced font is selected either globally
or on individual profiles. All existing tests continue to pass.
<img width="868" alt="image"
src="https://user-images.githubusercontent.com/2086722/232594214-cd42397b-ce9d-499c-aa73-3feaa45e850e.png">

## PR Checklist
- [x] Closes #13389
- [x] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ ] Schema updated (if necessary)

(cherry picked from commit 2c165438ef)
Service-Card-Id: 89001996
Service-Version: 1.17
2023-04-25 17:28:46 -05:00
Leonard Hecker 4d4111b9ed Avoid animations during startup (#15204)
This fixes 3 sources for animations:
* `TabView`'s `EntranceThemeTransition` causes tabs to slowly slide in
  from the bottom. Removing the transition requires you to override the
  entire list of transitions obviously, which is a global change. Nice.
  Am I glad I don't need to deal with the complexity of CSS. /s
* `TabBase`, `SettingsTab` and `TerminalTab` were using a lot of
  coroutines with `resume_foreground` even though almost none of the
  functions are called from background tabs in the first place. This
  caused us to miss the initial XAML drawing pass, which resulted in
  animations when the tab icons would asynchronously pop into existence.
  It also appears as if `resume_foreground`, etc. have a very high CPU
  cost attached, which surprises me absolutely not at all given WinRT.

The improvement is difficult to quantify because the run to run
variation is very high. But it seems like this shaves about 10% off
of the ~500ms startup delay on my PC depending on how you measure it.

Part of #5907

* It starts when it should 
* It doesn't "exit" when it shouldn't 
  (Scrolling, Settings reload, Bell `\a`, Progress `\e]9;4;2;80\e\\`)

(cherry picked from commit 35b9e75574)
Service-Card-Id: 89001994
Service-Version: 1.17
2023-04-25 17:28:44 -05:00
James Pack 5d1ecce97c Add subtext to why Always show tabs is not toggleable in SUI. (#15154)
## Summary of the Pull Request
Add subtext that lets the user know why Always show tabs is not
toggleable in SUI. Also adds some additional information to the comment
for this value that points to the Globals_ShowTitlebar.Header setting.

## References and Relevant Issues
#13984
## Detailed Description of the Pull Request / Additional comments
Simple updates to the resources that add some additional helpful
information for the user.
## Validation Steps Performed
Verified the updates show in the SUI and that they render correctly.
## PR Checklist
- [ ] Closes #13984
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ ] Schema updated (if necessary)

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
(cherry picked from commit 27bcf7e41c)
Service-Card-Id: 89001999
Service-Version: 1.17
2023-04-25 17:27:55 -05:00
James Pack dd02ef0666 Skip generating a profile for rancher-desktop (#15166)
Don't generate a profile for rancher-desktop utility WSL distro.

Adds a check for rancher-desktop as well as docker. As mentioned in the
discussion of this issue. This becomes much more difficult to maintain
once other folks inevitably start to follow this pattern. But the easy
win was up for grabs so I took it :)

Closes #12757

(cherry picked from commit 10bdadffbd)
Service-Card-Id: 89001998
Service-Version: 1.17
2023-04-25 17:27:53 -05:00
Dustin L. Howett cd28ed7a4a When unpackaged, isolate the monarch by the install path (#15118)
Unpackaged installations don't have the luxury of magic package
isolation to stop them from accidentally touching each other's monarchs.
We need to enforce that ourselves by making their monarch CLSIDs unique
per install.

We'll use a v5 UUID based on the install folder to unique them.

Closes #15117

(cherry picked from commit 5f70920491)
Service-Card-Id: 89002000
Service-Version: 1.17
2023-04-25 17:27:52 -05:00
Alex Noble a1882ce852 Add options to enable and disable read only mode (#14995)
## Summary of the Pull Request
PR adds functionality to enable or disable readOnly mode within panes.
This functionality is different to toggling as if you call the same
functionality twice, it will not toggle between states.

## References and Relevant Issues
- Closes https://github.com/microsoft/terminal/issues/14415
- Documentation https://github.com/MicrosoftDocs/terminal/pull/645

## Validation Steps Performed
- Checked readOnly is enabled when command triggered
- Checked readOnly is enabled when command triggered while read only
already enabled
- Checked readOnly is disabled when command triggered while read only is
enabled
- Checked readOnly stays disabled when command triggered while read only
is disabled
- Checked above with multiple tabs and split panes

## PR Checklist
- [ ] Closes #14415
- [X] Tests added/passed
- [x] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here:
https://github.com/MicrosoftDocs/terminal/pull/645
- [X] Schema updated (if necessary)

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
(cherry picked from commit 2acdc9d7e2)
Service-Card-Id: 89002012
Service-Version: 1.17
2023-04-25 17:26:24 -05:00
Dustin L. Howett d48870c49b Helix: Decode HTML entities in the test comment field (#15141
I have observed the test comment coming back from Helix with `&quot;`
and friends in it.

It ends badly as you might imagine.

This unescape will be a no-op if the data is already well-formed.

(cherry picked from commit 90bbd2927d)
Service-Card-Id:
Service-Version: 1.17
2023-04-14 15:11:05 -05:00
Dustin L. Howett 0eafd10e3d PGO: Update the Helix payload to rely on the unpackaged distribution (#15123)
The unpackaged distribution was made for this exact use, so let's *do
it*!

(cherry picked from commit c7498a4269)
Service-Card-Id: 88876486
Service-Version: 1.17
2023-04-14 15:11:04 -05:00
Dustin L. Howett 436c037021 Only try to hand off to ConhostV1 if building for Windows (#15131)
Some of our automated tooling detects this as being a private API that
we're accessing via LoadLibrary/GetProcAddress. It's not *wrong*, but
it's also not *right*.

It's easier for us to just not do it (and save all the code for it!) in
OpenConsole.

(cherry picked from commit 7fbd3be8c3)
Service-Card-Id: 88788306
Service-Version: 1.17
2023-04-14 15:08:11 -05:00
Dustin L. Howett 99ac5f632f wpf: Bump the history length to 9001 instead of 1000 (#15129)
This was an oversight in the original implementation.

(cherry picked from commit de09671d8a)
Service-Card-Id: 88787776
Service-Version: 1.17
2023-04-14 15:07:09 -05:00
Mike Griese 55f7bec9d1 Add "legacy" themes (#15108)
This is a minimal version of the requests for #14858. In that thread we
discussed FULL reverting the default themes to the old ones. In later
discussion, we decided _meh_, let's just ship the legacy themes too, so
it's easy to go back if you should choose. The default still remains the
sane `dark`, but the `legacy*` themes are all right there, and given the
same special treatment as the other inbox themes.

Closes #14858
Closes #14844

(cherry picked from commit fe66ba5f58)
Service-Card-Id: 88785748
Service-Version: 1.17
2023-04-14 15:07:08 -05:00
Dustin L. Howett 9c9e8ecc91 Stop the beef when you hover off a hyperlink (#15120)
Big surprise, apparently W.F.Uri can parse the empty string into
garbage!

(cherry picked from commit a98a0cf2c6)
Service-Card-Id: 88773730
Service-Version: 1.17
2023-04-14 15:07:06 -05:00
Leonard Hecker 65324d6049 Replace statics in headers with inline constants (#15100)
C++ is a very well balanced and reasonable language, which is why
`static` inside classes means "shared between all instances", whereas
`static` outside of classes means "not shared between all .cpp files".

32 years after this problem was written onto parchment it was fixed with
the introduction of inline variables in C++17, which tell the compiler
to deduplicate variables the same way it deduplicates functions.

(cherry picked from commit 47a17cf2d7)
Service-Card-Id: 88757825
Service-Version: 1.17
2023-04-04 16:13:58 -05:00
Dustin L. Howett 87333f79ed Format URLs for display when we show the tooltip (#15095)
This will reduce the incidence of confusables, RTL, and non-printables
messing with the display of the URL.

(cherry picked from commit 06174a9cb3)
Service-Card-Id: 88740699
Service-Version: 1.17
2023-04-04 16:13:26 -05:00
Dustin L. Howett 30419b99df Add "portable mode", where settings load from the install path (#15051)
This pull request implements portable mode for Windows Terminal, which
will make side by side deployment of different versions generally more
feasible.

Portable mode was specified in #15032.

There are three broad categories of changes in this PR:

1. Changes to settings loading.
2. A new indicator in the settings UI plus a link to the portable mode
   docs.
3. A new application display name, `Terminal (Portable)`, which users
   will hopefully include in their bug reports.

It's surprisingly small for how big a deal it is!

Related to #15034
Closes #1386

(cherry picked from commit e6a3fa8d4e)
Service-Card-Id: 88719279
Service-Version: 1.17
2023-03-31 17:47:57 -05:00
Dustin L. Howett c16e5d99cc Add support for an unpackaged distribution of Terminal (#15034)
Since the removal of the Win10-specific variant of the Terminal MSIX in
#15031, there has been no officially-sanctioned (or even unofficially
tested!) way to get an unzippable double-click-runnable version of
Windows Terminal.

Due to a quirk in the resource loading system, an unpackaged
distribution of Terminal needs to ship all of XAML's resources and all
of is own resources in a single `resources.pri` file. The tooling to
support this is minimal, and we were previously just coasting by on
Visual Studio's generosity plus how the prerelease distribution of XAML
embedded itself into the consuming package.

This pull request introduces a build phase plus a supporting script (or
three) that produces a ZIP file distribution of Windows Terminal when
given a Terminal MSIX and an XAML AppX.

The three scripts are:

1. A script to merge any number of PRI files and/or PRI dump files (made
   with `makepri dump /dt detailed`)
2. A script that specifically merges XAML's resources with Terminal's.
   This is necessary because the XAML package emits a couple PRI
   resources into Terminal's resources _even when it is not
   co-packaged._ We need to remove the conflicting resources.
3. Finally, a script to take a WT and XAML distribution and combine them
   -- resources, files, everything -- and strip out the things that we
   don't need. This script is an all-in-one that calls the other two and
   produces a ZIP file at the end.

The final distribution is named after the PFN
(`Microsoft.WindowsTerminal`, or `...Preview` or `WindowsTerminalDev`),
the version number and the architecture. When expanded, it produces a
directory named `terminal-X.Y.Z.A` (version number.)

I've also added the build script to the release pipeline.

As a treat, this also produces an unpackaged distribution out of every
CI build... that way, contributors can download live deployable copies
of WT Unpackaged to test out their changes. Pretty cool.

Refs #1386

(cherry picked from commit dd63a0590b)
Service-Card-Id: 88602021
Service-Version: 1.17
2023-03-31 17:47:56 -05:00
Dustin L. Howett 9523d6ad20 Add flexible virtualization rules for HKCU\Console\Startup (#15050)
[Flexible Virtualization] is a little more restrictive than
`unvirtualizedResources`, but it's more descriptive and stands a chance
of working on Windows 10.

This makes `unvirtualizedResources` actually work for us - we can tell
the system exactly which registry keys we want to use. This is required
for our registry writes to work on Windows 10.

[Flexible Virtualization]:
https://learn.microsoft.com/en-us/windows/msix/desktop/flexible-virtualization

(cherry picked from commit c7816fdb05)
Service-Card-Id: 88719280
Service-Version: 1.17
2023-03-31 17:47:55 -05:00
Leonard Hecker 799d48ffea Fix font size of HTML clipboard contents (#15046)
This regression is caused by 0eff8c0. It previously said `.Y` here.
I went through the diff again and found no other width/height mistake.

Closes #14762
Closes #15043

(cherry picked from commit d9efdae982)
Service-Card-Id: 88652707
Service-Version: 1.17
2023-03-31 17:47:53 -05:00
Dustin L. Howett acd32f252d Add a second way of detecting whether DefTerm is available (#15040)
This will become meaningful soon.

(cherry picked from commit c4d029829a)
Service-Card-Id: 88617801
Service-Version: 1.17
2023-03-31 17:47:52 -05:00
Dustin L. Howett 9b4fbff1a2 Consolidate our MSIX distribution back down to one package (#15031)
We ship a separate package to Windows 10, which contains a copy of XAML
embedded in it, because of a bug in activating classes from framework
packages while we're elevated.

We did this to avoid wasting disk space on Windows 11 installs (which is
critical given that we're preinstalled in the Windows image.)

The fix for this issue was released in a servicing update in April 2022.
Thanks to KB5011831, we no longer need this workaround!

And finally, this means that we no longer need to depend on a copy of
"pre-release" XAML. We only did that because it would copy all of its
assets into our package.

Introduced in #12560
Closes #14106
Closes (discussion) #14981
Reverts #14660

(cherry picked from commit f5e9e8ea77)
Service-Card-Id: 88600517
Service-Version: 1.17
2023-03-31 17:47:51 -05:00
Dustin L. Howett d6d35610bc VsDevCmdGenerator: respect the user's startingDirectory (#15035)
The PowerShell equivalent was added in the initial pull request, #7774.

Closes #13721

(cherry picked from commit f06cd1759f)
Service-Card-Id: 88719282
Service-Version: 1.17
2023-03-31 17:47:34 -05:00
Dustin L. Howett 31ae78d1bc Remove useRegExe and add rescap:unvirtualizedResources (#15028)
Due to a limitation in the Windows App Installer UI, Terminal had to
shell out to `reg.exe` to write the Delegation registry keys. The team
in charge of AppInstaller lifted that (once by-policy) limitation.

Therefore, we can remove our BODGY workaround.

(cherry picked from commit e0046a4cca)
Service-Card-Id: 88581048
Service-Version: 1.17
2023-03-31 17:47:33 -05:00
Dustin L. Howett d8c8e780b6 Enable the Hybrid CRT for all C++ projects (#15010)
The less we need the C++ runtime, the better.

I measured this as growing our package by a fair amount...
but less than the size of XamlHost and all the forwarders combined.

Reducing our dependency surface makes us easier to deploy and more
reliable.

_as of 1.17 (2022-10)_

| **File**                | **Before** | **After** |        **Delta** |
| ----------------------- | ----------:| ---------:| ----------------:|
| `OpenConsole`           |  1,273,344 | 1,359,360 |   +86,016 (84kb) |
| `TerminalApp`           |  2,037,248 | 2,120,704 |   +83,456 (82kb) |
| `TerminalControl`       |  1,412,608 | 1,502,720 |   +90,112 (88kb) |
| `TerminalSettingsModel` |  1,510,912 | 1,621,504 | +110,592 (108kb) |
| `wt`                    |     97,280 |   122,368 |   +25,088 (25kb) |
| `WindowsTerminal`       |    508,928 |   575,488 |   +66,560 (65kb) |
| **MSIX Overall**        |  6,488,301 | 6,799,017 | +310,716 (303kb) |

(cherry picked from commit b6bb3e0a80)
Service-Card-Id: 88536379
Service-Version: 1.17
2023-03-31 17:47:32 -05:00
Mike Griese a33fdcfd75 Properly configure the project dependencies for TerminalAzBridge (#15008)
I don't think this is the resolution for #14581, but this can't hurt. These deps were using the wrong GUIDs

(cherry picked from commit 5c9f756891)
Service-Card-Id: 88719283
Service-Version: 1.17
2023-03-31 17:47:27 -05:00
Mike Griese 31aa23f717 Allow wsl$ in file URIs; generally allow all URI schemes (#14993)
Does two things related to URLs emitted via OSC8.

* Allows `wsl$` and `wsl.localhost` as the hostname in `file://` URIs
* Generally allows _all_ URIs that parse as a URI.

The relevant security comments: https://github.com/microsoft/terminal/pull/7526#issuecomment-764160208
> this doesn't let a would-be attacker specify command-line arguments (ala "cmd.exe /s /c do_a_bad_thing") (using somebody else's reputation to cause mayhem)
>
> `ShellExecute` de-elevates because it bounces a launch request off the shell
>
> "Works predictably for 15% of applications" (h/t to PhMajerus' AXSH, and other on-Windows requestors) is better in so many ways than "Works for 0% of applications", in my estimation. Incremental progress 😄 while we work on features that'll make it even more broadly applicable.

Closes #10188
Closes #7562

(cherry picked from commit 65640f6fe3)
Service-Card-Id: 88719284
Service-Version: 1.17
2023-03-31 17:47:26 -05:00
Mike Griese 9670230925 Rebuild the profile nav via MenuItemsSource; mitigate a crash (#14630)
Directly manipulating the `NavigationView::MenuItems` vector is bad. If
you do that, you're gonna get crashes, in WinUI code for `Measure`.
However, a WinUI PR (below) gave me an idea: Changing
`NavigationView::MenuItemsSource` will wholly invalidate the entirety of
the nav view items, and that will avoid the crash.

This code does that. It's a wee bit janky, but it works.

Closes #13673

_might_ affect #12333, need to try and repro.

See also:
* #9273
* #10390
* https://github.com/microsoft/microsoft-ui-xaml/issues/6302
* https://github.com/microsoft/microsoft-ui-xaml/pull/3138, which was
the fix for https://github.com/microsoft/microsoft-ui-xaml/issues/2818

(cherry picked from commit 8c17475a9f)
Service-Card-Id: 88428128
Service-Version: 1.17
2023-03-31 17:47:24 -05:00
Leonard Hecker c9a4ab7624 Fix offset calculation in the outlines shader (#14971)
The `Sample` method has an offset parameter which we can use here.
The result is not identical to the old shader, as the older shader
used the height of the terminal for drawing horizontal edges and so
the result looked way fatter than it was seemingly originally intended.
On my 150% scale display I found an offset of +/- 2px to produce an
acceptable result, although in the future it might be worthwhile to
make the offset dependent on the UI scale.

Closes #14953

(cherry picked from commit 6c80390de7)
Service-Card-Id: 88719285
Service-Version: 1.17
2023-03-31 17:47:23 -05:00
Dustin L. Howett 986ced95c1 Switch to the new Helix queues (#14933)
The old ones are pushing up daisies.

(cherry picked from commit 3e7e8d59f2)
Service-Card-Id: 88338601
Service-Version: 1.17
2023-03-31 17:47:22 -05:00
Dustin L. Howett 0631bf5bd7 Add a proper reference from TermCore to MidiAudio (#14868)
It was just by luck that TerminalCore usually built after MidiAudio

(cherry picked from commit e1145c362f)
Service-Card-Id: 88719295
Service-Version: 1.17
2023-03-31 17:46:52 -05:00
Leonard Hecker 0e2b3e6079 Ignore CHAR_INFO trailers during WriteConsoleOutput (#14840)
#13626 contains a small "regression" compared to #13321:
It now began to store trailers in the buffer wherever possible to allow
a region
of the buffer to be backed up and restored via Read/WriteConsoleOutput.
But we're unfortunately still ill-equipped to handle anything but UCS-2
via
WriteConsoleOutput, so it's best to again ignore trailers just like in
#13321.

## Validation Steps Performed
* Added unit test 

(cherry picked from commit 9dcdcac0bb)
Service-Card-Id: 88719297
Service-Version: 1.17
2023-03-31 17:46:50 -05:00
Leonard Hecker 6edaa15d4c Update ControlsV2 scrollbar template (#14846)
This commit updates our scrollbar template to microsoft-ui-xaml at ceeab5f.
This incorporates the bug fix for MSFT-39442675.

(cherry picked from commit 6a8bba96b2)
Service-Card-Id: 88103610
Service-Version: 1.17
2023-03-31 17:46:49 -05:00
PankajBhojwani dd9e0148c2 Pass the window root to the profile page views, instead of the view model (#14816)
## Summary of the Pull Request
Let the profile pages' views have access to the window root, rather than the `ProfileViewModel`. The window root is passed along when the page is navigated to.

## Validation Steps Performed
Clicking `Browse` no longer crashes.

## PR Checklist
- [x] Closes #14808

(cherry picked from commit e4bba3cd9a)
Service-Card-Id: 88031914
Service-Version: 1.17
2023-03-31 17:46:48 -05:00
Dustin L. Howett f0b09421da AzureConnection: remove our dependency on cpprestsdk (#14776)
This pull request removes, in full, our dependency on cpprestsdk. This
allows us to shed 500KiB-1.2MiB from our package off the top and enables
the following future investments:

- Removal of the App CRT forwarders to save an additional ~500KiB
- Switching over to the HybridCRT and removing our dependency on _any
  CRT_.

cpprest was built on my dev box two or so years ago, and is in _utter_
violation of our compliance guidelines on SBOM et al.

In addition, this change allows us to use the proxy server configured
in Windows Settings.

I did this in four steps (represented roughly by the individual commits):

1. Switch from cpprest's http_client/json to Windows.Web.Http and
   Windows.Data.Json
2. Switch from websocketpp to winhttp.dll's WebSocket implementation¹
3. Remove all remaining utility classes
4. Purge all dependencies from all projects and scripts on cpprest.

I also took this opportunity to add a feature flag that allows Dev
builds to run AzureConnection in-process.

¹ Windows.Networking.Sockets' API is so unergonomic that it was simply
infeasible (and also _horrible_) to use it.

## Validation Steps

I've run the Azure Connection quite a bit inproc.

Closes #4575.
Might be related to #5977, #11714, and with the user agent thing maybe #14403.

(cherry picked from commit 4903cfd484)
Service-Card-Id: 88581854
Service-Version: 1.17
2023-03-31 17:46:47 -05:00
Dustin L. Howett 7083738146 Generalize OpenConsoleProxy's HybridCRT logic (#14733)
This pull request moves the Hybrid CRT logic out of the Host.Proxy
project and makes it available for all other projects in our solution.

(cherry picked from commit fc960e3327)
Service-Card-Id: 88719300
Service-Version: 1.17
2023-03-31 17:46:45 -05:00
Dustin Howett 80c529aced Revert the removal of LayoutUpdated_revoker from ColorSchemes in ab79a8538 2023-01-23 19:01:07 -06:00
Dustin Howett ab79a85381
Revert "Manually set the automation name of the default color scheme for screen reader (#14704)"
This reverts commit 47f38e31a1.
2023-01-23 18:52:19 -06:00
Carlos Zamora b9089d9d1d [UIA] Dispatch a TextChanged event on new output (#14723)
For some reason, Windows Terminal stops dispatching UIA TextChanged events sometimes. There isn't a reliable repro for this bug.

However, under NVDA's logger, it appears that when the bug does occur, we still dispatch UIA notifications (which may be ignored by NVDA in some configurations). A "quick fix" here is to dispatch a TextChanged event if we're going to dispatch a notification. Since we're just enabling a flag, we won't send two events at once.

Closes #10911

(cherry picked from commit a0e830cc1a)
Service-Card-Id: 87730855
Service-Version: 1.17
2023-01-23 16:57:05 -06:00
Carlos Zamora 272e7b0905 Ensure TermControl is not closing when firing UIA events (#14714)
The `SignalTextChanged` crash seems to be occurring due to the `TermControlAutomationPeer` being destructed by the time the UIA event is actually dispatched. Even though we're already checking if TCAP and TermControl still exist, it could be that the TermControl is being closed as text is being output.

The proposed fix here is to record when the closing process starts and exposing that information directly to the TCAP. If TCAP sees that we're in the process of closing, don't bother sending a UIA event.

Closes #13978

(cherry picked from commit 3dd40791c9)
Service-Card-Id: 87728853
Service-Version: 1.17
2023-01-23 12:44:39 -06:00
Mike Griese 7326eaaa6f Resize our ContentDialog's when the window resizes (#14722)
Major thanks to @dongle-the-gadget in https://github.com/microsoft/microsoft-ui-xaml/issues/3577#issuecomment-1399250405 for coming up with this workaround.

This PR will manually forward a `WM_SIZE` message to our `CoreWindow`, to trigger the `ContentDialog` to resize itself.

We always closed these issues as dupes of the upstream one, so this doesn't actually close anything.
HOWEVER, these are the following issues that reported this bug:
- #2380
- #4463
- #5252
- #5810
- #6181
- #7113
- #7225
- #8245
- #8496
- #8643
- #9336
- #9563
- #5808
- #10351
- #10634
- #10995
- #11770
- #13796

(cherry picked from commit a4cf4e2761)
Service-Card-Id: 87727806
Service-Version: 1.17
2023-01-23 12:43:04 -06:00
Dustin L. Howett 72be9a95af
Code sign the contents of the Terminal package (#14710)
Up until now, we have been relying on the catalog signature produced for our MSIX package.
There are some things (Packaged COM, Process Explorer as of 2022) that cannot handle catalog-signed
files. It's easier and safer for us to simply sign all the executables we produce before packaging them.

Unfortunately, we can't do it before we package them. We have to unpack and re-pack our package.

In the future, this will allow us to provide a codesigned distribution that is not in an MSIX package.

TEST=Ran a build and checked out the contents of the package. They were all signed!

Closes #13294
Closes #12695
Closes #9670
2023-01-20 11:47:18 -06:00
Mike Griese 596d0c5155
Update the titlebar visibility when we gain/lose focus too (#14708)
We forgot to updateTheme again when we change the titlebar color. That would result in us setting the titlebar visibility only when the settings were reloaded, but if the unfocused BG was opaque, and the focused was transparent, we'd use the current _unfocused_ color to set the titlebar visibility. 

Also, this fixes a bug with `tabRow.BG: terminalBackground`

from teams for brevity 

> tabRow.BG = terminalBackground might not work, and here's why
>
> the termcontrol's BG brush might be (r,g,b, 255), with an Opacity of 0
> 
> so my "use mica when the brush's A is <1.0" doesn't work
> 

closes #14563
2023-01-20 01:38:34 +00:00
Mike Griese 79eb9b3d3c
Use a dark titlebar when we've requested dark theme (#14536)
This applies to `"showTabsInTitlebar": false,`. We literally never set that for the `IslandWindow` before, only ever the NCIW. 

Closes #11589


![update-titlebar-for-theme](https://user-images.githubusercontent.com/18356694/207109370-a63a8b19-4c42-4b1f-8d39-8c3abdf1b403.gif)


For a dramatic example - here's the IW with mica enabled, in dark mode:

![image](https://user-images.githubusercontent.com/18356694/207109465-a6165637-31a5-45a4-bff0-51ac79404cd6.png)

Theme json:

```json
        {
            "name": "chonk",
            "tab":
            {
                "background": "#00000000",
                "unfocusedBackground": "#00000000",
                "showCloseButton": "never"
            },
            "tabRow":
            {
                "background": "#00000000",
                "unfocusedBackground": "#00000000",
            },
            "window":
            {
                "applicationTheme": "dark",
                "useMica": true
            }
        },
```
2023-01-19 23:51:21 +00:00
Joshua Boelter eab1c239a9
Launch elevated instances via shell:AppFolder (#14637)
This uses `shell:AppsFolder` to launch elevated instances of the app via
`ShellExecuteEx` and `runas` in elevate-shim.exe. The app to launch is
discovered via the `GetCurrentApplicationUserModelId` API.

e.g. `shell:AppsFolder\WindowsTerminalDev_8wekyb3d8bbwe!App`

This will fallback to launching `WindowsTerminal.exe` if it fails to
discover the app user model id to launch.

This also fixes a bug in elevate-shim where the first argument of
WinMain was lost (e.g. `new-tab`). 

Curiously, `AppLogic::RunAsUwp()` is never called and
`AppLogic::IsUwp()` is always false when running debug builds locally
(e.g. WindowsTerminalDev). It's not clear if this is an artifact of
development packages or something else.

## Validation Steps Performed

Various manual debug/execution scenarios.

Verified the fallback path by running the unbundled app by extracting
the `CascadiaPackage_0.0.1.0_x64.msix` from the 'drop' build artifact.

Fixes #14501
2023-01-19 23:40:53 +00:00
PankajBhojwani 96a9dd5209
Automatically focus the ColorSchemeListView when we navigate to the ColorSchemes page (#14631)
This regressed when we implemented ColorSchemeViewModel in #13179.
This commit fixes that by automatically focusing the ColorSchemeListView
when we navigate to the ColorSchemes page, which makes sense from a
user experience perspective anyway.

Closes #11971
2023-01-19 23:20:56 +00:00
PankajBhojwani 6278a2d9bf
Fix the selected color scheme list item container background being blue in Windows 10 (#14706)
Specify the resource to use for the list view item background when selected.

References #14693 

## Validation Steps Performed
Background is no longer blue, it is light gray (like in Windows 11). Screenshots below.
2023-01-19 22:04:28 +00:00
PankajBhojwani 16fe2e5905
Add color chips to the color scheme dropdown in Appearance (#14587)
Does what it says on the tin.
2023-01-19 21:46:59 +00:00