From 76d8f93b4a72d02f6af6ff4eda36b7630cd8417b Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Wed, 26 Oct 2016 18:21:08 +0300 Subject: gtk: fix compilation warning with gtk 3.22.2 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 Message-id: 20161026152108.12364-1-berto@igalia.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/gtk.c b/ui/gtk.c index 25e6d9969d..dd13982b1a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -912,9 +912,28 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, if (!qemu_input_is_absolute() && s->ptr_owner == vc) { GdkScreen *screen = gtk_widget_get_screen(vc->gfx.drawing_area); + int screen_width, screen_height; + int x = (int)motion->x_root; int y = (int)motion->y_root; +#if GTK_CHECK_VERSION(3, 22, 0) + { + GdkDisplay *dpy = gtk_widget_get_display(widget); + GdkWindow *win = gtk_widget_get_window(widget); + GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); + GdkRectangle geometry; + gdk_monitor_get_geometry(monitor, &geometry); + screen_width = geometry.width; + screen_height = geometry.height; + } +#else + { + screen_width = gdk_screen_get_width(screen); + screen_height = gdk_screen_get_height(screen); + } +#endif + /* In relative mode check to see if client pointer hit * one of the screen edges, and if so move it back by * 200 pixels. This is important because the pointer @@ -928,10 +947,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, if (y == 0) { y += 200; } - if (x == (gdk_screen_get_width(screen) - 1)) { + if (x == (screen_width - 1)) { x -= 200; } - if (y == (gdk_screen_get_height(screen) - 1)) { + if (y == (screen_height - 1)) { y -= 200; } -- cgit v1.2.1 From 856178852032404dee69665c2dcb65f00b4bb48e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 27 Oct 2016 14:17:27 +0200 Subject: ui/gtk: Fix non-working DELETE key 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 Message-id: 1477570647-7100-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/gtk.c b/ui/gtk.c index dd13982b1a..ca737c48d9 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1070,7 +1070,9 @@ static gboolean gd_text_key_down(GtkWidget *widget, VirtualConsole *vc = opaque; QemuConsole *con = vc->gfx.dcl.con; - if (key->length) { + if (key->keyval == GDK_KEY_Delete) { + kbd_put_qcode_console(con, Q_KEY_CODE_DELETE); + } else if (key->length) { kbd_put_string_console(con, key->string, key->length); } else { int num = gd_map_keycode(vc->s, gtk_widget_get_display(widget), -- cgit v1.2.1 From 697783a736b99e8666baf9a0f81fc483ac5f31a5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 15 Oct 2016 21:53:04 +0200 Subject: curses: fix left/right arrow translation In default VGA font, left/right arrow are glyphs 0x1a and 0x1b, not 0x0a and 0x0b. Signed-off-by: Samuel Thibault Message-id: 20161015195308.20473-2-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann --- ui/curses.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/curses.c b/ui/curses.c index d06f724879..2e132a7bfa 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -369,10 +369,10 @@ static void curses_setup(void) /* ACS_* is not constant. So, we can't initialize statically. */ vga_to_curses['\0'] = ' '; vga_to_curses[0x04] = ACS_DIAMOND; - vga_to_curses[0x0a] = ACS_RARROW; - vga_to_curses[0x0b] = ACS_LARROW; vga_to_curses[0x18] = ACS_UARROW; vga_to_curses[0x19] = ACS_DARROW; + vga_to_curses[0x1a] = ACS_RARROW; + vga_to_curses[0x1b] = ACS_LARROW; vga_to_curses[0x9c] = ACS_STERLING; vga_to_curses[0xb0] = ACS_BOARD; vga_to_curses[0xb1] = ACS_CKBOARD; -- cgit v1.2.1