Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor new method entry point to rwh #1041

Merged
merged 83 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
5925b9d
Refactor new method entry point to rwh
wusyong Oct 22, 2023
5189de5
Update doc and add change file
wusyong Oct 22, 2023
4bafb90
Fix mac and ios compile error
wusyong Oct 22, 2023
dc11115
Add new_as_child
wusyong Oct 22, 2023
ee0a55a
Add rhw_04, 05 06 flags
wusyong Oct 23, 2023
787fb28
Update android port
wusyong Oct 24, 2023
c7c1f7e
Remove winit CI
wusyong Oct 24, 2023
5d0b242
Fix android bindings
wusyong Oct 24, 2023
b5770cd
windows implementation
amrbashir Oct 24, 2023
919ce11
Update Cargo.toml
amrbashir Oct 24, 2023
0e32a04
Fix macOS and iOS
wusyong Oct 24, 2023
e6b9177
Fix Android
wusyong Oct 24, 2023
729f14e
fix is_child on WkWebView
amrbashir Oct 24, 2023
9049943
x11 impl
amrbashir Oct 25, 2023
36979c9
expose `new_gtk`
amrbashir Oct 25, 2023
7ba0948
fix winit-gtk version
amrbashir Oct 25, 2023
f3825f9
Merge branch 'dev' into raw-handle
amrbashir Oct 25, 2023
101d9c8
remove undecorated resizing handling
amrbashir Oct 25, 2023
68fd18d
implement set_position and set_size for child gtk in x11
amrbashir Oct 25, 2023
17e943f
fix macos
amrbashir Oct 25, 2023
1352b97
more fixes
amrbashir Oct 25, 2023
dcb01de
one more time
amrbashir Oct 25, 2023
6b601e8
unreachable
amrbashir Oct 25, 2023
7283d57
update actions
amrbashir Oct 25, 2023
a6c5d27
fix windows
amrbashir Oct 25, 2023
f09ba8c
some clippy
amrbashir Oct 25, 2023
6ada710
Add documentation and fix clippy
wusyong Oct 25, 2023
8c16f53
Fix windows clippy error
wusyong Oct 25, 2023
9de0f23
Fix android biuld
wusyong Oct 25, 2023
d391bec
Fix documentation test
wusyong Oct 25, 2023
263a323
Fix android again
wusyong Oct 25, 2023
18cba91
Reduce clippy noise
wusyong Oct 25, 2023
59f3089
use rc?
amrbashir Oct 25, 2023
7300dfa
refine some documentation, add set_visible
amrbashir Oct 25, 2023
2607424
fix set_visible
amrbashir Oct 25, 2023
8d1ba86
impl set_visible on Windows
amrbashir Oct 25, 2023
91a498b
fix doctests
amrbashir Oct 25, 2023
1e595c7
more set_visible fixes
amrbashir Oct 25, 2023
67c0ae8
fix windows
amrbashir Oct 25, 2023
0f43154
unsafe
amrbashir Oct 25, 2023
3e38519
fix set size for child webviews
amrbashir Oct 25, 2023
f63ce34
fix initial visibility with new_gtk
amrbashir Oct 25, 2023
8e0a3d9
refine examples
amrbashir Oct 25, 2023
f4cd336
fix wpgu example
amrbashir Oct 25, 2023
5a58f70
fix examples on windows and macos
amrbashir Oct 25, 2023
c7cb208
use a better workaround
amrbashir Oct 26, 2023
5469e89
make set_size work on x11
amrbashir Oct 26, 2023
a6f5e0a
Fix size in multiwebview example
wusyong Oct 26, 2023
7c8f13a
Add visible method on macOS and iOS
wusyong Oct 26, 2023
0f02f24
Merge branch 'dev' into raw-handle
amrbashir Oct 26, 2023
fe0f345
remvoe `tao` from android backend and update documentation
amrbashir Oct 27, 2023
3a90ae9
fix winit example
amrbashir Oct 27, 2023
f41d9c3
Add new_as_content_view on macOS
wusyong Oct 29, 2023
94037cf
allow using raw-window-handle v0.5 [skip ci]
lucasfernog Oct 31, 2023
9d90e23
change trait name [skip ci]
lucasfernog Oct 31, 2023
0b9631a
fix linux impl [skip ci]
lucasfernog Oct 31, 2023
8566a88
fix android build [skip ci]
lucasfernog Oct 31, 2023
71638f5
fix windows build
lucasfernog Oct 31, 2023
06d7f91
fix(macos): do not autoresize on child webview [skip ci]
lucasfernog Oct 31, 2023
b3f8bdb
fix macos coordinates [skip ci]
lucasfernog Oct 31, 2023
12f3c25
fix example [skip ci]
lucasfernog Oct 31, 2023
c9c3283
fixed child on macos [skip ci]
lucasfernog Oct 31, 2023
6d5bbff
fix docs typos [skip ci]
lucasfernog Oct 31, 2023
6fd35b7
fix webview position when it's not a child [skip ci]
lucasfernog Oct 31, 2023
e4b409c
replace new_as_content_view with new_as_subview
lucasfernog Oct 31, 2023
7775ec3
with_as_subview instead of constructor [skip ci]
lucasfernog Oct 31, 2023
4df7a51
fix position/size when as_subview is true
lucasfernog Oct 31, 2023
781b86f
lint & fmt
lucasfernog Oct 31, 2023
ff7f9ff
Merge branch 'dev' into raw-handle
wusyong Nov 6, 2023
cac3a6d
Fix ios build
wusyong Nov 6, 2023
a79d31a
Fix cargo test
wusyong Nov 6, 2023
3f28e0a
Fix mac build
wusyong Nov 6, 2023
b0886f0
Update macOS contrusctors
wusyong Nov 6, 2023
bd46e58
cargo fmt
wusyong Nov 6, 2023
71b5663
impl drop on Windows
amrbashir Nov 6, 2023
6eda375
fix child transparency on Windows (still needs PRs in tao and winit)
amrbashir Nov 6, 2023
46db450
fix winit usage in the examples, use rwh_05 only for now
amrbashir Nov 6, 2023
6a6cc96
fix tests
amrbashir Nov 6, 2023
bf3c1ca
add webview.focus
amrbashir Nov 6, 2023
028d207
fix dropping on Linux
amrbashir Nov 6, 2023
ea93b36
chore clean examples
amrbashir Nov 6, 2023
e947f01
implement focus on Linux
amrbashir Nov 6, 2023
cf33d85
macos focus
lucasfernog Nov 6, 2023
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
17 changes: 17 additions & 0 deletions .changes/rwh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"wry": minor
---

