Skip to content

Commit

Permalink
Fix ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Jan 8, 2025
1 parent 9be0963 commit d513bc2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
21 changes: 15 additions & 6 deletions src/items/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,23 @@ impl CheckMenuItem {

/// Check or Uncheck this check menu item.
pub fn set_checked(&self, checked: bool) {
let mut inner = self.inner.borrow_mut();
inner.set_checked(checked);
#[cfg(target_os = "macos")]
{
let inner = self.inner.borrow();
inner.set_checked(checked);
}

#[cfg(all(feature = "linux-ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));
#[cfg(not(target_os = "macos"))]
{
let mut inner = self.inner.borrow_mut();
inner.set_checked(checked);

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

/// Convert this menu item into its menu ID.
Expand Down
24 changes: 10 additions & 14 deletions src/platform_impl/windows/dark_menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#![allow(non_snake_case, clippy::upper_case_acronyms)]

use std::cell::OnceCell;

use once_cell::sync::Lazy;
use windows_sys::{
s,
Expand Down Expand Up @@ -76,24 +78,18 @@ impl Drop for HBrush {

fn background_brush() -> HBRUSH {
const BACKGROUND_COLOR: u32 = 2829099;
static mut BACKGROUND_BRUSH: Option<HBrush> = None;
unsafe {
if BACKGROUND_BRUSH.is_none() {
BACKGROUND_BRUSH = Some(HBrush(CreateSolidBrush(BACKGROUND_COLOR)));
}
BACKGROUND_BRUSH.as_ref().unwrap().0
}
static BACKGROUND_BRUSH: OnceCell<HBrush> = OnceCell::new();

let hbrush = BACKGROUND_BRUSH.get_or_init(|| HBrush(CreateSolidBrush(BACKGROUND_COLOR)));
hbrush.as_ref().unwrap().0
}

fn selected_background_brush() -> HBRUSH {
const SELECTED_BACKGROUND_COLOR: u32 = 4276545;
static mut SELECTED_BACKGROUND_BRUSH: Option<HBrush> = None;
unsafe {
if SELECTED_BACKGROUND_BRUSH.is_none() {
SELECTED_BACKGROUND_BRUSH = Some(HBrush(CreateSolidBrush(SELECTED_BACKGROUND_COLOR)));
}
SELECTED_BACKGROUND_BRUSH.as_ref().unwrap().0
}
static SELECTED_BACKGROUND_BRUSH: OnceCell<HBrush> = OnceCell::new();

let hbrush = SELECTED_BACKGROUND_BRUSH.get_or_init(|| HBrush(CreateSolidBrush(SELECTED_BACKGROUND_COLOR)));
hbrush.as_ref().unwrap().0
}

/// Draws a dark menu bar if needed and returns whether it draws it or not
Expand Down

0 comments on commit d513bc2

Please sign in to comment.