feat: update to latest wry (#8213)

Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira 2023-11-21 12:32:06 -03:00 committed by GitHub
parent bf095df55a
commit ebc3e78e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 460 additions and 335 deletions

View File

@ -13,17 +13,18 @@ edition = { workspace = true }
rust-version = { workspace = true }
[dependencies]
wry = { version = "0.34.2", default-features = false, features = [ "tao", "file-drop", "protocol" ] }
wry = { version = "0.35", default-features = false, features = [ "file-drop", "protocol", "os-webview" ] }
tao = { version = "0.24", default-features = false, features = ["rwh_05"] }
tauri-runtime = { version = "1.0.0-alpha.5", path = "../tauri-runtime" }
tauri-utils = { version = "2.0.0-alpha.11", path = "../tauri-utils" }
raw-window-handle = "0.5"
http = "0.2"
[target."cfg(windows)".dependencies]
webview2-com = "0.27"
webview2-com = "0.28"
[target."cfg(windows)".dependencies.windows]
version = "0.51"
version = "0.52"
features = [ "Win32_Foundation" ]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]

View File

@ -24,66 +24,65 @@ use tauri_runtime::{
WindowEventId,
};
#[cfg(target_os = "macos")]
use tao::platform::macos::EventLoopWindowTargetExtMacOS;
#[cfg(target_os = "macos")]
use tao::platform::macos::WindowBuilderExtMacOS;
#[cfg(target_os = "linux")]
use tao::platform::unix::{WindowBuilderExtUnix, WindowExtUnix};
#[cfg(windows)]
use tao::platform::windows::{WindowBuilderExtWindows, WindowExtWindows};
#[cfg(windows)]
use webview2_com::FocusChangedEventHandler;
#[cfg(windows)]
use windows::Win32::{Foundation::HWND, System::WinRT::EventRegistrationToken};
#[cfg(target_os = "macos")]
use wry::application::platform::macos::EventLoopWindowTargetExtMacOS;
#[cfg(target_os = "macos")]
use wry::application::platform::macos::WindowBuilderExtMacOS;
#[cfg(target_os = "linux")]
use wry::application::platform::unix::{WindowBuilderExtUnix, WindowExtUnix};
#[cfg(windows)]
use wry::application::platform::windows::{WindowBuilderExtWindows, WindowExtWindows};
#[cfg(windows)]
use wry::webview::WebViewBuilderExtWindows;
use wry::WebViewBuilderExtWindows;
use tao::{
dpi::{
LogicalPosition as TaoLogicalPosition, LogicalSize as TaoLogicalSize,
PhysicalPosition as TaoPhysicalPosition, PhysicalSize as TaoPhysicalSize,
Position as TaoPosition, Size as TaoSize,
},
event::{Event, StartCause, WindowEvent as TaoWindowEvent},
event_loop::{
ControlFlow, DeviceEventFilter as TaoDeviceEventFilter, EventLoop, EventLoopBuilder,
EventLoopProxy as TaoEventLoopProxy, EventLoopWindowTarget,
},
monitor::MonitorHandle,
window::{
CursorIcon as TaoCursorIcon, Fullscreen, Icon as TaoWindowIcon,
ProgressBarState as TaoProgressBarState, ProgressState as TaoProgressState, Theme as TaoTheme,
UserAttentionType as TaoUserAttentionType,
},
};
#[cfg(target_os = "macos")]
use tauri_utils::TitleBarStyle;
use tauri_utils::{
config::WindowConfig, debug_eprintln, ProgressBarState, ProgressBarStatus, Theme,
};
use wry::{
application::{
dpi::{
LogicalPosition as WryLogicalPosition, LogicalSize as WryLogicalSize,
PhysicalPosition as WryPhysicalPosition, PhysicalSize as WryPhysicalSize,
Position as WryPosition, Size as WrySize,
},
event::{Event, StartCause, WindowEvent as WryWindowEvent},
event_loop::{
ControlFlow, DeviceEventFilter as WryDeviceEventFilter, EventLoop, EventLoopBuilder,
EventLoopProxy as WryEventLoopProxy, EventLoopWindowTarget,
},
monitor::MonitorHandle,
window::{
CursorIcon as WryCursorIcon, Fullscreen, Icon as WryWindowIcon,
ProgressBarState as WryProgressBarState, ProgressState as WryProgressState,
Theme as WryTheme, UserAttentionType as WryUserAttentionType,
},
},
webview::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder},
};
use wry::{FileDropEvent as WryFileDropEvent, Url, WebContext, WebView, WebViewBuilder};
pub use tao;
pub use tao::window::{Window, WindowBuilder as TaoWindowBuilder, WindowId};
pub use wry;
pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId};
pub use wry::webview::webview_version;
pub use wry::webview_version;
#[cfg(windows)]
use wry::webview::WebviewExtWindows;
use wry::WebViewExtWindows;
#[cfg(target_os = "android")]
use wry::webview::{
use wry::{
prelude::{dispatch, find_class},
WebViewBuilderExtAndroid, WebviewExtAndroid,
WebViewBuilderExtAndroid, WebViewExtAndroid,
};
#[cfg(target_os = "macos")]
use tauri_runtime::ActivationPolicy;
#[cfg(target_os = "macos")]
pub use wry::application::platform::macos::{
ActivationPolicy as WryActivationPolicy, EventLoopExtMacOS, WindowExtMacOS,
pub use tao::platform::macos::{
ActivationPolicy as TaoActivationPolicy, EventLoopExtMacOS, WindowExtMacOS,
};
#[cfg(target_os = "macos")]
use tauri_runtime::ActivationPolicy;
use std::{
cell::RefCell,
@ -104,8 +103,8 @@ use std::{
};
pub type WebviewId = u32;
type IpcHandler = dyn Fn(&Window, String) + 'static;
type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static;
type IpcHandler = dyn Fn(String) + 'static;
type FileDropHandler = dyn Fn(WryFileDropEvent) -> bool + 'static;
mod webview;
pub use webview::Webview;
@ -172,7 +171,7 @@ pub(crate) fn send_user_message<T: UserEvent>(
pub struct Context<T: UserEvent> {
pub webview_id_map: WebviewIdStore,
main_thread_id: ThreadId,
pub proxy: WryEventLoopProxy<Message<T>>,
pub proxy: TaoEventLoopProxy<Message<T>>,
main_thread: DispatcherMainThreadContext<T>,
plugins: Arc<Mutex<Vec<Box<dyn Plugin<T> + Send>>>>,
next_window_id: Arc<AtomicU32>,
@ -275,29 +274,29 @@ impl<T: UserEvent> fmt::Debug for Context<T> {
}
}
pub struct DeviceEventFilterWrapper(pub WryDeviceEventFilter);
pub struct DeviceEventFilterWrapper(pub TaoDeviceEventFilter);
impl From<DeviceEventFilter> for DeviceEventFilterWrapper {
fn from(item: DeviceEventFilter) -> Self {
match item {
DeviceEventFilter::Always => Self(WryDeviceEventFilter::Always),
DeviceEventFilter::Never => Self(WryDeviceEventFilter::Never),
DeviceEventFilter::Unfocused => Self(WryDeviceEventFilter::Unfocused),
DeviceEventFilter::Always => Self(TaoDeviceEventFilter::Always),
DeviceEventFilter::Never => Self(TaoDeviceEventFilter::Never),
DeviceEventFilter::Unfocused => Self(TaoDeviceEventFilter::Unfocused),
}
}
}
/// Wrapper around a [`wry::application::window::Icon`] that can be created from an [`Icon`].
pub struct WryIcon(pub WryWindowIcon);
/// Wrapper around a [`tao::window::Icon`] that can be created from an [`Icon`].
pub struct TaoIcon(pub TaoWindowIcon);
fn icon_err<E: std::error::Error + Send + Sync + 'static>(e: E) -> Error {
Error::InvalidIcon(Box::new(e))
}
impl TryFrom<Icon> for WryIcon {
impl TryFrom<Icon> for TaoIcon {
type Error = Error;
fn try_from(icon: Icon) -> std::result::Result<Self, Self::Error> {
WryWindowIcon::from_rgba(icon.rgba, icon.width, icon.height)
TaoWindowIcon::from_rgba(icon.rgba, icon.width, icon.height)
.map(Self)
.map_err(icon_err)
}
@ -306,11 +305,11 @@ impl TryFrom<Icon> for WryIcon {
pub struct WindowEventWrapper(pub Option<WindowEvent>);
impl WindowEventWrapper {
fn parse(webview: &Option<WindowHandle>, event: &WryWindowEvent<'_>) -> Self {
fn parse(webview: &Option<WindowHandle>, event: &TaoWindowEvent<'_>) -> Self {
match event {
// resized event from tao doesn't include a reliable size on macOS
// because wry replaces the NSView
WryWindowEvent::Resized(_) => {
TaoWindowEvent::Resized(_) => {
if let Some(webview) = webview {
Self(Some(WindowEvent::Resized(
PhysicalSizeWrapper(webview.inner_size()).into(),
@ -324,23 +323,23 @@ impl WindowEventWrapper {
}
}
pub fn map_theme(theme: &WryTheme) -> Theme {
pub fn map_theme(theme: &TaoTheme) -> Theme {
match theme {
WryTheme::Light => Theme::Light,
WryTheme::Dark => Theme::Dark,
TaoTheme::Light => Theme::Light,
TaoTheme::Dark => Theme::Dark,
_ => Theme::Light,
}
}
impl<'a> From<&WryWindowEvent<'a>> for WindowEventWrapper {
fn from(event: &WryWindowEvent<'a>) -> Self {
impl<'a> From<&TaoWindowEvent<'a>> for WindowEventWrapper {
fn from(event: &TaoWindowEvent<'a>) -> Self {
let event = match event {
WryWindowEvent::Resized(size) => WindowEvent::Resized(PhysicalSizeWrapper(*size).into()),
WryWindowEvent::Moved(position) => {
TaoWindowEvent::Resized(size) => WindowEvent::Resized(PhysicalSizeWrapper(*size).into()),
TaoWindowEvent::Moved(position) => {
WindowEvent::Moved(PhysicalPositionWrapper(*position).into())
}
WryWindowEvent::Destroyed => WindowEvent::Destroyed,
WryWindowEvent::ScaleFactorChanged {
TaoWindowEvent::Destroyed => WindowEvent::Destroyed,
TaoWindowEvent::ScaleFactorChanged {
scale_factor,
new_inner_size,
} => WindowEvent::ScaleFactorChanged {
@ -348,8 +347,8 @@ impl<'a> From<&WryWindowEvent<'a>> for WindowEventWrapper {
new_inner_size: PhysicalSizeWrapper(**new_inner_size).into(),
},
#[cfg(any(target_os = "linux", target_os = "macos"))]
WryWindowEvent::Focused(focused) => WindowEvent::Focused(*focused),
WryWindowEvent::ThemeChanged(theme) => WindowEvent::ThemeChanged(map_theme(theme)),
TaoWindowEvent::Focused(focused) => WindowEvent::Focused(*focused),
TaoWindowEvent::ThemeChanged(theme) => WindowEvent::ThemeChanged(map_theme(theme)),
_ => return Self(None),
};
Self(Some(event))
@ -378,7 +377,7 @@ impl From<MonitorHandleWrapper> for Monitor {
}
}
pub struct PhysicalPositionWrapper<T>(pub WryPhysicalPosition<T>);
pub struct PhysicalPositionWrapper<T>(pub TaoPhysicalPosition<T>);
impl<T> From<PhysicalPositionWrapper<T>> for PhysicalPosition<T> {
fn from(position: PhysicalPositionWrapper<T>) -> Self {
@ -391,25 +390,25 @@ impl<T> From<PhysicalPositionWrapper<T>> for PhysicalPosition<T> {
impl<T> From<PhysicalPosition<T>> for PhysicalPositionWrapper<T> {
fn from(position: PhysicalPosition<T>) -> Self {
Self(WryPhysicalPosition {
Self(TaoPhysicalPosition {
x: position.x,
y: position.y,
})
}
}
struct LogicalPositionWrapper<T>(WryLogicalPosition<T>);
struct LogicalPositionWrapper<T>(TaoLogicalPosition<T>);
impl<T> From<LogicalPosition<T>> for LogicalPositionWrapper<T> {
fn from(position: LogicalPosition<T>) -> Self {
Self(WryLogicalPosition {
Self(TaoLogicalPosition {
x: position.x,
y: position.y,
})
}
}
pub struct PhysicalSizeWrapper<T>(pub WryPhysicalSize<T>);
pub struct PhysicalSizeWrapper<T>(pub TaoPhysicalSize<T>);
impl<T> From<PhysicalSizeWrapper<T>> for PhysicalSize<T> {
fn from(size: PhysicalSizeWrapper<T>) -> Self {
@ -422,127 +421,127 @@ impl<T> From<PhysicalSizeWrapper<T>> for PhysicalSize<T> {
impl<T> From<PhysicalSize<T>> for PhysicalSizeWrapper<T> {
fn from(size: PhysicalSize<T>) -> Self {
Self(WryPhysicalSize {
Self(TaoPhysicalSize {
width: size.width,
height: size.height,
})
}
}
struct LogicalSizeWrapper<T>(WryLogicalSize<T>);
struct LogicalSizeWrapper<T>(TaoLogicalSize<T>);
impl<T> From<LogicalSize<T>> for LogicalSizeWrapper<T> {
fn from(size: LogicalSize<T>) -> Self {
Self(WryLogicalSize {
Self(TaoLogicalSize {
width: size.width,
height: size.height,
})
}
}
pub struct SizeWrapper(pub WrySize);
pub struct SizeWrapper(pub TaoSize);
impl From<Size> for SizeWrapper {
fn from(size: Size) -> Self {
match size {
Size::Logical(s) => Self(WrySize::Logical(LogicalSizeWrapper::from(s).0)),
Size::Physical(s) => Self(WrySize::Physical(PhysicalSizeWrapper::from(s).0)),
Size::Logical(s) => Self(TaoSize::Logical(LogicalSizeWrapper::from(s).0)),
Size::Physical(s) => Self(TaoSize::Physical(PhysicalSizeWrapper::from(s).0)),
}
}
}
pub struct PositionWrapper(pub WryPosition);
pub struct PositionWrapper(pub TaoPosition);
impl From<Position> for PositionWrapper {
fn from(position: Position) -> Self {
match position {
Position::Logical(s) => Self(WryPosition::Logical(LogicalPositionWrapper::from(s).0)),
Position::Physical(s) => Self(WryPosition::Physical(PhysicalPositionWrapper::from(s).0)),
Position::Logical(s) => Self(TaoPosition::Logical(LogicalPositionWrapper::from(s).0)),
Position::Physical(s) => Self(TaoPosition::Physical(PhysicalPositionWrapper::from(s).0)),
}
}
}
#[derive(Debug, Clone)]
pub struct UserAttentionTypeWrapper(pub WryUserAttentionType);
pub struct UserAttentionTypeWrapper(pub TaoUserAttentionType);
impl From<UserAttentionType> for UserAttentionTypeWrapper {
fn from(request_type: UserAttentionType) -> Self {
let o = match request_type {
UserAttentionType::Critical => WryUserAttentionType::Critical,
UserAttentionType::Informational => WryUserAttentionType::Informational,
UserAttentionType::Critical => TaoUserAttentionType::Critical,
UserAttentionType::Informational => TaoUserAttentionType::Informational,
};
Self(o)
}
}
#[derive(Debug)]
pub struct CursorIconWrapper(pub WryCursorIcon);
pub struct CursorIconWrapper(pub TaoCursorIcon);
impl From<CursorIcon> for CursorIconWrapper {
fn from(icon: CursorIcon) -> Self {
use CursorIcon::*;
let i = match icon {
Default => WryCursorIcon::Default,
Crosshair => WryCursorIcon::Crosshair,
Hand => WryCursorIcon::Hand,
Arrow => WryCursorIcon::Arrow,
Move => WryCursorIcon::Move,
Text => WryCursorIcon::Text,
Wait => WryCursorIcon::Wait,
Help => WryCursorIcon::Help,
Progress => WryCursorIcon::Progress,
NotAllowed => WryCursorIcon::NotAllowed,
ContextMenu => WryCursorIcon::ContextMenu,
Cell => WryCursorIcon::Cell,
VerticalText => WryCursorIcon::VerticalText,
Alias => WryCursorIcon::Alias,
Copy => WryCursorIcon::Copy,
NoDrop => WryCursorIcon::NoDrop,
Grab => WryCursorIcon::Grab,
Grabbing => WryCursorIcon::Grabbing,
AllScroll => WryCursorIcon::AllScroll,
ZoomIn => WryCursorIcon::ZoomIn,
ZoomOut => WryCursorIcon::ZoomOut,
EResize => WryCursorIcon::EResize,
NResize => WryCursorIcon::NResize,
NeResize => WryCursorIcon::NeResize,
NwResize => WryCursorIcon::NwResize,
SResize => WryCursorIcon::SResize,
SeResize => WryCursorIcon::SeResize,
SwResize => WryCursorIcon::SwResize,
WResize => WryCursorIcon::WResize,
EwResize => WryCursorIcon::EwResize,
NsResize => WryCursorIcon::NsResize,
NeswResize => WryCursorIcon::NeswResize,
NwseResize => WryCursorIcon::NwseResize,
ColResize => WryCursorIcon::ColResize,
RowResize => WryCursorIcon::RowResize,
_ => WryCursorIcon::Default,
Default => TaoCursorIcon::Default,
Crosshair => TaoCursorIcon::Crosshair,
Hand => TaoCursorIcon::Hand,
Arrow => TaoCursorIcon::Arrow,
Move => TaoCursorIcon::Move,
Text => TaoCursorIcon::Text,
Wait => TaoCursorIcon::Wait,
Help => TaoCursorIcon::Help,
Progress => TaoCursorIcon::Progress,
NotAllowed => TaoCursorIcon::NotAllowed,
ContextMenu => TaoCursorIcon::ContextMenu,
Cell => TaoCursorIcon::Cell,
VerticalText => TaoCursorIcon::VerticalText,
Alias => TaoCursorIcon::Alias,
Copy => TaoCursorIcon::Copy,
NoDrop => TaoCursorIcon::NoDrop,
Grab => TaoCursorIcon::Grab,
Grabbing => TaoCursorIcon::Grabbing,
AllScroll => TaoCursorIcon::AllScroll,
ZoomIn => TaoCursorIcon::ZoomIn,
ZoomOut => TaoCursorIcon::ZoomOut,
EResize => TaoCursorIcon::EResize,
NResize => TaoCursorIcon::NResize,
NeResize => TaoCursorIcon::NeResize,
NwResize => TaoCursorIcon::NwResize,
SResize => TaoCursorIcon::SResize,
SeResize => TaoCursorIcon::SeResize,
SwResize => TaoCursorIcon::SwResize,
WResize => TaoCursorIcon::WResize,
EwResize => TaoCursorIcon::EwResize,
NsResize => TaoCursorIcon::NsResize,
NeswResize => TaoCursorIcon::NeswResize,
NwseResize => TaoCursorIcon::NwseResize,
ColResize => TaoCursorIcon::ColResize,
RowResize => TaoCursorIcon::RowResize,
_ => TaoCursorIcon::Default,
};
Self(i)
}
}
pub struct ProgressStateWrapper(pub WryProgressState);
pub struct ProgressStateWrapper(pub TaoProgressState);
impl From<ProgressBarStatus> for ProgressStateWrapper {
fn from(status: ProgressBarStatus) -> Self {
let state = match status {
ProgressBarStatus::None => WryProgressState::None,
ProgressBarStatus::Normal => WryProgressState::Normal,
ProgressBarStatus::Indeterminate => WryProgressState::Indeterminate,
ProgressBarStatus::Paused => WryProgressState::Paused,
ProgressBarStatus::Error => WryProgressState::Error,
ProgressBarStatus::None => TaoProgressState::None,
ProgressBarStatus::Normal => TaoProgressState::Normal,
ProgressBarStatus::Indeterminate => TaoProgressState::Indeterminate,
ProgressBarStatus::Paused => TaoProgressState::Paused,
ProgressBarStatus::Error => TaoProgressState::Error,
};
Self(state)
}
}
pub struct ProgressBarStateWrapper(pub WryProgressBarState);
pub struct ProgressBarStateWrapper(pub TaoProgressBarState);
impl From<ProgressBarState> for ProgressBarStateWrapper {
fn from(progress_state: ProgressBarState) -> Self {
Self(WryProgressBarState {
Self(TaoProgressBarState {
progress: progress_state.progress,
state: progress_state
.status
@ -554,7 +553,7 @@ impl From<ProgressBarState> for ProgressBarStateWrapper {
#[derive(Clone, Default)]
pub struct WindowBuilderWrapper {
inner: WryWindowBuilder,
inner: TaoWindowBuilder,
center: bool,
#[cfg(target_os = "macos")]
tabbing_identifier: Option<String>,
@ -659,28 +658,28 @@ impl WindowBuilder for WindowBuilderWrapper {
}
fn position(mut self, x: f64, y: f64) -> Self {
self.inner = self.inner.with_position(WryLogicalPosition::new(x, y));
self.inner = self.inner.with_position(TaoLogicalPosition::new(x, y));
self
}
fn inner_size(mut self, width: f64, height: f64) -> Self {
self.inner = self
.inner
.with_inner_size(WryLogicalSize::new(width, height));
.with_inner_size(TaoLogicalSize::new(width, height));
self
}
fn min_inner_size(mut self, min_width: f64, min_height: f64) -> Self {
self.inner = self
.inner
.with_min_inner_size(WryLogicalSize::new(min_width, min_height));
.with_min_inner_size(TaoLogicalSize::new(min_width, min_height));
self
}
fn max_inner_size(mut self, max_width: f64, max_height: f64) -> Self {
self.inner = self
.inner
.with_max_inner_size(WryLogicalSize::new(max_width, max_height));
.with_max_inner_size(TaoLogicalSize::new(max_width, max_height));
self
}
@ -834,7 +833,7 @@ impl WindowBuilder for WindowBuilderWrapper {
fn icon(mut self, icon: Icon) -> Result<Self> {
self.inner = self
.inner
.with_window_icon(Some(WryIcon::try_from(icon)?.0));
.with_window_icon(Some(TaoIcon::try_from(icon)?.0));
Ok(self)
}
@ -853,8 +852,8 @@ impl WindowBuilder for WindowBuilderWrapper {
fn theme(mut self, theme: Option<Theme>) -> Self {
self.inner = self.inner.with_theme(if let Some(t) = theme {
match t {
Theme::Dark => Some(WryTheme::Dark),
_ => Some(WryTheme::Light),
Theme::Dark => Some(TaoTheme::Dark),
_ => Some(TaoTheme::Light),
}
} else {
None
@ -902,11 +901,11 @@ impl From<FileDropEventWrapper> for FileDropEvent {
match event.0 {
WryFileDropEvent::Hovered { paths, position } => FileDropEvent::Hovered {
paths: paths.into_iter().map(decode_path).collect(),
position: PhysicalPositionWrapper(position).into(),
position: PhysicalPosition::new(position.0 as f64, position.1 as f64),
},
WryFileDropEvent::Dropped { paths, position } => FileDropEvent::Dropped {
paths: paths.into_iter().map(decode_path).collect(),
position: PhysicalPositionWrapper(position).into(),
position: PhysicalPosition::new(position.0 as f64, position.1 as f64),
},
// default to cancelled
// FIXME(maybe): Add `FileDropEvent::Unknown` event?
@ -1038,7 +1037,7 @@ pub enum WindowMessage {
SetPosition(Position),
SetFullscreen(bool),
SetFocus,
SetIcon(WryWindowIcon),
SetIcon(TaoWindowIcon),
SetSkipTaskbar(bool),
SetCursorGrab(bool),
SetCursorVisible(bool),
@ -1077,7 +1076,7 @@ pub enum Message<T: 'static> {
CreateWebview(WebviewId, CreateWebviewClosure<T>),
CreateWindow(
WebviewId,
Box<dyn FnOnce() -> (String, WryWindowBuilder) + Send>,
Box<dyn FnOnce() -> (String, TaoWindowBuilder) + Send>,
Sender<Result<Weak<Window>>>,
),
UserEvent(T),
@ -1093,7 +1092,7 @@ impl<T: UserEvent> Clone for Message<T> {
}
}
/// The Tauri [`Dispatch`] for [`Wry`].
/// The Tauri [`Dispatch`] for [`Tao`].
#[derive(Debug, Clone)]
pub struct WryDispatcher<T: UserEvent> {
window_id: WebviewId,
@ -1504,7 +1503,7 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
&self.context,
Message::Window(
self.window_id,
WindowMessage::SetIcon(WryIcon::try_from(icon)?.0),
WindowMessage::SetIcon(TaoIcon::try_from(icon)?.0),
),
)
}
@ -1585,6 +1584,7 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
#[derive(Clone)]
enum WindowHandle {
Webview {
window: Arc<Window>,
inner: Rc<WebView>,
context_store: WebContextStore,
// the key of the WebContext if it's not shared
@ -1597,6 +1597,7 @@ impl Drop for WindowHandle {
fn drop(&mut self) {
if let Self::Webview {
inner,
window: _,
context_store,
context_key,
} = self
@ -1620,17 +1621,17 @@ impl Deref for WindowHandle {
#[inline(always)]
fn deref(&self) -> &Window {
match self {
Self::Webview { inner, .. } => inner.window(),
Self::Webview { window, .. } => window,
Self::Window(w) => w,
}
}
}
impl WindowHandle {
fn inner_size(&self) -> WryPhysicalSize<u32> {
fn inner_size(&self) -> TaoPhysicalSize<u32> {
match self {
WindowHandle::Window(w) => w.inner_size(),
WindowHandle::Webview { inner, .. } => inner.inner_size(),
WindowHandle::Webview { window, .. } => window.inner_size(),
}
}
}
@ -1651,7 +1652,7 @@ impl fmt::Debug for WindowWrapper {
}
#[derive(Debug, Clone)]
pub struct EventProxy<T: UserEvent>(WryEventLoopProxy<Message<T>>);
pub struct EventProxy<T: UserEvent>(TaoEventLoopProxy<Message<T>>);
#[cfg(target_os = "ios")]
#[allow(clippy::non_send_fields_in_send_ty)]
@ -1676,7 +1677,7 @@ pub trait Plugin<T: UserEvent> {
&mut self,
event: &Event<Message<T>>,
event_loop: &EventLoopWindowTarget<Message<T>>,
proxy: &WryEventLoopProxy<Message<T>>,
proxy: &TaoEventLoopProxy<Message<T>>,
control_flow: &mut ControlFlow,
context: EventLoopIterationContext<'_, T>,
web_context: &WebContextStore,
@ -1712,7 +1713,7 @@ unsafe impl<T: UserEvent> Sync for WryHandle<T> {}
impl<T: UserEvent> WryHandle<T> {
/// Creates a new tao window using a callback, and returns its window id.
pub fn create_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>(
pub fn create_tao_window<F: FnOnce() -> (String, TaoWindowBuilder) + Send + 'static>(
&self,
f: F,
) -> Result<Weak<Window>> {
@ -1845,7 +1846,7 @@ impl<T: UserEvent> Wry<T> {
) -> Result<Self> {
#[cfg(windows)]
if let Some(hook) = args.msg_hook {
use wry::application::platform::windows::EventLoopBuilderExtWindows;
use tao::platform::windows::EventLoopBuilderExtWindows;
event_loop_builder.with_msg_hook(hook);
}
Self::init(event_loop_builder.build())
@ -1897,7 +1898,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
target_os = "openbsd"
))]
fn new_any_thread(args: RuntimeInitArgs) -> Result<Self> {
use wry::application::platform::unix::EventLoopBuilderExtUnix;
use tao::platform::unix::EventLoopBuilderExtUnix;
let mut event_loop_builder = EventLoopBuilder::<Message<T>>::with_user_event();
event_loop_builder.with_any_thread(true);
Self::init_with_builder(event_loop_builder, args)
@ -1905,7 +1906,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
#[cfg(windows)]
fn new_any_thread(args: RuntimeInitArgs) -> Result<Self> {
use wry::application::platform::windows::EventLoopBuilderExtWindows;
use tao::platform::windows::EventLoopBuilderExtWindows;
let mut event_loop_builder = EventLoopBuilder::<Message<T>>::with_user_event();
event_loop_builder.with_any_thread(true);
Self::init_with_builder(event_loop_builder, args)
@ -1977,9 +1978,9 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
self
.event_loop
.set_activation_policy(match activation_policy {
ActivationPolicy::Regular => WryActivationPolicy::Regular,
ActivationPolicy::Accessory => WryActivationPolicy::Accessory,
ActivationPolicy::Prohibited => WryActivationPolicy::Prohibited,
ActivationPolicy::Regular => TaoActivationPolicy::Regular,
ActivationPolicy::Accessory => TaoActivationPolicy::Accessory,
ActivationPolicy::Prohibited => TaoActivationPolicy::Prohibited,
_ => unimplemented!(),
});
}
@ -2002,7 +2003,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
#[cfg(desktop)]
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, mut callback: F) -> RunIteration {
use wry::application::platform::run_return::EventLoopExtRunReturn;
use tao::platform::run_return::EventLoopExtRunReturn;
let windows = self.context.main_thread.windows.clone();
let webview_id_map = self.context.webview_id_map.clone();
let web_context = &self.context.main_thread.web_context;
@ -2144,12 +2145,12 @@ fn handle_user_message<T: UserEvent>(
target_os = "openbsd"
))]
{
use wry::webview::WebviewExtUnix;
use wry::WebViewExtUnix;
f(w.webview());
}
#[cfg(target_os = "macos")]
{
use wry::webview::WebviewExtMacOS;
use wry::WebViewExtMacOS;
f(Webview {
webview: w.webview(),
manager: w.manager(),
@ -2158,12 +2159,13 @@ fn handle_user_message<T: UserEvent>(
}
#[cfg(target_os = "ios")]
{
use wry::{application::platform::ios::WindowExtIOS, webview::WebviewExtIOS};
use tao::platform::ios::WindowExtIOS;
use wry::WebViewExtIOS;
f(Webview {
webview: w.webview(),
manager: w.manager(),
view_controller: w.window().ui_view_controller() as cocoa::base::id,
view_controller: window.ui_view_controller() as cocoa::base::id,
});
}
#[cfg(windows)]
@ -2508,22 +2510,22 @@ fn handle_event_loop<T: UserEvent>(
match event {
#[cfg(windows)]
WryWindowEvent::ThemeChanged(theme) => {
TaoWindowEvent::ThemeChanged(theme) => {
if let Some(window) = windows.borrow().get(&window_id) {
if let Some(WindowHandle::Webview { inner, .. }) = &window.inner {
let theme = match theme {
WryTheme::Dark => wry::webview::Theme::Dark,
WryTheme::Light => wry::webview::Theme::Light,
_ => wry::webview::Theme::Light,
TaoTheme::Dark => wry::Theme::Dark,
TaoTheme::Light => wry::Theme::Light,
_ => wry::Theme::Light,
};
inner.set_theme(theme);
}
}
}
WryWindowEvent::CloseRequested => {
TaoWindowEvent::CloseRequested => {
on_close_requested(callback, window_id, windows.clone());
}
WryWindowEvent::Destroyed => {
TaoWindowEvent::Destroyed => {
let removed = windows.borrow_mut().remove(&window_id).is_some();
if removed {
let is_empty = windows.borrow().is_empty();
@ -2611,13 +2613,13 @@ fn on_window_close(window_id: WebviewId, windows: Rc<RefCell<HashMap<WebviewId,
}
}
pub fn center_window(window: &Window, window_size: WryPhysicalSize<u32>) -> Result<()> {
pub fn center_window(window: &Window, window_size: TaoPhysicalSize<u32>) -> Result<()> {
if let Some(monitor) = window.current_monitor() {
let screen_size = monitor.size();
let monitor_pos = monitor.position();
let x = (screen_size.width as i32 - window_size.width as i32) / 2;
let y = (screen_size.height as i32 - window_size.height as i32) / 2;
window.set_outer_position(WryPhysicalPosition::new(
window.set_outer_position(TaoPhysicalPosition::new(
monitor_pos.x + x,
monitor_pos.y + y,
));
@ -2707,8 +2709,26 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
handler(raw);
}
let mut webview_builder = WebViewBuilder::new(window)
.map_err(|e| Error::CreateWebview(Box::new(e)))?
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
)))]
let builder = {
use wry::WebViewBuilderExtUnix;
let vbox = window.default_vbox().unwrap();
WebViewBuilder::new_gtk(vbox)
};
let mut webview_builder = builder
.with_focused(focused)
.with_url(&url)
.unwrap() // safe to unwrap because we validate the URL beforehand
@ -2732,8 +2752,8 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
page_load_handler(
url,
match event {
wry::webview::PageLoadEvent::Started => tauri_runtime::window::PageLoadEvent::Started,
wry::webview::PageLoadEvent::Finished => tauri_runtime::window::PageLoadEvent::Finished,
wry::PageLoadEvent::Started => tauri_runtime::window::PageLoadEvent::Started,
wry::PageLoadEvent::Finished => tauri_runtime::window::PageLoadEvent::Finished,
},
)
});
@ -2752,9 +2772,9 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
if let Some(theme) = window_theme {
webview_builder = webview_builder.with_theme(match theme {
WryTheme::Dark => wry::webview::Theme::Dark,
WryTheme::Light => wry::webview::Theme::Light,
_ => wry::webview::Theme::Light,
TaoTheme::Dark => wry::Theme::Dark,
TaoTheme::Light => wry::Theme::Light,
_ => wry::Theme::Light,
});
}
}
@ -2765,8 +2785,12 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
}
if let Some(handler) = ipc_handler {
webview_builder =
webview_builder.with_ipc_handler(create_ipc_handler(context.clone(), label.clone(), handler));
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
window_id,
context.clone(),
label.clone(),
handler,
));
}
for (scheme, protocol) in uri_scheme_protocols {
@ -2810,11 +2834,11 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
};
if webview_attributes.clipboard {
webview_builder.webview.clipboard = true;
webview_builder.attrs.clipboard = true;
}
if webview_attributes.incognito {
webview_builder.webview.incognito = true;
webview_builder.attrs.incognito = true;
}
#[cfg(any(debug_assertions, feature = "devtools"))]
@ -2876,6 +2900,7 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
Ok(WindowWrapper {
label,
inner: Some(WindowHandle::Webview {
window: Arc::new(window),
inner: Rc::new(webview),
context_store: web_context_store.clone(),
context_key: if automation_enabled {
@ -2890,12 +2915,12 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
/// Create a wry ipc handler from a tauri ipc handler.
fn create_ipc_handler<T: UserEvent>(
window_id: u32,
context: Context<T>,
label: String,
handler: WebviewIpcHandler<T, Wry<T>>,
) -> Box<IpcHandler> {
Box::new(move |window, request| {
let window_id = context.webview_id_map.get(&window.id()).unwrap();
Box::new(move |request| {
handler(
DetachedWindow {
dispatcher: WryDispatcher {
@ -2911,7 +2936,7 @@ fn create_ipc_handler<T: UserEvent>(
/// Create a wry file drop handler.
fn create_file_drop_handler(window_event_listeners: WindowEventListeners) -> Box<FileDropHandler> {
Box::new(move |_window, event| {
Box::new(move |event| {
let event: FileDropEvent = FileDropEventWrapper(event).into();
let window_event = WindowEvent::FileDrop(event);
let listeners_map = window_event_listeners.lock().unwrap();

View File

@ -10,9 +10,7 @@
target_os = "openbsd"
))]
mod imp {
use std::rc::Rc;
pub type Webview = Rc<webkit2gtk::WebView>;
pub type Webview = webkit2gtk::WebView;
}
#[cfg(target_os = "macos")]
@ -47,7 +45,7 @@ mod imp {
#[cfg(target_os = "android")]
mod imp {
use wry::webview::JniHandle;
use wry::JniHandle;
pub type Webview = JniHandle;
}

View File

@ -35,7 +35,7 @@ raw-window-handle = "0.5"
url = { version = "2" }
[target."cfg(windows)".dependencies.windows]
version = "0.51"
version = "0.52"
features = [ "Win32_Foundation" ]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]

View File

@ -87,11 +87,11 @@ objc = "0.2"
window-vibrancy = "0.4"
[target."cfg(windows)".dependencies]
webview2-com = "0.27"
webview2-com = "0.28"
window-vibrancy = "0.4"
[target."cfg(windows)".dependencies.windows]
version = "0.51"
version = "0.52"
features = [ "Win32_Foundation" ]
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]

View File

@ -267,7 +267,7 @@ pub struct AppHandle<R: Runtime> {
impl AppHandle<crate::Wry> {
/// Create a new tao window using a callback. The event loop must be running at this point.
pub fn create_tao_window<
F: FnOnce() -> (String, tauri_runtime_wry::WryWindowBuilder) + Send + 'static,
F: FnOnce() -> (String, tauri_runtime_wry::TaoWindowBuilder) + Send + 'static,
>(
&self,
f: F,

View File

@ -116,15 +116,30 @@ pub type Wry = tauri_runtime_wry::Wry<EventLoopMessage>;
#[macro_export]
macro_rules! android_binding {
($domain:ident, $package:ident, $main: ident, $wry: path) => {
::tauri::wry::android_binding!($domain, $package, $main, $wry);
::tauri::wry::application::android_fn!(
use $wry::{
android_setup,
prelude::{JClass, JNIEnv, JString},
};
::tauri::wry::android_binding!($domain, $package, $wry);
::tauri::tao::android_binding!(
$domain,
$package,
WryActivity,
android_setup,
$main,
::tauri::tao
);
::tauri::tao::platform::android::prelude::android_fn!(
app_tauri,
plugin,
PluginManager,
handlePluginResponse,
[i32, JString, JString],
);
::tauri::wry::application::android_fn!(
::tauri::tao::platform::android::prelude::android_fn!(
app_tauri,
plugin,
PluginManager,
@ -157,7 +172,7 @@ macro_rules! android_binding {
pub use plugin::mobile::{handle_android_plugin_response, send_channel_data};
#[cfg(all(feature = "wry", target_os = "android"))]
#[doc(hidden)]
pub use tauri_runtime_wry::wry;
pub use tauri_runtime_wry::{tao, wry};
/// A task to run on the main thread.
pub type SyncTask = Box<dyn FnOnce() + Send>;

View File

@ -1108,7 +1108,7 @@ impl PlatformWebview {
target_os = "openbsd"
)))
)]
pub fn inner(&self) -> std::rc::Rc<webkit2gtk::WebView> {
pub fn inner(&self) -> webkit2gtk::WebView {
self.0.clone()
}
@ -1159,7 +1159,7 @@ impl PlatformWebview {
/// Returns handle for JNI execution.
#[cfg(target_os = "android")]
pub fn jni_handle(&self) -> tauri_runtime_wry::wry::webview::JniHandle {
pub fn jni_handle(&self) -> tauri_runtime_wry::wry::JniHandle {
self.0
}
}
@ -2291,7 +2291,7 @@ impl<R: Runtime> Window<R> {
if let serde_json::Value::Object(map) = payload {
for v in map.values() {
if let serde_json::Value::String(s) = v {
crate::ipc::JavaScriptChannelId::from_str(s)
let _ = crate::ipc::JavaScriptChannelId::from_str(s)
.map(|id| id.channel_on(window.clone()));
}
}

File diff suppressed because one or more lines are too long

View File

@ -193,11 +193,11 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0"
dependencies = [
"async-lock",
"async-lock 2.8.0",
"async-task",
"concurrent-queue",
"fastrand 2.0.1",
"futures-lite",
"futures-lite 1.13.0",
"slab",
]
@ -207,10 +207,10 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06"
dependencies = [
"async-lock",
"async-lock 2.8.0",
"autocfg",
"blocking",
"futures-lite",
"futures-lite 1.13.0",
]
[[package]]
@ -219,20 +219,40 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
"async-lock",
"async-lock 2.8.0",
"autocfg",
"cfg-if",
"concurrent-queue",
"futures-lite",
"futures-lite 1.13.0",
"log",
"parking",
"polling",
"rustix 0.37.26",
"polling 2.8.0",
"rustix 0.37.27",
"slab",
"socket2 0.4.9",
"waker-fn",
]
[[package]]
name = "async-io"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997"
dependencies = [
"async-lock 3.0.0",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite 2.0.1",
"parking",
"polling 3.3.0",
"rustix 0.38.21",
"slab",
"tracing",
"waker-fn",
"windows-sys 0.48.0",
]
[[package]]
name = "async-lock"
version = "2.8.0"
@ -242,20 +262,31 @@ dependencies = [
"event-listener 2.5.3",
]
[[package]]
name = "async-lock"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45e900cdcd39bb94a14487d3f7ef92ca222162e6c7c3fe7cb3550ea75fb486ed"
dependencies = [
"event-listener 3.0.1",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-process"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88"
dependencies = [
"async-io",
"async-lock",
"async-io 1.13.0",
"async-lock 2.8.0",
"async-signal",
"blocking",
"cfg-if",
"event-listener 3.0.0",
"futures-lite",
"rustix 0.38.20",
"event-listener 3.0.1",
"futures-lite 1.13.0",
"rustix 0.38.21",
"windows-sys 0.48.0",
]
@ -272,17 +303,17 @@ dependencies = [
[[package]]
name = "async-signal"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2a5415b7abcdc9cd7d63d6badba5288b2ca017e3fbd4173b8f405449f1a2399"
checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
dependencies = [
"async-io",
"async-lock",
"async-io 2.2.0",
"async-lock 2.8.0",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix 0.38.20",
"rustix 0.38.21",
"signal-hook-registry",
"slab",
"windows-sys 0.48.0",
@ -398,11 +429,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a"
dependencies = [
"async-channel",
"async-lock",
"async-lock 2.8.0",
"async-task",
"fastrand 2.0.1",
"futures-io",
"futures-lite",
"futures-lite 1.13.0",
"piper",
"tracing",
]
@ -532,6 +563,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "chrono"
version = "0.4.31"
@ -1002,9 +1039,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
dependencies = [
"libc",
"windows-sys 0.48.0",
@ -1018,15 +1055,25 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "3.0.0"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29e56284f00d94c1bc7fd3c77027b4623c88c1f53d8d2394c6199f2921dea325"
checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160"
dependencies = [
"event-listener 3.0.1",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "1.9.0"
@ -1185,6 +1232,16 @@ dependencies = [
"waker-fn",
]
[[package]]
name = "futures-lite"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]]
name = "futures-macro"
version = "0.3.28"
@ -1306,6 +1363,20 @@ dependencies = [
"system-deps",
]
[[package]]
name = "gdkx11"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db2ea8a4909d530f79921290389cbd7c34cb9d623bfe970eaae65ca5f9cd9cce"
dependencies = [
"gdk",
"gdkx11-sys",
"gio",
"glib",
"libc",
"x11",
]
[[package]]
name = "gdkx11-sys"
version = "0.18.0"
@ -1666,7 +1737,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
"windows-core 0.51.1",
]
[[package]]
@ -1948,9 +2019,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "linux-raw-sys"
version = "0.4.10"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "lock_api"
@ -2551,6 +2622,20 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "polling"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531"
dependencies = [
"cfg-if",
"concurrent-queue",
"pin-project-lite",
"rustix 0.38.21",
"tracing",
"windows-sys 0.48.0",
]
[[package]]
name = "polyval"
version = "0.6.1"
@ -2744,15 +2829,6 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
@ -2871,9 +2947,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.37.26"
version = "0.37.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84f3f8f960ed3b5a59055428714943298bf3fa2d4a1d53135084e0544829d995"
checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2"
dependencies = [
"bitflags 1.3.2",
"errno",
@ -2885,14 +2961,14 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.20"
version = "0.38.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
dependencies = [
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys 0.4.10",
"linux-raw-sys 0.4.11",
"windows-sys 0.48.0",
]
@ -3326,26 +3402,19 @@ dependencies = [
[[package]]
name = "tao"
version = "0.23.0"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f130523fee9820ad78141d443e6cef75043acade79107bc483872bc183928c0f"
checksum = "3c0dff18fed076d29cb5779e918ef4b8a5dbb756204e4a027794f0bce233d949"
dependencies = [
"bitflags 1.3.2",
"cairo-rs",
"cc",
"cocoa 0.24.1",
"cocoa 0.25.0",
"core-foundation",
"core-graphics 0.22.3",
"core-graphics 0.23.1",
"crossbeam-channel",
"dispatch",
"gdk",
"gdk-pixbuf",
"gdk-sys",
"gdkwayland-sys",
"gdkx11-sys",
"gio",
"glib",
"glib-sys",
"gtk",
"image",
"instant",
@ -3362,13 +3431,12 @@ dependencies = [
"png",
"raw-window-handle",
"scopeguard",
"serde",
"tao-macros",
"unicode-segmentation",
"url",
"uuid",
"windows 0.51.1",
"windows 0.52.0",
"windows-implement",
"windows-version",
"x11-dl",
"zbus",
]
@ -3392,7 +3460,7 @@ checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
[[package]]
name = "tauri"
version = "2.0.0-alpha.17"
version = "2.0.0-alpha.18"
dependencies = [
"anyhow",
"bytes",
@ -3438,12 +3506,12 @@ dependencies = [
"webkit2gtk",
"webview2-com",
"window-vibrancy",
"windows 0.51.1",
"windows 0.52.0",
]
[[package]]
name = "tauri-build"
version = "2.0.0-alpha.11"
version = "2.0.0-alpha.12"
dependencies = [
"anyhow",
"cargo_toml",
@ -3464,7 +3532,7 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "2.0.0-alpha.10"
version = "2.0.0-alpha.11"
dependencies = [
"base64",
"brotli",
@ -3488,7 +3556,7 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "2.0.0-alpha.10"
version = "2.0.0-alpha.11"
dependencies = [
"heck",
"proc-macro2",
@ -3524,7 +3592,7 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
dependencies = [
"gtk",
"http",
@ -3535,12 +3603,12 @@ dependencies = [
"tauri-utils",
"thiserror",
"url",
"windows 0.51.1",
"windows 0.52.0",
]
[[package]]
name = "tauri-runtime-wry"
version = "1.0.0-alpha.5"
version = "1.0.0-alpha.6"
dependencies = [
"cocoa 0.24.1",
"gtk",
@ -3548,17 +3616,18 @@ dependencies = [
"jni",
"percent-encoding",
"raw-window-handle",
"tao",
"tauri-runtime",
"tauri-utils",
"webkit2gtk",
"webview2-com",
"windows 0.51.1",
"windows 0.52.0",
"wry",
]
[[package]]
name = "tauri-utils"
version = "2.0.0-alpha.10"
version = "2.0.0-alpha.11"
dependencies = [
"aes-gcm",
"brotli",
@ -3584,7 +3653,6 @@ dependencies = [
"thiserror",
"url",
"walkdir",
"windows-version",
]
[[package]]
@ -3599,14 +3667,14 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.8.0"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand 2.0.1",
"redox_syscall 0.3.5",
"rustix 0.38.20",
"redox_syscall 0.4.1",
"rustix 0.38.21",
"windows-sys 0.48.0",
]
@ -4201,14 +4269,14 @@ dependencies = [
[[package]]
name = "webview2-com"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd15556ff1d1d6bc850dbb362762bae86069773dd30177c90d3bfa917080dc73"
checksum = "e0ae9c7e420783826cf769d2c06ac9ba462f450eca5893bb8c6c6529a4e5dd33"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
"windows 0.51.1",
"windows-core",
"windows 0.52.0",
"windows-core 0.52.0",
"windows-implement",
"windows-interface",
]
@ -4226,13 +4294,13 @@ dependencies = [
[[package]]
name = "webview2-com-sys"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3775bb005c3170497ec411b36005708b57ad486bfa3d23864c92f5973858ce8d"
checksum = "d6ad85fceee6c42fa3d61239eba5a11401bf38407a849ed5ea1b407df08cca72"
dependencies = [
"thiserror",
"windows 0.51.1",
"windows-core",
"windows 0.52.0",
"windows-core 0.52.0",
]
[[package]]
@ -4301,14 +4369,14 @@ dependencies = [
[[package]]
name = "windows"
version = "0.51.1"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-core 0.52.0",
"windows-implement",
"windows-interface",
"windows-targets 0.48.5",
"windows-targets 0.52.0",
]
[[package]]
@ -4321,10 +4389,19 @@ dependencies = [
]
[[package]]
name = "windows-implement"
version = "0.51.1"
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb2b158efec5af20d8846836622f50a87e6556b9153a42772fa047f773c0e555"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "windows-implement"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946"
dependencies = [
"proc-macro2",
"quote",
@ -4333,9 +4410,9 @@ dependencies = [
[[package]]
name = "windows-interface"
version = "0.51.1"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0546e63e1ce64c04403d2311fa0e3ab5ae3a367bd524b4a38d8d8d18c70cfa76"
checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1"
dependencies = [
"proc-macro2",
"quote",
@ -4580,38 +4657,47 @@ dependencies = [
[[package]]
name = "wry"
version = "0.34.2"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f1e29660f22d8eec141f41f59b7fef231e4113c370c89b90ae3a0db8dec1927"
checksum = "764ce8212721205a90c79f5fa04f5135af597bea9072f22a5e7f39dcd0669f2e"
dependencies = [
"base64",
"block",
"cfg_aliases",
"cocoa 0.25.0",
"core-graphics 0.23.1",
"crossbeam-channel",
"dunce",
"gdkx11",
"gtk",
"html5ever",
"http",
"javascriptcore-rs",
"jni",
"kuchikiki",
"libc",
"log",
"ndk",
"ndk-context",
"ndk-sys",
"objc",
"objc_id",
"once_cell",
"raw-window-handle",
"serde",
"serde_json",
"sha2",
"soup3",
"tao",
"tao-macros",
"thiserror",
"url",
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
"windows 0.51.1",
"windows 0.52.0",
"windows-implement",
"windows-version",
"x11-dl",
]
[[package]]
@ -4654,8 +4740,8 @@ dependencies = [
"async-broadcast",
"async-executor",
"async-fs",
"async-io",
"async-lock",
"async-io 1.13.0",
"async-lock 2.8.0",
"async-process",
"async-recursion",
"async-task",

View File

@ -43,7 +43,7 @@ path = "../../../core/tauri"
features = ["test"]
[target."cfg(target_os = \"windows\")".dependencies]
window-shadows= "0.2"
window-shadows = "0.2"
[features]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@ -44,7 +44,7 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>(
#[cfg(desktop)]
{
let handle = app.handle();
tray::create_tray(&handle)?;
tray::create_tray(handle)?;
handle.plugin(tauri_plugin_cli::init())?;
}
@ -68,7 +68,7 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>(
.inner_size(1000., 800.)
.min_inner_size(600., 400.)
.content_protected(true)
.menu(tauri::menu::Menu::default(&app.handle())?);
.menu(tauri::menu::Menu::default(app.handle())?);
}
let window = window_builder.build().unwrap();

View File

@ -84,7 +84,7 @@
let consoleTextEl;
async function onMessage(value) {
messages.update((r) => [
...r
...r,
{
html:
`<pre><strong class="text-accent dark:text-darkAccent">[${new Date().toLocaleTimeString()}]:</strong> ` +
@ -100,7 +100,7 @@
// we only use it with our own input data
async function insecureRenderHtml(html) {
messages.update((r) => [
...r
...r,
{
html:
`<pre><strong class="text-accent dark:text-darkAccent">[${new Date().toLocaleTimeString()}]:</strong> ` +