Skip to contentSkip to conversation

Add GTK UI to enable basic accessibility (v2)

PATCH In review Anthony Liguori 10 participants 38 messages Feb 26, 2012 – Mar 12, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Add GTK UI to enable basic accessibility (v2)

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64
- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

#1 lore raw

PATCH 1/8 console: allow VCs to be overridden by UI

We want to expose VCs using a VteTerminal widget. We need access to provide our own CharDriverState in order to do this.

---
 console.c   |   14 +++++++++++++-
 console.h   |    6 +++++-
 qemu-char.c |    2 +-
 3 files changed, 19 insertions(+), 3 deletions(-)
console.c +13 -1
index 6a463f5..6434ed0 100644
@@ -1513,7 +1513,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
         chr->init(chr);
 }
 
-CharDriverState *text_console_init(QemuOpts *opts)
+static CharDriverState *text_console_init(QemuOpts *opts)
 {
     CharDriverState *chr;
     TextConsole *s;
@@ -1549,6 +1549,18 @@ CharDriverState *text_console_init(QemuOpts *opts)
     return chr;
 }
 
+static VcHandler *vc_handler = text_console_init;
+
+int vc_init(QemuOpts *opts, CharDriverState **_chr)
+{
+    return vc_handler(opts, _chr);
+}
+
+void register_vc_handler(VcHandler *handler)
+{
+    vc_handler = handler;
+}
+
 void text_consoles_set_display(DisplayState *ds)
 {
     int i;
console.h +5 -1
index a95b581..56cda3c 100644
@@ -356,7 +356,6 @@ void vga_hw_text_update(console_ch_t *chardata);
 
 int is_graphic_console(void);
 int is_fixedsize_console(void);
-CharDriverState *text_console_init(QemuOpts *opts);
 void text_consoles_set_display(DisplayState *ds);
 void console_select(unsigned int index);
 void console_color_init(DisplayState *ds);
@@ -364,6 +363,11 @@ void qemu_console_resize(DisplayState *ds, int width, int height);
 void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
                        int dst_x, int dst_y, int w, int h);
 
+typedef int (VcHandler)(QemuOpts *, CharDriverState **);
+
+int vc_init(QemuOpts *opts, CharDriverState **_chr);
+void register_vc_handler(VcHandler *handler);
+
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
 
qemu-char.c +1 -1
index bb9e3f5..5b2b35e 100644
@@ -2707,7 +2707,7 @@ static const struct {
     { .name = "socket",    .open = qemu_chr_open_socket },
     { .name = "udp",       .open = qemu_chr_open_udp },
     { .name = "msmouse",   .open = qemu_chr_open_msmouse },
-    { .name = "vc",        .open = text_console_init },
+    { .name = "vc",        .open = vc_init },
 #ifdef _WIN32
     { .name = "file",      .open = qemu_chr_open_win_file_out },
     { .name = "pipe",      .open = qemu_chr_open_win_pipe },
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/8 chr: check to see if front end has registered a read function

In reply to Anthony Liguori
---
 qemu-char.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
qemu-char.c +3 -1
index 5b2b35e..22bfb29 100644
@@ -160,7 +160,9 @@ int qemu_chr_be_can_write(CharDriverState *s)
 
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
 {
-    s->chr_read(s->handler_opaque, buf, len);
+    if (s->chr_read) {
+        s->chr_read(s->handler_opaque, buf, len);
+    }
 }
 
 int qemu_chr_fe_get_msgfd(CharDriverState *s)
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/8 ui: add basic GTK gui (v2)

In reply to Anthony Liguori

This is minimalistic and just contains the basic widget infrastructure. The GUI consists of a menu and a GtkNotebook. To start with, the notebook has its tabs hidden which provides a UI that looks very similar to SDL with the exception of the menu bar.

The menu bar allows a user to toggle the visibility of the tabs. Cairo is used for rendering.

I used gtk-vnc as a reference. gtk-vnc solves the same basic problems as QEMU since it was originally written as a remote display for QEMU. So for the most part, the approach to rendering and keyboard handling should be pretty solid for GTK.

---
v1 -> v2
- add gtk-vnc license
- fix key propagation

---
 Makefile      |    2 +
 Makefile.objs |    1 +
 configure     |   25 +++-
 console.h     |    4 +
 sysemu.h      |    1 +
 ui/gtk.c      |  572 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 604 insertions(+), 1 deletions(-)
 create mode 100644 ui/gtk.c
Makefile +2 -0
index ad1e627..aa758dd 100644
@@ -120,6 +120,8 @@ ui/cocoa.o: ui/cocoa.m
 
 ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
 
+ui/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)
+
 ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 
 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
Makefile.objs +1 -0
index 808de6a..86b63c0 100644
@@ -147,6 +147,7 @@ ui-obj-y += keymaps.o
 ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
 ui-obj-$(CONFIG_COCOA) += cocoa.o
 ui-obj-$(CONFIG_CURSES) += curses.o
+ui-obj-$(CONFIG_GTK) += gtk.o
 vnc-obj-y += vnc.o d3des.o
 vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o
 vnc-obj-y += vnc-enc-tight.o vnc-palette.o
configure +24 -1
index f9d5330..4c80673 100755
@@ -250,7 +250,7 @@ sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
 # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
-QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
@@ -1498,6 +1498,23 @@ if test "$sparse" != "no" ; then
 fi
 
 ##########################################
+# GTK probe
+
+if test "$gtk" != "no"; then
+    if $pkg_config gtk+-2.0 --modversion >/dev/null 2>/dev/null && \
+       $pkg_config vte --modversion >/dev/null 2>/dev/null; then
+	gtk_cflags=`$pkg_config --cflags gtk+-2.0 2>/dev/null`
+	gtk_libs=`$pkg_config --libs gtk+-2.0 2>/dev/null`
+	vte_cflags=`$pkg_config --cflags vte 2>/dev/null`
+	vte_libs=`$pkg_config --libs vte 2>/dev/null`
+	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
+	gtk="yes"
+    else
+	gtk="no"
+    fi
+fi
+
+##########################################
 # SDL probe
 
 # Look for sdl configuration program (pkg-config or sdl-config).  Try
@@ -2879,6 +2896,7 @@ if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
 echo "SDL support       $sdl"
+echo "GTK support       $gtk"
 echo "curses support    $curses"
 echo "curl support      $curl"
 echo "mingw32 support   $mingw32"
@@ -3162,6 +3180,11 @@ if test "$bluez" = "yes" ; then
   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
 fi
 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
+if test "$gtk" = "yes" ; then
+  echo "CONFIG_GTK=y" >> $config_host_mak
+  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
+  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
+fi
 if test "$xen" = "yes" ; then
   echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
   echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
console.h +4 -0
index 56cda3c..9b4b390 100644
@@ -398,4 +398,8 @@ static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires)
 /* curses.c */
 void curses_display_init(DisplayState *ds, int full_screen);
 
+/* gtk.c */
+void early_gtk_display_init(void);
+void gtk_display_init(DisplayState *ds);
+
 #endif
sysemu.h +1 -0
index 98118cc..7b46bb8 100644
@@ -92,6 +92,7 @@ typedef enum DisplayType
     DT_DEFAULT,
     DT_CURSES,
     DT_SDL,
+    DT_GTK,
     DT_NOGRAPHIC,
     DT_NONE,
 } DisplayType;
ui/gtk.c new file +572 -0

572 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/8 gtk: add virtual console support (v2)

In reply to Anthony Liguori

This enables VteTerminal to be used to render the text consoles. VteTerminal is the same widget used by gnome-terminal which means it's VT100 emulation is as good as they come.

It's also screen reader accessible, supports copy/paste, proper scrolling and most of the other features you would expect from a terminal widget.

---
v1 -> v2
- make sure to activate the menu item when switching tabs
- fix sizing of non-0 pages

---
 console.c |    4 +-
 console.h |    4 +-
 ui/gtk.c  |  160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 4 deletions(-)
console.c +2 -2
index 6434ed0..c12f02a 100644
@@ -1551,9 +1551,9 @@ static CharDriverState *text_console_init(QemuOpts *opts)
 
 static VcHandler *vc_handler = text_console_init;
 
-int vc_init(QemuOpts *opts, CharDriverState **_chr)
+CharDriverState *vc_init(QemuOpts *opts)
 {
-    return vc_handler(opts, _chr);
+    return vc_handler(opts);
 }
 
 void register_vc_handler(VcHandler *handler)
console.h +2 -2
index 9b4b390..27d7929 100644
@@ -363,9 +363,9 @@ void qemu_console_resize(DisplayState *ds, int width, int height);
 void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
                        int dst_x, int dst_y, int w, int h);
 
-typedef int (VcHandler)(QemuOpts *, CharDriverState **);
+typedef CharDriverState *(VcHandler)(QemuOpts *);
 
-int vc_init(QemuOpts *opts, CharDriverState **_chr);
+CharDriverState *vc_init(QemuOpts *opts);
 void register_vc_handler(VcHandler *handler);
 
 /* sdl.c */
