From 9b15440b62580951eac3a5aebe8a70a30c2f91d9 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 22 Jan 2017 17:54:45 +1100 Subject: [PATCH 1/2] Fix non_upper_case_globals warnings on macos --- src/platform/macos/mod.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/platform/macos/mod.rs b/src/platform/macos/mod.rs index d05984cc..bd06414b 100644 --- a/src/platform/macos/mod.rs +++ b/src/platform/macos/mod.rs @@ -34,10 +34,10 @@ pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor}; mod monitor; mod event; -static mut shift_pressed: bool = false; -static mut ctrl_pressed: bool = false; -static mut win_pressed: bool = false; -static mut alt_pressed: bool = false; +static mut SHIFT_PRESSED: bool = false; +static mut CTRL_PRESSED: bool = false; +static mut WIN_PRESSED: bool = false; +static mut ALT_PRESSED: bool = false; struct DelegateState { 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; INIT.call_once(|| unsafe { @@ -126,11 +126,11 @@ impl WindowDelegate { // Store internal state as user data decl.add_ivar::<*mut c_void>("glutinState"); - delegate_class = decl.register(); + DELEGATE_CLASS = decl.register(); }); unsafe { - delegate_class + DELEGATE_CLASS } } @@ -780,24 +780,24 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option { }, appkit::NSFlagsChanged => { 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() { - shift_pressed = !shift_pressed; + SHIFT_PRESSED = !SHIFT_PRESSED; 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() { - ctrl_pressed = !ctrl_pressed; + CTRL_PRESSED = !CTRL_PRESSED; 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() { - win_pressed = !win_pressed; + WIN_PRESSED = !WIN_PRESSED; 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() { - alt_pressed = !alt_pressed; + ALT_PRESSED = !ALT_PRESSED; events.push_back(alt_modifier.unwrap()); } let event = events.pop_front(); From 95b7d5326ee56319800123742556a7f9742a7cea Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 22 Jan 2017 17:55:30 +1100 Subject: [PATCH 2/2] Fix patterns_in_fns_without_body warning on macos --- src/os/macos.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/macos.rs b/src/os/macos.rs index d77c64f4..85d2d88d 100755 --- a/src/os/macos.rs +++ b/src/os/macos.rs @@ -62,7 +62,7 @@ impl From for NSApplicationActivationPolicy { /// Additional methods on `WindowBuilder` that are specific to MacOS. 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 {