aboutsummaryrefslogtreecommitdiff
path: root/cocoa.m
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-12-18 19:18:45 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-12-18 19:18:45 +0000
commit7c206a754afa8657bc5b4562b45aacd5cdab4817 (patch)
treec4e557566ab1f9e01573e3b1ba1579cf593e04b7 /cocoa.m
parent2efc32658e7517e8e555a31fe99303757cb6bbb5 (diff)
(Joachim Henke)
- suppress unwanted kernel logs - avoids passing modifier keys to the guest OS when typing in the Monitor - fixes the bug that the mouse cursor grab is released with _any_ modifier key (should be only ctrl+alt) - removes some code redundancies git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1721 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cocoa.m')
-rw-r--r--cocoa.m43
1 files changed, 23 insertions, 20 deletions
diff --git a/cocoa.m b/cocoa.m
index 895e96f982..27773e9fdd 100644
--- a/cocoa.m
+++ b/cocoa.m
@@ -375,36 +375,39 @@ static void cocoa_refresh(DisplayState *ds)
case NSFlagsChanged:
{
int keycode = cocoa_keycode_to_qemu([event keyCode]);
- modifiers_state[keycode] = (modifiers_state[keycode] == 0) ? 1 : 0;
-
- if ( modifiers_state[keycode] ) { /* Keydown */
- if (keycode & 0x80)
- kbd_put_keycode(0xe0);
- kbd_put_keycode(keycode & 0x7f);
- } else { /* Keyup */
- if (keycode & 0x80)
- kbd_put_keycode(0xe0);
- kbd_put_keycode(keycode | 0x80);
- }
-
- /* emulate caps lock and num lock keyup */
- if ((keycode == 58) || (keycode == 69))
+
+ if (keycode)
{
- modifiers_state[keycode] = 0;
- if (keycode & 0x80)
- kbd_put_keycode(0xe0);
- kbd_put_keycode(keycode | 0x80);
+ if (keycode == 58 || keycode == 69) {
+ /* emulate caps lock and num lock keydown and keyup */
+ kbd_put_keycode(keycode);
+ kbd_put_keycode(keycode | 0x80);
+ } else if (is_active_console(vga_console)) {
+ if (keycode & 0x80)
+ kbd_put_keycode(0xe0);
+ if (modifiers_state[keycode] == 0) {
+ /* keydown */
+ kbd_put_keycode(keycode & 0x7f);
+ modifiers_state[keycode] = 1;
+ } else {
+ /* keyup */
+ kbd_put_keycode(keycode | 0x80);
+ modifiers_state[keycode] = 0;
+ }
+ }
}
-
+
/* release Mouse grab when pressing ctrl+alt */
if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask))
+ {
[window setTitle: @"QEMU"];
[NSCursor unhide];
CGAssociateMouseAndMouseCursorPosition ( TRUE );
grab = 0;
+ }
}
break;
-
+
case NSKeyDown:
{
int keycode = cocoa_keycode_to_qemu([event keyCode]);