diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-18 11:52:05 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-18 11:52:05 +0100 |
commit | 51cd65b18fbb105fda1a38081053f023a32cc7a9 (patch) | |
tree | adfe9a6875b99dc1aced8eb264da9d949a5dcd20 | |
parent | d52932ed34e61831f2ca2cdcb217f61605e72f5d (diff) | |
parent | 707f75070a94c28889f887deef0ab4da09e25ddf (diff) | |
download | qemu-51cd65b18fbb105fda1a38081053f023a32cc7a9.zip qemu-51cd65b18fbb105fda1a38081053f023a32cc7a9.tar.gz qemu-51cd65b18fbb105fda1a38081053f023a32cc7a9.tar.bz2 |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20191018-pull-request' into staging
ui: bugfixes for cocoa, curses and input-barrier.
# gpg: Signature made Fri 18 Oct 2019 11:16:53 BST
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20191018-pull-request:
ui: fix keymap file search in input-barrier object
curses: correctly pass the color pair to setcchar()
curses: use the bit mask constants provided by curses
ui: Fix hanging up Cocoa display on macOS 10.15 (Catalina)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | ui/cocoa.m | 12 | ||||
-rw-r--r-- | ui/curses.c | 8 | ||||
-rw-r--r-- | ui/input-barrier.c | 14 |
3 files changed, 24 insertions, 10 deletions
@@ -134,6 +134,7 @@ NSArray * supportedImageFileTypes; static QemuSemaphore display_init_sem; static QemuSemaphore app_started_sem; +static bool allow_events; // Utility functions to run specified code block with iothread lock held typedef void (^CodeBlock)(void); @@ -729,6 +730,16 @@ QemuCocoaView *cocoaView; - (bool) handleEvent:(NSEvent *)event { + if(!allow_events) { + /* + * Just let OSX have all events that arrive before + * applicationDidFinishLaunching. + * This avoids a deadlock on the iothread lock, which cocoa_display_init() + * will not drop until after the app_started_sem is posted. (In theory + * there should not be any such events, but OSX Catalina now emits some.) + */ + return false; + } return bool_with_iothread_lock(^{ return [self handleEventLocked:event]; }); @@ -1156,6 +1167,7 @@ QemuCocoaView *cocoaView; - (void)applicationDidFinishLaunching: (NSNotification *) note { COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n"); + allow_events = true; /* Tell cocoa_display_init to proceed */ qemu_sem_post(&app_started_sem); } diff --git a/ui/curses.c b/ui/curses.c index ec28112..3a1b714 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -75,14 +75,16 @@ static void curses_update(DisplayChangeListener *dcl, line = screen + y * width; for (h += y; y < h; y ++, line += width) { for (x = 0; x < width; x++) { - chtype ch = line[x] & 0xff; - chtype at = line[x] & ~0xff; + chtype ch = line[x] & A_CHARTEXT; + chtype at = line[x] & A_ATTRIBUTES; + short color_pair = PAIR_NUMBER(line[x]); + ret = getcchar(&vga_to_curses[ch], wch, &attrs, &colors, NULL); if (ret == ERR || wch[0] == 0) { wch[0] = ch; wch[1] = 0; } - setcchar(&curses_line[x], wch, at, 0, NULL); + setcchar(&curses_line[x], wch, at, color_pair, NULL); } mvwadd_wchnstr(screenpad, y, 0, curses_line, width); } diff --git a/ui/input-barrier.c b/ui/input-barrier.c index a2c961f..fe35049 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -682,6 +682,13 @@ static void input_barrier_instance_init(Object *obj) { InputBarrier *ib = INPUT_BARRIER(obj); + /* always use generic keymaps */ + if (keyboard_layout && !kbd_layout) { + /* We use X11 key id, so use VNC name2keysym */ + kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout, + &error_fatal); + } + ib->saddr.type = SOCKET_ADDRESS_TYPE_INET; ib->saddr.u.inet.host = g_strdup("localhost"); ib->saddr.u.inet.port = g_strdup("24800"); @@ -719,13 +726,6 @@ static void input_barrier_class_init(ObjectClass *oc, void *data) UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); ucc->complete = input_barrier_complete; - - /* always use generic keymaps */ - if (keyboard_layout) { - /* We use X11 key id, so use VNC name2keysym */ - kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout, - &error_fatal); - } } static const TypeInfo input_barrier_info = { |