Skip to content

Commit

Permalink
input: keyboard: switch cocoa ui to new core
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel committed Mar 5, 2014
1 parent c751a74 commit 2e08c66
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions ui/cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -514,16 +514,14 @@ - (void) handleEvent:(NSEvent *)event

if (keycode) {
if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
kbd_put_keycode(keycode);
kbd_put_keycode(keycode | 0x80);
qemu_input_event_send_key_number(dcl->con, keycode, true);
qemu_input_event_send_key_number(dcl->con, keycode, false);
} else if (qemu_console_is_graphic(NULL)) {
if (keycode & 0x80)
kbd_put_keycode(0xe0);
if (modifiers_state[keycode] == 0) { // keydown
kbd_put_keycode(keycode & 0x7f);
qemu_input_event_send_key_number(dcl->con, keycode, true);
modifiers_state[keycode] = 1;
} else { // keyup
kbd_put_keycode(keycode | 0x80);
qemu_input_event_send_key_number(dcl->con, keycode, false);
modifiers_state[keycode] = 0;
}
}
Expand Down Expand Up @@ -557,9 +555,7 @@ - (void) handleEvent:(NSEvent *)event

// handle keys for graphic console
} else if (qemu_console_is_graphic(NULL)) {
if (keycode & 0x80) //check bit for e0 in front
kbd_put_keycode(0xe0);
kbd_put_keycode(keycode & 0x7f); //remove e0 bit in front
qemu_input_event_send_key_number(dcl->con, keycode, true);

// handlekeys for Monitor
} else {
Expand Down Expand Up @@ -607,9 +603,7 @@ - (void) handleEvent:(NSEvent *)event
}

if (qemu_console_is_graphic(NULL)) {
if (keycode & 0x80)
kbd_put_keycode(0xe0);
kbd_put_keycode(keycode | 0x80); //add 128 to signal release of key
qemu_input_event_send_key_number(dcl->con, keycode, false);
}
break;
case NSMouseMoved:
Expand Down

0 comments on commit 2e08c66

Please sign in to comment.