terminal/src/cascadia
Mike Griese 6e11780ca6
Add property to control dropdown speed of global summon (#9977)
## Summary of the Pull Request

Adds the `dropdownDuration` property to `globalSummon`. This controls how fast the window appears on the screen when summoned from minimized. It similarly controls the speed for sliding out of view when the window is dismissed with `"toggleVisibility": true`.

`dropdownDuration` specifies the duration in **milliseconds**. This defaults to `0` for `globalSummon`, and defaults to `200` for `quakeMode`. 200 was picked because, according to [`AnimateWindow`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-animatewindow): 

>  Typically, an animation takes 200 milliseconds to play.

Do note that you won't be able to interact with the window during the animation! Input sent during the dropdown will arrive at the end of the animation, but input sent during the slide-up _won't_. Avoid setting this to large values!

The gifs are in Teams. 

## References
* Original thread: #653
* Spec: #9274 
* megathread: #8888

## PR Checklist
* [x] Closes https://github.com/microsoft/terminal/projects/5#card-59030824
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

I had the following previously in the doc comments, but it feels better in the PR body:

- This was chosen because it was easier to implement and generally nicer than:
  * `AnimateWindow`, which would show the window borders for the duration of
    the animation, and occasionally just plain not work. Additionally, for
    `AnimateWindow` to work, the window much not be visible, so we'd need to
    first restore the window, then hide it, then animate it. That would flash
    the taskbar.
  * `SetWindowRgn` on the root HWND, which caused the xaml content to shift to
    the left, and caused a black bar to be drawn on the right of the window.
    Presumably, `SetWindowRgn` and `DwmExtendFrameIntoClientArea` did not play
    well with each other.
  * `SetWindowPos(..., SWP_NOSENDCHANGING)`, which worked the absolute best for
    longer animations, and is the closest to the actual implementation of
    `AnimateWindow`. This would resize the ROOT window, without sending resizes
    to the XAML island, allowing the content to _not_ reflow. but for a
    duration of 200ms, would only ever display ~2 frames. That's basically
    not even animation anymore, it's now just an "appear". Since that's how
    long the default animation is, if felt silly to have it basically not
    work by default.
- If a future reader would like to implement this better, **they should feel
  free to**, and not mistake my notes here as expertise. These are research
  notes into the dark and terrible land that is Win32 programming. I'm no expert. 

## Validation Steps Performed

This is the blob of json I'm testing with these days:

```jsonc
        { "keys": "ctrl+`", "command": { "action": "quakeMode" } },
        { "keys": "ctrl+1", "command": { "action": "globalSummon" } },
        // { "keys": "ctrl+2", "command": { "action": "globalSummon", "desktop": "toCurrent" } },
        // { "keys": "ctrl+2", "command": { "action": "globalSummon", "toggleVisibility": false } },
        { "keys": "ctrl+2", "command": { "action": "globalSummon", "dropdownDuration": 2000 } },
        { "keys": "ctrl+3", "command": { "action": "globalSummon", "desktop": "onCurrent" } },
        { "keys": "ctrl+4", "command": { "action": "globalSummon", "desktop": "any" } },
```

* <kbd>ctrl+\`</kbd> will summon the quake window with a _quick_ animation
* <kbd>ctrl+2</kbd> will summon the window with a  s l o w  animation
2021-05-17 07:28:46 -05:00
..
CascadiaPackage Remove bug fixes which aren't needed in VS 16.9 (#9953) 2021-04-28 10:43:05 +00:00
inc Add globalSummon action (#9854) 2021-04-28 17:13:28 -05:00
LocalTests_SettingsModel Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
LocalTests_TerminalApp Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
PublicTerminalCore Exclude more rarely-used stuff from Windows headers (#8513) 2020-12-11 19:35:23 +00:00
Remoting Add property to control dropdown speed of global summon (#9977) 2021-05-17 07:28:46 -05:00
ShellExtension Move Branding into common props (#9668) 2021-03-30 18:08:53 -05:00
TerminalApp Fix tabColor arg crash in CommandPalette (#10096) 2021-05-16 21:51:51 -05:00
TerminalAzBridge Update C++/WinRT to 2.0.210309.3 (#9437) 2021-03-10 16:04:59 -06:00
TerminalConnection Implement PGO in pipelines for AMD64 architecture; supply training test scenarios (#10071) 2021-05-13 21:12:30 +00:00
TerminalControl Add a setting to disable URL detection (#10022) 2021-05-17 04:20:09 +00:00
TerminalCore Add a setting to disable URL detection (#10022) 2021-05-17 04:20:09 +00:00
TerminalSettingsEditor Add a setting to disable URL detection (#10022) 2021-05-17 04:20:09 +00:00
TerminalSettingsModel Add property to control dropdown speed of global summon (#9977) 2021-05-17 07:28:46 -05:00
UnitTests_Control Add a setting to disable URL detection (#10022) 2021-05-17 04:20:09 +00:00
UnitTests_Remoting When the window is summoned and is already active, minimize it. (#9963) 2021-04-28 18:57:14 -05:00
UnitTests_TerminalCore Add a setting to disable URL detection (#10022) 2021-05-17 04:20:09 +00:00
ut_app Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
WindowsTerminal Add property to control dropdown speed of global summon (#9977) 2021-05-17 07:28:46 -05:00
WindowsTerminal_UIATests Implement PGO in pipelines for AMD64 architecture; supply training test scenarios (#10071) 2021-05-13 21:12:30 +00:00
WindowsTerminalUniversal Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
WinRTUtils Remove bug fixes which aren't needed in VS 16.9 (#9953) 2021-04-28 10:43:05 +00:00
WpfTerminalControl [WPF] Allows setting the WPF control background when setting the terminal theme (#10026) 2021-05-04 21:18:25 +00:00
WpfTerminalTestNetCore Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
wt Build and ship an actual binary named wt that just launches WT (#6860) 2020-07-10 22:41:37 +00:00
CascadiaResources.build.items Introduce TerminalSettingsModel project (#7667) 2020-10-06 09:56:59 -07:00