Skip to content

Commit

Permalink
Control 'Touch Keyboard and Handwriting Panel Service' warning (#9015)
Browse files Browse the repository at this point in the history
Add a setting to turn off the warning if 'Touch Keyboard and
Handwriting Panel Service' is disabled.

The service might not start in some case, and it doesn't affect the
input in some computer.  This PR turn off the warning even if the
service is disabled.  The setting name is  "inputServiceWarning".

## Validation Steps Performed
I manually set the service to "Disabled", restarted the Terminal,
verified the warning up, then set "inputServiceWarning" to false and
restarted the Terminal, and the warning didn't appear.

References #8095
References #7886 (comment)
  • Loading branch information
WVVxm authored Feb 22, 2021
1 parent 99ffaa8 commit 8ad4d1f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@
"description": "When set to `true`, the terminal window will auto-center itself on the display it opens on. The terminal will use the \"initialPosition\" to determine which display to open on.",
"type": "boolean"
},
"inputServiceWarning": {
"default": true,
"description": "Warning if 'Touch Keyboard and Handwriting Panel Service' is disabled.",
"type": "boolean"
},
"copyOnSelect": {
"default": false,
"description": "When set to true, a selection is immediately copied to your clipboard upon creation. When set to false, the selection persists and awaits further action.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace SettingsModelLocalTests
"initialPosition": ",",
"launchMode": "default",
"alwaysOnTop": false,
"inputServiceWarning": true,
"copyOnSelect": false,
"copyFormatting": "all",
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
Expand Down
10 changes: 7 additions & 3 deletions src/cascadia/TerminalApp/AppLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,15 @@ namespace winrt::TerminalApp::implementation
void AppLogic::_OnLoaded(const IInspectable& /*sender*/,
const RoutedEventArgs& /*eventArgs*/)
{
const auto keyboardServiceIsDisabled = !_IsKeyboardServiceEnabled();
if (keyboardServiceIsDisabled)
if (_settings.GlobalSettings().InputServiceWarning())
{
_root->ShowKeyboardServiceWarning();
const auto keyboardServiceIsDisabled = !_IsKeyboardServiceEnabled();
if (keyboardServiceIsDisabled)
{
_root->ShowKeyboardServiceWarning();
}
}

if (FAILED(_settingsLoadedResult))
{
const winrt::hstring titleKey = USES_RESOURCE(L"InitialJsonParseErrorTitle");
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ namespace winrt::TerminalApp::implementation
GETSET_SETTING(TerminalApp::TerminalSettings, uint32_t, CursorHeight, DEFAULT_CURSOR_HEIGHT);
GETSET_SETTING(TerminalApp::TerminalSettings, hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
GETSET_SETTING(TerminalApp::TerminalSettings, bool, CopyOnSelect, false);
GETSET_SETTING(TerminalApp::TerminalSettings, bool, InputServiceWarning, true);
GETSET_SETTING(TerminalApp::TerminalSettings, bool, FocusFollowMouse, false);

GETSET_SETTING(TerminalApp::TerminalSettings, Windows::Foundation::IReference<uint32_t>, TabColor, nullptr);
Expand Down
5 changes: 5 additions & 0 deletions src/cascadia/TerminalSettingsModel/GlobalAppSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static constexpr std::string_view ThemeKey{ "theme" };
static constexpr std::string_view TabWidthModeKey{ "tabWidthMode" };
static constexpr std::string_view ShowTabsInTitlebarKey{ "showTabsInTitlebar" };
static constexpr std::string_view WordDelimitersKey{ "wordDelimiters" };
static constexpr std::string_view InputServiceWarningKey{ "inputServiceWarning" };
static constexpr std::string_view CopyOnSelectKey{ "copyOnSelect" };
static constexpr std::string_view CopyFormattingKey{ "copyFormatting" };
static constexpr std::string_view WarnAboutLargePasteKey{ "largePasteWarning" };
Expand Down Expand Up @@ -103,6 +104,7 @@ winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::Copy() const
globals->_TabWidthMode = _TabWidthMode;
globals->_ShowTabsInTitlebar = _ShowTabsInTitlebar;
globals->_WordDelimiters = _WordDelimiters;
globals->_InputServiceWarning = _InputServiceWarning;
globals->_CopyOnSelect = _CopyOnSelect;
globals->_CopyFormatting = _CopyFormatting;
globals->_WarnAboutLargePaste = _WarnAboutLargePaste;
Expand Down Expand Up @@ -276,6 +278,8 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)

JsonUtils::GetValueForKey(json, CopyOnSelectKey, _CopyOnSelect);

JsonUtils::GetValueForKey(json, InputServiceWarningKey, _InputServiceWarning);

JsonUtils::GetValueForKey(json, CopyFormattingKey, _CopyFormatting);

JsonUtils::GetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
Expand Down Expand Up @@ -395,6 +399,7 @@ Json::Value GlobalAppSettings::ToJson() const
JsonUtils::SetValueForKey(json, ShowTitleInTitlebarKey, _ShowTitleInTitlebar);
JsonUtils::SetValueForKey(json, ShowTabsInTitlebarKey, _ShowTabsInTitlebar);
JsonUtils::SetValueForKey(json, WordDelimitersKey, _WordDelimiters);
JsonUtils::SetValueForKey(json, InputServiceWarningKey, _InputServiceWarning);
JsonUtils::SetValueForKey(json, CopyOnSelectKey, _CopyOnSelect);
JsonUtils::SetValueForKey(json, CopyFormattingKey, _CopyFormatting);
JsonUtils::SetValueForKey(json, WarnAboutLargePasteKey, _WarnAboutLargePaste);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/GlobalAppSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
GETSET_SETTING(Model::GlobalAppSettings, bool, ShowTabsInTitlebar, true);
GETSET_SETTING(Model::GlobalAppSettings, hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
GETSET_SETTING(Model::GlobalAppSettings, bool, CopyOnSelect, false);
GETSET_SETTING(Model::GlobalAppSettings, bool, InputServiceWarning, true);
GETSET_SETTING(Model::GlobalAppSettings, winrt::Microsoft::Terminal::TerminalControl::CopyFormat, CopyFormatting, 0);
GETSET_SETTING(Model::GlobalAppSettings, bool, WarnAboutLargePaste, true);
GETSET_SETTING(Model::GlobalAppSettings, bool, WarnAboutMultiLinePaste, true);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/GlobalAppSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
INHERITABLE_SETTING(String, WordDelimiters);
INHERITABLE_SETTING(Boolean, CopyOnSelect);
INHERITABLE_SETTING(Boolean, InputServiceWarning);
INHERITABLE_SETTING(Microsoft.Terminal.TerminalControl.CopyFormat, CopyFormatting);
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
INHERITABLE_SETTING(Boolean, WarnAboutMultiLinePaste);
Expand Down

3 comments on commit 8ad4d1f

@DHowett
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you thought better of your comment, which is a good thing.

@levicki
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was wrong and I have no problem to admit it. For what is worth, I didn't pay attention to - and + at line starts before commenting (was viewing on a mobile screen).

Thanks for reconsidering our feedback and implementing the setting.

I'd really like to know more about the current state of Windows input stack. It would be nice if those guys would publish a blog post to explain how it works now. I think that would benefit both users and developers.

@DHowett
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d love to understand it too! 😅

Thanks again for keeping us honest and/or on-track here. Sorry it was a hard battle.

Please sign in to comment.