Skip to content

Commit

Permalink
Rename feature ksni to linux-ksni
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Jan 8, 2025
1 parent d12cba1 commit 2415231
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default = ["libxdo"]
libxdo = ["dep:libxdo"]
common-controls-v6 = []
serde = ["dep:serde", "dpi/serde"]
ksni = ["arc-swap"]
linux-ksni = ["arc-swap"]

[dependencies]
arc-swap = { version = "1.7.1", optional = true }
Expand Down
28 changes: 14 additions & 14 deletions src/items/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use std::{cell::RefCell, mem, rc::Rc};

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use std::sync::Arc;

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use arc_swap::ArcSwap;

use crate::{accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId, MenuItemKind};
Expand All @@ -22,7 +22,7 @@ use crate::{accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId
pub struct CheckMenuItem {
pub(crate) id: Rc<MenuId>,
pub(crate) inner: Rc<RefCell<crate::platform_impl::MenuChild>>,
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) compat: Arc<ArcSwap<crate::CompatMenuItem>>,
}

Expand All @@ -42,7 +42,7 @@ impl IsMenuItem for CheckMenuItem {
}

impl CheckMenuItem {
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) fn compat_menu_item(
item: &crate::platform_impl::MenuChild,
) -> crate::CompatMenuItem {
Expand Down Expand Up @@ -73,13 +73,13 @@ impl CheckMenuItem {
None,
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(inner.id().clone()),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -104,13 +104,13 @@ impl CheckMenuItem {
Some(id.clone()),
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(id),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -132,10 +132,10 @@ impl CheckMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_text(text.as_ref());

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand All @@ -149,10 +149,10 @@ impl CheckMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_enabled(enabled);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand All @@ -171,10 +171,10 @@ impl CheckMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_checked(checked);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand Down
36 changes: 18 additions & 18 deletions src/items/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use std::{cell::RefCell, mem, rc::Rc};

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use std::sync::Arc;

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use arc_swap::ArcSwap;

use crate::{
Expand All @@ -26,7 +26,7 @@ use crate::{
pub struct IconMenuItem {
pub(crate) id: Rc<MenuId>,
pub(crate) inner: Rc<RefCell<crate::platform_impl::MenuChild>>,
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) compat: Arc<ArcSwap<crate::CompatMenuItem>>,
}

Expand All @@ -46,7 +46,7 @@ impl IsMenuItem for IconMenuItem {
}

impl IconMenuItem {
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) fn compat_menu_item(
item: &crate::platform_impl::MenuChild,
) -> crate::CompatMenuItem {
Expand Down Expand Up @@ -81,13 +81,13 @@ impl IconMenuItem {
None,
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(inner.id().clone()),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -112,13 +112,13 @@ impl IconMenuItem {
Some(id.clone()),
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(id),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -144,13 +144,13 @@ impl IconMenuItem {
None,
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(inner.id().clone()),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand Down Expand Up @@ -178,13 +178,13 @@ impl IconMenuItem {
Some(id.clone()),
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(id),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -206,10 +206,10 @@ impl IconMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_text(text.as_ref());

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand All @@ -223,10 +223,10 @@ impl IconMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_enabled(enabled);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand All @@ -245,10 +245,10 @@ impl IconMenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_icon(icon);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand Down
4 changes: 2 additions & 2 deletions src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod normal;
mod predefined;
mod submenu;

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
mod compat;

pub use check::*;
Expand All @@ -17,7 +17,7 @@ pub use normal::*;
pub use predefined::*;
pub use submenu::*;

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub use compat::*;

#[cfg(test)]
Expand Down
24 changes: 12 additions & 12 deletions src/items/normal.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{cell::RefCell, mem, rc::Rc};

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use std::sync::Arc;

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
use arc_swap::ArcSwap;

use crate::{accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId, MenuItemKind};
Expand All @@ -16,7 +16,7 @@ use crate::{accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId
pub struct MenuItem {
pub(crate) id: Rc<MenuId>,
pub(crate) inner: Rc<RefCell<crate::platform_impl::MenuChild>>,
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) compat: Arc<ArcSwap<crate::CompatMenuItem>>,
}

Expand All @@ -36,7 +36,7 @@ impl IsMenuItem for MenuItem {
}

impl MenuItem {
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
pub(crate) fn compat_menu_item(
item: &crate::platform_impl::MenuChild,
) -> crate::CompatMenuItem {
Expand All @@ -57,13 +57,13 @@ impl MenuItem {
pub fn new<S: AsRef<str>>(text: S, enabled: bool, accelerator: Option<Accelerator>) -> Self {
let inner = crate::platform_impl::MenuChild::new(text.as_ref(), enabled, accelerator, None);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(inner.id().clone()),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -86,13 +86,13 @@ impl MenuItem {
Some(id.clone()),
);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
let compat = Self::compat_menu_item(&inner);

Self {
id: Rc::new(id),
inner: Rc::new(RefCell::new(inner)),
#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
compat: Arc::new(ArcSwap::from_pointee(compat)),
}
}
Expand All @@ -114,10 +114,10 @@ impl MenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_text(text.as_ref());

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand All @@ -131,10 +131,10 @@ impl MenuItem {
let mut inner = self.inner.borrow_mut();
inner.set_enabled(enabled);

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
crate::send_menu_update();
}

Expand Down
Loading

0 comments on commit 2415231

Please sign in to comment.