ui: install logo icons to $prefix/share/icons

QEMU currently installs logos to $prefix/share/qemu/ which means no GUI
toolkit or applications can find them by default.

The accepted standards for desktop applications declare that application
logos / icons should be installed under $prefix/share/icons, so use this
directory location.

Pre-rendered icons are provided at the standard sizes expected for GUI
applications, along with the scalable SVG, to ensure maximum portability.

The PNGs are rendered from the SVG using inkscape, however, this is not
wired up into the default make rules to avoid requiring inkscape as a
mandatory tool in build systems / developer workstations.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20190110120047.25369-2-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-01-10 12:00:45 +00:00 committed by Gerd Hoffmann
parent 681d61362d
commit a8260d3876
16 changed files with 38 additions and 23 deletions

View File

@ -667,7 +667,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 \
@ -720,6 +719,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),)
@ -741,6 +741,17 @@ 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"
ifdef CONFIG_GTK
$(MAKE) -C po $@
endif

2
configure vendored
View File

@ -5745,6 +5745,7 @@ qemu_confdir=$sysconfdir$confsuffix
qemu_moddir=$libdir$confsuffix
qemu_datadir=$datadir$confsuffix
qemu_localedir="$datadir/locale"
qemu_icondir="$datadir/icons"
# We can only support ivshmem if we have eventfd
if [ "$eventfd" = "yes" ]; then
@ -6210,6 +6211,7 @@ 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 "libs_softmmu=$libs_softmmu" >> $config_host_mak
echo "GIT=$git" >> $config_host_mak
echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

View File

@ -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");
@ -2224,6 +2224,9 @@ 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);
s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
s->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
s->notebook = gtk_notebook_new();
@ -2248,17 +2251,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);

13
ui/icons/Makefile Normal file
View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

BIN
ui/icons/qemu_128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
ui/icons/qemu_16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

BIN
ui/icons/qemu_24x24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
ui/icons/qemu_256x256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
ui/icons/qemu_32x32.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
ui/icons/qemu_32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
ui/icons/qemu_48x48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
ui/icons/qemu_512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
ui/icons/qemu_64x64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -762,7 +762,6 @@ 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;
@ -837,16 +836,13 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
}
/* 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);
SDL_Surface *image = SDL_LoadBMP(CONFIG_QEMU_ICONDIR
"/hicolor/32x32/apps/qemu.bmp");
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);
}
gui_grab = 0;
if (gui_fullscreen) {