ui/gtk.c +160 -0

206 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#5 lore raw

Re: [Qemu-devel] [PATCH 4/8] gtk: add virtual console support (v2)

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 166 lines

This enables VteTerminal to be used to render the text consoles. VteTerminal is the same widget used by gnome-terminal which means it's VT100 emulation is as good as they come.

It's also screen reader accessible, supports copy/paste, proper scrolling and most of the other features you would expect from a terminal widget.

---
v1 -> v2
- make sure to activate the menu item when switching tabs
- fix sizing of non-0 pages

---
 console.c |    4 +-
 console.h |    4 +-
 ui/gtk.c  |  160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 4 deletions(-)
console.c +2 -2
index 6434ed0..c12f02a 100644
@@ -1551,9 +1551,9 @@ static CharDriverState *text_console_init(QemuOpts *opts)
 
 static VcHandler *vc_handler = text_console_init;
 
-int vc_init(QemuOpts *opts, CharDriverState **_chr)
+CharDriverState *vc_init(QemuOpts *opts)
 {
-    return vc_handler(opts, _chr);
+    return vc_handler(opts);
 }
 
 void register_vc_handler(VcHandler *handler)
console.h +2 -2
index 9b4b390..27d7929 100644
@@ -363,9 +363,9 @@ void qemu_console_resize(DisplayState *ds, int width, int height);
 void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
                        int dst_x, int dst_y, int w, int h);
 
-typedef int (VcHandler)(QemuOpts *, CharDriverState **);
+typedef CharDriverState *(VcHandler)(QemuOpts *);
 
-int vc_init(QemuOpts *opts, CharDriverState **_chr);
+CharDriverState *vc_init(QemuOpts *opts);
 void register_vc_handler(VcHandler *handler);
 
 /* sdl.c */
ui/gtk.c +77 -0
index 591a987..0579a55 100644
@@ -56,6 +56,8 @@
 #define dprintf(fmt, ...) do { } while (0)
 #endif
 
+#define MAX_VCS 10
+
 typedef struct VirtualConsole
 {
     GtkWidget *menu_item;
@@ -79,6 +81,9 @@ typedef struct GtkDisplayState
     GtkWidget *view_menu;
     GtkWidget *vga_item;
 
+    int nb_vcs;
+    VirtualConsole vc[MAX_VCS];
+
     GtkWidget *show_tabs_item;
 
     GtkWidget *vbox;
@@ -400,6 +405,15 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque)
 
     if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->vga_item))) {
         gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), 0);
+    } else {
+        int i;
+
+        for (i = 0; i < s->nb_vcs; i++) {
+            if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->vc[i].menu_item))) {
+                gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), i + 1);
+                break;
+            }
+        }
     }
 }
 
@@ -418,16 +432,154 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
                            gpointer data)
 {
     GtkDisplayState *s = data;
+    guint last_page;
 
     if (!gtk_widget_get_realized(s->notebook)) {
         return;
     }
 
+    last_page = gtk_notebook_get_current_page(nb);
+
+    if (last_page) {
+        gtk_widget_set_size_request(s->vc[last_page - 1].terminal, -1, -1);
+    }
+
+    if (arg2 == 0) {
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->vga_item), TRUE);
+    } else {
+        VirtualConsole *vc = &s->vc[arg2 - 1];
+        VteTerminal *term = VTE_TERMINAL(vc->terminal);
+        int width, height;
+
+        width = 80 * vte_terminal_get_char_width(term);
+        height = 25 * vte_terminal_get_char_height(term);
+
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE);
+        gtk_widget_set_size_request(vc->terminal, width, height);
+    }        
+
     gd_update_cursor(s, TRUE);
 }
 
+/** Virtual Console Callbacks **/
+
+static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
+{
+    VirtualConsole *vc = chr->opaque;
+
+    return write(vc->fd, buf, len);
+}
+
+static int nb_vcs;
+static CharDriverState *vcs[MAX_VCS];
+
+static CharDriverState *gd_vc_handler(QemuOpts *opts)
+{
+    CharDriverState *chr;
+
+    chr = g_malloc0(sizeof(*chr));
+    chr->chr_write = gd_vc_chr_write;
+
+    vcs[nb_vcs++] = chr;
+
+    return chr;
+}
+
 void early_gtk_display_init(void)
 {
+    register_vc_handler(gd_vc_handler);
+}
+
+static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *opaque)
+{
+    VirtualConsole *vc = opaque;
+    uint8_t buffer[1024];
+    ssize_t len;
+
+    len = read(vc->fd, buffer, sizeof(buffer));
+    if (len <= 0) {
+        return FALSE;
+    }
+
+    qemu_chr_be_write(vc->chr, buffer, len);
+
+    return TRUE;
+}

ui/gtk.c static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, · line 517

Quoted 10 lines
ui/gtk.c +10 -0
+
+static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group)
+{
+    const char *label;
+    char buffer[32];
+    char path[32];
+    VtePty *pty;
+    GIOChannel *chan;
+    GtkWidget *scrolled_window;
+    GtkAdjustment *hadjustment, *vadjustment;

Doesn't build without modifications:

ui/gtk.c: In function 'gd_vc_init':
ui/gtk.c:661:20: error: variable 'hadjustment' set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

Kevin

#6 lore raw

PATCH 5/8 gtk: add support for input grabbing

In reply to Anthony Liguori

There is a small deviation from SDL's behavior here. Instead of Ctrl+Alt triggering grab, we now use Ctrl-Alt-g to trigger grab.

GTK will not accept Ctrl+Alt as an accelerator since it just consists of modifiers. Having grab as a proper accelerator is important as it allows a user to override the accelerator for accessibility purposes.

We also are not automatically grabbing on left-click. Besides the inability to tie mouse clicks to an accelerator, I think this behavior is hard to discover and since it only happens depending on the guest state, it can lead to confusing behavior.

This can be changed in the future if there's a strong resistence to dropping left-click-to-grab, but I think we're better off dropping it.

---
 ui/gtk.c |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 98 insertions(+), 4 deletions(-)
ui/gtk.c +98 -4
index 0579a55..0dac807 100644
@@ -79,6 +79,7 @@ typedef struct GtkDisplayState
 
     GtkWidget *view_menu_item;
     GtkWidget *view_menu;
+    GtkWidget *grab_item;
     GtkWidget *vga_item;
 
     int nb_vcs;
@@ -107,6 +108,11 @@ static GtkDisplayState *global_state;
 
 /** Utility Functions **/
 
+static bool gd_is_grab_active(GtkDisplayState *s)
+{
+    return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->grab_item));
+}
+
 static void gd_update_cursor(GtkDisplayState *s, gboolean override)
 {
     GdkWindow *window;
@@ -116,7 +122,8 @@ static void gd_update_cursor(GtkDisplayState *s, gboolean override)
 
     on_vga = (gtk_notebook_get_current_page(GTK_NOTEBOOK(s->notebook)) == 0);
 
-    if ((override || on_vga) && kbd_mouse_is_absolute()) {
+    if ((override || on_vga) &&
+        (kbd_mouse_is_absolute() || gd_is_grab_active(s))) {
 	gdk_window_set_cursor(window, s->null_cursor);
     } else {
 	gdk_window_set_cursor(window, NULL);
@@ -127,15 +134,20 @@ static void gd_update_caption(GtkDisplayState *s)
 {
     const char *status = "";
     gchar *title;
+    const char *grab = "";
+
+    if (gd_is_grab_active(s)) {
+        grab = " - Press Ctrl+Alt+G to release grab";
+    }
 
     if (!runstate_is_running()) {
         status = " [Stopped]";
     }
 
     if (qemu_name) {
-        title = g_strdup_printf("QEMU (%s)%s", qemu_name, status);
+        title = g_strdup_printf("QEMU (%s)%s%s", qemu_name, status, grab);
     } else {
-        title = g_strdup_printf("QEMU%s", status);
+        title = g_strdup_printf("QEMU%s%s", status, grab);
     }
         
     gtk_window_set_title(GTK_WINDOW(s->window), title);
@@ -309,10 +321,44 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
     s->last_x = x;
     s->last_y = y;
 
-    if (kbd_mouse_is_absolute()) {
+    if (kbd_mouse_is_absolute() || gd_is_grab_active(s)) {
         kbd_mouse_event(dx, dy, 0, s->button_mask);
     }
 
+    if (!kbd_mouse_is_absolute() && gd_is_grab_active(s)) {
+        GdkDrawable *drawable = GDK_DRAWABLE(gtk_widget_get_window(s->drawing_area));
+        GdkDisplay *display = gdk_drawable_get_display(drawable);
+        GdkScreen *screen = gdk_drawable_get_screen(drawable);
+        int x = (int)motion->x_root;
+        int y = (int)motion->y_root;
+
+        /* 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
+         * in the server doesn't correspond 1-for-1, and so
+         * may still be only half way across the screen. Without
+         * this warp, the server pointer would thus appear to hit
+         * an invisible wall */
+        if (x == 0) {
+            x += 200;
+        }
+        if (y == 0) {
+            y += 200;
+        }
+        if (x == (gdk_screen_get_width(screen) - 1)) {
+            x -= 200;
+        }
+        if (y == (gdk_screen_get_height(screen) - 1)) {
+            y -= 200;
+        }
+
+        if (x != (int)motion->x_root || y != (int)motion->y_root) {
+            gdk_display_warp_pointer(display, screen, x, y);
+            s->last_x = -1;
+            s->last_y = -1;
+            return FALSE;
+        }
+    }        
     return TRUE;
 }
 
@@ -428,11 +474,39 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
     }
 }
 
+static void gd_menu_grab_input(GtkMenuItem *item, void *opaque)
+{
+    GtkDisplayState *s = opaque;
+
+    if (gd_is_grab_active(s)) {
+	gdk_keyboard_grab(gtk_widget_get_window(GTK_WIDGET(s->drawing_area)),
+			  FALSE,
+			  GDK_CURRENT_TIME);
+	gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(s->drawing_area)),
+			 FALSE, /* All events to come to our window directly */
+			 GDK_POINTER_MOTION_MASK |
+			 GDK_BUTTON_PRESS_MASK |
+			 GDK_BUTTON_RELEASE_MASK |
+			 GDK_BUTTON_MOTION_MASK |
+			 GDK_SCROLL_MASK,
+			 NULL, /* Allow cursor to move over entire desktop */
+                         s->null_cursor,
+			 GDK_CURRENT_TIME);
+    } else {
+	gdk_keyboard_ungrab(GDK_CURRENT_TIME);
+	gdk_pointer_ungrab(GDK_CURRENT_TIME);
+    }
+
+    gd_update_caption(s);
+    gd_update_cursor(s, FALSE);
+}
+
 static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
                            gpointer data)
 {
     GtkDisplayState *s = data;
     guint last_page;
+    gboolean on_vga;
 
     if (!gtk_widget_get_realized(s->notebook)) {
         return;
@@ -444,6 +518,13 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
         gtk_widget_set_size_request(s->vc[last_page - 1].terminal, -1, -1);
     }
 
+    on_vga = arg2 == 0;
+
+    if (!on_vga) {
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
+                                       FALSE);
+    }
+
     if (arg2 == 0) {
         gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->vga_item), TRUE);
     } else {
@@ -458,6 +539,8 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
         gtk_widget_set_size_request(vc->terminal, width, height);
     }        
 
