Show InputPanel on focus and pointer press (#4867)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request I originally thought that setting `TSFInputControl::_editContext.InputPaneDisplayPolicy` to be Automatic would allow the InputPanel to show and hide automatically when `TSFInputControl` gains and loses focus. It doesn't seem to behave that way, so we'll show the InputPanel manually. I'll show the panel during `PointerPressedHandler` and during `GotFocusHandler`. A user will have the on-screen keyboard pop up when getting focus, but if they close the keyboard, they can simply re-tap on the terminal to bring it back up. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #3639 * [x] CLA signed. * [x] Tests added/passed ## Validation Steps Performed Played on my surfaces book with the on screen keyboard by closing/tapping on the terminal and using the search box.
This commit is contained in:
parent
75f4240adc
commit
61d635367b
|
@ -27,9 +27,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
auto manager = Core::CoreTextServicesManager::GetForCurrentView();
|
||||
_editContext = manager.CreateEditContext();
|
||||
|
||||
// sets the Input Pane display policy to Manual for now so that it can manually show the
|
||||
// software keyboard when the control gains focus and dismiss it when the control loses focus.
|
||||
// TODO GitHub #3639: Should Input Pane display policy be Automatic
|
||||
// InputPane is manually shown inside of TermControl.
|
||||
_editContext.InputPaneDisplayPolicy(Core::CoreTextInputPaneDisplayPolicy::Manual);
|
||||
|
||||
// set the input scope to Text because this control is for any text.
|
||||
|
|
|
@ -21,6 +21,7 @@ using namespace winrt::Windows::UI::Xaml;
|
|||
using namespace winrt::Windows::UI::Xaml::Input;
|
||||
using namespace winrt::Windows::UI::Xaml::Automation::Peers;
|
||||
using namespace winrt::Windows::UI::Core;
|
||||
using namespace winrt::Windows::UI::ViewManagement;
|
||||
using namespace winrt::Windows::System;
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
using namespace winrt::Windows::ApplicationModel::DataTransfer;
|
||||
|
@ -824,6 +825,12 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
const auto ptr = args.Pointer();
|
||||
const auto point = args.GetCurrentPoint(*this);
|
||||
|
||||
// We also TryShow in GotFocusHandler, but this call is specifically
|
||||
// for the case where the Terminal is in focus but the user closed the
|
||||
// on-screen keyboard. This lets the user simply tap on the terminal
|
||||
// again to bring it up.
|
||||
InputPane::GetForCurrentView().TryShow();
|
||||
|
||||
if (!_focused)
|
||||
{
|
||||
Focus(FocusState::Pointer);
|
||||
|
@ -1300,6 +1307,8 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
|
||||
_focused = true;
|
||||
|
||||
InputPane::GetForCurrentView().TryShow();
|
||||
|
||||
// If the searchbox is focused, we don't want TSFInputControl to think
|
||||
// it has focus so it doesn't intercept IME input. We also don't want the
|
||||
// terminal's cursor to start blinking. So, we'll just return quickly here.
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <winrt/Windows.Graphics.Display.h>
|
||||
#include <winrt/windows.ui.core.h>
|
||||
#include <winrt/Windows.ui.input.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
#include <winrt/Windows.UI.Xaml.h>
|
||||
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>
|
||||
#include <winrt/Windows.UI.Text.Core.h>
|
||||
|
|
Loading…
Reference in a new issue