Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions shell/platform/windows/flutter_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ void FlutterWindow::SetFlutterCursor(HCURSOR cursor) {
::SetCursor(current_cursor_);
}

void FlutterWindow::OnWindowResized() {
// Blocking the raster thread until DWM flushes alleviates glitches where
// previous size surface is stretched over current size view.
DwmFlush();
}

void FlutterWindow::OnDpiScale(unsigned int dpi) {};

// When DesktopWindow notifies that a WM_Size message has come in
Expand Down
3 changes: 0 additions & 3 deletions shell/platform/windows/flutter_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ class FlutterWindow : public KeyboardManager::WindowDelegate,
// |FlutterWindowBindingHandler|
virtual void SetFlutterCursor(HCURSOR cursor) override;

// |FlutterWindowBindingHandler|
virtual void OnWindowResized() override;

// |FlutterWindowBindingHandler|
virtual bool OnBitmapSurfaceCleared() override;

Expand Down
6 changes: 5 additions & 1 deletion shell/platform/windows/flutter_windows_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,11 @@ bool FlutterWindowsView::SwapBuffers() {
resize_status_ = ResizeState::kDone;
lock.unlock();
resize_cv_.notify_all();
binding_handler_->OnWindowResized();

// Blocking the raster thread until DWM flushes alleviates glitches where
// previous size surface is stretched over current size view.
windows_proc_table_->DwmFlush();

if (!visible) {
swap_buffers_result = engine_->surface_manager()->SwapBuffers();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class MockWindowBindingHandler : public WindowBindingHandler {
MOCK_METHOD(HWND, GetWindowHandle, (), (override));
MOCK_METHOD(float, GetDpiScale, (), (override));
MOCK_METHOD(bool, IsVisible, (), (override));
MOCK_METHOD(void, OnWindowResized, (), (override));
MOCK_METHOD(PhysicalWindowBounds, GetPhysicalWindowBounds, (), (override));
MOCK_METHOD(void,
UpdateFlutterCursor,
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/windows/testing/mock_windows_proc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class MockWindowsProcTable : public WindowsProcTable {

MOCK_METHOD(bool, DwmIsCompositionEnabled, (), (const, override));

MOCK_METHOD(HRESULT, DwmFlush, (), (const, override));

private:
FML_DISALLOW_COPY_AND_ASSIGN(MockWindowsProcTable);
};
Expand Down
3 changes: 0 additions & 3 deletions shell/platform/windows/window_binding_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ class WindowBindingHandler {
// Returns the bounds of the backing window in physical pixels.
virtual PhysicalWindowBounds GetPhysicalWindowBounds() = 0;

// Invoked after the window has been resized.
virtual void OnWindowResized() = 0;

// Sets the cursor that should be used when the mouse is over the Flutter
// content. See mouse_cursor.dart for the values and meanings of cursor_name.
virtual void UpdateFlutterCursor(const std::string& cursor_name) = 0;
Expand Down
4 changes: 4 additions & 0 deletions shell/platform/windows/windows_proc_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ bool WindowsProcTable::DwmIsCompositionEnabled() const {
return true;
}

HRESULT WindowsProcTable::DwmFlush() const {
return ::DwmFlush();
}

} // namespace flutter
7 changes: 7 additions & 0 deletions shell/platform/windows/windows_proc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class WindowsProcTable {
// https://learn.microsoft.com/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled
virtual bool DwmIsCompositionEnabled() const;

// Issues a flush call that blocks the caller until all of the outstanding
// surface updates have been made.
//
// See:
// https://learn.microsoft.com/windows/win32/api/dwmapi/nf-dwmapi-dwmflush
virtual HRESULT DwmFlush() const;

private:
using GetPointerType_ = BOOL __stdcall(UINT32 pointerId,
POINTER_INPUT_TYPE* pointerType);
Expand Down