gtk,vnc: misc bugfixes.

kbd: add jp keys, fix ps2 regressions.
 sdl: export window id for baum, remove sdl hooks from baum.
 egl: egl-helpers.c license change.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYdIo1AAoJEEy22O7T6HE4Y+sP/275gPar5CN4wSCXacDbygfu
 GeJSDajJc25Hby7tXGuPKNLZ28KXtYcFlhbIq8eHGRfde4MuCke73lMQoNipsRPM
 1D5EKZvPAMGxu5xNIxk4X9JmHmL8JoNjopWY8hdBabtoqYV/BcHZa9INDC08UC0C
 aoP5pjqebXbYLdzASojYanwL7I1uPVZAUMoQCxO/FAEVbAtRryA0ust+EU5GQ9/9
 CTlHWiqDgAVTIRHemZTSXA0/qj6JWxypkvf4+AH45Yq0iJtD6K6uIc/C4xvVQ6RV
 r1Hu2mUj7jujSD607BYW9OQWHH9NCpT3J/QBc7p7BK79wHdi2hqJIPBVE2v7r/9X
 KQoh3ViURCgq0Gbrtd5NgLPajasx9/8pmpEeU5IcW+em3v8qAH3tOgVWG5qpoxzk
 Rh5BOV5jKSZVA/qaIJNGoH2JOdARvA/yYfrRRW8jbeCD6w2+s5QhXGEq47XMAwuu
 5wHcrjNMdrmT2BB6j6EOwiFcWjKy9RKiLxBkQzwNyNv7CzBHut12X//SJAPlPu+s
 7iSO1iSKcpA7gCwqhHiKStMvbfcGB832LCkWVZku/yyN/df5UoNvWtgue7SFspFQ
 7BamoXXPBlkH3t0O0e3GjAjRnSMJwuaJaw+O5HFf0fdWVRKZ+MmHloEWKxnTcLoU
 ou/35w41MqhEkWvbfumE
 =92LQ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20170110-1' into staging

gtk,vnc: misc bugfixes.
kbd: add jp keys, fix ps2 regressions.
sdl: export window id for baum, remove sdl hooks from baum.
egl: egl-helpers.c license change.

# gpg: Signature made Tue 10 Jan 2017 07:16:05 GMT
# 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-20170110-1:
  ps2: Fix lost scancodes by recent changes
  curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT)
  ui/vnc: Fix problem with sending too many bytes as server name
  gtk: avoid oob array access
  egl-helpers: Change file licensing to LGPLv2
  sdl2: set window ID
  console: move window ID code from baum to sdl
  console: add API to get underlying gui window ID
  ui: use evdev keymap when running under wayland
  ui/gtk: fix crash at startup when no console is available

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-01-10 14:52:34 +00:00
commit b44486dfb9
13 changed files with 119 additions and 28 deletions

View File

