ui: bugfixes for cocoa, curses and input-barrier.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJdqZEVAAoJEEy22O7T6HE4gS4P/jKkuKmXzeEoRX00OhZghBnk
 SjGoHyuSFWMdy0fP4+HagaB8444usLDa2mLv6sorKUpQhYRCp5Rla3KT2h7l5td7
 uzynatLTCJVvQh+BPZS9XWcSf482MQ5eOya+9J8SzJnVNDg8OpCbWs5vH7bEZU28
 UWI6HfjTG1BES4SATWFJrTxAVZy4x46RlNoUXRra+Qfa2x1Ucddf4AVCluLEO4uD
 saugpf9WO04nXpPMbOyJhUUTkkMJCh7GcU7y08fJk9MSxlNNUPCkbVZ3sUofg+V0
 6OOHoA3W7vAOsKBilmckoMrgepPFQui19ZkWGCFfjGMFmjlrXazGDR98bQs5Y4mW
 yKWqLgzhYXrjmTDVgmc8e454VX0ugIb3YUJYfojnxoUDwpnZCT5QgWAzxcg1JX51
 +Qcg7yG9hNGZXA9DndOJVtOWQilxbW08HRfV+mFvIimEvuqIj9ONsmVQpWnD3177
 WItAff5IQoQc1bBAO/D1sPHXzYTztqBXcTyu0/TEP6XndIuixAAEyFdMW0ntqSWv
 hLsZ2bwoHKwWGmOsN7zguqupoJkxW1FUhsmf/C8O35tZoQcdBhKap4wicdbGd2wM
 hdjufUCToX+pgoUx5yMR2NgTk/dAP9E7dDZ2xK7Ojwp7f5q/YXfNo3zBu0Ukz/zW
 eibz6i03KKle20lxbhZn
 =gpjR
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2019-10-18 11:52:05 +01:00
commit 51cd65b18f
3 changed files with 24 additions and 10 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 = {