From 0a9d735901a91f7bc00d67840434cfcf43a6e846 Mon Sep 17 00:00:00 2001 From: Hasan Mohsin Date: Sun, 14 Jan 2024 14:23:05 +0000 Subject: [PATCH 1/2] Set cursor immediately when framework requests update --- shell/platform/windows/flutter_window.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/windows/flutter_window.cc b/shell/platform/windows/flutter_window.cc index 2558d4fc5864a..b43bb3bbcc1e3 100644 --- a/shell/platform/windows/flutter_window.cc +++ b/shell/platform/windows/flutter_window.cc @@ -177,7 +177,7 @@ PhysicalWindowBounds FlutterWindow::GetPhysicalWindowBounds() { } void FlutterWindow::UpdateFlutterCursor(const std::string& cursor_name) { - current_cursor_ = GetCursorByName(cursor_name); + SetFlutterCursor(GetCursorByName(cursor_name)); } void FlutterWindow::SetFlutterCursor(HCURSOR cursor) { From ed95675021461b714d6b8f5f4217aa8c75f83753 Mon Sep 17 00:00:00 2001 From: Hasan Mohsin Date: Wed, 24 Jan 2024 21:10:45 +0000 Subject: [PATCH 2/2] Add test for updating cursor --- shell/platform/windows/flutter_window_unittests.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/platform/windows/flutter_window_unittests.cc b/shell/platform/windows/flutter_window_unittests.cc index c920f5a97ef60..7dd69e42829e8 100644 --- a/shell/platform/windows/flutter_window_unittests.cc +++ b/shell/platform/windows/flutter_window_unittests.cc @@ -436,5 +436,12 @@ TEST(FlutterWindowTest, PosthumousWindowMessage) { EXPECT_GE(msg_count, 1); } +TEST(FlutterWindowTest, UpdateCursor) { + FlutterWindow win32window(100, 100); + win32window.UpdateFlutterCursor("text"); + HCURSOR cursor = ::GetCursor(); + EXPECT_EQ(cursor, ::LoadCursor(nullptr, IDC_IBEAM)); +} + } // namespace testing } // namespace flutter