This commit implements the OSC 9;4 sequence per the [ConEmu style]. | sequence | description | | ------------ | ------------ | | `ESC ] 9 ; 4 ; st ; pr ST` | Set progress state on taskbar and tab. | | | When `st` is: | | | | | | `0`: remove progress. | | | `1`: set progress value to `pr` (number, 0-100). | | | `2`: set the taskbar to the "Error" state | | | `3`: set the taskbar to the "Indeterminate" state | | | `4`: set the taskbar to the "Warning" state | We've also extended this with: * st 3: set indeterminate state * st 4: set paused state We handle multiple tabs sending the sequence by using the the last focused control's taskbar state/progress. Upon receiving the sequence in `TerminalApi`, we send an event that gets caught by `TerminalPage`. `TerminalPage` then fires another event that gets caught by `AppHost` and that's where we set the taskbar progress. Closes #3004 [ConEmu style]: https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC
45 lines
2 KiB
C++
45 lines
2 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#include "pch.h"
|
|
|
|
#include <winrt/TerminalApp.h>
|
|
#include <winrt/Microsoft.Terminal.Settings.Model.h>
|
|
|
|
#include "NonClientIslandWindow.h"
|
|
|
|
class AppHost
|
|
{
|
|
public:
|
|
AppHost() noexcept;
|
|
virtual ~AppHost();
|
|
|
|
void AppTitleChanged(const winrt::Windows::Foundation::IInspectable& sender, winrt::hstring newTitle);
|
|
void LastTabClosed(const winrt::Windows::Foundation::IInspectable& sender, const winrt::TerminalApp::LastTabClosedEventArgs& args);
|
|
void Initialize();
|
|
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
|
|
void SetTaskbarProgress(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
|
|
|
|
private:
|
|
bool _useNonClientArea;
|
|
|
|
std::unique_ptr<IslandWindow> _window;
|
|
winrt::TerminalApp::App _app;
|
|
winrt::TerminalApp::AppLogic _logic;
|
|
|
|
void _HandleCommandlineArgs();
|
|
|
|
void _HandleCreateWindow(const HWND hwnd, RECT proposedRect, winrt::Microsoft::Terminal::Settings::Model::LaunchMode& launchMode);
|
|
void _UpdateTitleBarContent(const winrt::Windows::Foundation::IInspectable& sender,
|
|
const winrt::Windows::UI::Xaml::UIElement& arg);
|
|
void _UpdateTheme(const winrt::Windows::Foundation::IInspectable&,
|
|
const winrt::Windows::UI::Xaml::ElementTheme& arg);
|
|
void _FocusModeChanged(const winrt::Windows::Foundation::IInspectable& sender,
|
|
const winrt::Windows::Foundation::IInspectable& arg);
|
|
void _FullscreenChanged(const winrt::Windows::Foundation::IInspectable& sender,
|
|
const winrt::Windows::Foundation::IInspectable& arg);
|
|
void _AlwaysOnTopChanged(const winrt::Windows::Foundation::IInspectable& sender,
|
|
const winrt::Windows::Foundation::IInspectable& arg);
|
|
void _WindowMouseWheeled(const til::point coord, const int32_t delta);
|
|
};
|