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>
This commit is contained in:
csmartdalton
2024-10-11 19:25:57 +00:00
parent 049e6e8b9d
commit b4bfa2d69b
6 changed files with 57 additions and 30 deletions

View File

@ -1 +1 @@
eed8230f84e2894d0436dd1d94566c59f4dfcb6f e52e9fff2973ce63a689e9d11ea283214109ca18

View File

@ -8,7 +8,8 @@
{ {
[GeneratedPluginRegistrant registerWithRegistry:self]; [GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch. // Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions]; return [super application:application
didFinishLaunchingWithOptions:launchOptions];
} }
@end @end

View File

@ -6,6 +6,7 @@ int main(int argc, char* argv[])
{ {
@autoreleasepool @autoreleasepool
{ {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); return UIApplicationMain(
argc, argv, nil, NSStringFromClass([AppDelegate class]));
} }
} }

View File

@ -4,7 +4,9 @@
#include "flutter/generated_plugin_registrant.h" #include "flutter/generated_plugin_registrant.h"
FlutterWindow::FlutterWindow(const flutter::DartProject& project) : project_(project) {} FlutterWindow::FlutterWindow(const flutter::DartProject& project) :
project_(project)
{}
FlutterWindow::~FlutterWindow() {} FlutterWindow::~FlutterWindow() {}
@ -17,11 +19,12 @@ bool FlutterWindow::OnCreate()
RECT frame = GetClientArea(); RECT frame = GetClientArea();
// The size here must match the window dimensions to avoid unnecessary surface // The size here must match the window dimensions to avoid unnecessary
// creation / destruction in the startup path. // surface creation / destruction in the startup path.
flutter_controller_ = std::make_unique<flutter::FlutterViewController>(frame.right - frame.left, flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
frame.bottom - frame.top, frame.right - frame.left,
project_); frame.bottom - frame.top,
project_);
// Ensure that basic setup of the controller was successful. // Ensure that basic setup of the controller was successful.
if (!flutter_controller_->engine() || !flutter_controller_->view()) if (!flutter_controller_->engine() || !flutter_controller_->view())
{ {
@ -48,11 +51,15 @@ FlutterWindow::MessageHandler(HWND hwnd,
WPARAM const wparam, WPARAM const wparam,
LPARAM const lparam) noexcept 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_) if (flutter_controller_)
{ {
std::optional<LRESULT> result = std::optional<LRESULT> result =
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, lparam); flutter_controller_->HandleTopLevelWindowProc(hwnd,
message,
wparam,
lparam);
if (result) if (result)
{ {
return *result; return *result;

View File

@ -16,7 +16,10 @@ using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
// Scale helper to convert logical scaler values to physical using passed in // Scale helper to convert logical scaler values to physical using passed in
// scale factor // scale factor
int Scale(int source, double scale_factor) { return static_cast<int>(source * scale_factor); } int Scale(int source, double scale_factor)
{
return static_cast<int>(source * scale_factor);
}
// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
// This API is only needed for PerMonitor V1 awareness mode. // This API is only needed for PerMonitor V1 awareness mode.
@ -27,8 +30,9 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd)
{ {
return; return;
} }
auto enable_non_client_dpi_scaling = reinterpret_cast<EnableNonClientDpiScaling*>( auto enable_non_client_dpi_scaling =
GetProcAddress(user32_module, "EnableNonClientDpiScaling")); reinterpret_cast<EnableNonClientDpiScaling*>(
GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
if (enable_non_client_dpi_scaling != nullptr) if (enable_non_client_dpi_scaling != nullptr)
{ {
enable_non_client_dpi_scaling(hwnd); enable_non_client_dpi_scaling(hwnd);
@ -83,7 +87,8 @@ const wchar_t* WindowClassRegistrar::GetWindowClass()
window_class.cbClsExtra = 0; window_class.cbClsExtra = 0;
window_class.cbWndExtra = 0; window_class.cbWndExtra = 0;
window_class.hInstance = GetModuleHandle(nullptr); 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.hbrBackground = 0;
window_class.lpszMenuName = nullptr; window_class.lpszMenuName = nullptr;
window_class.lpfnWndProc = Win32Window::WndProc; window_class.lpfnWndProc = Win32Window::WndProc;
@ -107,13 +112,17 @@ Win32Window::~Win32Window()
Destroy(); 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(); Destroy();
const wchar_t* window_class = WindowClassRegistrar::GetInstance()->GetWindowClass(); const wchar_t* window_class =
WindowClassRegistrar::GetInstance()->GetWindowClass();
const POINT target_point = {static_cast<LONG>(origin.x), static_cast<LONG>(origin.y)}; const POINT target_point = {static_cast<LONG>(origin.x),
static_cast<LONG>(origin.y)};
HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
double scale_factor = dpi / 96.0; double scale_factor = dpi / 96.0;
@ -147,9 +156,10 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window,
if (message == WM_NCCREATE) if (message == WM_NCCREATE)
{ {
auto window_struct = reinterpret_cast<CREATESTRUCT*>(lparam); auto window_struct = reinterpret_cast<CREATESTRUCT*>(lparam);
SetWindowLongPtr(window, SetWindowLongPtr(
GWLP_USERDATA, window,
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams)); GWLP_USERDATA,
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams));
auto that = static_cast<Win32Window*>(window_struct->lpCreateParams); auto that = static_cast<Win32Window*>(window_struct->lpCreateParams);
EnableFullDpiSupportIfAvailable(window); EnableFullDpiSupportIfAvailable(window);
@ -240,7 +250,8 @@ void Win32Window::Destroy()
Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept
{ {
return reinterpret_cast<Win32Window*>(GetWindowLongPtr(window, GWLP_USERDATA)); return reinterpret_cast<Win32Window*>(
GetWindowLongPtr(window, GWLP_USERDATA));
} }
void Win32Window::SetChildContent(HWND content) void Win32Window::SetChildContent(HWND content)
@ -268,7 +279,10 @@ RECT Win32Window::GetClientArea()
HWND Win32Window::GetHandle() { return window_handle_; } 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() bool Win32Window::OnCreate()
{ {

View File

@ -24,19 +24,23 @@ public:
{ {
unsigned int width; unsigned int width;
unsigned int height; 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(); Win32Window();
virtual ~Win32Window(); virtual ~Win32Window();
// Creates and shows a win32 window with |title| and position and size using // 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 // |origin| and |size|. New windows are created on the default monitor.
// sizes are specified to the OS in physical pixels, hence to ensure a // Window sizes are specified to the OS in physical pixels, hence to ensure
// consistent size to will treat the width height passed in to this function // a consistent size to will treat the width height passed in to this
// as logical pixels and scale to appropriate for the default monitor. Returns // function as logical pixels and scale to appropriate for the default
// true if the window was created successfully. // monitor. Returns true if the window was created successfully.
bool CreateAndShow(const std::wstring& title, const Point& origin, const Size& size); bool CreateAndShow(const std::wstring& title,
const Point& origin,
const Size& size);
// Release OS resources associated with window. // Release OS resources associated with window.
void Destroy(); void Destroy();