From 76820f8e86cd334c3b5b8d35f59539f9cdd21261 Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Sun, 13 Jul 2025 13:49:32 -0300 Subject: [PATCH 1/7] update to find cc src files in runner subdirectory --- linux/target_modifier/modify_target.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linux/target_modifier/modify_target.sh b/linux/target_modifier/modify_target.sh index f42bde76..670aee5e 100755 --- a/linux/target_modifier/modify_target.sh +++ b/linux/target_modifier/modify_target.sh @@ -8,9 +8,9 @@ scriptdir=$(cd $(dirname $0); pwd -P) echo "Modifying target cc files..." -bash $scriptdir/tools/import_webview_cef_header_my_application.sh "$program_path/linux/my_application.cc" -bash $scriptdir/tools/add_key_release_event_to_my_application.sh "$program_path/linux/my_application.cc" -bash $scriptdir/tools/add_key_press_event_to_my_application.sh "$program_path/linux/my_application.cc" +bash $scriptdir/tools/import_webview_cef_header_my_application.sh "$program_path/linux/runner/my_application.cc" +bash $scriptdir/tools/add_key_release_event_to_my_application.sh "$program_path/linux/runner/my_application.cc" +bash $scriptdir/tools/add_key_press_event_to_my_application.sh "$program_path/linux/runner/my_application.cc" -bash $scriptdir/tools/import_webview_cef_header_main.sh "$program_path/linux/main.cc" -bash $scriptdir/tools/add_webview_init_to_main.sh "$program_path/linux/main.cc" +bash $scriptdir/tools/import_webview_cef_header_main.sh "$program_path/linux/runner/main.cc" +bash $scriptdir/tools/add_webview_init_to_main.sh "$program_path/linux/runner/main.cc" From d62fa0907f188962ca2b9851c22b0f52d21aba76 Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Sun, 13 Jul 2025 13:50:39 -0300 Subject: [PATCH 2/7] change to linking GTKMM in CMake --- linux/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 1af6a673..bd2cb7dd 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -26,6 +26,9 @@ set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../third/cef") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake") find_package(CEF REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED gtkmm-3.0) + # This value is used when generating builds using this plugin, so it must # not be changed. set(PLUGIN_NAME "webview_cef_plugin") @@ -69,7 +72,7 @@ target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) -target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) +target_link_libraries(${PLUGIN_NAME} PRIVATE ${GTKMM_LIBRARIES}) target_include_directories(${PLUGIN_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../common") From fca3a99e74693dba363f41cc4edfd504852cd85b Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Sun, 13 Jul 2025 14:37:10 -0300 Subject: [PATCH 3/7] update CEF version (untested on Windows) --- common/webview_handler.cc | 1 + common/webview_handler.h | 1 + third/download.cmake | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/webview_handler.cc b/common/webview_handler.cc index 71bc682f..9cfe8ec3 100644 --- a/common/webview_handler.cc +++ b/common/webview_handler.cc @@ -167,6 +167,7 @@ void WebviewHandler::OnBeforeClose(CefRefPtr browser) { bool WebviewHandler::OnBeforePopup(CefRefPtr browser, CefRefPtr frame, + int popup_id, const CefString& target_url, const CefString& target_frame_name, WindowOpenDisposition target_disposition, diff --git a/common/webview_handler.h b/common/webview_handler.h index 7c3c95e4..501f251a 100644 --- a/common/webview_handler.h +++ b/common/webview_handler.h @@ -98,6 +98,7 @@ public CefRenderHandler{ virtual void OnBeforeClose(CefRefPtr browser) override; virtual bool OnBeforePopup(CefRefPtr browser, CefRefPtr frame, + int popup_id, const CefString& target_url, const CefString& target_frame_name, WindowOpenDisposition target_disposition, diff --git a/third/download.cmake b/third/download.cmake index 8f2c964b..26d2e1d4 100644 --- a/third/download.cmake +++ b/third/download.cmake @@ -1,22 +1,20 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") message(WARNING "current system is Linux") if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64") - set(cef_prebuilt_path "https://cef-builds.spotifycdn.com/cef_binary_130.1.2%2Bg48f3ef6%2Bchromium-130.0.6723.44_linuxarm64.tar.bz2") - set(cef_prebuilt_version "cef_binary_130.1.2%2Bg48f3ef6%2Bchromium-130.0.6723.44_linuxarm64.tar.bz2") + set(cef_prebuilt_path "https://cef-builds.spotifycdn.com/cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_linuxarm64.tar.bz2") + set(cef_prebuilt_version "cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_linuxarm64") else() - set(cef_prebuilt_path "https://cef-builds.spotifycdn.com/cef_binary_130.1.2%2Bg48f3ef6%2Bchromium-130.0.6723.44_linux64.tar.bz2") - set(cef_prebuilt_version "cef_binary_130.1.2%2Bg48f3ef6%2Bchromium-130.0.6723.44_linux64.tar.bz2") + set(cef_prebuilt_path "https://cef-builds.spotifycdn.com/cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_linux64.tar.bz2") + set(cef_prebuilt_version "cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_linux64") endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") message(WARNING "current system is Windows") - set(cef_prebuilt_path "https://github.com/hlwhl/webview_cef/releases/download/prebuilt_cef_bin_linux/webview_cef_bin_0.0.2_101.0.18+chromium-101.0.4951.67_windows64.zip") - set(cef_prebuilt_version "webview_cef_bin_0.0.2_101.0.18+chromium-101.0.4951.67_windows64") + set(cef_prebuilt_path "https://cef-builds.spotifycdn.com/cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_windows64.tar.bz2") + set(cef_prebuilt_version "cef_binary_138.0.21%2Bg54811fe%2Bchromium-138.0.7204.101_windows64") # elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # message(STATUS "current system is MacOS") # set(cef_prebuilt_path "") endif() -set(cef_prebuilt_version_path "https://github.com/hlwhl/webview_cef/releases/download/prebuilt_cef_bin_linux/version.txt") - function(extract_file filename extract_dir) message(WARNING "${filename} will extract to ${extract_dir} ...") From c129fbf06137d6bc2440d78acfa6fec0fd8d8eef Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Sun, 13 Jul 2025 16:36:00 -0300 Subject: [PATCH 4/7] deal with being passed null parameter --- lib/src/webview_manager.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/webview_manager.dart b/lib/src/webview_manager.dart index f9ee6fa9..ebfe8c0e 100644 --- a/lib/src/webview_manager.dart +++ b/lib/src/webview_manager.dart @@ -34,7 +34,7 @@ class WebviewManager extends ValueNotifier { final controller = WebViewController(pluginChannel, browserIndex, loading: loading); _tempWebViews[browserIndex] = controller; - _tempInjectUserScripts[browserIndex] = injectUserScripts; + _tempInjectUserScripts[browserIndex] = injectUserScripts ?? InjectUserScripts(); return controller; } From fa839323e57a05dd1fc04fdd55922cc1ce2d0962 Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Thu, 24 Jul 2025 13:46:27 -0300 Subject: [PATCH 5/7] revert adding gtkmm as dependency --- linux/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index bd2cb7dd..c3de92b0 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -27,7 +27,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake") find_package(CEF REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED gtkmm-3.0) +pkg_check_modules(GTK REQUIRED gtk+-3.0) # This value is used when generating builds using this plugin, so it must # not be changed. @@ -72,7 +72,7 @@ target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) -target_link_libraries(${PLUGIN_NAME} PRIVATE ${GTKMM_LIBRARIES}) +target_link_libraries(${PLUGIN_NAME} PRIVATE ${GTK_LIBRARIES}) target_include_directories(${PLUGIN_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../common") From ad8c0d8d66609bc5aa6057171078a3e8c6d9e108 Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Thu, 24 Jul 2025 14:17:31 -0300 Subject: [PATCH 6/7] update target modifier scripts to check for src files in older projects default directory --- .../add_key_press_event_to_my_application.sh | 15 ++++++++++++--- .../add_key_release_event_to_my_application.sh | 15 ++++++++++++--- .../tools/add_webview_init_to_main.sh | 15 ++++++++++++--- .../tools/import_webview_cef_header_main.sh | 15 ++++++++++++--- .../import_webview_cef_header_my_application.sh | 15 ++++++++++++--- 5 files changed, 60 insertions(+), 15 deletions(-) diff --git a/linux/target_modifier/tools/add_key_press_event_to_my_application.sh b/linux/target_modifier/tools/add_key_press_event_to_my_application.sh index fcf94b5b..89e42d3b 100755 --- a/linux/target_modifier/tools/add_key_press_event_to_my_application.sh +++ b/linux/target_modifier/tools/add_key_press_event_to_my_application.sh @@ -15,10 +15,19 @@ fi # Assign file path argument file="$1" -# Check if the file exists +# Check if the file exists at the provided path if [ ! -f "$file" ]; then - echo "File not found: $file" - exit 1 + # If not, construct a path in the parent directory with the same filename + parent_dir_file=$(dirname "$(dirname $file)")/$(basename "$file") + + # Check if the file exists at the new path + if [ -f "$parent_dir_file" ]; then + file="$parent_dir_file" # Use the new path if it exists + else + # If neither path is valid, exit + echo "File not found at '$original_path' or in its parent directory." + exit 1 + fi fi # Check if the line g_signal_connect exists in the file diff --git a/linux/target_modifier/tools/add_key_release_event_to_my_application.sh b/linux/target_modifier/tools/add_key_release_event_to_my_application.sh index dca9ffa9..58a9eda6 100755 --- a/linux/target_modifier/tools/add_key_release_event_to_my_application.sh +++ b/linux/target_modifier/tools/add_key_release_event_to_my_application.sh @@ -15,10 +15,19 @@ fi # Assign file path argument file="$1" -# Check if the file exists +# Check if the file exists at the provided path if [ ! -f "$file" ]; then - echo "File not found: $file" - exit 1 + # If not, construct a path in the parent directory with the same filename + parent_dir_file=$(dirname "$(dirname $file)")/$(basename "$file") + + # Check if the file exists at the new path + if [ -f "$parent_dir_file" ]; then + file="$parent_dir_file" # Use the new path if it exists + else + # If neither path is valid, exit + echo "File not found at '$original_path' or in its parent directory." + exit 1 + fi fi # Check if the line g_signal_connect exists in the file diff --git a/linux/target_modifier/tools/add_webview_init_to_main.sh b/linux/target_modifier/tools/add_webview_init_to_main.sh index 13fe89bd..d1f26d0a 100755 --- a/linux/target_modifier/tools/add_webview_init_to_main.sh +++ b/linux/target_modifier/tools/add_webview_init_to_main.sh @@ -13,10 +13,19 @@ fi # Assign file path argument file="$1" -# Check if the file exists +# Check if the file exists at the provided path if [ ! -f "$file" ]; then - echo "File not found: $file" - exit 1 + # If not, construct a path in the parent directory with the same filename + parent_dir_file=$(dirname "$(dirname $file)")/$(basename "$file") + + # Check if the file exists at the new path + if [ -f "$parent_dir_file" ]; then + file="$parent_dir_file" # Use the new path if it exists + else + # If neither path is valid, exit + echo "File not found at '$original_path' or in its parent directory." + exit 1 + fi fi # Check if the line initCEFProcesses(argc, argv); already exists in the file diff --git a/linux/target_modifier/tools/import_webview_cef_header_main.sh b/linux/target_modifier/tools/import_webview_cef_header_main.sh index 8e115fab..d8ddde38 100755 --- a/linux/target_modifier/tools/import_webview_cef_header_main.sh +++ b/linux/target_modifier/tools/import_webview_cef_header_main.sh @@ -11,10 +11,19 @@ fi # Assign file path argument file="$1" -# Check if the file exists +# Check if the file exists at the provided path if [ ! -f "$file" ]; then - echo "File not found: $file" - exit 1 + # If not, construct a path in the parent directory with the same filename + parent_dir_file=$(dirname "$(dirname $file)")/$(basename "$file") + + # Check if the file exists at the new path + if [ -f "$parent_dir_file" ]; then + file="$parent_dir_file" # Use the new path if it exists + else + # If neither path is valid, exit + echo "File not found at '$original_path' or in its parent directory." + exit 1 + fi fi # Check if the line already exists in the file diff --git a/linux/target_modifier/tools/import_webview_cef_header_my_application.sh b/linux/target_modifier/tools/import_webview_cef_header_my_application.sh index e47959d4..716d77e2 100755 --- a/linux/target_modifier/tools/import_webview_cef_header_my_application.sh +++ b/linux/target_modifier/tools/import_webview_cef_header_my_application.sh @@ -15,10 +15,19 @@ fi # Assign file path argument file="$1" -# Check if the file exists +# Check if the file exists at the provided path if [ ! -f "$file" ]; then - echo "File not found: $file" - exit 1 + # If not, construct a path in the parent directory with the same filename + parent_dir_file=$(dirname "$(dirname $file)")/$(basename "$file") + + # Check if the file exists at the new path + if [ -f "$parent_dir_file" ]; then + file="$parent_dir_file" # Use the new path if it exists + else + # If neither path is valid, exit + echo "File not found at '$original_path' or in its parent directory." + exit 1 + fi fi # Check if the line already exists in the file From 6027d34441a21f3ecd279c99d57618fc86bb4297 Mon Sep 17 00:00:00 2001 From: Ben Waver Date: Sat, 9 Aug 2025 16:24:56 -0300 Subject: [PATCH 7/7] fix variable reference in target modifier scripts --- .../tools/add_key_press_event_to_my_application.sh | 2 +- .../tools/add_key_release_event_to_my_application.sh | 2 +- linux/target_modifier/tools/add_webview_init_to_main.sh | 2 +- linux/target_modifier/tools/import_webview_cef_header_main.sh | 2 +- .../tools/import_webview_cef_header_my_application.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux/target_modifier/tools/add_key_press_event_to_my_application.sh b/linux/target_modifier/tools/add_key_press_event_to_my_application.sh index 89e42d3b..a38eb29f 100755 --- a/linux/target_modifier/tools/add_key_press_event_to_my_application.sh +++ b/linux/target_modifier/tools/add_key_press_event_to_my_application.sh @@ -25,7 +25,7 @@ if [ ! -f "$file" ]; then file="$parent_dir_file" # Use the new path if it exists else # If neither path is valid, exit - echo "File not found at '$original_path' or in its parent directory." + echo "File not found at '$file' or in its parent directory." exit 1 fi fi diff --git a/linux/target_modifier/tools/add_key_release_event_to_my_application.sh b/linux/target_modifier/tools/add_key_release_event_to_my_application.sh index 58a9eda6..b0fcb768 100755 --- a/linux/target_modifier/tools/add_key_release_event_to_my_application.sh +++ b/linux/target_modifier/tools/add_key_release_event_to_my_application.sh @@ -25,7 +25,7 @@ if [ ! -f "$file" ]; then file="$parent_dir_file" # Use the new path if it exists else # If neither path is valid, exit - echo "File not found at '$original_path' or in its parent directory." + echo "File not found at '$file' or in its parent directory." exit 1 fi fi diff --git a/linux/target_modifier/tools/add_webview_init_to_main.sh b/linux/target_modifier/tools/add_webview_init_to_main.sh index d1f26d0a..12bbf215 100755 --- a/linux/target_modifier/tools/add_webview_init_to_main.sh +++ b/linux/target_modifier/tools/add_webview_init_to_main.sh @@ -23,7 +23,7 @@ if [ ! -f "$file" ]; then file="$parent_dir_file" # Use the new path if it exists else # If neither path is valid, exit - echo "File not found at '$original_path' or in its parent directory." + echo "File not found at '$file' or in its parent directory." exit 1 fi fi diff --git a/linux/target_modifier/tools/import_webview_cef_header_main.sh b/linux/target_modifier/tools/import_webview_cef_header_main.sh index d8ddde38..00f685df 100755 --- a/linux/target_modifier/tools/import_webview_cef_header_main.sh +++ b/linux/target_modifier/tools/import_webview_cef_header_main.sh @@ -21,7 +21,7 @@ if [ ! -f "$file" ]; then file="$parent_dir_file" # Use the new path if it exists else # If neither path is valid, exit - echo "File not found at '$original_path' or in its parent directory." + echo "File not found at '$file' or in its parent directory." exit 1 fi fi diff --git a/linux/target_modifier/tools/import_webview_cef_header_my_application.sh b/linux/target_modifier/tools/import_webview_cef_header_my_application.sh index 716d77e2..d1c24fc1 100755 --- a/linux/target_modifier/tools/import_webview_cef_header_my_application.sh +++ b/linux/target_modifier/tools/import_webview_cef_header_my_application.sh @@ -25,7 +25,7 @@ if [ ! -f "$file" ]; then file="$parent_dir_file" # Use the new path if it exists else # If neither path is valid, exit - echo "File not found at '$original_path' or in its parent directory." + echo "File not found at '$file' or in its parent directory." exit 1 fi fi