diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/CMakeLists.txt b/packages/flutter_tools/templates/app/windows.tmpl/runner/CMakeLists.txt index 83e5acaac64..977e38b5d1d 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/CMakeLists.txt +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/CMakeLists.txt @@ -7,12 +7,12 @@ add_executable(${BINARY_NAME} WIN32 "run_loop.cpp" "utils.cpp" "win32_window.cpp" - "window_configuration.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) apply_standard_settings(${BINARY_NAME}) +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.h b/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.h index 7fcd13062f3..b663ddd5012 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.h +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.h @@ -1,5 +1,5 @@ -#ifndef FLUTTER_WINDOW_H_ -#define FLUTTER_WINDOW_H_ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ #include #include @@ -36,4 +36,4 @@ class FlutterWindow : public Win32Window { std::unique_ptr flutter_controller_; }; -#endif // FLUTTER_WINDOW_H_ +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp b/packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp.tmpl similarity index 79% rename from packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp rename to packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp.tmpl index 11b48e95738..6d2c86b2c35 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/main.cpp.tmpl @@ -5,7 +5,6 @@ #include "flutter_window.h" #include "run_loop.h" #include "utils.h" -#include "window_configuration.h" int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { @@ -23,9 +22,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, flutter::DartProject project(L"data"); FlutterWindow window(&run_loop, project); - Win32Window::Point origin(kFlutterWindowOriginX, kFlutterWindowOriginY); - Win32Window::Size size(kFlutterWindowWidth, kFlutterWindowHeight); - if (!window.CreateAndShow(kFlutterWindowTitle, origin, size)) { + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.CreateAndShow(L"{{projectName}}", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.cpp b/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.cpp index 36849fd2785..2d6636ab6bc 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.cpp +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.cpp @@ -1,9 +1,6 @@ #include "run_loop.h" -#include -// Don't stomp std::min/std::max -#undef max -#undef min +#include #include diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.h b/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.h index 46ffc7a97a7..000d3624638 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.h +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/run_loop.h @@ -1,5 +1,5 @@ -#ifndef RUN_LOOP_H_ -#define RUN_LOOP_H_ +#ifndef RUNNER_RUN_LOOP_H_ +#define RUNNER_RUN_LOOP_H_ #include @@ -37,4 +37,4 @@ class RunLoop { std::set flutter_instances_; }; -#endif // RUN_LOOP_H_ +#endif // RUNNER_RUN_LOOP_H_ diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/utils.h b/packages/flutter_tools/templates/app/windows.tmpl/runner/utils.h index d247a66308b..d792603bb13 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/utils.h +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/utils.h @@ -1,8 +1,8 @@ -#ifndef CONSOLE_UTILS_H_ -#define CONSOLE_UTILS_H_ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ // Creates a console for the process, and redirects stdout and stderr to // it for both the runner and the Flutter library. void CreateAndAttachConsole(); -#endif // CONSOLE_UTILS_H_ +#endif // RUNNER_UTILS_H_ diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.h b/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.h index 93d2162eea8..17ba431125b 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.h +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.h @@ -1,8 +1,7 @@ -#ifndef WIN32_WINDOW_H_ -#define WIN32_WINDOW_H_ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ -#include -#include +#include #include #include @@ -96,4 +95,4 @@ class Win32Window { HWND child_content_ = nullptr; }; -#endif // WIN32_WINDOW_H_ +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.cpp.tmpl b/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.cpp.tmpl deleted file mode 100644 index 7cf81a2c0b0..00000000000 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.cpp.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -#include "window_configuration.h" - -const wchar_t* kFlutterWindowTitle = L"{{projectName}}"; -const unsigned int kFlutterWindowOriginX = 10; -const unsigned int kFlutterWindowOriginY = 10; -const unsigned int kFlutterWindowWidth = 1280; -const unsigned int kFlutterWindowHeight = 720; diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.h b/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.h deleted file mode 100644 index ea5cead43c4..00000000000 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/window_configuration.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef WINDOW_CONFIGURATION_ -#define WINDOW_CONFIGURATION_ - -// This is a temporary approach to isolate changes that people are likely to -// make to main.cpp, where the APIs are still in flux. This will reduce the -// need to resolve conflicts or re-create changes slightly differently every -// time the Windows Flutter API surface changes. -// -// Longer term there should be simpler configuration options for common -// customizations like this, without requiring native code changes. - -extern const wchar_t* kFlutterWindowTitle; -extern const unsigned int kFlutterWindowOriginX; -extern const unsigned int kFlutterWindowOriginY; -extern const unsigned int kFlutterWindowWidth; -extern const unsigned int kFlutterWindowHeight; - -#endif // WINDOW_CONFIGURATION_ diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json index cbd09dd76d9..4e4fe4ce371 100644 --- a/packages/flutter_tools/templates/template_manifest.json +++ b/packages/flutter_tools/templates/template_manifest.json @@ -84,8 +84,6 @@ "templates/app/linux.tmpl/main.cc", "templates/app/linux.tmpl/my_application.cc", "templates/app/linux.tmpl/my_application.h", - "templates/app/linux.tmpl/window_configuration.cc.tmpl", - "templates/app/linux.tmpl/window_configuration.h", "templates/app/macos.tmpl/.gitignore", "templates/app/macos.tmpl/Flutter/Flutter-Debug.xcconfig", "templates/app/macos.tmpl/Flutter/Flutter-Release.xcconfig", @@ -128,7 +126,7 @@ "templates/app/windows.tmpl/runner/CMakeLists.txt", "templates/app/windows.tmpl/runner/flutter_window.cpp", "templates/app/windows.tmpl/runner/flutter_window.h", - "templates/app/windows.tmpl/runner/main.cpp", + "templates/app/windows.tmpl/runner/main.cpp.tmpl", "templates/app/windows.tmpl/runner/resource.h", "templates/app/windows.tmpl/runner/resources/app_icon.ico.img.tmpl", "templates/app/windows.tmpl/runner/runner.exe.manifest", @@ -139,8 +137,6 @@ "templates/app/windows.tmpl/runner/utils.h", "templates/app/windows.tmpl/runner/win32_window.cpp", "templates/app/windows.tmpl/runner/win32_window.h", - "templates/app/windows.tmpl/runner/window_configuration.cpp.tmpl", - "templates/app/windows.tmpl/runner/window_configuration.h", "templates/cocoapods/Podfile-ios-objc", "templates/cocoapods/Podfile-ios-swift", "templates/cocoapods/Podfile-macos",