~repos /only-bible-app
git clone https://pyrossh.dev/repos/only-bible-app.git
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
af084513
—
pyrossh 2 years ago
update workflows
- .github/workflows/build.yml +9 -83
- linux/.gitignore +0 -1
- linux/CMakeLists.txt +0 -139
- linux/flutter/CMakeLists.txt +0 -88
- linux/flutter/generated_plugin_registrant.cc +0 -15
- linux/flutter/generated_plugin_registrant.h +0 -15
- linux/flutter/generated_plugins.cmake +0 -24
- linux/main.cc +0 -6
- linux/my_application.cc +0 -104
- linux/my_application.h +0 -18
- readme.md +0 -8
- windows/.gitignore +0 -17
- windows/CMakeLists.txt +0 -102
- windows/flutter/CMakeLists.txt +0 -104
- windows/flutter/generated_plugin_registrant.cc +0 -20
- windows/flutter/generated_plugin_registrant.h +0 -15
- windows/flutter/generated_plugins.cmake +0 -26
- windows/runner/CMakeLists.txt +0 -40
- windows/runner/Runner.rc +0 -121
- windows/runner/flutter_window.cpp +0 -66
- windows/runner/flutter_window.h +0 -33
- windows/runner/main.cpp +0 -43
- windows/runner/resource.h +0 -16
- windows/runner/resources/app_icon.ico +0 -0
- windows/runner/runner.exe.manifest +0 -20
- windows/runner/utils.cpp +0 -65
- windows/runner/utils.h +0 -19
- windows/runner/win32_window.cpp +0 -288
- windows/runner/win32_window.h +0 -102
.github/workflows/build.yml
CHANGED
|
@@ -4,29 +4,12 @@ name: Build
|
|
|
4
4
|
branches:
|
|
5
5
|
- master
|
|
6
6
|
jobs:
|
|
7
|
-
|
|
7
|
+
build:
|
|
8
8
|
permissions:
|
|
9
9
|
contents: read
|
|
10
10
|
pages: write
|
|
11
11
|
id-token: write
|
|
12
|
-
runs-on:
|
|
12
|
+
runs-on: macos-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
- uses: subosito/flutter-action@v2
|
|
16
|
-
with:
|
|
17
|
-
flutter-version: '3.13.0'
|
|
18
|
-
channel: 'stable'
|
|
19
|
-
cache: true
|
|
20
|
-
- run: flutter --version
|
|
21
|
-
- run: flutter pub get
|
|
22
|
-
- run: flutter build web --dart-define=TTS_SUBSCRIPTION_KEY=${{ secrets.TTS_SUBSCRIPTION_KEY }} --dart-define=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
|
|
23
|
-
- run: cp build/web/index.html build/web/privacy-policy.html
|
|
24
|
-
- uses: actions/upload-pages-artifact@v1
|
|
25
|
-
with:
|
|
26
|
-
path: build/web
|
|
27
|
-
- uses: actions/deploy-pages@v2
|
|
28
|
-
android:
|
|
29
|
-
runs-on: ubuntu-latest
|
|
30
13
|
steps:
|
|
31
14
|
- uses: actions/checkout@v3
|
|
32
15
|
- uses: actions/setup-java@v2
|
|
@@ -38,71 +21,14 @@ jobs:
|
|
|
38
21
|
flutter-version: '3.13.0'
|
|
39
22
|
channel: 'stable'
|
|
40
23
|
cache: true
|
|
41
|
-
-
|
|
24
|
+
- run: flutter --disable-telemetry
|
|
42
|
-
env:
|
|
43
|
-
envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
|
|
44
|
-
envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
45
25
|
- run: flutter build appbundle
|
|
46
|
-
ios:
|
|
47
|
-
runs-on: macos-latest
|
|
48
|
-
steps:
|
|
49
|
-
- uses: actions/checkout@v3
|
|
50
|
-
- uses: subosito/flutter-action@v2
|
|
51
|
-
with:
|
|
52
|
-
flutter-version: '3.13.0'
|
|
53
|
-
channel: 'stable'
|
|
54
|
-
architecture: x64
|
|
55
|
-
- uses: SpicyPizza/create-envfile@v2.0
|
|
56
|
-
env:
|
|
57
|
-
envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
|
|
58
|
-
envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
59
26
|
- run: flutter build ios --release --no-codesign
|
|
60
|
-
macos:
|
|
61
|
-
runs-on: macos-latest
|
|
62
|
-
steps:
|
|
63
|
-
- uses: actions/checkout@v3
|
|
64
|
-
- uses: subosito/flutter-action@v2
|
|
65
|
-
with:
|
|
66
|
-
flutter-version: '3.13.0'
|
|
67
|
-
channel: 'stable'
|
|
68
|
-
architecture: x64
|
|
69
|
-
cache: true
|
|
70
|
-
- uses: SpicyPizza/create-envfile@v2.0
|
|
71
|
-
env:
|
|
72
|
-
envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
|
|
73
|
-
envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
74
27
|
- run: flutter config --enable-macos-desktop
|
|
28
|
+
- run: flutter build macos --dart-define=TTS_SUBSCRIPTION_KEY=${{ secrets.TTS_SUBSCRIPTION_KEY }} --dart-define=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
|
|
29
|
+
- run: flutter build web --dart-define=TTS_SUBSCRIPTION_KEY=${{ secrets.TTS_SUBSCRIPTION_KEY }} --dart-define=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
|
|
75
|
-
- run:
|
|
30
|
+
- run: cp build/web/index.html build/web/privacy-policy.html
|
|
76
|
-
windows:
|
|
77
|
-
runs-on: windows-latest
|
|
78
|
-
steps:
|
|
79
|
-
- uses: actions/
|
|
31
|
+
- uses: actions/upload-pages-artifact@v1
|
|
80
|
-
- uses: subosito/flutter-action@v2
|
|
81
|
-
with:
|
|
82
|
-
flutter-version: '3.13.0'
|
|
83
|
-
channel: 'stable'
|
|
84
|
-
cache: true
|
|
85
|
-
- uses: SpicyPizza/create-envfile@v2.0
|
|
86
|
-
env:
|
|
87
|
-
envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
|
|
88
|
-
envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
89
|
-
- run: flutter config --enable-windows-desktop
|
|
90
|
-
- run: flutter build windows
|
|
91
|
-
linux:
|
|
92
|
-
runs-on: ubuntu-latest
|
|
93
|
-
steps:
|
|
94
|
-
- uses: actions/checkout@v3
|
|
95
|
-
- uses: subosito/flutter-action@v2
|
|
96
32
|
with:
|
|
97
|
-
flutter-version: '3.13.0'
|
|
98
|
-
|
|
33
|
+
path: build/web
|
|
99
|
-
cache: true
|
|
100
|
-
- uses:
|
|
34
|
+
- uses: actions/deploy-pages@v2
|
|
101
|
-
env:
|
|
102
|
-
envkey_TTS_SUBSCRIPTION_KEY: ${{ secrets.TTS_SUBSCRIPTION_KEY }}
|
|
103
|
-
envkey_RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
104
|
-
- run: |
|
|
105
|
-
sudo apt-get update -y
|
|
106
|
-
sudo apt-get install -y ninja-build libgtk-3-dev
|
|
107
|
-
- run: flutter config --enable-linux-desktop
|
|
108
|
-
- run: flutter build linux
|
linux/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
flutter/ephemeral
|
linux/CMakeLists.txt
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Project-level configuration.
|
|
2
|
-
cmake_minimum_required(VERSION 3.10)
|
|
3
|
-
project(runner LANGUAGES CXX)
|
|
4
|
-
|
|
5
|
-
# The name of the executable created for the application. Change this to change
|
|
6
|
-
# the on-disk name of your application.
|
|
7
|
-
set(BINARY_NAME "bible_app")
|
|
8
|
-
# The unique GTK application identifier for this application. See:
|
|
9
|
-
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
|
10
|
-
set(APPLICATION_ID "sh.pyros.bible_app")
|
|
11
|
-
|
|
12
|
-
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
|
13
|
-
# versions of CMake.
|
|
14
|
-
cmake_policy(SET CMP0063 NEW)
|
|
15
|
-
|
|
16
|
-
# Load bundled libraries from the lib/ directory relative to the binary.
|
|
17
|
-
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
|
18
|
-
|
|
19
|
-
# Root filesystem for cross-building.
|
|
20
|
-
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
|
|
21
|
-
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
|
|
22
|
-
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
|
|
23
|
-
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
24
|
-
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
25
|
-
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
26
|
-
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
27
|
-
endif()
|
|
28
|
-
|
|
29
|
-
# Define build configuration options.
|
|
30
|
-
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
31
|
-
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
|
32
|
-
STRING "Flutter build mode" FORCE)
|
|
33
|
-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
34
|
-
"Debug" "Profile" "Release")
|
|
35
|
-
endif()
|
|
36
|
-
|
|
37
|
-
# Compilation settings that should be applied to most targets.
|
|
38
|
-
#
|
|
39
|
-
# Be cautious about adding new options here, as plugins use this function by
|
|
40
|
-
# default. In most cases, you should add new options to specific targets instead
|
|
41
|
-
# of modifying this function.
|
|
42
|
-
function(APPLY_STANDARD_SETTINGS TARGET)
|
|
43
|
-
target_compile_features(${TARGET} PUBLIC cxx_std_14)
|
|
44
|
-
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
|
45
|
-
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
|
46
|
-
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
|
|
47
|
-
endfunction()
|
|
48
|
-
|
|
49
|
-
# Flutter library and tool build rules.
|
|
50
|
-
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
|
51
|
-
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
|
52
|
-
|
|
53
|
-
# System-level dependencies.
|
|
54
|
-
find_package(PkgConfig REQUIRED)
|
|
55
|
-
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
|
56
|
-
|
|
57
|
-
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
|
|
58
|
-
|
|
59
|
-
# Define the application target. To change its name, change BINARY_NAME above,
|
|
60
|
-
# not the value here, or `flutter run` will no longer work.
|
|
61
|
-
#
|
|
62
|
-
# Any new source files that you add to the application should be added here.
|
|
63
|
-
add_executable(${BINARY_NAME}
|
|
64
|
-
"main.cc"
|
|
65
|
-
"my_application.cc"
|
|
66
|
-
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
# Apply the standard set of build settings. This can be removed for applications
|
|
70
|
-
# that need different build settings.
|
|
71
|
-
apply_standard_settings(${BINARY_NAME})
|
|
72
|
-
|
|
73
|
-
# Add dependency libraries. Add any application-specific dependencies here.
|
|
74
|
-
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
|
|
75
|
-
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
|
|
76
|
-
|
|
77
|
-
# Run the Flutter tool portions of the build. This must not be removed.
|
|
78
|
-
add_dependencies(${BINARY_NAME} flutter_assemble)
|
|
79
|
-
|
|
80
|
-
# Only the install-generated bundle's copy of the executable will launch
|
|
81
|
-
# correctly, since the resources must in the right relative locations. To avoid
|
|
82
|
-
# people trying to run the unbundled copy, put it in a subdirectory instead of
|
|
83
|
-
# the default top-level location.
|
|
84
|
-
set_target_properties(${BINARY_NAME}
|
|
85
|
-
PROPERTIES
|
|
86
|
-
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# Generated plugin build rules, which manage building the plugins and adding
|
|
91
|
-
# them to the application.
|
|
92
|
-
include(flutter/generated_plugins.cmake)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# === Installation ===
|
|
96
|
-
# By default, "installing" just makes a relocatable bundle in the build
|
|
97
|
-
# directory.
|
|
98
|
-
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
|
|
99
|
-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
100
|
-
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
|
101
|
-
endif()
|
|
102
|
-
|
|
103
|
-
# Start with a clean build bundle directory every time.
|
|
104
|
-
install(CODE "
|
|
105
|
-
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
|
|
106
|
-
" COMPONENT Runtime)
|
|
107
|
-
|
|
108
|
-
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
|
109
|
-
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
|
110
|
-
|
|
111
|
-
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
|
112
|
-
COMPONENT Runtime)
|
|
113
|
-
|
|
114
|
-
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
|
115
|
-
COMPONENT Runtime)
|
|
116
|
-
|
|
117
|
-
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
118
|
-
COMPONENT Runtime)
|
|
119
|
-
|
|
120
|
-
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
|
|
121
|
-
install(FILES "${bundled_library}"
|
|
122
|
-
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
123
|
-
COMPONENT Runtime)
|
|
124
|
-
endforeach(bundled_library)
|
|
125
|
-
|
|
126
|
-
# Fully re-copy the assets directory on each build to avoid having stale files
|
|
127
|
-
# from a previous install.
|
|
128
|
-
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
|
129
|
-
install(CODE "
|
|
130
|
-
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
|
131
|
-
" COMPONENT Runtime)
|
|
132
|
-
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
|
133
|
-
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
|
134
|
-
|
|
135
|
-
# Install the AOT library on non-Debug builds only.
|
|
136
|
-
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
137
|
-
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
138
|
-
COMPONENT Runtime)
|
|
139
|
-
endif()
|
linux/flutter/CMakeLists.txt
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# This file controls Flutter-level build steps. It should not be edited.
|
|
2
|
-
cmake_minimum_required(VERSION 3.10)
|
|
3
|
-
|
|
4
|
-
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
|
5
|
-
|
|
6
|
-
# Configuration provided via flutter tool.
|
|
7
|
-
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
|
8
|
-
|
|
9
|
-
# TODO: Move the rest of this into files in ephemeral. See
|
|
10
|
-
# https://github.com/flutter/flutter/issues/57146.
|
|
11
|
-
|
|
12
|
-
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
|
|
13
|
-
# which isn't available in 3.10.
|
|
14
|
-
function(list_prepend LIST_NAME PREFIX)
|
|
15
|
-
set(NEW_LIST "")
|
|
16
|
-
foreach(element ${${LIST_NAME}})
|
|
17
|
-
list(APPEND NEW_LIST "${PREFIX}${element}")
|
|
18
|
-
endforeach(element)
|
|
19
|
-
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
|
|
20
|
-
endfunction()
|
|
21
|
-
|
|
22
|
-
# === Flutter Library ===
|
|
23
|
-
# System-level dependencies.
|
|
24
|
-
find_package(PkgConfig REQUIRED)
|
|
25
|
-
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
|
26
|
-
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
|
27
|
-
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
|
|
28
|
-
|
|
29
|
-
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
|
|
30
|
-
|
|
31
|
-
# Published to parent scope for install step.
|
|
32
|
-
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
|
33
|
-
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
|
34
|
-
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
|
35
|
-
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
|
|
36
|
-
|
|
37
|
-
list(APPEND FLUTTER_LIBRARY_HEADERS
|
|
38
|
-
"fl_basic_message_channel.h"
|
|
39
|
-
"fl_binary_codec.h"
|
|
40
|
-
"fl_binary_messenger.h"
|
|
41
|
-
"fl_dart_project.h"
|
|
42
|
-
"fl_engine.h"
|
|
43
|
-
"fl_json_message_codec.h"
|
|
44
|
-
"fl_json_method_codec.h"
|
|
45
|
-
"fl_message_codec.h"
|
|
46
|
-
"fl_method_call.h"
|
|
47
|
-
"fl_method_channel.h"
|
|
48
|
-
"fl_method_codec.h"
|
|
49
|
-
"fl_method_response.h"
|
|
50
|
-
"fl_plugin_registrar.h"
|
|
51
|
-
"fl_plugin_registry.h"
|
|
52
|
-
"fl_standard_message_codec.h"
|
|
53
|
-
"fl_standard_method_codec.h"
|
|
54
|
-
"fl_string_codec.h"
|
|
55
|
-
"fl_value.h"
|
|
56
|
-
"fl_view.h"
|
|
57
|
-
"flutter_linux.h"
|
|
58
|
-
)
|
|
59
|
-
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
|
|
60
|
-
add_library(flutter INTERFACE)
|
|
61
|
-
target_include_directories(flutter INTERFACE
|
|
62
|
-
"${EPHEMERAL_DIR}"
|
|
63
|
-
)
|
|
64
|
-
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
|
|
65
|
-
target_link_libraries(flutter INTERFACE
|
|
66
|
-
PkgConfig::GTK
|
|
67
|
-
PkgConfig::GLIB
|
|
68
|
-
PkgConfig::GIO
|
|
69
|
-
)
|
|
70
|
-
add_dependencies(flutter flutter_assemble)
|
|
71
|
-
|
|
72
|
-
# === Flutter tool backend ===
|
|
73
|
-
# _phony_ is a non-existent file to force this command to run every time,
|
|
74
|
-
# since currently there's no way to get a full input/output list from the
|
|
75
|
-
# flutter tool.
|
|
76
|
-
add_custom_command(
|
|
77
|
-
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
|
78
|
-
${CMAKE_CURRENT_BINARY_DIR}/_phony_
|
|
79
|
-
COMMAND ${CMAKE_COMMAND} -E env
|
|
80
|
-
${FLUTTER_TOOL_ENVIRONMENT}
|
|
81
|
-
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
|
|
82
|
-
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
|
|
83
|
-
VERBATIM
|
|
84
|
-
)
|
|
85
|
-
add_custom_target(flutter_assemble DEPENDS
|
|
86
|
-
"${FLUTTER_LIBRARY}"
|
|
87
|
-
${FLUTTER_LIBRARY_HEADERS}
|
|
88
|
-
)
|
linux/flutter/generated_plugin_registrant.cc
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Generated file. Do not edit.
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// clang-format off
|
|
6
|
-
|
|
7
|
-
#include "generated_plugin_registrant.h"
|
|
8
|
-
|
|
9
|
-
#include <url_launcher_linux/url_launcher_plugin.h>
|
|
10
|
-
|
|
11
|
-
void fl_register_plugins(FlPluginRegistry* registry) {
|
|
12
|
-
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
|
13
|
-
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
|
14
|
-
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
|
15
|
-
}
|
linux/flutter/generated_plugin_registrant.h
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Generated file. Do not edit.
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// clang-format off
|
|
6
|
-
|
|
7
|
-
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
|
8
|
-
#define GENERATED_PLUGIN_REGISTRANT_
|
|
9
|
-
|
|
10
|
-
#include <flutter_linux/flutter_linux.h>
|
|
11
|
-
|
|
12
|
-
// Registers Flutter plugins.
|
|
13
|
-
void fl_register_plugins(FlPluginRegistry* registry);
|
|
14
|
-
|
|
15
|
-
#endif // GENERATED_PLUGIN_REGISTRANT_
|
linux/flutter/generated_plugins.cmake
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Generated file, do not edit.
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
list(APPEND FLUTTER_PLUGIN_LIST
|
|
6
|
-
url_launcher_linux
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
set(PLUGIN_BUNDLED_LIBRARIES)
|
|
13
|
-
|
|
14
|
-
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|
15
|
-
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
|
16
|
-
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
|
17
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
|
18
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
|
19
|
-
endforeach(plugin)
|
|
20
|
-
|
|
21
|
-
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
|
22
|
-
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
|
23
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
|
24
|
-
endforeach(ffi_plugin)
|
linux/main.cc
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#include "my_application.h"
|
|
2
|
-
|
|
3
|
-
int main(int argc, char** argv) {
|
|
4
|
-
g_autoptr(MyApplication) app = my_application_new();
|
|
5
|
-
return g_application_run(G_APPLICATION(app), argc, argv);
|
|
6
|
-
}
|
linux/my_application.cc
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
#include "my_application.h"
|
|
2
|
-
|
|
3
|
-
#include <flutter_linux/flutter_linux.h>
|
|
4
|
-
#ifdef GDK_WINDOWING_X11
|
|
5
|
-
#include <gdk/gdkx.h>
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
#include "flutter/generated_plugin_registrant.h"
|
|
9
|
-
|
|
10
|
-
struct _MyApplication {
|
|
11
|
-
GtkApplication parent_instance;
|
|
12
|
-
char** dart_entrypoint_arguments;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
|
16
|
-
|
|
17
|
-
// Implements GApplication::activate.
|
|
18
|
-
static void my_application_activate(GApplication* application) {
|
|
19
|
-
MyApplication* self = MY_APPLICATION(application);
|
|
20
|
-
GtkWindow* window =
|
|
21
|
-
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
|
22
|
-
|
|
23
|
-
// Use a header bar when running in GNOME as this is the common style used
|
|
24
|
-
// by applications and is the setup most users will be using (e.g. Ubuntu
|
|
25
|
-
// desktop).
|
|
26
|
-
// If running on X and not using GNOME then just use a traditional title bar
|
|
27
|
-
// in case the window manager does more exotic layout, e.g. tiling.
|
|
28
|
-
// If running on Wayland assume the header bar will work (may need changing
|
|
29
|
-
// if future cases occur).
|
|
30
|
-
gboolean use_header_bar = TRUE;
|
|
31
|
-
#ifdef GDK_WINDOWING_X11
|
|
32
|
-
GdkScreen* screen = gtk_window_get_screen(window);
|
|
33
|
-
if (GDK_IS_X11_SCREEN(screen)) {
|
|
34
|
-
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
|
|
35
|
-
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
|
|
36
|
-
use_header_bar = FALSE;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
#endif
|
|
40
|
-
if (use_header_bar) {
|
|
41
|
-
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
|
42
|
-
gtk_widget_show(GTK_WIDGET(header_bar));
|
|
43
|
-
gtk_header_bar_set_title(header_bar, "bible_app");
|
|
44
|
-
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
|
45
|
-
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
|
46
|
-
} else {
|
|
47
|
-
gtk_window_set_title(window, "bible_app");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
gtk_window_set_default_size(window, 1280, 720);
|
|
51
|
-
gtk_widget_show(GTK_WIDGET(window));
|
|
52
|
-
|
|
53
|
-
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
|
54
|
-
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
|
|
55
|
-
|
|
56
|
-
FlView* view = fl_view_new(project);
|
|
57
|
-
gtk_widget_show(GTK_WIDGET(view));
|
|
58
|
-
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
|
59
|
-
|
|
60
|
-
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
|
61
|
-
|
|
62
|
-
gtk_widget_grab_focus(GTK_WIDGET(view));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Implements GApplication::local_command_line.
|
|
66
|
-
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
|
|
67
|
-
MyApplication* self = MY_APPLICATION(application);
|
|
68
|
-
// Strip out the first argument as it is the binary name.
|
|
69
|
-
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
|
|
70
|
-
|
|
71
|
-
g_autoptr(GError) error = nullptr;
|
|
72
|
-
if (!g_application_register(application, nullptr, &error)) {
|
|
73
|
-
g_warning("Failed to register: %s", error->message);
|
|
74
|
-
*exit_status = 1;
|
|
75
|
-
return TRUE;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
g_application_activate(application);
|
|
79
|
-
*exit_status = 0;
|
|
80
|
-
|
|
81
|
-
return TRUE;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Implements GObject::dispose.
|
|
85
|
-
static void my_application_dispose(GObject* object) {
|
|
86
|
-
MyApplication* self = MY_APPLICATION(object);
|
|
87
|
-
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
|
|
88
|
-
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
static void my_application_class_init(MyApplicationClass* klass) {
|
|
92
|
-
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
|
|
93
|
-
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
|
|
94
|
-
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
static void my_application_init(MyApplication* self) {}
|
|
98
|
-
|
|
99
|
-
MyApplication* my_application_new() {
|
|
100
|
-
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
|
101
|
-
"application-id", APPLICATION_ID,
|
|
102
|
-
"flags", G_APPLICATION_NON_UNIQUE,
|
|
103
|
-
nullptr));
|
|
104
|
-
}
|
linux/my_application.h
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#ifndef FLUTTER_MY_APPLICATION_H_
|
|
2
|
-
#define FLUTTER_MY_APPLICATION_H_
|
|
3
|
-
|
|
4
|
-
#include <gtk/gtk.h>
|
|
5
|
-
|
|
6
|
-
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
|
|
7
|
-
GtkApplication)
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* my_application_new:
|
|
11
|
-
*
|
|
12
|
-
* Creates a new Flutter-based application.
|
|
13
|
-
*
|
|
14
|
-
* Returns: a new #MyApplication.
|
|
15
|
-
*/
|
|
16
|
-
MyApplication* my_application_new();
|
|
17
|
-
|
|
18
|
-
#endif // FLUTTER_MY_APPLICATION_H_
|
readme.md
CHANGED
|
@@ -49,7 +49,6 @@ dart run flutter_native_splash:create
|
|
|
49
49
|
```agsl
|
|
50
50
|
flutter clean
|
|
51
51
|
flutter run
|
|
52
|
-
firebase emulators:start
|
|
53
52
|
```
|
|
54
53
|
|
|
55
54
|
## Test
|
|
@@ -58,13 +57,6 @@ firebase emulators:start
|
|
|
58
57
|
flutter test
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
## Deploy
|
|
62
|
-
|
|
63
|
-
```agsl
|
|
64
|
-
flutter build web
|
|
65
|
-
firebase deploy
|
|
66
|
-
```
|
|
67
|
-
|
|
68
60
|
## Web
|
|
69
61
|
|
|
70
62
|
```agsl
|
windows/.gitignore
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
flutter/ephemeral/
|
|
2
|
-
|
|
3
|
-
# Visual Studio user-specific files.
|
|
4
|
-
*.suo
|
|
5
|
-
*.user
|
|
6
|
-
*.userosscache
|
|
7
|
-
*.sln.docstates
|
|
8
|
-
|
|
9
|
-
# Visual Studio build-related files.
|
|
10
|
-
x64/
|
|
11
|
-
x86/
|
|
12
|
-
|
|
13
|
-
# Visual Studio cache files
|
|
14
|
-
# files ending in .cache can be ignored
|
|
15
|
-
*.[Cc]ache
|
|
16
|
-
# but keep track of directories ending in .cache
|
|
17
|
-
!*.[Cc]ache/
|
windows/CMakeLists.txt
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Project-level configuration.
|
|
2
|
-
cmake_minimum_required(VERSION 3.14)
|
|
3
|
-
project(only_bible_app LANGUAGES CXX)
|
|
4
|
-
|
|
5
|
-
# The name of the executable created for the application. Change this to change
|
|
6
|
-
# the on-disk name of your application.
|
|
7
|
-
set(BINARY_NAME "only_bible_app")
|
|
8
|
-
|
|
9
|
-
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
|
10
|
-
# versions of CMake.
|
|
11
|
-
cmake_policy(SET CMP0063 NEW)
|
|
12
|
-
|
|
13
|
-
# Define build configuration option.
|
|
14
|
-
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
15
|
-
if(IS_MULTICONFIG)
|
|
16
|
-
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
|
|
17
|
-
CACHE STRING "" FORCE)
|
|
18
|
-
else()
|
|
19
|
-
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
20
|
-
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
|
21
|
-
STRING "Flutter build mode" FORCE)
|
|
22
|
-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
23
|
-
"Debug" "Profile" "Release")
|
|
24
|
-
endif()
|
|
25
|
-
endif()
|
|
26
|
-
# Define settings for the Profile build mode.
|
|
27
|
-
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
|
28
|
-
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
|
|
29
|
-
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
|
|
30
|
-
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
|
|
31
|
-
|
|
32
|
-
# Use Unicode for all projects.
|
|
33
|
-
add_definitions(-DUNICODE -D_UNICODE)
|
|
34
|
-
|
|
35
|
-
# Compilation settings that should be applied to most targets.
|
|
36
|
-
#
|
|
37
|
-
# Be cautious about adding new options here, as plugins use this function by
|
|
38
|
-
# default. In most cases, you should add new options to specific targets instead
|
|
39
|
-
# of modifying this function.
|
|
40
|
-
function(APPLY_STANDARD_SETTINGS TARGET)
|
|
41
|
-
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
|
42
|
-
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
|
|
43
|
-
target_compile_options(${TARGET} PRIVATE /EHsc)
|
|
44
|
-
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
|
|
45
|
-
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
|
|
46
|
-
endfunction()
|
|
47
|
-
|
|
48
|
-
# Flutter library and tool build rules.
|
|
49
|
-
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
|
50
|
-
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
|
51
|
-
|
|
52
|
-
# Application build; see runner/CMakeLists.txt.
|
|
53
|
-
add_subdirectory("runner")
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# Generated plugin build rules, which manage building the plugins and adding
|
|
57
|
-
# them to the application.
|
|
58
|
-
include(flutter/generated_plugins.cmake)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# === Installation ===
|
|
62
|
-
# Support files are copied into place next to the executable, so that it can
|
|
63
|
-
# run in place. This is done instead of making a separate bundle (as on Linux)
|
|
64
|
-
# so that building and running from within Visual Studio will work.
|
|
65
|
-
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
|
|
66
|
-
# Make the "install" step default, as it's required to run.
|
|
67
|
-
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
|
|
68
|
-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
69
|
-
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
|
70
|
-
endif()
|
|
71
|
-
|
|
72
|
-
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
|
73
|
-
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
|
|
74
|
-
|
|
75
|
-
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
|
76
|
-
COMPONENT Runtime)
|
|
77
|
-
|
|
78
|
-
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
|
79
|
-
COMPONENT Runtime)
|
|
80
|
-
|
|
81
|
-
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
82
|
-
COMPONENT Runtime)
|
|
83
|
-
|
|
84
|
-
if(PLUGIN_BUNDLED_LIBRARIES)
|
|
85
|
-
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
|
|
86
|
-
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
87
|
-
COMPONENT Runtime)
|
|
88
|
-
endif()
|
|
89
|
-
|
|
90
|
-
# Fully re-copy the assets directory on each build to avoid having stale files
|
|
91
|
-
# from a previous install.
|
|
92
|
-
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
|
93
|
-
install(CODE "
|
|
94
|
-
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
|
95
|
-
" COMPONENT Runtime)
|
|
96
|
-
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
|
97
|
-
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
|
98
|
-
|
|
99
|
-
# Install the AOT library on non-Debug builds only.
|
|
100
|
-
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
|
101
|
-
CONFIGURATIONS Profile;Release
|
|
102
|
-
COMPONENT Runtime)
|
windows/flutter/CMakeLists.txt
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# This file controls Flutter-level build steps. It should not be edited.
|
|
2
|
-
cmake_minimum_required(VERSION 3.14)
|
|
3
|
-
|
|
4
|
-
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
|
5
|
-
|
|
6
|
-
# Configuration provided via flutter tool.
|
|
7
|
-
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
|
8
|
-
|
|
9
|
-
# TODO: Move the rest of this into files in ephemeral. See
|
|
10
|
-
# https://github.com/flutter/flutter/issues/57146.
|
|
11
|
-
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
|
|
12
|
-
|
|
13
|
-
# === Flutter Library ===
|
|
14
|
-
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
|
|
15
|
-
|
|
16
|
-
# Published to parent scope for install step.
|
|
17
|
-
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
|
18
|
-
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
|
19
|
-
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
|
20
|
-
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
|
|
21
|
-
|
|
22
|
-
list(APPEND FLUTTER_LIBRARY_HEADERS
|
|
23
|
-
"flutter_export.h"
|
|
24
|
-
"flutter_windows.h"
|
|
25
|
-
"flutter_messenger.h"
|
|
26
|
-
"flutter_plugin_registrar.h"
|
|
27
|
-
"flutter_texture_registrar.h"
|
|
28
|
-
)
|
|
29
|
-
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
|
|
30
|
-
add_library(flutter INTERFACE)
|
|
31
|
-
target_include_directories(flutter INTERFACE
|
|
32
|
-
"${EPHEMERAL_DIR}"
|
|
33
|
-
)
|
|
34
|
-
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
|
|
35
|
-
add_dependencies(flutter flutter_assemble)
|
|
36
|
-
|
|
37
|
-
# === Wrapper ===
|
|
38
|
-
list(APPEND CPP_WRAPPER_SOURCES_CORE
|
|
39
|
-
"core_implementations.cc"
|
|
40
|
-
"standard_codec.cc"
|
|
41
|
-
)
|
|
42
|
-
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
|
|
43
|
-
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
|
|
44
|
-
"plugin_registrar.cc"
|
|
45
|
-
)
|
|
46
|
-
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
|
|
47
|
-
list(APPEND CPP_WRAPPER_SOURCES_APP
|
|
48
|
-
"flutter_engine.cc"
|
|
49
|
-
"flutter_view_controller.cc"
|
|
50
|
-
)
|
|
51
|
-
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
|
|
52
|
-
|
|
53
|
-
# Wrapper sources needed for a plugin.
|
|
54
|
-
add_library(flutter_wrapper_plugin STATIC
|
|
55
|
-
${CPP_WRAPPER_SOURCES_CORE}
|
|
56
|
-
${CPP_WRAPPER_SOURCES_PLUGIN}
|
|
57
|
-
)
|
|
58
|
-
apply_standard_settings(flutter_wrapper_plugin)
|
|
59
|
-
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
|
60
|
-
POSITION_INDEPENDENT_CODE ON)
|
|
61
|
-
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
|
62
|
-
CXX_VISIBILITY_PRESET hidden)
|
|
63
|
-
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
|
|
64
|
-
target_include_directories(flutter_wrapper_plugin PUBLIC
|
|
65
|
-
"${WRAPPER_ROOT}/include"
|
|
66
|
-
)
|
|
67
|
-
add_dependencies(flutter_wrapper_plugin flutter_assemble)
|
|
68
|
-
|
|
69
|
-
# Wrapper sources needed for the runner.
|
|
70
|
-
add_library(flutter_wrapper_app STATIC
|
|
71
|
-
${CPP_WRAPPER_SOURCES_CORE}
|
|
72
|
-
${CPP_WRAPPER_SOURCES_APP}
|
|
73
|
-
)
|
|
74
|
-
apply_standard_settings(flutter_wrapper_app)
|
|
75
|
-
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
|
|
76
|
-
target_include_directories(flutter_wrapper_app PUBLIC
|
|
77
|
-
"${WRAPPER_ROOT}/include"
|
|
78
|
-
)
|
|
79
|
-
add_dependencies(flutter_wrapper_app flutter_assemble)
|
|
80
|
-
|
|
81
|
-
# === Flutter tool backend ===
|
|
82
|
-
# _phony_ is a non-existent file to force this command to run every time,
|
|
83
|
-
# since currently there's no way to get a full input/output list from the
|
|
84
|
-
# flutter tool.
|
|
85
|
-
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
|
|
86
|
-
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
|
|
87
|
-
add_custom_command(
|
|
88
|
-
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
|
89
|
-
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
|
|
90
|
-
${CPP_WRAPPER_SOURCES_APP}
|
|
91
|
-
${PHONY_OUTPUT}
|
|
92
|
-
COMMAND ${CMAKE_COMMAND} -E env
|
|
93
|
-
${FLUTTER_TOOL_ENVIRONMENT}
|
|
94
|
-
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
|
|
95
|
-
windows-x64 $<CONFIG>
|
|
96
|
-
VERBATIM
|
|
97
|
-
)
|
|
98
|
-
add_custom_target(flutter_assemble DEPENDS
|
|
99
|
-
"${FLUTTER_LIBRARY}"
|
|
100
|
-
${FLUTTER_LIBRARY_HEADERS}
|
|
101
|
-
${CPP_WRAPPER_SOURCES_CORE}
|
|
102
|
-
${CPP_WRAPPER_SOURCES_PLUGIN}
|
|
103
|
-
${CPP_WRAPPER_SOURCES_APP}
|
|
104
|
-
)
|
windows/flutter/generated_plugin_registrant.cc
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Generated file. Do not edit.
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// clang-format off
|
|
6
|
-
|
|
7
|
-
#include "generated_plugin_registrant.h"
|
|
8
|
-
|
|
9
|
-
#include <just_audio_windows/just_audio_windows_plugin.h>
|
|
10
|
-
#include <share_plus/share_plus_windows_plugin_c_api.h>
|
|
11
|
-
#include <url_launcher_windows/url_launcher_windows.h>
|
|
12
|
-
|
|
13
|
-
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|
14
|
-
JustAudioWindowsPluginRegisterWithRegistrar(
|
|
15
|
-
registry->GetRegistrarForPlugin("JustAudioWindowsPlugin"));
|
|
16
|
-
SharePlusWindowsPluginCApiRegisterWithRegistrar(
|
|
17
|
-
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
|
|
18
|
-
UrlLauncherWindowsRegisterWithRegistrar(
|
|
19
|
-
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
|
20
|
-
}
|
windows/flutter/generated_plugin_registrant.h
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Generated file. Do not edit.
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// clang-format off
|
|
6
|
-
|
|
7
|
-
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
|
8
|
-
#define GENERATED_PLUGIN_REGISTRANT_
|
|
9
|
-
|
|
10
|
-
#include <flutter/plugin_registry.h>
|
|
11
|
-
|
|
12
|
-
// Registers Flutter plugins.
|
|
13
|
-
void RegisterPlugins(flutter::PluginRegistry* registry);
|
|
14
|
-
|
|
15
|
-
#endif // GENERATED_PLUGIN_REGISTRANT_
|
windows/flutter/generated_plugins.cmake
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Generated file, do not edit.
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
list(APPEND FLUTTER_PLUGIN_LIST
|
|
6
|
-
just_audio_windows
|
|
7
|
-
share_plus
|
|
8
|
-
url_launcher_windows
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
set(PLUGIN_BUNDLED_LIBRARIES)
|
|
15
|
-
|
|
16
|
-
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|
17
|
-
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
|
|
18
|
-
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
|
19
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
|
20
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
|
21
|
-
endforeach(plugin)
|
|
22
|
-
|
|
23
|
-
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
|
24
|
-
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
|
25
|
-
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
|
26
|
-
endforeach(ffi_plugin)
|
windows/runner/CMakeLists.txt
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.14)
|
|
2
|
-
project(runner LANGUAGES CXX)
|
|
3
|
-
|
|
4
|
-
# Define the application target. To change its name, change BINARY_NAME in the
|
|
5
|
-
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
|
|
6
|
-
# work.
|
|
7
|
-
#
|
|
8
|
-
# Any new source files that you add to the application should be added here.
|
|
9
|
-
add_executable(${BINARY_NAME} WIN32
|
|
10
|
-
"flutter_window.cpp"
|
|
11
|
-
"main.cpp"
|
|
12
|
-
"utils.cpp"
|
|
13
|
-
"win32_window.cpp"
|
|
14
|
-
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
|
15
|
-
"Runner.rc"
|
|
16
|
-
"runner.exe.manifest"
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
# Apply the standard set of build settings. This can be removed for applications
|
|
20
|
-
# that need different build settings.
|
|
21
|
-
apply_standard_settings(${BINARY_NAME})
|
|
22
|
-
|
|
23
|
-
# Add preprocessor definitions for the build version.
|
|
24
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
|
|
25
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
|
|
26
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
|
|
27
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
|
|
28
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
|
|
29
|
-
|
|
30
|
-
# Disable Windows macros that collide with C++ standard library functions.
|
|
31
|
-
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
|
32
|
-
|
|
33
|
-
# Add dependency libraries and include directories. Add any application-specific
|
|
34
|
-
# dependencies here.
|
|
35
|
-
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
|
|
36
|
-
target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
|
|
37
|
-
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
|
|
38
|
-
|
|
39
|
-
# Run the Flutter tool portions of the build. This must not be removed.
|
|
40
|
-
add_dependencies(${BINARY_NAME} flutter_assemble)
|
windows/runner/Runner.rc
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
// Microsoft Visual C++ generated resource script.
|
|
2
|
-
//
|
|
3
|
-
#pragma code_page(65001)
|
|
4
|
-
#include "resource.h"
|
|
5
|
-
|
|
6
|
-
#define APSTUDIO_READONLY_SYMBOLS
|
|
7
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
8
|
-
//
|
|
9
|
-
// Generated from the TEXTINCLUDE 2 resource.
|
|
10
|
-
//
|
|
11
|
-
#include "winres.h"
|
|
12
|
-
|
|
13
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
14
|
-
#undef APSTUDIO_READONLY_SYMBOLS
|
|
15
|
-
|
|
16
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
17
|
-
// English (United States) resources
|
|
18
|
-
|
|
19
|
-
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
|
20
|
-
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|
21
|
-
|
|
22
|
-
#ifdef APSTUDIO_INVOKED
|
|
23
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
24
|
-
//
|
|
25
|
-
// TEXTINCLUDE
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
1 TEXTINCLUDE
|
|
29
|
-
BEGIN
|
|
30
|
-
"resource.h\0"
|
|
31
|
-
END
|
|
32
|
-
|
|
33
|
-
2 TEXTINCLUDE
|
|
34
|
-
BEGIN
|
|
35
|
-
"#include ""winres.h""\r\n"
|
|
36
|
-
"\0"
|
|
37
|
-
END
|
|
38
|
-
|
|
39
|
-
3 TEXTINCLUDE
|
|
40
|
-
BEGIN
|
|
41
|
-
"\r\n"
|
|
42
|
-
"\0"
|
|
43
|
-
END
|
|
44
|
-
|
|
45
|
-
#endif // APSTUDIO_INVOKED
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
49
|
-
//
|
|
50
|
-
// Icon
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
// Icon with lowest ID value placed first to ensure application icon
|
|
54
|
-
// remains consistent on all systems.
|
|
55
|
-
IDI_APP_ICON ICON "resources\\app_icon.ico"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
59
|
-
//
|
|
60
|
-
// Version
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
|
|
64
|
-
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
|
|
65
|
-
#else
|
|
66
|
-
#define VERSION_AS_NUMBER 1,0,0,0
|
|
67
|
-
#endif
|
|
68
|
-
|
|
69
|
-
#if defined(FLUTTER_VERSION)
|
|
70
|
-
#define VERSION_AS_STRING FLUTTER_VERSION
|
|
71
|
-
#else
|
|
72
|
-
#define VERSION_AS_STRING "1.0.0"
|
|
73
|
-
#endif
|
|
74
|
-
|
|
75
|
-
VS_VERSION_INFO VERSIONINFO
|
|
76
|
-
FILEVERSION VERSION_AS_NUMBER
|
|
77
|
-
PRODUCTVERSION VERSION_AS_NUMBER
|
|
78
|
-
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
|
79
|
-
#ifdef _DEBUG
|
|
80
|
-
FILEFLAGS VS_FF_DEBUG
|
|
81
|
-
#else
|
|
82
|
-
FILEFLAGS 0x0L
|
|
83
|
-
#endif
|
|
84
|
-
FILEOS VOS__WINDOWS32
|
|
85
|
-
FILETYPE VFT_APP
|
|
86
|
-
FILESUBTYPE 0x0L
|
|
87
|
-
BEGIN
|
|
88
|
-
BLOCK "StringFileInfo"
|
|
89
|
-
BEGIN
|
|
90
|
-
BLOCK "040904e4"
|
|
91
|
-
BEGIN
|
|
92
|
-
VALUE "CompanyName", "sh.pyros" "\0"
|
|
93
|
-
VALUE "FileDescription", "only_bible_app" "\0"
|
|
94
|
-
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
|
95
|
-
VALUE "InternalName", "only_bible_app" "\0"
|
|
96
|
-
VALUE "LegalCopyright", "Copyright (C) 2023 sh.pyros. All rights reserved." "\0"
|
|
97
|
-
VALUE "OriginalFilename", "only_bible_app.exe" "\0"
|
|
98
|
-
VALUE "ProductName", "only_bible_app" "\0"
|
|
99
|
-
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
|
100
|
-
END
|
|
101
|
-
END
|
|
102
|
-
BLOCK "VarFileInfo"
|
|
103
|
-
BEGIN
|
|
104
|
-
VALUE "Translation", 0x409, 1252
|
|
105
|
-
END
|
|
106
|
-
END
|
|
107
|
-
|
|
108
|
-
#endif // English (United States) resources
|
|
109
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
#ifndef APSTUDIO_INVOKED
|
|
114
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
115
|
-
//
|
|
116
|
-
// Generated from the TEXTINCLUDE 3 resource.
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
121
|
-
#endif // not APSTUDIO_INVOKED
|
windows/runner/flutter_window.cpp
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#include "flutter_window.h"
|
|
2
|
-
|
|
3
|
-
#include <optional>
|
|
4
|
-
|
|
5
|
-
#include "flutter/generated_plugin_registrant.h"
|
|
6
|
-
|
|
7
|
-
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
|
|
8
|
-
: project_(project) {}
|
|
9
|
-
|
|
10
|
-
FlutterWindow::~FlutterWindow() {}
|
|
11
|
-
|
|
12
|
-
bool FlutterWindow::OnCreate() {
|
|
13
|
-
if (!Win32Window::OnCreate()) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
RECT frame = GetClientArea();
|
|
18
|
-
|
|
19
|
-
// The size here must match the window dimensions to avoid unnecessary surface
|
|
20
|
-
// creation / destruction in the startup path.
|
|
21
|
-
flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
|
|
22
|
-
frame.right - frame.left, frame.bottom - frame.top, project_);
|
|
23
|
-
// Ensure that basic setup of the controller was successful.
|
|
24
|
-
if (!flutter_controller_->engine() || !flutter_controller_->view()) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
RegisterPlugins(flutter_controller_->engine());
|
|
28
|
-
SetChildContent(flutter_controller_->view()->GetNativeWindow());
|
|
29
|
-
|
|
30
|
-
flutter_controller_->engine()->SetNextFrameCallback([&]() {
|
|
31
|
-
this->Show();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void FlutterWindow::OnDestroy() {
|
|
38
|
-
if (flutter_controller_) {
|
|
39
|
-
flutter_controller_ = nullptr;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Win32Window::OnDestroy();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
LRESULT
|
|
46
|
-
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
|
|
47
|
-
WPARAM const wparam,
|
|
48
|
-
LPARAM const lparam) noexcept {
|
|
49
|
-
// Give Flutter, including plugins, an opportunity to handle window messages.
|
|
50
|
-
if (flutter_controller_) {
|
|
51
|
-
std::optional<LRESULT> result =
|
|
52
|
-
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
|
|
53
|
-
lparam);
|
|
54
|
-
if (result) {
|
|
55
|
-
return *result;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
switch (message) {
|
|
60
|
-
case WM_FONTCHANGE:
|
|
61
|
-
flutter_controller_->engine()->ReloadSystemFonts();
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
|
|
66
|
-
}
|
windows/runner/flutter_window.h
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#ifndef RUNNER_FLUTTER_WINDOW_H_
|
|
2
|
-
#define RUNNER_FLUTTER_WINDOW_H_
|
|
3
|
-
|
|
4
|
-
#include <flutter/dart_project.h>
|
|
5
|
-
#include <flutter/flutter_view_controller.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
|
|
9
|
-
#include "win32_window.h"
|
|
10
|
-
|
|
11
|
-
// A window that does nothing but host a Flutter view.
|
|
12
|
-
class FlutterWindow : public Win32Window {
|
|
13
|
-
public:
|
|
14
|
-
// Creates a new FlutterWindow hosting a Flutter view running |project|.
|
|
15
|
-
explicit FlutterWindow(const flutter::DartProject& project);
|
|
16
|
-
virtual ~FlutterWindow();
|
|
17
|
-
|
|
18
|
-
protected:
|
|
19
|
-
// Win32Window:
|
|
20
|
-
bool OnCreate() override;
|
|
21
|
-
void OnDestroy() override;
|
|
22
|
-
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
|
|
23
|
-
LPARAM const lparam) noexcept override;
|
|
24
|
-
|
|
25
|
-
private:
|
|
26
|
-
// The project to run.
|
|
27
|
-
flutter::DartProject project_;
|
|
28
|
-
|
|
29
|
-
// The Flutter instance hosted by this window.
|
|
30
|
-
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
#endif // RUNNER_FLUTTER_WINDOW_H_
|
windows/runner/main.cpp
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#include <flutter/dart_project.h>
|
|
2
|
-
#include <flutter/flutter_view_controller.h>
|
|
3
|
-
#include <windows.h>
|
|
4
|
-
|
|
5
|
-
#include "flutter_window.h"
|
|
6
|
-
#include "utils.h"
|
|
7
|
-
|
|
8
|
-
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
|
9
|
-
_In_ wchar_t *command_line, _In_ int show_command) {
|
|
10
|
-
// Attach to console when present (e.g., 'flutter run') or create a
|
|
11
|
-
// new console when running with a debugger.
|
|
12
|
-
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
|
|
13
|
-
CreateAndAttachConsole();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Initialize COM, so that it is available for use in the library and/or
|
|
17
|
-
// plugins.
|
|
18
|
-
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
19
|
-
|
|
20
|
-
flutter::DartProject project(L"data");
|
|
21
|
-
|
|
22
|
-
std::vector<std::string> command_line_arguments =
|
|
23
|
-
GetCommandLineArguments();
|
|
24
|
-
|
|
25
|
-
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
|
|
26
|
-
|
|
27
|
-
FlutterWindow window(project);
|
|
28
|
-
Win32Window::Point origin(10, 10);
|
|
29
|
-
Win32Window::Size size(1280, 720);
|
|
30
|
-
if (!window.Create(L"only_bible_app", origin, size)) {
|
|
31
|
-
return EXIT_FAILURE;
|
|
32
|
-
}
|
|
33
|
-
window.SetQuitOnClose(true);
|
|
34
|
-
|
|
35
|
-
::MSG msg;
|
|
36
|
-
while (::GetMessage(&msg, nullptr, 0, 0)) {
|
|
37
|
-
::TranslateMessage(&msg);
|
|
38
|
-
::DispatchMessage(&msg);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
::CoUninitialize();
|
|
42
|
-
return EXIT_SUCCESS;
|
|
43
|
-
}
|
windows/runner/resource.h
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//{{NO_DEPENDENCIES}}
|
|
2
|
-
// Microsoft Visual C++ generated include file.
|
|
3
|
-
// Used by Runner.rc
|
|
4
|
-
//
|
|
5
|
-
#define IDI_APP_ICON 101
|
|
6
|
-
|
|
7
|
-
// Next default values for new objects
|
|
8
|
-
//
|
|
9
|
-
#ifdef APSTUDIO_INVOKED
|
|
10
|
-
#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
|
|
15
|
-
#endif
|
|
16
|
-
#endif
|
windows/runner/resources/app_icon.ico
DELETED
|
Binary file
|
windows/runner/runner.exe.manifest
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
-
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
|
3
|
-
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
|
4
|
-
<windowsSettings>
|
|
5
|
-
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
|
6
|
-
</windowsSettings>
|
|
7
|
-
</application>
|
|
8
|
-
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
|
9
|
-
<application>
|
|
10
|
-
<!-- Windows 10 and Windows 11 -->
|
|
11
|
-
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
|
12
|
-
<!-- Windows 8.1 -->
|
|
13
|
-
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
|
14
|
-
<!-- Windows 8 -->
|
|
15
|
-
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
|
16
|
-
<!-- Windows 7 -->
|
|
17
|
-
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
|
18
|
-
</application>
|
|
19
|
-
</compatibility>
|
|
20
|
-
</assembly>
|
windows/runner/utils.cpp
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#include "utils.h"
|
|
2
|
-
|
|
3
|
-
#include <flutter_windows.h>
|
|
4
|
-
#include <io.h>
|
|
5
|
-
#include <stdio.h>
|
|
6
|
-
#include <windows.h>
|
|
7
|
-
|
|
8
|
-
#include <iostream>
|
|
9
|
-
|
|
10
|
-
void CreateAndAttachConsole() {
|
|
11
|
-
if (::AllocConsole()) {
|
|
12
|
-
FILE *unused;
|
|
13
|
-
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
|
|
14
|
-
_dup2(_fileno(stdout), 1);
|
|
15
|
-
}
|
|
16
|
-
if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
|
|
17
|
-
_dup2(_fileno(stdout), 2);
|
|
18
|
-
}
|
|
19
|
-
std::ios::sync_with_stdio();
|
|
20
|
-
FlutterDesktopResyncOutputStreams();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
std::vector<std::string> GetCommandLineArguments() {
|
|
25
|
-
// Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
|
|
26
|
-
int argc;
|
|
27
|
-
wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
|
|
28
|
-
if (argv == nullptr) {
|
|
29
|
-
return std::vector<std::string>();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
std::vector<std::string> command_line_arguments;
|
|
33
|
-
|
|
34
|
-
// Skip the first argument as it's the binary name.
|
|
35
|
-
for (int i = 1; i < argc; i++) {
|
|
36
|
-
command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
::LocalFree(argv);
|
|
40
|
-
|
|
41
|
-
return command_line_arguments;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
std::string Utf8FromUtf16(const wchar_t* utf16_string) {
|
|
45
|
-
if (utf16_string == nullptr) {
|
|
46
|
-
return std::string();
|
|
47
|
-
}
|
|
48
|
-
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
|
|
52
|
-
int input_length = (int)wcslen(utf16_string);
|
|
53
|
-
std::string utf8_string;
|
|
54
|
-
if (target_length <= 0 || target_length > utf8_string.max_size()) {
|
|
55
|
-
return utf8_string;
|
|
56
|
-
}
|
|
57
|
-
utf8_string.resize(target_length);
|
|
58
|
-
int converted_length = ::WideCharToMultiByte(
|
|
59
|
-
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
|
|
60
|
-
input_length, utf8_string.data(), target_length, nullptr, nullptr);
|
|
61
|
-
if (converted_length == 0) {
|
|
62
|
-
return std::string();
|
|
63
|
-
}
|
|
64
|
-
return utf8_string;
|
|
65
|
-
}
|
windows/runner/utils.h
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#ifndef RUNNER_UTILS_H_
|
|
2
|
-
#define RUNNER_UTILS_H_
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <vector>
|
|
6
|
-
|
|
7
|
-
// Creates a console for the process, and redirects stdout and stderr to
|
|
8
|
-
// it for both the runner and the Flutter library.
|
|
9
|
-
void CreateAndAttachConsole();
|
|
10
|
-
|
|
11
|
-
// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
|
|
12
|
-
// encoded in UTF-8. Returns an empty std::string on failure.
|
|
13
|
-
std::string Utf8FromUtf16(const wchar_t* utf16_string);
|
|
14
|
-
|
|
15
|
-
// Gets the command line arguments passed in as a std::vector<std::string>,
|
|
16
|
-
// encoded in UTF-8. Returns an empty std::vector<std::string> on failure.
|
|
17
|
-
std::vector<std::string> GetCommandLineArguments();
|
|
18
|
-
|
|
19
|
-
#endif // RUNNER_UTILS_H_
|
windows/runner/win32_window.cpp
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
#include "win32_window.h"
|
|
2
|
-
|
|
3
|
-
#include <dwmapi.h>
|
|
4
|
-
#include <flutter_windows.h>
|
|
5
|
-
|
|
6
|
-
#include "resource.h"
|
|
7
|
-
|
|
8
|
-
namespace {
|
|
9
|
-
|
|
10
|
-
/// Window attribute that enables dark mode window decorations.
|
|
11
|
-
///
|
|
12
|
-
/// Redefined in case the developer's machine has a Windows SDK older than
|
|
13
|
-
/// version 10.0.22000.0.
|
|
14
|
-
/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
|
|
15
|
-
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
|
|
16
|
-
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
|
|
20
|
-
|
|
21
|
-
/// Registry key for app theme preference.
|
|
22
|
-
///
|
|
23
|
-
/// A value of 0 indicates apps should use dark mode. A non-zero or missing
|
|
24
|
-
/// value indicates apps should use light mode.
|
|
25
|
-
constexpr const wchar_t kGetPreferredBrightnessRegKey[] =
|
|
26
|
-
L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
|
|
27
|
-
constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme";
|
|
28
|
-
|
|
29
|
-
// The number of Win32Window objects that currently exist.
|
|
30
|
-
static int g_active_window_count = 0;
|
|
31
|
-
|
|
32
|
-
using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
|
|
33
|
-
|
|
34
|
-
// Scale helper to convert logical scaler values to physical using passed in
|
|
35
|
-
// scale factor
|
|
36
|
-
int Scale(int source, double scale_factor) {
|
|
37
|
-
return static_cast<int>(source * scale_factor);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
|
|
41
|
-
// This API is only needed for PerMonitor V1 awareness mode.
|
|
42
|
-
void EnableFullDpiSupportIfAvailable(HWND hwnd) {
|
|
43
|
-
HMODULE user32_module = LoadLibraryA("User32.dll");
|
|
44
|
-
if (!user32_module) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
auto enable_non_client_dpi_scaling =
|
|
48
|
-
reinterpret_cast<EnableNonClientDpiScaling*>(
|
|
49
|
-
GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
|
|
50
|
-
if (enable_non_client_dpi_scaling != nullptr) {
|
|
51
|
-
enable_non_client_dpi_scaling(hwnd);
|
|
52
|
-
}
|
|
53
|
-
FreeLibrary(user32_module);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
} // namespace
|
|
57
|
-
|
|
58
|
-
// Manages the Win32Window's window class registration.
|
|
59
|
-
class WindowClassRegistrar {
|
|
60
|
-
public:
|
|
61
|
-
~WindowClassRegistrar() = default;
|
|
62
|
-
|
|
63
|
-
// Returns the singleton registrar instance.
|
|
64
|
-
static WindowClassRegistrar* GetInstance() {
|
|
65
|
-
if (!instance_) {
|
|
66
|
-
instance_ = new WindowClassRegistrar();
|
|
67
|
-
}
|
|
68
|
-
return instance_;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Returns the name of the window class, registering the class if it hasn't
|
|
72
|
-
// previously been registered.
|
|
73
|
-
const wchar_t* GetWindowClass();
|
|
74
|
-
|
|
75
|
-
// Unregisters the window class. Should only be called if there are no
|
|
76
|
-
// instances of the window.
|
|
77
|
-
void UnregisterWindowClass();
|
|
78
|
-
|
|
79
|
-
private:
|
|
80
|
-
WindowClassRegistrar() = default;
|
|
81
|
-
|
|
82
|
-
static WindowClassRegistrar* instance_;
|
|
83
|
-
|
|
84
|
-
bool class_registered_ = false;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
|
|
88
|
-
|
|
89
|
-
const wchar_t* WindowClassRegistrar::GetWindowClass() {
|
|
90
|
-
if (!class_registered_) {
|
|
91
|
-
WNDCLASS window_class{};
|
|
92
|
-
window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
|
93
|
-
window_class.lpszClassName = kWindowClassName;
|
|
94
|
-
window_class.style = CS_HREDRAW | CS_VREDRAW;
|
|
95
|
-
window_class.cbClsExtra = 0;
|
|
96
|
-
window_class.cbWndExtra = 0;
|
|
97
|
-
window_class.hInstance = GetModuleHandle(nullptr);
|
|
98
|
-
window_class.hIcon =
|
|
99
|
-
LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
|
|
100
|
-
window_class.hbrBackground = 0;
|
|
101
|
-
window_class.lpszMenuName = nullptr;
|
|
102
|
-
window_class.lpfnWndProc = Win32Window::WndProc;
|
|
103
|
-
RegisterClass(&window_class);
|
|
104
|
-
class_registered_ = true;
|
|
105
|
-
}
|
|
106
|
-
return kWindowClassName;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
void WindowClassRegistrar::UnregisterWindowClass() {
|
|
110
|
-
UnregisterClass(kWindowClassName, nullptr);
|
|
111
|
-
class_registered_ = false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
Win32Window::Win32Window() {
|
|
115
|
-
++g_active_window_count;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
Win32Window::~Win32Window() {
|
|
119
|
-
--g_active_window_count;
|
|
120
|
-
Destroy();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
bool Win32Window::Create(const std::wstring& title,
|
|
124
|
-
const Point& origin,
|
|
125
|
-
const Size& size) {
|
|
126
|
-
Destroy();
|
|
127
|
-
|
|
128
|
-
const wchar_t* window_class =
|
|
129
|
-
WindowClassRegistrar::GetInstance()->GetWindowClass();
|
|
130
|
-
|
|
131
|
-
const POINT target_point = {static_cast<LONG>(origin.x),
|
|
132
|
-
static_cast<LONG>(origin.y)};
|
|
133
|
-
HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
|
|
134
|
-
UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
|
|
135
|
-
double scale_factor = dpi / 96.0;
|
|
136
|
-
|
|
137
|
-
HWND window = CreateWindow(
|
|
138
|
-
window_class, title.c_str(), WS_OVERLAPPEDWINDOW,
|
|
139
|
-
Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
|
|
140
|
-
Scale(size.width, scale_factor), Scale(size.height, scale_factor),
|
|
141
|
-
nullptr, nullptr, GetModuleHandle(nullptr), this);
|
|
142
|
-
|
|
143
|
-
if (!window) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
UpdateTheme(window);
|
|
148
|
-
|
|
149
|
-
return OnCreate();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
bool Win32Window::Show() {
|
|
153
|
-
return ShowWindow(window_handle_, SW_SHOWNORMAL);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// static
|
|
157
|
-
LRESULT CALLBACK Win32Window::WndProc(HWND const window,
|
|
158
|
-
UINT const message,
|
|
159
|
-
WPARAM const wparam,
|
|
160
|
-
LPARAM const lparam) noexcept {
|
|
161
|
-
if (message == WM_NCCREATE) {
|
|
162
|
-
auto window_struct = reinterpret_cast<CREATESTRUCT*>(lparam);
|
|
163
|
-
SetWindowLongPtr(window, GWLP_USERDATA,
|
|
164
|
-
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams));
|
|
165
|
-
|
|
166
|
-
auto that = static_cast<Win32Window*>(window_struct->lpCreateParams);
|
|
167
|
-
EnableFullDpiSupportIfAvailable(window);
|
|
168
|
-
that->window_handle_ = window;
|
|
169
|
-
} else if (Win32Window* that = GetThisFromHandle(window)) {
|
|
170
|
-
return that->MessageHandler(window, message, wparam, lparam);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return DefWindowProc(window, message, wparam, lparam);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
LRESULT
|
|
177
|
-
Win32Window::MessageHandler(HWND hwnd,
|
|
178
|
-
UINT const message,
|
|
179
|
-
WPARAM const wparam,
|
|
180
|
-
LPARAM const lparam) noexcept {
|
|
181
|
-
switch (message) {
|
|
182
|
-
case WM_DESTROY:
|
|
183
|
-
window_handle_ = nullptr;
|
|
184
|
-
Destroy();
|
|
185
|
-
if (quit_on_close_) {
|
|
186
|
-
PostQuitMessage(0);
|
|
187
|
-
}
|
|
188
|
-
return 0;
|
|
189
|
-
|
|
190
|
-
case WM_DPICHANGED: {
|
|
191
|
-
auto newRectSize = reinterpret_cast<RECT*>(lparam);
|
|
192
|
-
LONG newWidth = newRectSize->right - newRectSize->left;
|
|
193
|
-
LONG newHeight = newRectSize->bottom - newRectSize->top;
|
|
194
|
-
|
|
195
|
-
SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
|
|
196
|
-
newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
|
|
197
|
-
|
|
198
|
-
return 0;
|
|
199
|
-
}
|
|
200
|
-
case WM_SIZE: {
|
|
201
|
-
RECT rect = GetClientArea();
|
|
202
|
-
if (child_content_ != nullptr) {
|
|
203
|
-
// Size and position the child window.
|
|
204
|
-
MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
|
|
205
|
-
rect.bottom - rect.top, TRUE);
|
|
206
|
-
}
|
|
207
|
-
return 0;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
case WM_ACTIVATE:
|
|
211
|
-
if (child_content_ != nullptr) {
|
|
212
|
-
SetFocus(child_content_);
|
|
213
|
-
}
|
|
214
|
-
return 0;
|
|
215
|
-
|
|
216
|
-
case WM_DWMCOLORIZATIONCOLORCHANGED:
|
|
217
|
-
UpdateTheme(hwnd);
|
|
218
|
-
return 0;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return DefWindowProc(window_handle_, message, wparam, lparam);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
void Win32Window::Destroy() {
|
|
225
|
-
OnDestroy();
|
|
226
|
-
|
|
227
|
-
if (window_handle_) {
|
|
228
|
-
DestroyWindow(window_handle_);
|
|
229
|
-
window_handle_ = nullptr;
|
|
230
|
-
}
|
|
231
|
-
if (g_active_window_count == 0) {
|
|
232
|
-
WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
|
|
237
|
-
return reinterpret_cast<Win32Window*>(
|
|
238
|
-
GetWindowLongPtr(window, GWLP_USERDATA));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
void Win32Window::SetChildContent(HWND content) {
|
|
242
|
-
child_content_ = content;
|
|
243
|
-
SetParent(content, window_handle_);
|
|
244
|
-
RECT frame = GetClientArea();
|
|
245
|
-
|
|
246
|
-
MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
|
|
247
|
-
frame.bottom - frame.top, true);
|
|
248
|
-
|
|
249
|
-
SetFocus(child_content_);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
RECT Win32Window::GetClientArea() {
|
|
253
|
-
RECT frame;
|
|
254
|
-
GetClientRect(window_handle_, &frame);
|
|
255
|
-
return frame;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
HWND Win32Window::GetHandle() {
|
|
259
|
-
return window_handle_;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
void Win32Window::SetQuitOnClose(bool quit_on_close) {
|
|
263
|
-
quit_on_close_ = quit_on_close;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
bool Win32Window::OnCreate() {
|
|
267
|
-
// No-op; provided for subclasses.
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
void Win32Window::OnDestroy() {
|
|
272
|
-
// No-op; provided for subclasses.
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
void Win32Window::UpdateTheme(HWND const window) {
|
|
276
|
-
DWORD light_mode;
|
|
277
|
-
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);
|
|
282
|
-
|
|
283
|
-
if (result == ERROR_SUCCESS) {
|
|
284
|
-
BOOL enable_dark_mode = light_mode == 0;
|
|
285
|
-
DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE,
|
|
286
|
-
&enable_dark_mode, sizeof(enable_dark_mode));
|
|
287
|
-
}
|
|
288
|
-
}
|
windows/runner/win32_window.h
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#ifndef RUNNER_WIN32_WINDOW_H_
|
|
2
|
-
#define RUNNER_WIN32_WINDOW_H_
|
|
3
|
-
|
|
4
|
-
#include <windows.h>
|
|
5
|
-
|
|
6
|
-
#include <functional>
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
|
|
10
|
-
// A class abstraction for a high DPI-aware Win32 Window. Intended to be
|
|
11
|
-
// inherited from by classes that wish to specialize with custom
|
|
12
|
-
// rendering and input handling
|
|
13
|
-
class Win32Window {
|
|
14
|
-
public:
|
|
15
|
-
struct Point {
|
|
16
|
-
unsigned int x;
|
|
17
|
-
unsigned int y;
|
|
18
|
-
Point(unsigned int x, unsigned int y) : x(x), y(y) {}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
struct Size {
|
|
22
|
-
unsigned int width;
|
|
23
|
-
unsigned int height;
|
|
24
|
-
Size(unsigned int width, unsigned int height)
|
|
25
|
-
: width(width), height(height) {}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
Win32Window();
|
|
29
|
-
virtual ~Win32Window();
|
|
30
|
-
|
|
31
|
-
// Creates a win32 window with |title| that is positioned and sized using
|
|
32
|
-
// |origin| and |size|. New windows are created on the default monitor. Window
|
|
33
|
-
// sizes are specified to the OS in physical pixels, hence to ensure a
|
|
34
|
-
// consistent size this function will scale the inputted width and height as
|
|
35
|
-
// as appropriate for the default monitor. The window is invisible until
|
|
36
|
-
// |Show| is called. Returns true if the window was created successfully.
|
|
37
|
-
bool Create(const std::wstring& title, const Point& origin, const Size& size);
|
|
38
|
-
|
|
39
|
-
// Show the current window. Returns true if the window was successfully shown.
|
|
40
|
-
bool Show();
|
|
41
|
-
|
|
42
|
-
// Release OS resources associated with window.
|
|
43
|
-
void Destroy();
|
|
44
|
-
|
|
45
|
-
// Inserts |content| into the window tree.
|
|
46
|
-
void SetChildContent(HWND content);
|
|
47
|
-
|
|
48
|
-
// Returns the backing Window handle to enable clients to set icon and other
|
|
49
|
-
// window properties. Returns nullptr if the window has been destroyed.
|
|
50
|
-
HWND GetHandle();
|
|
51
|
-
|
|
52
|
-
// If true, closing this window will quit the application.
|
|
53
|
-
void SetQuitOnClose(bool quit_on_close);
|
|
54
|
-
|
|
55
|
-
// Return a RECT representing the bounds of the current client area.
|
|
56
|
-
RECT GetClientArea();
|
|
57
|
-
|
|
58
|
-
protected:
|
|
59
|
-
// Processes and route salient window messages for mouse handling,
|
|
60
|
-
// size change and DPI. Delegates handling of these to member overloads that
|
|
61
|
-
// inheriting classes can handle.
|
|
62
|
-
virtual LRESULT MessageHandler(HWND window,
|
|
63
|
-
UINT const message,
|
|
64
|
-
WPARAM const wparam,
|
|
65
|
-
LPARAM const lparam) noexcept;
|
|
66
|
-
|
|
67
|
-
// Called when CreateAndShow is called, allowing subclass window-related
|
|
68
|
-
// setup. Subclasses should return false if setup fails.
|
|
69
|
-
virtual bool OnCreate();
|
|
70
|
-
|
|
71
|
-
// Called when Destroy is called.
|
|
72
|
-
virtual void OnDestroy();
|
|
73
|
-
|
|
74
|
-
private:
|
|
75
|
-
friend class WindowClassRegistrar;
|
|
76
|
-
|
|
77
|
-
// OS callback called by message pump. Handles the WM_NCCREATE message which
|
|
78
|
-
// is passed when the non-client area is being created and enables automatic
|
|
79
|
-
// non-client DPI scaling so that the non-client area automatically
|
|
80
|
-
// responds to changes in DPI. All other messages are handled by
|
|
81
|
-
// MessageHandler.
|
|
82
|
-
static LRESULT CALLBACK WndProc(HWND const window,
|
|
83
|
-
UINT const message,
|
|
84
|
-
WPARAM const wparam,
|
|
85
|
-
LPARAM const lparam) noexcept;
|
|
86
|
-
|
|
87
|
-
// Retrieves a class instance pointer for |window|
|
|
88
|
-
static Win32Window* GetThisFromHandle(HWND const window) noexcept;
|
|
89
|
-
|
|
90
|
-
// Update the window frame's theme to match the system theme.
|
|
91
|
-
static void UpdateTheme(HWND const window);
|
|
92
|
-
|
|
93
|
-
bool quit_on_close_ = false;
|
|
94
|
-
|
|
95
|
-
// window handle for top level window.
|
|
96
|
-
HWND window_handle_ = nullptr;
|
|
97
|
-
|
|
98
|
-
// window handle for hosted content.
|
|
99
|
-
HWND child_content_ = nullptr;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
#endif // RUNNER_WIN32_WINDOW_H_
|