aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Partouche <david@manateedev.com>2014-10-23 18:01:09 +0200
committerDavid Partouche <david@manateedev.com>2014-10-23 18:01:09 +0200
commitf86af01a99064ac1476498ea48370d4193ceda97 (patch)
tree41f7387deaeecd90a8fb3f06284433d0ab0badaf
parent6f46c0c2dd9eedd350dd2ea1a426c96ef6284357 (diff)
downloadglutin-f86af01a99064ac1476498ea48370d4193ceda97.tar.gz
glutin-f86af01a99064ac1476498ea48370d4193ceda97.zip
Added the Alt key modifier
-rw-r--r--src/events.rs2
-rw-r--r--src/osx/mod.rs6
2 files changed, 8 insertions, 0 deletions
diff --git a/src/events.rs b/src/events.rs
index 1b46e10..0c11a75 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -128,6 +128,7 @@ pub enum VirtualKeyCode {
Kana,
Kanji,
L,
+ LAlt,
LBracket,
LControl,
Left,
@@ -171,6 +172,7 @@ pub enum VirtualKeyCode {
Prevtrack,
Q,
R,
+ RAlt,
RBracket,
RControl,
Return,
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index abe233d..dfd2eb8 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -26,6 +26,7 @@ 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;
pub struct Window {
view: id,
@@ -272,6 +273,11 @@ impl Window {
win_pressed = !win_pressed;
events.push(win_modifier.unwrap());
}
+ let alt_modifier = Window::modifier_event(event, appkit::NSAlternateKeyMask as u64, events::LAlt, alt_pressed);
+ if alt_modifier.is_some() {
+ alt_pressed = !alt_pressed;
+ events.push(alt_modifier.unwrap());
+ }
},
NSScrollWheel => { },
NSOtherMouseDown => { },