+    gtk_widget_set_sensitive(s->grab_item, on_vga);
+
     gd_update_cursor(s, TRUE);
 }
 
@@ -609,6 +692,8 @@ static void gd_connect_signals(GtkDisplayState *s)
                      G_CALLBACK(gd_menu_quit), s);
     g_signal_connect(s->vga_item, "activate",
                      G_CALLBACK(gd_menu_switch_vc), s);
+    g_signal_connect(s->grab_item, "activate",
+                     G_CALLBACK(gd_menu_grab_input), s);
     g_signal_connect(s->notebook, "switch-page",
                      G_CALLBACK(gd_change_page), s);
 }
@@ -639,6 +724,15 @@ static void gd_create_menus(GtkDisplayState *s)
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
+    s->grab_item = gtk_check_menu_item_new_with_mnemonic("_Grab Input");
+    gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->grab_item),
+                                 "<QEMU>/View/Grab Input");
+    gtk_accel_map_add_entry("<QEMU>/View/Grab Input", GDK_KEY_g, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+    gtk_menu_append(GTK_MENU(s->view_menu), s->grab_item);
+
+    separator = gtk_separator_menu_item_new();
+    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+
     s->vga_item = gtk_radio_menu_item_new_with_mnemonic(group, "_VGA");
     group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(s->vga_item));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->vga_item),
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 6/8 gtk: add support for screen scaling and full screen (v2)

In reply to Anthony Liguori

Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we don't allow arbitrary scaling based on window resizing. The current behavior with SDL causes a lot of problems for me.

Sometimes I accidentally resize the window a tiny bit while trying to move it (Ubuntu's 1-pixel window decorations don't help here). After that, scaling is now active and if the screen changes size again, badness ensues since the aspect ratio is skewed.

Allowing zooming by 25% in and out should cover most use cases. We can add a more flexible scaling later but for now, I think this is a more friendly behavior.

---
v1 -> v2
- fix scaling (Paolo)
- use ctrl-alt-+ instead of ctrl-alt-= for zoom

---
 ui/gtk.c |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 88 insertions(+), 4 deletions(-)
ui/gtk.c +88 -4
index 0dac807..578cb94 100644
@@ -79,6 +79,9 @@ typedef struct GtkDisplayState
 
     GtkWidget *view_menu_item;
     GtkWidget *view_menu;
+    GtkWidget *full_screen_item;
+    GtkWidget *zoom_in_item;
+    GtkWidget *zoom_out_item;
     GtkWidget *grab_item;
     GtkWidget *vga_item;
 
@@ -99,6 +102,7 @@ typedef struct GtkDisplayState
 
     double scale_x;
     double scale_y;
+    gboolean full_screen;
 
     GdkCursor *null_cursor;
     Notifier mouse_mode_notifier;
@@ -123,7 +127,7 @@ static void gd_update_cursor(GtkDisplayState *s, gboolean override)
     on_vga = (gtk_notebook_get_current_page(GTK_NOTEBOOK(s->notebook)) == 0);
 
     if ((override || on_vga) &&
-        (kbd_mouse_is_absolute() || gd_is_grab_active(s))) {
+        (s->full_screen || kbd_mouse_is_absolute() || gd_is_grab_active(s))) {
 	gdk_window_set_cursor(window, s->null_cursor);
     } else {
 	gdk_window_set_cursor(window, NULL);
@@ -215,9 +219,11 @@ static void gd_resize(DisplayState *ds)
                                                      ds->surface->height,
                                                      ds->surface->linesize);
 
-    gtk_widget_set_size_request(s->drawing_area,
-                                ds->surface->width * s->scale_x,
-                                ds->surface->height * s->scale_y);
+    if (!s->full_screen) {
+        gtk_widget_set_size_request(s->drawing_area,
+                                    ds->surface->width * s->scale_x,
+                                    ds->surface->height * s->scale_y);
+    }
 }
 
 /** QEMU Events **/
@@ -474,6 +480,54 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque)
     }
 }
 
+static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
+{
+    GtkDisplayState *s = opaque;
+
+    if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->full_screen_item))) {
+        gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s->notebook), FALSE);
+        gtk_widget_set_size_request(s->menu_bar, 0, 0);
+        gtk_widget_set_size_request(s->drawing_area, -1, -1);
+        gtk_window_set_resizable(GTK_WINDOW(s->window), TRUE);
+        gtk_window_fullscreen(GTK_WINDOW(s->window));
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), TRUE);
+        s->full_screen = TRUE;
+    } else {
+        gtk_window_unfullscreen(GTK_WINDOW(s->window));
+        gd_menu_show_tabs(GTK_MENU_ITEM(s->show_tabs_item), s);
+        gtk_widget_set_size_request(s->menu_bar, -1, -1);
+        gtk_widget_set_size_request(s->drawing_area, s->ds->surface->width, s->ds->surface->height);
+        gtk_window_set_resizable(GTK_WINDOW(s->window), FALSE);
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), FALSE);
+        s->full_screen = FALSE;
+    }
+
+    gd_update_cursor(s, FALSE);
+}
+
+static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
+{
+    GtkDisplayState *s = opaque;
+
+    s->scale_x += .25;
+    s->scale_y += .25;
+
+    gd_resize(s->ds);
+}
+
+static void gd_menu_zoom_out(GtkMenuItem *item, void *opaque)
+{
+    GtkDisplayState *s = opaque;
+
+    s->scale_x -= .25;
+    s->scale_y -= .25;
+
+    s->scale_x = MAX(s->scale_x, .25);
+    s->scale_y = MAX(s->scale_y, .25);
+
+    gd_resize(s->ds);
+}
+
 static void gd_menu_grab_input(GtkMenuItem *item, void *opaque)
 {
     GtkDisplayState *s = opaque;
@@ -523,6 +577,9 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2,
     if (!on_vga) {
         gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
                                        FALSE);
+    } else if (s->full_screen) {
+        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
+                                       TRUE);
     }
 
     if (arg2 == 0) {
@@ -690,6 +747,12 @@ static void gd_connect_signals(GtkDisplayState *s)
 
     g_signal_connect(s->quit_item, "activate",
                      G_CALLBACK(gd_menu_quit), s);
+    g_signal_connect(s->full_screen_item, "activate",
+                     G_CALLBACK(gd_menu_full_screen), s);
+    g_signal_connect(s->zoom_in_item, "activate",
+                     G_CALLBACK(gd_menu_zoom_in), s);
+    g_signal_connect(s->zoom_out_item, "activate",
+                     G_CALLBACK(gd_menu_zoom_out), s);
     g_signal_connect(s->vga_item, "activate",
                      G_CALLBACK(gd_menu_switch_vc), s);
     g_signal_connect(s->grab_item, "activate",
@@ -721,6 +784,27 @@ static void gd_create_menus(GtkDisplayState *s)
     gtk_menu_set_accel_group(GTK_MENU(s->view_menu), accel_group);
     s->view_menu_item = gtk_menu_item_new_with_mnemonic("_View");
 
+    s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");
+    gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
+                                 "<QEMU>/View/Full Screen");
+    gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+    gtk_menu_append(GTK_MENU(s->view_menu), s->full_screen_item);
+
+    separator = gtk_separator_menu_item_new();
+    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+
+    s->zoom_in_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL);
+    gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item),
+                                 "<QEMU>/View/Zoom In");
+    gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_in_item);
+
+    s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);
+    gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item),
+                                 "<QEMU>/View/Zoom Out");
+    gtk_accel_map_add_entry("<QEMU>/View/Zoom Out", GDK_KEY_minus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_out_item);
+
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
Signature · 1 line
1.7.4.1
#8 lore raw

