static DisplayChangeListener dcl = {
.ops = &dcl_ops,
};
+static QKbdState *kbd;
static int cursor_hide = 1;
static int left_command_key_enabled = 1;
static bool swap_opt_cmd;
NSTrackingArea *trackingArea;
QEMUScreen screen;
pixman_image_t *pixman_image;
- QKbdState *kbd;
BOOL isMouseGrabbed;
BOOL isAbsoluteEnabled;
CFMachPortRef eventsTap;
screen.width = frameRect.size.width;
screen.height = frameRect.size.height;
- kbd = qkbd_state_init(dcl.con);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0
[self setClipsToBounds:YES];
#endif
pixman_image_unref(pixman_image);
}
- qkbd_state_free(kbd);
-
if (eventsTap) {
CFRelease(eventsTap);
}
[self removeTrackingRect];
}
+- (void) selectConsoleLocked:(unsigned int)index
+{
+ QemuConsole *con = qemu_console_lookup_by_index(index);
+ if (!con) {
+ return;
+ }
+
+ unregister_displaychangelistener(&dcl);
+ qkbd_state_switch_console(kbd, con);
+ dcl.con = con;
+ register_displaychangelistener(&dcl);
+ [self updateUIInfo];
+}
+
- (void) hideCursor
{
if (!cursor_hide) {
}
if (keysym) {
- qemu_text_console_put_keysym(NULL, keysym);
+ QemuTextConsole *con = QEMU_TEXT_CONSOLE(dcl.con);
+ qemu_text_console_put_keysym(con, keysym);
}
}
// enable graphic console
case '1' ... '9':
- console_select(key - '0' - 1); /* ascii math */
+ [self selectConsoleLocked:key - '0' - 1]; /* ascii math */
return true;
// release the mouse grab
}
}
- if (qemu_console_is_graphic(NULL)) {
+ if (qemu_console_is_graphic(dcl.con)) {
qkbd_state_key_event(kbd, keycode, true);
} else {
[self handleMonitorInput: event];
return true;
}
- if (qemu_console_is_graphic(NULL)) {
+ if (qemu_console_is_graphic(dcl.con)) {
qkbd_state_key_event(kbd, keycode, false);
}
return true;
- (void)displayConsole:(id)sender
{
with_bql(^{
- console_select([sender tag]);
+ [cocoaView selectConsoleLocked:[sender tag]];
});
}
pixman_image_ref(image);
dispatch_async(dispatch_get_main_queue(), ^{
- [cocoaView updateUIInfo];
[cocoaView switchSurface:image];
});
}
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n");
- graphic_hw_update(NULL);
+ graphic_hw_update(dcl->con);
if (qemu_input_is_absolute(dcl->con)) {
dispatch_async(dispatch_get_main_queue(), ^{
add_console_menu_entries();
addRemovableDevicesMenuItems();
+ dcl.con = qemu_console_lookup_default();
+ kbd = qkbd_state_init(dcl.con);
+
// register vga output callbacks
register_displaychangelistener(&dcl);
+ [cocoaView updateUIInfo];
qemu_event_init(&cbevent, false);
cbowner = [[QemuCocoaPasteboardTypeOwner alloc] init];