Eliminate redundant Win32 suffix in Windows embedder (flutter/engine#34983)
Now that we've removed the UWP embedder, eliminate remaining Win32 suffixes on identifiers and _win32 suffixes from filenames. This renames all files and types ending in _win32/Win32 that don't require further rework/merging/simplification. All remaining files/types ending in _win32/Win32 are less straightforward and will be submitted class by class. Issue: https://github.com/flutter/flutter/issues/108386
This commit is contained in:
@@ -2341,9 +2341,9 @@ FILE: ../../../flutter/shell/platform/linux/public/flutter_linux/fl_texture_regi
|
||||
FILE: ../../../flutter/shell/platform/linux/public/flutter_linux/fl_value.h
|
||||
FILE: ../../../flutter/shell/platform/linux/public/flutter_linux/fl_view.h
|
||||
FILE: ../../../flutter/shell/platform/linux/public/flutter_linux/flutter_linux.h
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_win32_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_windows.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_windows.h
|
||||
FILE: ../../../flutter/shell/platform/windows/accessibility_bridge_delegate_windows_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/angle_surface_manager.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/angle_surface_manager.h
|
||||
FILE: ../../../flutter/shell/platform/windows/client_wrapper/dart_project_unittests.cc
|
||||
@@ -2363,25 +2363,25 @@ FILE: ../../../flutter/shell/platform/windows/cursor_handler.h
|
||||
FILE: ../../../flutter/shell/platform/windows/direct_manipulation.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/direct_manipulation.h
|
||||
FILE: ../../../flutter/shell/platform/windows/direct_manipulation_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils_win32_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/event_watcher_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/event_watcher_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils.h
|
||||
FILE: ../../../flutter/shell/platform/windows/dpi_utils_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/event_watcher.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/event_watcher.h
|
||||
FILE: ../../../flutter/shell/platform/windows/external_texture.h
|
||||
FILE: ../../../flutter/shell/platform/windows/external_texture_d3d.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/external_texture_d3d.h
|
||||
FILE: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/external_texture_pixelbuffer.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_key_map.g.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_project_bundle.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_project_bundle.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_project_bundle_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window_win32_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_window_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_engine.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_engine.h
|
||||
@@ -2392,7 +2392,6 @@ FILE: ../../../flutter/shell/platform/windows/flutter_windows_texture_registrar_
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view.h
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_view_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/flutter_windows_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/keyboard_handler_base.h
|
||||
FILE: ../../../flutter/shell/platform/windows/keyboard_key_channel_handler.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/keyboard_key_channel_handler.h
|
||||
@@ -2434,8 +2433,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_win32_window.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/task_runner_win32_window.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_manager.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/text_input_manager.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
|
||||
@@ -2444,9 +2443,9 @@ FILE: ../../../flutter/shell/platform/windows/window.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_binding_handler.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_binding_handler_delegate.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager_win32.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager_win32.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager_win32_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_proc_delegate_manager_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window_state.h
|
||||
FILE: ../../../flutter/shell/platform/windows/window_unittests.cc
|
||||
FILE: ../../../flutter/shell/profiling/sampling_profiler.cc
|
||||
|
||||
@@ -38,30 +38,30 @@ source_set("flutter_windows_headers") {
|
||||
source_set("flutter_windows_source") {
|
||||
# Common Windows sources.
|
||||
sources = [
|
||||
"accessibility_bridge_delegate_win32.cc",
|
||||
"accessibility_bridge_delegate_win32.h",
|
||||
"accessibility_bridge_delegate_windows.cc",
|
||||
"accessibility_bridge_delegate_windows.h",
|
||||
"angle_surface_manager.cc",
|
||||
"angle_surface_manager.h",
|
||||
"cursor_handler.cc",
|
||||
"cursor_handler.h",
|
||||
"direct_manipulation.cc",
|
||||
"direct_manipulation.h",
|
||||
"dpi_utils_win32.cc",
|
||||
"dpi_utils_win32.h",
|
||||
"event_watcher_win32.cc",
|
||||
"event_watcher_win32.h",
|
||||
"dpi_utils.cc",
|
||||
"dpi_utils.h",
|
||||
"event_watcher.cc",
|
||||
"event_watcher.h",
|
||||
"external_texture.h",
|
||||
"external_texture_d3d.cc",
|
||||
"external_texture_d3d.h",
|
||||
"external_texture_pixelbuffer.cc",
|
||||
"external_texture_pixelbuffer.h",
|
||||
"flutter_key_map.g.cc",
|
||||
"flutter_platform_node_delegate_win32.cc",
|
||||
"flutter_platform_node_delegate_win32.h",
|
||||
"flutter_platform_node_delegate_windows.cc",
|
||||
"flutter_platform_node_delegate_windows.h",
|
||||
"flutter_project_bundle.cc",
|
||||
"flutter_project_bundle.h",
|
||||
"flutter_window_win32.cc",
|
||||
"flutter_window_win32.h",
|
||||
"flutter_window.cc",
|
||||
"flutter_window.h",
|
||||
"flutter_windows.cc",
|
||||
"flutter_windows_engine.cc",
|
||||
"flutter_windows_engine.h",
|
||||
@@ -69,7 +69,6 @@ source_set("flutter_windows_source") {
|
||||
"flutter_windows_texture_registrar.h",
|
||||
"flutter_windows_view.cc",
|
||||
"flutter_windows_view.h",
|
||||
"flutter_windows_win32.cc",
|
||||
"keyboard_handler_base.h",
|
||||
"keyboard_key_channel_handler.cc",
|
||||
"keyboard_key_channel_handler.h",
|
||||
@@ -99,16 +98,16 @@ source_set("flutter_windows_source") {
|
||||
"task_runner_win32.h",
|
||||
"task_runner_win32_window.cc",
|
||||
"task_runner_win32_window.h",
|
||||
"text_input_manager_win32.cc",
|
||||
"text_input_manager_win32.h",
|
||||
"text_input_manager.cc",
|
||||
"text_input_manager.h",
|
||||
"text_input_plugin.cc",
|
||||
"text_input_plugin.h",
|
||||
"window.cc",
|
||||
"window.h",
|
||||
"window_binding_handler.h",
|
||||
"window_binding_handler_delegate.h",
|
||||
"window_proc_delegate_manager_win32.cc",
|
||||
"window_proc_delegate_manager_win32.h",
|
||||
"window_proc_delegate_manager.cc",
|
||||
"window_proc_delegate_manager.h",
|
||||
"window_state.h",
|
||||
]
|
||||
|
||||
@@ -173,11 +172,11 @@ executable("flutter_windows_unittests") {
|
||||
|
||||
# Common Windows test sources.
|
||||
sources = [
|
||||
"accessibility_bridge_delegate_win32_unittests.cc",
|
||||
"accessibility_bridge_delegate_windows_unittests.cc",
|
||||
"direct_manipulation_unittests.cc",
|
||||
"dpi_utils_win32_unittests.cc",
|
||||
"dpi_utils_unittests.cc",
|
||||
"flutter_project_bundle_unittests.cc",
|
||||
"flutter_window_win32_unittests.cc",
|
||||
"flutter_window_unittests.cc",
|
||||
"flutter_windows_engine_unittests.cc",
|
||||
"flutter_windows_texture_registrar_unittests.cc",
|
||||
"flutter_windows_view_unittests.cc",
|
||||
@@ -193,11 +192,11 @@ executable("flutter_windows_unittests") {
|
||||
"system_utils_unittests.cc",
|
||||
"task_runner_unittests.cc",
|
||||
"testing/engine_modifier.h",
|
||||
"testing/flutter_window_win32_test.cc",
|
||||
"testing/flutter_window_win32_test.h",
|
||||
"testing/flutter_window_test.cc",
|
||||
"testing/flutter_window_test.h",
|
||||
"testing/mock_gl_functions.h",
|
||||
"testing/mock_text_input_manager_win32.cc",
|
||||
"testing/mock_text_input_manager_win32.h",
|
||||
"testing/mock_text_input_manager.cc",
|
||||
"testing/mock_text_input_manager.h",
|
||||
"testing/mock_window.cc",
|
||||
"testing/mock_window.h",
|
||||
"testing/mock_window_binding_handler.cc",
|
||||
@@ -208,7 +207,7 @@ executable("flutter_windows_unittests") {
|
||||
"testing/wm_builders.cc",
|
||||
"testing/wm_builders.h",
|
||||
"text_input_plugin_unittest.cc",
|
||||
"window_proc_delegate_manager_win32_unittests.cc",
|
||||
"window_proc_delegate_manager_unittests.cc",
|
||||
"window_unittests.cc",
|
||||
]
|
||||
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
// 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/accessibility_bridge_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/accessibility_bridge_delegate_windows.h"
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_view.h"
|
||||
#include "flutter/third_party/accessibility/ax/platform/ax_platform_node_delegate_base.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
AccessibilityBridgeDelegateWin32::AccessibilityBridgeDelegateWin32(
|
||||
AccessibilityBridgeDelegateWindows::AccessibilityBridgeDelegateWindows(
|
||||
FlutterWindowsEngine* engine)
|
||||
: engine_(engine) {
|
||||
assert(engine_);
|
||||
}
|
||||
|
||||
void AccessibilityBridgeDelegateWin32::OnAccessibilityEvent(
|
||||
void AccessibilityBridgeDelegateWindows::OnAccessibilityEvent(
|
||||
ui::AXEventGenerator::TargetedEvent targeted_event) {
|
||||
ui::AXNode* ax_node = targeted_event.node;
|
||||
ui::AXEventGenerator::Event event_type = targeted_event.event_params.event;
|
||||
@@ -27,8 +27,9 @@ void AccessibilityBridgeDelegateWin32::OnAccessibilityEvent(
|
||||
auto node_delegate =
|
||||
bridge->GetFlutterPlatformNodeDelegateFromID(ax_node->id()).lock();
|
||||
assert(node_delegate);
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> win_delegate =
|
||||
std::static_pointer_cast<FlutterPlatformNodeDelegateWin32>(node_delegate);
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> win_delegate =
|
||||
std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
|
||||
node_delegate);
|
||||
|
||||
switch (event_type) {
|
||||
case ui::AXEventGenerator::Event::ALERT:
|
||||
@@ -137,7 +138,7 @@ void AccessibilityBridgeDelegateWin32::OnAccessibilityEvent(
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityBridgeDelegateWin32::DispatchAccessibilityAction(
|
||||
void AccessibilityBridgeDelegateWindows::DispatchAccessibilityAction(
|
||||
AccessibilityNodeId target,
|
||||
FlutterSemanticsAction action,
|
||||
fml::MallocMapping data) {
|
||||
@@ -145,18 +146,18 @@ void AccessibilityBridgeDelegateWin32::DispatchAccessibilityAction(
|
||||
}
|
||||
|
||||
std::shared_ptr<FlutterPlatformNodeDelegate>
|
||||
AccessibilityBridgeDelegateWin32::CreateFlutterPlatformNodeDelegate() {
|
||||
return std::make_shared<FlutterPlatformNodeDelegateWin32>(engine_);
|
||||
AccessibilityBridgeDelegateWindows::CreateFlutterPlatformNodeDelegate() {
|
||||
return std::make_shared<FlutterPlatformNodeDelegateWindows>(engine_);
|
||||
}
|
||||
|
||||
void AccessibilityBridgeDelegateWin32::DispatchWinAccessibilityEvent(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate,
|
||||
void AccessibilityBridgeDelegateWindows::DispatchWinAccessibilityEvent(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate,
|
||||
DWORD event_type) {
|
||||
node_delegate->DispatchWinAccessibilityEvent(event_type);
|
||||
}
|
||||
|
||||
void AccessibilityBridgeDelegateWin32::SetFocus(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate) {
|
||||
void AccessibilityBridgeDelegateWindows::SetFocus(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate) {
|
||||
node_delegate->SetFocus();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "flutter/shell/platform/common/accessibility_bridge.h"
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
|
||||
|
||||
namespace flutter {
|
||||
@@ -21,11 +21,11 @@ class FlutterWindowsEngine;
|
||||
// the framework to Windows, routing native Windows accessibility events to the
|
||||
// framework, and creating Windows-specific FlutterPlatformNodeDelegate objects
|
||||
// for each node in the semantics tree.
|
||||
class AccessibilityBridgeDelegateWin32
|
||||
class AccessibilityBridgeDelegateWindows
|
||||
: public AccessibilityBridge::AccessibilityBridgeDelegate {
|
||||
public:
|
||||
explicit AccessibilityBridgeDelegateWin32(FlutterWindowsEngine* engine);
|
||||
virtual ~AccessibilityBridgeDelegateWin32() = default;
|
||||
explicit AccessibilityBridgeDelegateWindows(FlutterWindowsEngine* engine);
|
||||
virtual ~AccessibilityBridgeDelegateWindows() = default;
|
||||
|
||||
// |AccessibilityBridge::AccessibilityBridgeDelegate|
|
||||
void OnAccessibilityEvent(
|
||||
@@ -43,13 +43,13 @@ class AccessibilityBridgeDelegateWin32
|
||||
// Dispatches a Windows accessibility event of the specified type, generated
|
||||
// by the accessibility node associated with the specified semantics node.
|
||||
virtual void DispatchWinAccessibilityEvent(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate,
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate,
|
||||
DWORD event_type);
|
||||
|
||||
// Sets the accessibility focus to the accessibility node associated with the
|
||||
// specified semantics node.
|
||||
virtual void SetFocus(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate);
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate);
|
||||
|
||||
private:
|
||||
FlutterWindowsEngine* engine_;
|
||||
@@ -2,7 +2,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/accessibility_bridge_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/accessibility_bridge_delegate_windows.h"
|
||||
|
||||
#include <comdef.h>
|
||||
#include <comutil.h>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "flutter/shell/platform/embedder/embedder.h"
|
||||
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_view.h"
|
||||
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
|
||||
@@ -28,25 +28,25 @@ namespace {
|
||||
|
||||
// A structure representing a Win32 MSAA event targeting a specified node.
|
||||
struct MsaaEvent {
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate;
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate;
|
||||
DWORD event_type;
|
||||
};
|
||||
|
||||
// Accessibility bridge delegate that captures events dispatched to the OS.
|
||||
class AccessibilityBridgeDelegateWin32Spy
|
||||
: public AccessibilityBridgeDelegateWin32 {
|
||||
class AccessibilityBridgeDelegateWindowsSpy
|
||||
: public AccessibilityBridgeDelegateWindows {
|
||||
public:
|
||||
explicit AccessibilityBridgeDelegateWin32Spy(FlutterWindowsEngine* engine)
|
||||
: AccessibilityBridgeDelegateWin32(engine) {}
|
||||
explicit AccessibilityBridgeDelegateWindowsSpy(FlutterWindowsEngine* engine)
|
||||
: AccessibilityBridgeDelegateWindows(engine) {}
|
||||
|
||||
void DispatchWinAccessibilityEvent(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate,
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> node_delegate,
|
||||
DWORD event_type) override {
|
||||
dispatched_events_.push_back({node_delegate, event_type});
|
||||
}
|
||||
|
||||
void SetFocus(std::shared_ptr<FlutterPlatformNodeDelegateWin32> node_delegate)
|
||||
override {
|
||||
void SetFocus(std::shared_ptr<FlutterPlatformNodeDelegateWindows>
|
||||
node_delegate) override {
|
||||
focused_nodes_.push_back(node_delegate->GetAXNode()->id());
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ void ExpectWinEventFromAXEvent(int32_t node_id,
|
||||
auto bridge = view.GetEngine()->accessibility_bridge().lock();
|
||||
PopulateAXTree(bridge);
|
||||
|
||||
AccessibilityBridgeDelegateWin32Spy spy(view.GetEngine());
|
||||
AccessibilityBridgeDelegateWindowsSpy spy(view.GetEngine());
|
||||
spy.OnAccessibilityEvent({AXNodeFromID(bridge, node_id),
|
||||
{ax_event, ax::mojom::EventFrom::kNone, {}}});
|
||||
ASSERT_EQ(spy.dispatched_events().size(), 1);
|
||||
@@ -163,7 +163,7 @@ void ExpectWinEventFromAXEvent(int32_t node_id,
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, GetParent) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, GetParent) {
|
||||
auto window_binding_handler =
|
||||
std::make_unique<::testing::NiceMock<MockWindowBindingHandler>>();
|
||||
FlutterWindowsView view(std::move(window_binding_handler));
|
||||
@@ -179,7 +179,7 @@ TEST(AccessibilityBridgeDelegateWin32, GetParent) {
|
||||
node1_delegate->GetParent());
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, GetParentOnRootRetunsNullptr) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, GetParentOnRootRetunsNullptr) {
|
||||
auto window_binding_handler =
|
||||
std::make_unique<::testing::NiceMock<MockWindowBindingHandler>>();
|
||||
FlutterWindowsView view(std::move(window_binding_handler));
|
||||
@@ -193,7 +193,7 @@ TEST(AccessibilityBridgeDelegateWin32, GetParentOnRootRetunsNullptr) {
|
||||
ASSERT_TRUE(node0_delegate->GetParent() == nullptr);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, DispatchAccessibilityAction) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, DispatchAccessibilityAction) {
|
||||
auto window_binding_handler =
|
||||
std::make_unique<::testing::NiceMock<MockWindowBindingHandler>>();
|
||||
FlutterWindowsView view(std::move(window_binding_handler));
|
||||
@@ -214,22 +214,22 @@ TEST(AccessibilityBridgeDelegateWin32, DispatchAccessibilityAction) {
|
||||
return kSuccess;
|
||||
}));
|
||||
|
||||
AccessibilityBridgeDelegateWin32 delegate(view.GetEngine());
|
||||
AccessibilityBridgeDelegateWindows delegate(view.GetEngine());
|
||||
delegate.DispatchAccessibilityAction(1, kFlutterSemanticsActionCopy, {});
|
||||
EXPECT_EQ(actual_action, kFlutterSemanticsActionCopy);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventAlert) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityEventAlert) {
|
||||
ExpectWinEventFromAXEvent(0, ui::AXEventGenerator::Event::ALERT,
|
||||
EVENT_SYSTEM_ALERT);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventChildrenChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityEventChildrenChanged) {
|
||||
ExpectWinEventFromAXEvent(0, ui::AXEventGenerator::Event::CHILDREN_CHANGED,
|
||||
EVENT_OBJECT_REORDER);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventFocusChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityEventFocusChanged) {
|
||||
auto window_binding_handler =
|
||||
std::make_unique<::testing::NiceMock<MockWindowBindingHandler>>();
|
||||
FlutterWindowsView view(std::move(window_binding_handler));
|
||||
@@ -239,7 +239,7 @@ TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventFocusChanged) {
|
||||
auto bridge = view.GetEngine()->accessibility_bridge().lock();
|
||||
PopulateAXTree(bridge);
|
||||
|
||||
AccessibilityBridgeDelegateWin32Spy spy(view.GetEngine());
|
||||
AccessibilityBridgeDelegateWindowsSpy spy(view.GetEngine());
|
||||
spy.OnAccessibilityEvent({AXNodeFromID(bridge, 1),
|
||||
{ui::AXEventGenerator::Event::FOCUS_CHANGED,
|
||||
ax::mojom::EventFrom::kNone,
|
||||
@@ -251,62 +251,64 @@ TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventFocusChanged) {
|
||||
EXPECT_EQ(spy.focused_nodes()[0], 1);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityEventIgnoredChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityEventIgnoredChanged) {
|
||||
// Static test nodes with no text, hint, or scrollability are ignored.
|
||||
ExpectWinEventFromAXEvent(4, ui::AXEventGenerator::Event::IGNORED_CHANGED,
|
||||
EVENT_OBJECT_HIDE);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityImageAnnotationChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows,
|
||||
OnAccessibilityImageAnnotationChanged) {
|
||||
ExpectWinEventFromAXEvent(
|
||||
1, ui::AXEventGenerator::Event::IMAGE_ANNOTATION_CHANGED,
|
||||
EVENT_OBJECT_NAMECHANGE);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityLiveRegionChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityLiveRegionChanged) {
|
||||
ExpectWinEventFromAXEvent(1, ui::AXEventGenerator::Event::LIVE_REGION_CHANGED,
|
||||
EVENT_OBJECT_LIVEREGIONCHANGED);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityNameChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityNameChanged) {
|
||||
ExpectWinEventFromAXEvent(1, ui::AXEventGenerator::Event::NAME_CHANGED,
|
||||
EVENT_OBJECT_NAMECHANGE);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityHScrollPosChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityHScrollPosChanged) {
|
||||
ExpectWinEventFromAXEvent(
|
||||
1, ui::AXEventGenerator::Event::SCROLL_HORIZONTAL_POSITION_CHANGED,
|
||||
EVENT_SYSTEM_SCROLLINGEND);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityVScrollPosChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityVScrollPosChanged) {
|
||||
ExpectWinEventFromAXEvent(
|
||||
1, ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED,
|
||||
EVENT_SYSTEM_SCROLLINGEND);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilitySelectedChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilitySelectedChanged) {
|
||||
ExpectWinEventFromAXEvent(1, ui::AXEventGenerator::Event::SELECTED_CHANGED,
|
||||
EVENT_OBJECT_VALUECHANGE);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilitySelectedChildrenChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows,
|
||||
OnAccessibilitySelectedChildrenChanged) {
|
||||
ExpectWinEventFromAXEvent(
|
||||
2, ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED,
|
||||
EVENT_OBJECT_SELECTIONWITHIN);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilitySubtreeCreated) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilitySubtreeCreated) {
|
||||
ExpectWinEventFromAXEvent(0, ui::AXEventGenerator::Event::SUBTREE_CREATED,
|
||||
EVENT_OBJECT_SHOW);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityValueChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityValueChanged) {
|
||||
ExpectWinEventFromAXEvent(1, ui::AXEventGenerator::Event::VALUE_CHANGED,
|
||||
EVENT_OBJECT_VALUECHANGE);
|
||||
}
|
||||
|
||||
TEST(AccessibilityBridgeDelegateWin32, OnAccessibilityStateChanged) {
|
||||
TEST(AccessibilityBridgeDelegateWindows, OnAccessibilityStateChanged) {
|
||||
ExpectWinEventFromAXEvent(
|
||||
1, ui::AXEventGenerator::Event::WIN_IACCESSIBLE_STATE_CHANGED,
|
||||
EVENT_OBJECT_STATECHANGE);
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "dpi_utils_win32.h"
|
||||
#include "dpi_utils.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
@@ -26,11 +26,11 @@ bool AssignProcAddress(HMODULE comBaseModule, const char* name, T*& outProc) {
|
||||
|
||||
/// A helper class for abstracting various Windows DPI related functions across
|
||||
/// Windows OS versions.
|
||||
class DpiHelperWin32 {
|
||||
class DpiHelper {
|
||||
public:
|
||||
DpiHelperWin32();
|
||||
DpiHelper();
|
||||
|
||||
~DpiHelperWin32();
|
||||
~DpiHelper();
|
||||
|
||||
/// Returns the DPI for |hwnd|. Supports all DPI awareness modes, and is
|
||||
/// backward compatible down to Windows Vista. If |hwnd| is nullptr, returns
|
||||
@@ -60,7 +60,7 @@ class DpiHelperWin32 {
|
||||
bool dpi_for_monitor_supported_ = false;
|
||||
};
|
||||
|
||||
DpiHelperWin32::DpiHelperWin32() {
|
||||
DpiHelper::DpiHelper() {
|
||||
if ((user32_module_ = LoadLibraryA("User32.dll")) != nullptr) {
|
||||
dpi_for_window_supported_ = (AssignProcAddress(
|
||||
user32_module_, "GetDpiForWindow", get_dpi_for_window_));
|
||||
@@ -71,7 +71,7 @@ DpiHelperWin32::DpiHelperWin32() {
|
||||
}
|
||||
}
|
||||
|
||||
DpiHelperWin32::~DpiHelperWin32() {
|
||||
DpiHelper::~DpiHelper() {
|
||||
if (user32_module_ != nullptr) {
|
||||
FreeLibrary(user32_module_);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ DpiHelperWin32::~DpiHelperWin32() {
|
||||
}
|
||||
}
|
||||
|
||||
UINT DpiHelperWin32::GetDpiForWindow(HWND hwnd) {
|
||||
UINT DpiHelper::GetDpiForWindow(HWND hwnd) {
|
||||
// GetDpiForWindow returns the DPI for any awareness mode. If not available,
|
||||
// or no |hwnd| is provided, fallback to a per monitor, system, or default
|
||||
// DPI.
|
||||
@@ -101,7 +101,7 @@ UINT DpiHelperWin32::GetDpiForWindow(HWND hwnd) {
|
||||
return dpi;
|
||||
}
|
||||
|
||||
UINT DpiHelperWin32::GetDpiForMonitor(HMONITOR monitor) {
|
||||
UINT DpiHelper::GetDpiForMonitor(HMONITOR monitor) {
|
||||
if (dpi_for_monitor_supported_) {
|
||||
if (monitor == nullptr) {
|
||||
const POINT target_point = {0, 0};
|
||||
@@ -117,8 +117,8 @@ UINT DpiHelperWin32::GetDpiForMonitor(HMONITOR monitor) {
|
||||
return kDefaultDpi;
|
||||
} // namespace
|
||||
|
||||
DpiHelperWin32* GetHelper() {
|
||||
static DpiHelperWin32* dpi_helper = new DpiHelperWin32();
|
||||
DpiHelper* GetHelper() {
|
||||
static DpiHelper* dpi_helper = new DpiHelper();
|
||||
return dpi_helper;
|
||||
}
|
||||
} // namespace
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "flutter/shell/platform/windows/dpi_utils_win32.h"
|
||||
#include "flutter/shell/platform/windows/dpi_utils.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
@@ -2,11 +2,11 @@
|
||||
// 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/event_watcher_win32.h"
|
||||
#include "flutter/shell/platform/windows/event_watcher.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
EventWatcherWin32::EventWatcherWin32(std::function<void()> callback)
|
||||
EventWatcher::EventWatcher(std::function<void()> callback)
|
||||
: callback_(callback) {
|
||||
handle_ = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
@@ -15,18 +15,18 @@ EventWatcherWin32::EventWatcherWin32(std::function<void()> callback)
|
||||
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD);
|
||||
}
|
||||
|
||||
EventWatcherWin32::~EventWatcherWin32() {
|
||||
EventWatcher::~EventWatcher() {
|
||||
UnregisterWait(handle_for_wait_);
|
||||
CloseHandle(handle_);
|
||||
}
|
||||
|
||||
HANDLE EventWatcherWin32::GetHandle() {
|
||||
HANDLE EventWatcher::GetHandle() {
|
||||
return handle_;
|
||||
}
|
||||
|
||||
// static
|
||||
VOID CALLBACK EventWatcherWin32::CallbackForWait(PVOID context, BOOLEAN) {
|
||||
EventWatcherWin32* self = reinterpret_cast<EventWatcherWin32*>(context);
|
||||
VOID CALLBACK EventWatcher::CallbackForWait(PVOID context, BOOLEAN) {
|
||||
EventWatcher* self = reinterpret_cast<EventWatcher*>(context);
|
||||
ResetEvent(self->handle_);
|
||||
self->callback_();
|
||||
}
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace flutter {
|
||||
|
||||
// A win32 `HANDLE` wrapper for use as a one-time callback.
|
||||
class EventWatcherWin32 {
|
||||
class EventWatcher {
|
||||
public:
|
||||
explicit EventWatcherWin32(std::function<void()> callback);
|
||||
~EventWatcherWin32();
|
||||
explicit EventWatcher(std::function<void()> callback);
|
||||
~EventWatcher();
|
||||
|
||||
// Returns `HANDLE`, which can be used to register an event listener.
|
||||
HANDLE GetHandle();
|
||||
@@ -28,8 +28,8 @@ class EventWatcherWin32 {
|
||||
HANDLE handle_;
|
||||
HANDLE handle_for_wait_;
|
||||
|
||||
EventWatcherWin32(const EventWatcherWin32&) = delete;
|
||||
EventWatcherWin32& operator=(const EventWatcherWin32&) = delete;
|
||||
EventWatcher(const EventWatcher&) = delete;
|
||||
EventWatcher& operator=(const EventWatcher&) = delete;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <oleacc.h>
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h"
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_windows_view.h"
|
||||
#include "flutter/third_party/accessibility/ax/ax_clipping_behavior.h"
|
||||
@@ -12,21 +12,21 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
FlutterPlatformNodeDelegateWin32::FlutterPlatformNodeDelegateWin32(
|
||||
FlutterPlatformNodeDelegateWindows::FlutterPlatformNodeDelegateWindows(
|
||||
FlutterWindowsEngine* engine)
|
||||
: engine_(engine) {
|
||||
assert(engine_);
|
||||
}
|
||||
|
||||
FlutterPlatformNodeDelegateWin32::~FlutterPlatformNodeDelegateWin32() {
|
||||
FlutterPlatformNodeDelegateWindows::~FlutterPlatformNodeDelegateWindows() {
|
||||
if (ax_platform_node_) {
|
||||
ax_platform_node_->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// |ui::AXPlatformNodeDelegate|
|
||||
void FlutterPlatformNodeDelegateWin32::Init(std::weak_ptr<OwnerBridge> bridge,
|
||||
ui::AXNode* node) {
|
||||
void FlutterPlatformNodeDelegateWindows::Init(std::weak_ptr<OwnerBridge> bridge,
|
||||
ui::AXNode* node) {
|
||||
FlutterPlatformNodeDelegate::Init(bridge, node);
|
||||
ax_platform_node_ = ui::AXPlatformNode::Create(this);
|
||||
assert(ax_platform_node_);
|
||||
@@ -34,13 +34,13 @@ void FlutterPlatformNodeDelegateWin32::Init(std::weak_ptr<OwnerBridge> bridge,
|
||||
|
||||
// |ui::AXPlatformNodeDelegate|
|
||||
gfx::NativeViewAccessible
|
||||
FlutterPlatformNodeDelegateWin32::GetNativeViewAccessible() {
|
||||
FlutterPlatformNodeDelegateWindows::GetNativeViewAccessible() {
|
||||
assert(ax_platform_node_);
|
||||
return ax_platform_node_->GetNativeViewAccessible();
|
||||
}
|
||||
|
||||
// |ui::AXPlatformNodeDelegate|
|
||||
gfx::NativeViewAccessible FlutterPlatformNodeDelegateWin32::HitTestSync(
|
||||
gfx::NativeViewAccessible FlutterPlatformNodeDelegateWindows::HitTestSync(
|
||||
int screen_physical_pixel_x,
|
||||
int screen_physical_pixel_y) const {
|
||||
// If this node doesn't contain the point, return.
|
||||
@@ -56,8 +56,8 @@ gfx::NativeViewAccessible FlutterPlatformNodeDelegateWin32::HitTestSync(
|
||||
auto bridge = engine_->accessibility_bridge().lock();
|
||||
assert(bridge);
|
||||
for (const ui::AXNode* child : GetAXNode()->children()) {
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWin32> win_delegate =
|
||||
std::static_pointer_cast<FlutterPlatformNodeDelegateWin32>(
|
||||
std::shared_ptr<FlutterPlatformNodeDelegateWindows> win_delegate =
|
||||
std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
|
||||
bridge->GetFlutterPlatformNodeDelegateFromID(child->id()).lock());
|
||||
assert(win_delegate);
|
||||
auto hit_view = win_delegate->HitTestSync(screen_physical_pixel_x,
|
||||
@@ -72,7 +72,7 @@ gfx::NativeViewAccessible FlutterPlatformNodeDelegateWin32::HitTestSync(
|
||||
}
|
||||
|
||||
// |FlutterPlatformNodeDelegate|
|
||||
gfx::Rect FlutterPlatformNodeDelegateWin32::GetBoundsRect(
|
||||
gfx::Rect FlutterPlatformNodeDelegateWindows::GetBoundsRect(
|
||||
const ui::AXCoordinateSystem coordinate_system,
|
||||
const ui::AXClippingBehavior clipping_behavior,
|
||||
ui::AXOffscreenResult* offscreen_result) const {
|
||||
@@ -86,7 +86,7 @@ gfx::Rect FlutterPlatformNodeDelegateWin32::GetBoundsRect(
|
||||
extent.y - origin.y);
|
||||
}
|
||||
|
||||
void FlutterPlatformNodeDelegateWin32::DispatchWinAccessibilityEvent(
|
||||
void FlutterPlatformNodeDelegateWindows::DispatchWinAccessibilityEvent(
|
||||
DWORD event_type) {
|
||||
FlutterWindowsView* view = engine_->view();
|
||||
if (!view) {
|
||||
@@ -101,7 +101,7 @@ void FlutterPlatformNodeDelegateWin32::DispatchWinAccessibilityEvent(
|
||||
-ax_platform_node_->GetUniqueId());
|
||||
}
|
||||
|
||||
void FlutterPlatformNodeDelegateWin32::SetFocus() {
|
||||
void FlutterPlatformNodeDelegateWindows::SetFocus() {
|
||||
VARIANT varchild{};
|
||||
varchild.vt = VT_I4;
|
||||
varchild.lVal = CHILDID_SELF;
|
||||
@@ -14,14 +14,14 @@ namespace flutter {
|
||||
|
||||
class FlutterWindowsEngine;
|
||||
|
||||
// The Win32 implementation of FlutterPlatformNodeDelegate.
|
||||
// The Windows implementation of FlutterPlatformNodeDelegate.
|
||||
//
|
||||
// This class implements a wrapper around the Win32 accessibility objects that
|
||||
// compose the accessibility tree.
|
||||
class FlutterPlatformNodeDelegateWin32 : public FlutterPlatformNodeDelegate {
|
||||
// This class implements a wrapper around the Windows accessibility objects
|
||||
// that compose the accessibility tree.
|
||||
class FlutterPlatformNodeDelegateWindows : public FlutterPlatformNodeDelegate {
|
||||
public:
|
||||
explicit FlutterPlatformNodeDelegateWin32(FlutterWindowsEngine* engine);
|
||||
virtual ~FlutterPlatformNodeDelegateWin32();
|
||||
explicit FlutterPlatformNodeDelegateWindows(FlutterWindowsEngine* engine);
|
||||
virtual ~FlutterPlatformNodeDelegateWindows();
|
||||
|
||||
// |ui::AXPlatformNodeDelegate|
|
||||
void Init(std::weak_ptr<OwnerBridge> bridge, ui::AXNode* node) override;
|
||||
@@ -2,7 +2,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/flutter_window_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
#include <chrono>
|
||||
@@ -61,44 +61,44 @@ static HCURSOR GetCursorByName(const std::string& cursor_name) {
|
||||
|
||||
} // namespace
|
||||
|
||||
FlutterWindowWin32::FlutterWindowWin32(int width, int height)
|
||||
FlutterWindow::FlutterWindow(int width, int height)
|
||||
: binding_handler_delegate_(nullptr) {
|
||||
Window::InitializeChild("FLUTTERVIEW", width, height);
|
||||
current_cursor_ = ::LoadCursor(nullptr, IDC_ARROW);
|
||||
}
|
||||
|
||||
FlutterWindowWin32::~FlutterWindowWin32() {}
|
||||
FlutterWindow::~FlutterWindow() {}
|
||||
|
||||
void FlutterWindowWin32::SetView(WindowBindingHandlerDelegate* window) {
|
||||
void FlutterWindow::SetView(WindowBindingHandlerDelegate* window) {
|
||||
binding_handler_delegate_ = window;
|
||||
direct_manipulation_owner_->SetBindingHandlerDelegate(window);
|
||||
}
|
||||
|
||||
WindowsRenderTarget FlutterWindowWin32::GetRenderTarget() {
|
||||
WindowsRenderTarget FlutterWindow::GetRenderTarget() {
|
||||
return WindowsRenderTarget(GetWindowHandle());
|
||||
}
|
||||
|
||||
PlatformWindow FlutterWindowWin32::GetPlatformWindow() {
|
||||
PlatformWindow FlutterWindow::GetPlatformWindow() {
|
||||
return GetWindowHandle();
|
||||
}
|
||||
|
||||
float FlutterWindowWin32::GetDpiScale() {
|
||||
float FlutterWindow::GetDpiScale() {
|
||||
return static_cast<float>(GetCurrentDPI()) / static_cast<float>(base_dpi);
|
||||
}
|
||||
|
||||
bool FlutterWindowWin32::IsVisible() {
|
||||
bool FlutterWindow::IsVisible() {
|
||||
return IsWindowVisible(GetWindowHandle());
|
||||
}
|
||||
|
||||
PhysicalWindowBounds FlutterWindowWin32::GetPhysicalWindowBounds() {
|
||||
PhysicalWindowBounds FlutterWindow::GetPhysicalWindowBounds() {
|
||||
return {GetCurrentWidth(), GetCurrentHeight()};
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::UpdateFlutterCursor(const std::string& cursor_name) {
|
||||
void FlutterWindow::UpdateFlutterCursor(const std::string& cursor_name) {
|
||||
current_cursor_ = GetCursorByName(cursor_name);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnWindowResized() {
|
||||
void FlutterWindow::OnWindowResized() {
|
||||
// Blocking the raster thread until DWM flushes alleviates glitches where
|
||||
// previous size surface is stretched over current size view.
|
||||
DwmFlush();
|
||||
@@ -125,34 +125,34 @@ static uint64_t ConvertWinButtonToFlutterButton(UINT button) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnDpiScale(unsigned int dpi){};
|
||||
void FlutterWindow::OnDpiScale(unsigned int dpi){};
|
||||
|
||||
// When DesktopWindow notifies that a WM_Size message has come in
|
||||
// lets FlutterEngine know about the new size.
|
||||
void FlutterWindowWin32::OnResize(unsigned int width, unsigned int height) {
|
||||
void FlutterWindow::OnResize(unsigned int width, unsigned int height) {
|
||||
if (binding_handler_delegate_ != nullptr) {
|
||||
binding_handler_delegate_->OnWindowSizeChanged(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnPaint() {
|
||||
void FlutterWindow::OnPaint() {
|
||||
if (binding_handler_delegate_ != nullptr) {
|
||||
binding_handler_delegate_->OnWindowRepaint();
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnPointerMove(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
void FlutterWindow::OnPointerMove(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
binding_handler_delegate_->OnPointerMove(x, y, device_kind, device_id);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnPointerDown(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id,
|
||||
UINT button) {
|
||||
void FlutterWindow::OnPointerDown(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id,
|
||||
UINT button) {
|
||||
uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
|
||||
if (flutter_button != 0) {
|
||||
binding_handler_delegate_->OnPointerDown(
|
||||
@@ -161,11 +161,11 @@ void FlutterWindowWin32::OnPointerDown(double x,
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnPointerUp(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id,
|
||||
UINT button) {
|
||||
void FlutterWindow::OnPointerUp(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id,
|
||||
UINT button) {
|
||||
uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
|
||||
if (flutter_button != 0) {
|
||||
binding_handler_delegate_->OnPointerUp(
|
||||
@@ -174,57 +174,57 @@ void FlutterWindowWin32::OnPointerUp(double x,
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnPointerLeave(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
void FlutterWindow::OnPointerLeave(double x,
|
||||
double y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
binding_handler_delegate_->OnPointerLeave(x, y, device_kind, device_id);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnSetCursor() {
|
||||
void FlutterWindow::OnSetCursor() {
|
||||
::SetCursor(current_cursor_);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnText(const std::u16string& text) {
|
||||
void FlutterWindow::OnText(const std::u16string& text) {
|
||||
binding_handler_delegate_->OnText(text);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnKey(int key,
|
||||
int scancode,
|
||||
int action,
|
||||
char32_t character,
|
||||
bool extended,
|
||||
bool was_down,
|
||||
KeyEventCallback callback) {
|
||||
void FlutterWindow::OnKey(int key,
|
||||
int scancode,
|
||||
int action,
|
||||
char32_t character,
|
||||
bool extended,
|
||||
bool was_down,
|
||||
KeyEventCallback callback) {
|
||||
binding_handler_delegate_->OnKey(key, scancode, action, character, extended,
|
||||
was_down, std::move(callback));
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnComposeBegin() {
|
||||
void FlutterWindow::OnComposeBegin() {
|
||||
binding_handler_delegate_->OnComposeBegin();
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnComposeCommit() {
|
||||
void FlutterWindow::OnComposeCommit() {
|
||||
binding_handler_delegate_->OnComposeCommit();
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnComposeEnd() {
|
||||
void FlutterWindow::OnComposeEnd() {
|
||||
binding_handler_delegate_->OnComposeEnd();
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnComposeChange(const std::u16string& text,
|
||||
int cursor_pos) {
|
||||
void FlutterWindow::OnComposeChange(const std::u16string& text,
|
||||
int cursor_pos) {
|
||||
binding_handler_delegate_->OnComposeChange(text, cursor_pos);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnUpdateSemanticsEnabled(bool enabled) {
|
||||
void FlutterWindow::OnUpdateSemanticsEnabled(bool enabled) {
|
||||
binding_handler_delegate_->OnUpdateSemanticsEnabled(enabled);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnScroll(double delta_x,
|
||||
double delta_y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
void FlutterWindow::OnScroll(double delta_x,
|
||||
double delta_y,
|
||||
FlutterPointerDeviceKind device_kind,
|
||||
int32_t device_id) {
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
|
||||
@@ -234,7 +234,7 @@ void FlutterWindowWin32::OnScroll(double delta_x,
|
||||
device_id);
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnCursorRectUpdated(const Rect& rect) {
|
||||
void FlutterWindow::OnCursorRectUpdated(const Rect& rect) {
|
||||
// Convert the rect from Flutter logical coordinates to device coordinates.
|
||||
auto scale = GetDpiScale();
|
||||
Point origin(rect.left() * scale, rect.top() * scale);
|
||||
@@ -242,13 +242,13 @@ void FlutterWindowWin32::OnCursorRectUpdated(const Rect& rect) {
|
||||
UpdateCursorRect(Rect(origin, size));
|
||||
}
|
||||
|
||||
void FlutterWindowWin32::OnResetImeComposing() {
|
||||
void FlutterWindow::OnResetImeComposing() {
|
||||
AbortImeComposing();
|
||||
}
|
||||
|
||||
bool FlutterWindowWin32::OnBitmapSurfaceUpdated(const void* allocation,
|
||||
size_t row_bytes,
|
||||
size_t height) {
|
||||
bool FlutterWindow::OnBitmapSurfaceUpdated(const void* allocation,
|
||||
size_t row_bytes,
|
||||
size_t height) {
|
||||
HDC dc = ::GetDC(GetWindowHandle());
|
||||
BITMAPINFO bmi;
|
||||
memset(&bmi, 0, sizeof(bmi));
|
||||
@@ -265,11 +265,11 @@ bool FlutterWindowWin32::OnBitmapSurfaceUpdated(const void* allocation,
|
||||
return ret != 0;
|
||||
}
|
||||
|
||||
gfx::NativeViewAccessible FlutterWindowWin32::GetNativeViewAccessible() {
|
||||
gfx::NativeViewAccessible FlutterWindow::GetNativeViewAccessible() {
|
||||
return binding_handler_delegate_->GetNativeViewAccessible();
|
||||
}
|
||||
|
||||
PointerLocation FlutterWindowWin32::GetPrimaryPointerLocation() {
|
||||
PointerLocation FlutterWindow::GetPrimaryPointerLocation() {
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
ScreenToClient(GetWindowHandle(), &point);
|
||||
@@ -23,12 +23,12 @@ namespace flutter {
|
||||
// the future, there will likely be a CoreWindow-based FlutterWindow as well.
|
||||
// At the point may make sense to dependency inject the native window rather
|
||||
// than inherit.
|
||||
class FlutterWindowWin32 : public Window, public WindowBindingHandler {
|
||||
class FlutterWindow : public Window, public WindowBindingHandler {
|
||||
public:
|
||||
// Create flutter Window for use as child window
|
||||
FlutterWindowWin32(int width, int height);
|
||||
FlutterWindow(int width, int height);
|
||||
|
||||
virtual ~FlutterWindowWin32();
|
||||
virtual ~FlutterWindow();
|
||||
|
||||
// |Window|
|
||||
void OnDpiScale(unsigned int dpi) override;
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "flutter/shell/platform/windows/keyboard_key_channel_handler.h"
|
||||
#include "flutter/shell/platform/windows/keyboard_key_handler.h"
|
||||
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
|
||||
#include "flutter/shell/platform/windows/testing/flutter_window_win32_test.h"
|
||||
#include "flutter/shell/platform/windows/testing/flutter_window_test.h"
|
||||
#include "flutter/shell/platform/windows/testing/mock_window_binding_handler.h"
|
||||
#include "flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h"
|
||||
#include "flutter/shell/platform/windows/testing/test_keyboard.h"
|
||||
@@ -94,17 +94,17 @@ class SpyTextInputPlugin : public TextInputPlugin,
|
||||
std::unique_ptr<TextInputPlugin> real_implementation_;
|
||||
};
|
||||
|
||||
class MockFlutterWindowWin32 : public FlutterWindowWin32 {
|
||||
class MockFlutterWindow : public FlutterWindow {
|
||||
public:
|
||||
MockFlutterWindowWin32() : FlutterWindowWin32(800, 600) {
|
||||
MockFlutterWindow() : FlutterWindow(800, 600) {
|
||||
ON_CALL(*this, GetDpiScale())
|
||||
.WillByDefault(Return(this->FlutterWindowWin32::GetDpiScale()));
|
||||
.WillByDefault(Return(this->FlutterWindow::GetDpiScale()));
|
||||
}
|
||||
virtual ~MockFlutterWindowWin32() {}
|
||||
virtual ~MockFlutterWindow() {}
|
||||
|
||||
// Prevent copying.
|
||||
MockFlutterWindowWin32(MockFlutterWindowWin32 const&) = delete;
|
||||
MockFlutterWindowWin32& operator=(MockFlutterWindowWin32 const&) = delete;
|
||||
MockFlutterWindow(MockFlutterWindow const&) = delete;
|
||||
MockFlutterWindow& operator=(MockFlutterWindow const&) = delete;
|
||||
|
||||
// Wrapper for GetCurrentDPI() which is a protected method.
|
||||
UINT GetDpi() { return GetCurrentDPI(); }
|
||||
@@ -206,13 +206,13 @@ std::unique_ptr<FlutterWindowsEngine> GetTestEngine() {
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(FlutterWindowWin32Test, CreateDestroy) {
|
||||
FlutterWindowWin32Test window(800, 600);
|
||||
TEST(FlutterWindowTest, CreateDestroy) {
|
||||
FlutterWindowTest window(800, 600);
|
||||
ASSERT_TRUE(TRUE);
|
||||
}
|
||||
|
||||
TEST(FlutterWindowWin32Test, OnBitmapSurfaceUpdated) {
|
||||
FlutterWindowWin32 win32window(100, 100);
|
||||
TEST(FlutterWindowTest, OnBitmapSurfaceUpdated) {
|
||||
FlutterWindow win32window(100, 100);
|
||||
int old_handle_count = GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS);
|
||||
|
||||
constexpr size_t row_bytes = 100 * 4;
|
||||
@@ -228,8 +228,8 @@ TEST(FlutterWindowWin32Test, OnBitmapSurfaceUpdated) {
|
||||
// Tests that composing rect updates are transformed from Flutter logical
|
||||
// coordinates to device coordinates and passed to the text input manager
|
||||
// when the DPI scale is 100% (96 DPI).
|
||||
TEST(FlutterWindowWin32Test, OnCursorRectUpdatedRegularDPI) {
|
||||
MockFlutterWindowWin32 win32window;
|
||||
TEST(FlutterWindowTest, OnCursorRectUpdatedRegularDPI) {
|
||||
MockFlutterWindow win32window;
|
||||
ON_CALL(win32window, GetDpiScale()).WillByDefault(Return(1.0));
|
||||
EXPECT_CALL(win32window, GetDpiScale()).Times(1);
|
||||
|
||||
@@ -242,8 +242,8 @@ TEST(FlutterWindowWin32Test, OnCursorRectUpdatedRegularDPI) {
|
||||
// Tests that composing rect updates are transformed from Flutter logical
|
||||
// coordinates to device coordinates and passed to the text input manager
|
||||
// when the DPI scale is 150% (144 DPI).
|
||||
TEST(FlutterWindowWin32Test, OnCursorRectUpdatedHighDPI) {
|
||||
MockFlutterWindowWin32 win32window;
|
||||
TEST(FlutterWindowTest, OnCursorRectUpdatedHighDPI) {
|
||||
MockFlutterWindow win32window;
|
||||
ON_CALL(win32window, GetDpiScale()).WillByDefault(Return(1.5));
|
||||
EXPECT_CALL(win32window, GetDpiScale()).Times(1);
|
||||
|
||||
@@ -254,8 +254,8 @@ TEST(FlutterWindowWin32Test, OnCursorRectUpdatedHighDPI) {
|
||||
win32window.OnCursorRectUpdated(cursor_rect);
|
||||
}
|
||||
|
||||
TEST(FlutterWindowWin32Test, OnPointerStarSendsDeviceType) {
|
||||
FlutterWindowWin32 win32window(100, 100);
|
||||
TEST(FlutterWindowTest, OnPointerStarSendsDeviceType) {
|
||||
FlutterWindow win32window(100, 100);
|
||||
MockWindowBindingHandlerDelegate delegate;
|
||||
win32window.SetView(&delegate);
|
||||
// Move
|
||||
@@ -349,8 +349,8 @@ TEST(FlutterWindowWin32Test, OnPointerStarSendsDeviceType) {
|
||||
|
||||
// Tests that calls to OnScroll in turn calls GetScrollOffsetMultiplier
|
||||
// for mapping scroll ticks to pixels.
|
||||
TEST(FlutterWindowWin32Test, OnScrollCallsGetScrollOffsetMultiplier) {
|
||||
MockFlutterWindowWin32 win32window;
|
||||
TEST(FlutterWindowTest, OnScrollCallsGetScrollOffsetMultiplier) {
|
||||
MockFlutterWindow win32window;
|
||||
MockWindowBindingHandlerDelegate delegate;
|
||||
win32window.SetView(&delegate);
|
||||
|
||||
@@ -367,8 +367,8 @@ TEST(FlutterWindowWin32Test, OnScrollCallsGetScrollOffsetMultiplier) {
|
||||
kDefaultPointerDeviceId);
|
||||
}
|
||||
|
||||
TEST(FlutterWindowWin32Test, OnWindowRepaint) {
|
||||
MockFlutterWindowWin32 win32window;
|
||||
TEST(FlutterWindowTest, OnWindowRepaint) {
|
||||
MockFlutterWindow win32window;
|
||||
MockWindowBindingHandlerDelegate delegate;
|
||||
win32window.SetView(&delegate);
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#include "flutter/shell/platform/common/incoming_message_dispatcher.h"
|
||||
#include "flutter/shell/platform/common/path_utils.h"
|
||||
#include "flutter/shell/platform/embedder/embedder.h"
|
||||
#include "flutter/shell/platform/windows/dpi_utils.h"
|
||||
#include "flutter/shell/platform/windows/flutter_project_bundle.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_view.h"
|
||||
#include "flutter/shell/platform/windows/window_binding_handler.h"
|
||||
@@ -61,6 +63,31 @@ static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(
|
||||
return reinterpret_cast<FlutterDesktopTextureRegistrarRef>(registrar);
|
||||
}
|
||||
|
||||
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
|
||||
int width,
|
||||
int height,
|
||||
FlutterDesktopEngineRef engine) {
|
||||
std::unique_ptr<flutter::WindowBindingHandler> window_wrapper =
|
||||
std::make_unique<flutter::FlutterWindow>(width, height);
|
||||
|
||||
auto state = std::make_unique<FlutterDesktopViewControllerState>();
|
||||
state->view =
|
||||
std::make_unique<flutter::FlutterWindowsView>(std::move(window_wrapper));
|
||||
// Take ownership of the engine, starting it if necessary.
|
||||
state->view->SetEngine(
|
||||
std::unique_ptr<flutter::FlutterWindowsEngine>(EngineFromHandle(engine)));
|
||||
state->view->CreateRenderSurface();
|
||||
if (!state->view->GetEngine()->running()) {
|
||||
if (!state->view->GetEngine()->RunWithEntrypoint(nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Must happen after engine is running.
|
||||
state->view->SendInitialBounds();
|
||||
return state.release();
|
||||
}
|
||||
|
||||
void FlutterDesktopViewControllerDestroy(
|
||||
FlutterDesktopViewControllerRef controller) {
|
||||
delete controller;
|
||||
@@ -81,6 +108,23 @@ void FlutterDesktopViewControllerForceRedraw(
|
||||
controller->view->ForceRedraw();
|
||||
}
|
||||
|
||||
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
|
||||
FlutterDesktopViewControllerRef controller,
|
||||
HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam,
|
||||
LRESULT* result) {
|
||||
std::optional<LRESULT> delegate_result =
|
||||
controller->view->GetEngine()
|
||||
->window_proc_delegate_manager()
|
||||
->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
|
||||
if (delegate_result) {
|
||||
*result = *delegate_result;
|
||||
}
|
||||
return delegate_result.has_value();
|
||||
}
|
||||
|
||||
FlutterDesktopEngineRef FlutterDesktopEngineCreate(
|
||||
const FlutterDesktopEngineProperties* engine_properties) {
|
||||
flutter::FlutterProjectBundle project(*engine_properties);
|
||||
@@ -103,6 +147,10 @@ bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine,
|
||||
return EngineFromHandle(engine)->RunWithEntrypoint(entry_point);
|
||||
}
|
||||
|
||||
uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
|
||||
return std::chrono::nanoseconds::max().count();
|
||||
}
|
||||
|
||||
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine) {
|
||||
EngineFromHandle(engine)->ReloadSystemFonts();
|
||||
}
|
||||
@@ -137,6 +185,29 @@ FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(
|
||||
return HandleForView(registrar->engine->view());
|
||||
}
|
||||
|
||||
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate,
|
||||
void* user_data) {
|
||||
registrar->engine->window_proc_delegate_manager()
|
||||
->RegisterTopLevelWindowProcDelegate(delegate, user_data);
|
||||
}
|
||||
|
||||
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate) {
|
||||
registrar->engine->window_proc_delegate_manager()
|
||||
->UnregisterTopLevelWindowProcDelegate(delegate);
|
||||
}
|
||||
|
||||
UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
|
||||
return flutter::GetDpiForHWND(hwnd);
|
||||
}
|
||||
|
||||
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
|
||||
return flutter::GetDpiForMonitor(monitor);
|
||||
}
|
||||
|
||||
void FlutterDesktopResyncOutputStreams() {
|
||||
FILE* unused;
|
||||
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -11,13 +13,11 @@
|
||||
#include "flutter/fml/platform/win/wstring_conversion.h"
|
||||
#include "flutter/shell/platform/common/client_wrapper/binary_messenger_impl.h"
|
||||
#include "flutter/shell/platform/common/path_utils.h"
|
||||
#include "flutter/shell/platform/windows/accessibility_bridge_delegate_windows.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_view.h"
|
||||
#include "flutter/shell/platform/windows/system_utils.h"
|
||||
#include "flutter/shell/platform/windows/task_runner.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
#include "flutter/shell/platform/windows/accessibility_bridge_delegate_win32.h"
|
||||
|
||||
// winbase.h defines GetCurrentTime as a macro.
|
||||
#undef GetCurrentTime
|
||||
|
||||
@@ -182,8 +182,7 @@ FlutterWindowsEngine::FlutterWindowsEngine(const FlutterProjectBundle& project)
|
||||
texture_registrar_ =
|
||||
std::make_unique<FlutterWindowsTextureRegistrar>(this, gl_procs_);
|
||||
surface_manager_ = AngleSurfaceManager::Create();
|
||||
window_proc_delegate_manager_ =
|
||||
std::make_unique<WindowProcDelegateManagerWin32>();
|
||||
window_proc_delegate_manager_ = std::make_unique<WindowProcDelegateManager>();
|
||||
|
||||
// Set up internal channels.
|
||||
// TODO: Replace this with an embedder.h API. See
|
||||
@@ -523,8 +522,6 @@ bool FlutterWindowsEngine::DispatchSemanticsAction(
|
||||
}
|
||||
|
||||
void FlutterWindowsEngine::UpdateSemanticsEnabled(bool enabled) {
|
||||
using AccessibilityBridgeDelegateWindows = AccessibilityBridgeDelegateWin32;
|
||||
|
||||
if (engine_ && semantics_enabled_ != enabled) {
|
||||
semantics_enabled_ = enabled;
|
||||
embedder_api_.UpdateSemanticsEnabled(engine_, enabled);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "flutter/shell/platform/windows/public/flutter_windows.h"
|
||||
#include "flutter/shell/platform/windows/settings_plugin.h"
|
||||
#include "flutter/shell/platform/windows/task_runner.h"
|
||||
#include "flutter/shell/platform/windows/window_proc_delegate_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/window_proc_delegate_manager.h"
|
||||
#include "flutter/shell/platform/windows/window_state.h"
|
||||
#include "third_party/rapidjson/include/rapidjson/document.h"
|
||||
|
||||
@@ -124,7 +124,7 @@ class FlutterWindowsEngine {
|
||||
return accessibility_bridge_;
|
||||
}
|
||||
|
||||
WindowProcDelegateManagerWin32* window_proc_delegate_manager() {
|
||||
WindowProcDelegateManager* window_proc_delegate_manager() {
|
||||
return window_proc_delegate_manager_.get();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ class FlutterWindowsEngine {
|
||||
std::shared_ptr<AccessibilityBridge> accessibility_bridge_;
|
||||
|
||||
// The manager for WindowProc delegate registration and callbacks.
|
||||
std::unique_ptr<WindowProcDelegateManagerWin32> window_proc_delegate_manager_;
|
||||
std::unique_ptr<WindowProcDelegateManager> window_proc_delegate_manager_;
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "flutter/shell/platform/common/json_message_codec.h"
|
||||
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
|
||||
#include "flutter/shell/platform/windows/flutter_windows_texture_registrar.h"
|
||||
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
|
||||
@@ -582,8 +582,7 @@ TEST(FlutterWindowsViewTest, WindowRepaintTests) {
|
||||
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
|
||||
EngineModifier modifier(engine.get());
|
||||
|
||||
FlutterWindowsView view(
|
||||
std::make_unique<flutter::FlutterWindowWin32>(100, 100));
|
||||
FlutterWindowsView view(std::make_unique<flutter::FlutterWindow>(100, 100));
|
||||
view.SetEngine(std::move(engine));
|
||||
view.CreateRenderSurface();
|
||||
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// 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/public/flutter_windows.h"
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "flutter/shell/platform/windows/dpi_utils_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window_win32.h"
|
||||
|
||||
// Returns the engine corresponding to the given opaque API handle.
|
||||
static flutter::FlutterWindowsEngine* EngineFromHandle(
|
||||
FlutterDesktopEngineRef ref) {
|
||||
return reinterpret_cast<flutter::FlutterWindowsEngine*>(ref);
|
||||
}
|
||||
|
||||
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(
|
||||
int width,
|
||||
int height,
|
||||
FlutterDesktopEngineRef engine) {
|
||||
std::unique_ptr<flutter::WindowBindingHandler> window_wrapper =
|
||||
std::make_unique<flutter::FlutterWindowWin32>(width, height);
|
||||
|
||||
auto state = std::make_unique<FlutterDesktopViewControllerState>();
|
||||
state->view =
|
||||
std::make_unique<flutter::FlutterWindowsView>(std::move(window_wrapper));
|
||||
// Take ownership of the engine, starting it if necessary.
|
||||
state->view->SetEngine(
|
||||
std::unique_ptr<flutter::FlutterWindowsEngine>(EngineFromHandle(engine)));
|
||||
state->view->CreateRenderSurface();
|
||||
if (!state->view->GetEngine()->running()) {
|
||||
if (!state->view->GetEngine()->RunWithEntrypoint(nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Must happen after engine is running.
|
||||
state->view->SendInitialBounds();
|
||||
return state.release();
|
||||
}
|
||||
|
||||
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
|
||||
FlutterDesktopViewControllerRef controller,
|
||||
HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam,
|
||||
LRESULT* result) {
|
||||
std::optional<LRESULT> delegate_result =
|
||||
controller->view->GetEngine()
|
||||
->window_proc_delegate_manager()
|
||||
->OnTopLevelWindowProc(hwnd, message, wparam, lparam);
|
||||
if (delegate_result) {
|
||||
*result = *delegate_result;
|
||||
}
|
||||
return delegate_result.has_value();
|
||||
}
|
||||
|
||||
uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine) {
|
||||
return std::chrono::nanoseconds::max().count();
|
||||
}
|
||||
|
||||
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate,
|
||||
void* user_data) {
|
||||
registrar->engine->window_proc_delegate_manager()
|
||||
->RegisterTopLevelWindowProcDelegate(delegate, user_data);
|
||||
}
|
||||
|
||||
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopPluginRegistrarRef registrar,
|
||||
FlutterDesktopWindowProcCallback delegate) {
|
||||
registrar->engine->window_proc_delegate_manager()
|
||||
->UnregisterTopLevelWindowProcDelegate(delegate);
|
||||
}
|
||||
|
||||
UINT FlutterDesktopGetDpiForHWND(HWND hwnd) {
|
||||
return flutter::GetDpiForHWND(hwnd);
|
||||
}
|
||||
|
||||
UINT FlutterDesktopGetDpiForMonitor(HMONITOR monitor) {
|
||||
return flutter::GetDpiForMonitor(monitor);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ SettingsPluginWin32::GetPreferredBrightness() {
|
||||
|
||||
void SettingsPluginWin32::WatchPreferredBrightnessChanged() {
|
||||
preferred_brightness_changed_watcher_ =
|
||||
std::make_unique<EventWatcherWin32>([this]() {
|
||||
std::make_unique<EventWatcher>([this]() {
|
||||
task_runner_->PostTask([this]() {
|
||||
SendSettings();
|
||||
WatchPreferredBrightnessChanged();
|
||||
@@ -106,13 +106,12 @@ void SettingsPluginWin32::WatchPreferredBrightnessChanged() {
|
||||
}
|
||||
|
||||
void SettingsPluginWin32::WatchTextScaleFactorChanged() {
|
||||
text_scale_factor_changed_watcher_ =
|
||||
std::make_unique<EventWatcherWin32>([this]() {
|
||||
task_runner_->PostTask([this]() {
|
||||
SendSettings();
|
||||
WatchTextScaleFactorChanged();
|
||||
});
|
||||
});
|
||||
text_scale_factor_changed_watcher_ = std::make_unique<EventWatcher>([this]() {
|
||||
task_runner_->PostTask([this]() {
|
||||
SendSettings();
|
||||
WatchTextScaleFactorChanged();
|
||||
});
|
||||
});
|
||||
|
||||
RegNotifyChangeKeyValue(
|
||||
text_scale_factor_reg_hkey_, FALSE, REG_NOTIFY_CHANGE_LAST_SET,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include "flutter/shell/platform/windows/event_watcher_win32.h"
|
||||
#include "flutter/shell/platform/windows/event_watcher.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
@@ -44,8 +44,8 @@ class SettingsPluginWin32 : public SettingsPlugin {
|
||||
HKEY preferred_brightness_reg_hkey_ = nullptr;
|
||||
HKEY text_scale_factor_reg_hkey_ = nullptr;
|
||||
|
||||
std::unique_ptr<EventWatcherWin32> preferred_brightness_changed_watcher_;
|
||||
std::unique_ptr<EventWatcherWin32> text_scale_factor_changed_watcher_;
|
||||
std::unique_ptr<EventWatcher> preferred_brightness_changed_watcher_;
|
||||
std::unique_ptr<EventWatcher> text_scale_factor_changed_watcher_;
|
||||
|
||||
SettingsPluginWin32(const SettingsPluginWin32&) = delete;
|
||||
SettingsPluginWin32& operator=(const SettingsPluginWin32&) = delete;
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// 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/testing/flutter_window_win32_test.h"
|
||||
#include "flutter/shell/platform/windows/testing/flutter_window_test.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
FlutterWindowWin32Test::FlutterWindowWin32Test(int width, int height)
|
||||
: FlutterWindowWin32(width, height){};
|
||||
FlutterWindowTest::FlutterWindowTest(int width, int height)
|
||||
: FlutterWindow(width, height){};
|
||||
|
||||
FlutterWindowWin32Test::~FlutterWindowWin32Test() = default;
|
||||
FlutterWindowTest::~FlutterWindowTest() = default;
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -5,20 +5,20 @@
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_WIN32_FLUTTER_WINDOW_TEST_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_WIN32_FLUTTER_WINDOW_TEST_H_
|
||||
|
||||
#include "flutter/shell/platform/windows/flutter_window_win32.h"
|
||||
#include "flutter/shell/platform/windows/flutter_window.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
/// Test class for FlutterWindowWin32.
|
||||
class FlutterWindowWin32Test : public FlutterWindowWin32 {
|
||||
/// Test class for FlutterWindow.
|
||||
class FlutterWindowTest : public FlutterWindow {
|
||||
public:
|
||||
FlutterWindowWin32Test(int width, int height);
|
||||
virtual ~FlutterWindowWin32Test();
|
||||
FlutterWindowTest(int width, int height);
|
||||
virtual ~FlutterWindowTest();
|
||||
|
||||
// Prevent copying.
|
||||
FlutterWindowWin32Test(FlutterWindowWin32Test const&) = delete;
|
||||
FlutterWindowWin32Test& operator=(FlutterWindowWin32Test const&) = delete;
|
||||
FlutterWindowTest(FlutterWindowTest const&) = delete;
|
||||
FlutterWindowTest& operator=(FlutterWindowTest const&) = delete;
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
@@ -2,15 +2,14 @@
|
||||
// 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/testing/mock_text_input_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/testing/mock_text_input_manager.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
MockTextInputManagerWin32::MockTextInputManagerWin32()
|
||||
: TextInputManagerWin32(){};
|
||||
MockTextInputManager::MockTextInputManager() : TextInputManager(){};
|
||||
|
||||
MockTextInputManagerWin32::~MockTextInputManagerWin32() = default;
|
||||
MockTextInputManager::~MockTextInputManager() = default;
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -9,22 +9,21 @@
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
|
||||
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
/// Mock for the |Window| base class.
|
||||
class MockTextInputManagerWin32 : public TextInputManagerWin32 {
|
||||
class MockTextInputManager : public TextInputManager {
|
||||
public:
|
||||
MockTextInputManagerWin32();
|
||||
virtual ~MockTextInputManagerWin32();
|
||||
MockTextInputManager();
|
||||
virtual ~MockTextInputManager();
|
||||
|
||||
// Prevent copying.
|
||||
MockTextInputManagerWin32(MockTextInputManagerWin32 const&) = delete;
|
||||
MockTextInputManagerWin32& operator=(MockTextInputManagerWin32 const&) =
|
||||
delete;
|
||||
MockTextInputManager(MockTextInputManager const&) = delete;
|
||||
MockTextInputManager& operator=(MockTextInputManager const&) = delete;
|
||||
|
||||
MOCK_CONST_METHOD0(GetComposingString, std::optional<std::u16string>());
|
||||
MOCK_CONST_METHOD0(GetResultString, std::optional<std::u16string>());
|
||||
@@ -7,8 +7,7 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
MockWindow::MockWindow() : Window(){};
|
||||
MockWindow::MockWindow(
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager)
|
||||
MockWindow::MockWindow(std::unique_ptr<TextInputManager> text_input_manager)
|
||||
: Window(std::move(text_input_manager)){};
|
||||
|
||||
MockWindow::~MockWindow() = default;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace testing {
|
||||
class MockWindow : public Window {
|
||||
public:
|
||||
MockWindow();
|
||||
MockWindow(std::unique_ptr<TextInputManagerWin32> text_input_manager);
|
||||
MockWindow(std::unique_ptr<TextInputManager> text_input_manager);
|
||||
virtual ~MockWindow();
|
||||
|
||||
// Prevent copying.
|
||||
|
||||
@@ -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_win32.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager.h"
|
||||
|
||||
#include <imm.h>
|
||||
|
||||
@@ -48,11 +48,11 @@ class ImmContext {
|
||||
HIMC context_;
|
||||
};
|
||||
|
||||
void TextInputManagerWin32::SetWindowHandle(HWND window_handle) {
|
||||
void TextInputManager::SetWindowHandle(HWND window_handle) {
|
||||
window_handle_ = window_handle;
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::CreateImeWindow() {
|
||||
void TextInputManager::CreateImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void TextInputManagerWin32::CreateImeWindow() {
|
||||
UpdateImeWindow();
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::DestroyImeWindow() {
|
||||
void TextInputManager::DestroyImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void TextInputManagerWin32::DestroyImeWindow() {
|
||||
ime_active_ = false;
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::UpdateImeWindow() {
|
||||
void TextInputManager::UpdateImeWindow() {
|
||||
if (window_handle_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ void TextInputManagerWin32::UpdateImeWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::UpdateCaretRect(const Rect& rect) {
|
||||
void TextInputManager::UpdateCaretRect(const Rect& rect) {
|
||||
caret_rect_ = rect;
|
||||
|
||||
if (window_handle_ == nullptr) {
|
||||
@@ -105,7 +105,7 @@ void TextInputManagerWin32::UpdateCaretRect(const Rect& rect) {
|
||||
}
|
||||
}
|
||||
|
||||
long TextInputManagerWin32::GetComposingCursorPosition() const {
|
||||
long TextInputManager::GetComposingCursorPosition() const {
|
||||
if (window_handle_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -119,16 +119,15 @@ long TextInputManagerWin32::GetComposingCursorPosition() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetComposingString()
|
||||
const {
|
||||
std::optional<std::u16string> TextInputManager::GetComposingString() const {
|
||||
return GetString(GCS_COMPSTR);
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetResultString() const {
|
||||
std::optional<std::u16string> TextInputManager::GetResultString() const {
|
||||
return GetString(GCS_RESULTSTR);
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::AbortComposing() {
|
||||
void TextInputManager::AbortComposing() {
|
||||
if (window_handle_ == nullptr || !ime_active_) {
|
||||
return;
|
||||
}
|
||||
@@ -147,7 +146,7 @@ void TextInputManagerWin32::AbortComposing() {
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::u16string> TextInputManagerWin32::GetString(int type) const {
|
||||
std::optional<std::u16string> TextInputManager::GetString(int type) const {
|
||||
if (window_handle_ == nullptr || !ime_active_) {
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -168,7 +167,7 @@ std::optional<std::u16string> TextInputManagerWin32::GetString(int type) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TextInputManagerWin32::MoveImeWindow(HIMC imm_context) {
|
||||
void TextInputManager::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 TextInputManagerWin32 {
|
||||
class TextInputManager {
|
||||
public:
|
||||
TextInputManagerWin32() noexcept = default;
|
||||
virtual ~TextInputManagerWin32() = default;
|
||||
TextInputManager() noexcept = default;
|
||||
virtual ~TextInputManager() = default;
|
||||
|
||||
TextInputManagerWin32(const TextInputManagerWin32&) = delete;
|
||||
TextInputManagerWin32& operator=(const TextInputManagerWin32&) = delete;
|
||||
TextInputManager(const TextInputManager&) = delete;
|
||||
TextInputManager& operator=(const TextInputManager&) = delete;
|
||||
|
||||
// Sets the window handle with which the IME is associated.
|
||||
void SetWindowHandle(HWND window_handle);
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "dpi_utils_win32.h"
|
||||
#include "dpi_utils.h"
|
||||
#include "keyboard_win32_common.h"
|
||||
|
||||
namespace flutter {
|
||||
@@ -55,7 +55,7 @@ static const int kLinesPerScrollWindowsDefault = 3;
|
||||
|
||||
Window::Window() : Window(nullptr) {}
|
||||
|
||||
Window::Window(std::unique_ptr<TextInputManagerWin32> text_input_manager)
|
||||
Window::Window(std::unique_ptr<TextInputManager> text_input_manager)
|
||||
: touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId),
|
||||
text_input_manager_(std::move(text_input_manager)) {
|
||||
// Get the DPI of the primary monitor as the initial DPI. If Per-Monitor V2 is
|
||||
@@ -69,7 +69,7 @@ Window::Window(std::unique_ptr<TextInputManagerWin32> text_input_manager)
|
||||
UpdateScrollOffsetMultiplier();
|
||||
|
||||
if (text_input_manager_ == nullptr) {
|
||||
text_input_manager_ = std::make_unique<TextInputManagerWin32>();
|
||||
text_input_manager_ = std::make_unique<TextInputManager>();
|
||||
}
|
||||
keyboard_manager_ = std::make_unique<KeyboardManagerWin32>(this);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "flutter/shell/platform/windows/direct_manipulation.h"
|
||||
#include "flutter/shell/platform/windows/keyboard_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/sequential_id_generator.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/text_input_manager.h"
|
||||
#include "flutter/third_party/accessibility/gfx/native_widget_types.h"
|
||||
|
||||
namespace flutter {
|
||||
@@ -28,7 +28,7 @@ namespace flutter {
|
||||
class Window : public KeyboardManagerWin32::WindowDelegate {
|
||||
public:
|
||||
Window();
|
||||
Window(std::unique_ptr<TextInputManagerWin32> text_input_manager);
|
||||
Window(std::unique_ptr<TextInputManager> text_input_manager);
|
||||
virtual ~Window();
|
||||
|
||||
// Initializes as a child window with size using |width| and |height| and
|
||||
@@ -267,7 +267,7 @@ class Window : public KeyboardManagerWin32::WindowDelegate {
|
||||
double mouse_y_ = 0;
|
||||
|
||||
// Manages IME state.
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_;
|
||||
std::unique_ptr<TextInputManager> text_input_manager_;
|
||||
|
||||
// Manages IME state.
|
||||
std::unique_ptr<KeyboardManagerWin32> keyboard_manager_;
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
// 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/window_proc_delegate_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/window_proc_delegate_manager.h"
|
||||
|
||||
#include "flutter/shell/platform/embedder/embedder.h"
|
||||
|
||||
namespace flutter {
|
||||
|
||||
WindowProcDelegateManagerWin32::WindowProcDelegateManagerWin32() = default;
|
||||
WindowProcDelegateManagerWin32::~WindowProcDelegateManagerWin32() = default;
|
||||
WindowProcDelegateManager::WindowProcDelegateManager() = default;
|
||||
WindowProcDelegateManager::~WindowProcDelegateManager() = default;
|
||||
|
||||
void WindowProcDelegateManagerWin32::RegisterTopLevelWindowProcDelegate(
|
||||
void WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopWindowProcCallback delegate,
|
||||
void* user_data) {
|
||||
top_level_window_proc_handlers_[delegate] = user_data;
|
||||
}
|
||||
|
||||
void WindowProcDelegateManagerWin32::UnregisterTopLevelWindowProcDelegate(
|
||||
void WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate(
|
||||
FlutterDesktopWindowProcCallback delegate) {
|
||||
top_level_window_proc_handlers_.erase(delegate);
|
||||
}
|
||||
|
||||
std::optional<LRESULT> WindowProcDelegateManagerWin32::OnTopLevelWindowProc(
|
||||
std::optional<LRESULT> WindowProcDelegateManager::OnTopLevelWindowProc(
|
||||
HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
@@ -16,16 +16,15 @@ namespace flutter {
|
||||
|
||||
// Handles registration, unregistration, and dispatching for WindowProc
|
||||
// delegation.
|
||||
class WindowProcDelegateManagerWin32 {
|
||||
class WindowProcDelegateManager {
|
||||
public:
|
||||
explicit WindowProcDelegateManagerWin32();
|
||||
~WindowProcDelegateManagerWin32();
|
||||
explicit WindowProcDelegateManager();
|
||||
~WindowProcDelegateManager();
|
||||
|
||||
// Prevent copying.
|
||||
WindowProcDelegateManagerWin32(WindowProcDelegateManagerWin32 const&) =
|
||||
WindowProcDelegateManager(WindowProcDelegateManager const&) = delete;
|
||||
WindowProcDelegateManager& operator=(WindowProcDelegateManager const&) =
|
||||
delete;
|
||||
WindowProcDelegateManagerWin32& operator=(
|
||||
WindowProcDelegateManagerWin32 const&) = delete;
|
||||
|
||||
// Adds |delegate| as a delegate to be called for |OnTopLevelWindowProc|.
|
||||
//
|
||||
@@ -2,7 +2,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/window_proc_delegate_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/window_proc_delegate_manager.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
@@ -44,8 +44,8 @@ bool TestWindowProcCallback2(HWND hwnd,
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(WindowProcDelegateManagerWin32Test, CallsCorrectly) {
|
||||
WindowProcDelegateManagerWin32 manager;
|
||||
TEST(WindowProcDelegateManagerTest, CallsCorrectly) {
|
||||
WindowProcDelegateManager manager;
|
||||
HWND dummy_hwnd;
|
||||
|
||||
bool called = false;
|
||||
@@ -66,8 +66,8 @@ TEST(WindowProcDelegateManagerWin32Test, CallsCorrectly) {
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
TEST(WindowProcDelegateManagerWin32Test, ReplacementRegister) {
|
||||
WindowProcDelegateManagerWin32 manager;
|
||||
TEST(WindowProcDelegateManagerTest, ReplacementRegister) {
|
||||
WindowProcDelegateManager manager;
|
||||
|
||||
bool called_a = false;
|
||||
TestWindowProcDelegate delegate_a =
|
||||
@@ -92,8 +92,8 @@ TEST(WindowProcDelegateManagerWin32Test, ReplacementRegister) {
|
||||
EXPECT_TRUE(called_b);
|
||||
}
|
||||
|
||||
TEST(WindowProcDelegateManagerWin32Test, RegisterMultiple) {
|
||||
WindowProcDelegateManagerWin32 manager;
|
||||
TEST(WindowProcDelegateManagerTest, RegisterMultiple) {
|
||||
WindowProcDelegateManager manager;
|
||||
|
||||
bool called_a = false;
|
||||
TestWindowProcDelegate delegate_a =
|
||||
@@ -118,8 +118,8 @@ TEST(WindowProcDelegateManagerWin32Test, RegisterMultiple) {
|
||||
EXPECT_TRUE(called_b);
|
||||
}
|
||||
|
||||
TEST(WindowProcDelegateManagerWin32Test, ConflictingDelegates) {
|
||||
WindowProcDelegateManagerWin32 manager;
|
||||
TEST(WindowProcDelegateManagerTest, ConflictingDelegates) {
|
||||
WindowProcDelegateManager manager;
|
||||
|
||||
bool called_a = false;
|
||||
TestWindowProcDelegate delegate_a =
|
||||
@@ -147,8 +147,8 @@ TEST(WindowProcDelegateManagerWin32Test, ConflictingDelegates) {
|
||||
EXPECT_NE(called_a, called_b);
|
||||
}
|
||||
|
||||
TEST(WindowProcDelegateManagerWin32Test, Unregister) {
|
||||
WindowProcDelegateManagerWin32 manager;
|
||||
TEST(WindowProcDelegateManagerTest, Unregister) {
|
||||
WindowProcDelegateManager manager;
|
||||
|
||||
bool called = false;
|
||||
TestWindowProcDelegate delegate = [&called](HWND hwnd, UINT message,
|
||||
@@ -2,7 +2,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/testing/mock_text_input_manager_win32.h"
|
||||
#include "flutter/shell/platform/windows/testing/mock_text_input_manager.h"
|
||||
#include "flutter/shell/platform/windows/testing/mock_window.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -37,10 +37,8 @@ TEST(MockWindow, VerticalScroll) {
|
||||
}
|
||||
|
||||
TEST(MockWindow, OnImeCompositionCompose) {
|
||||
MockTextInputManagerWin32* text_input_manager =
|
||||
new MockTextInputManagerWin32();
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_ptr(
|
||||
text_input_manager);
|
||||
MockTextInputManager* text_input_manager = new MockTextInputManager();
|
||||
std::unique_ptr<TextInputManager> text_input_manager_ptr(text_input_manager);
|
||||
MockWindow window(std::move(text_input_manager_ptr));
|
||||
EXPECT_CALL(*text_input_manager, GetComposingString())
|
||||
.WillRepeatedly(
|
||||
@@ -63,10 +61,8 @@ TEST(MockWindow, OnImeCompositionCompose) {
|
||||
}
|
||||
|
||||
TEST(MockWindow, OnImeCompositionResult) {
|
||||
MockTextInputManagerWin32* text_input_manager =
|
||||
new MockTextInputManagerWin32();
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_ptr(
|
||||
text_input_manager);
|
||||
MockTextInputManager* text_input_manager = new MockTextInputManager();
|
||||
std::unique_ptr<TextInputManager> text_input_manager_ptr(text_input_manager);
|
||||
MockWindow window(std::move(text_input_manager_ptr));
|
||||
EXPECT_CALL(*text_input_manager, GetComposingString())
|
||||
.WillRepeatedly(
|
||||
@@ -89,10 +85,8 @@ TEST(MockWindow, OnImeCompositionResult) {
|
||||
}
|
||||
|
||||
TEST(MockWindow, OnImeCompositionResultAndCompose) {
|
||||
MockTextInputManagerWin32* text_input_manager =
|
||||
new MockTextInputManagerWin32();
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_ptr(
|
||||
text_input_manager);
|
||||
MockTextInputManager* text_input_manager = new MockTextInputManager();
|
||||
std::unique_ptr<TextInputManager> text_input_manager_ptr(text_input_manager);
|
||||
MockWindow window(std::move(text_input_manager_ptr));
|
||||
|
||||
// This situation is that Google Japanese Input finished composing "今日" in
|
||||
@@ -127,10 +121,8 @@ TEST(MockWindow, OnImeCompositionResultAndCompose) {
|
||||
}
|
||||
|
||||
TEST(MockWindow, OnImeCompositionClearChange) {
|
||||
MockTextInputManagerWin32* text_input_manager =
|
||||
new MockTextInputManagerWin32();
|
||||
std::unique_ptr<TextInputManagerWin32> text_input_manager_ptr(
|
||||
text_input_manager);
|
||||
MockTextInputManager* text_input_manager = new MockTextInputManager();
|
||||
std::unique_ptr<TextInputManager> text_input_manager_ptr(text_input_manager);
|
||||
MockWindow window(std::move(text_input_manager_ptr));
|
||||
EXPECT_CALL(window, OnComposeChange(std::u16string(u""), 0)).Times(1);
|
||||
EXPECT_CALL(window, OnComposeCommit()).Times(1);
|
||||
|
||||
Reference in New Issue
Block a user