Refactor new method to take raw window handle instead. Following are APIs got affected:
- `application` module is removed, and `webivew` module is moved to root module.
- `WebviewBuilder::new`, `Webview::new` now take `RawWindowHandle` instead.
- Attributes `ipc_handler`, `file_drop_handler`, `document_change_handler` don't have window parameter anymore.
Users should use closure to capture the types they want to use.
- Position field in `FileDrop` event is now `Position` instead of `PhysicalPosition`. Users need to handle scale factor
depend on the situation they have.
- `Webview::inner_size` is removed.

This also means that we removed `tao` as a dependency completely which required some changes to the Android backend:
- We exposed the `android_setup` function that needs to be called once to setup necessary logic.
- Previously the `android_binding!` had internal call to `tao::android_binding` but now that `tao` has been removed,sa
the macro signature has changed and you now need to call `tao::android_binding` yourself, checkout the crate documentation for more information.
29 changes: 21 additions & 8 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Audit
# Copyright 2022-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: audit

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- dev
paths:
- 'Cargo.lock'
- 'Cargo.toml'
pull_request:
paths:
- "Cargo.lock"
- "Cargo.toml"
- 'Cargo.lock'
- 'Cargo.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
audit-rust:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: rust audit
uses: actions-rs/audit-check@v1
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 3 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_version: [stable]
platform:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
Expand All @@ -28,7 +27,7 @@ jobs:
if: contains(matrix.platform.target, 'gnu')
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libgtksourceview-3.0-dev libayatana-appindicator3-dev
sudo apt-get install -y libwebkit2gtk-4.1-dev

- name: install webview2 (windows only)
if: contains(matrix.platform.target, 'windows')
Expand All @@ -44,20 +43,10 @@ jobs:

