summaryrefslogtreecommitdiff
path: root/ui/cocoa.m
AgeCommit message (Collapse)Author
2021-03-16ui/cocoa: Comment about modifier key input quirksAkihiko Odaki
Based-on: <20210310042348.21931-1-akihiko.odaki@gmail.com> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210312133212.3131-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-15ui/cocoa: Do not exit immediately after shutdownAkihiko Odaki
ui/cocoa used to call exit immediately after calling qemu_system_shutdown_request, which prevents QEMU from actually perfoming system shutdown. Just sleep forever, and wait QEMU to call exit and kill the Cocoa thread. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210219111652.20623-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Fix mouse association stateAkihiko Odaki
ui/cocoa deassociates the mouse input and the mouse cursor position only when relative movement inputs are expected. Such inputs may let the mouse cursor leave the view and cause undesired side effects if they are associated. On the other hand, the problem does not occur when inputting absolute points, and the association allows seamless cursor movement across views. However, the synchronization of the association and the expected input type was only done when grabbing the mouse. In reality, the state whether the emulated input device expects absolute pointing inputs or relative movement inputs can vary dynamically due to USB device hot-plugging, for example. This change adds association state updates according to input type expectation changes. It also removes an internal flag representing the association state because the state can now be determined with the current input type expectation and it only adds the complexity of the state tracking. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210222150714.21766-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Mark variables staticAkihiko Odaki
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210225084202.39601-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Clear modifiers whenever possibleAkihiko Odaki
ui/cocoa does not receive NSEventTypeFlagsChanged when it is not active, and the modifier state can be desynchronized in such a situation. [NSEvent -modifierFlags] tells whether a modifier is *not* pressed, so check it whenever receiving an event and clear the modifier if it is not pressed. Note that [NSEvent -modifierFlags] does not tell if a certain modifier *is* pressed because the documented mask for [NSEvent -modifierFlags] generalizes left shift and right shift, for example. CapsLock is the only exception. The pressed state is synchronized only with NSEventTypeFlagsChanged. This change also removes modifier keys from keycode map. If they are input with NSEventTypeKeyDown or NSEventTypeKeyUp, it leads to desynchronization. Although such a situation is not observed, they are removed just in case. Moreover, QKbdState is introduced for automatic key state tracking. Thanks to Konstantin Nazarov for testing and finding a bug in this change: https://gist.github.com/akihikodaki/87df4149e7ca87f18dc56807ec5a1bc5#gistcomment-3659419 Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210310144602.58528-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Do not rely on the first argumentAkihiko Odaki
The first argument of the executable was used to get its path, but it is not reliable because the executer can specify any arbitrary string. Use the interfaces provided by QEMU and the platform to get those paths. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210309122226.23117-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Show QEMU icon in the about windowAkihiko Odaki
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210309122226.23117-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-11ui/cocoa: Use kCGColorSpaceSRGBAkihiko Odaki
kCGColorSpaceGenericRGB | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/kcgcolorspacegenericrgb > Deprecated > Use kCGColorSpaceSRGB instead. This change also removes the legacy color space specification for PowerPC. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210305121304.65096-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-04ui/cocoa: Replace fprintf with error_reportAkihiko Odaki
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210223131106.21166-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-04ui/cocoa: Fix stride resolution of pixman imageAkihiko Odaki
A display can receive an image which its stride is greater than its width. In fact, when a guest requests virtio-gpu to scan out a smaller part of an image, virtio-gpu passes it to a display as an image which its width represents the one of the part and its stride equals to the one of the whole image. This change makes ui/cocoa to cover such cases. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210222144012.21486-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-03ui/cocoa: Remove the uses of full screen APIsAkihiko Odaki
The detections of [NSView -enterFullScreen:] and [NSView -exitFullScreen:] were wrong. A detection is coded as: [NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)] but it should be: [NSView instancesRespondToSelector:@selector(exitFullScreenModeWithOptions:)] Because of those APIs were not detected, ui/cocoa always falled back to a borderless window whose frame matches the screen to implement fullscreen behavior. The code using [NSView -enterFullScreen:] and [NSView -exitFullScreen:] will be used if you fix the detections, but its behavior is undesirable; the full screen view stretches the video, changing the aspect ratio, even if zooming is disabled. This change removes the code as it does nothing good. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210220013138.51437-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-02-19ui/cocoa: Statically allocate dclAkihiko Odaki
There is no need of dynamic allocation as dcl is a small singleton. Static allocation reduces code size and makes hacking with ui/cocoa a bit easier. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210219084419.90181-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-02-19ui/cocoa: Interpret left button down as is when command is pressedAkihiko Odaki
Old Macs were not equipped with mice with an ability to perform "right clicks" and ui/cocoa interpreted left button down with left command key pressed as right button down as a workaround. The workaround has an obvious downside: you cannot tell the guest that the left button is down while the left command key is pressed. Today, Macs has trackpads, Apple Mice, or Magic Mice. They are capable to emulate right clicks with gestures, which also allows to perform right clicks on "BootCamp" OSes like Windows. By removing the workaround, we overcome its downside, and provide a behavior consistent with BootCamp. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210212000706.28616-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-02-19ui/cocoa: Do not copy members of pixman imageAkihiko Odaki
The old CocoaView had an idea of synchronizing the host window configuration and the guest screen configuration. Here, the guest screen actually means pixman image given ui/cocoa display implementation. However, [CocoaView -drawRect:] directly interacts with the pixman image buffer in reality. There is no such distinction of "host" and "guest." This change removes the "host" configuration and let drawRect consistently have the direct reference to pixman image. It allows to get rid of the error-prone "sync" and reduce code size a bit. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210212000629.28551-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-02-19ui/cocoa: Support unique keys of JIS keyboardsAkihiko Odaki
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210212000404.28413-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-12ui/cocoa: Fix openFile: deprecation on Big SurRoman Bolshakov
ui/cocoa.m:1188:44: warning: 'openFile:' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspace openURL:] instead. [-Wdeprecated-declarations] if ([[NSWorkspace sharedWorkspace] openFile: full_file_path] == YES) { ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:350:1: note: 'openFile:' has been explicitly marked deprecated here - (BOOL)openFile:(NSString *)fullPath API_DEPRECATED("Use -[NSWorkspace openURL:] instead.", macos(10.0, 11.0)); ^ Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20210102150718.47618-1-r.bolshakov@yadro.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-12ui/cocoa: Update path to docs in build treeRoman Bolshakov
QEMU documentation can't be opened if QEMU is run from build tree because executables are placed in the top of build tree after conversion to meson. Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reported-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20210108213815.64678-1-r.bolshakov@yadro.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-21qapi: Restrict 'system wakeup/reset/powerdown' commands to machine.jsonPhilippe Mathieu-Daudé
Restricting system_wakeup/system_reset/system_powerdown to machine.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-3-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-07-10cpu-throttle: new module, extracted from cpus.cClaudio Fontana
move the vcpu throttling functionality into its own module. This functionality is not specific to any accelerator, and it is used currently by migration to slow down guests to try to have migrations converge, and by the cocoa MacOS UI to throttle speed. cpu-throttle contains the controls to adjust and inspect throttle settings, start (set) and stop vcpu throttling, and the throttling function itself that is run periodically on vcpus to make them take a nap. Execution of the throttling function on all vcpus is triggered by a timer, registered at module initialization. No functionality change. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20200629093504.3228-3-cfontana@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-06ui/cocoa.m: Update documentation file and pathnamePeter Maydell
We want to stop generating the old qemu-doc.html; first we must update places that refer to it so they instead go to our top level index.html documentation landing page. The Cocoa UI has a menu option to bring up the documentation; make it point to the new top level index.html instead. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20200228153619.9906-31-peter.maydell@linaro.org
2020-02-12ui/cocoa: Drop workarounds for pre-10.12 OSXPeter Maydell
Our official OSX support policy covers the last two released versions. Currently that is 10.14 and 10.15. We also may work on older versions, but don't guarantee it. In commit 50290c002c045280f8d in mid-2019 we introduced some uses of CLOCK_MONOTONIC which incidentally broke compilation for pre-10.12 OSX versions (see LP:1861551). We don't intend to fix that, so we might as well drop the code in ui/cocoa.m which caters for pre-10.12 versions as well. (For reference, 10.11 fell out of Apple extended security support in September 2018.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200201170534.22123-1-peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-12ui/cocoa: switch to new show-cursor optionGerd Hoffmann
Use DisplayOpts settings to set the new file-global cursor_hide variable, stop using the qemu-global cursor_hide variable. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-10-18ui: Fix hanging up Cocoa display on macOS 10.15 (Catalina)Hikaru Nishida
macOS API documentation says that before applicationDidFinishLaunching is called, any events will not be processed. However, some events are fired before it is called in macOS Catalina. This causes deadlock of iothread_lock in handleEvent while it will be released after the app_started_sem is posted. This patch avoids processing events before the app_started_sem is posted to prevent this deadlock. Buglink: https://bugs.launchpad.net/qemu/+bug/1847906 Signed-off-by: Hikaru Nishida <hikarupsp@gmail.com> Message-id: 20191015010734.85229-1-hikarupsp@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-08-21hw/core: Move cpu.c, cpu.h from qom/ to hw/core/Markus Armbruster
Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190709152053.16670-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [Rebased onto merge commit 95a9457fd44; missed instances of qom/cpu.h in comments replaced]
2019-08-16sysemu: Split sysemu/runstate.h off sysemu/sysemu.hMarkus Armbruster
sysemu/sysemu.h is a rather unfocused dumping ground for stuff related to the system-emulator. Evidence: * It's included widely: in my "build everything" tree, changing sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h, down from 5400 due to the previous two commits). * It pulls in more than a dozen additional headers. Split stuff related to run state management into its own header sysemu/runstate.h. Touching sysemu/sysemu.h now recompiles some 850 objects. qemu/uuid.h also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400 to 4200. Touching new sysemu/runstate.h recompiles some 500 objects. Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also add qemu/main-loop.h. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190812052359.30071-30-armbru@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [Unbreak OS-X build]
2019-08-16Include qemu/main-loop.h lessMarkus Armbruster
In my "build everything" tree, changing qemu/main-loop.h triggers a recompile of some 5600 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h). It includes block/aio.h, which in turn includes qemu/event_notifier.h, qemu/notify.h, qemu/processor.h, qemu/qsp.h, qemu/queue.h, qemu/thread-posix.h, qemu/thread.h, qemu/timer.h, and a few more. Include qemu/main-loop.h only where it's needed. Touching it now recompiles only some 1700 objects. For block/aio.h and qemu/event_notifier.h, these numbers drop from 5600 to 2800. For the others, they shrink only slightly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190812052359.30071-21-armbru@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-06-13ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input deviceChen Zhang
In fullscreen mode, the window property of cocoaView may not be the key window, and the current implementation would not re-grab cursor by left click in fullscreen mode after ungrabbed in fullscreen mode with hot-key ctrl-opt-g. This patch used value of isFullscreen as a short-cirtuit condition for relative input device grabbing. Signed-off-by: Chen Zhang <tgfbeta@me.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-06-13ui/cocoa: Fix absolute input device grabbing issue on MojaveChen Zhang
On Mojave, absolute input device, i.e. tablet, had trouble re-grabbing the cursor in re-entry into the virtual screen area. In some cases, the `window` property of NSEvent object was nil after cursor exiting from window, hinting that the `-locationInWindow` method would return value in screen coordinates. The current implementation used raw locations from NSEvent without considering whether the value was for the window coordinates or the macOS screen coordinates, nor the zooming factor for Zoom-to-Fit in fullscreen mode. In fullscreen mode, the fullscreen cocoa window might not be the key window, therefore the location of event in virtual coordinates should suffice. This patches fixed boundary check methods for cursor in normal and fullscreen with/without Zoom-to-Fit in Mojave. Note: CGRect, -convertRectToScreen: and -convertRectFromScreen: were used in coordinates conversion for compatibility reason. Signed-off-by: Chen Zhang <tgfbeta@me.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: FA3FBC4F-5379-4118-B997-58FE05CC58F9@me.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-06-12Include qemu/module.h where needed, drop it from qemu-common.hMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190523143508.25387-4-armbru@redhat.com> [Rebased with conflicts resolved automatically, except for hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c; ui/cocoa.m fixed up]
2019-03-04ui/cocoa: Perform UI operations only on the main threadPeter Maydell
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
2019-03-04ui/cocoa: Subclass NSApplication so we can implement sendEventPeter Maydell
When we switch away from our custom event handling, we still want to be able to have first go at any events our application receives, because in full-screen mode we want to send key events to the guest, even if they would be menu item activation events. There are several ways we could do that, but one simple approach is to subclass NSApplication so we can implement a custom sendEvent method. Do that, but for the moment have our sendEvent just invoke the superclass method. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20190225102433.22401-7-peter.maydell@linaro.org Message-id: 20190214102816.3393-7-peter.maydell@linaro.org
2019-03-04ui/cocoa: Don't call NSApp sendEvent directly from handleEventPeter Maydell
Currently the handleEvent method will directly call the NSApp sendEvent method for any events that we want to let OSX deal with. When we rearrange the event handling code, the way that we say "let OSX have this event" is going to change. Prepare for that by refactoring so that handleEvent returns a flag indicating whether it consumed the event. Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20190225102433.22401-6-peter.maydell@linaro.org Message-id: 20190214102816.3393-6-peter.maydell@linaro.org
2019-03-04ui/cocoa: Move console/device menu creation code up in filePeter Maydell
Move the console/device menu creation code functions further up in the source file, next to the code which creates the initial menus. We're going to want to change the location we call these functions from in the next patch. This commit is a pure code move with no other changes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20190225102433.22401-5-peter.maydell@linaro.org Message-id: 20190214102816.3393-5-peter.maydell@linaro.org
2019-03-04ui/cocoa: Factor out initial menu creationPeter Maydell
Factor out the long code sequence in main() which creates the initial set of menus. This will make later patches which move initialization code around a bit clearer. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20190225102433.22401-4-peter.maydell@linaro.org Message-id: 20190214102816.3393-4-peter.maydell@linaro.org
2019-03-04ui/cocoa: Use the pixman image directly in switchSurfacePeter Maydell
Currently the switchSurface method takes a DisplaySurface. We want to change our DisplayChangeListener's dpy_gfx_switch callback to do this work asynchronously on a different thread. The caller of the switch callback will free the old DisplaySurface immediately the callback returns, so to ensure that the other thread doesn't access freed data we need to switch to using the underlying pixman image instead. The pixman image is reference counted, so we will be able to take a reference to it to avoid it vanishing too early. In this commit we only change the switchSurface method to take a pixman image, and keep the flow of control synchronous for now. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20190225102433.22401-3-peter.maydell@linaro.org Message-id: 20190214102816.3393-3-peter.maydell@linaro.org
2019-03-04ui/cocoa: Ensure we have the iothread lock when calling into QEMUPeter Maydell
The Cocoa UI should run on the main thread; this is enforced in OSX Mojave. In order to be able to run on the main thread, we need to make sure we hold the iothread lock whenever we call into various QEMU UI midlayer functions. 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-2-peter.maydell@linaro.org Message-id: 20190214102816.3393-2-peter.maydell@linaro.org
2019-02-05ui/cocoa.m: Fix macOS 10.14 deprecation warningsBrendan Shanks
macOS 10.14 deprecated NSOnState/NSOffState in favour of NSControlStateValueOn/NSControlStateValueOff. Use the new constants, and #define them to the old ones when compiling against a pre-10.13 SDK. Also [NSGraphicsContext graphicsPort] is now deprecated, use [NSGraphicsContext CGContext] when available. Signed-off-by: Brendan Shanks <brendan@bslabs.net> Message-id: 20190201071225.20576-1-brendan@bslabs.net Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-01-08ui/cocoa: Include less of the generated modular QAPI headersMarkus Armbruster
Avoids pointless recompilation. Missed in commit 112ed241f5d. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-id: 20181220084559.13880-1-armbru@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-24ui/cocoa.m: prevent stuck command key when going into full screen modeJohn Arbuckle
When the user pushes Command-F in QEMU while the mouse is ungrabbed, QEMU goes into full screen mode. When the user finally releases the command key, it is sent to the guest as an event. The makes the guest operating system think the command key is down when it is really up. To prevent this situation from happening, we simply drop the first command key event after the user has gone into full screen mode using Command-F. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180703020017.1032-1-programmingkidx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-12ui/cocoa.m: replace scrollingDeltaY with deltaYJohn Arbuckle
The NSEvent class method scrollingDeltaY is available for Mac OS 10.7 and newer. Since QEMU supports Mac OS 10.5 and up, we need to be using a method that is available on these version of Mac OS X. The deltaY method is a method that does almost the same thing as scrollingDeltaY and is available on Mac OS 10.5 and up. So we can replace scrollingDeltaY with deltaY. We only check deltaY's value if it is not zero because zero means that the scrolling increment was sufficiently fine that it was only reported in scrollingDeltaY, or that the scrolling was horizontal. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180709150235.7573-1-programmingkidx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: tweak commit message and comment a little] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-05-29ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warningPeter Maydell
OSX 10.13 deprecates the NSFileHandlingPanelOKButton constant, and would rather you use NSModalResponseOK, which was introduced in OS 10.9. Use the recommended new constant name, with a backward compatibility define if we're building on an older OSX. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180529181523.19185-1-peter.maydell@linaro.org
2018-03-12Polish the version strings containing the package versionThomas Huth
Since commit 67a1de0d195a there is no space anymore between the version number and the parentheses when running configure with --with-pkgversion=foo : $ qemu-system-s390x --version QEMU emulator version 2.11.50(foo) But the space is included when building without that option when building from a git checkout: $ qemu-system-s390x --version QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty) The same confusion exists with the "query-version" QMP command. Let's fix this by introducing a proper QEMU_FULL_VERSION definition that includes the space and parentheses, while the QEMU_PKGVERSION should just cleanly contain the package version string itself. Note that this also changes the behavior of the "query-version" QMP command (the space and parentheses are not included there anymore), but that's supposed to be OK since the strings there are not meant to be parsed by other tools. Fixes: 67a1de0d195a6185c39b436159c9ffc7720bf979 Buglink: https://bugs.launchpad.net/qemu/+bug/1673373 Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-05Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-request' ↵Peter Maydell
into staging ui: build curses, gtk and sdl as modules. # gpg: Signature made Mon 05 Mar 2018 08:48:24 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20180305-pull-request: ui/sdl: build as module audio: rename CONFIG_* to CONFIG_AUDIO_* ui/curses: build as module ui/gtk: build as module configure: opengl doesn't depend on x11 configure: add X11 vars to config-host.mak console: add ui module loading support console: add and use qemu_display_find_default egl-headless: switch over to new display registry curses: switch over to new display registry cocoa: switch over to new display registry sdl: switch over to new display registry console: add qemu display registry, add gtk Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-03-05cocoa: switch over to new display registryGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180301100547.18962-4-kraxel@redhat.com
2018-03-02qapi: Move qapi-schema.json to qapi/, rename generated filesMarkus Armbruster
Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules. Consistently name the generated files qapi-MODULE.EXT: qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py, scripts/qapi/events.py, and scripts/qapi/common.py. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180211093607.27351-28-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> [eblake: Fix trailing dot in tpm.c, undo temporary hack for OSX toolchain] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-02-20cocoa: use DisplayOptionsGerd Hoffmann
Switch cocoa ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20180202111022.19269-10-kraxel@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-02-09Include qapi/error.h exactly where neededMarkus Armbruster
This cleanup makes the number of objects depending on qapi/error.h drop from 1910 (out of 4743) to 1612 in my "build everything" tree. While there, separate #include from file comment with a blank line, and drop a useless comment on why qemu/osdep.h is included first. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-5-armbru@redhat.com> [Semantic conflict with commit 34e304e975 resolved, OSX breakage fixed]
2018-01-18cocoa.m: Fix scroll wheel supportJohn Arbuckle
When using a mouse's scroll wheel in a guest with the cocoa front-end, the mouse pointer moves up and down instead of scrolling the window. This patch fixes this problem. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180108180707.7976-1-programmingkidx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-11-07ui/cocoa.m: Send ctrl-alt key combos to guest if QEMU isn't using themPeter Maydell
Send those ctrl-alt key combos that QEMU doesn't treat specially to the guest rather than ignoring them. All the case where we do special handling of ctrl-alt-X exit the event handling using a "return" statement, so we can simply allow the rest to fall through into the normal key handling by deleting the now-spurious "else". We take the opportunity to clean up some oddly-formatted and now rather uninformative comments by removing them. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-11-07ui/cocoa.m: move ungrab to ctrl-alt-gJohn Arbuckle
Currently the cocoa user interface relis on the user pushing control-alt to ungrab the mouse. This is patch changes the key combination to control-alt-g to be in line with the GTK user interface. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20171102213907.11443-1-programmingkidx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>