Re: [Qemu-devel] [PATCH 6/8] gtk: add support for screen scaling and full screen (v2)

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 27 lines

Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we don't allow arbitrary scaling based on window resizing. The current behavior with SDL causes a lot of problems for me.

Sometimes I accidentally resize the window a tiny bit while trying to move it (Ubuntu's 1-pixel window decorations don't help here). After that, scaling is now active and if the screen changes size again, badness ensues since the aspect ratio is skewed.

Allowing zooming by 25% in and out should cover most use cases. We can add a more flexible scaling later but for now, I think this is a more friendly behavior.

---
v1 -> v2
- fix scaling (Paolo)
- use ctrl-alt-+ instead of ctrl-alt-= for zoom
---
ui/gtk.c | 92
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---

1 files changed, 88 insertions(+), 4 deletions(-)
ui/gtk.c +0 -0
index 0dac807..578cb94 100644

[...]

Quoted 3 lines

+ s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");

I suggest using the GTK standard widget GTK_STOCK_FULLSCREEN here. That's not a check menu item, so some more changes will be needed.

Full screen mode does not need a check menu item, because you only see the menu item when it is not in full screen mode.

Quoted 19 lines

+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
+ "<QEMU>/View/Full Screen");
+ gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ gtk_menu_append(GTK_MENU(s->view_menu), s->full_screen_item);

ui/gtk.c +5 -0
+
+ separator = gtk_separator_menu_item_new();
+ gtk_menu_append(GTK_MENU(s->view_menu), separator);
+
+ s->zoom_in_item = 

gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL);
+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item),
+ "<QEMU>/View/Zoom In");
+ gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_in_item); +
+ s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);

Quoted 9 lines

+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item),
+ "<QEMU>/View/Zoom Out");
+ gtk_accel_map_add_entry("<QEMU>/View/Zoom Out", GDK_KEY_minus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_out_item); +
separator = gtk_separator_menu_item_new(); gtk_menu_append(GTK_MENU(s->view_menu), separator);

As was already said, GTK_STOCK_ZOOM_100 with accelerator GDK_KEY_0 would complete the zooming menu entries.

In your previous patch, you scaled s->scale_x *= 1.25 (which was correct) and s->scale_x *= 0.75 (which should have been s->scale_x *= 0.8).

Why do you now use s->scale_x += .25, s->scale_x -= .25? Linear scaling is uncommon and not what I'd expect when I read 25 % zooming in / out. I know that SDL also uses linear scaling, but GTK wants to be better than SDL.

Regards,

Stefan Weil

#9 lore raw

Re: [Qemu-devel] [PATCH 6/8] gtk: add support for screen scaling and full screen (v2)

Quoted 31 lines · Stefan Weil

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 26 lines

Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we don't allow arbitrary scaling based on window resizing. The current behavior with SDL causes a lot of problems for me.

Sometimes I accidentally resize the window a tiny bit while trying to move it (Ubuntu's 1-pixel window decorations don't help here). After that, scaling is now active and if the screen changes size again, badness ensues since the aspect ratio is skewed.

Allowing zooming by 25% in and out should cover most use cases. We can add a more flexible scaling later but for now, I think this is a more friendly behavior.

---
v1 -> v2
- fix scaling (Paolo)
- use ctrl-alt-+ instead of ctrl-alt-= for zoom
---
ui/gtk.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---

1 files changed, 88 insertions(+), 4 deletions(-)
ui/gtk.c +0 -0
index 0dac807..578cb94 100644

[...]

Quoted 1 line
Quoted 7 lines
Quoted 1 line

+ s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");

I suggest using the GTK standard widget GTK_STOCK_FULLSCREEN here. That's not a check menu item, so some more changes will be needed.

Full screen mode does not need a check menu item, because you only see the menu item when it is not in full screen mode.

Yeah, I've thought about this myself too. In the very least, we could use the stock item's label. I've been on the fence about check vs. image.

Regarding use of a check menu item. I've thought about this too. In the past, it was common to have an "Enter Fullscreen" and a "Leave Fullscreen" option although now it seems to have a single check item for Fullscreen. Both evince and firefox do this for instance.

It definitely makes sense programatically (it's a toggle after all). If we did something like have an autohiding menubar when in full screen mode, it would also make more sense from a UI perspective.

Quoted 23 lines
Quoted 23 lines

+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
+ "<QEMU>/View/Full Screen");
+ gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ gtk_menu_append(GTK_MENU(s->view_menu), s->full_screen_item);

ui/gtk.c +8 -0
+
+ separator = gtk_separator_menu_item_new();
+ gtk_menu_append(GTK_MENU(s->view_menu), separator);
+
+ s->zoom_in_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL);
+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item),
+ "<QEMU>/View/Zoom In");
+ gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus,

GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_in_item);
+
+ s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);
+ gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item),
+ "<QEMU>/View/Zoom Out");
+ gtk_accel_map_add_entry("<QEMU>/View/Zoom Out", GDK_KEY_minus, GDK_CONTROL_MASK | GDK_MOD1_MASK);

Quoted 8 lines
Quoted 5 lines

+ gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_out_item); +
separator = gtk_separator_menu_item_new(); gtk_menu_append(GTK_MENU(s->view_menu), separator);

As was already said, GTK_STOCK_ZOOM_100 with accelerator GDK_KEY_0 would complete the zooming menu entries.

Yeah, should be easy enough to add.

Quoted 7 lines

In your previous patch, you scaled s->scale_x *= 1.25 (which was correct) and s->scale_x *= 0.75 (which should have been s->scale_x *= 0.8).

Why do you now use s->scale_x += .25, s->scale_x -= .25? Linear scaling is uncommon and not what I'd expect when I read 25 % zooming in / out. I know that SDL also uses linear scaling, but GTK wants to be better than SDL.

I was suspicious that floating point math was causing undesirable rounding such that I was a pixel off when you zoomed out and zoomed back to 100%. Stretching by 1 pixel tends to create a very noticeable artifact with text.

I think we could do exponential scaling but store the exponent instead of the straight factor. That would avoid any accumulated rounding error.

Regards,

Anthony Liguori

Quoted 5 lines

Regards,

Stefan Weil

#10 lore raw

Re: [Qemu-devel] [PATCH 6/8] gtk: add support for screen scaling and full screen (v2)

In reply to Stefan Weil

Am 27.02.2012 21:10, schrieb Stefan Weil:

Quoted 36 lines

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 31 lines

Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we don't allow arbitrary scaling based on window resizing. The current behavior
with SDL causes a lot of problems for me.

Sometimes I accidentally resize the window a tiny bit while trying to move it
(Ubuntu's 1-pixel window decorations don't help here). After that, scaling is
now active and if the screen changes size again, badness ensues since the aspect ratio is skewed.

Allowing zooming by 25% in and out should cover most use cases. We can add a
more flexible scaling later but for now, I think this is a more friendly behavior.

---
v1 -> v2
- fix scaling (Paolo)
- use ctrl-alt-+ instead of ctrl-alt-= for zoom
---
ui/gtk.c | 92
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---

1 files changed, 88 insertions(+), 4 deletions(-)
ui/gtk.c +0 -0
index 0dac807..578cb94 100644

[...]

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

+ s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");

I suggest using the GTK standard widget GTK_STOCK_FULLSCREEN here. That's not a check menu item, so some more changes will be needed.

Full screen mode does not need a check menu item, because you only see the menu item when it is not in full screen mode.

Tried Alt-V in full screen mode? ;-)

