aboutsummaryrefslogtreecommitdiff
path: root/ui
AgeCommit message (Collapse)AuthorFilesLines
2017-02-20egl-helpers: Support newer MESA versionsFrediano Ziglio1-0/+4
According to https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt if MESA_platform_gbm is supported display should be initialized from a GBM handle using eglGetPlatformDisplayEXT. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Message-id: 20170220095055.4234-1-fziglio@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-20spice: allow to specify drm rendernodeMarc-André Lureau2-4/+11
When multiple GPU are available, picking the first one isn't always the best choice. Learn to specify a device rendernode. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170212112118.16044-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-09ui: add ability to specify multiple VNC listen addressesDaniel P. Berrange1-62/+133
This change allows the listen address and websocket address options for -vnc to be repeated. This causes the VNC server to listen on multiple addresses. e.g. $ $QEMU -vnc vnc=localhost:1,vnc=unix:/tmp/vnc,\ websocket=127.0.0.1:8080,websocket=[::]:8081 results in listening on 127.0.0.1:5901, 127.0.0.1:8080, ::1:5901, :::8081 & /tmp/vnc Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-9-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-09ui: let VNC server listen on all resolved IP addressesDaniel P. Berrange1-9/+43
Remove the limitation that the VNC server can only listen on a single resolved IP address. This uses the new DNS resolver API to resolve a SocketAddress struct into an array of SocketAddress structs containing raw IP addresses. The VNC server will then attempt to listen on all resolved IP addresses. The server must successfully listen on at least one of the resolved IP addresses, otherwise an error will be reported. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-7-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-09ui: extract code to connect/listen from vnc_display_openDaniel P. Berrange1-42/+80
The code which takes a SocketAddress and connects/listens on the network is going to get more complicated to deal with multiple listeners. Pull it out into a separate method to avoid making the vnc_display_open method even more complex. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-6-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-09ui: refactor code for populating SocketAddress from vnc_display_openDaniel P. Berrange1-101/+181
The code which interprets the CLI args to populate the SocketAddress objects for plain & websockets VNC is quite complex already and will need further enhancements shortly. Refactor it into separate methods to avoid vnc_display_open getting even larger. As a side effect of the refactoring, it is now possible to specify a listen address for the websocket server explicitly. e.g, -vnc localhost:5900,websockets=0.0.0.0:8080 will listen on localhost for the plain VNC server, but expose the websockets VNC server on the public interface. This refactoring also removes the restriction that prevents enabling websockets when the plain VNC server is listening on a UNIX socket. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-5-berrange@redhat.com [ kraxel: squashed clang build fix ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-08ui: refactor VncDisplay to allow multiple listening socketsDaniel P. Berrange2-40/+73
Currently there is only a single listener for plain VNC and a single listener for websockets VNC. This means that if getaddrinfo() returns multiple IP addresses, for a hostname, the VNC server can only listen on one of them. This is just bearable if listening on wildcard interface, or if the host only has a single network interface to listen on, but if there are multiple NICs and the VNC server needs to listen on 2 or more specific IP addresses, it can't be done. This refactors the VncDisplay state so that it holds an array of listening sockets, but still only listens on one socket. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-4-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-08ui: fix reporting of VNC auth in query-vnc-serversDaniel P. Berrange1-35/+50
Currently the VNC authentication info is emitted at the top level of the query-vnc-servers data. This is wrong because the authentication scheme differs between plain and websockets when TLS is enabled. We should instead report auth against the individual servers. e.g. (QEMU) query-vnc-servers { "return": [ { "clients": [], "id": "default", "auth": "vencrypt", "vencrypt": "x509-vnc", "server": [ { "host": "127.0.0.1" "service": "5901", "websocket": false, "family": "ipv4", "auth": "vencrypt", "vencrypt": "x509-vnc" }, { "host": "127.0.0.1", "service": "5902", "websocket": true, "family": "ipv4", "auth": "vnc" } ] } ] } This also future proofs the QMP schema so that we can cope with multiple VNC server instances, listening on different interfaces or ports, with different auth setup. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-3-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-08ui: fix regression handling bare 'websocket' option to -vncDaniel P. Berrange1-1/+7
The -vnc argument is documented as accepting two syntaxes for the 'websocket' option, either a bare option name, or a port number. If using the bare option name, it is supposed to apply the display number as an offset to base port 5700. e.g. -vnc localhost:3,websocket should listen on port 5703, however, this was broken in 2.3.0 since commit 4db14629c38611061fc19ec6927405923de84f08 Author: Gerd Hoffmann <kraxel@redhat.com> Date: Tue Sep 16 12:33:03 2014 +0200 vnc: switch to QemuOpts, allow multiple servers instead qemu tries to listen on port "on" which gets looked up in /etc/services and fails. Fixes bug: #1455912 Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170203120649.15637-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-08vnc: do not disconnect on EAGAINMichael Tokarev1-1/+2
When qemu vnc server is trying to send large update to clients, there might be a situation when system responds with something like EAGAIN, indicating that there's no system memory to send that much data (depending on the network speed, client and server and what is happening). In this case, something like this happens on qemu side (from strace): sendmsg(16, {msg_name(0)=NULL, msg_iov(1)=[{"\244\"..., 729186}], msg_controllen=0, msg_flags=0}, 0) = 103950 sendmsg(16, {msg_name(0)=NULL, msg_iov(1)=[{"lz\346"..., 1559618}], msg_controllen=0, msg_flags=0}, 0) = -1 EAGAIN sendmsg(-1, {msg_name(0)=NULL, msg_iov(1)=[{"lz\346"..., 1559618}], msg_controllen=0, msg_flags=0}, 0) = -1 EBADF qemu closes the socket before the retry, and obviously it gets EBADF when trying to send to -1. This is because there WAS a special handling for EAGAIN, but now it doesn't work anymore, after commit 04d2529da27db512dcbd5e99d0e26d333f16efcc, because now in all error-like cases we initiate vnc disconnect. This change were introduced in qemu 2.6, and caused numerous grief for many people, resulting in their vnc clients reporting sporadic random disconnects from vnc server. Fix that by doing the disconnect only when necessary, i.e. omitting this very case of EAGAIN. Hopefully the existing condition (comparing with QIO_CHANNEL_ERR_BLOCK) is sufficient, as the original code (before the above commit) were checking for other errno values too. Apparently there's another (semi?)bug exist somewhere here, since the code tries to write to fd# -1, it probably should check if the connection is open before. But this isn't important. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1486115549-9398-1-git-send-email-mjt@msgid.tls.msk.ru Fixes: 04d2529da27db512dcbd5e99d0e26d333f16efcc Cc: Daniel P. Berrange <berrange@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-08ui/vnc: Drop unused vnc_has_job() and vnc_jobs_clear()Peter Maydell2-25/+0
The functions vnc_has_job() and vnc_jobs_clear() are never used; remove them. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Message-id: 1486146260-8092-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-02-02Merge remote-tracking branch 'remotes/elmarco/tags/chr-split-pull-request' ↵Peter Maydell2-16/+3
into staging # gpg: Signature made Tue 31 Jan 2017 19:32:40 GMT # gpg: using RSA key 0xDAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/chr-split-pull-request: (41 commits) char: headers clean-up char: move parallel chardev in its own file char: move serial chardev to its own file char: move pty chardev in its own file char: move pipe chardev in its own file char: move console in its own file char: move stdio in its own file char: move file chardev in its own file char: move udp chardev in its own file char: move socket chardev to its own file char: move win-stdio into its own file char: move win chardev base class in its own file char: move fd chardev in its own file char: move QIOChannel-related stuff to char-io.h char: remove unused READ_RETRIES char: rename and move to header CHR_READ_BUF_LEN char: move ringbuf/memory to its own file char: move mux to its own file char: move null chardev to its own file char: make null_chr_write() the default method ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-01-31console: fix console resizeGerd Hoffmann1-1/+1
Only skip surface reallocation in case the old surface was created using qemu_alloc_display (via qemu_create_displaysurface) too, otherwise we might end up with a DisplaySurface with the wrong backing storage. Cc: 1658634@bugs.launchpad.net Fixes: cd958edb1fae85d0c7d1e1acbff82d22724e8d64 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1485256239-12219-1-git-send-email-kraxel@redhat.com
2017-01-31gtk: Hardcode LC_CTYPE as C.utf-8Kevin Wolf1-1/+5
Commit 2cb5d2a4 removed setlocale() for everything except LC_MESSAGES in order to avoid unwanted side effects such as using the wrong decimal separator in generated JSON objects. However, the problem that unsetting LC_CTYPE caused is that non-ASCII characters are considered non-printable now and therefore the GTK menus display question marks for accented letters, Chinese characters etc. A first attempt to fix this [1] was rejected because even just setting LC_CTYPE to the user's locale (and thereby modifying the semantics of the ctype.h functions) could have unwanted effects that we're not aware of yet. Recently, however, glibc introduced a new locale "C.utf-8" that just uses UTF-8 as its charset, but otherwise leaves the semantics alone. Just setting the right character set is enough for our use case, so we can just hardcode this one without having to be afraid of nasty side effects. Older systems that don't have the new locale will continue displaying question marks, but this should fix the problem for most users. [1] https://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03591.html ('Re: gtk: use setlocale() for LC_MESSAGES only') Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20170131100945.8189-1-kwolf@redhat.com [ kraxel: change C.utf-8 to C.UTF-8 ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31char: remove class kind fieldMarc-André Lureau2-2/+1
The class kind is necessary to lookup the chardev name in qmp_chardev_add() after calling qemu_chr_new_from_opts() and to set the appropriate ChardevBackend (mainly to free the right fields). qemu_chr_new_from_opts() can be changed to use a non-qmp function using the chardev class typename. Introduce qemu_chardev_add() to be called from qemu_chr_new_from_opts() and remove the class chardev kind field. Set the backend->type in the parse callback (when non-common fields are added). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2017-01-31char: get rid of CharDriverMarc-André Lureau2-16/+4
qemu_chr_new_from_opts() is modified to not need CharDriver backend[] array, but uses instead objectified qmp_query_chardev_backends() and char_get_class(). The alias field is moved outside in a ChardevAlias[], similar to QDevAlias for devices. "kind" and "parse" are moved to ChardevClass ("kind" is to be removed next) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2017-01-31vnc: fix overflow in vnc_update_statsGerd Hoffmann1-2/+4
Commit "bea60dd ui/vnc: fix potential memory corruption issues" is incomplete. vnc_update_stats must calculate width and height the same way vnc_refresh_server_surface does it, to make sure we don't use width and height values larger than the qemu vnc server can handle. Commit "e22492d ui/vnc: disable adaptive update calculations if not needed" masks the issue in the default configuration. It triggers only in case the "lossy" option is set to "on" (default is "off"). Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 1485248428-575-1-git-send-email-kraxel@redhat.com
2017-01-31spice: wakeup QXL worker to pick up mouse changesMarc-André Lureau1-0/+2
Without it, server-mode mouse is "slow" to update position: QXL will wait until new display commands come. This is very visible with virtio-gpu. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170130104540.14660-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31ui/gtk.c: add ctrl-alt-= support for zoom in accelerationZiyue Yang1-0/+9
Solving wishlist item at https://bugs.launchpad.net/qemu/+bug/1656710 by accepting Ctrl-Alt-= as an additional zoom-in acceleration. Using gtk_accel_group_connect to support multiple accelerations triggering a single menu item since that gtk_accel_map_add_entry seems to support only one acceleration. A wrapper function gd_accel_zoom_in is added to support gtk_accel_group_connect's callback activities. Signed-off-by: Ziyue Yang <skiver.cloud.yzy@gmail.com> Message-id: 1485826335-15686-1-git-send-email-skiver.cloud.yzy@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31ui: fix format specfier in vnc to avoid break in build.Rami Rosen1-1/+1
When building qemu after setting _VNC_DEBUG to 1 (see ui/vnc.h), we get the following error and the build breaks: ... ui/vnc.c: In function ‘vnc_client_io_error’: ui/vnc.c:1262:13: error: format ‘%d’ expects argument of type ‘int’, but VNC_DEBUG("Closing down client sock: ret %d (%s)\n", ^ cc1: all warnings being treated as errors make: *** [ui/vnc.o] Error 1 ... This patch solves this issue by fixing the print format specifier in vnc_client_io_error() to be %zd, which corresponds to the type of the "ret" variable. Signed-off-by: Rami Rosen <rami.rosen@intel.com> Message-id: 1484039965-25907-1-git-send-email-rami.rosen@intel.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31ui/gtk: Fix mouse wheel on 3.4.0 or laterOGAWA Hirofumi1-0/+13
On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of GDK_SCROLL_UP/DOWN. This fixes it by converting any smooth scroll to up/down. (I.e. without smooth support) Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31vnc: track LED state separatelyPierre Ossman2-44/+18
Piggy-backing on the modifier state array made it difficult to send out updates at the proper times. Signed-off-by: Pierre Ossman <ossman@cendio.se> Message-id: 5aa28297d665cee24ddab26bbf4633e4252f97b6.1483978442.git.ossman@cendio.se Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-31ui: add support for mice with extra/side buttonsFabian Lesniak2-0/+10
Adds input event generation for BTN_SIDE and BTN_EXTRA events to gtk and input-linux methods. Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de> Message-id: 20161206190007.7539-4-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-27chardev: qom-ifyMarc-André Lureau2-48/+65
Turn Chardev into Object. qemu_chr_alloc() is replaced by the qemu_chardev_new() constructor. It will call qemu_char_open() to open/intialize the chardev with the ChardevCommon *backend settings. The CharDriver::create() callback is turned into a ChardevClass::open() which is called from the newly introduced qemu_chardev_open(). "chardev-gdb" and "chardev-hci" are internal chardev and aren't creatable directly with -chardev. Use a new internal flag to disable them. We may want to use TYPE_USER_CREATABLE interface instead, or perhaps allow -chardev usage. Although in general we keep typename and macros private, unless the type is being used by some other file, in this patch, all types and common helper macros for qemu-char.c are in char.h. This is to help transition now (some types must be declared early, while some aren't shared) and when splitting in several units. This is to be improved later. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27vc: use a common prefix for chr callbacksMarc-André Lureau1-12/+12
vc_chr_write() is more appropriate than _puts() since no newline is appended, even though it's not used only as a callback. Keep "qemu_chr_parse" prefix, most chardev parse functions use this prefix atm. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27gtk: overwrite the console.c char driverMarc-André Lureau2-26/+28
Instead of registering a vc handler to allocate the Gtk VC Chardev, overwrite the console.c char driver. A later patch, when switching to QOM, will register a default console vc QOM class if none has been registered before. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27char: rename CharDriverState ChardevMarc-André Lureau2-33/+33
Pick a uniform chardev type name. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27char: allocate CharDriverState as a single objectMarc-André Lureau2-17/+34
Use a single allocation for CharDriverState, this avoids extra allocations & pointers, and is a step towards more object-oriented CharDriver. Gtk console is a bit peculiar, gd_vc_chr_set_echo() used to have a temporary VirtualConsole to save the echo bit. Instead now, we consider whether vcd->console is set or not, and restore the echo bit saved in VCDriverState when calling gd_vc_vte_init(). The casts added are temporary, they are replaced with QOM type-safe macros in a later patch in this series. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27char: move callbacks in CharDriverMarc-André Lureau2-15/+24
This makes the code more declarative, and avoids duplicating the information on all instances. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-27char: use a const CharDriverMarc-André Lureau1-3/+7
No need to allocate & copy fields, let's use static const struct instead. Add an alias field to the CharDriver structure to cover the cases where we previously registered a driver twice under two names. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-23io: change the QIOTask callback signatureDaniel P. Berrange2-9/+12
Currently the QIOTaskFunc signature takes an Object * for the source, and an Error * for any error. We also need to be able to provide a result pointer. Rather than continue to add parameters to QIOTaskFunc, remove the existing ones and simply pass the QIOTask object instead. This has methods to access all the other data items required in the callback impl. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-01-13sdl2: fix build failure on windowsGerd Hoffmann1-0/+6
Cc: Stefan Weil <sw@weilnetz.de> Cc: Samuel Thibault <samuel.thibault@gnu.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Message-id: 1484295285-8809-1-git-send-email-kraxel@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-01-10ps2: Fix lost scancodes by recent changesOGAWA Hirofumi1-0/+3
With "ps2: use QEMU qcodes instead of scancodes", key handling was changed to qcode base. But all scancodes are not converted to new one. This adds some missing qcodes/scancodes what I found in using. [set1 and set3 are from <hpoussin@reactos.org>] Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT)Stefan Weil1-1/+0
For builds with Mingw-w64 as it is included in Cygwin, there are two header files which define KEY_EVENT with different values. This results in lots of compiler warnings like this one: CC vl.o In file included from /qemu/include/ui/console.h:340:0, from /qemu/vl.c:76: /usr/i686-w64-mingw32/sys-root/mingw/include/curses.h:1522:0: warning: "KEY_EVENT" redefined #define KEY_EVENT 0633 /* We were interrupted by an event */ In file included from /usr/share/mingw-w64/include/windows.h:74:0, from /usr/share/mingw-w64/include/winsock2.h:23, from /qemu/include/sysemu/os-win32.h:29, from /qemu/include/qemu/osdep.h:100, from /qemu/vl.c:24: /usr/share/mingw-w64/include/wincon.h:101:0: note: this is the location of the previous definition #define KEY_EVENT 0x1 QEMU only uses the KEY_EVENT macro from wincon.h. Therefore we can undefine the macro coming from curses.h. The explicit include statement for curses.h in ui/curses.c is not needed and was removed. Those two modifications fix the redefinition warnings. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161119185318.10564-1-sw@weilnetz.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10ui/vnc: Fix problem with sending too many bytes as server nameThomas Huth1-2/+6
If the buffer is not big enough, snprintf() does not return the number of bytes that have been written to the buffer, but the number of bytes that would be needed for writing the whole string. By using this value for the following vnc_write() calls, we send some junk at the end of the name in case the qemu_name is longer than 1017 bytes, which could confuse the VNC clients. Fix this by adding an additional size check here. Buglink: https://bugs.launchpad.net/qemu/+bug/1637447 Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1479749115-21932-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10gtk: avoid oob array accessMarc-André Lureau1-0/+5
When too many consoles are created, vcs[] may be write out-of-bounds. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20161207105511.25173-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10egl-helpers: Change file licensing to LGPLv2Frediano Ziglio1-0/+16
The relicense permits sharing the code with Spice which is LGPL. All people listed below have agreed to the relicense: - Arei Gonglei; - Cole Robinson; - Gerd Hoffmann; - Peter Maydell. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Cole Robinson <crobinso@redhat.com> Acked-by: Gonglei <arei.gonglei@huawei.com> Acked-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20161208104539.3045-1-fziglio@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10sdl2: set window IDSamuel Thibault1-0/+7
This uses the console API to record the window ID of the SDL2 windows. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161221003806.22412-4-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10console: move window ID code from baum to sdlSamuel Thibault1-0/+25
This moves the SDL bits for window ID from the baum driver to SDL, as well as fixing the build for non-X11. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161221003806.22412-3-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10console: add API to get underlying gui window IDSamuel Thibault1-0/+11
This adds two console functions, qemu_console_set_window_id and qemu_graphic_console_get_window_id, to let graphical backend record the window id in the QemuConsole structure, and let the baum driver read it. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161221003806.22412-2-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10ui: use evdev keymap when running under waylandDaniel P. Berrange1-0/+7
Wayland always uses evdev as its input source, so QEMU can use the existing evdev keymap data Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Tested-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20161201094117.16407-1-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-01-10ui/gtk: fix crash at startup when no console is availableHervé Poussineau1-1/+5
This patch fixes a segfault at QEMU startup, introduced in a08156321ab9a7d2fed9ee77dbfeea2a61ffd153. gd_vc_find_current() return NULL, which is dereferenced without checking it. While at it, disable the whole 'View' menu if no console exists. Reproducer: qemu-system-i386 -M none -nodefaults Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1483263585-8101-1-git-send-email-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-12-14ui/gtk: fix "Copy" menu item segfaultStefan Hajnoczi1-0/+8
The "Copy" menu item copies VTE terminal text to the clipboard. This only works with VTE terminals, not with graphics consoles. Disable the menu item when the current notebook page isn't a VTE terminal. This patch fixes a segfault. Reproducer: Start QEMU and click the Copy menu item when the guest display is visible. Reported-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20161214142518.10504-1-stefanha@redhat.com Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-10ui/gtk: Fix build with older versions of gtkThomas Huth1-1/+2
GDK_KEY_Delete is only defined with gtk version 2.22 and newer, on older versions this key was called GDK_Delete instead. Since this is the case for all GDK_KEY_* defines, change the already existing preprocessor check there to test for version 2.22, so we know that we can remove this code block in case we require that version as a minimum one day. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1478081328-25515-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-10-28Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into ↵Peter Maydell2-5/+26
staging braille fixes and improvements. curses fix, switch to cursesw. gtk bugfixes. # gpg: Signature made Fri 28 Oct 2016 13:05:12 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # 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/pull-ui-20161028-1: curses: Use cursesw instead of curses curses: fix left/right arrow translation ui/gtk: Fix non-working DELETE key gtk: fix compilation warning with gtk 3.22.2 Defer BrlAPI tty acquisition to when guest starts using device Add dots keypresses support to the baum braille device Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-28Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-2016-10-27-1' ↵Peter Maydell3-0/+11
into staging Merge qio 2016/10/27 v1 # gpg: Signature made Thu 27 Oct 2016 13:54:03 BST # gpg: using RSA key 0xBE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange/tags/pull-qio-2016-10-27-1: main: set names for main loop sources created vnc: set name for all I/O channels created migration: set name for all I/O channels created char: set name for all I/O channels created nbd: set name for all I/O channels created io: add ability to set a name for IO channels io: Add a QIOChannelSocket cleanup test io: set LISTEN flag explicitly for listen sockets io: Introduce a qio_channel_set_feature() helper io: Use qio_channel_has_feature() where applicable io: Fix double shift usages on QIOChannel features Conflicts: qemu-char.c Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-28curses: fix left/right arrow translationSamuel Thibault1-2/+2
In default VGA font, left/right arrow are glyphs 0x1a and 0x1b, not 0x0a and 0x0b. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161015195308.20473-2-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-10-28ui/gtk: Fix non-working DELETE keyThomas Huth1-1/+3
GTK generates key events for the delete key with key->string[0] = 0x7f ... but this does not work right with the readline_handle_byte() function in util/readline.c, since this treats the keycode 127 as backspace. So let's add a special case for the GTK delete key to make this key behave right in the monitor interface of the GTK ui. Buglink: https://bugs.launchpad.net/qemu/+bug/1619438 Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1477570647-7100-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-10-28gtk: fix compilation warning with gtk 3.22.2Alberto Garcia1-2/+21
gdk_screen_get_width() is deprecated since gtk 3.22.2, use gdk_monitor_get_geometry() instead if it's available. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: 20161026152108.12364-1-berto@igalia.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-10-27vnc: set name for all I/O channels createdDaniel P. Berrange3-0/+11
Ensure that all I/O channels created for VNC are given names to distinguish their respective roles. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>