From b0853c8c0ff7eaf675d21c059251df5018c0b20a Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Sun, 8 Dec 2024 13:19:08 +0900 Subject: [PATCH] chore: api adjust --- iced_layershell/src/actions.rs | 6 +++--- iced_layershell/src/event.rs | 5 +---- iced_layershell/src/multi_window.rs | 8 +++++--- iced_layershell_macros/src/lib.rs | 11 ++++------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/iced_layershell/src/actions.rs b/iced_layershell/src/actions.rs index ac2e580..464c112 100644 --- a/iced_layershell/src/actions.rs +++ b/iced_layershell/src/actions.rs @@ -67,15 +67,15 @@ pub enum LayershellCustomActions { // settings, info, single_tone NewLayerShell { settings: NewLayerShellSettings, - info: IcedId, + id: IcedId, }, NewPopUp { settings: IcedNewPopupSettings, - info: IcedId, + id: IcedId, }, NewMenu { settings: IcedNewMenuSettings, - info: IcedId, + id: IcedId, }, /// is same with WindowAction::Close(id) RemoveWindow(IcedId), diff --git a/iced_layershell/src/event.rs b/iced_layershell/src/event.rs index 686da3a..9dc4d67 100644 --- a/iced_layershell/src/event.rs +++ b/iced_layershell/src/event.rs @@ -117,10 +117,7 @@ pub enum IcedLayerEvent { #[allow(unused)] #[derive(Debug)] -pub struct MultiWindowIcedLayerEvent( - pub Option, - pub IcedLayerEvent, -); +pub struct MultiWindowIcedLayerEvent(pub Option, pub IcedLayerEvent); impl From<(Option, IcedLayerEvent)> for MultiWindowIcedLayerEvent diff --git a/iced_layershell/src/multi_window.rs b/iced_layershell/src/multi_window.rs index 6e85e9c..7f29305 100644 --- a/iced_layershell/src/multi_window.rs +++ b/iced_layershell/src/multi_window.rs @@ -372,7 +372,9 @@ where ) .ok(); } - LayershellCustomActions::NewLayerShell { settings, info, .. } => { + LayershellCustomActions::NewLayerShell { + settings, id: info, .. + } => { let id = layershellev::id::Id::unique(); ev.append_return_data(ReturnData::NewLayerShell(( settings, @@ -391,7 +393,7 @@ where } LayershellCustomActions::NewPopUp { settings: menusettings, - info, + id: info, } => { let IcedNewPopupSettings { size, position } = menusettings; let Some(id) = ev.current_surface_id() else { @@ -407,7 +409,7 @@ where } LayershellCustomActions::NewMenu { settings: menusetting, - info, + id: info, } => { let Some(id) = ev.current_surface_id() else { break 'out; diff --git a/iced_layershell_macros/src/lib.rs b/iced_layershell_macros/src/lib.rs index cd9fbe2..ecd33cf 100644 --- a/iced_layershell_macros/src/lib.rs +++ b/iced_layershell_macros/src/lib.rs @@ -4,10 +4,7 @@ use darling::{ FromDeriveInput, FromMeta, }; use proc_macro2::TokenStream as TokenStream2; -use syn::{ - DeriveInput, Generics, Ident, - Variant, Visibility, -}; +use syn::{DeriveInput, Generics, Ident, Variant, Visibility}; use quote::quote; @@ -73,9 +70,9 @@ pub fn to_layer_message(attr: TokenStream2, input: TokenStream2) -> manyhow::Res None, LayershellCustomActions::VirtualKeyboardPressed { time, key }) ), - Self::NewLayerShell {settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewLayerShell { settings, info: id })), - Self::NewPopUp { settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewPopUp { settings, info: id })), - Self::NewMenu { settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewMenu {settings, info:id })), + Self::NewLayerShell {settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewLayerShell { settings, id })), + Self::NewPopUp { settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewPopUp { settings, id })), + Self::NewMenu { settings, id } => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::NewMenu {settings, id })), Self::RemoveWindow(id) => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::RemoveWindow(id))), Self::ForgetLastOutput => Ok(LayershellCustomActionsWithId::new(None, LayershellCustomActions::ForgetLastOutput)), _ => Err(self)