(Yes, I'd consider it a bug)

Kevin

#11 lore raw

PATCH 7/8 gtk: add translation support

In reply to Anthony Liguori

The de_DE translation is just a placeholder so that I could test the infrastructure.

---
 Makefile       |    3 +++
 configure      |    4 ++++
 po/Makefile    |   43 +++++++++++++++++++++++++++++++++++++++++++
 po/de_DE.po    |   37 +++++++++++++++++++++++++++++++++++++
 po/messages.po |   37 +++++++++++++++++++++++++++++++++++++
 ui/gtk.c       |   18 +++++++++++++-----
 6 files changed, 137 insertions(+), 5 deletions(-)
 create mode 100644 po/Makefile
 create mode 100644 po/de_DE.po
 create mode 100644 po/messages.po
Makefile +3 -0
index aa758dd..d8f33f7 100644
@@ -296,6 +296,9 @@ ifneq ($(BLOBS),)
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
 	done
 endif
+ifeq ($(CONFIG_GTK),y)
+	$(MAKE) -C po $@ || exit 1
+endif
 	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
 	set -e; for x in $(KEYMAPS); do \
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
configure +4 -0
index 4c80673..7d5cb38 100755
@@ -3916,6 +3916,10 @@ if [ "$source_path" != `pwd` ]; then
     mkdir -p libcacard
     rm -f libcacard/Makefile
     symlink "$source_path/libcacard/Makefile" libcacard/Makefile
+
+    mkdir -p po
+    rm -f po/Makefile
+    symlink "$source_path/po/Makefile" po/Makefile
 fi
 
 d=libuser
po/Makefile new file +43 -0

43 lines not on this page · raw message

po/de_DE.po new file +37 -0
new file mode 100644
index 0000000..aa4ef42
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# This file is put in the public domain.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.0.50\n"
+"Report-Msgid-Bugs-To: [email protected]\n"
+"POT-Creation-Date: 2012-02-26 11:30-0600\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../ui/gtk.c:769
+msgid "_File"
+msgstr "_File FIXME"
+
+#: ../ui/gtk.c:779
+msgid "_View"
+msgstr "_View FIXME"
+
+#: ../ui/gtk.c:781
+msgid "_Full Screen"
+msgstr "_Full Screen FIXME"
+
+#: ../ui/gtk.c:805
+msgid "_Grab Input"
+msgstr "_Grab Input FIXME"
+
+#: ../ui/gtk.c:831
+msgid "Show _Tabs"
+msgstr "Show _Tabs FIXME"
po/messages.po new file +37 -0
new file mode 100644
index 0000000..741e782
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# This file is put in the public domain.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.0.50\n"
+"Report-Msgid-Bugs-To: [email protected]\n"
+"POT-Creation-Date: 2012-02-26 11:30-0600\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../ui/gtk.c:769
+msgid "_File"
+msgstr ""
+
+#: ../ui/gtk.c:779
+msgid "_View"
+msgstr ""
+
+#: ../ui/gtk.c:781
+msgid "_Full Screen"
+msgstr ""
+
+#: ../ui/gtk.c:805
+msgid "_Grab Input"
+msgstr ""
+
+#: ../ui/gtk.c:831
+msgid "Show _Tabs"
+msgstr ""
ui/gtk.c +13 -5
index 578cb94..5b759bc 100644
@@ -31,8 +31,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#define GETTEXT_PACKAGE "qemu"
+#define LOCALEDIR "po"
+
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 #include <vte/vte.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -772,7 +776,7 @@ static void gd_create_menus(GtkDisplayState *s)
     accel_group = gtk_accel_group_new();
     s->file_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(s->file_menu), accel_group);
-    s->file_menu_item = gtk_menu_item_new_with_mnemonic("_File");
+    s->file_menu_item = gtk_menu_item_new_with_mnemonic(_("_File"));
 
     s->quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
     gtk_stock_lookup(GTK_STOCK_QUIT, &item);
@@ -782,9 +786,9 @@ static void gd_create_menus(GtkDisplayState *s)
 
     s->view_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(s->view_menu), accel_group);
-    s->view_menu_item = gtk_menu_item_new_with_mnemonic("_View");
+    s->view_menu_item = gtk_menu_item_new_with_mnemonic(_("_View"));
 
-    s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");
+    s->full_screen_item = gtk_check_menu_item_new_with_mnemonic(_("_Full Screen"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
                                  "<QEMU>/View/Full Screen");
     gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
@@ -808,7 +812,7 @@ static void gd_create_menus(GtkDisplayState *s)
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
-    s->grab_item = gtk_check_menu_item_new_with_mnemonic("_Grab Input");
+    s->grab_item = gtk_check_menu_item_new_with_mnemonic(_("_Grab Input"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->grab_item),
                                  "<QEMU>/View/Grab Input");
     gtk_accel_map_add_entry("<QEMU>/View/Grab Input", GDK_KEY_g, GDK_CONTROL_MASK | GDK_MOD1_MASK);
@@ -834,7 +838,7 @@ static void gd_create_menus(GtkDisplayState *s)
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
-    s->show_tabs_item = gtk_check_menu_item_new_with_mnemonic("Show _Tabs");
+    s->show_tabs_item = gtk_check_menu_item_new_with_mnemonic(_("Show _Tabs"));
     gtk_menu_append(GTK_MENU(s->view_menu), s->show_tabs_item);
 
     g_object_set_data(G_OBJECT(s->window), "accel_group", accel_group);
@@ -870,6 +874,10 @@ void gtk_display_init(DisplayState *ds)
     s->scale_x = 1.0;
     s->scale_y = 1.0;
 
+    setlocale(LC_ALL, "");
+    bindtextdomain("qemu", CONFIG_QEMU_PREFIX "/share/locale");
+    textdomain("qemu");
+
     s->null_cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
 
     s->mouse_mode_notifier.notify = gd_mouse_mode_change;
Signature · 1 line
1.7.4.1
#12 lore raw

Re: [Qemu-devel] [PATCH 7/8] gtk: add translation support

Quoted 2 lines · Anthony Liguori

The de_DE translation is just a placeholder so that I could test the infrastructure.

Here is an it_IT translation that you can use instead.

Paolo

# Italian translation for QEMU.
# This file is put in the public domain.
# Paolo Bonzini <[email protected]>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: QEMU 1.0.50\n" "Report-Msgid-Bugs-To: [email protected]\n" "POT-Creation-Date: 2012-02-26 11:30-0600\n" "PO-Revision-Date: 2012-02-27 08:23+0100\n" "Last-Translator: Paolo Bonzini <[email protected]>\n" "Language-Team: Italian <[email protected]>\n" "Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"

#: ../ui/gtk.c:769
msgid "_File"
msgstr "_File"

#: ../ui/gtk.c:779
msgid "_View"
msgstr "_Visualizza"

#: ../ui/gtk.c:781
msgid "_Full Screen"
msgstr "_Schermo intero"

#: ../ui/gtk.c:805
msgid "_Grab Input"
msgstr "_Cattura input"

#: ../ui/gtk.c:831
msgid "Show _Tabs"
msgstr "Mostra _tab"

#13 lore raw

Re: [Qemu-devel] [PATCH 7/8] gtk: add translation support

Quoted 5 lines · Paolo Bonzini
Quoted 2 lines · Anthony Liguori

The de_DE translation is just a placeholder so that I could test the infrastructure.

Here is an it_IT translation that you can use instead.

Grazie!

Regards,

Anthony Liguori

Quoted 2 lines

Paolo

#14 lore raw

Re: [Qemu-devel] [PATCH 7/8] gtk: add translation support

In reply to Paolo Bonzini

Am 27.02.2012 09:32, schrieb Paolo Bonzini:

Quoted 5 lines · Anthony Liguori
Quoted 2 lines

The de_DE translation is just a placeholder so that I could test the infrastructure.

Here is an it_IT translation that you can use instead.

And here's a real de_DE.

Kevin

# German translation for QEMU.
# This file is put in the public domain.
# Kevin Wolf <[email protected]>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: QEMU 1.0.50\n" "Report-Msgid-Bugs-To: [email protected]\n" "POT-Creation-Date: 2012-02-26 11:30-0600\n" "PO-Revision-Date: 2012-02-28 16:00+0100\n" "Last-Translator: Kevin Wolf <[email protected]>\n" "Language-Team: Deutsch <[email protected]>\n" "Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n"

#: ../ui/gtk.c:769
msgid "_File"
msgstr "_Datei"

#: ../ui/gtk.c:779
msgid "_View"
msgstr "_Ansicht"

#: ../ui/gtk.c:781
msgid "_Full Screen"
msgstr "Voll_bild"

#: ../ui/gtk.c:805
msgid "_Grab Input"
msgstr "_Eingabegeräte einfangen"

#: ../ui/gtk.c:831
msgid "Show _Tabs"
msgstr "_Tableiste anzeigen"

#15 lore raw

Re: [Qemu-devel] [PATCH 7/8] gtk: add translation support

In reply to Anthony Liguori

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 12 lines

The de_DE translation is just a placeholder so that I could test the infrastructure.

---
  Makefile       |    3 +++
  configure      |    4 ++++
  po/Makefile    |   43 +++++++++++++++++++++++++++++++++++++++++++
  po/de_DE.po    |   37 +++++++++++++++++++++++++++++++++++++
  po/messages.po |   37 +++++++++++++++++++++++++++++++++++++
  ui/gtk.c       |   18 +++++++++++++-----
  6 files changed, 137 insertions(+), 5 deletions(-)
Quoted 5 lines

create mode 100644 po/Makefile
create mode 100644 po/de_DE.po
create mode 100644 po/messages.po

What about using the Translation Project (which is already used by other well known GTK based projects) for QEMU, too?

See http://translationproject.org/ for more information.

Regards,

Stefan Weil

#16 lore raw

PATCH 8/8 gtk: make default UI

In reply to Anthony Liguori

A user can still enable SDL with '-sdl' or '-display sdl' but start making the default display GTK by default.

I'd also like to deprecate the SDL display and remove it in a few releases.

---
 vl.c |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)
