Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 08daa2c

Browse files
authored
Rename TextInputManager to TextInputManagerWin32 (#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.
1 parent 4557989 commit 08daa2c

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,8 @@ FILE: ../../../flutter/shell/platform/windows/task_runner_win32.cc
14971497
FILE: ../../../flutter/shell/platform/windows/task_runner_win32.h
14981498
FILE: ../../../flutter/shell/platform/windows/task_runner_winuwp.cc
14991499
FILE: ../../../flutter/shell/platform/windows/task_runner_winuwp.h
1500-
FILE: ../../../flutter/shell/platform/windows/text_input_manager.cc
1501-
FILE: ../../../flutter/shell/platform/windows/text_input_manager.h
1500+
FILE: ../../../flutter/shell/platform/windows/text_input_manager_win32.cc
1501+
FILE: ../../../flutter/shell/platform/windows/text_input_manager_win32.h
15021502
FILE: ../../../flutter/shell/platform/windows/text_input_plugin.cc
15031503
FILE: ../../../flutter/shell/platform/windows/text_input_plugin.h
15041504
FILE: ../../../flutter/shell/platform/windows/text_input_plugin_delegate.h

shell/platform/windows/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ source_set("flutter_windows_source") {
6868
"string_conversion.h",
6969
"system_utils.h",
7070
"task_runner.h",
71-
"text_input_manager.cc",
72-
"text_input_manager.h",
7371
"text_input_plugin.cc",
7472
"text_input_plugin.h",
7573
"window_binding_handler.h",
@@ -95,6 +93,8 @@ source_set("flutter_windows_source") {
9593
"system_utils_win32.cc",
9694
"task_runner_win32.cc",
9795
"task_runner_win32.h",
96+
"text_input_manager_win32.cc",
97+
"text_input_manager_win32.h",
9898
"win32_dpi_utils.cc",
9999
"win32_dpi_utils.h",
100100
"win32_flutter_window.cc",

shell/platform/windows/text_input_manager.cc renamed to shell/platform/windows/text_input_manager_win32.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
// Use of this source code is governed by a BSD-style license that can be
77
// found in the LICENSE file.
88

9-
#include "flutter/shell/platform/windows/text_input_manager.h"
9+
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
1010

1111
#include <imm.h>
1212

1313
#include <memory>
1414

1515
namespace flutter {
1616

17-
void TextInputManager::SetWindowHandle(HWND window_handle) {
17+
void TextInputManagerWin32::SetWindowHandle(HWND window_handle) {
1818
window_handle_ = window_handle;
1919
}
2020

21-
void TextInputManager::CreateImeWindow() {
21+
void TextInputManagerWin32::CreateImeWindow() {
2222
if (window_handle_ == nullptr) {
2323
return;
2424
}
@@ -35,7 +35,7 @@ void TextInputManager::CreateImeWindow() {
3535
UpdateImeWindow();
3636
}
3737

38-
void TextInputManager::DestroyImeWindow() {
38+
void TextInputManagerWin32::DestroyImeWindow() {
3939
if (window_handle_ == nullptr) {
4040
return;
4141
}
@@ -47,7 +47,7 @@ void TextInputManager::DestroyImeWindow() {
4747
ime_active_ = false;
4848
}
4949

50-
void TextInputManager::UpdateImeWindow() {
50+
void TextInputManagerWin32::UpdateImeWindow() {
5151
if (window_handle_ == nullptr) {
5252
return;
5353
}
@@ -59,7 +59,7 @@ void TextInputManager::UpdateImeWindow() {
5959
}
6060
}
6161

62-
void TextInputManager::UpdateCaretRect(const Rect& rect) {
62+
void TextInputManagerWin32::UpdateCaretRect(const Rect& rect) {
6363
caret_rect_ = rect;
6464

6565
if (window_handle_ == nullptr) {
@@ -74,7 +74,7 @@ void TextInputManager::UpdateCaretRect(const Rect& rect) {
7474
}
7575
}
7676

77-
long TextInputManager::GetComposingCursorPosition() const {
77+
long TextInputManagerWin32::GetComposingCursorPosition() const {
7878
if (window_handle_ == nullptr) {
7979
return false;
8080
}
@@ -90,15 +90,16 @@ long TextInputManager::GetComposingCursorPosition() const {
9090
return -1;
9191
}
9292

93-
std::optional<std::u16string> TextInputManager::GetComposingString() const {
93+
std::optional<std::u16string> TextInputManagerWin32::GetComposingString()
94+
const {
9495
return GetString(GCS_COMPSTR);
9596
}
9697

97-
std::optional<std::u16string> TextInputManager::GetResultString() const {
98+
std::optional<std::u16string> TextInputManagerWin32::GetResultString() const {
9899
return GetString(GCS_RESULTSTR);
99100
}
100101

101-
std::optional<std::u16string> TextInputManager::GetString(int type) const {
102+
std::optional<std::u16string> TextInputManagerWin32::GetString(int type) const {
102103
if (window_handle_ == nullptr || !ime_active_) {
103104
return std::nullopt;
104105
}
@@ -121,7 +122,7 @@ std::optional<std::u16string> TextInputManager::GetString(int type) const {
121122
return std::nullopt;
122123
}
123124

124-
void TextInputManager::MoveImeWindow(HIMC imm_context) {
125+
void TextInputManagerWin32::MoveImeWindow(HIMC imm_context) {
125126
if (GetFocus() != window_handle_ || !ime_active_) {
126127
return;
127128
}

shell/platform/windows/text_input_manager.h renamed to shell/platform/windows/text_input_manager_win32.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ namespace flutter {
2525
// This implementation wraps the Win32 IMM32 APIs and provides a mechanism for
2626
// creating and positioning the IME window, a system caret, and the candidates
2727
// list as well as for accessing composing and results string contents.
28-
class TextInputManager {
28+
class TextInputManagerWin32 {
2929
public:
30-
TextInputManager() noexcept = default;
31-
~TextInputManager() = default;
30+
TextInputManagerWin32() noexcept = default;
31+
~TextInputManagerWin32() = default;
3232

33-
TextInputManager(const TextInputManager&) = delete;
34-
TextInputManager& operator=(const TextInputManager&) = delete;
33+
TextInputManagerWin32(const TextInputManagerWin32&) = delete;
34+
TextInputManagerWin32& operator=(const TextInputManagerWin32&) = delete;
3535

3636
// Sets the window handle with which the IME is associated.
3737
void SetWindowHandle(HWND window_handle);

shell/platform/windows/win32_window.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <memory>
1212
#include <string>
1313

14-
#include "flutter/shell/platform/windows/text_input_manager.h"
14+
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
1515

1616
namespace flutter {
1717

@@ -183,7 +183,7 @@ class Win32Window {
183183
int keycode_for_char_message_ = 0;
184184

185185
protected:
186-
TextInputManager text_input_manager_;
186+
TextInputManagerWin32 text_input_manager_;
187187
};
188188

189189
} // namespace flutter

0 commit comments

Comments
 (0)