From b4bfa2d69b5ed076d991a72a9770dfa3ef08e690 Mon Sep 17 00:00:00 2001 From: csmartdalton Date: Fri, 11 Oct 2024 19:25:57 +0000 Subject: [PATCH] Drop the ColumnLimit to 80 for clang-format This gives better support for smaller screens and side-by-side windows. Also standardize the formatting check on GitHub on version 17. Diffs= e52e9fff29 Drop the ColumnLimit to 80 for clang-format (#8320) 52913023ba add support for listeners on layout components (#8317) 1b5e50fcec Optimize atomic rendering for input attachments (#8310) 1cc5f2b6f6 Prep for rhi (#8270) f9715435dd Nnnn fix databind state machine shared data context (#8307) 708a913eae Implement isHidden in DrawableProxy (#8302) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> --- .rive_head | 2 +- example/ios/Runner/AppDelegate.m | 3 +- example/ios/Runner/main.m | 3 +- example/windows/runner/flutter_window.cpp | 23 +++++++++----- example/windows/runner/win32_window.cpp | 38 ++++++++++++++++------- example/windows/runner/win32_window.h | 18 ++++++----- 6 files changed, 57 insertions(+), 30 deletions(-) diff --git a/.rive_head b/.rive_head index 12e1c9e..eef2092 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -eed8230f84e2894d0436dd1d94566c59f4dfcb6f +e52e9fff2973ce63a689e9d11ea283214109ca18 diff --git a/example/ios/Runner/AppDelegate.m b/example/ios/Runner/AppDelegate.m index cd106dd..bc8b730 100644 --- a/example/ios/Runner/AppDelegate.m +++ b/example/ios/Runner/AppDelegate.m @@ -8,7 +8,8 @@ { [GeneratedPluginRegistrant registerWithRegistry:self]; // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; + return [super application:application + didFinishLaunchingWithOptions:launchOptions]; } @end diff --git a/example/ios/Runner/main.m b/example/ios/Runner/main.m index d8be491..3c67dd0 100644 --- a/example/ios/Runner/main.m +++ b/example/ios/Runner/main.m @@ -6,6 +6,7 @@ int main(int argc, char* argv[]) { @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + return UIApplicationMain( + argc, argv, nil, NSStringFromClass([AppDelegate class])); } } diff --git a/example/windows/runner/flutter_window.cpp b/example/windows/runner/flutter_window.cpp index 594156d..29de545 100644 --- a/example/windows/runner/flutter_window.cpp +++ b/example/windows/runner/flutter_window.cpp @@ -4,7 +4,9 @@ #include "flutter/generated_plugin_registrant.h" -FlutterWindow::FlutterWindow(const flutter::DartProject& project) : project_(project) {} +FlutterWindow::FlutterWindow(const flutter::DartProject& project) : + project_(project) +{} FlutterWindow::~FlutterWindow() {} @@ -17,11 +19,12 @@ bool FlutterWindow::OnCreate() RECT frame = GetClientArea(); - // The size here must match the window dimensions to avoid unnecessary surface - // creation / destruction in the startup path. - flutter_controller_ = std::make_unique(frame.right - frame.left, - frame.bottom - frame.top, - project_); + // The size here must match the window dimensions to avoid unnecessary + // surface creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, + frame.bottom - frame.top, + project_); // Ensure that basic setup of the controller was successful. if (!flutter_controller_->engine() || !flutter_controller_->view()) { @@ -48,11 +51,15 @@ FlutterWindow::MessageHandler(HWND hwnd, WPARAM const wparam, LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opportunity to handle window messages. + // Give Flutter, including plugins, an opportunity to handle window + // messages. if (flutter_controller_) { std::optional result = - flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, lparam); + flutter_controller_->HandleTopLevelWindowProc(hwnd, + message, + wparam, + lparam); if (result) { return *result; diff --git a/example/windows/runner/win32_window.cpp b/example/windows/runner/win32_window.cpp index 370c53f..c4e29fc 100644 --- a/example/windows/runner/win32_window.cpp +++ b/example/windows/runner/win32_window.cpp @@ -16,7 +16,10 @@ using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); // Scale helper to convert logical scaler values to physical using passed in // scale factor -int Scale(int source, double scale_factor) { return static_cast(source * scale_factor); } +int Scale(int source, double scale_factor) +{ + return static_cast(source * scale_factor); +} // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. // This API is only needed for PerMonitor V1 awareness mode. @@ -27,8 +30,9 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd) { return; } - auto enable_non_client_dpi_scaling = reinterpret_cast( - GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); if (enable_non_client_dpi_scaling != nullptr) { enable_non_client_dpi_scaling(hwnd); @@ -83,7 +87,8 @@ const wchar_t* WindowClassRegistrar::GetWindowClass() window_class.cbClsExtra = 0; window_class.cbWndExtra = 0; window_class.hInstance = GetModuleHandle(nullptr); - window_class.hIcon = LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); window_class.hbrBackground = 0; window_class.lpszMenuName = nullptr; window_class.lpfnWndProc = Win32Window::WndProc; @@ -107,13 +112,17 @@ Win32Window::~Win32Window() Destroy(); } -bool Win32Window::CreateAndShow(const std::wstring& title, const Point& origin, const Size& size) +bool Win32Window::CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size) { Destroy(); - const wchar_t* window_class = WindowClassRegistrar::GetInstance()->GetWindowClass(); + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); - const POINT target_point = {static_cast(origin.x), static_cast(origin.y)}; + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); double scale_factor = dpi / 96.0; @@ -147,9 +156,10 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window, if (message == WM_NCCREATE) { auto window_struct = reinterpret_cast(lparam); - SetWindowLongPtr(window, - GWLP_USERDATA, - reinterpret_cast(window_struct->lpCreateParams)); + SetWindowLongPtr( + window, + GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); auto that = static_cast(window_struct->lpCreateParams); EnableFullDpiSupportIfAvailable(window); @@ -240,7 +250,8 @@ void Win32Window::Destroy() Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast(GetWindowLongPtr(window, GWLP_USERDATA)); + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); } void Win32Window::SetChildContent(HWND content) @@ -268,7 +279,10 @@ RECT Win32Window::GetClientArea() HWND Win32Window::GetHandle() { return window_handle_; } -void Win32Window::SetQuitOnClose(bool quit_on_close) { quit_on_close_ = quit_on_close; } +void Win32Window::SetQuitOnClose(bool quit_on_close) +{ + quit_on_close_ = quit_on_close; +} bool Win32Window::OnCreate() { diff --git a/example/windows/runner/win32_window.h b/example/windows/runner/win32_window.h index 7768aab..2b6bbd8 100644 --- a/example/windows/runner/win32_window.h +++ b/example/windows/runner/win32_window.h @@ -24,19 +24,23 @@ public: { unsigned int width; unsigned int height; - Size(unsigned int width, unsigned int height) : width(width), height(height) {} + Size(unsigned int width, unsigned int height) : + width(width), height(height) + {} }; Win32Window(); virtual ~Win32Window(); // Creates and shows a win32 window with |title| and position and size using - // |origin| and |size|. New windows are created on the default monitor. Window - // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size to will treat the width height passed in to this function - // as logical pixels and scale to appropriate for the default monitor. Returns - // true if the window was created successfully. - bool CreateAndShow(const std::wstring& title, const Point& origin, const Size& size); + // |origin| and |size|. New windows are created on the default monitor. + // Window sizes are specified to the OS in physical pixels, hence to ensure + // a consistent size to will treat the width height passed in to this + // function as logical pixels and scale to appropriate for the default + // monitor. Returns true if the window was created successfully. + bool CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size); // Release OS resources associated with window. void Destroy();