Skip to content

Commit aebc548

Browse files
committed
Attempt flutter#1 to fix CI failures
1 parent edf141f commit aebc548

15 files changed

+56
-22
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,9 @@ FILE: ../../../flutter/shell/platform/windows/client_wrapper/include/flutter/plu
16991699
FILE: ../../../flutter/shell/platform/windows/client_wrapper/plugin_registrar_windows_unittests.cc
17001700
FILE: ../../../flutter/shell/platform/windows/cursor_handler.cc
17011701
FILE: ../../../flutter/shell/platform/windows/cursor_handler.h
1702+
FILE: ../../../flutter/shell/platform/windows/direct_manipulation.cc
1703+
FILE: ../../../flutter/shell/platform/windows/direct_manipulation.h
1704+
FILE: ../../../flutter/shell/platform/windows/direct_manipulation_unittests.cc
17021705
FILE: ../../../flutter/shell/platform/windows/display_helper_winuwp.cc
17031706
FILE: ../../../flutter/shell/platform/windows/display_helper_winuwp.h
17041707
FILE: ../../../flutter/shell/platform/windows/dpi_utils_win32.cc

lib/web_ui/lib/src/engine/pointer_converter.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,11 @@ class PointerDataConverter {
613613
);
614614
_pointers.remove(device);
615615
break;
616+
case ui.PointerChange.flowStart:
617+
case ui.PointerChange.flowUpdate:
618+
case ui.PointerChange.flowEnd:
619+
// Pointer flow events are not gemerated on web
620+
break;
616621
}
617622
} else {
618623
switch (signalKind) {

shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ - (void)surfaceUpdated:(BOOL)appeared;
121121
- (void)performOrientationUpdate:(UIInterfaceOrientationMask)new_preferences;
122122
- (void)handlePressEvent:(FlutterUIPressProxy*)press
123123
nextAction:(void (^)())next API_AVAILABLE(ios(13.4));
124-
- (void)scrollEvent:(UIPanGestureRecognizer*)recognizer;
124+
- (void)panEvent:(UIPanGestureRecognizer*)recognizer;
125125
- (void)updateViewportMetrics;
126126
- (void)onUserSettingsChanged:(NSNotification*)notification;
127127
@end
@@ -922,7 +922,7 @@ - (void)testMouseSupport API_AVAILABLE(ios(13.4)) {
922922
id mockPanGestureRecognizer = OCMClassMock([UIPanGestureRecognizer class]);
923923
XCTAssertNotNil(mockPanGestureRecognizer);
924924

925-
[vc scrollEvent:mockPanGestureRecognizer];
925+
[vc panEvent:mockPanGestureRecognizer];
926926

927927
[[[self.mockEngine verify] ignoringNonObjectArgs]
928928
dispatchPointerDataPacket:std::make_unique<flutter::PointerDataPacket>()];

shell/platform/fuchsia/flutter/platform_view.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ bool PlatformView::OnHandlePointerEvent(
378378
FML_DLOG(ERROR) << "Received hover event for down pointer.";
379379
}
380380
break;
381+
case flutter::PointerData::Change::kFlowStart:
382+
case flutter::PointerData::Change::kFlowUpdate:
383+
case flutter::PointerData::Change::kFlowEnd:
384+
FML_DLOG(ERROR) << "Unexpectedly received pointer flow event";
385+
break;
381386
}
382387

383388
auto packet = std::make_unique<flutter::PointerDataPacket>(1);

shell/platform/windows/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ source_set("uwptool_utils") {
338338
"uwptool_utils.h",
339339
]
340340

341+
defines = [ "_SILENCE_CLANG_COROUTINE_MESSAGE" ]
342+
341343
deps = [ ":string_conversion" ]
342344

343345
defines = [ "_SILENCE_CLANG_COROUTINE_MESSAGE" ]
@@ -356,6 +358,8 @@ executable("uwptool") {
356358
]
357359
}
358360

361+
defines = [ "_SILENCE_CLANG_COROUTINE_MESSAGE" ]
362+
359363
sources = [ "uwptool_main.cc" ]
360364
deps = [
361365
":string_conversion",

shell/platform/windows/direct_manipulation.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ DirectManipulationOwner::DirectManipulationOwner(WindowWin32* window)
119119
int DirectManipulationOwner::Init(unsigned int width, unsigned int height) {
120120
HRESULT hr = CoCreateInstance(
121121
CLSID_DirectManipulationManager, nullptr, CLSCTX_INPROC_SERVER,
122-
IID_IDirectManipulationManager, manager_.put_void());
122+
IID_IDirectManipulationManager, &manager_);
123123
if (FAILED(hr)) {
124124
FML_LOG(ERROR)
125125
<< "CoCreateInstance(CLSID_DirectManipulationManager) failed";
@@ -128,7 +128,7 @@ int DirectManipulationOwner::Init(unsigned int width, unsigned int height) {
128128
}
129129

130130
hr = manager_->GetUpdateManager(IID_IDirectManipulationUpdateManager,
131-
updateManager_.put_void());
131+
&updateManager_);
132132
if (FAILED(hr)) {
133133
FML_LOG(ERROR) << "GetUpdateManager failed";
134134
manager_ = nullptr;
@@ -138,7 +138,7 @@ int DirectManipulationOwner::Init(unsigned int width, unsigned int height) {
138138

139139
hr = manager_->CreateViewport(nullptr, window_->GetWindowHandle(),
140140
IID_IDirectManipulationViewport,
141-
viewport_.put_void());
141+
&viewport_);
142142
if (FAILED(hr)) {
143143
FML_LOG(ERROR) << "CreateViewport failed";
144144
manager_ = nullptr;

shell/platform/windows/direct_manipulation.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "flutter/fml/memory/ref_counted.h"
99

10-
#include <winrt/base.h>
10+
#include <wrl/client.h>
1111
#include "directmanipulation.h"
1212

1313
namespace flutter {
@@ -32,9 +32,9 @@ class DirectManipulationOwner {
3232
private:
3333
WindowWin32* window_;
3434
DWORD viewportHandlerCookie_;
35-
winrt::com_ptr<IDirectManipulationManager> manager_;
36-
winrt::com_ptr<IDirectManipulationUpdateManager> updateManager_;
37-
winrt::com_ptr<IDirectManipulationViewport> viewport_;
35+
Microsoft::WRL::ComPtr<IDirectManipulationManager> manager_;
36+
Microsoft::WRL::ComPtr<IDirectManipulationUpdateManager> updateManager_;
37+
Microsoft::WRL::ComPtr<IDirectManipulationViewport> viewport_;
3838
fml::RefPtr<DirectManipulationEventHandler> handler_;
3939
};
4040

shell/platform/windows/flutter_window_win32.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,11 @@ bool FlutterWindowWin32::OnBitmapSurfaceUpdated(const void* allocation,
259259
return ret != 0;
260260
}
261261

262+
PointerLocation FlutterWindowWin32::GetPrimaryPointerLocation() {
263+
POINT point;
264+
GetCursorPos(&point);
265+
ScreenToClient(GetWindowHandle(), &point);
266+
return {(size_t)point.x, (size_t)point.y};
267+
}
268+
262269
} // namespace flutter

shell/platform/windows/flutter_window_win32.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ class FlutterWindowWin32 : public WindowWin32, public WindowBindingHandler {
130130
size_t row_bytes,
131131
size_t height) override;
132132

133+
PointerLocation GetPrimaryPointerLocation() override;
134+
133135
private:
134136
// A pointer to a FlutterWindowsView that can be used to update engine
135137
// windowing and input state.

shell/platform/windows/flutter_window_winuwp.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,4 +376,10 @@ bool FlutterWindowWinUWP::OnBitmapSurfaceUpdated(const void* allocation,
376376
return false;
377377
}
378378

379+
PointerLocation FlutterWindowWinUWP::GetPrimaryPointerLocation() {
380+
auto point = window_.PointerPosition();
381+
auto bounds = window_.Bounds();
382+
return {static_cast<size_t>(point.X - bounds.X), static_cast<size_t>(point.Y - bounds.Y)};
383+
}
384+
379385
} // namespace flutter

shell/platform/windows/flutter_window_winuwp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class FlutterWindowWinUWP : public WindowBindingHandler {
6666
size_t row_bytes,
6767
size_t height) override;
6868

69+
PointerLocation GetPrimaryPointerLocation() override;
70+
6971
private:
7072
// Undoes the scale transform applied by the Windows compositor in order to
7173
// render at native scale and produce smooth results on high DPI screens.

shell/platform/windows/flutter_windows_view.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void FlutterWindowsView::OnPointerLeave(FlutterPointerDeviceKind device_kind,
204204
}
205205

206206
void FlutterWindowsView::OnPointerFlowStart(int32_t device_id) {
207-
POINT point = GetCursorPosition();
207+
PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
208208
SendPointerFlowStart(device_id, point.x, point.y);
209209
}
210210

@@ -213,13 +213,13 @@ void FlutterWindowsView::OnPointerFlowUpdate(int32_t device_id,
213213
double pan_y,
214214
double scale,
215215
double angle) {
216-
POINT point = GetCursorPosition();
216+
PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
217217
SendPointerFlowUpdate(device_id, point.x, point.y, pan_x, pan_y, scale,
218218
angle);
219219
}
220220

221221
void FlutterWindowsView::OnPointerFlowEnd(int32_t device_id) {
222-
POINT point = GetCursorPosition();
222+
PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
223223
SendPointerFlowEnd(device_id, point.x, point.y);
224224
}
225225

@@ -636,11 +636,4 @@ FlutterWindowsEngine* FlutterWindowsView::GetEngine() {
636636
return engine_.get();
637637
}
638638

639-
POINT FlutterWindowsView::GetCursorPosition() {
640-
POINT point;
641-
GetCursorPos(&point);
642-
ScreenToClient(std::get<0>(*GetRenderTarget()), &point);
643-
return point;
644-
}
645-
646639
} // namespace flutter

shell/platform/windows/flutter_windows_view.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ class FlutterWindowsView : public WindowBindingHandlerDelegate,
332332
// Reports platform brightness change to Flutter engine.
333333
void SendPlatformBrightnessChanged();
334334

335-
// Gets the current cursor position to set on trackpad gesture events
336-
POINT GetCursorPosition();
337-
338335
// Currently configured WindowsRenderTarget for this view used by
339336
// surface_manager for creation of render surfaces and bound to the physical
340337
// os window.

shell/platform/windows/testing/mock_window_binding_handler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class MockWindowBindingHandler : public WindowBindingHandler {
3535
MOCK_METHOD0(OnResetImeComposing, void());
3636
MOCK_METHOD3(OnBitmapSurfaceUpdated,
3737
bool(const void* allocation, size_t row_bytes, size_t height));
38+
MOCK_METHOD0(GetPrimaryPointerLocation, PointerLocation());
3839
};
3940

4041
} // namespace testing

shell/platform/windows/window_binding_handler.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ struct PhysicalWindowBounds {
2929
size_t height;
3030
};
3131

32+
// Structure containing the position of a mouse pointer
33+
struct PointerLocation {
34+
size_t x;
35+
size_t y;
36+
};
37+
3238
// Type representing an underlying platform window.
3339
#ifdef WINUWP
3440
using PlatformWindow =
@@ -95,6 +101,9 @@ class WindowBindingHandler {
95101
// Invoked when the app ends IME composing, such when the active text input
96102
// client is cleared.
97103
virtual void OnResetImeComposing() = 0;
104+
105+
// Returns the last known position of the primary pointer
106+
virtual PointerLocation GetPrimaryPointerLocation() = 0;
98107
};
99108

100109
} // namespace flutter

0 commit comments

Comments
 (0)