Rename TextInputManager to TextInputManagerWin32 (flutter/engine#23905)
The current text input manager is win32-specific due to its use of IMM32. For UWP, we'll need a TSF implementation. Once that happens we'll want to extract out a TextInputManager interface and add a separate UWP implementation of this class.
This commit is contained in:
@@ -1497,8 +1497,8 @@ FILE: ../../../flutter/shell/platform/windows/task_runner_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/task_runner_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/task_runner_winuwp.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/task_runner_winuwp.h
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_manager.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_manager.h
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_manager_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_manager_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_plugin.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_plugin.h
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_plugin_delegate.h
|
||||
|
||||
@@ -68,8 +68,6 @@ source_set("flutter_windows_source") {
|
||||
"string_conversion.h",
|
||||
"system_utils.h",
|
||||
"task_runner.h",
|
||||
"text_input_manager.cc",
|
||||
"text_input_manager.h",
|
||||
"text_input_plugin.cc",
|
||||
"text_input_plugin.h",
|
||||
"window_binding_handler.h",
|
||||
@@ -95,6 +93,8 @@ source_set("flutter_windows_source") {
|
||||
"system_utils_win32.cc",
|
||||
"task_runner_win32.cc",
|
||||
"task_runner_win32.h",
|
||||
"text_input_manager_win32.cc",
|
||||
"text_input_manager_win32.h",
|
||||
"win32_dpi_utils.cc",
|
||||
"win32_dpi_utils.h",
|
||||
"win32_flutter_window.cc",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/windows/text_input_manager.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
|
||||
|
||||
#include <imm.h>
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
void TextInputManager::SetWindowHandle(HWND window_handle) {
|
||||
void TextInputManagerWin32::SetWindowHandle(HWND window_handle) {
|
||||
window_handle_ = window_handle;
|
||||
}
|
||||
|
||||
void TextInputManager::CreateImeWindow() {
|
||||
void TextInputManagerWin32::CreateImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ void TextInputManager::CreateImeWindow() {
|
||||
UpdateImeWindow();
|
||||
}
|
||||
|
||||
void TextInputManager::DestroyImeWindow() {
|
||||
void TextInputManagerWin32::DestroyImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void TextInputManager::DestroyImeWindow() {
|
||||
ime_active_ = false;
|
||||
}
|
||||
|
||||
void TextInputManager::UpdateImeWindow() {
|
||||
void TextInputManagerWin32::UpdateImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ void TextInputManager::UpdateImeWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
void TextInputManager::UpdateCaretRect(const Rect& rect) {
|
||||
void TextInputManagerWin32::UpdateCaretRect(const Rect& rect) {
|
||||
caret_rect_ = rect;
|
||||
|
||||
if (window_handle_ == nullptr) {
|
||||
@@ -74,7 +74,7 @@ void TextInputManager::UpdateCaretRect(const Rect& rect) {
|
||||
}
|
||||
}
|
||||
|
||||
long TextInputManager::GetComposingCursorPosition() const {
|
||||
long TextInputManagerWin32::GetComposingCursorPosition() const {
|
||||
if (window_handle_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -90,15 +90,16 @@ long TextInputManager::GetComposingCursorPosition() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManager::GetComposingString() const {
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetComposingString()
|
||||
const {
|
||||
return GetString(GCS_COMPSTR);
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManager::GetResultString() const {
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetResultString() const {
|
||||
return GetString(GCS_RESULTSTR);
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManager::GetString(int type) const {
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetString(int type) const {
|
||||
if (window_handle_ == nullptr || !ime_active_) {
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -121,7 +122,7 @@ std::optional<std::u16string> TextInputManager::GetString(int type) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TextInputManager::MoveImeWindow(HIMC imm_context) {
|
||||
void TextInputManagerWin32::MoveImeWindow(HIMC imm_context) {
|
||||
if (GetFocus() != window_handle_ || !ime_active_) {
|
||||
return;
|
||||
}
|
||||
@@ -25,13 +25,13 @@ namespace flutter {
|
||||
// This implementation wraps the Win32 IMM32 APIs and provides a mechanism for
|
||||
// creating and positioning the IME window, a system caret, and the candidates
|
||||
// list as well as for accessing composing and results string contents.
|
||||
class TextInputManager {
|
||||
class TextInputManagerWin32 {
|
||||
public:
|
||||
TextInputManager() noexcept = default;
|
||||
~TextInputManager() = default;
|
||||
TextInputManagerWin32() noexcept = default;
|
||||
~TextInputManagerWin32() = default;
|
||||
|
||||
TextInputManager(const TextInputManager&) = delete;
|
||||
TextInputManager& operator=(const TextInputManager&) = delete;
|
||||
TextInputManagerWin32(const TextInputManagerWin32&) = delete;
|
||||
TextInputManagerWin32& operator=(const TextInputManagerWin32&) = delete;
|
||||
|
||||
// Sets the window handle with which the IME is associated.
|
||||
void SetWindowHandle(HWND window_handle);
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "flutter/shell/platform/windows/text_input_manager.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
@@ -183,7 +183,7 @@ class Win32Window {
|
||||
int keycode_for_char_message_ = 0;
|
||||
|
||||
protected:
|
||||
TextInputManager text_input_manager_;
|
||||
TextInputManagerWin32 text_input_manager_;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
Reference in New Issue
Block a user