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];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
return [super application:application
didFinishLaunchingWithOptions:launchOptions];
}
@end

View File

@ -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]));
}
}

View File

@ -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<flutter::FlutterViewController>(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<flutter::FlutterViewController>(
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<LRESULT> result =
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, lparam);
flutter_controller_->HandleTopLevelWindowProc(hwnd,
message,
wparam,
lparam);
if (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 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.
// 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<EnableNonClientDpiScaling*>(
GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
auto enable_non_client_dpi_scaling =
reinterpret_cast<EnableNonClientDpiScaling*>(
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<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);
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<CREATESTRUCT*>(lparam);
SetWindowLongPtr(window,
GWLP_USERDATA,
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams));
SetWindowLongPtr(
window,
GWLP_USERDATA,
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams));
auto that = static_cast<Win32Window*>(window_struct->lpCreateParams);
EnableFullDpiSupportIfAvailable(window);
@ -240,7 +250,8 @@ void Win32Window::Destroy()
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)
@ -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()
{

View File

@ -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();