feat: integrate text context menu popups into Cosmic framework view system
This commit is contained in:
parent
d751855c74
commit
a70feab2bf
1 changed files with 13 additions and 2 deletions
|
|
@ -513,7 +513,7 @@ where
|
|||
&mut self,
|
||||
message: crate::Action<T::Message>,
|
||||
) -> iced::Task<crate::Action<T::Message>> {
|
||||
let message = match message {
|
||||
let mut task = match message {
|
||||
crate::Action::App(message) => self.app.update(message),
|
||||
crate::Action::Cosmic(message) => self.cosmic_update(message),
|
||||
crate::Action::None => iced::Task::none(),
|
||||
|
|
@ -533,7 +533,7 @@ where
|
|||
#[cfg(all(target_env = "gnu", not(target_os = "windows")))]
|
||||
crate::malloc::trim(0);
|
||||
|
||||
message
|
||||
task
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "multi-window"))]
|
||||
|
|
@ -712,9 +712,15 @@ where
|
|||
|
||||
#[cfg(feature = "multi-window")]
|
||||
pub fn view(&self, id: window::Id) -> Element<'_, crate::Action<T::Message>> {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||
if let Some((_, _, _, Some(v))) = self.surface_views.get(&id) {
|
||||
return v(&self.app);
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
if let Some(element) = crate::widget::text_context_menu::popup_view_for_id::<T::Message>(id)
|
||||
{
|
||||
return element;
|
||||
}
|
||||
if self
|
||||
.app
|
||||
.core()
|
||||
|
|
@ -724,6 +730,8 @@ where
|
|||
return self.app.view_window(id).map(crate::Action::App);
|
||||
}
|
||||
|
||||
crate::widget::text_context_menu::set_current_window_id(id);
|
||||
|
||||
let view = if self.app.core().window.use_template {
|
||||
self.app.view_main()
|
||||
} else {
|
||||
|
|
@ -738,6 +746,9 @@ where
|
|||
|
||||
#[cfg(not(feature = "multi-window"))]
|
||||
pub fn view(&self) -> Element<crate::Action<T::Message>> {
|
||||
if let Some(id) = self.app.core().main_window_id() {
|
||||
crate::widget::text_context_menu::set_current_window_id(id);
|
||||
}
|
||||
let view = self.app.view_main();
|
||||
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "windows")))]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue