Skip to content

Commit e05b719

Browse files
committed
Fix formatting
1 parent 5edfc9c commit e05b719

File tree

9 files changed

+60
-67
lines changed

9 files changed

+60
-67
lines changed

packages/diagram_capture/example/linux/my_application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
1919
*/
2020
MyApplication *my_application_new();
2121

22-
#endif // FLUTTER_MY_APPLICATION_H_
22+
#endif // FLUTTER_MY_APPLICATION_H_

packages/diagram_generator/linux/my_application.cc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ static void my_application_activate(GApplication* application) {
5151
gtk_widget_show(GTK_WIDGET(window));
5252

5353
g_autoptr(FlDartProject) project = fl_dart_project_new();
54-
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
54+
fl_dart_project_set_dart_entrypoint_arguments(
55+
project, self->dart_entrypoint_arguments);
5556

5657
FlView* view = fl_view_new(project);
5758
gtk_widget_show(GTK_WIDGET(view));
@@ -63,16 +64,18 @@ static void my_application_activate(GApplication* application) {
6364
}
6465

6566
// Implements GApplication::local_command_line.
66-
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67+
static gboolean my_application_local_command_line(GApplication* application,
68+
gchar*** arguments,
69+
int* exit_status) {
6770
MyApplication* self = MY_APPLICATION(application);
6871
// Strip out the first argument as it is the binary name.
6972
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
7073

7174
g_autoptr(GError) error = nullptr;
7275
if (!g_application_register(application, nullptr, &error)) {
73-
g_warning("Failed to register: %s", error->message);
74-
*exit_status = 1;
75-
return TRUE;
76+
g_warning("Failed to register: %s", error->message);
77+
*exit_status = 1;
78+
return TRUE;
7679
}
7780

7881
g_application_activate(application);
@@ -83,7 +86,7 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8386

8487
// Implements GApplication::startup.
8588
static void my_application_startup(GApplication* application) {
86-
//MyApplication* self = MY_APPLICATION(object);
89+
// MyApplication* self = MY_APPLICATION(object);
8790

8891
// Perform any actions required at application startup.
8992

@@ -92,7 +95,7 @@ static void my_application_startup(GApplication* application) {
9295

9396
// Implements GApplication::shutdown.
9497
static void my_application_shutdown(GApplication* application) {
95-
//MyApplication* self = MY_APPLICATION(object);
98+
// MyApplication* self = MY_APPLICATION(object);
9699

97100
// Perform any actions required at application shutdown.
98101

@@ -108,7 +111,8 @@ static void my_application_dispose(GObject* object) {
108111

109112
static void my_application_class_init(MyApplicationClass* klass) {
110113
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
111-
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
114+
G_APPLICATION_CLASS(klass)->local_command_line =
115+
my_application_local_command_line;
112116
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
113117
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
114118
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
@@ -118,7 +122,6 @@ static void my_application_init(MyApplication* self) {}
118122

119123
MyApplication* my_application_new() {
120124
return MY_APPLICATION(g_object_new(my_application_get_type(),
121-
"application-id", APPLICATION_ID,
122-
"flags", G_APPLICATION_NON_UNIQUE,
123-
nullptr));
125+
"application-id", APPLICATION_ID, "flags",
126+
G_APPLICATION_NON_UNIQUE, nullptr));
124127
}

packages/diagram_viewer/linux/my_application.cc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ static void my_application_activate(GApplication* application) {
5151
gtk_widget_show(GTK_WIDGET(window));
5252

5353
g_autoptr(FlDartProject) project = fl_dart_project_new();
54-
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
54+
fl_dart_project_set_dart_entrypoint_arguments(
55+
project, self->dart_entrypoint_arguments);
5556

5657
FlView* view = fl_view_new(project);
5758
gtk_widget_show(GTK_WIDGET(view));
@@ -63,16 +64,18 @@ static void my_application_activate(GApplication* application) {
6364
}
6465

6566
// Implements GApplication::local_command_line.
66-
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67+
static gboolean my_application_local_command_line(GApplication* application,
68+
gchar*** arguments,
69+
int* exit_status) {
6770
MyApplication* self = MY_APPLICATION(application);
6871
// Strip out the first argument as it is the binary name.
6972
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
7073

7174
g_autoptr(GError) error = nullptr;
7275
if (!g_application_register(application, nullptr, &error)) {
73-
g_warning("Failed to register: %s", error->message);
74-
*exit_status = 1;
75-
return TRUE;
76+
g_warning("Failed to register: %s", error->message);
77+
*exit_status = 1;
78+
return TRUE;
7679
}
7780

7881
g_application_activate(application);
@@ -83,7 +86,7 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8386

8487
// Implements GApplication::startup.
8588
static void my_application_startup(GApplication* application) {
86-
//MyApplication* self = MY_APPLICATION(object);
89+
// MyApplication* self = MY_APPLICATION(object);
8790

8891
// Perform any actions required at application startup.
8992

@@ -92,7 +95,7 @@ static void my_application_startup(GApplication* application) {
9295

9396
// Implements GApplication::shutdown.
9497
static void my_application_shutdown(GApplication* application) {
95-
//MyApplication* self = MY_APPLICATION(object);
98+
// MyApplication* self = MY_APPLICATION(object);
9699

97100
// Perform any actions required at application shutdown.
98101

@@ -108,7 +111,8 @@ static void my_application_dispose(GObject* object) {
108111

109112
static void my_application_class_init(MyApplicationClass* klass) {
110113
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
111-
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
114+
G_APPLICATION_CLASS(klass)->local_command_line =
115+
my_application_local_command_line;
112116
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
113117
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
114118
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
@@ -118,7 +122,6 @@ static void my_application_init(MyApplication* self) {}
118122

119123
MyApplication* my_application_new() {
120124
return MY_APPLICATION(g_object_new(my_application_get_type(),
121-
"application-id", APPLICATION_ID,
122-
"flags", G_APPLICATION_NON_UNIQUE,
123-
nullptr));
125+
"application-id", APPLICATION_ID, "flags",
126+
G_APPLICATION_NON_UNIQUE, nullptr));
124127
}

packages/diagram_viewer/windows/runner/flutter_window.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ bool FlutterWindow::OnCreate() {
2727
RegisterPlugins(flutter_controller_->engine());
2828
SetChildContent(flutter_controller_->view()->GetNativeWindow());
2929

30-
flutter_controller_->engine()->SetNextFrameCallback([&]() {
31-
this->Show();
32-
});
30+
flutter_controller_->engine()->SetNextFrameCallback([&]() { this->Show(); });
3331

3432
// Flutter can complete the first frame before the "show window" callback is
3533
// registered. The following call ensures a frame is pending to ensure the

packages/diagram_viewer/windows/runner/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
1919

2020
flutter::DartProject project(L"data");
2121

22-
std::vector<std::string> command_line_arguments =
23-
GetCommandLineArguments();
22+
std::vector<std::string> command_line_arguments = GetCommandLineArguments();
2423

2524
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
2625

packages/diagram_viewer/windows/runner/resource.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Microsoft Visual C++ generated include file.
33
// Used by Runner.rc
44
//
5-
#define IDI_APP_ICON 101
5+
#define IDI_APP_ICON 101
66

77
// Next default values for new objects
88
//
99
#ifdef APSTUDIO_INVOKED
1010
#ifndef APSTUDIO_READONLY_SYMBOLS
11-
#define _APS_NEXT_RESOURCE_VALUE 102
12-
#define _APS_NEXT_COMMAND_VALUE 40001
13-
#define _APS_NEXT_CONTROL_VALUE 1001
14-
#define _APS_NEXT_SYMED_VALUE 101
11+
#define _APS_NEXT_RESOURCE_VALUE 102
12+
#define _APS_NEXT_COMMAND_VALUE 40001
13+
#define _APS_NEXT_CONTROL_VALUE 1001
14+
#define _APS_NEXT_SYMED_VALUE 101
1515
#endif
1616
#endif

packages/diagram_viewer/windows/runner/utils.cpp

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

1010
void CreateAndAttachConsole() {
1111
if (::AllocConsole()) {
12-
FILE *unused;
12+
FILE* unused;
1313
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
1414
_dup2(_fileno(stdout), 1);
1515
}
@@ -45,19 +45,19 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) {
4545
if (utf16_string == nullptr) {
4646
return std::string();
4747
}
48-
unsigned int target_length = ::WideCharToMultiByte(
49-
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50-
-1, nullptr, 0, nullptr, nullptr)
51-
-1; // remove the trailing null character
48+
unsigned int target_length =
49+
::WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1,
50+
nullptr, 0, nullptr, nullptr) -
51+
1; // remove the trailing null character
5252
int input_length = (int)wcslen(utf16_string);
5353
std::string utf8_string;
5454
if (target_length == 0 || target_length > utf8_string.max_size()) {
5555
return utf8_string;
5656
}
5757
utf8_string.resize(target_length);
5858
int converted_length = ::WideCharToMultiByte(
59-
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
60-
input_length, utf8_string.data(), target_length, nullptr, nullptr);
59+
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, input_length,
60+
utf8_string.data(), target_length, nullptr, nullptr);
6161
if (converted_length == 0) {
6262
return std::string();
6363
}

packages/diagram_viewer/windows/runner/win32_window.cpp

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace {
1111
///
1212
/// Redefined in case the developer's machine has a Windows SDK older than
1313
/// version 10.0.22000.0.
14-
/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
14+
/// See:
15+
/// https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
1516
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
1617
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
1718
#endif
@@ -23,8 +24,9 @@ constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
2324
/// A value of 0 indicates apps should use dark mode. A non-zero or missing
2425
/// value indicates apps should use light mode.
2526
constexpr const wchar_t kGetPreferredBrightnessRegKey[] =
26-
L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
27-
constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme";
27+
L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
28+
constexpr const wchar_t kGetPreferredBrightnessRegValue[] =
29+
L"AppsUseLightTheme";
2830

2931
// The number of Win32Window objects that currently exist.
3032
static int g_active_window_count = 0;
@@ -111,17 +113,14 @@ void WindowClassRegistrar::UnregisterWindowClass() {
111113
class_registered_ = false;
112114
}
113115

114-
Win32Window::Win32Window() {
115-
++g_active_window_count;
116-
}
116+
Win32Window::Win32Window() { ++g_active_window_count; }
117117

118118
Win32Window::~Win32Window() {
119119
--g_active_window_count;
120120
Destroy();
121121
}
122122

123-
bool Win32Window::Create(const std::wstring& title,
124-
const Point& origin,
123+
bool Win32Window::Create(const std::wstring& title, const Point& origin,
125124
const Size& size) {
126125
Destroy();
127126

@@ -149,13 +148,10 @@ bool Win32Window::Create(const std::wstring& title,
149148
return OnCreate();
150149
}
151150

152-
bool Win32Window::Show() {
153-
return ShowWindow(window_handle_, SW_SHOWNORMAL);
154-
}
151+
bool Win32Window::Show() { return ShowWindow(window_handle_, SW_SHOWNORMAL); }
155152

156153
// static
157-
LRESULT CALLBACK Win32Window::WndProc(HWND const window,
158-
UINT const message,
154+
LRESULT CALLBACK Win32Window::WndProc(HWND const window, UINT const message,
159155
WPARAM const wparam,
160156
LPARAM const lparam) noexcept {
161157
if (message == WM_NCCREATE) {
@@ -174,9 +170,7 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window,
174170
}
175171

176172
LRESULT
177-
Win32Window::MessageHandler(HWND hwnd,
178-
UINT const message,
179-
WPARAM const wparam,
173+
Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam,
180174
LPARAM const lparam) noexcept {
181175
switch (message) {
182176
case WM_DESTROY:
@@ -255,9 +249,7 @@ RECT Win32Window::GetClientArea() {
255249
return frame;
256250
}
257251

258-
HWND Win32Window::GetHandle() {
259-
return window_handle_;
260-
}
252+
HWND Win32Window::GetHandle() { return window_handle_; }
261253

262254
void Win32Window::SetQuitOnClose(bool quit_on_close) {
263255
quit_on_close_ = quit_on_close;
@@ -275,10 +267,10 @@ void Win32Window::OnDestroy() {
275267
void Win32Window::UpdateTheme(HWND const window) {
276268
DWORD light_mode;
277269
DWORD light_mode_size = sizeof(light_mode);
278-
LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey,
279-
kGetPreferredBrightnessRegValue,
280-
RRF_RT_REG_DWORD, nullptr, &light_mode,
281-
&light_mode_size);
270+
LSTATUS result =
271+
RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey,
272+
kGetPreferredBrightnessRegValue, RRF_RT_REG_DWORD, nullptr,
273+
&light_mode, &light_mode_size);
282274

283275
if (result == ERROR_SUCCESS) {
284276
BOOL enable_dark_mode = light_mode == 0;

packages/diagram_viewer/windows/runner/win32_window.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class Win32Window {
5959
// Processes and route salient window messages for mouse handling,
6060
// size change and DPI. Delegates handling of these to member overloads that
6161
// inheriting classes can handle.
62-
virtual LRESULT MessageHandler(HWND window,
63-
UINT const message,
62+
virtual LRESULT MessageHandler(HWND window, UINT const message,
6463
WPARAM const wparam,
6564
LPARAM const lparam) noexcept;
6665

@@ -79,8 +78,7 @@ class Win32Window {
7978
// non-client DPI scaling so that the non-client area automatically
8079
// responds to changes in DPI. All other messages are handled by
8180
// MessageHandler.
82-
static LRESULT CALLBACK WndProc(HWND const window,
83-
UINT const message,
81+
static LRESULT CALLBACK WndProc(HWND const window, UINT const message,
8482
WPARAM const wparam,
8583
LPARAM const lparam) noexcept;
8684

0 commit comments

Comments
 (0)