Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions packages/desktop_webview_window/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.5

* Add support for `registerJavaScriptMessageHandler` and `unregisterJavaScriptMessageHandler` on
Linux. Use `window.webkit.messageHandlers.<handlerName>.postMessage(<message>)` in js

## 0.2.4

* Add backward compatibility with webkit2gtk-4.0 on Linux
Expand All @@ -9,16 +14,22 @@
## 0.2.2

* fix memory leak on macOS after close webview window.
* Show and Hide Webview window by [@Iri-Hor](https://github.com/Iri-Hor) in [#268](https://github.com/MixinNetwork/flutter-plugins/pull/268)
* Show and Hide Webview window by [@Iri-Hor](https://github.com/Iri-Hor)
in [#268](https://github.com/MixinNetwork/flutter-plugins/pull/268)

## 0.2.1

* add Windows attentions to readme.
* fix linux close sub window cause app exited.
* fix linux webview title bar expanded unexpected.
* More control over webview position and size under windows. [#206](https://github.com/MixinNetwork/flutter-plugins/pull/206) by [Lukas Heinze](https://github.com/Iri-Hor)
* fix zone mismatch [#250](https://github.com/MixinNetwork/flutter-plugins/pull/250) by [CD](https://github.com/459217974)
* fix linux webkit2gtk deprecated error [#246](https://github.com/MixinNetwork/flutter-plugins/pull/246) by [Zhiqiang Zhang](https://github.com/zhangzqs)
* More control over webview position and size under
windows. [#206](https://github.com/MixinNetwork/flutter-plugins/pull/206)
by [Lukas Heinze](https://github.com/Iri-Hor)
* fix zone mismatch [#250](https://github.com/MixinNetwork/flutter-plugins/pull/250)
by [CD](https://github.com/459217974)
* fix linux webkit2gtk deprecated
error [#246](https://github.com/MixinNetwork/flutter-plugins/pull/246)
by [Zhiqiang Zhang](https://github.com/zhangzqs)

## 0.2.0

Expand Down Expand Up @@ -63,7 +74,8 @@ NOTE: contains break change. more details see readme.

## 0.0.6

fix swift definition conflict on macOS. [flutter-plugins#17](https://github.com/MixinNetwork/flutter-plugins/issues/17)
fix swift definition conflict on
macOS. [flutter-plugins#17](https://github.com/MixinNetwork/flutter-plugins/issues/17)

## 0.0.5

Expand Down
6 changes: 3 additions & 3 deletions packages/desktop_webview_window/lib/src/webview_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WebviewImpl extends Webview {

final ValueNotifier<bool> _isNavigating = ValueNotifier<bool>(false);

OnUrlRequestCallback? _onUrlRequestCallback = null;
OnUrlRequestCallback? _onUrlRequestCallback;

final Set<OnWebMessageReceivedCallback> _onWebMessageReceivedCallbacks = {};

Expand Down Expand Up @@ -85,7 +85,7 @@ class WebviewImpl extends Webview {
@override
void registerJavaScriptMessageHandler(
String name, JavaScriptMessageHandler handler) {
if (!Platform.isMacOS) {
if (!(Platform.isMacOS || Platform.isLinux)) {
return;
}
assert(!_closed);
Expand All @@ -103,7 +103,7 @@ class WebviewImpl extends Webview {

@override
void unregisterJavaScriptMessageHandler(String name) {
if (!Platform.isMacOS) {
if (!(Platform.isMacOS || Platform.isLinux)) {
return;
}
if (_closed) {
Expand Down
57 changes: 44 additions & 13 deletions packages/desktop_webview_window/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,73 @@
# The Flutter tooling requires that developers have CMake 3.10 or later
# installed. You should not increase this version, as doing so will cause
# the plugin to fail to compile for some customers of the plugin.
cmake_minimum_required(VERSION 3.10)

# Project-level configuration.
set(PROJECT_NAME "desktop_webview_window")
project(${PROJECT_NAME} LANGUAGES CXX)

# This value is used when generating builds using this plugin, so it must
# not be changed
# not be changed.
set(PLUGIN_NAME "desktop_webview_window_plugin")


# === WebKit and libsoup dependencies ===
find_package(PkgConfig REQUIRED)
pkg_check_modules(WebKit IMPORTED_TARGET webkit2gtk-4.1)

# Try webkit2gtk-4.1 first, then fallback to 4.0
pkg_check_modules(WebKit IMPORTED_TARGET webkit2gtk-4.1)
if (NOT WebKit_FOUND)
pkg_check_modules(WebKit REQUIRED IMPORTED_TARGET webkit2gtk-4.0) # for backward compatibility
pkg_check_modules(WebKit REQUIRED IMPORTED_TARGET webkit2gtk-4.0)
endif ()

# Try libsoup-3.0, fallback to libsoup-2.4
pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-3.0)
if (NOT LibSoup_FOUND)
pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-2.4)
endif()
pkg_check_modules(LibSoup REQUIRED IMPORTED_TARGET libsoup-2.4)
endif ()

# Any new source files that you add to the plugin should be added here.
list(APPEND PLUGIN_SOURCES
"desktop_webview_window_plugin.cc"
"webview_window.cc"
"webview_window.h"
"message_channel_plugin.h"
"message_channel_plugin.cc"
)

# Define the plugin library target. Its name must not be changed (see comment
# on PLUGIN_NAME above).
add_library(${PLUGIN_NAME} SHARED
"desktop_webview_window_plugin.cc"
webview_window.cc
webview_window.h
message_channel_plugin.h
message_channel_plugin.cc
)
${PLUGIN_SOURCES}
)

# Apply a standard set of build settings that are configured in the
# application-level CMakeLists.txt. This can be removed for plugins that want
# full control over build settings.
apply_standard_settings(${PLUGIN_NAME})

# Symbols are hidden by default to reduce the chance of accidental conflicts
# between plugins. This should not be removed; any symbols that should be
# exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro.
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)

# Source include directories and library dependencies. Add any plugin-spec ific
# dependencies here.
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 PkgConfig::WebKit)
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::LibSoup)


# List of absolute paths to libraries that should be bundled with the plugin
# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.
set(desktop_webview_window_bundled_libraries
""
PARENT_SCOPE
)
)
Loading