Skip to content

Commit

Permalink
chore: api adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Dec 8, 2024
1 parent 69420b4 commit b0853c8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions iced_layershell/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 1 addition & 4 deletions iced_layershell/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ pub enum IcedLayerEvent<Message: 'static> {

#[allow(unused)]
#[derive(Debug)]
pub struct MultiWindowIcedLayerEvent<Message: 'static>(
pub Option<Id>,
pub IcedLayerEvent<Message>,
);
pub struct MultiWindowIcedLayerEvent<Message: 'static>(pub Option<Id>, pub IcedLayerEvent<Message>);

impl<Message: 'static> From<(Option<Id>, IcedLayerEvent<Message>)>
for MultiWindowIcedLayerEvent<Message>
Expand Down
8 changes: 5 additions & 3 deletions iced_layershell/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -407,7 +409,7 @@ where
}
LayershellCustomActions::NewMenu {
settings: menusetting,
info,
id: info,
} => {
let Some(id) = ev.current_surface_id() else {
break 'out;
Expand Down
11 changes: 4 additions & 7 deletions iced_layershell_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b0853c8

Please sign in to comment.