Skip to content

Commit

Permalink
ui: add basic GTK gui (v5)
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-4-git-send-email-aliguori@us.ibm.com
  • Loading branch information
Anthony Liguori committed Feb 21, 2013
1 parent d82831d commit a4ccabc
Show file tree
Hide file tree
Showing 5 changed files with 615 additions and 0 deletions.
31 changes: 31 additions & 0 deletions configure
Expand Up @@ -226,6 +226,7 @@ coroutine=""
seccomp=""
glusterfs=""
virtio_blk_data_plane=""
gtk=""

# parse CC options first
for opt do
Expand Down Expand Up @@ -897,6 +898,10 @@ for opt do
;;
--enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
;;
--disable-gtk) gtk="no"
;;
--enable-gtk) gtk="yes"
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
Expand Down Expand Up @@ -1635,6 +1640,26 @@ if test "$sparse" != "no" ; then
fi
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
if test "$gtk" = "yes" ; then
feature_not_found "gtk"
fi
gtk="no"
fi
fi

##########################################
# SDL probe

Expand Down Expand Up @@ -3301,6 +3326,7 @@ if test "$darwin" = "yes" ; then
fi
echo "pixman $pixman"
echo "SDL support $sdl"
echo "GTK support $gtk"
echo "curses support $curses"
echo "curl support $curl"
echo "mingw32 support $mingw32"
Expand Down Expand Up @@ -3591,6 +3617,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
Expand Down
1 change: 1 addition & 0 deletions include/sysemu/sysemu.h
Expand Up @@ -89,6 +89,7 @@ typedef enum DisplayType
DT_DEFAULT,
DT_CURSES,
DT_SDL,
DT_GTK,
DT_NOGRAPHIC,
DT_NONE,
} DisplayType;
Expand Down
4 changes: 4 additions & 0 deletions include/ui/console.h
Expand Up @@ -487,4 +487,8 @@ void curses_display_init(DisplayState *ds, int full_screen);
int index_from_key(const char *key);
int index_from_keycode(int code);

/* gtk.c */
void early_gtk_display_init(void);
void gtk_display_init(DisplayState *ds);

#endif
3 changes: 3 additions & 0 deletions ui/Makefile.objs
Expand Up @@ -13,7 +13,10 @@ common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
common-obj-$(CONFIG_COCOA) += cocoa.o
common-obj-$(CONFIG_CURSES) += curses.o
common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
common-obj-$(CONFIG_GTK) += gtk.o

$(obj)/sdl.o $(obj)/sdl_zoom.o: QEMU_CFLAGS += $(SDL_CFLAGS)

$(obj)/cocoa.o: $(SRC_PATH)/$(obj)/cocoa.m

$(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)

0 comments on commit a4ccabc

Please sign in to comment.