vl.c +24 -14
index 1d4c350..95d4e79 100644
@@ -3290,6 +3290,25 @@ int main(int argc, char **argv, char **envp)
             add_device_config(DEV_VIRTCON, "vc:80Cx24C");
     }
 
+    if (display_type == DT_DEFAULT) {
+#if defined(CONFIG_GTK)
+        display_type = DT_GTK;
+#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
+        display_type = DT_SDL;
+#elif defined(CONFIG_VNC)
+        vnc_display = "localhost:0,to=99";
+        show_vnc_port = 1;
+#else
+        display_type = DT_NONE;
+#endif
+    }
+
+#if defined(CONFIG_GTK)
+    if (display_type == DT_GTK) {
+        early_gtk_display_init();
+    }
+#endif
+
     socket_init();
 
     if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
@@ -3502,20 +3521,6 @@ int main(int argc, char **argv, char **envp)
     /* just use the first displaystate for the moment */
     ds = get_displaystate();
 
-    if (using_spice)
-        display_remote++;
-    if (display_type == DT_DEFAULT && !display_remote) {
-#if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
-        display_type = DT_SDL;
-#elif defined(CONFIG_VNC)
-        vnc_display = "localhost:0,to=99";
-        show_vnc_port = 1;
-#else
-        display_type = DT_NONE;
-#endif
-    }
-
-
     /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
@@ -3534,6 +3539,11 @@ int main(int argc, char **argv, char **envp)
         cocoa_display_init(ds, full_screen);
         break;
 #endif
+#if defined(CONFIG_GTK)
+    case DT_GTK:
+        gtk_display_init(ds);
+        break;
+#endif
     default:
         break;
     }
Signature · 1 line
1.7.4.1
#17 lore raw
In reply to Anthony Liguori
Quoted 38 lines · Anthony Liguori

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

Quoted 7 lines

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

gnome-terminal, well basically every terminal that isn't konsole, is utterly incapable of rendering anything with complex shaping (devanagari/gurumukhi/whatever for instance), i'd go on a limb and say that it's defficiency in the underlying terminal emulation (VteTerminal?), so claiming to support internationalization is disingenuous.

Quoted 12 lines

- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

Signature · 1 line
mailto:[email protected]
#18 lore raw
In reply to Anthony Liguori
Quoted 49 lines · Anthony Liguori

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64
- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Quoted 6 lines

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

Looks quite nice but still has some rough edges:
- full screen doesn't work, at least here
- lacking support for auto-grabbing in absolute mouse mode
- unscaling (ctrl-alt-u) is lacking
- window not resizable (except in broken full-screen mode)

Will see if I find some time to look into this.

Is this also working properly under Windows? Otherwise we probably can't deprecate SDL - or would have to provide a native Windows GUI.

As we have a menu now, I would suggest to add some handy monitor commands there as well, like reset or powerdown.

Jan

#19 lore raw
Quoted 57 lines · Jan Kiszka
Quoted 49 lines · Anthony Liguori

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64
- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Quoted 6 lines

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

Quoted 2 lines

Looks quite nice but still has some rough edges:
- full screen doesn't work, at least here

How does it fail? It works for me. What distro are you on?

Quoted 1 line

- lacking support for auto-grabbing in absolute mouse mode

What do you mean by auto grabbing?

Quoted 1 line

- unscaling (ctrl-alt-u) is lacking

Since we scale by 25% up and down, I figured it wasn't strictly necessary anymore because it's very easy to zoom back to the original size. It's easy enough to add though.

Quoted 1 line

- window not resizable (except in broken full-screen mode)

That's intentional.

Quoted 5 lines

Will see if I find some time to look into this.

Is this also working properly under Windows? Otherwise we probably can't deprecate SDL - or would have to provide a native Windows GUI.

It should, but it doesn't right now most likely because of the glib event loop being broken on win32.

Quoted 2 lines

As we have a menu now, I would suggest to add some handy monitor commands there as well, like reset or powerdown.

Absolutely. I wanted to start with something very simple though first.

Regards,

Anthony Liguori

Quoted 2 lines

Jan

#20 lore raw
Quoted 81 lines · Anthony Liguori
Quoted 80 lines · Jan Kiszka
Quoted 78 lines · Anthony Liguori

I realize UIs are the third rail of QEMU development, but over the years I've
gotten a lot of feedback from users about our UI. I think everyone struggles
with the SDL interface and its lack of discoverability but it's worse than I
think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack
of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect
system font settings which means we ignore if the user has configured large
print.

We also don't integrate at all with screen readers which means that for blind
users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with
limited dexterity (this is actually more common than you would think), they may
use an input device that only inputs one key at a time. Holding down two keys
at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK,
solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go
there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic
accessibility support. As a consequence, the UI is much more usable even for a
user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any
other languages
so I added a placeholder for a German translation. This can be
tested with

    LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

- Fixed the terminal size for VteTerminal widgets. I think the
behavior makes
sense now.
- Fixed lots of issues raised in review comments (see individual
patches)

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes.
I need to
work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older
VteTerminal widgets
yet.

Quoted 4 lines
Quoted 2 lines

Looks quite nice but still has some rough edges:
- full screen doesn't work, at least here

How does it fail?

The window changes to resizable mode, but remains a decorated window.

Quoted 1 line

It works for me. What distro are you on?

OpenSUSE 11.4, gnome2.

Quoted 4 lines
Quoted 2 lines

- lacking support for auto-grabbing in absolute mouse mode

What do you mean by auto grabbing?

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Quoted 6 lines
Quoted 2 lines

- unscaling (ctrl-alt-u) is lacking

Since we scale by 25% up and down, I figured it wasn't strictly necessary anymore because it's very easy to zoom back to the original size. It's easy enough to add though.

It's mandatory for usability IMHO. You find this "back to 1:1 view" in almost every application that supports scaling of its view, and we even have a pre-defined shortcut for it for some releases now.

Quoted 4 lines
Quoted 2 lines

- window not resizable (except in broken full-screen mode)

That's intentional.

And a mistake IMHO. Definitely for the text consoles, but one can also argue about the guest graphic console. I think Stefano once introduced this for some Xen use case, maybe he can comment on it.

BTW, "VGA" is the wrong term for the graphic console. Maybe there is the real front-end name available somewhere and could be used instead.

Quoted 9 lines
Quoted 6 lines

Will see if I find some time to look into this.

Is this also working properly under Windows? Otherwise we probably can't deprecate SDL - or would have to provide a native Windows GUI.

It should, but it doesn't right now most likely because of the glib event loop being broken on win32.

Sounds great.

Quoted 13 lines
Quoted 3 lines

As we have a menu now, I would suggest to add some handy monitor commands there as well, like reset or powerdown.

Absolutely. I wanted to start with something very simple though first.

Regards,

Anthony Liguori

Quoted 2 lines

Jan

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#21 lore raw
Quoted 85 lines · Jan Kiszka
Quoted 84 lines · Anthony Liguori
Quoted 82 lines · Jan Kiszka
Quoted 70 lines · Anthony Liguori

I realize UIs are the third rail of QEMU development, but over the years I've
gotten a lot of feedback from users about our UI. I think everyone struggles
with the SDL interface and its lack of discoverability but it's worse than I
think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack
of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect
system font settings which means we ignore if the user has configured large
print.

We also don't integrate at all with screen readers which means that for blind
users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with
limited dexterity (this is actually more common than you would think), they may
use an input device that only inputs one key at a time. Holding down two keys
at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK,
solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go
there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic
accessibility support. As a consequence, the UI is much more usable even for a
user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any
other languages
so I added a placeholder for a German translation. This can be
tested with

     LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

- Fixed the terminal size for VteTerminal widgets. I think the
behavior makes
sense now.
- Fixed lots of issues raised in review comments (see individual
patches)

Quoted 8 lines

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes.
I need to
work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older
VteTerminal widgets
yet.

Looks quite nice but still has some rough edges:
- full screen doesn't work, at least here

Quoted 7 lines
Quoted 1 line

How does it fail?

The window changes to resizable mode, but remains a decorated window.

Quoted 1 line

It works for me. What distro are you on?

OpenSUSE 11.4, gnome2.

Okay, I'll setup a system and test it out.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

- lacking support for auto-grabbing in absolute mouse mode

What do you mean by auto grabbing?

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

- unscaling (ctrl-alt-u) is lacking

Since we scale by 25% up and down, I figured it wasn't strictly necessary anymore because it's very easy to zoom back to the original size. It's easy enough to add though.

