提交 7c206a75 编写于 作者: B bellard

(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
上级 2efc3265
......@@ -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]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册