@ -27,12 +27,10 @@
#include "sysemu/char.h"
#include "qemu/timer.h"
#include "hw/usb.h"
#include "ui/console.h"
#include <brlapi.h>
#include <brlapi_constants.h>
#include <brlapi_keycodes.h>
#ifdef CONFIG_SDL
#include <SDL_syswm.h>
#endif
#if 0
#define DPRINTF(fmt, ...) \
@ -227,12 +225,8 @@ static const uint8_t nabcc_translation[2][256] = {
/* The guest OS has started discussing with us, finish initializing BrlAPI */
static int baum_deferred_init(BaumDriverState *baum)
{
#if defined(CONFIG_SDL)
#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)
SDL_SysWMinfo info;
#endif
#endif
int tty;
int tty = BRLAPI_TTY_DEFAULT;
QemuConsole *con;
if (baum->deferred_init) {
return 1;
@ -243,21 +237,12 @@ static int baum_deferred_init(BaumDriverState *baum)
return 0;
}
#if defined(CONFIG_SDL)
#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info)) {
tty = info.info.x11.wmwindow;
} else {
#endif
#endif
tty = BRLAPI_TTY_DEFAULT;
#if defined(CONFIG_SDL)
#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)
con = qemu_console_lookup_by_index(0);
if (con && qemu_console_is_graphic(con)) {
tty = qemu_console_get_window_id(con);
if (tty == -1)
tty = BRLAPI_TTY_DEFAULT;
}
#endif
#endif
if (brlapi__enterTtyMode(baum->brlapi, tty, NULL) == -1) {
brlapi_perror("baum: brlapi__enterTtyMode");

View File

@ -252,6 +252,9 @@ static const uint16_t qcode_to_keycode_set1[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_ASTERISK] = 0x37,
[Q_KEY_CODE_LESS] = 0x56,
[Q_KEY_CODE_RO] = 0x73,
[Q_KEY_CODE_HIRAGANA] = 0x70,
[Q_KEY_CODE_HENKAN] = 0x79,
[Q_KEY_CODE_YEN] = 0x7d,
[Q_KEY_CODE_KP_COMMA] = 0x7e,
};
@ -394,6 +397,9 @@ static const uint16_t qcode_to_keycode_set2[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_LESS] = 0x61,
[Q_KEY_CODE_SYSRQ] = 0x7f,
[Q_KEY_CODE_RO] = 0x51,
[Q_KEY_CODE_HIRAGANA] = 0x13,
[Q_KEY_CODE_HENKAN] = 0x64,
[Q_KEY_CODE_YEN] = 0x6a,
[Q_KEY_CODE_KP_COMMA] = 0x6d,
};
@ -504,6 +510,10 @@ static const uint16_t qcode_to_keycode_set3[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_COMMA] = 0x41,
[Q_KEY_CODE_DOT] = 0x49,
[Q_KEY_CODE_SLASH] = 0x4a,
[Q_KEY_CODE_HIRAGANA] = 0x87,
[Q_KEY_CODE_HENKAN] = 0x86,
[Q_KEY_CODE_YEN] = 0x5d,
};
static uint8_t translate_table[256] = {

View File

@ -337,7 +337,10 @@ static inline pixman_format_code_t surface_format(DisplaySurface *s)
}
#ifdef CONFIG_CURSES
/* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
#undef KEY_EVENT
#include <curses.h>
#undef KEY_EVENT
typedef chtype console_ch_t;
extern chtype vga_to_curses[];
#else
@ -394,6 +397,10 @@ uint32_t qemu_console_get_head(QemuConsole *con);
QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con);
int qemu_console_get_width(QemuConsole *con, int fallback);
int qemu_console_get_height(QemuConsole *con, int fallback);
/* Return the low-level window id for the console */
int qemu_console_get_window_id(QemuConsole *con);
/* Set the low-level window id for the console */
void qemu_console_set_window_id(QemuConsole *con, int window_id);
void console_select(unsigned int index);
void qemu_console_resize(QemuConsole *con, int width, int height);

View File

@ -18,6 +18,10 @@
#include <X11/XKBlib.h>
#endif
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#if defined(CONFIG_OPENGL)
#include "ui/egl-helpers.h"
#include "ui/egl-context.h"

View File

@ -3618,6 +3618,9 @@
# @kp_comma: since 2.4
# @kp_equals: since 2.6
# @power: since 2.6
# @hiragana: since 2.9
# @henkan: since 2.9
# @yen: since 2.9
#
# An enumeration of key name.
#
@ -3642,7 +3645,8 @@
'kp_9', 'less', 'f11', 'f12', 'print', 'home', 'pgup', 'pgdn', 'end',
'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause', 'ro',
'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
'ro', 'hiragana', 'henkan', 'yen',
'kp_comma', 'kp_equals', 'power' ] }
##

View File

