chore: update features and feature gates

This commit is contained in:
Ashley Wulber 2026-03-30 18:51:33 -04:00 committed by Ashley Wulber
parent 380b341bdc
commit 413e63f62a
18 changed files with 159 additions and 102 deletions

View file

@ -3,7 +3,12 @@
//! A context menu is a menu in a graphical user interface that appears upon user interaction, such as a right-click mouse operation.
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
use crate::app::cosmic::{WINDOWING_SYSTEM, WindowingSystem};
use crate::widget::menu::{
self, CloseCondition, Direction, ItemHeight, ItemWidth, MenuBarState, PathHighlight,
@ -59,7 +64,12 @@ pub struct ContextMenu<'a, Message> {
}
impl<Message: Clone + 'static> ContextMenu<'_, Message> {
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
#[allow(clippy::too_many_lines)]
fn create_popup(
&mut self,
@ -364,7 +374,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
state.active_root.clear();
state.open = false;
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
&& let Some(id) = state.popup_id.remove(&self.window_id)
{
@ -403,7 +418,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
state.open = true;
state.view_cursor = cursor;
});
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland)) {
self.create_popup(layout, cursor, renderer, shell, viewport, state);
}
@ -422,6 +442,7 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
@ -458,7 +479,12 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
_viewport: &iced::Rectangle,
translation: Vector,
) -> Option<iced_core::overlay::Element<'b, Message, crate::Theme, crate::Renderer>> {
#[cfg(all(feature = "wayland", feature = "winit", feature = "surface-message"))]
#[cfg(all(
feature = "wayland",
target_os = "linux",
feature = "winit",
feature = "surface-message"
))]
if matches!(WINDOWING_SYSTEM.get(), Some(WindowingSystem::Wayland))
&& self.window_id != window::Id::NONE
&& self.on_surface_action.is_some()