It's mandatory for usability IMHO. You find this "back to 1:1 view" in almost every application that supports scaling of its view, and we even have a pre-defined shortcut for it for some releases now.

I'll add it.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

- window not resizable (except in broken full-screen mode)

That's intentional.

And a mistake IMHO. Definitely for the text consoles, but one can also argue about the guest graphic console. I think Stefano once introduced this for some Xen use case, maybe he can comment on it.

If we added resize, I wouldn't want to scale-to-size. I find this behavior to be more trouble than it's worth. I'd want to render the VGA screen with a black border only scaling based on the zoom settings.

Quoted 2 lines

BTW, "VGA" is the wrong term for the graphic console. Maybe there is the real front-end name available somewhere and could be used instead.

Any suggestions? Display? Graphics?

Or were you thinking something like Cirrus VGA?

Regards,

Anthony Liguori

#22 lore raw
Quoted 10 lines · Anthony Liguori
Quoted 4 lines

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

This would be a usability regression. It is very unhandy to switch between grabbed and ungrabbed, specifically for alt-tab, when working with guests vs. host windows. Look e.g. at how rdeskop works in this regard. That's why I introduced this feature to QEMU, and I would not want to see it die again with the introduction of GTK.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

- window not resizable (except in broken full-screen mode)

That's intentional.

And a mistake IMHO. Definitely for the text consoles, but one can also argue about the guest graphic console. I think Stefano once introduced this for some Xen use case, maybe he can comment on it.

If we added resize, I wouldn't want to scale-to-size. I find this behavior to be more trouble than it's worth. I'd want to render the VGA screen with a black border only scaling based on the zoom settings.

OK for aspect-ratio-correct scaling of the guest view from my POV. And if there is a use case for the old behavior, we could still add a switch to the menu for selecting the scaling mode.

Quoted 7 lines
Quoted 3 lines

BTW, "VGA" is the wrong term for the graphic console. Maybe there is the real front-end name available somewhere and could be used instead.

Any suggestions? Display? Graphics?

Or were you thinking something like Cirrus VGA?

VGA is (mostly) x86. Also, we may once have multiple guest screens, maybe even multiple types of them. So picking up some telling front-end name would likely scale best.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#23 lore raw
Quoted 12 lines · Jan Kiszka
Quoted 10 lines · Anthony Liguori
Quoted 4 lines

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

Quoted 5 lines

This would be a usability regression. It is very unhandy to switch between grabbed and ungrabbed, specifically for alt-tab, when working with guests vs. host windows. Look e.g. at how rdeskop works in this regard. That's why I introduced this feature to QEMU, and I would not want to see it die again with the introduction of GTK.

I'll add a "Grab on Hover" menu item to enable the behavior. It's a good excuse to look at gconf to store GUI preferences too.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

- window not resizable (except in broken full-screen mode)

That's intentional.

And a mistake IMHO. Definitely for the text consoles, but one can also argue about the guest graphic console. I think Stefano once introduced this for some Xen use case, maybe he can comment on it.

Quoted 7 lines
Quoted 3 lines

If we added resize, I wouldn't want to scale-to-size. I find this behavior to be more trouble than it's worth. I'd want to render the VGA screen with a black border only scaling based on the zoom settings.

OK for aspect-ratio-correct scaling of the guest view from my POV. And if there is a use case for the old behavior, we could still add a switch to the menu for selecting the scaling mode.

Okay, I'll look into it.

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

BTW, "VGA" is the wrong term for the graphic console. Maybe there is the real front-end name available somewhere and could be used instead.

Any suggestions? Display? Graphics?

Or were you thinking something like Cirrus VGA?

VGA is (mostly) x86. Also, we may once have multiple guest screens, maybe even multiple types of them. So picking up some telling front-end name would likely scale best.

Display 0?

I think Monitor would be more natural but obviously that would conflict with the human monitor.

Regards,

Anthony Liguori

Quoted 2 lines

Jan

#24 lore raw
Quoted 13 lines · Anthony Liguori
Quoted 12 lines · Jan Kiszka
Quoted 10 lines · Anthony Liguori
Quoted 4 lines

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

Quoted 8 lines
Quoted 5 lines

This would be a usability regression. It is very unhandy to switch between grabbed and ungrabbed, specifically for alt-tab, when working with guests vs. host windows. Look e.g. at how rdeskop works in this regard. That's why I introduced this feature to QEMU, and I would not want to see it die again with the introduction of GTK.

I'll add a "Grab on Hover" menu item to enable the behavior. It's a good excuse to look at gconf to store GUI preferences too.

Perfect.

Quoted 26 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

- window not resizable (except in broken full-screen mode)

That's intentional.

And a mistake IMHO. Definitely for the text consoles, but one can also argue about the guest graphic console. I think Stefano once introduced this for some Xen use case, maybe he can comment on it.

Quoted 7 lines
Quoted 3 lines

If we added resize, I wouldn't want to scale-to-size. I find this behavior to be more trouble than it's worth. I'd want to render the VGA screen with a black border only scaling based on the zoom settings.

OK for aspect-ratio-correct scaling of the guest view from my POV. And if there is a use case for the old behavior, we could still add a switch to the menu for selecting the scaling mode.

Okay, I'll look into it.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

BTW, "VGA" is the wrong term for the graphic console. Maybe there is the real front-end name available somewhere and could be used instead.

Any suggestions? Display? Graphics?

Or were you thinking something like Cirrus VGA?

Quoted 8 lines
Quoted 3 lines

VGA is (mostly) x86. Also, we may once have multiple guest screens, maybe even multiple types of them. So picking up some telling front-end name would likely scale best.

Display 0?

I think Monitor would be more natural but obviously that would conflict with the human monitor.

It might also be something else than a "monitor" that visualizes guest graphic-like output.

Another effect I just noticed: The scroll position of the monitor console is not always properly restored when switching from other consoles. Looks like it can move down, leaving the visible range after some switches.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#25 lore raw
In reply to Anthony Liguori

Hi,

Quoted 11 lines
Quoted 4 lines

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

Same is true the other way around. Working in the guest, then have the host desktop grab accelerators can be annoying too. You might have wanted switch *guest* windows with alt tab ;)

It is a tricky usability issue.

cheers,
Gerd

#26 lore raw
Quoted 14 lines · Gerd Hoffmann
   Hi,
Quoted 11 lines
Quoted 4 lines

That all keyboard inputs are grabbed when the mouse is in the window and you don't need to press ctrl-alt-g explicitly. And the reverse should happen when the mouse reaches the window border. Just like under SDL, give it a try.

Right, this was intentional. I think it's weird that a window would steal input when the mouse moves over it breaking desktop accelerators like alt tab. If you've ever alt-tab cycled through windows when QEMU is running, if you're unlucky enough to have the mouse where a QEMU window may be, the QEMU instance will steal input and prevent alt-tab from working anymore.

Quoted 5 lines

Same is true the other way around. Working in the guest, then have the host desktop grab accelerators can be annoying too. You might have wanted switch *guest* windows with alt tab ;)

It is a tricky usability issue.

Clearly, the GUI needs to read the user's mind to figure out what they meant to do :-)

I think a menu option at least let's the user choose the behavior. I think that's the best we're going to be able to do.

Regards,

Anthony Liguori

Quoted 3 lines

cheers,
Gerd

#27 lore raw

Hi,

Quoted 2 lines

Clearly, the GUI needs to read the user's mind to figure out what they meant to do :-)

Fine with me. /me looks forward reviewing patches.

cheers,
Gerd

#28 lore raw
In reply to Anthony Liguori

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 38 lines

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

Quoted 7 lines

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

Looks like I need to 'make install' before I can use the translations? I don't have any qemu version installed into the system, but always run it from to build directory (I would only confuse the different trees if something was installed). Shouldn't it be possible that qemu finds the right files just like it does with the BIOS etc.?

Quoted 10 lines

- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

- F10 still activates the menu (same for Alt-F/V)

Kevin

#29 lore raw
Quoted 47 lines · Kevin Wolf

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 38 lines

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

Quoted 7 lines

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

Quoted 5 lines

Looks like I need to 'make install' before I can use the translations? I don't have any qemu version installed into the system, but always run it from to build directory (I would only confuse the different trees if something was installed). Shouldn't it be possible that qemu finds the right files just like it does with the BIOS etc.?

It's a little harder because of the way gettext works. You can only have a single search path AFAICT.

We could add a --with-localedir= to configure and then rearrange the po/ structure. Then you would do something like:

./configure --with-localedir=$(pwd)/po

And it would use translations from your build directory.

Quoted 4 lines
Quoted 4 lines

- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Quoted 8 lines
Quoted 6 lines

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

- F10 still activates the menu (same for Alt-F/V)

This is expected behavior although Grab on Hover will cause it to behave like SDL does.

F10/Alt-F/V are menu accelerators and we need to allow menu accelerators for things like Ctrl-Alt-2 to work.