- name: build tests and examples
shell: bash
if: (
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios'))
if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
run: cargo test --no-run --verbose --target ${{ matrix.platform.target }}

- name: run tests
if: (
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios'))
if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
run: cargo test --verbose --target ${{ matrix.platform.target }} --features linux-body

- name: build wry with winit
if: (
contains(matrix.platform.target, 'gnu') ||
contains(matrix.platform.target, 'windows') ||
contains(matrix.platform.target, 'apple'))
run: cargo build --no-default-features --features winit --target ${{ matrix.platform.target }}
48 changes: 48 additions & 0 deletions .github/workflows/clippy-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2022-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: clippy & fmt

on:
push:
branches:
- dev
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
clippy:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
- name: install system deps
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- run: cargo clippy --all-targets

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- run: cargo fmt --all -- --check
4 changes: 1 addition & 3 deletions .github/workflows/covector-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: covector status
uses: jbolda/covector/packages/action@covector-v0
id: covector
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: version or publish
name: covector version or publish

on:
push:
Expand All @@ -15,15 +15,16 @@ jobs:
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v4

- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}

- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"

- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
Expand All @@ -34,14 +35,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true

- name: Create Pull Request With Versions Bumped
id: cpr
uses: tauri-apps/create-pull-request@v3
if: steps.covector.outputs.commandRan == 'version'
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Publish New Versions"
commit-message: "publish new versions"
labels: "version updates"
branch: "release"
title: Apply Version Updates From Current Changes
commit-message: 'apply version updates'
labels: 'version updates'
branch: 'release'
body: ${{ steps.covector.outputs.change }}
31 changes: 0 additions & 31 deletions .github/workflows/fmt.yml

This file was deleted.

71 changes: 39 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,71 +1,67 @@
workspace = { }
workspace = {}

[package]
name = "wry"
version = "0.34.2"
authors = [ "Tauri Programme within The Commons Conservancy" ]
authors = ["Tauri Programme within The Commons Conservancy"]
edition = "2021"
license = "Apache-2.0 OR MIT"
description = "Cross-platform WebView rendering library"
readme = "README.md"
repository = "https://github.com/tauri-apps/wry"
documentation = "https://docs.rs/wry"
categories = [ "gui" ]
categories = ["gui"]

[package.metadata.docs.rs]
no-default-features = true
features = [ "tao", "file-drop", "protocol" ]
features = ["file-drop", "protocol"]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin"
"x86_64-apple-darwin",
]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
default = [ "file-drop", "objc-exception", "protocol", "tao" ]
objc-exception = [ "objc/exception" ]
file-drop = [ ]
protocol = [ ]
devtools = [ ]
transparent = [ ]
fullscreen = [ ]
linux-body = [ "webkit2gtk/v2_40" ]
mac-proxy = [ ]
default = ["file-drop", "objc-exception", "protocol"]
objc-exception = ["objc/exception"]
file-drop = []
protocol = []
devtools = []
transparent = []
fullscreen = []
linux-body = ["webkit2gtk/v2_40"]
mac-proxy = []

[dependencies]
libc = "0.2"
log = "0.4"
once_cell = "1"
serde = { version = "1.0", features = [ "derive" ] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
url = "2.4"
tao = { version = "0.23", default-features = false, features = [ "serde" ], optional = true }
http = "0.2.9"

[dev-dependencies]
http-range = "0.1.5"
base64 = "0.21"
http = "0.2"
raw-window-handle = { version = "0.5", features = ["std"] }

[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
javascriptcore-rs = { version = "=1.1", features = [ "v2_28" ] }
webkit2gtk = { version = "=2.0", features = [ "v2_38" ] }
javascriptcore-rs = { version = "=1.1", features = ["v2_28"] }
webkit2gtk = { version = "=2.0", features = ["v2_38"] }
webkit2gtk-sys = "=2.0"
gtk = "0.18"
soup3 = "0.5"
winit = { version = "0.29", package = "winit-gtk", features = [ "serde" ], optional = true }
x11-dl = "2.9"
gdkx11 = "0.18"

[target."cfg(target_os = \"windows\")".dependencies]
webview2-com = "0.27"
windows-implement = "0.51"
dunce = "1"
winit = { version = "0.28", features = [ "serde" ], optional = true }

[target."cfg(target_os = \"windows\")".dependencies.windows]
version = "0.51"
features = [
[target."cfg(target_os = \"windows\")".dependencies.windows]
version = "0.51"
features = [
"implement",
"Win32_Foundation",
"Win32_Graphics_Gdi",
Expand All @@ -80,7 +76,7 @@ winit = { version = "0.28", features = [ "serde" ], optional = true }
"Win32_Globalization",
"Win32_UI_HiDpi",
"Win32_UI_Input",
"Win32_UI_Input_KeyboardAndMouse"
"Win32_UI_Input_KeyboardAndMouse",
]

[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies]
Expand All @@ -89,11 +85,22 @@ cocoa = "0.25"
core-graphics = "0.23"
objc = "0.2"
objc_id = "0.1"
winit = { version = "0.28", features = [ "serde" ], optional = true }

[target."cfg(target_os = \"android\")".dependencies]
crossbeam-channel = "0.5"
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
sha2 = "0.10"
base64 = "0.21"
jni = "0.21"
ndk = "0.7"
ndk-sys = "0.4"
ndk-context = "0.1"
tao-macros = { version = "0.1.0" }

[dev-dependencies]
http-range = "0.1.5"
pollster = "0.3.0"
tao = { git = "https://github.com/tauri-apps/tao", default-features = false, features = ["rwh_05"] }
wgpu = "0.18.0"
winit = { version = "0.29", features = ["rwh_05"] }
Loading
Loading