summaryrefslogtreecommitdiffstats
path: root/ui/cocoa.m
Commit message (Collapse)AuthorAgeFilesLines
* qapi: Change munging of CamelCase enum valuesEric Blake2019-11-291-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>
* qapi: Don't let implicit enum MAX member collideEric Blake2019-11-291-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>
* ui/cocoa.m: Prevent activation clicks from going to guestPeter Maydell2015-12-011-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
* blockdev: read-only-mode for blockdev-change-mediumMax Reitz2015-11-111-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>
* qmp: Introduce blockdev-change-mediumMax Reitz2015-11-111-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>
* ui/cocoa.m: blinky mouse cursor fixJohn Arbuckle2015-10-161-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>
* ui/cocoa.m: addRemovableDevicesMenuItems() warning fixJohn Arbuckle2015-10-161-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>
* ui/cocoa.m: eliminate normalWindow warningJohn Arbuckle2015-10-131-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>
* ui/cocoa.m: remove open dialog codeJohn Arbuckle2015-09-251-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>
* ui/cocoa.m: prevent stuck key situationJohn Arbuckle2015-09-251-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>
* ui/cocoa.m: verify with user before quitting QEMUJohn Arbuckle2015-09-251-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>
* cocoa: Suppress Cocoa window with -displayRainer Müller2015-09-181-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>
* ui/cocoa.m: Add machine menu items to change and eject removable drive mediaJohn Arbuckle2015-06-191-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>
* ui/cocoa.m: Add Reset and Power Down menu items to Machine menuJohn Arbuckle2015-06-191-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>
* ui/cocoa.m: Add Machine menu with pause and resume menu itemsJohn Arbuckle2015-06-191-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>
* ui/cocoa: Add console items to the View menuProgrammingkid2015-05-191-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>
* ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constantsPeter Maydell2015-05-191-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
* ui/cocoa: Don't use NSWindow useOptimizedDrawing on OSX 10.10 and upPeter Maydell2015-05-191-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
* ui/cocoa: Declare that QemuCocoaAppController implements NSApplicationDelegatePeter Maydell2015-05-191-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
* ui/cocoa: openPanelDidEnd returnCode should be NSInteger, not intPeter Maydell2015-05-191-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
* ui/cocoa: Remove compatibility ifdefs for OSX 10.4Peter Maydell2015-05-191-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
* ui/cocoa: Drop tests for CGImageCreateWithImageInRect supportPeter Maydell2015-05-191-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
* ui/cocoa: Make -full-screen option work on Mac OS XProgrammingkid2015-05-191-0/+6
| | | | | | | | This patch makes the -full-screen option actually instruct QEMU to enter fullscreen at startup, on Mac OS X. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* ui/cocoa: Fix several full screen issues on Mac OS XProgrammingkid2015-05-191-4/+45
| | | | | | | | | | | | | | | | This patch makes several changes: - Minimizes distorted full screen display by respecting aspect ratios. - Makes full screen mode available on Mac OS 10.7 and higher. - Allows user to decide if video should be stretched to fill the screen, using a menu item called "Zoom To Fit". - Hides the normalWindow so it won't show up in full screen mode. - Allows user to exit full screen mode. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> [PMM: minor whitespace tweaks, remove incorrectly duplicated use of 'f' menu accelerator key] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* block: delete cow block driverStefan Hajnoczi2014-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes support for the cow file format. Normally we do not break backwards compatibility but in this case there is no impact and it is the most logical option. Extraordinary claims require extraordinary evidence so I will show why removing the cow block driver is the right thing to do. The cow file format is the disk image format for Usermode Linux, a way of running a Linux system in userspace. The performance of UML was never great and it was hacky, but it enjoyed some popularity before hardware virtualization support became mainstream. QEMU's block/cow.c is supposed to read this image file format. Unfortunately the file format was underspecified: 1. Earlier Linux versions used the MAXPATHLEN constant for the backing filename field. The value of MAXPATHLEN can change, so Linux switched to a 4096 literal but QEMU has a 1024 literal. 2. Padding was not used on the header struct (both in the Linux kernel and in QEMU) so the struct layout varied across architectures. In particular, i386 and x86_64 were different due to int64_t alignment differences. Linux now uses __attribute__((packed)), QEMU does not. Therefore: 1. QEMU cow images do not conform to the Linux cow image file format. 2. cow images cannot be shared between different host architectures. This means QEMU cow images are useless and QEMU has not had bug reports from users actually hitting these issues. Let's get rid of this thing, it serves no purpose and no one will be affected. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* ui/cocoa: Honour -show-cursor command line optionPeter Maydell2014-06-291-2/+18
| | | | | | | | Honour the -show-cursor command line option (which forces the mouse pointer to always be displayed even when input is grabbed) in the Cocoa UI backend. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1403516125-14568-5-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Fix handling of absolute positioning devicesPeter Maydell2014-06-291-29/+46
| | | | | | | | | | | | | | | | | | | | | | Fix handling of absolute positioning devices, which were basically unusable for two separate reasons: (1) as soon as you pressed the left mouse button we would call CGAssociateMouseAndMouseCursorPosition(FALSE), which means that the absolute coordinates of the mouse events are never updated (2) we didn't account for MacOSX coordinate origin being bottom left rather than top right, and so all the Y values sent to the guest were inverted We fix (1) by aligning our behaviour with the SDL UI backend for absolute devices: * when the mouse moves into the window we do a grab (which means hiding the host cursor and sending special keys to the guest) * when the mouse moves out of the window we un-grab and fix (2) by doing the correct transformation in the call to qemu_input_queue_abs(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1403516125-14568-4-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Add utility method to check if point is within windowPeter Maydell2014-06-291-2/+7
| | | | | | | | | Add a utility method to check whether a point is within the current window bounds, and use it in the various places in the mouse handling code that were opencoding the check. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1403516125-14568-3-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Cope with first surface being same as initial window sizePeter Maydell2014-06-291-1/+5
| | | | | | | | | | | | Do the recalculation of the content dimensions in switchSurface if the current cdx is zero as well as if the new surface is a different size to the current window. This catches the case where the first surface registered happens to be 640x480 (our current window size), and fixes a bug where we would always display a black screen until the first surface of a different size was registered. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1403516125-14568-2-git-send-email-peter.maydell@linaro.org
* input: mouse: switch cocoa ui to new coreGerd Hoffmann2014-03-051-21/+42
| | | | | | Build fixes by Peter Maydell. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* input: keyboard: switch cocoa ui to new coreGerd Hoffmann2014-03-051-12/+6
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui/cocoa: Remove stray tabsPeter Maydell2014-01-121-3/+3
| | | | | | | | The ui/cocoa.m file has just three lines with hardcoded tabs; fix them. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Message-id: 1387886052-27067-1-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Draw black rectangle if we have no data yetPeter Maydell2014-01-121-1/+6
| | | | | | | | | | If our redraw method is called before we have any data from the guest, then draw a black rectangle rather than leaving the window empty. This mostly only matters when the guest machine has no framebuffer device, but it is more in line with the behaviour of other QEMU UIs. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1387853507-26298-3-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Redraw at correct size when switching surfacePeter Maydell2014-01-121-7/+17
| | | | | | | | | | | | | | | | | | | | | If the surface switch involved a resize, we were doing the redraw at the old size rather than the new, because the update of screen.width and screen.height was being done after the setFrame method calls which triggered a redraw. Normally this isn't very noticeable because typically after the guest triggers the window resize it also draws something to it, which will in turn cause us to redraw. However, the combination of a guest which never draws to the display and a command line setting of a screen size larger than the default can reveal odd effects. Move most of the handling of resizes to the top of the method, and guard it with a check that the surface size actually changed, to avoid unnecessary operations (including some user visible ones like "recenter the window on the screen") if the surface is the same size as the old one. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1387853507-26298-2-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Fix code for starting QEMU via image file load dialogPeter Maydell2014-01-121-6/+6
| | | | | | | | | | | | | | | | Fix a number of bugs in the code for starting QEMU via the image file load dialog: * use the actual argv[0] rather than "qemu": this avoids failures to find BIOS image files caused by not looking in the correct directory relative to the executable path * allocate a large enough argv array to NULL terminate it * use g_strdup(X) rather than g_strdup_printf("%s", X) or g_strdup_printf(X) * disable the printing of the simulated command line argument (which is presumably intended for debug only) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1386543546-31919-6-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Add ".qcow2" to extension list for image load dialogPeter Maydell2014-01-121-1/+1
| | | | | | | | | Add ".qcow2" to the list of file extensions which are accepted by the initial disk image load dialog which is displayed if the user runs QEMU without any command line arguments. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1386543546-31919-5-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Send warning message to stderr, not stdoutPeter Maydell2014-01-121-1/+1
| | | | | | | | Bring a warning message into line with the others in this file by sending it to stderr, not stdout. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1386543546-31919-4-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Correct typos in comments and variable namesPeter Maydell2014-01-121-14/+14
| | | | | | | | Fix various non-user-visible typos in comments and variable names. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Message-id: 1386543546-31919-3-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Pass command key through to guest when VM has mousegrabPeter Maydell2014-01-121-7/+18
| | | | | | | | | | | | | | | | The guest might want to be able to use the command key for its won purposes (as command if it is MacOS X, or for the Windows key if it is a PC guest, for instance). In line with other UI frontends, pass it through if the guest has mousegrab, and only use it for UI menu accelerators if not grabbed. Thanks to John Arbuckle for reporting this problem, helping us work through what the best solution would be and providing a patch which was the initial inspiration for this one. Reported-by: John Arbuckle <programmingkidx@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1386543546-31919-2-git-send-email-peter.maydell@linaro.org
* ui/cocoa: Use macro ARRAY_SIZE where possibleStefan Weil2013-12-231-3/+2
| | | | | | | | | | This improves readability and simplifies the code. Cc: Andreas Färber <andreas.faerber@web.de> Cc: Anthony Liguori <aliguori@amazon.com> 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>
* cocoa: Avoid deprecated NSOpenPanel beginSheetForDirectoryPeter Maydell2013-05-291-1/+15
| | | | | | | | | | In MacOSX 10.6 and above the NSOpenPanel beginSheetForDirectory method is deprecated. Use the preferred replacements instead. We retain the original code for use on earlier MacOSX versions because the replacement methods don't exist before 10.6. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
* cocoa: Avoid deprecated NSOpenPanel filename methodPeter Maydell2013-05-291-1/+1
| | | | | | | | | Avoid the NSOpenPanel filename method (deprecated in MacOSX 10.6) in favour of using the URL method and extracting the path from the resulting NSUrl object. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
* cocoa: Avoid deprecated CPS* functionsPeter Maydell2013-05-291-17/+6
| | | | | | | | | | | | | The functions CPSGetCurrentProcess and CPSEnableForegroundOperation are deprecated in newer versions of MacOSX and cause warning messages to be logged to the system log. Instead, use the new preferred method of promoting our console process up to a graphical app with menubar and Dock icon, which is TransformProcessType. (This function came in with MacOSX 10.3, so there's no need to retain the old method as we don't support anything earlier than 10.3 anyway.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
* cocoa: Fix leaks of NSScreen and NSConcreteMapTablePeter Maydell2013-05-291-1/+10
| | | | | | | | | | | | | | | | | | | | | On MacOSX 10.8 QEMU provokes system log messages: 11/03/2013 17:03:29.998 qemu-system-arm[42586]: objc[42586]: Object 0x7ffbf9c2f3b0 of class NSScreen autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug 11/03/2013 17:03:29.999 qemu-system-arm[42586]: objc[42586]: Object 0x7ffbf9c3a010 of class NSConcreteMapTable autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug This is because we call back into Cocoa from threads other than the UI thread (specifically from the CPU thread). Since we created these threads via the POSIX API rather than NSThread, they don't have automatically created autorelease pools. Guard all the functions where QEMU can call back into the Cocoa UI code with autorelease pools so that we don't leak any Cocoa objects. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
* console: zap ds arg from register_displaychangelistenerGerd Hoffmann2013-04-251-1/+1
| | | | | | | We don't have multiple DisplayStates any more, so passing it in as argument is not needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui/cocoa.m: Fix recent compile breakagePeter Maydell2013-04-211-4/+4
| | | | | | | | | | Fix failures to compile introduced by recent console commits 1dbfa00503, 81c0d5a6) which removed is_graphic_console() and vga_hw_update() without updating the cocoa UI backend to match. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* ui/cocoa.m: Fix compile failures introduced by recent console changesPeter Maydell2013-03-191-3/+6
| | | | | | | | | Fix various compilation failures introduced by the recent console changes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1363638501-29603-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* console: zap displaystate from dcl callbacksGerd Hoffmann2013-03-181-4/+1
| | | | | | | Now that nobody depends on DisplayState in DisplayChangeListener callbacks any more we can remove the parameter from all callbacks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* cocoa: stop using DisplayStateGerd Hoffmann2013-03-181-25/+10
| | | | | | | Rework DisplayStateListener callbacks to not use the DisplayState any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: rework DisplaySurface handling [dcl/ui side]Gerd Hoffmann2013-03-181-9/+4
| | | | | | | | Replace the dpy_gfx_resize and dpy_gfx_setdata DisplayChangeListener callbacks with a dpy_gfx_switch callback which notifies the ui code when the framebuffer backing storage changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud