mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Merge pull request #117 from mitchmindtree/fix_macos_warnings
Fix all warnings on macOS
This commit is contained in:
commit
4cc6faa800
|
@ -62,7 +62,7 @@ impl From<ActivationPolicy> for NSApplicationActivationPolicy {
|
||||||
|
|
||||||
/// Additional methods on `WindowBuilder` that are specific to MacOS.
|
/// Additional methods on `WindowBuilder` that are specific to MacOS.
|
||||||
pub trait WindowBuilderExt {
|
pub trait WindowBuilderExt {
|
||||||
fn with_activation_policy(mut self, activation_policy: ActivationPolicy) -> WindowBuilder;
|
fn with_activation_policy(self, activation_policy: ActivationPolicy) -> WindowBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowBuilderExt for WindowBuilder {
|
impl WindowBuilderExt for WindowBuilder {
|
||||||
|
|
|
@ -34,10 +34,10 @@ pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor};
|
||||||
mod monitor;
|
mod monitor;
|
||||||
mod event;
|
mod event;
|
||||||
|
|
||||||
static mut shift_pressed: bool = false;
|
static mut SHIFT_PRESSED: bool = false;
|
||||||
static mut ctrl_pressed: bool = false;
|
static mut CTRL_PRESSED: bool = false;
|
||||||
static mut win_pressed: bool = false;
|
static mut WIN_PRESSED: bool = false;
|
||||||
static mut alt_pressed: bool = false;
|
static mut ALT_PRESSED: bool = false;
|
||||||
|
|
||||||
struct DelegateState {
|
struct DelegateState {
|
||||||
view: IdRef,
|
view: IdRef,
|
||||||
|
@ -104,7 +104,7 @@ impl WindowDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut delegate_class: *const Class = 0 as *const Class;
|
static mut DELEGATE_CLASS: *const Class = 0 as *const Class;
|
||||||
static INIT: Once = ONCE_INIT;
|
static INIT: Once = ONCE_INIT;
|
||||||
|
|
||||||
INIT.call_once(|| unsafe {
|
INIT.call_once(|| unsafe {
|
||||||
|
@ -126,11 +126,11 @@ impl WindowDelegate {
|
||||||
// Store internal state as user data
|
// Store internal state as user data
|
||||||
decl.add_ivar::<*mut c_void>("glutinState");
|
decl.add_ivar::<*mut c_void>("glutinState");
|
||||||
|
|
||||||
delegate_class = decl.register();
|
DELEGATE_CLASS = decl.register();
|
||||||
});
|
});
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
delegate_class
|
DELEGATE_CLASS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,24 +780,24 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
|
||||||
},
|
},
|
||||||
appkit::NSFlagsChanged => {
|
appkit::NSFlagsChanged => {
|
||||||
let mut events = VecDeque::new();
|
let mut events = VecDeque::new();
|
||||||
let shift_modifier = Window::modifier_event(nsevent, appkit::NSShiftKeyMask, events::VirtualKeyCode::LShift, shift_pressed);
|
let shift_modifier = Window::modifier_event(nsevent, appkit::NSShiftKeyMask, events::VirtualKeyCode::LShift, SHIFT_PRESSED);
|
||||||
if shift_modifier.is_some() {
|
if shift_modifier.is_some() {
|
||||||
shift_pressed = !shift_pressed;
|
SHIFT_PRESSED = !SHIFT_PRESSED;
|
||||||
events.push_back(shift_modifier.unwrap());
|
events.push_back(shift_modifier.unwrap());
|
||||||
}
|
}
|
||||||
let ctrl_modifier = Window::modifier_event(nsevent, appkit::NSControlKeyMask, events::VirtualKeyCode::LControl, ctrl_pressed);
|
let ctrl_modifier = Window::modifier_event(nsevent, appkit::NSControlKeyMask, events::VirtualKeyCode::LControl, CTRL_PRESSED);
|
||||||
if ctrl_modifier.is_some() {
|
if ctrl_modifier.is_some() {
|
||||||
ctrl_pressed = !ctrl_pressed;
|
CTRL_PRESSED = !CTRL_PRESSED;
|
||||||
events.push_back(ctrl_modifier.unwrap());
|
events.push_back(ctrl_modifier.unwrap());
|
||||||
}
|
}
|
||||||
let win_modifier = Window::modifier_event(nsevent, appkit::NSCommandKeyMask, events::VirtualKeyCode::LWin, win_pressed);
|
let win_modifier = Window::modifier_event(nsevent, appkit::NSCommandKeyMask, events::VirtualKeyCode::LWin, WIN_PRESSED);
|
||||||
if win_modifier.is_some() {
|
if win_modifier.is_some() {
|
||||||
win_pressed = !win_pressed;
|
WIN_PRESSED = !WIN_PRESSED;
|
||||||
events.push_back(win_modifier.unwrap());
|
events.push_back(win_modifier.unwrap());
|
||||||
}
|
}
|
||||||
let alt_modifier = Window::modifier_event(nsevent, appkit::NSAlternateKeyMask, events::VirtualKeyCode::LAlt, alt_pressed);
|
let alt_modifier = Window::modifier_event(nsevent, appkit::NSAlternateKeyMask, events::VirtualKeyCode::LAlt, ALT_PRESSED);
|
||||||
if alt_modifier.is_some() {
|
if alt_modifier.is_some() {
|
||||||
alt_pressed = !alt_pressed;
|
ALT_PRESSED = !ALT_PRESSED;
|
||||||
events.push_back(alt_modifier.unwrap());
|
events.push_back(alt_modifier.unwrap());
|
||||||
}
|
}
|
||||||
let event = events.pop_front();
|
let event = events.pop_front();
|
||||||
|
|
Loading…
Reference in a new issue