summaryrefslogtreecommitdiffstats
path: root/ui
Commit message (Collapse)AuthorAgeFilesLines
* maint: avoid useless "if (foo) free(foo)" patternDaniel P. Berrange2015-09-111-10/+4
| | | | | | | | | | | | The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* vnc: fix memory corruption (CVE-2015-5225)Gerd Hoffmann2015-08-261-5/+10
| | | | | | | | | | | | | | | | | | | | The _cmp_bytes variable added by commit "bea60dd ui/vnc: fix potential memory corruption issues" can become negative. Result is (possibly exploitable) memory corruption. Reason for that is it uses the stride instead of bytes per scanline to apply limits. For the server surface is is actually fine. vnc creates that itself, there is never any padding and thus scanline length always equals stride. For the guest surface scanline length and stride are typically identical too, but it doesn't has to be that way. So add and use a new variable (guest_ll) for the guest scanline length. Also rename min_stride to line_bytes to make more clear what it actually is. Finally sprinkle in an assert() to make sure we never use a negative _cmp_bytes again. Reported-by: 范祚至(库特) <zuozhi.fzz@alibaba-inc.com> Reviewed-by: P J P <ppandit@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: fix memory leakGonglei2015-07-241-1/+4
| | | | | | | | | | | If vnc's password is configured, it will leak memory which cipher variable pointed on every vnc connection. Cc: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Message-Id: <1437556133-11268-1-git-send-email-arei.gonglei@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vnc: fix vnc client authenticationWolfgang Bumiller2015-07-141-1/+1
| | | | | | | | | | | | Commit 800567a61 updated the code to the generic crypto API and mixed up encrypt and decrypt functions in procotol_client_auth_vnc. (Used to be: deskey(key, EN0) which encrypts, and was changed to qcrypto_cipher_decrypt in 800567a61.) Changed it to qcrypto_cipher_encrypt now. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui: convert VNC to use generic cipher APIDaniel P. Berrange2015-07-081-11/+41
| | | | | | | | | | Switch the VNC server over to use the generic cipher API, this allows it to use the pluggable DES implementations, instead of being hardcoded to use QEMU's built-in impl. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1435770638-25715-11-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* ui: convert VNC websockets to use crypto APIsDaniel P. Berrange2015-07-085-77/+24
| | | | | | | | | | | Remove the direct use of gnutls for hash processing in the websockets code, in favour of using the crypto APIs. This allows the websockets code to be built unconditionally removing countless conditional checks from the VNC code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1435770638-25715-9-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* crypto: move built-in D3DES implementation into crypto/Daniel P. Berrange2015-07-074-466/+2
| | | | | | | | | | | | | | | | To prepare for a generic internal cipher API, move the built-in D3DES implementation into the crypto/ directory. This is not in fact a normal D3DES implementation, it is D3DES with double & triple length modes removed, and the key bytes in reversed bit order. IOW it is crippled specifically for the "benefit" of RFB, so call the new files desrfb.c instead of d3des.c to make it clear that it isn't a generally useful impl. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1435770638-25715-4-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Include monitor/monitor.h exactly where neededMarkus Armbruster2015-06-223-2/+1
| | | | | | | | | In particular, don't include it into headers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* Include qapi/qmp/qerror.h exactly where neededMarkus Armbruster2015-06-221-0/+1
| | | | | | | | | In particular, don't include it into headers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qerror: Move #include out of qerror.hMarkus Armbruster2015-06-223-0/+3
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qerror: Clean up QERR_ macros to expand into a single stringMarkus Armbruster2015-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae. The error class is always ERROR_CLASS_GENERIC_ERROR since the previous commit. Clean up as follows: * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and delete it from the QERR_ macro. No change after preprocessing. * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into error_setg(...). Again, no change after preprocessing. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qerror: Eliminate QERR_DEVICE_NOT_FOUNDMarkus Armbruster2015-06-221-1/+2
| | | | | | | | | | | | | | | | | | Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used in new code. Hiding them in QERR_ macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch: @@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E) Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* QemuOpts: Wean off qerror_report_err()Markus Armbruster2015-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. The only remaining user in qemu-option.c is qemu_opts_parse(). Is it used in QMP context? If not, we can simply replace qerror_report_err() by error_report_err(). The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are clearly not in QMP context. The uses in vl.c aren't either, because the only QMP command handlers there are qmp_query_status() and qmp_query_machines(), and they don't call it. Remaining uses: * drive_def(): Command line -drive and such, HMP drive_add and pci_add * hmp_chardev_add(): HMP chardev-add * monitor_parse_command(): HMP core * tmp_config_parse(): Command line -tpmdev * net_host_device_add(): HMP host_net_add * net_client_parse(): Command line -net and -netdev * qemu_global_option(): Command line -global * vnc_parse_func(): Command line -display, -vnc, default display, HMP change, QMP change. Bummer. * qemu_pci_hot_add_nic(): HMP pci_add * usb_net_init(): Command line -usbdevice, HMP usb_add Propagate errors through qemu_opts_parse(). Create a convenience function qemu_opts_parse_noisily() that passes errors to error_report_err(). Switch all non-QMP users outside tests to it. That leaves vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it to vnc_parse(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* 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>
* Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handlerFam Zheng2015-06-124-20/+17
| | | | | | | | | | | | | | | Done with following Coccinelle semantic patch, plus manual cosmetic changes in net/*.c. @@ expression E1, E2, E3, E4; @@ - qemu_set_fd_handler2(E1, NULL, E2, E3, E4); + qemu_set_fd_handler(E1, E2, E3, E4); Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-8-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-20150611-1' into ↵Peter Maydell2015-06-111-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging sdl2: fix crash in handle_windowevent() when restoring the screen size # gpg: Signature made Thu Jun 11 08:57:38 2015 BST using RSA key ID D3E87138 # 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>" * remotes/kraxel/tags/pull-sdl-20150611-1: sdl2: fix crash in handle_windowevent() when restoring the screen size Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * sdl2: fix crash in handle_windowevent() when restoring the screen sizeAlberto Garcia2015-06-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The Ctrl-Alt-u keyboard shortcut restores the screen to its original size. In the SDL2 UI this is done by destroying the window and creating a new one. The old window emits SDL_WINDOWEVENT_HIDDEN when it's destroyed, but trying to call SDL_GetWindowFromID() from that event's window ID returns a null pointer. handle_windowevent() assumes that the pointer is never null so it results in a crash. Cc: qemu-stable@nongnu.org Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20150611-1' into ↵Peter Maydell2015-06-111-13/+13
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging spice: fix segfault in qemu_spice_create_update, ui_info tweaks. # gpg: Signature made Thu Jun 11 08:48:49 2015 BST using RSA key ID D3E87138 # 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>" * remotes/spice/tags/pull-spice-20150611-1: spice: ui_info tweaks spice-display: fix segfault in qemu_spice_create_update Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | spice: ui_info tweaksGerd Hoffmann2015-06-111-9/+8
| | | | | | | | | | | | | | | | | | | | | Use the new dpy_ui_info_supported function. Clarifies the control flow. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * | spice-display: fix segfault in qemu_spice_create_updateGerd Hoffmann2015-06-111-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although it is pretty unusual the stride for the guest image and the mirror image maintained by spice-display can be different. So use separate variables for them. https://bugzilla.redhat.com/show_bug.cgi?id=1163047 Cc: qemu-stable@nongnu.org Reported-by: perrier vincent <clownix@clownix.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | | gtk: don't exit early in case gtk init failsGerd Hoffmann2015-06-111-1/+12
|/ / | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
* | QemuOpts: Convert qemu_opt_foreach() to ErrorMarkus Armbruster2015-06-091-2/+3
| | | | | | | | | | | | | | | | Retain the function value for now, to permit selective conversion of its callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* | QemuOpts: Drop qemu_opt_foreach() parameter abort_on_failureMarkus Armbruster2015-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the argument is non-zero, qemu_opt_foreach() stops on callback returning non-zero, and returns that value. When the argument is zero, it doesn't stop, and returns the callback's value from the last iteration. The two callers that pass zero could just as well pass one: * qemu_spice_init()'s callback add_channel() either returns zero or exit()s. * config_write_opts()'s callback config_write_opt() always returns zero. Drop the parameter, and always stop. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* | QemuOpts: Convert qemu_opts_foreach() to ErrorMarkus Armbruster2015-06-091-1/+1
|/ | | | | | | | | Retain the function value for now, to permit selective conversion of its callers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
* ui/console: remove dpy_gfx_update_dirtyPaolo Bonzini2015-06-051-61/+0
| | | | | | | | | | | | | | | | dpy_gfx_update_dirty expects DIRTY_MEMORY_VGA logging to be always on, but that will not be the case soon. Because it computes the memory region on the fly for every update (with memory_region_find), it cannot enable/disable logging by itself. We could always treat updates as invalidations if dirty logging is not enabled, assuming that the board will enable logging on the RAM region that includes the framebuffer. However, the function is unused, so just drop it. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150529-1' into ↵Peter Maydell2015-05-294-16/+374
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging gtk: add opengl rendering support. small bugfixes for gtk and opengl ui code. # gpg: Signature made Fri May 29 10:44:54 2015 BST using RSA key ID D3E87138 # 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>" * remotes/kraxel/tags/pull-gtk-20150529-1: gtk: Replace gdk_cursor_new() gtk: add opengl support, using egl ui: add egl-helpers ui: shader.h protect against double inclusion ui: use libexpoxy Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * gtk: Replace gdk_cursor_new()Max Reitz2015-05-291-1/+4
| | | | | | | | | | | | | | | | | | gdk_cursor_new() has been deprecated in GTK 3.16, it is recommended to use gdk_cursor_new_for_display() instead, so do that. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * gtk: add opengl support, using eglGerd Hoffmann2015-05-293-15/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds opengl rendering support to the gtk ui, using egl. It's off by default for now, use 'qemu -display gtk,gl=on' to play with this. Note that gtk got native opengl support with release 3.16. There most likely will be a separate implementation for 3.16+, using the native gtk opengl support. This patch covers older versions (and for the time being 3.16 too, hopefully without rendering quirks). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ui: add egl-helpersGerd Hoffmann2015-05-292-0/+151
| | | | | | | | | | | | | | Add helper functions to initialize OpenGL using egl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* | Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150529-1' ↵Peter Maydell2015-05-292-2/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging kbd: add support for brazilian keyboard (two extra keys). input: add virtio-input devices. # gpg: Signature made Fri May 29 10:09:02 2015 BST using RSA key ID D3E87138 # 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>" * remotes/kraxel/tags/pull-input-20150529-1: virtio-input: emulated devices [device] virtio-input: core code & base class [device] virtio-input: add linux/input.h kbd: add brazil kbd keys to x11 evdev map kbd: add brazil kbd keys to qemu Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | kbd: add brazil kbd keys to x11 evdev mapGerd Hoffmann2015-05-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the two extra brazilian keys to the evdev keymap for X11. This patch gets the two keys going with the vnc, gtk and sdl1 UIs. The SDL2 library complains it doesn't know these keys, so the SDL2 library must be fixed before we can update ui/sdl2-keymap.h Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
| * | kbd: add brazil kbd keys to qemuGerd Hoffmann2015-05-291-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The brazilian computer keyboard layout has two extra keys (compared to the usual 105-key intl ps/2 keyboard). This patch makes these two keys known to qemu. For historic reasons qemu has two ways to specify a key: A QKeyCode (name-based) or a number (ps/2 scancode based). Therefore we have to update multiple places to make new keys known to qemu: (1) The QKeyCode definition in qapi-schema.json (2) The QKeyCode <-> number mapping table in ui/input-keymap.c This patch does just that. With this patch applied you can send those two keys to the guest using the send-key monitor command. Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
* | spice: don't update mm_time when spice-server is stopped.Gerd Hoffmann2015-05-291-0/+1
|/ | | | | | | | | | Skip mm_time updates (in qxl device memory) in case the guest is stopped. Guest isn't able to look anyway, and it causes problems with migration. Also make sure the initial state for spice server is stopped. Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: Tweak error when init failsCole Robinson2015-05-201-2/+1
| | | | | | | | | | | | | | | | Before: qemu-system-x86_64: -display vnc=unix:/root/foo.sock: Failed to start VNC server on `(null)': Failed to bind socket to /root/foo.sock: Permission denied After: qemu-system-x86_64: -display vnc=unix:/root/foo.sock: Failed to start VNC server: Failed to bind socket to /root/foo.sock: Permission denied Rather than tweak the string possibly show unix: value as well, just drop the explicit display reporting. We already get the cli string in the error message, that should be sufficient. Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: Don't assert if opening unix socket failsCole Robinson2015-05-201-0/+3
| | | | | | | | | | | | Reproducer: $ qemu-system-x86_64 -display vnc=unix:/root/i-cant-access-you.sock qemu-system-x86_64: iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed. Aborted (core dumped) Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui: remove check for failure of qemu_acl_init()Daniel P. Berrange2015-05-201-8/+0
| | | | | | | | | | The qemu_acl_init() function has long since stopped being able to return NULL, since g_malloc will abort on OOM. As such the checks for NULL were unreachable code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Strip brackets from vnc hostJán Tomko2015-05-201-1/+8
| | | | | | | | | | | | | | | Commit v2.2.0-1530-ge556032 vnc: switch to inet_listen_opts bypassed the use of inet_parse in inet_listen, making literal IPv6 addresses enclosed in brackets fail: qemu-kvm: -vnc [::1]:0: Failed to start VNC server on `(null)': address resolution failed for [::1]:5900: Name or service not known Strip the brackets to make it work again. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* 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>
* gtk: update mouse position in mouse_set()Gerd Hoffmann2015-05-061-0/+2
| | | | | | | | Without that the next mouse motion event uses the old position as base for relative move calculation, giving wrong results and making your mouse pointer jump around. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: create gtk.hGerd Hoffmann2015-05-061-71/+2
| | | | | | Move various gtk bits (includes, data structures) to a header file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud