Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190121-pull-re…
Browse files Browse the repository at this point in the history
…quest' into staging

ui: highres logo for sdl and gtk, bugfixes for vnc and egl.

# gpg: Signature made Mon 21 Jan 2019 14:11:39 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20190121-pull-request:
  egl-helpers.h: do not depend on X11 Window type, use EGLNativeWindowType
  vnc: detect and optimize pageflips
  sdl: add support for high resolution window icon
  ui: fix icon display for GTK frontend under GNOME Shell with Wayland
  ui: install logo icons to $prefix/share/icons

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jan 23, 2019
2 parents fcb700b + fbd57c7 commit f6b06fc
Show file tree
Hide file tree
Showing 22 changed files with 131 additions and 30 deletions.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \
efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
efi-e1000e.rom efi-vmxnet3.rom \
qemu-icon.bmp qemu_logo_no_text.svg \
bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \
s390-ccw.img s390-netboot.img \
Expand Down Expand Up @@ -722,6 +721,7 @@ ifneq (,$(findstring qemu-ga,$(TOOLS)))
endif
endif

ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512

install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
ifneq ($(TOOLS),)
Expand All @@ -743,6 +743,20 @@ ifneq ($(BLOBS),)
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
done
endif
for s in $(ICON_SIZES); do \
mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
"$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
done; \
mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps"; \
$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
"$(DESTDIR)/$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps"; \
$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
"$(DESTDIR)/$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
mkdir -p "$(DESTDIR)/$(qemu_desktopdir)"
$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
"$(DESTDIR)/$(qemu_desktopdir)/qemu.desktop"
ifdef CONFIG_GTK
$(MAKE) -C po $@
endif
Expand Down
47 changes: 47 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ fdt=""
netmap="no"
sdl=""
sdlabi=""
sdl_image=""
virtfs=""
mpath=""
vnc="yes"
Expand Down Expand Up @@ -1045,6 +1046,10 @@ for opt do
;;
--with-sdlabi=*) sdlabi="$optarg"
;;
--disable-sdl-image) sdl_image="no"
;;
--enable-sdl-image) sdl_image="yes"
;;
--disable-qom-cast-debug) qom_cast_debug="no"
;;
--enable-qom-cast-debug) qom_cast_debug="yes"
Expand Down Expand Up @@ -1707,6 +1712,7 @@ disabled with --disable-FEATURE, default is enabled if available:
gcrypt libgcrypt cryptography support
sdl SDL UI
--with-sdlabi select preferred SDL ABI 1.2 or 2.0
sdl_image SDL Image support for icons
gtk gtk UI
vte vte support for the gtk UI
curses curses UI
Expand Down Expand Up @@ -3008,10 +3014,43 @@ EOF
fi # sdl compile test
}

sdl_image_probe ()
{
if test "$sdl_image" != "no" ; then
if $pkg_config SDL2_image --exists; then
if test "$static" = "yes"; then
sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null)
else
sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null)
fi
sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null)
sdl_image=yes

sdl_cflags="$sdl_cflags $sdl_image_cflags"
sdl_libs="$sdl_libs $sdl_image_libs"
else
if test "$sdl_image" = "yes" ; then
feature_not_found "sdl_image" "Install SDL Image devel"
else
sdl_image=no
fi
fi
fi
}

if test "$sdl" != "no" ; then
sdl_probe
fi

if test "$sdl" = "yes" ; then
sdl_image_probe
else
if test "$sdl_image" = "yes"; then
echo "warning: SDL Image requested, but SDL is not available, disabling"
fi
sdl_image=no
fi

if test "$sdl" = "yes" ; then
cat > $TMPC <<EOF
#include <SDL.h>
Expand Down Expand Up @@ -5751,6 +5790,8 @@ qemu_confdir=$sysconfdir$confsuffix
qemu_moddir=$libdir$confsuffix
qemu_datadir=$datadir$confsuffix
qemu_localedir="$datadir/locale"
qemu_icondir="$datadir/icons"
qemu_desktopdir="$datadir/applications"

# We can only support ivshmem if we have eventfd
if [ "$eventfd" = "yes" ]; then
Expand Down Expand Up @@ -6037,6 +6078,7 @@ if test "$darwin" = "yes" ; then
echo "Cocoa support $cocoa"
fi
echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
echo "SDL image support $sdl_image"
echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
echo "GTK GL support $gtk_gl"
echo "VTE support $vte $(echo_version $vte $vteversion)"
Expand Down Expand Up @@ -6220,6 +6262,8 @@ if test "$mingw32" = "no" ; then
fi
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
echo "qemu_icondir=$qemu_icondir" >> $config_host_mak
echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
echo "GIT=$git" >> $config_host_mak
echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
Expand Down Expand Up @@ -6374,6 +6418,9 @@ if test "$sdl" = "yes" ; then
echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
if test "$sdl_image" = "yes" ; then
echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak
fi
fi
if test "$cocoa" = "yes" ; then
echo "CONFIG_COCOA=y" >> $config_host_mak
Expand Down
2 changes: 1 addition & 1 deletion include/ui/egl-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);

#endif

EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win);

int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
Expand Down
3 changes: 3 additions & 0 deletions include/ui/sdl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include <SDL.h>
#include <SDL_syswm.h>
#ifdef CONFIG_SDL_IMAGE
# include <SDL_image.h>
#endif

#ifdef CONFIG_OPENGL
# include "ui/egl-helpers.h"
Expand Down
Binary file removed pc-bios/qemu-icon.bmp
Binary file not shown.
4 changes: 2 additions & 2 deletions ui/egl-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf)

/* ---------------------------------------------------------------------- */

EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win)
EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win)
{
EGLSurface esurface;
EGLBoolean b;

esurface = eglCreateWindowSurface(qemu_egl_display,
qemu_egl_config,
(EGLNativeWindowType)win, NULL);
win, NULL);
if (esurface == EGL_NO_SURFACE) {
error_report("egl: eglCreateWindowSurface failed");
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion ui/gtk-egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ void gd_egl_init(VirtualConsole *vc)
}

vc->gfx.ectx = qemu_egl_init_ctx();
vc->gfx.esurface = qemu_egl_init_surface_x11(vc->gfx.ectx, x11_window);
vc->gfx.esurface = qemu_egl_init_surface_x11
(vc->gfx.ectx, (EGLNativeWindowType)x11_window);

assert(vc->gfx.esurface);
}
Expand Down
18 changes: 6 additions & 12 deletions ui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2214,8 +2214,8 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
VirtualConsole *vc;

GtkDisplayState *s = g_malloc0(sizeof(*s));
char *filename;
GdkDisplay *window_display;
GtkIconTheme *theme;

if (!gtkinit) {
fprintf(stderr, "gtk initialization failed\n");
Expand All @@ -2224,6 +2224,10 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
assert(opts->type == DISPLAY_TYPE_GTK);
s->opts = opts;

theme = gtk_icon_theme_get_default();
gtk_icon_theme_prepend_search_path(theme, CONFIG_QEMU_ICONDIR);
g_set_prgname("qemu");

s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
s->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
s->notebook = gtk_notebook_new();
Expand All @@ -2248,17 +2252,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
qemu_add_mouse_mode_change_notifier(&s->mouse_mode_notifier);
qemu_add_vm_change_state_handler(gd_change_runstate, s);

filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu_logo_no_text.svg");
if (filename) {
GError *error = NULL;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if (pixbuf) {
gtk_window_set_icon(GTK_WINDOW(s->window), pixbuf);
} else {
g_error_free(error);
}
g_free(filename);
}
gtk_window_set_icon_name(GTK_WINDOW(s->window), "qemu");

gd_create_menus(s);

Expand Down
13 changes: 13 additions & 0 deletions ui/icons/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Regenerate bitmaps from the SVG using inkscape CLI export
# and ImageMagick. Don't use ImageMagick for the initial
# SVG conversion, since it merely calls inkscape, but uses
# 96 DPI res resulting in poor quality output.

regenerate:
for s in 16 24 32 48 64 128 256 512; \
do \
inkscape --without-gui --export-png=qemu_$${s}x$${s}.png \
--export-width=$$s --export-height=$$s qemu.svg ; \
done
convert qemu_32x32.png qemu_32x32.bmp
File renamed without changes
Binary file added ui/icons/qemu_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_32x32.bmp
Binary file not shown.
Binary file added ui/icons/qemu_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/qemu_64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions ui/qemu.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Version=1.0
Name=QEMU
Icon=qemu
Type=Application
Terminal=false
Keywords=Emulators;Virtualization;KVM;
NoDisplay=true
22 changes: 12 additions & 10 deletions ui/sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,9 @@ static void sdl2_display_early_init(DisplayOptions *o)
static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
{
uint8_t data = 0;
char *filename;
int i;
SDL_SysWMinfo info;
SDL_Surface *icon = NULL;

assert(o->type == DISPLAY_TYPE_SDL);

Expand Down Expand Up @@ -836,16 +836,18 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
#endif
}

#ifdef CONFIG_SDL_IMAGE
icon = IMG_Load(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
#else
/* Load a 32x32x4 image. White pixels are transparent. */
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");
if (filename) {
SDL_Surface *image = SDL_LoadBMP(filename);
if (image) {
uint32_t colorkey = SDL_MapRGB(image->format, 255, 255, 255);
SDL_SetColorKey(image, SDL_TRUE, colorkey);
SDL_SetWindowIcon(sdl2_console[0].real_window, image);
}
g_free(filename);
icon = SDL_LoadBMP(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
if (icon) {
uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
SDL_SetColorKey(icon, SDL_TRUE, colorkey);
}
#endif
if (icon) {
SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
}

gui_grab = 0;
Expand Down
25 changes: 22 additions & 3 deletions ui/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,25 @@ static void vnc_update_server_surface(VncDisplay *vd)
width, height);
}

static bool vnc_check_pageflip(DisplaySurface *s1,
DisplaySurface *s2)
{
return (s1 != NULL &&
s2 != NULL &&
surface_width(s1) == surface_width(s2) &&
surface_height(s1) == surface_height(s2) &&
surface_format(s1) == surface_format(s2));

}

static void vnc_dpy_switch(DisplayChangeListener *dcl,
DisplaySurface *surface)
{
static const char placeholder_msg[] =
"Display output is not active.";
static DisplaySurface *placeholder;
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
bool pageflip = vnc_check_pageflip(vd->ds, surface);
VncState *vs;

if (surface == NULL) {
Expand All @@ -761,14 +773,21 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
vnc_abort_display_jobs(vd);
vd->ds = surface;

/* server surface */
vnc_update_server_surface(vd);

/* guest surface */
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
vd->guest.format = surface->format;

if (pageflip) {
vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0,
surface_width(surface),
surface_height(surface));
return;
}

/* server surface */
vnc_update_server_surface(vd);

QTAILQ_FOREACH(vs, &vd->clients, next) {
vnc_colordepth(vs);
vnc_desktop_resize(vs);
Expand Down

0 comments on commit f6b06fc

Please sign in to comment.