More importantly, it should be possible to navigate the GUI without a mouse (this is an accessibility requirement). Without supporting Alt-F, there's no way to navigate the menu from the keyboard.

That said, we probably do want to add a Send Key menu for sending key sequences that are used as accelerators.

Regards,

Anthony Liguo

Quoted 3 lines

Kevin

#30 lore raw

Am 27.02.2012 15:39, schrieb Anthony Liguori:

Quoted 57 lines · Kevin Wolf
Quoted 47 lines

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 38 lines

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

Quoted 7 lines

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64

Quoted 5 lines

Looks like I need to 'make install' before I can use the translations? I don't have any qemu version installed into the system, but always run it from to build directory (I would only confuse the different trees if something was installed). Shouldn't it be possible that qemu finds the right files just like it does with the BIOS etc.?

It's a little harder because of the way gettext works. You can only have a single search path AFAICT.

Quoted 6 lines

We could add a --with-localedir= to configure and then rearrange the po/ structure. Then you would do something like:

./configure --with-localedir=$(pwd)/po

And it would use translations from your build directory.

Yeah, would be better than nothing.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

- Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets yet.

Quoted 4 lines
Quoted 1 line

- F10 still activates the menu (same for Alt-F/V)

This is expected behavior although Grab on Hover will cause it to behave like SDL does.

At least grabbing the keyboard manually with Ctrl-Alt-G doesn't disable the accelerators, so even then you can't use these keys inside the VM.

Quoted 9 lines

F10/Alt-F/V are menu accelerators and we need to allow menu accelerators for things like Ctrl-Alt-2 to work.

More importantly, it should be possible to navigate the GUI without a mouse (this is an accessibility requirement). Without supporting Alt-F, there's no way to navigate the menu from the keyboard.

That said, we probably do want to add a Send Key menu for sending key sequences that are used as accelerators.

Probably. But not for things as common as Alt-F, Alt-V or F10. Having to use sendkey or the menus for these would be ridiculous and make SDL the friendlier user interface again.

Can accelerators only be enabled or disabled all at once? Or could we say that we disable everything that doesn't include Ctrl-Alt and provide an alternative accelerator for activating the menu, like Ctrl_Alt-M?

Kevin

#31 lore raw
In reply to Anthony Liguori

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 51 lines

I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools.

The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators.

Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print.

We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist.

We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users.

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems.

By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface).

I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about.

This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win.

Also available at:

https://github.com/aliguori/qemu/tree/gtk.2

---
v1 -> v2
- Add internationalization support. I don't actually speak any other languages
so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64
- Fixed the terminal size for VteTerminal widgets. I think the behavior makes
sense now.
- Fixed lots of issues raised in review comments (see individual patches)

Quoted 8 lines

Known Issues:
- I saw the X crash once. I think it has to do with widget sizes. I need to
work harder to reproduce.
- I've not recreated the reported memory leak yet.
- I haven't added backwards compatibility code for older VteTerminal widgets
yet.

Hi Anthony,

are you still working on a new version of this patch series?

I suggest to commit a slightly modified version of v2 which adds the GTK UI as an optional user interface (only enabled by a configure option).

This makes testing easier and allows developers to send patches which improve the new UI.

As soon as the GTK UI is considered stable and usable, the default could be changed from SDL to GTK.

Regards,
Stefan Weil

PS. Of course the committed patches should pass checkpatch.pl without errors.

#32 lore raw
Quoted 8 lines · Stefan Weil

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 7 lines

I realize UIs are the third rail of QEMU development, but over the years I've
gotten a lot of feedback from users about our UI. I think everyone struggles
with the SDL interface and its lack of discoverability but it's worse than I
think most people realize for users that rely on accessibility tools.

[...]

While I do think accessibility is important...

Quoted 4 lines
Quoted 4 lines

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK,
solve these problems.

GTK itself causes problems, because, it's not ported, thus not available, to all platforms QEMU can run on.

It's certainly not available on Haiku at least.

Of course, SDL itself is not really a good candidate to add a11y features, due to its framebuffer-based design...

Quoted 7 lines
Quoted 7 lines

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

Hmm the thing using libvte that uses /tmp to insecurely store terminal backlogs ? ;-)

[snip]

Quoted 2 lines

As soon as the GTK UI is considered stable and usable, the default could be changed from SDL to GTK.

Due to GTK not being as universally available as SDL, I'd really like not to.

François.

#33 lore raw

Am 11.03.2012 19:24, schrieb François Revol:

Quoted 37 lines · Stefan Weil
Quoted 8 lines

Am 27.02.2012 00:46, schrieb Anthony Liguori:

Quoted 7 lines

I realize UIs are the third rail of QEMU development, but over the years I've
gotten a lot of feedback from users about our UI. I think everyone struggles
with the SDL interface and its lack of discoverability but it's worse than I
think most people realize for users that rely on accessibility tools.

[...]

While I do think accessibility is important...

Quoted 4 lines
Quoted 4 lines

These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK,
solve these problems.

GTK itself causes problems, because, it's not ported, thus not available, to all platforms QEMU can run on.

It's certainly not available on Haiku at least.

Of course, SDL itself is not really a good candidate to add a11y features, due to its framebuffer-based design...

Quoted 7 lines
Quoted 7 lines

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

Hmm the thing using libvte that uses /tmp to insecurely store terminal backlogs ? ;-)

Quoted 8 lines

[snip]

Quoted 2 lines

As soon as the GTK UI is considered stable and usable, the default could be changed from SDL to GTK.

Due to GTK not being as universally available as SDL, I'd really like not to.

François.

Agreed. I should have been more precise. The default could be changed from SDL to GTK when GTK is available and working (this implies not for Haiku, not for compilation environments without the necessary GTK installation, and also not for Windows as long as the GTK UI freezes QEMU).

Stefan

#34 lore raw
In reply to François Revol
Quoted 4 lines · François Revol

GTK itself causes problems, because, it's not ported, thus not available, to all platforms QEMU can run on.

It's certainly not available on Haiku at least.

There is no perfect solution here. I think GTK is the best that's out there.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

Hmm the thing using libvte that uses /tmp to insecurely store terminal backlogs ? ;-)

Yeah, I saw it on a blog, it must be true!

Regards,

Anthony Liguori

Quoted 8 lines
Quoted 2 lines

As soon as the GTK UI is considered stable and usable, the default could be changed from SDL to GTK.

Due to GTK not being as universally available as SDL, I'd really like not to.

François.

#35 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 4 lines · François Revol

GTK itself causes problems, because, it's not ported, thus not available, to all platforms QEMU can run on.

It's certainly not available on Haiku at least.

There is no perfect solution here. I think GTK is the best that's out there.

Well as long as it's not mandatory...

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

Hmm the thing using libvte that uses /tmp to insecurely store terminal backlogs ? ;-)

Yeah, I saw it on a blog, it must be true!

Well it is true, just fill up your /tmp and see the backlog stop working in gnome-terminal. I did it unintentionally the other day... :P

François.

#36 lore raw
Quoted 19 lines · François Revol
Quoted 8 lines · Anthony Liguori
Quoted 4 lines · François Revol

GTK itself causes problems, because, it's not ported, thus not available, to all platforms QEMU can run on.

It's certainly not available on Haiku at least.

There is no perfect solution here. I think GTK is the best that's out there.

Well as long as it's not mandatory...

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

By using GTK, we can leverage VteTerminal for screen reader integration and font
configuration. We can also use GTK's accelerator support to make accelerators
configurable (Gnome provides a global accelerator configuration interface).

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Hmm the thing using libvte that uses /tmp to insecurely store terminal backlogs ? ;-)

Yeah, I saw it on a blog, it must be true!

Well it is true, just fill up your /tmp and see the backlog stop working in gnome-terminal. I did it unintentionally the other day... :P

The issue is viewing '/tmp' as "insecure". Per-user TMPDIR has existed almost for a decade now. Moreover, /tmp files can be created safely using the appropriate syscalls (which VTE uses).

If you're worried about securing your data and are surprised by the fact that /tmp isn't encrypted, you should be using full disk encryption because /tmp isn't the only place that needs to be worried about.

Regards,

Anthony Liguori

Quoted 3 lines

François.

#37 lore raw
In reply to Stefan Weil
Quoted 3 lines · Stefan Weil

Hi Anthony,

are you still working on a new version of this patch series?

Yeah, but this is purely a free time project which is in short supply these days :-)

Quoted 2 lines

I suggest to commit a slightly modified version of v2 which adds the GTK UI as an optional user interface (only enabled by a configure option).

The big thing I have on my TODO list is understanding what's happening with resizing. I'm actually in the process of upgrading to GTK3 so I hope I'll see the issues other people are having.

I'll try to get a new series out as soon as I have some free time.

Regards,

Anthony Liguori

Quoted 12 lines

This makes testing easier and allows developers to send patches which improve the new UI.

As soon as the GTK UI is considered stable and usable, the default could be changed from SDL to GTK.

Regards,
Stefan Weil

PS. Of course the committed patches should pass checkpatch.pl without errors.