mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 19:30:27 +03:00
refactor(core): scope JS resources to the webview (#9272)
* refactor(core): scope JS resources to the webview * clippy * change files * swap args order * more clippy * just add them on each type * clippy * macro docs * Update mod.rs * use random rid * revert resource table arg change --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
parent
8276ab767b
commit
284eca9ef2
5
.changes/resources_table_access.md
Normal file
5
.changes/resources_table_access.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'tauri': 'patch:breaking'
|
||||
---
|
||||
|
||||
`Manager::resources_table` is now scoped so each `App/AppHandle/Window/Webview/WebviewWindow` has its own resource collection.
|
@ -94,19 +94,19 @@ pub fn default_runtime(attributes: TokenStream, input: TokenStream) -> TokenStre
|
||||
/// Accepts a closure-like syntax to call arbitrary code on a menu item
|
||||
/// after matching against `kind` and retrieving it from `resources_table` using `rid`.
|
||||
///
|
||||
/// You can optionally pass a third parameter to select which item kinds
|
||||
/// You can optionally pass a 5th parameter to select which item kinds
|
||||
/// to match against, by providing a `|` separated list of item kinds
|
||||
/// ```ignore
|
||||
/// do_menu_item!(|i| i.set_text(text), Check | Submenu);
|
||||
/// do_menu_item!(resources_table, rid, kind, |i| i.set_text(text), Check | Submenu);
|
||||
/// ```
|
||||
/// You could also provide a negated list
|
||||
/// ```ignore
|
||||
/// do_menu_item!(|i| i.set_text(text), !Check);
|
||||
/// do_menu_item!(|i| i.set_text(text), !Check | !Submenu);
|
||||
/// do_menu_item!(resources_table, rid, kind, |i| i.set_text(text), !Check);
|
||||
/// do_menu_item!(resources_table, rid, kind, |i| i.set_text(text), !Check | !Submenu);
|
||||
/// ```
|
||||
/// but you can't have mixed negations and positive kinds.
|
||||
/// ```ignore
|
||||
/// do_menu_item!(|i| i.set_text(text), !Check | Submeun);
|
||||
/// do_menu_item!(resources_table, rid, kind, |i| i.set_text(text), !Check | Submeun);
|
||||
/// ```
|
||||
///
|
||||
/// #### Example
|
||||
@ -115,7 +115,7 @@ pub fn default_runtime(attributes: TokenStream, input: TokenStream) -> TokenStre
|
||||
/// let rid = 23;
|
||||
/// let kind = ItemKind::Check;
|
||||
/// let resources_table = app.resources_table();
|
||||
/// do_menu_item!(|i| i.set_text(text))
|
||||
/// do_menu_item!(resources_table, rid, kind, |i| i.set_text(text))
|
||||
/// ```
|
||||
/// which will expand into:
|
||||
/// ```ignore
|
||||
|
@ -20,13 +20,32 @@ pub struct DoMenuItemInput {
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct NegatedIdent(bool, Ident);
|
||||
struct NegatedIdent {
|
||||
negated: bool,
|
||||
ident: Ident,
|
||||
}
|
||||
|
||||
impl NegatedIdent {
|
||||
fn new(ident: &str) -> Self {
|
||||
Self {
|
||||
negated: false,
|
||||
ident: Ident::new(ident, Span::call_site()),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_negated(&self) -> bool {
|
||||
self.negated
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for NegatedIdent {
|
||||
fn parse(input: ParseStream) -> syn::Result<Self> {
|
||||
let t = input.parse::<Token![!]>();
|
||||
let i: Ident = input.parse()?;
|
||||
Ok(NegatedIdent(t.is_ok(), i))
|
||||
let negated_token = input.parse::<Token![!]>();
|
||||
let ident: Ident = input.parse()?;
|
||||
Ok(NegatedIdent {
|
||||
negated: negated_token.is_ok(),
|
||||
ident,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,32 +86,31 @@ pub fn do_menu_item(input: DoMenuItemInput) -> TokenStream {
|
||||
} = input;
|
||||
|
||||
let defaults = vec![
|
||||
NegatedIdent(false, Ident::new("Submenu", Span::call_site())),
|
||||
NegatedIdent(false, Ident::new("MenuItem", Span::call_site())),
|
||||
NegatedIdent(false, Ident::new("Predefined", Span::call_site())),
|
||||
NegatedIdent(false, Ident::new("Check", Span::call_site())),
|
||||
NegatedIdent(false, Ident::new("Icon", Span::call_site())),
|
||||
NegatedIdent::new("Submenu"),
|
||||
NegatedIdent::new("MenuItem"),
|
||||
NegatedIdent::new("Predefined"),
|
||||
NegatedIdent::new("Check"),
|
||||
NegatedIdent::new("Icon"),
|
||||
];
|
||||
|
||||
if kinds.is_empty() {
|
||||
kinds.extend(defaults.clone());
|
||||
}
|
||||
|
||||
let has_negated = kinds.iter().any(|n| n.0);
|
||||
|
||||
let has_negated = kinds.iter().any(|n| n.is_negated());
|
||||
if has_negated {
|
||||
kinds.extend(defaults);
|
||||
kinds.sort_by(|a, b| a.1.cmp(&b.1));
|
||||
kinds.dedup_by(|a, b| a.1 == b.1);
|
||||
kinds.sort_by(|a, b| a.ident.cmp(&b.ident));
|
||||
kinds.dedup_by(|a, b| a.ident == b.ident);
|
||||
}
|
||||
|
||||
let (kinds, types): (Vec<Ident>, Vec<Ident>) = kinds
|
||||
.into_iter()
|
||||
.filter_map(|nident| {
|
||||
if nident.0 {
|
||||
if nident.is_negated() {
|
||||
None
|
||||
} else {
|
||||
match nident.1 {
|
||||
match nident.ident {
|
||||
i if i == "MenuItem" => Some((i, Ident::new("MenuItem", Span::call_site()))),
|
||||
i if i == "Submenu" => Some((i, Ident::new("Submenu", Span::call_site()))),
|
||||
i if i == "Predefined" => Some((i, Ident::new("PredefinedMenuItem", Span::call_site()))),
|
||||
|
@ -13,6 +13,7 @@ use crate::{
|
||||
AppManager, Asset,
|
||||
},
|
||||
plugin::{Plugin, PluginStore},
|
||||
resources::ResourceTable,
|
||||
runtime::{
|
||||
window::{WebviewEvent as RuntimeWebviewEvent, WindowEvent as RuntimeWindowEvent},
|
||||
ExitRequestedEventAction, RunEvent as RuntimeRunEvent,
|
||||
@ -45,7 +46,7 @@ use std::{
|
||||
borrow::Cow,
|
||||
collections::HashMap,
|
||||
fmt,
|
||||
sync::{mpsc::Sender, Arc},
|
||||
sync::{mpsc::Sender, Arc, MutexGuard},
|
||||
};
|
||||
|
||||
use crate::{event::EventId, runtime::RuntimeHandle, Event, EventTarget};
|
||||
@ -416,7 +417,12 @@ impl<R: Runtime> AppHandle<R> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for AppHandle<R> {}
|
||||
impl<R: Runtime> Manager<R> for AppHandle<R> {
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self.manager.resources_table()
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> ManagerBase<R> for AppHandle<R> {
|
||||
fn manager(&self) -> &AppManager<R> {
|
||||
&self.manager
|
||||
@ -457,7 +463,12 @@ impl<R: Runtime> fmt::Debug for App<R> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for App<R> {}
|
||||
impl<R: Runtime> Manager<R> for App<R> {
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self.manager.resources_table()
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> ManagerBase<R> for App<R> {
|
||||
fn manager(&self) -> &AppManager<R> {
|
||||
&self.manager
|
||||
@ -743,7 +754,6 @@ macro_rules! shared_app_impl {
|
||||
pub fn cleanup_before_exit(&self) {
|
||||
#[cfg(all(desktop, feature = "tray-icon"))]
|
||||
self.manager.tray.icons.lock().unwrap().clear();
|
||||
self.resources_table().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,12 +165,9 @@ pub enum JsImage {
|
||||
|
||||
impl JsImage {
|
||||
/// Converts this intermediate image format into an actual [`Image`].
|
||||
pub fn into_img<R: Runtime, M: Manager<R>>(self, app: &M) -> crate::Result<Arc<Image<'_>>> {
|
||||
pub fn into_img<R: Runtime, M: Manager<R>>(self, manager: &M) -> crate::Result<Arc<Image<'_>>> {
|
||||
match self {
|
||||
Self::Resource(rid) => {
|
||||
let resources_table = app.resources_table();
|
||||
resources_table.get::<Image<'static>>(rid)
|
||||
}
|
||||
Self::Resource(rid) => manager.resources_table().get::<Image<'static>>(rid),
|
||||
#[cfg(any(feature = "image-ico", feature = "image-png"))]
|
||||
Self::Path(path) => Image::from_path(path).map(Arc::new).map_err(Into::into),
|
||||
|
||||
|
@ -5,26 +5,27 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::plugin::{Builder, TauriPlugin};
|
||||
use crate::{command, image::Image, AppHandle, Manager, ResourceId, Runtime};
|
||||
use crate::Manager;
|
||||
use crate::{command, image::Image, ResourceId, Runtime, Webview};
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn new<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rgba: Vec<u8>,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> crate::Result<ResourceId> {
|
||||
let image = Image::new_owned(rgba, width, height);
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let rid = resources_table.add(image);
|
||||
Ok(rid)
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "image-ico", feature = "image-png"))]
|
||||
#[command(root = "crate")]
|
||||
fn from_bytes<R: Runtime>(app: AppHandle<R>, bytes: Vec<u8>) -> crate::Result<ResourceId> {
|
||||
fn from_bytes<R: Runtime>(webview: Webview<R>, bytes: Vec<u8>) -> crate::Result<ResourceId> {
|
||||
let image = Image::from_bytes(&bytes)?.to_owned();
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let rid = resources_table.add(image);
|
||||
Ok(rid)
|
||||
}
|
||||
@ -37,9 +38,12 @@ fn from_bytes() -> std::result::Result<(), &'static str> {
|
||||
|
||||
#[cfg(any(feature = "image-ico", feature = "image-png"))]
|
||||
#[command(root = "crate")]
|
||||
fn from_path<R: Runtime>(app: AppHandle<R>, path: std::path::PathBuf) -> crate::Result<ResourceId> {
|
||||
fn from_path<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
path: std::path::PathBuf,
|
||||
) -> crate::Result<ResourceId> {
|
||||
let image = Image::from_path(path)?.to_owned();
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let rid = resources_table.add(image);
|
||||
Ok(rid)
|
||||
}
|
||||
@ -51,8 +55,8 @@ fn from_path() -> std::result::Result<(), &'static str> {
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn rgba<R: Runtime>(app: AppHandle<R>, rid: ResourceId) -> crate::Result<Vec<u8>> {
|
||||
let resources_table = app.resources_table();
|
||||
fn rgba<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::Result<Vec<u8>> {
|
||||
let resources_table = webview.resources_table();
|
||||
let image = resources_table.get::<Image<'_>>(rid)?;
|
||||
Ok(image.rgba().to_vec())
|
||||
}
|
||||
@ -64,8 +68,8 @@ struct Size {
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn size<R: Runtime>(app: AppHandle<R>, rid: ResourceId) -> crate::Result<Size> {
|
||||
let resources_table = app.resources_table();
|
||||
fn size<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::Result<Size> {
|
||||
let resources_table = webview.resources_table();
|
||||
let image = resources_table.get::<Image<'_>>(rid)?;
|
||||
Ok(Size {
|
||||
width: image.width(),
|
||||
|
@ -895,10 +895,8 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
|
||||
self.manager().state.try_get()
|
||||
}
|
||||
|
||||
/// Get a reference to the resources table.
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self.manager().resources_table()
|
||||
}
|
||||
/// Get a reference to the resources table of this manager.
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable>;
|
||||
|
||||
/// Gets the managed [`Env`].
|
||||
fn env(&self) -> Env {
|
||||
|
@ -558,7 +558,6 @@ impl<R: Runtime> AppManager<R> {
|
||||
self.webview.webviews_lock().clone()
|
||||
}
|
||||
|
||||
/// Resources table managed by the application.
|
||||
pub(crate) fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self
|
||||
.resources_table
|
||||
|
@ -2,10 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Mutex, MutexGuard},
|
||||
};
|
||||
use std::{collections::HashMap, sync::Mutex};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri_runtime::dpi::Position;
|
||||
@ -16,9 +13,9 @@ use crate::{
|
||||
image::JsImage,
|
||||
ipc::{channel::JavaScriptChannelId, Channel},
|
||||
plugin::{Builder, TauriPlugin},
|
||||
resources::{ResourceId, ResourceTable},
|
||||
resources::ResourceId,
|
||||
sealed::ManagerBase,
|
||||
AppHandle, Manager, RunEvent, Runtime, State, Webview, Window,
|
||||
Manager, RunEvent, Runtime, State, Webview, Window,
|
||||
};
|
||||
use tauri_macros::do_menu_item;
|
||||
|
||||
@ -49,12 +46,12 @@ pub(crate) struct AboutMetadata {
|
||||
}
|
||||
|
||||
impl AboutMetadata {
|
||||
pub fn into_metdata<R: Runtime, M: Manager<R>>(
|
||||
pub fn into_metadata<R: Runtime, M: Manager<R>>(
|
||||
self,
|
||||
app: &M,
|
||||
manager: &M,
|
||||
) -> crate::Result<super::AboutMetadata<'_>> {
|
||||
let icon = match self.icon {
|
||||
Some(i) => Some(i.into_img(app)?.as_ref().clone()),
|
||||
Some(i) => Some(i.into_img(manager)?.as_ref().clone()),
|
||||
None => None,
|
||||
};
|
||||
|
||||
@ -105,11 +102,7 @@ struct SubmenuPayload {
|
||||
}
|
||||
|
||||
impl SubmenuPayload {
|
||||
pub fn create_item<R: Runtime>(
|
||||
self,
|
||||
webview: &Webview<R>,
|
||||
resources_table: &MutexGuard<'_, ResourceTable>,
|
||||
) -> crate::Result<Submenu<R>> {
|
||||
pub fn create_item<R: Runtime>(self, webview: &Webview<R>) -> crate::Result<Submenu<R>> {
|
||||
let mut builder = if let Some(id) = self.id {
|
||||
SubmenuBuilder::with_id(webview, id, self.text)
|
||||
} else {
|
||||
@ -119,7 +112,7 @@ impl SubmenuPayload {
|
||||
builder = builder.enabled(enabled);
|
||||
}
|
||||
for item in self.items {
|
||||
builder = item.with_item(webview, resources_table, |i| Ok(builder.item(i)))?;
|
||||
builder = item.with_item(webview, |i| Ok(builder.item(i)))?;
|
||||
}
|
||||
|
||||
builder.build()
|
||||
@ -286,7 +279,7 @@ impl PredefinedMenuItemPayload {
|
||||
Predefined::Quit => PredefinedMenuItem::quit(webview, self.text.as_deref()),
|
||||
Predefined::About(metadata) => {
|
||||
let metadata = match metadata {
|
||||
Some(m) => Some(m.into_metdata(webview)?),
|
||||
Some(m) => Some(m.into_metadata(webview)?),
|
||||
None => None,
|
||||
};
|
||||
PredefinedMenuItem::about(webview, self.text.as_deref(), metadata)
|
||||
@ -311,14 +304,14 @@ impl MenuItemPayloadKind {
|
||||
pub fn with_item<T, R: Runtime, F: FnOnce(&dyn IsMenuItem<R>) -> crate::Result<T>>(
|
||||
self,
|
||||
webview: &Webview<R>,
|
||||
resources_table: &MutexGuard<'_, ResourceTable>,
|
||||
f: F,
|
||||
) -> crate::Result<T> {
|
||||
match self {
|
||||
Self::ExistingItem((rid, kind)) => {
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(resources_table, rid, kind, |i| f(&*i))
|
||||
}
|
||||
Self::Submenu(i) => f(&i.create_item(webview, resources_table)?),
|
||||
Self::Submenu(i) => f(&i.create_item(webview)?),
|
||||
Self::Predefined(i) => f(&i.create_item(webview)?),
|
||||
Self::Check(i) => f(&i.create_item(webview)?),
|
||||
Self::Icon(i) => f(&i.create_item(webview)?),
|
||||
@ -343,7 +336,7 @@ struct NewOptions {
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn new<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
app: Webview<R>,
|
||||
webview: Webview<R>,
|
||||
kind: ItemKind,
|
||||
options: Option<NewOptions>,
|
||||
@ -361,7 +354,7 @@ fn new<R: Runtime>(
|
||||
}
|
||||
if let Some(items) = options.items {
|
||||
for item in items {
|
||||
builder = item.with_item(&webview, &resources_table, |i| Ok(builder.item(i)))?;
|
||||
builder = item.with_item(&webview, |i| Ok(builder.item(i)))?;
|
||||
}
|
||||
}
|
||||
let menu = builder.build()?;
|
||||
@ -378,7 +371,7 @@ fn new<R: Runtime>(
|
||||
enabled: options.enabled,
|
||||
items: options.items.unwrap_or_default(),
|
||||
}
|
||||
.create_item(&webview, &resources_table)?;
|
||||
.create_item(&webview)?;
|
||||
let id = submenu.id().clone();
|
||||
let rid = resources_table.add(submenu);
|
||||
|
||||
@ -461,13 +454,13 @@ fn append<R: Runtime>(
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| menu.append(i))?;
|
||||
item.with_item(&webview, |i| menu.append(i))?;
|
||||
}
|
||||
}
|
||||
ItemKind::Submenu => {
|
||||
let submenu = resources_table.get::<Submenu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| submenu.append(i))?;
|
||||
item.with_item(&webview, |i| submenu.append(i))?;
|
||||
}
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!("unexpected menu item kind").into()),
|
||||
@ -488,13 +481,13 @@ fn prepend<R: Runtime>(
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| menu.prepend(i))?;
|
||||
item.with_item(&webview, |i| menu.prepend(i))?;
|
||||
}
|
||||
}
|
||||
ItemKind::Submenu => {
|
||||
let submenu = resources_table.get::<Submenu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| submenu.prepend(i))?;
|
||||
item.with_item(&webview, |i| submenu.prepend(i))?;
|
||||
}
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!("unexpected menu item kind").into()),
|
||||
@ -516,14 +509,14 @@ fn insert<R: Runtime>(
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| menu.insert(i, position))?;
|
||||
item.with_item(&webview, |i| menu.insert(i, position))?;
|
||||
position += 1
|
||||
}
|
||||
}
|
||||
ItemKind::Submenu => {
|
||||
let submenu = resources_table.get::<Submenu<R>>(rid)?;
|
||||
for item in items {
|
||||
item.with_item(&webview, &resources_table, |i| submenu.insert(i, position))?;
|
||||
item.with_item(&webview, |i| submenu.insert(i, position))?;
|
||||
position += 1
|
||||
}
|
||||
}
|
||||
@ -535,12 +528,12 @@ fn insert<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn remove<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
item: (ResourceId, ItemKind),
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let (item_rid, item_kind) = item;
|
||||
match kind {
|
||||
ItemKind::Menu => {
|
||||
@ -574,12 +567,12 @@ macro_rules! make_item_resource {
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn remove_at<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
position: usize,
|
||||
) -> crate::Result<Option<(ResourceId, MenuId, ItemKind)>> {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
match kind {
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
@ -601,11 +594,11 @@ fn remove_at<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn items<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
) -> crate::Result<Vec<(ResourceId, MenuId, ItemKind)>> {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let items = match kind {
|
||||
ItemKind::Menu => resources_table.get::<Menu<R>>(rid)?.items()?,
|
||||
ItemKind::Submenu => resources_table.get::<Submenu<R>>(rid)?.items()?,
|
||||
@ -622,12 +615,12 @@ fn items<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn get<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
id: MenuId,
|
||||
) -> crate::Result<Option<(ResourceId, MenuId, ItemKind)>> {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
match kind {
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
@ -649,7 +642,7 @@ fn get<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
async fn popup<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
current_window: Window<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
@ -657,11 +650,11 @@ async fn popup<R: Runtime>(
|
||||
at: Option<Position>,
|
||||
) -> crate::Result<()> {
|
||||
let window = window
|
||||
.map(|w| app.manager().get_window(&w))
|
||||
.map(|w| webview.manager().get_window(&w))
|
||||
.unwrap_or(Some(current_window));
|
||||
|
||||
if let Some(window) = window {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
match kind {
|
||||
ItemKind::Menu => {
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
@ -679,8 +672,11 @@ async fn popup<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn create_default<R: Runtime>(app: AppHandle<R>) -> crate::Result<(ResourceId, MenuId)> {
|
||||
let mut resources_table = app.resources_table();
|
||||
fn create_default<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
) -> crate::Result<(ResourceId, MenuId)> {
|
||||
let mut resources_table = webview.resources_table();
|
||||
let menu = Menu::default(&app)?;
|
||||
let id = menu.id().clone();
|
||||
let rid = resources_table.add(menu);
|
||||
@ -689,10 +685,10 @@ fn create_default<R: Runtime>(app: AppHandle<R>) -> crate::Result<(ResourceId, M
|
||||
|
||||
#[command(root = "crate")]
|
||||
async fn set_as_app_menu<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
) -> crate::Result<Option<(ResourceId, MenuId)>> {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
if let Some(menu) = menu.set_as_app_menu()? {
|
||||
let id = menu.id().clone();
|
||||
@ -704,17 +700,17 @@ async fn set_as_app_menu<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
async fn set_as_window_menu<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
current_window: Window<R>,
|
||||
rid: ResourceId,
|
||||
window: Option<String>,
|
||||
) -> crate::Result<Option<(ResourceId, MenuId)>> {
|
||||
let window = window
|
||||
.map(|w| app.manager().get_window(&w))
|
||||
.map(|w| webview.manager().get_window(&w))
|
||||
.unwrap_or(Some(current_window));
|
||||
|
||||
if let Some(window) = window {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
let menu = resources_table.get::<Menu<R>>(rid)?;
|
||||
if let Some(menu) = menu.set_as_window_menu(&window)? {
|
||||
let id = menu.id().clone();
|
||||
@ -726,40 +722,40 @@ async fn set_as_window_menu<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn text<R: Runtime>(app: AppHandle<R>, rid: ResourceId, kind: ItemKind) -> crate::Result<String> {
|
||||
let resources_table = app.resources_table();
|
||||
fn text<R: Runtime>(webview: Webview<R>, rid: ResourceId, kind: ItemKind) -> crate::Result<String> {
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(resources_table, rid, kind, |i| i.text())
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_text<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
text: String,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(resources_table, rid, kind, |i| i.set_text(text))
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn is_enabled<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
) -> crate::Result<bool> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(resources_table, rid, kind, |i| i.is_enabled(), !Predefined)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_enabled<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
enabled: bool,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(
|
||||
resources_table,
|
||||
rid,
|
||||
@ -771,12 +767,12 @@ fn set_enabled<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_accelerator<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
kind: ItemKind,
|
||||
accelerator: Option<String>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
do_menu_item!(
|
||||
resources_table,
|
||||
rid,
|
||||
@ -788,62 +784,69 @@ fn set_accelerator<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_as_windows_menu_for_nsapp<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
) -> crate::Result<()> {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let submenu = resources_table.get::<Submenu<R>>(rid)?;
|
||||
submenu.set_as_help_menu_for_nsapp()?;
|
||||
}
|
||||
|
||||
let _ = rid;
|
||||
let _ = app;
|
||||
let _ = webview;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_as_help_menu_for_nsapp<R: Runtime>(app: AppHandle<R>, rid: ResourceId) -> crate::Result<()> {
|
||||
fn set_as_help_menu_for_nsapp<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
) -> crate::Result<()> {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let submenu = resources_table.get::<Submenu<R>>(rid)?;
|
||||
submenu.set_as_help_menu_for_nsapp()?;
|
||||
}
|
||||
|
||||
let _ = rid;
|
||||
let _ = app;
|
||||
let _ = webview;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn is_checked<R: Runtime>(app: AppHandle<R>, rid: ResourceId) -> crate::Result<bool> {
|
||||
let resources_table = app.resources_table();
|
||||
fn is_checked<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::Result<bool> {
|
||||
let resources_table = webview.resources_table();
|
||||
let check_item = resources_table.get::<CheckMenuItem<R>>(rid)?;
|
||||
check_item.is_checked()
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_checked<R: Runtime>(app: AppHandle<R>, rid: ResourceId, checked: bool) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
fn set_checked<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
checked: bool,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = webview.resources_table();
|
||||
let check_item = resources_table.get::<CheckMenuItem<R>>(rid)?;
|
||||
check_item.set_checked(checked)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_icon<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
icon: Option<Icon>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let icon_item = resources_table.get::<IconMenuItem<R>>(rid)?;
|
||||
|
||||
match icon {
|
||||
Some(Icon::Native(icon)) => icon_item.set_native_icon(Some(icon)),
|
||||
Some(Icon::Icon(icon)) => icon_item.set_icon(Some(icon.into_img(&app)?.as_ref().clone())),
|
||||
Some(Icon::Icon(icon)) => icon_item.set_icon(Some(icon.into_img(&webview)?.as_ref().clone())),
|
||||
None => {
|
||||
icon_item.set_icon(None)?;
|
||||
icon_item.set_native_icon(None)?;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
pub(crate) mod plugin;
|
||||
|
||||
use crate::error::Error;
|
||||
use std::{
|
||||
any::{type_name, Any, TypeId},
|
||||
borrow::Cow,
|
||||
@ -75,10 +74,15 @@ pub type ResourceId = u32;
|
||||
#[derive(Default)]
|
||||
pub struct ResourceTable {
|
||||
index: BTreeMap<ResourceId, Arc<dyn Resource>>,
|
||||
next_rid: ResourceId,
|
||||
}
|
||||
|
||||
impl ResourceTable {
|
||||
fn new_random_rid() -> u32 {
|
||||
let mut bytes = [0_u8; 4];
|
||||
getrandom::getrandom(&mut bytes).expect("failed to get random bytes");
|
||||
u32::from_ne_bytes(bytes)
|
||||
}
|
||||
|
||||
/// Inserts resource into the resource table, which takes ownership of it.
|
||||
///
|
||||
/// The resource type is erased at runtime and must be statically known
|
||||
@ -107,10 +111,9 @@ impl ResourceTable {
|
||||
///
|
||||
/// Returns a unique resource ID, which acts as a key for this resource.
|
||||
pub fn add_arc_dyn(&mut self, resource: Arc<dyn Resource>) -> ResourceId {
|
||||
let rid = self.next_rid;
|
||||
let rid = Self::new_random_rid();
|
||||
let removed_resource = self.index.insert(rid, resource);
|
||||
assert!(removed_resource.is_none());
|
||||
self.next_rid += 1;
|
||||
rid
|
||||
}
|
||||
|
||||
@ -121,24 +124,24 @@ impl ResourceTable {
|
||||
|
||||
/// Returns a reference counted pointer to the resource of type `T` with the
|
||||
/// given `rid`. If `rid` is not present or has a type different than `T`,
|
||||
/// this function returns [`Error::BadResourceId`].
|
||||
pub fn get<T: Resource>(&self, rid: ResourceId) -> Result<Arc<T>, Error> {
|
||||
/// this function returns [`Error::BadResourceId`](crate::Error::BadResourceId).
|
||||
pub fn get<T: Resource>(&self, rid: ResourceId) -> crate::Result<Arc<T>> {
|
||||
self
|
||||
.index
|
||||
.get(&rid)
|
||||
.and_then(|rc| rc.downcast_arc::<T>())
|
||||
.cloned()
|
||||
.ok_or_else(|| Error::BadResourceId(rid))
|
||||
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
||||
}
|
||||
|
||||
/// Returns a reference counted pointer to the resource of the given `rid`.
|
||||
/// If `rid` is not present, this function returns [`Error::BadResourceId`].
|
||||
pub fn get_any(&self, rid: ResourceId) -> Result<Arc<dyn Resource>, Error> {
|
||||
pub fn get_any(&self, rid: ResourceId) -> crate::Result<Arc<dyn Resource>> {
|
||||
self
|
||||
.index
|
||||
.get(&rid)
|
||||
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
||||
.cloned()
|
||||
.ok_or_else(|| Error::BadResourceId(rid))
|
||||
}
|
||||
|
||||
/// Replaces a resource with a new resource.
|
||||
@ -161,7 +164,7 @@ impl ResourceTable {
|
||||
/// assume that `Arc::strong_count(&returned_arc)` is always equal to 1 on success.
|
||||
/// In particular, be really careful when you want to extract the inner value of
|
||||
/// type `T` from `Arc<T>`.
|
||||
pub fn take<T: Resource>(&mut self, rid: ResourceId) -> Result<Arc<T>, Error> {
|
||||
pub fn take<T: Resource>(&mut self, rid: ResourceId) -> crate::Result<Arc<T>> {
|
||||
let resource = self.get::<T>(rid)?;
|
||||
self.index.remove(&rid);
|
||||
Ok(resource)
|
||||
@ -175,11 +178,11 @@ impl ResourceTable {
|
||||
/// we cannot assume that `Arc::strong_count(&returned_arc)` is always equal to 1
|
||||
/// on success. In particular, be really careful when you want to extract the
|
||||
/// inner value of type `T` from `Arc<T>`.
|
||||
pub fn take_any(&mut self, rid: ResourceId) -> Result<Arc<dyn Resource>, Error> {
|
||||
pub fn take_any(&mut self, rid: ResourceId) -> crate::Result<Arc<dyn Resource>> {
|
||||
self
|
||||
.index
|
||||
.remove(&rid)
|
||||
.ok_or_else(|| Error::BadResourceId(rid))
|
||||
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
||||
}
|
||||
|
||||
/// Returns an iterator that yields a `(id, name)` pair for every resource
|
||||
@ -199,17 +202,11 @@ impl ResourceTable {
|
||||
/// counted, therefore pending ops are not automatically cancelled. A resource
|
||||
/// may implement the `close()` method to perform clean-ups such as canceling
|
||||
/// ops.
|
||||
pub fn close(&mut self, rid: ResourceId) -> Result<(), Error> {
|
||||
pub fn close(&mut self, rid: ResourceId) -> crate::Result<()> {
|
||||
self
|
||||
.index
|
||||
.remove(&rid)
|
||||
.ok_or_else(|| Error::BadResourceId(rid))
|
||||
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
||||
.map(|resource| resource.close())
|
||||
}
|
||||
|
||||
/// Removes and frees all resources stored. Note that the
|
||||
/// resource's `close()` method is *not* called.
|
||||
pub(crate) fn clear(&mut self) {
|
||||
self.index.clear()
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@
|
||||
use crate::{
|
||||
command,
|
||||
plugin::{Builder, TauriPlugin},
|
||||
AppHandle, Manager, Runtime,
|
||||
Manager, Runtime, Webview,
|
||||
};
|
||||
|
||||
use super::ResourceId;
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn close<R: Runtime>(app: AppHandle<R>, rid: ResourceId) -> crate::Result<()> {
|
||||
app.resources_table().close(rid)
|
||||
fn close<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::Result<()> {
|
||||
webview.resources_table().close(rid)
|
||||
}
|
||||
|
||||
pub(crate) fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
|
@ -14,7 +14,7 @@ use crate::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
resources::ResourceId,
|
||||
tray::TrayIconBuilder,
|
||||
AppHandle, Manager, Runtime,
|
||||
AppHandle, Manager, Runtime, Webview,
|
||||
};
|
||||
|
||||
use super::TrayIcon;
|
||||
@ -34,7 +34,7 @@ struct TrayIconOptions {
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn new<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
options: TrayIconOptions,
|
||||
handler: Channel,
|
||||
) -> crate::Result<(ResourceId, String)> {
|
||||
@ -48,7 +48,7 @@ fn new<R: Runtime>(
|
||||
let _ = handler.send(e);
|
||||
});
|
||||
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
|
||||
if let Some((rid, kind)) = options.menu {
|
||||
match kind {
|
||||
@ -64,7 +64,7 @@ fn new<R: Runtime>(
|
||||
};
|
||||
}
|
||||
if let Some(icon) = options.icon {
|
||||
builder = builder.icon(icon.into_img(&app)?.as_ref().clone());
|
||||
builder = builder.icon(icon.into_img(&webview)?.as_ref().clone());
|
||||
}
|
||||
if let Some(tooltip) = options.tooltip {
|
||||
builder = builder.tooltip(tooltip);
|
||||
@ -82,7 +82,7 @@ fn new<R: Runtime>(
|
||||
builder = builder.menu_on_left_click(menu_on_left_click);
|
||||
}
|
||||
|
||||
let tray = builder.build(&app)?;
|
||||
let tray = builder.build(&webview)?;
|
||||
let id = tray.id().as_ref().to_string();
|
||||
let rid = resources_table.add(tray);
|
||||
|
||||
@ -90,10 +90,14 @@ fn new<R: Runtime>(
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn get_by_id<R: Runtime>(app: AppHandle<R>, id: &str) -> crate::Result<Option<ResourceId>> {
|
||||
fn get_by_id<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
id: &str,
|
||||
) -> crate::Result<Option<ResourceId>> {
|
||||
let tray = app.tray_by_id(id);
|
||||
let maybe_rid = tray.map(|tray| {
|
||||
let mut resources_table = app.resources_table();
|
||||
let mut resources_table = webview.resources_table();
|
||||
resources_table.add(tray)
|
||||
});
|
||||
Ok(maybe_rid)
|
||||
@ -110,14 +114,14 @@ fn remove_by_id<R: Runtime>(app: AppHandle<R>, id: &str) -> crate::Result<()> {
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_icon<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
icon: Option<JsImage>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
let icon = match icon {
|
||||
Some(i) => Some(i.into_img(&app)?.as_ref().clone()),
|
||||
Some(i) => Some(i.into_img(&webview)?.as_ref().clone()),
|
||||
None => None,
|
||||
};
|
||||
tray.set_icon(icon)
|
||||
@ -125,11 +129,11 @@ fn set_icon<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_menu<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
menu: Option<(ResourceId, ItemKind)>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
if let Some((rid, kind)) = menu {
|
||||
match kind {
|
||||
@ -151,62 +155,66 @@ fn set_menu<R: Runtime>(
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_tooltip<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
tooltip: Option<String>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_tooltip(tooltip)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_title<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
title: Option<String>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_title(title)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_visible<R: Runtime>(app: AppHandle<R>, rid: ResourceId, visible: bool) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
fn set_visible<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
visible: bool,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_visible(visible)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_temp_dir_path<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
path: Option<PathBuf>,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_temp_dir_path(path)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_icon_as_template<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
as_template: bool,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_icon_as_template(as_template)
|
||||
}
|
||||
|
||||
#[command(root = "crate")]
|
||||
fn set_show_menu_on_left_click<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
webview: Webview<R>,
|
||||
rid: ResourceId,
|
||||
on_left: bool,
|
||||
) -> crate::Result<()> {
|
||||
let resources_table = app.resources_table();
|
||||
let resources_table = webview.resources_table();
|
||||
let tray = resources_table.get::<TrayIcon<R>>(rid)?;
|
||||
tray.set_show_menu_on_left_click(on_left)
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ use crate::{
|
||||
},
|
||||
manager::{webview::WebviewLabelDef, AppManager},
|
||||
sealed::{ManagerBase, RuntimeOrDispatch},
|
||||
AppHandle, Event, EventId, EventLoopMessage, Manager, Runtime, Window,
|
||||
AppHandle, Event, EventId, EventLoopMessage, Manager, ResourceTable, Runtime, Window,
|
||||
};
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
hash::{Hash, Hasher},
|
||||
path::PathBuf,
|
||||
sync::{Arc, Mutex},
|
||||
sync::{Arc, Mutex, MutexGuard},
|
||||
};
|
||||
|
||||
pub(crate) type WebResourceRequestHandler =
|
||||
@ -786,6 +786,7 @@ pub struct Webview<R: Runtime> {
|
||||
pub(crate) app_handle: AppHandle<R>,
|
||||
/// The webview created by the runtime.
|
||||
pub(crate) webview: DetachedWebview<EventLoopMessage, R>,
|
||||
pub(crate) resources_table: Arc<Mutex<ResourceTable>>,
|
||||
}
|
||||
|
||||
impl<R: Runtime> std::fmt::Debug for Webview<R> {
|
||||
@ -804,6 +805,7 @@ impl<R: Runtime> Clone for Webview<R> {
|
||||
manager: self.manager.clone(),
|
||||
app_handle: self.app_handle.clone(),
|
||||
webview: self.webview.clone(),
|
||||
resources_table: self.resources_table.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -832,6 +834,7 @@ impl<R: Runtime> Webview<R> {
|
||||
manager: window.manager.clone(),
|
||||
app_handle: window.app_handle.clone(),
|
||||
webview,
|
||||
resources_table: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1502,7 +1505,14 @@ tauri::Builder::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for Webview<R> {}
|
||||
impl<R: Runtime> Manager<R> for Webview<R> {
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self
|
||||
.resources_table
|
||||
.lock()
|
||||
.expect("poisoned window resources table")
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> ManagerBase<R> for Webview<R> {
|
||||
fn manager(&self) -> &AppManager<R> {
|
||||
|
@ -4,12 +4,17 @@
|
||||
|
||||
//! [`Window`] that hosts a single [`Webview`].
|
||||
|
||||
use std::{borrow::Cow, path::PathBuf, sync::Arc};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
path::PathBuf,
|
||||
sync::{Arc, MutexGuard},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
event::EventTarget,
|
||||
runtime::dpi::{PhysicalPosition, PhysicalSize},
|
||||
window::Monitor,
|
||||
ResourceTable,
|
||||
};
|
||||
#[cfg(desktop)]
|
||||
use crate::{
|
||||
@ -1790,7 +1795,15 @@ tauri::Builder::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for WebviewWindow<R> {}
|
||||
impl<R: Runtime> Manager<R> for WebviewWindow<R> {
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self
|
||||
.webview
|
||||
.resources_table
|
||||
.lock()
|
||||
.expect("poisoned window resources table")
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> ManagerBase<R> for WebviewWindow<R> {
|
||||
fn manager(&self) -> &AppManager<R> {
|
||||
|
@ -25,11 +25,10 @@ use crate::{
|
||||
window::{DetachedWindow, PendingWindow, WindowBuilder as _},
|
||||
RuntimeHandle, WindowDispatch,
|
||||
},
|
||||
sealed::ManagerBase,
|
||||
sealed::RuntimeOrDispatch,
|
||||
sealed::{ManagerBase, RuntimeOrDispatch},
|
||||
utils::config::{WindowConfig, WindowEffectsConfig},
|
||||
webview::WebviewBuilder,
|
||||
EventLoopMessage, Manager, Runtime, Theme, Webview, WindowEvent,
|
||||
EventLoopMessage, Manager, ResourceTable, Runtime, Theme, Webview, WindowEvent,
|
||||
};
|
||||
#[cfg(desktop)]
|
||||
use crate::{
|
||||
@ -51,7 +50,7 @@ use tauri_macros::default_runtime;
|
||||
use std::{
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
sync::Arc,
|
||||
sync::{Arc, Mutex, MutexGuard},
|
||||
};
|
||||
|
||||
/// Monitor descriptor.
|
||||
@ -876,7 +875,8 @@ pub struct Window<R: Runtime> {
|
||||
pub(crate) app_handle: AppHandle<R>,
|
||||
// The menu set for this window
|
||||
#[cfg(desktop)]
|
||||
pub(crate) menu: Arc<std::sync::Mutex<Option<WindowMenu<R>>>>,
|
||||
pub(crate) menu: Arc<Mutex<Option<WindowMenu<R>>>>,
|
||||
pub(crate) resources_table: Arc<Mutex<ResourceTable>>,
|
||||
}
|
||||
|
||||
impl<R: Runtime> std::fmt::Debug for Window<R> {
|
||||
@ -913,6 +913,7 @@ impl<R: Runtime> Clone for Window<R> {
|
||||
app_handle: self.app_handle.clone(),
|
||||
#[cfg(desktop)]
|
||||
menu: self.menu.clone(),
|
||||
resources_table: self.resources_table.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -932,7 +933,14 @@ impl<R: Runtime> PartialEq for Window<R> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> Manager<R> for Window<R> {}
|
||||
impl<R: Runtime> Manager<R> for Window<R> {
|
||||
fn resources_table(&self) -> MutexGuard<'_, ResourceTable> {
|
||||
self
|
||||
.resources_table
|
||||
.lock()
|
||||
.expect("poisoned window resources table")
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Runtime> ManagerBase<R> for Window<R> {
|
||||
fn manager(&self) -> &AppManager<R> {
|
||||
@ -974,6 +982,7 @@ impl<R: Runtime> Window<R> {
|
||||
app_handle,
|
||||
#[cfg(desktop)]
|
||||
menu: Arc::new(std::sync::Mutex::new(menu)),
|
||||
resources_table: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ mod desktop_commands {
|
||||
utils::config::{WindowConfig, WindowEffectsConfig},
|
||||
window::{ProgressBarState, WindowBuilder},
|
||||
AppHandle, CursorIcon, Monitor, PhysicalPosition, PhysicalSize, Position, Size, Theme,
|
||||
UserAttentionType, Window,
|
||||
UserAttentionType, Webview, Window,
|
||||
};
|
||||
|
||||
#[command(root = "crate")]
|
||||
@ -132,13 +132,14 @@ mod desktop_commands {
|
||||
|
||||
#[command(root = "crate")]
|
||||
pub async fn set_icon<R: Runtime>(
|
||||
webview: Webview<R>,
|
||||
window: Window<R>,
|
||||
label: Option<String>,
|
||||
value: crate::image::JsImage,
|
||||
) -> crate::Result<()> {
|
||||
let window = get_window(window, label)?;
|
||||
window
|
||||
.set_icon(value.into_img(&window)?.as_ref().clone())
|
||||
.set_icon(value.into_img(&webview)?.as_ref().clone())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
|
232
examples/api/src-tauri/Cargo.lock
generated
232
examples/api/src-tauri/Cargo.lock
generated
@ -706,6 +706,15 @@ dependencies = [
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dpi"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "1.0.9"
|
||||
@ -753,15 +762,6 @@ version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
@ -1239,25 +1239,6 @@ dependencies = [
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap 2.2.3",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
@ -1304,9 +1285,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.11"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
@ -1315,12 +1296,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "0.4.6"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
@ -1336,34 +1329,43 @@ version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.28"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||
checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa 1.0.10",
|
||||
"pin-project-lite",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1780,12 +1782,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "muda"
|
||||
version = "0.12.1"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e27c56b8cb9b3214d196556227b0eaa12db8393b4f919a0a93ffb67ed17d185"
|
||||
checksum = "f428b4e9db3d17e2f809dfb1ff9ddfbbf16c71790d1656d10aee320877e1392f"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"crossbeam-channel",
|
||||
"dpi",
|
||||
"gtk",
|
||||
"keyboard-types",
|
||||
"objc",
|
||||
@ -2136,6 +2139,26 @@ dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
@ -2447,19 +2470,19 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.24"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251"
|
||||
checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
@ -2471,7 +2494,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
@ -2925,27 +2947,6 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "6.2.0"
|
||||
@ -2961,9 +2962,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tao"
|
||||
version = "0.26.1"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccba570365293ca309d60f30fdac2c5271b732dc762e6154e59c85d2c762a0a1"
|
||||
checksum = "bd5b6ec2c43abd15155f040c765001098f50f425414b679225d471a1cd782753"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cocoa",
|
||||
@ -2972,10 +2973,10 @@ dependencies = [
|
||||
"crossbeam-channel",
|
||||
"dispatch",
|
||||
"dlopen2",
|
||||
"dpi",
|
||||
"gdkwayland-sys",
|
||||
"gdkx11-sys",
|
||||
"gtk",
|
||||
"image",
|
||||
"instant",
|
||||
"jni",
|
||||
"lazy_static",
|
||||
@ -2987,14 +2988,12 @@ dependencies = [
|
||||
"objc",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"png",
|
||||
"raw-window-handle 0.6.0",
|
||||
"scopeguard",
|
||||
"tao-macros",
|
||||
"unicode-segmentation",
|
||||
"url",
|
||||
"windows 0.52.0",
|
||||
"windows-implement 0.52.0",
|
||||
"windows 0.54.0",
|
||||
"windows-version",
|
||||
"x11-dl",
|
||||
]
|
||||
@ -3018,7 +3017,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.0-beta.12"
|
||||
version = "2.0.0-beta.13"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
@ -3154,6 +3153,7 @@ dependencies = [
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.0-beta.10"
|
||||
dependencies = [
|
||||
"dpi",
|
||||
"gtk",
|
||||
"http",
|
||||
"jni",
|
||||
@ -3429,6 +3429,28 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
@ -3441,6 +3463,7 @@ version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
@ -3498,9 +3521,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tray-icon"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "454035ff34b8430638c894e6197748578d6b4d449c6edaf8ea854d94e2dd862b"
|
||||
checksum = "8713f74e697917aa794800289e15bce534fc91450312ab2d3edf5b8907f7301a"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
@ -3878,8 +3901,8 @@ dependencies = [
|
||||
"webview2-com-sys",
|
||||
"windows 0.54.0",
|
||||
"windows-core 0.54.0",
|
||||
"windows-implement 0.53.0",
|
||||
"windows-interface 0.53.0",
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3948,18 +3971,6 @@ dependencies = [
|
||||
"windows-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||
dependencies = [
|
||||
"windows-core 0.52.0",
|
||||
"windows-implement 0.52.0",
|
||||
"windows-interface 0.52.0",
|
||||
"windows-targets 0.52.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.53.0"
|
||||
@ -3977,8 +3988,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
|
||||
dependencies = [
|
||||
"windows-core 0.54.0",
|
||||
"windows-implement 0.53.0",
|
||||
"windows-interface 0.53.0",
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-targets 0.52.4",
|
||||
]
|
||||
|
||||
@ -4011,17 +4022,6 @@ dependencies = [
|
||||
"windows-targets 0.52.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.53.0"
|
||||
@ -4033,17 +4033,6 @@ dependencies = [
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.52",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.53.0"
|
||||
@ -4302,9 +4291,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wry"
|
||||
version = "0.38.2"
|
||||
version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "741261f2571990873d0dd5953cff8087f39a16fb37550edd0acf7221b9c8d65b"
|
||||
checksum = "4eca9d50437c04fc67e82c196ddd31d8e35794150713ae2d647f3a58c7f45d1a"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"block",
|
||||
@ -4312,6 +4301,7 @@ dependencies = [
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
"crossbeam-channel",
|
||||
"dpi",
|
||||
"dunce",
|
||||
"gdkx11",
|
||||
"gtk",
|
||||
|
Loading…
Reference in New Issue
Block a user