aboutsummaryrefslogtreecommitdiffstats
path: root/src/osx
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-10-30 14:01:52 +0100
committerTomaka17 <pierre.krieger1708@gmail.com>2014-11-06 19:09:07 +0100
commit2be71306ec40cd8cc660bbd4160103aa485b2999 (patch)
tree82c316d17fe37a458e5ec3d3709a90cb28c9a8c6 /src/osx
parent9926e179d6f8ebbc37625dce6682167c37c3a998 (diff)
downloadglutin-2be71306ec40cd8cc660bbd4160103aa485b2999.tar.gz
glutin-2be71306ec40cd8cc660bbd4160103aa485b2999.zip
Remove key modifiers in KeyboardInput
Diffstat (limited to 'src/osx')
-rw-r--r--src/osx/event.rs18
-rw-r--r--src/osx/mod.rs12
2 files changed, 5 insertions, 25 deletions
diff --git a/src/osx/event.rs b/src/osx/event.rs
index a4128a4..b5853bc 100644
--- a/src/osx/event.rs
+++ b/src/osx/event.rs
@@ -1,25 +1,7 @@
use events;
-use events::KeyModifiers;
use cocoa::base::NSUInteger;
use cocoa::appkit;
-pub fn modifierflag_to_element(flag: NSUInteger) -> KeyModifiers {
- let mut modifiers = KeyModifiers::empty();
- if flag & appkit::NSShiftKeyMask as u64 == appkit::NSShiftKeyMask as u64 {
- modifiers = modifiers | events::LEFT_SHIFT_MODIFIER;
- }
- if flag & appkit::NSControlKeyMask as u64 == appkit::NSControlKeyMask as u64 {
- modifiers = modifiers | events::LEFT_CONTROL_MODIFIER;
- }
- if flag & appkit::NSAlternateKeyMask as u64 == appkit::NSAlternateKeyMask as u64 {
- modifiers = modifiers | events::LEFT_ALT_MODIFIER;
- }
- if flag & appkit::NSNumericPadKeyMask as u64 == appkit::NSNumericPadKeyMask as u64 {
- modifiers = modifiers | events::NUM_LOCK_MODIFIER;
- }
- modifiers
-}
-
pub fn vkeycode_to_element(code: u16) -> Option<events::VirtualKeyCode> {
Some(match code {
0x00 => events::A,
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index de7e902..ea79f04 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -18,7 +18,7 @@ use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFuncti
use std::c_str::CString;
use {MouseInput, Pressed, Released, LeftMouseButton, RightMouseButton, MouseMoved, ReceivedCharacter,
- KeyboardInput, KeyModifiers};
+ KeyboardInput};
use events;
@@ -252,13 +252,11 @@ impl Window {
}
let vkey = event::vkeycode_to_element(event.keycode());
- let modifiers = event::modifierflag_to_element(event.modifierFlags());
- events.push(KeyboardInput(Pressed, event.keycode() as u8, vkey, modifiers));
+ events.push(KeyboardInput(Pressed, event.keycode() as u8, vkey));
},
NSKeyUp => {
let vkey = event::vkeycode_to_element(event.keycode());
- let modifiers = event::modifierflag_to_element(event.modifierFlags());
- events.push(KeyboardInput(Released, event.keycode() as u8, vkey, modifiers));
+ events.push(KeyboardInput(Released, event.keycode() as u8, vkey));
},
NSFlagsChanged => {
let shift_modifier = Window::modifier_event(event, appkit::NSShiftKeyMask as u64, events::LShift, shift_pressed);
@@ -295,10 +293,10 @@ impl Window {
unsafe fn modifier_event(event: id, keymask: u64, key: events::VirtualKeyCode, key_pressed: bool) -> Option<Event> {
if !key_pressed && Window::modifier_key_pressed(event, keymask) {
- return Some(KeyboardInput(Pressed, event.keycode() as u8, Some(key), KeyModifiers::empty()));
+ return Some(KeyboardInput(Pressed, event.keycode() as u8, Some(key)));
}
else if key_pressed && !Window::modifier_key_pressed(event, keymask) {
- return Some(KeyboardInput(Released, event.keycode() as u8, Some(key), KeyModifiers::empty()));
+ return Some(KeyboardInput(Released, event.keycode() as u8, Some(key)));
}
return None;