Skip to content

Commit

Permalink
feat: re-export raw-window-handle crate (#1067)
Browse files Browse the repository at this point in the history
* feat: make `HasRawWindowHandle` trait public

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* feat: re-export entire `raw_window_handle` module instead of `HasRawWindowHandle` trait

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

---------

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
  • Loading branch information
rhysd authored Nov 11, 2023
1 parent 587d4a4 commit d57f94e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .changes/rwh.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Refactor new method to take raw window handle instead. Following are APIs got af
- 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.
- [raw-window-handle](https://docs.rs/raw-window-handle/latest/raw_window_handle/) crate is re-exported as `wry::raw_window_handle`.

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.
the macro signature has changed and you now need to call `tao::android_binding` yourself, checkout the crate documentation for more information.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Cross-platform WebView rendering library in Rust that supports all major desktop
## Overview

WRY connects the web engine on each platform and provides easy to use and unified interface to render WebView.
The webview requires a running event loop and a window type that implements `HasWindowHandle`,
The webview requires a running event loop and a window type that implements `HasRawWindowHandle`,
or a gtk container widget if you need to support X11 and Wayland.
You can use a windowing library like `tao` or `winit`.

Expand Down
14 changes: 8 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

//! Wry is a Cross-platform WebView rendering library.
//!
//! The webview requires a running event loop and a window type that implements [`HasWindowHandle`],
//! The webview requires a running event loop and a window type that implements [`HasRawWindowHandle`],
//! or a gtk container widget if you need to support X11 and Wayland.
//! You can use a windowing library like [`tao`] or [`winit`].
//!
//! ## Examples
//!
//! This example leverages the [`HasWindowHandle`] and supports Windows, macOS, iOS, Android and Linux (X11 Only)
//! This example leverages the [`HasRawWindowHandle`] and supports Windows, macOS, iOS, Android and Linux (X11 Only)
//!
//! ```no_run
//! use wry::WebViewBuilder;
//! use wry::{WebViewBuilder, raw_window_handle};
//!
//! # struct T;
//! # unsafe impl raw_window_handle::HasRawWindowHandle for T {
Expand Down Expand Up @@ -67,7 +67,7 @@
//! macOS, Windows and Linux (X11 Only).
//!
//! ```no_run
//! use wry::WebViewBuilder;
//! use wry::{WebViewBuilder, raw_window_handle};
//!
//! # struct T;
//! # unsafe impl raw_window_handle::HasRawWindowHandle for T {
Expand Down Expand Up @@ -198,6 +198,8 @@ use android::*;
target_os = "openbsd"
))]
pub(crate) mod webkitgtk;
/// Re-exported [raw-window-handle](https://docs.rs/raw-window-handle/latest/raw_window_handle/) crate.
pub use raw_window_handle;
use raw_window_handle::HasRawWindowHandle;
#[cfg(any(
target_os = "linux",
Expand Down Expand Up @@ -725,7 +727,7 @@ impl<'a> WebViewBuilder<'a> {
/// # Examples
///
/// ```no_run
/// use wry::WebViewBuilder;
/// use wry::{WebViewBuilder, raw_window_handle};
///
/// # struct T;
/// # unsafe impl raw_window_handle::HasRawWindowHandle for T {
Expand Down Expand Up @@ -1184,7 +1186,7 @@ pub struct WebView {
}

impl WebView {
/// Create a [`WebView`] from from a type that implements [`HasWindowHandle`].
/// Create a [`WebView`] from from a type that implements [`HasRawWindowHandle`].
/// Note that calling this directly loses
/// abilities to initialize scripts, add ipc handler, and many more before starting WebView. To
/// benefit from above features, create a [`WebViewBuilder`] instead.
Expand Down

0 comments on commit d57f94e

Please sign in to comment.