summaryrefslogtreecommitdiff
path: root/ui/cocoa.m
AgeCommit message (Collapse)AuthorFilesLines
2018-03-12Polish the version strings containing the package versionThomas Huth1-1/+1
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 Maydell1-1/+13
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 Hoffmann1-1/+13
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 Armbruster1-1/+1
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 Hoffmann1-2/+2
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 Armbruster1-0/+1
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 Arbuckle1-8/+19
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 Maydell1-4/+2
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 Arbuckle1-13/+18
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>
2017-11-07ui/cocoa.m: Make scrolling work again in GUI monitor windowsJohn Arbuckle1-32/+66
Make scrolling in the monitor work, by correctly passing through control+key combinations. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20171101154607.1582-1-programmingkidx@gmail.com [PMM: fixed coding style nits; cleaned up commit message] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-11-02ui/cocoa.m: Fix console selection keysJohn Arbuckle1-1/+1
Fix console selection keys so that the right console is selected. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20171005190449.15591-1-programmingkidx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-06-29ui/cocoa.m: Fix compatibility issue with Mac OS 10.9 and underJohn Arbuckle1-1/+1
The [NSEvent modifierFlags] method returns an NSEventModifierFlags type value in Mac OS 10.10. It use to be of type NSUInteger. Replacing NSEventModifierFlags with NSUInteger allows for the cooca.m file to be compiled on older versions of Mac OS. This patch was been tested on Mac OS 10.6 and Mac OS 10.12 without problem. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: F6C36C1A-4661-48F4-BEA6-3994889927D0@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-06-23ui/cocoa.m: add Speed menuJohn Arbuckle1-0/+56
Programs running inside of QEMU can sometimes use more CPU time than is really needed. To solve this problem, we just need to throttle the virtual CPU. This feature will stop laptops from burning up. This patch adds a menu called Speed that has menu items from 100% to 1% that represent the speed options. 100% is full speed and 1% is slowest. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: D6FAAABF-064D-49C0-B572-C73679F34052@gmail.com [PMM: Moved "mark 100% menu item as checked initially" code to after menu item is allocated, not before it] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-06-14Improve Cocoa modifier key handlingIan McKellar via Qemu-devel1-12/+48
I had two problems with QEMU on macOS: 1) Sometimes when alt-tabbing to QEMU it would act as if the 'a' key was pressed so I'd get 'aaaaaaaaa....'. 2) Using Sikuli to programatically send keys to the QEMU window text like "foo_bar" would come out as "fooa-bar". They looked similar and after much digging the problem turned out to be the same. When QEMU's ui/cocoa.m received an NSFlagsChanged NSEvent it looked at the keyCode to determine what modifier key changed. This usually works fine but sometimes the keyCode is 0 and the app should instead be looking at the modifierFlags bitmask. Key code 0 is the 'a' key. I added code that handles keyCode == 0 differently. It checks the modifierFlags and if they differ from QEMU's idea of which modifier keys are currently pressed it toggles those changed keys. This fixes my problems and seems work fine. Signed-off-by: Ian McKellar <ianloic@google.com> Message-id: 20170526233816.47627-1-ianloic@google.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-05-23shutdown: Add source information to SHUTDOWN and RESETEric Blake1-1/+1
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch. It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers. Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests. Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts] Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part] Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts] Message-Id: <20170515214114.15442-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-05-11ui: Support non-zero minimum values for absolute input axesPhilippe Voinov1-2/+2
This patch refactors ui/input.c to support absolute axis minimum values other than 0. All dependent calls to qemu_input_queue_abs have been updated to explicitly supply 0 as the axis minimum value. Signed-off-by: Philippe Voinov <philippevoinov@gmail.com> Message-id: 20170505133952.29885-1-philippevoinov@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-04-25ui/cocoa.m: Fix macOS 10.12 deprecation warningsBrendan Shanks1-29/+58
macOS 10.12 deprecated/replaced many AppKit constants to make naming more consistent. Use the new constants, and #define them to the old constants when compiling against a pre-10.12 SDK. Signed-off-by: Brendan Shanks <brendan@bslabs.net> Message-id: 20170425062952.99149-1-brendan@bslabs.net Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-03-14ui/cocoa.m: add toast file supportProgrammingkid1-1/+1
Add the ability for the user to use .toast files with QEMU. This format works just like ISO files. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 0C9DA454-E3DC-4291-806E-9A96557DE833@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-07qemu-doc: merge qemu-tech and qemu-docPaolo Bonzini1-9/+0
Merge what is left of qemu-tech into the main manual as an appendix. Ultimately we should have a new internals manual built from docs/, and then the "Translator Internals" parts of qemu-tech could move to docs/ as well. The bits on limitation and features of CPU emulation should remain in qemu-doc. Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-23block: Accept device model name for blockdev-change-mediumKevin Wolf1-1/+3
In order to remove the need for BlockBackend names in the external API, we want to allow qdev device names in all device related commands. This converts blockdev-change-medium to accept a qdev device name. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-09-23block: Accept device model name for ejectKevin Wolf1-1/+2
In order to remove the need for BlockBackend names in the external API, we want to allow qdev device names in all device related commands. This converts eject to accept a qdev device name. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-09-15ui/cocoa.m: Make a better about dialogProgrammingkid1-3/+104
The about dialog in QEMU on Mac OS X is very plain and unhelpful. This patch makes the about dialog look a lot better and have some descriptive information on what version of QEMU the user is running. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: ED59936E-3EB2-46AB-9E33-AB26E382B884@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-05-18Fix some typos found by codespellStefan Weil1-1/+1
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-04-04ui/cocoa.m: Add support for cdr filesJohn Arbuckle1-1/+2
Allow the user to select .cdr files in the file open dialog. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 32C964D4-3F17-47B7-AE7E-593E6BFD8855@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-23ui/cocoa.m: switch to QKeyCodeJohn Arbuckle1-176/+141
This patch removes the pc/xt keycode map and replaces it with the QKeyCode keymap. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-23ui/cocoa.m: fix help menusJohn Arbuckle1-4/+27
Make the help menus actually work. The code will search thru three different locations for the help file. If it can't be found a dialog will tell the user the file can't be found. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: F6B689F9-4DBD-4C50-BC38-35E5DD03D396@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-01qapi: rename input buttonsGerd Hoffmann1-2/+2
All lowercase, use-dash instead of CamelCase. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-08ui/cocoa.m: Include qemu/osdep.hPeter Maydell1-0/+2
Include "qemu/osdep.h". (This is a manual commit equivalent to what the clean-includes script would do, because that script can't handle ObjectiveC source files.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454084614-5365-1-git-send-email-peter.maydell@linaro.org
2015-12-17qapi: Change munging of CamelCase enum valuesEric Blake1-2/+2
When munging enum values, the fact that we were passing the entire prefix + value through camel_to_upper() meant that enum values spelled with CamelCase could be turned into CAMEL_CASE. However, this provides a potential collision (both OneTwo and One-Two would munge into ONE_TWO) for enum types, when the same two names are valid side-by-side as QAPI member names. By changing the generation of enum constants to always be prefix + '_' + c_name(value, False).upper(), and ensuring that there are no case collisions (in the next patches), we no longer have to worry about names that would be distinct as QAPI members but collide as variant tag names, without having to think about what munging the heuristics in camel_to_upper() will actually perform on an enum value. Making the change will affect enums that did not follow coding conventions, using 'CamelCase' rather than desired 'lower-case'. Thankfully, there are only two culprits: InputButton and ErrorClass. We already tweaked ErrorClass to make it an alias of QapiErrorClass, where only the alias needs changing rather than the whole tree. So the bulk of this change is modifying INPUT_BUTTON_WHEEL_UP to the new INPUT_BUTTON_WHEELUP (and likewise for WHEELDOWN). That part of this commit may later need reverting if we rename the enum constants from 'WheelUp' to 'wheel-up' as part of moving x-input-send-event to a stable interface; but at least we have documentation bread crumbs in place to remind us (commit 513e7cd), and it matches the fact that SDL constants are also spelled SDL_BUTTON_WHEELUP. Suggested by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-27-git-send-email-eblake@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-17qapi: Don't let implicit enum MAX member collideEric Blake1-1/+1
Now that we guarantee the user doesn't have any enum values beginning with a single underscore, we can use that for our own purposes. Renaming ENUM_MAX to ENUM__MAX makes it obvious that the sentinel is generated. This patch was mostly generated by applying a temporary patch: |diff --git a/scripts/qapi.py b/scripts/qapi.py |index e6d014b..b862ec9 100644 |--- a/scripts/qapi.py |+++ b/scripts/qapi.py |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = { | max_index = c_enum_const(name, 'MAX', prefix) | ret += mcgen(''' | [%(max_index)s] = NULL, |+// %(max_index)s | }; | ''', | max_index=max_index) then running: $ cat qapi-{types,event}.c tests/test-qapi-types.c | sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list $ git grep -l _MAX | xargs sed -i -f list The only things not generated are the changes in scripts/qapi.py. Rejecting enum members named 'MAX' is now useless, and will be dropped in the next patch. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> [Rebased to current master, commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-01ui/cocoa.m: Prevent activation clicks from going to guestPeter Maydell1-1/+9
When QEMU is brought to the foreground, the click event that activates QEMU should not go to the guest. Accidents happen when they do go to the guest without giving the user a chance to handle them. In particular, if the guest input device is not an absolute-position one then the location of the guest cursor (and thus the click) will likely not be the location of the host cursor when it is clicked, and could be completely obscured below another window. Don't send mouse clicks to QEMU unless the window either has focus or has grabbed mouse events. Reported-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 1448551168-13196-1-git-send-email-peter.maydell@linaro.org
2015-11-11blockdev: read-only-mode for blockdev-change-mediumMax Reitz1-0/+1
Add an option to qmp_blockdev_change_medium() which allows changing the read-only status of the block device whose medium is changed. Some drives do not have a inherently fixed read-only status; for instance, floppy disks can be set read-only or writable independently of the drive. Some users may find it useful to be able to therefore change the read-only status of a block device when changing the medium. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-11qmp: Introduce blockdev-change-mediumMax Reitz1-4/+6
Introduce a new QMP command 'blockdev-change-medium' which is intended to replace the 'change' command for block devices. The existing function qmp_change_blockdev() is accordingly renamed to qmp_blockdev_change_medium(). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-16ui/cocoa.m: blinky mouse cursor fixJohn Arbuckle1-1/+1
The mouse cursor can become blinky when being moved a lot. This patch fixes that problem by issuing the redraw sooner. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: AAA87DD7-EC20-4F4B-B71E-C38461D9FCBA@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-16ui/cocoa.m: addRemovableDevicesMenuItems() warning fixJohn Arbuckle1-1/+1
Eliminate this warning associated with the addRemovableDevicesMenuItems() function: ui/cocoa.m:1344:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] static void addRemovableDevicesMenuItems() ^ ui/cocoa.m: In function 'addRemovableDevicesMenuItems': ui/cocoa.m:1344:13: warning: old-style function definition [-Wold-style-definition] Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 7B365FC2-072B-4E8D-A1D9-922C2D691A83@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-13ui/cocoa.m: eliminate normalWindow warningJohn Arbuckle1-1/+1
Eliminate this warning associated with the setting of the normalWindow's title: ui/cocoa.m: In function '-[QemuCocoaAppController init]': ui/cocoa.m:888:9: warning: format not a string literal and no format arguments [-Wformat-security] [normalWindow setTitle:[NSString stringWithFormat:@"QEMU"]]; Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 57057D6E-C108-4AE1-8370-E7E6855B2F2C@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-25ui/cocoa.m: remove open dialog codeJohn Arbuckle1-54/+2
Removes the open dialog code that runs when no arguments are supplied with QEMU. Not everyone needs a hard drive or cdrom to boot their target. A user might only need to use their target's bios to do work. With that said, this patch removes the unneeded open dialog code. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 33856864-321C-4367-9170-FB0BF81E789B@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-25ui/cocoa.m: prevent stuck key situationJohn Arbuckle1-0/+26
When the user puts QEMU in the background while holding down a key, QEMU will not receive the keyup event when the user lets go of the key. When the user goes back to QEMU, QEMU will think the key is still down causing stuck key symptoms. This patch fixes this problem by releasing all down keys when QEMU goes into the background. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 7A3FA6EE-84C8-4422-A786-C899B7229D32@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-25ui/cocoa.m: verify with user before quitting QEMUJohn Arbuckle1-1/+38
This patch prevents the user from accidentally quitting QEMU by pushing Command-Q or by pushing the close button on the main window. When the user does one of these two things, a dialog box appears verifying with the user if he or she wants to quit QEMU. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 29169A74-0347-47F5-934F-A5AD24C225CA@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-18cocoa: Suppress Cocoa window with -displayRainer Müller1-0/+1
Do not open a Cocoa window when another display is selected that will be initialized later. The Cocoa display cannot be selected with -display, so there is no need to check its argument. Signed-off-by: Rainer Müller <raimue@codingfarm.de> Reviewed-by: Andreas Färber <andreas.faerber@web.de> Message-id: 1441807710-25431-1-git-send-email-raimue@codingfarm.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-19ui/cocoa.m: Add machine menu items to change and eject removable drive mediaJohn Arbuckle1-3/+153
Adds all removable devices to the Machine menu as a Change and Eject menu item pair. ide-cd0 would have a "Change ide-cd0..." and "Eject ide-cd0" menu items. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-19ui/cocoa.m: Add Reset and Power Down menu items to Machine menuJohn Arbuckle1-0/+17
Add "Reset" and "Power Down" menu items to Machine menu. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-19ui/cocoa.m: Add Machine menu with pause and resume menu itemsJohn Arbuckle1-0/+67
Add Machine menu to the Macintosh interface with pause and resume menu items. These items can either pause or resume execution of the guest operating system. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 6D7AE6AA-0595-4FAD-AACF-9DFAB87248F0@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-19ui/cocoa: Add console items to the View menuProgrammingkid1-1/+38
Add any console that is available to the current emulator as a menu item under the View menu. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> [PMM: Adjusted to apply after zoom-to-fit menu item was added; create the View menu at the same time as all the others, and only add the dynamically-determined items to it later] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-19ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constantsPeter Maydell1-2/+8
In OSX 10.10, the NSOKButton and NSCancelButton constants are deprecated and provoke compiler warnings. Avoid them by using the NSFileHandlingPanelCancelButton and NSFileHandlingPanelOKButton constants instead. These are the documented correct constants for the 10.6-and-up beginSheetModalForWindow API we use. We also use the same method for the pre-10.6 compatibility code path, but conveniently the constant values are the same and the constant names have been present since 10.0. Preferring the constant names that match the non-legacy API makes more sense anyway. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-7-git-send-email-peter.maydell@linaro.org
2015-05-19ui/cocoa: Don't use NSWindow useOptimizedDrawing on OSX 10.10 and upPeter Maydell1-0/+5
Starting in OSX 10.10, NSWindow useOptimizedDrawing is deprecated, so don't use it there. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-6-git-send-email-peter.maydell@linaro.org
2015-05-19ui/cocoa: Declare that QemuCocoaAppController implements NSApplicationDelegatePeter Maydell1-0/+3
Our class QemuCocoaAppController implements the NSApplicationDelegate interface, and we pass an object of this class to [NSApp setDelegate]. However, we weren't declaring in the class definition that we implemented this interface; in OSX 10.10 this provokes the following (slighly misleading) warning: ui/cocoa.m:1031:24: warning: sending 'QemuCocoaAppController *' to parameter of incompatible type 'id<NSFileManagerDelegate>' [NSApp setDelegate:appController]; ^~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47: note: passing argument to parameter 'delegate' here @property (assign) id <NSFileManagerDelegate> delegate NS_AVAILABLE(10_5, 2_0); ^ Annoyingly, this interface wasn't formally defined until OSX 10.6, so we have to surround the relevant part of the @interface line with an ifdef. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-5-git-send-email-peter.maydell@linaro.org
2015-05-19ui/cocoa: openPanelDidEnd returnCode should be NSInteger, not intPeter Maydell1-2/+2
The type for openPanelDidEnd's returnCode argument should be NSInteger, not int. This only matters for the OSX 10.5 code path where we pass the method directly to an OSX function to call. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-4-git-send-email-peter.maydell@linaro.org
2015-05-19ui/cocoa: Remove compatibility ifdefs for OSX 10.4Peter Maydell1-17/+0
Remove compatibility ifdefs that work around OSX 10.4 not providing various typedefs and functions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-3-git-send-email-peter.maydell@linaro.org
2015-05-19ui/cocoa: Drop tests for CGImageCreateWithImageInRect supportPeter Maydell1-30/+20
The code that tries to test at both compiletime and runtime for whether CGImageCreateWithImageInRect is supported provokes a compile warning on OSX 10.3: ui/cocoa.m:378:13: warning: comparison of function 'CGImageCreateWithImageInRect' equal to a null pointer is always false[-Wtautological-pointer-compare] if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ The simplest way to deal with this is just to drop this code, since we don't in practice support OSX 10.4 anyway. (10.5 was released in 2007 and is the last PPC version, so is the earliest we really need to continue to support at all.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1431296361-16981-2-git-send-email-peter.maydell@linaro.org