diff --git a/iced_examples/zbus_invoked_widget/src/main.rs b/iced_examples/zbus_invoked_widget/src/main.rs index 72f2ca2..d730b70 100644 --- a/iced_examples/zbus_invoked_widget/src/main.rs +++ b/iced_examples/zbus_invoked_widget/src/main.rs @@ -45,8 +45,8 @@ impl TryInto for Message { match self { Self::NewWindow => Ok(LaLaShellIdAction::new( None, - LalaShellAction::NewLayerShell(( - NewLayerShellSettings { + LalaShellAction::NewLayerShell { + settings: NewLayerShellSettings { size: None, exclusive_zone: None, anchor: Anchor::Right | Anchor::Top | Anchor::Left | Anchor::Bottom, @@ -56,9 +56,9 @@ impl TryInto for Message { use_last_output: false, ..Default::default() }, - (), - false, - )), + info: (), + single_tone: false, + }, )), _ => Err(self), } diff --git a/iced_layershell/src/actions.rs b/iced_layershell/src/actions.rs index d7e2eb8..188f167 100644 --- a/iced_layershell/src/actions.rs +++ b/iced_layershell/src/actions.rs @@ -45,9 +45,20 @@ pub enum LayershellCustomActionsWithInfo { time: u32, key: u32, }, - NewLayerShell((NewLayerShellSettings, INFO, bool)), - NewPopUp((IcedNewPopupSettings, INFO)), - NewMenu((IcedNewMenuSettings, INFO)), + // settings, info, single_tone + NewLayerShell { + settings: NewLayerShellSettings, + info: INFO, + single_tone: bool, + }, + NewPopUp { + settings: IcedNewPopupSettings, + info: INFO, + }, + NewMenu { + settings: IcedNewMenuSettings, + info: INFO, + }, /// is same with WindowAction::Close(id) RemoveWindow(IcedId), ForgetLastOutput, diff --git a/iced_layershell/src/multi_window.rs b/iced_layershell/src/multi_window.rs index 57df921..4ddbf59 100644 --- a/iced_layershell/src/multi_window.rs +++ b/iced_layershell/src/multi_window.rs @@ -388,7 +388,9 @@ where ) .ok(); } - LayershellCustomActionsWithInfo::NewLayerShell((settings, info, _)) => { + LayershellCustomActionsWithInfo::NewLayerShell { + settings, info, .. + } => { ev.append_return_data(ReturnData::NewLayerShell(( settings, Some(info), @@ -403,7 +405,10 @@ where )) .ok(); } - LayershellCustomActionsWithInfo::NewPopUp((menusettings, info)) => { + LayershellCustomActionsWithInfo::NewPopUp { + settings: menusettings, + info, + } => { let IcedNewPopupSettings { size, position } = menusettings; let Some(id) = ev.current_surface_id() else { break 'out; @@ -414,7 +419,10 @@ where Some(info), ))); } - LayershellCustomActionsWithInfo::NewMenu((menusetting, info)) => { + LayershellCustomActionsWithInfo::NewMenu { + settings: menusetting, + info, + } => { let Some(id) = ev.current_surface_id() else { break 'out; }; @@ -1000,7 +1008,12 @@ pub(crate) fn run_action( Action::Output(stream) => match stream.try_into() { Ok(action) => { let action: LayershellCustomActionsWithIdAndInfo = action; - if let LayershellCustomActionsWithInfo::NewLayerShell((_, info, true)) = &action.1 { + if let LayershellCustomActionsWithInfo::NewLayerShell { + info, + single_tone: true, + .. + } = &action.1 + { if singleton_layers.contains(info) { return; } diff --git a/iced_layershell_macros/src/lib.rs b/iced_layershell_macros/src/lib.rs index 058bca2..a5e7341 100644 --- a/iced_layershell_macros/src/lib.rs +++ b/iced_layershell_macros/src/lib.rs @@ -69,9 +69,9 @@ pub fn to_layer_message(attr: TokenStream2, input: TokenStream2) -> manyhow::Res None, InnerLayerAction::VirtualKeyboardPressed { time, key }) ), - Self::NewLayerShell {settings, info, single_tone } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewLayerShell((settings, info, single_tone)))), - Self::NewPopUp { settings, info } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewPopUp((settings, info)))), - Self::NewMenu { settings, info } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewMenu((settings, info)))), + Self::NewLayerShell {settings, info, single_tone } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewLayerShell { settings, info, single_tone })), + Self::NewPopUp { settings, info } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewPopUp { settings, info })), + Self::NewMenu { settings, info } => Ok(InnerLayerActionId::new(None, InnerLayerAction::NewMenu {settings, info })), Self::RemoveWindow(id) => Ok(InnerLayerActionId::new(None, InnerLayerAction::RemoveWindow(id))), Self::ForgetLastOutput => Ok(InnerLayerActionId::new(None, InnerLayerAction::ForgetLastOutput)), _ => Err(self)