Added the Alt key modifier

This commit is contained in:
David Partouche 2014-10-23 18:01:09 +02:00
parent 6f46c0c2dd
commit f86af01a99
2 changed files with 8 additions and 0 deletions

View file

@ -128,6 +128,7 @@ pub enum VirtualKeyCode {
Kana, Kana,
Kanji, Kanji,
L, L,
LAlt,
LBracket, LBracket,
LControl, LControl,
Left, Left,
@ -171,6 +172,7 @@ pub enum VirtualKeyCode {
Prevtrack, Prevtrack,
Q, Q,
R, R,
RAlt,
RBracket, RBracket,
RControl, RControl,
Return, Return,

View file

@ -26,6 +26,7 @@ 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;
pub struct Window { pub struct Window {
view: id, view: id,
@ -272,6 +273,11 @@ impl Window {
win_pressed = !win_pressed; win_pressed = !win_pressed;
events.push(win_modifier.unwrap()); 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 => { }, NSScrollWheel => { },
NSOtherMouseDown => { }, NSOtherMouseDown => { },