@ -124,6 +124,7 @@ struct QemuConsole {
int dcls;
DisplayChangeListener *gl;
bool gl_block;
int window_id;
/* Graphic console state. */
Object *device;
@ -273,6 +274,16 @@ void graphic_hw_gl_block(QemuConsole *con, bool block)
}
}
int qemu_console_get_window_id(QemuConsole *con)
{
return con->window_id;
}
void qemu_console_set_window_id(QemuConsole *con, int window_id)
{
con->window_id = window_id;
}
void graphic_hw_invalidate(QemuConsole *con)
{
if (!con) {

View File

@ -22,7 +22,6 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include <curses.h>
#ifndef _WIN32
#include <sys/ioctl.h>

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2015-2016 Gerd Hoffmann <kraxel@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include <glob.h>
#include <dirent.h>

View File

@ -90,6 +90,9 @@
#ifndef GDK_IS_X11_DISPLAY
#define GDK_IS_X11_DISPLAY(dpy) (dpy == dpy)
#endif
#ifndef GDK_IS_WAYLAND_DISPLAY
#define GDK_IS_WAYLAND_DISPLAY(dpy) (dpy == dpy)
#endif
#ifndef GDK_IS_WIN32_DISPLAY
#define GDK_IS_WIN32_DISPLAY(dpy) (dpy == dpy)
#endif
@ -1053,6 +1056,10 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode)
} else {
qemu_keycode = translate_xfree86_keycode(gdk_keycode - 97);
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
} else if (GDK_IS_WAYLAND_DISPLAY(dpy) && gdk_keycode < 158) {
qemu_keycode = translate_evdev_keycode(gdk_keycode - 97);
#endif
} else if (gdk_keycode == 208) { /* Hiragana_Katakana */
qemu_keycode = 0x70;
@ -1699,6 +1706,11 @@ static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
ChardevCommon *common = qapi_ChardevVC_base(vc);
CharDriverState *chr;
if (nb_vcs == MAX_VCS) {
error_setg(errp, "Maximum number of consoles reached");
return NULL;
}
chr = qemu_chr_alloc(common, errp);
if (!chr) {
return NULL;
@ -2171,6 +2183,8 @@ static gboolean gtkinit;
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
{
VirtualConsole *vc;
GtkDisplayState *s = g_malloc0(sizeof(*s));
char *filename;
GdkDisplay *window_display;
@ -2249,9 +2263,11 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
}
#endif
vc = gd_vc_find_current(s);
gtk_widget_set_sensitive(s->view_menu, vc != NULL);
#ifdef CONFIG_VTE
gtk_widget_set_sensitive(s->copy_item,
gd_vc_find_current(s)->type == GD_VC_VTE);
vc && vc->type == GD_VC_VTE);
#endif
if (full_screen) {

View File

@ -131,6 +131,9 @@ static const int qcode_to_number[] = {
[Q_KEY_CODE_DELETE] = 0xd3,
[Q_KEY_CODE_RO] = 0x73,
[Q_KEY_CODE_HIRAGANA] = 0x70,
[Q_KEY_CODE_HENKAN] = 0x79,
[Q_KEY_CODE_YEN] = 0x7d,
[Q_KEY_CODE_KP_COMMA] = 0x7e,
[Q_KEY_CODE__MAX] = 0,

View File

@ -947,6 +947,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
int flags;
uint8_t data = 0;
const SDL_VideoInfo *vi;
SDL_SysWMinfo info;
char *filename;
#if defined(__APPLE__)
@ -1023,5 +1024,29 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
sdl_cursor_normal = SDL_GetCursor();
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info)) {
int i;
for (i = 0; ; i++) {
/* All consoles share the same window */
QemuConsole *con = qemu_console_lookup_by_index(i);
if (con) {
#if defined(SDL_VIDEO_DRIVER_X11)
qemu_console_set_window_id(con, info.info.x11.wmwindow);
#elif defined(SDL_VIDEO_DRIVER_NANOX) || \
defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || \
defined(SDL_VIDEO_DRIVER_GAPI) || \
defined(SDL_VIDEO_DRIVER_RISCOS)
qemu_console_set_window_id(con, (int) (uintptr_t) info.window);
#else
qemu_console_set_window_id(con, info.data);
#endif
} else {
break;
}
}
}
atexit(sdl_cleanup);
}

View File

@ -761,6 +761,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
uint8_t data = 0;
char *filename;
int i;
SDL_SysWMinfo info;
if (no_frame) {
gui_noframe = 1;
@ -786,6 +787,8 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
exit(1);
}
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
for (i = 0;; i++) {
QemuConsole *con = qemu_console_lookup_by_index(i);
@ -813,6 +816,10 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
#endif
sdl2_console[i].dcl.con = con;
register_displaychangelistener(&sdl2_console[i].dcl);
if (SDL_GetWindowWMInfo(sdl2_console[i].real_window, &info)) {
qemu_console_set_window_id(con, info.info.x11.window);
}
}
/* Load a 32x32x4 image. White pixels are transparent. */

View File

@ -2459,10 +2459,14 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len)
pixel_format_message(vs);
if (qemu_name)
if (qemu_name) {
size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name);
else
if (size > sizeof(buf)) {
size = sizeof(buf);
}
} else {
size = snprintf(buf, sizeof(buf), "QEMU");
}
vnc_write_u32(vs, size);
vnc_write(vs, buf, size);