mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-25 11:43:06 +03:00
refactor: optimize undecorated resizing handling (#8790)
* refactor: optimize undecorated resizing handling
* license
* separate modules
* fix windows
* rename export
* fix export
* same for gtk
* shared hit_test function
* change cursor on drag
* only set cursor on windows
* Revert "only set cursor on windows"
This reverts commit 03294a8430
.
* fix flickering on Windows, change cursor on motion on Linux
* remove changing cursor on move on linux
* fix linux implementation
* clippy
* Windows, on left click only
* prevent on fullscreen, use OS border size on Windows
* fix build
* clippy
---------
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
dbd525ca64
commit
77f49ad55e
@ -114,6 +114,16 @@ use std::{
|
||||
pub type WebviewId = u32;
|
||||
type IpcHandler = dyn Fn(String) + 'static;
|
||||
|
||||
#[cfg(any(
|
||||
windows,
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
mod undecorated_resizing;
|
||||
|
||||
mod webview;
|
||||
pub use webview::Webview;
|
||||
|
||||
@ -1858,6 +1868,9 @@ pub struct WindowWrapper {
|
||||
has_children: AtomicBool,
|
||||
webviews: Vec<WebviewWrapper>,
|
||||
window_event_listeners: WindowEventListeners,
|
||||
#[cfg(windows)]
|
||||
is_window_fullscreen: bool,
|
||||
#[cfg(windows)]
|
||||
is_window_transparent: bool,
|
||||
#[cfg(windows)]
|
||||
surface: Option<softbuffer::Surface<Arc<Window>, Arc<Window>>>,
|
||||
@ -1868,7 +1881,6 @@ impl fmt::Debug for WindowWrapper {
|
||||
f.debug_struct("WindowWrapper")
|
||||
.field("label", &self.label)
|
||||
.field("inner", &self.inner)
|
||||
.field("is_window_transparent", &self.is_window_transparent)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
@ -2603,6 +2615,10 @@ fn handle_user_message<T: UserEvent>(
|
||||
} else {
|
||||
window.set_fullscreen(None)
|
||||
}
|
||||
#[cfg(windows)]
|
||||
if let Some(w) = windows.borrow_mut().get_mut(&id) {
|
||||
w.is_window_fullscreen = fullscreen;
|
||||
}
|
||||
}
|
||||
WindowMessage::SetFocus => {
|
||||
window.set_focus();
|
||||
@ -2838,7 +2854,12 @@ fn handle_user_message<T: UserEvent>(
|
||||
},
|
||||
Message::CreateRawWindow(window_id, handler, sender) => {
|
||||
let (label, builder) = handler();
|
||||
|
||||
#[cfg(windows)]
|
||||
let is_window_fullscreen = builder.window.fullscreen.is_some();
|
||||
#[cfg(windows)]
|
||||
let is_window_transparent = builder.window.transparent;
|
||||
|
||||
if let Ok(window) = builder.build(event_loop) {
|
||||
window_id_map.insert(window.id(), window_id);
|
||||
|
||||
@ -2868,6 +2889,9 @@ fn handle_user_message<T: UserEvent>(
|
||||
inner: Some(window.clone()),
|
||||
window_event_listeners: Default::default(),
|
||||
webviews: Vec::new(),
|
||||
#[cfg(windows)]
|
||||
is_window_fullscreen,
|
||||
#[cfg(windows)]
|
||||
is_window_transparent,
|
||||
#[cfg(windows)]
|
||||
surface,
|
||||
@ -3192,7 +3216,10 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
|
||||
|
||||
let window_event_listeners = WindowEventListeners::default();
|
||||
|
||||
#[cfg(windows)]
|
||||
let is_window_transparent = window_builder.inner.window.transparent;
|
||||
#[cfg(windows)]
|
||||
let is_window_fullscreen = window_builder.inner.window.fullscreen.is_some();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
@ -3324,6 +3351,9 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
|
||||
inner: Some(window),
|
||||
webviews,
|
||||
window_event_listeners,
|
||||
#[cfg(windows)]
|
||||
is_window_fullscreen,
|
||||
#[cfg(windows)]
|
||||
is_window_transparent,
|
||||
#[cfg(windows)]
|
||||
surface,
|
||||
@ -3413,6 +3443,11 @@ fn create_webview<T: UserEvent>(
|
||||
.with_transparent(webview_attributes.transparent)
|
||||
.with_accept_first_mouse(webview_attributes.accept_first_mouse);
|
||||
|
||||
#[cfg(windows)]
|
||||
if kind == WebviewKind::WindowContent {
|
||||
webview_builder = webview_builder.with_initialization_script(undecorated_resizing::SCRIPT);
|
||||
}
|
||||
|
||||
if webview_attributes.file_drop_handler_enabled {
|
||||
let proxy = context.proxy.clone();
|
||||
webview_builder = webview_builder.with_file_drop_handler(move |event| {
|
||||
@ -3541,15 +3576,14 @@ fn create_webview<T: UserEvent>(
|
||||
webview_builder = webview_builder.with_https_scheme(false);
|
||||
}
|
||||
|
||||
if let Some(handler) = ipc_handler {
|
||||
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
|
||||
window_id,
|
||||
id,
|
||||
context.clone(),
|
||||
label.clone(),
|
||||
handler,
|
||||
));
|
||||
}
|
||||
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
|
||||
kind,
|
||||
window_id,
|
||||
id,
|
||||
context.clone(),
|
||||
label.clone(),
|
||||
ipc_handler,
|
||||
));
|
||||
|
||||
for (scheme, protocol) in uri_scheme_protocols {
|
||||
webview_builder =
|
||||
@ -3626,6 +3660,17 @@ fn create_webview<T: UserEvent>(
|
||||
.build()
|
||||
.map_err(|e| Error::CreateWebview(Box::new(e)))?;
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
if kind == WebviewKind::WindowContent {
|
||||
undecorated_resizing::attach_resize_handler(&webview);
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
if kind == WebviewKind::WindowContent {
|
||||
let controller = webview.controller();
|
||||
@ -3679,24 +3724,34 @@ fn create_webview<T: UserEvent>(
|
||||
|
||||
/// Create a wry ipc handler from a tauri ipc handler.
|
||||
fn create_ipc_handler<T: UserEvent>(
|
||||
_kind: WebviewKind,
|
||||
window_id: WindowId,
|
||||
webview_id: WebviewId,
|
||||
context: Context<T>,
|
||||
label: String,
|
||||
handler: WebviewIpcHandler<T, Wry<T>>,
|
||||
ipc_handler: Option<WebviewIpcHandler<T, Wry<T>>>,
|
||||
) -> Box<IpcHandler> {
|
||||
Box::new(move |request| {
|
||||
handler(
|
||||
DetachedWebview {
|
||||
label: label.clone(),
|
||||
dispatcher: WryWebviewDispatcher {
|
||||
window_id,
|
||||
webview_id,
|
||||
context: context.clone(),
|
||||
#[cfg(windows)]
|
||||
if _kind == WebviewKind::WindowContent
|
||||
&& undecorated_resizing::handle_request(context.clone(), window_id, &request)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(handler) = &ipc_handler {
|
||||
handler(
|
||||
DetachedWebview {
|
||||
label: label.clone(),
|
||||
dispatcher: WryWebviewDispatcher {
|
||||
window_id,
|
||||
webview_id,
|
||||
context: context.clone(),
|
||||
},
|
||||
},
|
||||
},
|
||||
request,
|
||||
);
|
||||
request,
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
328
core/tauri-runtime-wry/src/undecorated_resizing.rs
Normal file
328
core/tauri-runtime-wry/src/undecorated_resizing.rs
Normal file
@ -0,0 +1,328 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg(any(
|
||||
windows,
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
|
||||
const CLIENT: isize = 0b0000;
|
||||
const LEFT: isize = 0b0001;
|
||||
const RIGHT: isize = 0b0010;
|
||||
const TOP: isize = 0b0100;
|
||||
const BOTTOM: isize = 0b1000;
|
||||
const TOPLEFT: isize = TOP | LEFT;
|
||||
const TOPRIGHT: isize = TOP | RIGHT;
|
||||
const BOTTOMLEFT: isize = BOTTOM | LEFT;
|
||||
const BOTTOMRIGHT: isize = BOTTOM | RIGHT;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub use self::gtk::*;
|
||||
#[cfg(windows)]
|
||||
pub use self::windows::*;
|
||||
|
||||
#[cfg(windows)]
|
||||
type WindowDimensions = u32;
|
||||
#[cfg(not(windows))]
|
||||
type WindowDimensions = i32;
|
||||
#[cfg(windows)]
|
||||
type WindowPositions = i32;
|
||||
#[cfg(not(windows))]
|
||||
type WindowPositions = f64;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
enum HitTestResult {
|
||||
Client,
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom,
|
||||
TopLeft,
|
||||
TopRight,
|
||||
BottomLeft,
|
||||
BottomRight,
|
||||
NoWhere,
|
||||
}
|
||||
|
||||
fn hit_test(
|
||||
width: WindowDimensions,
|
||||
height: WindowDimensions,
|
||||
x: WindowPositions,
|
||||
y: WindowPositions,
|
||||
border_x: WindowPositions,
|
||||
border_y: WindowPositions,
|
||||
) -> HitTestResult {
|
||||
#[cfg(windows)]
|
||||
let (top, left) = (0, 0);
|
||||
#[cfg(not(windows))]
|
||||
let (top, left) = (0., 0.);
|
||||
|
||||
let bottom = top + height as WindowPositions;
|
||||
let right = left + width as WindowPositions;
|
||||
|
||||
#[rustfmt::skip]
|
||||
let result = (LEFT * (x < left + border_x) as isize)
|
||||
| (RIGHT * (x >= right - border_x) as isize)
|
||||
| (TOP * (y < top + border_y) as isize)
|
||||
| (BOTTOM * (y >= bottom - border_y) as isize);
|
||||
|
||||
match result {
|
||||
CLIENT => HitTestResult::Client,
|
||||
LEFT => HitTestResult::Left,
|
||||
RIGHT => HitTestResult::Right,
|
||||
TOP => HitTestResult::Top,
|
||||
BOTTOM => HitTestResult::Bottom,
|
||||
TOPLEFT => HitTestResult::TopLeft,
|
||||
TOPRIGHT => HitTestResult::TopRight,
|
||||
BOTTOMLEFT => HitTestResult::BottomLeft,
|
||||
BOTTOMRIGHT => HitTestResult::BottomRight,
|
||||
_ => HitTestResult::NoWhere,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
mod windows {
|
||||
use super::{hit_test, HitTestResult};
|
||||
|
||||
use tao::window::{CursorIcon, ResizeDirection, Window};
|
||||
use windows::Win32::UI::WindowsAndMessaging::{
|
||||
GetSystemMetrics, SM_CXFRAME, SM_CXPADDEDBORDER, SM_CYFRAME,
|
||||
};
|
||||
|
||||
const MESSAGE_MOUSEMOVE: &str = "__internal_on_mousemove__|";
|
||||
const MESSAGE_MOUSEDOWN: &str = "__internal_on_mousedown__|";
|
||||
pub const SCRIPT: &str = r#"
|
||||
;(function () {
|
||||
document.addEventListener('mousemove', (e) => {
|
||||
window.ipc.postMessage(
|
||||
`__internal_on_mousemove__|${e.clientX},${e.clientY}`
|
||||
)
|
||||
})
|
||||
document.addEventListener('mousedown', (e) => {
|
||||
if (e.button === 0) {
|
||||
window.ipc.postMessage(
|
||||
`__internal_on_mousedown__|${e.clientX},${e.clientY}`
|
||||
)
|
||||
}
|
||||
})
|
||||
})()
|
||||
"#;
|
||||
|
||||
impl HitTestResult {
|
||||
fn drag_resize_window(&self, window: &Window) {
|
||||
self.change_cursor(window);
|
||||
let edge = match self {
|
||||
HitTestResult::Left => ResizeDirection::West,
|
||||
HitTestResult::Right => ResizeDirection::East,
|
||||
HitTestResult::Top => ResizeDirection::North,
|
||||
HitTestResult::Bottom => ResizeDirection::South,
|
||||
HitTestResult::TopLeft => ResizeDirection::NorthWest,
|
||||
HitTestResult::TopRight => ResizeDirection::NorthEast,
|
||||
HitTestResult::BottomLeft => ResizeDirection::SouthWest,
|
||||
HitTestResult::BottomRight => ResizeDirection::SouthEast,
|
||||
|
||||
// if not on an edge, don't start resizing
|
||||
_ => return,
|
||||
};
|
||||
let _ = window.drag_resize_window(edge);
|
||||
}
|
||||
|
||||
fn change_cursor(&self, window: &Window) {
|
||||
let cursor = match self {
|
||||
HitTestResult::Left => CursorIcon::WResize,
|
||||
HitTestResult::Right => CursorIcon::EResize,
|
||||
HitTestResult::Top => CursorIcon::NResize,
|
||||
HitTestResult::Bottom => CursorIcon::SResize,
|
||||
HitTestResult::TopLeft => CursorIcon::NwResize,
|
||||
HitTestResult::TopRight => CursorIcon::NeResize,
|
||||
HitTestResult::BottomLeft => CursorIcon::SwResize,
|
||||
HitTestResult::BottomRight => CursorIcon::SeResize,
|
||||
|
||||
// if not on an edge, don't change the cursor, otherwise we cause flickering
|
||||
_ => return,
|
||||
};
|
||||
window.set_cursor_icon(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns whether handled or not
|
||||
pub fn handle_request<T: crate::UserEvent>(
|
||||
context: crate::Context<T>,
|
||||
window_id: crate::WindowId,
|
||||
request: &str,
|
||||
) -> bool {
|
||||
if let Some(args) = request.strip_prefix(MESSAGE_MOUSEMOVE) {
|
||||
if let Some(window) = context.main_thread.windows.borrow().get(&window_id) {
|
||||
if let Some(w) = window.inner.as_ref() {
|
||||
if !w.is_decorated()
|
||||
&& w.is_resizable()
|
||||
&& !w.is_maximized()
|
||||
&& !window.is_window_fullscreen
|
||||
{
|
||||
let (x, y) = args.split_once(',').unwrap();
|
||||
let (x, y) = (x.parse().unwrap(), y.parse().unwrap());
|
||||
let size = w.inner_size();
|
||||
let padded_border = unsafe { GetSystemMetrics(SM_CXPADDEDBORDER) };
|
||||
let border_x = unsafe { GetSystemMetrics(SM_CXFRAME) + padded_border };
|
||||
let border_y = unsafe { GetSystemMetrics(SM_CYFRAME) + padded_border };
|
||||
hit_test(size.width, size.height, x, y, border_x, border_y).change_cursor(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if let Some(args) = request.strip_prefix(MESSAGE_MOUSEDOWN) {
|
||||
if let Some(window) = context.main_thread.windows.borrow().get(&window_id) {
|
||||
if let Some(w) = window.inner.as_ref() {
|
||||
if !w.is_decorated()
|
||||
&& w.is_resizable()
|
||||
&& !w.is_maximized()
|
||||
&& !window.is_window_fullscreen
|
||||
{
|
||||
let (x, y) = args.split_once(',').unwrap();
|
||||
let (x, y) = (x.parse().unwrap(), y.parse().unwrap());
|
||||
let size = w.inner_size();
|
||||
let padded_border = unsafe { GetSystemMetrics(SM_CXPADDEDBORDER) };
|
||||
let border_x = unsafe { GetSystemMetrics(SM_CXFRAME) + padded_border };
|
||||
let border_y = unsafe { GetSystemMetrics(SM_CYFRAME) + padded_border };
|
||||
hit_test(size.width, size.height, x, y, border_x, border_y).drag_resize_window(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
mod gtk {
|
||||
use super::{hit_test, HitTestResult};
|
||||
|
||||
const BORDERLESS_RESIZE_INSET: i32 = 5;
|
||||
|
||||
impl HitTestResult {
|
||||
fn to_gtk_edge(self) -> gtk::gdk::WindowEdge {
|
||||
match self {
|
||||
HitTestResult::Client | HitTestResult::NoWhere => gtk::gdk::WindowEdge::__Unknown(0),
|
||||
HitTestResult::Left => gtk::gdk::WindowEdge::West,
|
||||
HitTestResult::Right => gtk::gdk::WindowEdge::East,
|
||||
HitTestResult::Top => gtk::gdk::WindowEdge::North,
|
||||
HitTestResult::Bottom => gtk::gdk::WindowEdge::South,
|
||||
HitTestResult::TopLeft => gtk::gdk::WindowEdge::NorthWest,
|
||||
HitTestResult::TopRight => gtk::gdk::WindowEdge::NorthEast,
|
||||
HitTestResult::BottomLeft => gtk::gdk::WindowEdge::SouthWest,
|
||||
HitTestResult::BottomRight => gtk::gdk::WindowEdge::SouthEast,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attach_resize_handler(webview: &wry::WebView) {
|
||||
use gtk::{
|
||||
gdk::{prelude::*, WindowEdge},
|
||||
glib::Propagation,
|
||||
prelude::*,
|
||||
};
|
||||
use wry::WebViewExtUnix;
|
||||
|
||||
let webview = webview.webview();
|
||||
|
||||
webview.add_events(
|
||||
gtk::gdk::EventMask::BUTTON1_MOTION_MASK
|
||||
| gtk::gdk::EventMask::BUTTON_PRESS_MASK
|
||||
| gtk::gdk::EventMask::TOUCH_MASK,
|
||||
);
|
||||
|
||||
webview.connect_button_press_event(
|
||||
move |webview: &webkit2gtk::WebView, event: >k::gdk::EventButton| {
|
||||
if event.button() == 1 {
|
||||
// This one should be GtkBox
|
||||
if let Some(window) = webview.parent().and_then(|w| w.parent()) {
|
||||
// Safe to unwrap unless this is not from tao
|
||||
let window: gtk::Window = window.downcast().unwrap();
|
||||
if !window.is_decorated() && window.is_resizable() && !window.is_maximized() {
|
||||
if let Some(window) = window.window() {
|
||||
let (root_x, root_y) = event.root();
|
||||
let (window_x, window_y) = window.position();
|
||||
let (client_x, client_y) = (root_x - window_x as f64, root_y - window_y as f64);
|
||||
let border = window.scale_factor() * BORDERLESS_RESIZE_INSET;
|
||||
let edge = hit_test(
|
||||
window.width(),
|
||||
window.height(),
|
||||
client_x,
|
||||
client_y,
|
||||
border as _,
|
||||
border as _,
|
||||
)
|
||||
.to_gtk_edge();
|
||||
|
||||
// we ignore the `__Unknown` variant so the webview receives the click correctly if it is not on the edges.
|
||||
match edge {
|
||||
WindowEdge::__Unknown(_) => (),
|
||||
_ => {
|
||||
window.begin_resize_drag(edge, 1, root_x as i32, root_y as i32, event.time())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Propagation::Proceed
|
||||
},
|
||||
);
|
||||
|
||||
webview.connect_touch_event(
|
||||
move |webview: &webkit2gtk::WebView, event: >k::gdk::Event| {
|
||||
// This one should be GtkBox
|
||||
if let Some(window) = webview.parent().and_then(|w| w.parent()) {
|
||||
// Safe to unwrap unless this is not from tao
|
||||
let window: gtk::Window = window.downcast().unwrap();
|
||||
if !window.is_decorated() && window.is_resizable() && !window.is_maximized() {
|
||||
if let Some(window) = window.window() {
|
||||
if let Some((root_x, root_y)) = event.root_coords() {
|
||||
if let Some(device) = event.device() {
|
||||
let (window_x, window_y) = window.position();
|
||||
let (client_x, client_y) = (root_x - window_x as f64, root_y - window_y as f64);
|
||||
let border = window.scale_factor() * BORDERLESS_RESIZE_INSET;
|
||||
let edge = hit_test(
|
||||
window.width(),
|
||||
window.height(),
|
||||
client_x,
|
||||
client_y,
|
||||
border as _,
|
||||
border as _,
|
||||
)
|
||||
.to_gtk_edge();
|
||||
|
||||
// we ignore the `__Unknown` variant so the window receives the click correctly if it is not on the edges.
|
||||
match edge {
|
||||
WindowEdge::__Unknown(_) => (),
|
||||
_ => window.begin_resize_drag_for_device(
|
||||
edge,
|
||||
&device,
|
||||
0,
|
||||
root_x as i32,
|
||||
root_y as i32,
|
||||
event.time(),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Propagation::Proceed
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -106,8 +106,6 @@ const PLUGINS: &[(&str, &[(&str, bool)])] = &[
|
||||
("toggle_maximize", false),
|
||||
// internal
|
||||
("internal_toggle_maximize", true),
|
||||
("internal_on_mousemove", true),
|
||||
("internal_on_mousedown", true),
|
||||
],
|
||||
),
|
||||
(
|
||||
|
@ -72,22 +72,6 @@ Enables the inner_size command without any pre-configured scope.
|
||||
|
||||
Denies the inner_size command without any pre-configured scope.
|
||||
|
||||
## allow-internal-on-mousedown
|
||||
|
||||
Enables the internal_on_mousedown command without any pre-configured scope.
|
||||
|
||||
## deny-internal-on-mousedown
|
||||
|
||||
Denies the internal_on_mousedown command without any pre-configured scope.
|
||||
|
||||
## allow-internal-on-mousemove
|
||||
|
||||
Enables the internal_on_mousemove command without any pre-configured scope.
|
||||
|
||||
## deny-internal-on-mousemove
|
||||
|
||||
Denies the internal_on_mousemove command without any pre-configured scope.
|
||||
|
||||
## allow-internal-toggle-maximize
|
||||
|
||||
Enables the internal_toggle_maximize command without any pre-configured scope.
|
||||
|
@ -204,115 +204,6 @@ mod desktop_commands {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum HitTestResult {
|
||||
Client,
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom,
|
||||
TopLeft,
|
||||
TopRight,
|
||||
BottomLeft,
|
||||
BottomRight,
|
||||
NoWhere,
|
||||
}
|
||||
|
||||
impl HitTestResult {
|
||||
fn drag_resize_window<R: Runtime>(&self, window: &Window<R>) {
|
||||
let _ = window.start_resize_dragging(match self {
|
||||
HitTestResult::Left => ResizeDirection::West,
|
||||
HitTestResult::Right => ResizeDirection::East,
|
||||
HitTestResult::Top => ResizeDirection::North,
|
||||
HitTestResult::Bottom => ResizeDirection::South,
|
||||
HitTestResult::TopLeft => ResizeDirection::NorthWest,
|
||||
HitTestResult::TopRight => ResizeDirection::NorthEast,
|
||||
HitTestResult::BottomLeft => ResizeDirection::SouthWest,
|
||||
HitTestResult::BottomRight => ResizeDirection::SouthEast,
|
||||
_ => unreachable!(),
|
||||
});
|
||||
}
|
||||
|
||||
fn change_cursor<R: Runtime>(&self, window: &Window<R>) {
|
||||
let _ = window.set_cursor_icon(match self {
|
||||
HitTestResult::Left => CursorIcon::WResize,
|
||||
HitTestResult::Right => CursorIcon::EResize,
|
||||
HitTestResult::Top => CursorIcon::NResize,
|
||||
HitTestResult::Bottom => CursorIcon::SResize,
|
||||
HitTestResult::TopLeft => CursorIcon::NwResize,
|
||||
HitTestResult::TopRight => CursorIcon::NeResize,
|
||||
HitTestResult::BottomLeft => CursorIcon::SwResize,
|
||||
HitTestResult::BottomRight => CursorIcon::SeResize,
|
||||
_ => CursorIcon::Default,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn hit_test(window_size: PhysicalSize<u32>, x: i32, y: i32, scale: f64) -> HitTestResult {
|
||||
const BORDERLESS_RESIZE_INSET: f64 = 5.0;
|
||||
|
||||
const CLIENT: isize = 0b0000;
|
||||
const LEFT: isize = 0b0001;
|
||||
const RIGHT: isize = 0b0010;
|
||||
const TOP: isize = 0b0100;
|
||||
const BOTTOM: isize = 0b1000;
|
||||
const TOPLEFT: isize = TOP | LEFT;
|
||||
const TOPRIGHT: isize = TOP | RIGHT;
|
||||
const BOTTOMLEFT: isize = BOTTOM | LEFT;
|
||||
const BOTTOMRIGHT: isize = BOTTOM | RIGHT;
|
||||
|
||||
let top = 0;
|
||||
let left = 0;
|
||||
let bottom = top + window_size.height as i32;
|
||||
let right = left + window_size.width as i32;
|
||||
|
||||
let inset = (BORDERLESS_RESIZE_INSET * scale) as i32;
|
||||
|
||||
#[rustfmt::skip]
|
||||
let result =
|
||||
(LEFT * (if x < (left + inset) { 1 } else { 0 }))
|
||||
| (RIGHT * (if x >= (right - inset) { 1 } else { 0 }))
|
||||
| (TOP * (if y < (top + inset) { 1 } else { 0 }))
|
||||
| (BOTTOM * (if y >= (bottom - inset) { 1 } else { 0 }));
|
||||
|
||||
match result {
|
||||
CLIENT => HitTestResult::Client,
|
||||
LEFT => HitTestResult::Left,
|
||||
RIGHT => HitTestResult::Right,
|
||||
TOP => HitTestResult::Top,
|
||||
BOTTOM => HitTestResult::Bottom,
|
||||
TOPLEFT => HitTestResult::TopLeft,
|
||||
TOPRIGHT => HitTestResult::TopRight,
|
||||
BOTTOMLEFT => HitTestResult::BottomLeft,
|
||||
BOTTOMRIGHT => HitTestResult::BottomRight,
|
||||
_ => HitTestResult::NoWhere,
|
||||
}
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
pub async fn internal_on_mousemove<R: Runtime>(
|
||||
window: Window<R>,
|
||||
x: i32,
|
||||
y: i32,
|
||||
) -> crate::Result<()> {
|
||||
hit_test(window.inner_size()?, x, y, window.scale_factor()?).change_cursor(&window);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
pub async fn internal_on_mousedown<R: Runtime>(
|
||||
window: Window<R>,
|
||||
x: i32,
|
||||
y: i32,
|
||||
) -> crate::Result<()> {
|
||||
let res = hit_test(window.inner_size()?, x, y, window.scale_factor()?);
|
||||
match res {
|
||||
HitTestResult::Client | HitTestResult::NoWhere => {}
|
||||
_ => res.drag_resize_window(&window),
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the plugin.
|
||||
@ -336,21 +227,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
.into_string(),
|
||||
);
|
||||
|
||||
#[derive(Template)]
|
||||
#[default_template("./scripts/undecorated-resizing.js")]
|
||||
struct UndecoratedResizingJavascript<'a> {
|
||||
os_name: &'a str,
|
||||
}
|
||||
|
||||
init_script.push_str(
|
||||
&UndecoratedResizingJavascript {
|
||||
os_name: std::env::consts::OS,
|
||||
}
|
||||
.render_default(&Default::default())
|
||||
.unwrap()
|
||||
.into_string(),
|
||||
);
|
||||
|
||||
Builder::new("window")
|
||||
.js_init_script(init_script)
|
||||
.invoke_handler(|invoke| {
|
||||
@ -421,8 +297,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
desktop_commands::set_visible_on_all_workspaces,
|
||||
desktop_commands::toggle_maximize,
|
||||
desktop_commands::internal_toggle_maximize,
|
||||
desktop_commands::internal_on_mousemove,
|
||||
desktop_commands::internal_on_mousedown,
|
||||
]);
|
||||
handler(invoke)
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
;(function () {
|
||||
const osName = __TEMPLATE_os_name__
|
||||
if (osName !== 'macos' && osName !== 'ios' && osName !== 'android') {
|
||||
document.addEventListener('mousemove', (e) => {
|
||||
window.__TAURI_INTERNALS__.invoke('plugin:window|internal_on_mousemove', {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
})
|
||||
})
|
||||
document.addEventListener('mousedown', (e) => {
|
||||
window.__TAURI_INTERNALS__.invoke('plugin:window|internal_on_mousedown', {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
})
|
||||
})
|
||||
}
|
||||
})()
|
218
examples/api/src-tauri/Cargo.lock
generated
218
examples/api/src-tauri/Cargo.lock
generated
@ -107,9 +107,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
@ -242,9 +242,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744"
|
||||
checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65"
|
||||
dependencies = [
|
||||
"async-lock 3.3.0",
|
||||
"cfg-if",
|
||||
@ -253,7 +253,7 @@ dependencies = [
|
||||
"futures-lite 2.2.0",
|
||||
"parking",
|
||||
"polling 3.3.2",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"slab",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
@ -292,7 +292,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"event-listener 3.1.0",
|
||||
"futures-lite 1.13.0",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
@ -313,13 +313,13 @@ version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
|
||||
dependencies = [
|
||||
"async-io 2.3.0",
|
||||
"async-io 2.3.1",
|
||||
"async-lock 2.8.0",
|
||||
"atomic-waker",
|
||||
"cfg-if",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"windows-sys 0.48.0",
|
||||
@ -473,9 +473,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.14.0"
|
||||
version = "1.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
|
||||
checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
@ -629,9 +629,9 @@ checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.32"
|
||||
version = "0.4.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a"
|
||||
checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
@ -882,9 +882,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.3"
|
||||
version = "0.20.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e"
|
||||
checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
@ -892,9 +892,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.3"
|
||||
version = "0.20.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621"
|
||||
checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
@ -906,9 +906,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.3"
|
||||
version = "0.20.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
|
||||
checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
@ -1011,7 +1011,7 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"drm-ffi",
|
||||
"drm-fourcc",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1021,7 +1021,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6"
|
||||
dependencies = [
|
||||
"drm-sys",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1608,7 +1608,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-crate 2.0.1",
|
||||
"proc-macro-crate 2.0.2",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1706,7 +1706,7 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap 2.1.0",
|
||||
"indexmap 2.2.2",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
@ -1733,9 +1733,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
|
||||
checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
@ -1823,9 +1823,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.59"
|
||||
version = "0.1.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539"
|
||||
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
@ -1895,9 +1895,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.1.0"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
||||
checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.14.3",
|
||||
@ -2092,9 +2092,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.152"
|
||||
version = "0.2.153"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@ -2237,9 +2237,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92"
|
||||
checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -2270,9 +2270,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"simd-adler32",
|
||||
@ -2370,6 +2370,12 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
@ -2705,9 +2711,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"indexmap 2.1.0",
|
||||
"indexmap 2.2.2",
|
||||
"line-wrap",
|
||||
"quick-xml 0.31.0",
|
||||
"quick-xml",
|
||||
"serde",
|
||||
"time",
|
||||
]
|
||||
@ -2750,7 +2756,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"pin-project-lite",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
@ -2797,9 +2803,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
|
||||
checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24"
|
||||
dependencies = [
|
||||
"toml_datetime",
|
||||
"toml_edit 0.20.2",
|
||||
@ -2844,15 +2850,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.31.0"
|
||||
@ -2992,7 +2989,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata 0.4.4",
|
||||
"regex-automata 0.4.5",
|
||||
"regex-syntax 0.8.2",
|
||||
]
|
||||
|
||||
@ -3007,9 +3004,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.4"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a"
|
||||
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -3030,9 +3027,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.23"
|
||||
version = "0.11.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
|
||||
checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
@ -3053,6 +3050,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
@ -3096,9 +3094,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.30"
|
||||
version = "0.38.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca"
|
||||
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"errno",
|
||||
@ -3213,18 +3211,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.195"
|
||||
version = "1.0.196"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
|
||||
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.195"
|
||||
version = "1.0.196"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
|
||||
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3244,9 +3242,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.111"
|
||||
version = "1.0.113"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
|
||||
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79"
|
||||
dependencies = [
|
||||
"itoa 1.0.10",
|
||||
"ryu",
|
||||
@ -3287,15 +3285,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.5.1"
|
||||
version = "3.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c"
|
||||
checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.1.0",
|
||||
"indexmap 2.2.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with_macros",
|
||||
@ -3304,9 +3302,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.5.1"
|
||||
version = "3.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbff351eb4b33600a2e138dfa0b10b65a238ea8ff8fb2387c422c5022a3e8298"
|
||||
checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@ -3453,7 +3451,7 @@ dependencies = [
|
||||
"objc",
|
||||
"raw-window-handle 0.6.0",
|
||||
"redox_syscall",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"tiny-xlib",
|
||||
"wasm-bindgen",
|
||||
"wayland-backend",
|
||||
@ -3582,6 +3580,12 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
@ -3801,14 +3805,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-cli"
|
||||
version = "2.0.0-alpha.6"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#61edbbec0acda4213ed8684f75a973e8be123a52"
|
||||
version = "2.0.0-beta.0"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#dac8b6331ca1a90df5e5dac27a209445fd6e5124"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -3905,14 +3910,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.9.0"
|
||||
version = "3.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
|
||||
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand 2.0.1",
|
||||
"redox_syscall",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
@ -3965,12 +3969,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.31"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
|
||||
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa 1.0.10",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
@ -3985,10 +3990,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
|
||||
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
@ -4034,9 +4040,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -4101,7 +4107,7 @@ version = "0.19.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||
dependencies = [
|
||||
"indexmap 2.1.0",
|
||||
"indexmap 2.2.2",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@ -4114,7 +4120,7 @@ version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
|
||||
dependencies = [
|
||||
"indexmap 2.1.0",
|
||||
"indexmap 2.2.2",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@ -4190,9 +4196,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tray-icon"
|
||||
version = "0.11.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fad962d06d2bfd9b2ab4f665fc73b175523b834b1466a294520201c5845145f8"
|
||||
checksum = "fd26786733426b0bf632ebab410c162859a911f26c7c9e208b9e329a8ca94481"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
@ -4210,9 +4216,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "treediff"
|
||||
version = "4.0.2"
|
||||
version = "4.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303"
|
||||
checksum = "4d127780145176e2b5d16611cc25a900150e86e9fd79d3bde6ff3a37359c9cb5"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
@ -4464,9 +4470,9 @@ checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-streams"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7"
|
||||
checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"js-sys",
|
||||
@ -4477,13 +4483,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4"
|
||||
checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
"nix",
|
||||
"rustix 0.38.31",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
@ -4491,24 +4497,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.1"
|
||||
version = "0.31.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3"
|
||||
checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"nix",
|
||||
"rustix 0.38.31",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.31.0"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c"
|
||||
checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml 0.30.0",
|
||||
"quick-xml",
|
||||
"quote",
|
||||
]
|
||||
|
||||
@ -4931,9 +4937,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.34"
|
||||
version = "0.5.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
|
||||
checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@ -5035,7 +5041,7 @@ dependencies = [
|
||||
"libc",
|
||||
"libloading 0.8.1",
|
||||
"once_cell",
|
||||
"rustix 0.38.30",
|
||||
"rustix 0.38.31",
|
||||
"x11rb-protocol",
|
||||
]
|
||||
|
||||
@ -5047,19 +5053,19 @@ checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
|
||||
|
||||
[[package]]
|
||||
name = "xdg-home"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd"
|
||||
checksum = "21e5a325c3cb8398ad6cf859c1135b25dd29e186679cf2da7581d9679f63b38e"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "3.14.1"
|
||||
version = "3.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948"
|
||||
checksum = "c45d06ae3b0f9ba1fb2671268b975557d8f5a84bb5ec6e43964f87e763d8bca8"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-executor",
|
||||
@ -5098,9 +5104,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "3.14.1"
|
||||
version = "3.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d"
|
||||
checksum = "b4a1ba45ed0ad344b85a2bb5a1fe9830aed23d67812ea39a586e7d0136439c7d"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro2",
|
||||
|
@ -26,6 +26,7 @@ tauri-plugin-cli = { git = "https://github.com/tauri-apps/plugins-workspace", br
|
||||
[patch.crates-io]
|
||||
tauri = { path = "../../../core/tauri" }
|
||||
tauri-build = { path = "../../../core/tauri-build" }
|
||||
tauri-plugin = { path = "../../../core/tauri-plugin" }
|
||||
|
||||
[dependencies.tauri]
|
||||
path = "../../../core/tauri"
|
||||
|
@ -15,8 +15,6 @@ fn main() {
|
||||
for cmd in [
|
||||
"plugin:event|listen",
|
||||
"plugin:webview|create_webview_window",
|
||||
"plugin:window|internal_on_mousemove",
|
||||
"plugin:window|internal_on_mousedown",
|
||||
] {
|
||||
context.resolved_acl().allowed_commands.insert(
|
||||
CommandKey {
|
||||
|
Loading…
Reference in New Issue
Block a user