7b7dea009c
Instead of having a separate method for setting each mouse and keyboard mode, this PR consolidates them all into a single method which takes a mode parameter, and stores the modes in a `til::enumset` rather than having a separate `bool` for each mode. This enables us to get rid of a lot of boilerplate code, and makes the code easier to extend when we want to introduce additional modes in the future. It'll also makes it easier to read back the state of the various modes when implementing the `DECRQM` query. Most of the complication is in the `TerminalInput` class, which had to be adjusted to work with an `enumset` in place of all the `bool` fields. For the rest, it was largely a matter of replacing calls to all the old mode setting methods with the new `SetInputMode` method, and deleting a bunch of unused code. One thing worth mentioning is that the `AdaptDispatch` implementation used to have a `_ShouldPassThroughInputModeChange` method that was called after every mode change. This code has now been moved up into the `SetInputMode` implementation in `ConhostInternalGetSet` so it's just handled in one place. Keeping this out of the dispatch class will also be beneficial for sharing the implementation with `TerminalDispatch`. ## Validation The updated interface necessitated some adjustments to the tests in `AdapterTest` and `MouseInputTest`, but the essential structure of the tests remains unchanged, and everything still passes. I've also tested the keyboard and mouse modes in Vttest and confirmed they still work at least as well as they did before (both conhost and Windows Terminal), and I tested the alternate scroll mode manually (conhost only). Simplifying the `ConGetSet` and `ITerminalApi` is also part of the plan to de-duplicate the `AdaptDispatch` and `TerminalDispatch` implementation (#3849).
84 lines
3.6 KiB
C++
84 lines
3.6 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- getset.h
|
|
|
|
Abstract:
|
|
- This file implements the NT console server console state API.
|
|
|
|
Author:
|
|
- Therese Stowell (ThereseS) 5-Dec-1990
|
|
|
|
Revision History:
|
|
--*/
|
|
|
|
#pragma once
|
|
#include "../inc/conattrs.hpp"
|
|
class SCREEN_INFORMATION;
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetScreenMode(const bool reverseMode);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetAutoWrapMode(const bool wrapAtEOL);
|
|
|
|
void DoSrvPrivateShowCursor(SCREEN_INFORMATION& screenInfo, const bool show) noexcept;
|
|
void DoSrvPrivateAllowCursorBlinking(SCREEN_INFORMATION& screenInfo, const bool fEnable);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetScrollingRegion(SCREEN_INFORMATION& screenInfo, const SMALL_RECT& scrollMargins);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateLineFeed(SCREEN_INFORMATION& screenInfo, const bool withReturn);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateReverseLineFeed(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateUseAlternateScreenBuffer(SCREEN_INFORMATION& screenInfo);
|
|
void DoSrvPrivateUseMainScreenBuffer(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateEraseAll(SCREEN_INFORMATION& screenInfo);
|
|
[[nodiscard]] HRESULT DoSrvPrivateClearBuffer(SCREEN_INFORMATION& screenInfo);
|
|
|
|
void DoSrvSetCursorStyle(SCREEN_INFORMATION& screenInfo,
|
|
const CursorType cursorType);
|
|
void DoSrvSetCursorColor(SCREEN_INFORMATION& screenInfo,
|
|
const COLORREF cursorColor);
|
|
|
|
void DoSrvAddHyperlink(SCREEN_INFORMATION& screenInfo,
|
|
const std::wstring_view uri,
|
|
const std::wstring_view params);
|
|
|
|
void DoSrvEndHyperlink(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvUpdateSoftFont(const gsl::span<const uint16_t> bitPattern,
|
|
const SIZE cellSize,
|
|
const size_t centeringHint) noexcept;
|
|
|
|
void DoSrvPrivateRefreshWindow(const SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvSetConsoleOutputCodePage(const unsigned int codepage);
|
|
void DoSrvGetConsoleOutputCodePage(unsigned int& codepage);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSuppressResizeRepaint();
|
|
|
|
void DoSrvIsConsolePty(bool& isPty);
|
|
|
|
void DoSrvPrivateDeleteLines(const size_t count);
|
|
void DoSrvPrivateInsertLines(const size_t count);
|
|
|
|
void DoSrvPrivateMoveToBottom(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateGetColorTableEntry(const size_t index, COLORREF& value) noexcept;
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetColorTableEntry(const size_t index, const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetDefaultForegroundColor(const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetDefaultBackgroundColor(const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateFillRegion(SCREEN_INFORMATION& screenInfo,
|
|
const COORD startPosition,
|
|
const size_t fillLength,
|
|
const wchar_t fillChar,
|
|
const bool standardFillAttrs) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateScrollRegion(SCREEN_INFORMATION& screenInfo,
|
|
const SMALL_RECT scrollRect,
|
|
const std::optional<SMALL_RECT> clipRect,
|
|
const COORD destinationOrigin,
|
|
const bool standardFillAttrs) noexcept;
|