Skip to content

Commit

Permalink
Fix ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Feb 8, 2025
1 parent 47ae86b commit 33f0917
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 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
12 changes: 9 additions & 3 deletions src/platform_impl/windows/dark_menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

use std::cell::Cell;
use std::cell::OnceCell;

use once_cell::sync::Lazy;
use windows_sys::{
Expand Down Expand Up @@ -94,15 +94,21 @@ fn background_brush() -> HBRUSH {
static BACKGROUND_BRUSH: Win32Brush = const { Win32Brush::null() };
}
const BACKGROUND_COLOR: u32 = 2829099;
BACKGROUND_BRUSH.with(|brush| brush.get_or_set(BACKGROUND_COLOR))
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 {
thread_local! {
static SELECTED_BACKGROUND_BRUSH: Win32Brush = const { Win32Brush::null() };
}
const SELECTED_BACKGROUND_COLOR: u32 = 4276545;
SELECTED_BACKGROUND_BRUSH.with(|brush| brush.get_or_set(SELECTED_BACKGROUND_COLOR))
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 33f0917

Please sign in to comment.