This commit is contained in:
Antonio Scandurra 2022-09-13 14:50:18 +02:00
parent a34eaa3606
commit b3dd09a0f2

View file

@ -5,8 +5,8 @@ use crate::{
};
use cocoa::{
appkit::{
NSApplication, NSButton, NSSquareStatusItemLength, NSStatusBar, NSStatusItem, NSView,
NSViewHeightSizable, NSViewWidthSizable, NSWindow,
NSApplication, NSButton, NSEventMask, NSSquareStatusItemLength, NSStatusBar, NSStatusItem,
NSView, NSViewHeightSizable, NSViewWidthSizable, NSWindow,
},
base::{id, nil, YES},
foundation::{NSSize, NSUInteger},
@ -32,9 +32,6 @@ use std::{
static mut HANDLER_CLASS: *const Class = ptr::null();
const STATE_IVAR: &str = "state";
#[allow(non_upper_case_globals)]
const NSEventMaskAny: NSUInteger = NSUInteger::MAX;
#[ctor]
unsafe fn build_classes() {
HANDLER_CLASS = {
@ -82,7 +79,7 @@ impl StatusItem {
.set_ivar(STATE_IVAR, Weak::into_raw(state.clone()) as *const c_void);
button.setTarget_(*event_handler);
button.setAction_(sel!(handleEvent));
let _: () = msg_send![button, sendActionOn: NSEventMaskAny];
let _: () = msg_send![button, sendActionOn: NSEventMask::NSAnyEventMask];
RefCell::new(StatusItemState {
native_item,