ui/cocoa: Perform UI operations only on the main thread
commit5588840ff77800e839d8a34b7be10e5c3acd1721
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 25 Feb 2019 10:24:33 +0000 (25 10:24 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 4 Mar 2019 16:47:31 +0000 (4 16:47 +0000)
tree9da74f911f80a094c81c01e9f81b96efe2bbca58
parent61a2ed447e1c0a05c4bb568c579a2d64c2d9c232
ui/cocoa: Perform UI operations only on the main thread

The OSX Mojave release is more picky about enforcing the Cocoa API
restriction that only the main thread may perform UI calls. To
accommodate this we need to restructure the Cocoa code:
 * the special OSX main() creates a second thread and uses
   that to call the vl.c qemu_main(); the original main
   thread goes into the OSX event loop
 * the refresh, switch and update callbacks asynchronously
   tell the main thread to do the necessary work
 * the refresh callback no longer does the "get events from the
   UI event queue and handle them" loop, since we now use
   the stock OSX event loop. Instead our NSApplication sendEvent
   method will either deal with them or pass them on to OSX

All these things have to be changed in one commit, to avoid
breaking bisection.

Note that since we use dispatch_get_main_queue(), this bumps
our minimum version requirement to OSX 10.10 Yosemite (released
in 2014, unsupported by Apple since 2017).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
Message-id: 20190225102433.22401-8-peter.maydell@linaro.org
Message-id: 20190214102816.3393-8-peter.maydell@linaro.org
ui/cocoa.m