diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2019-01-10 12:00:45 +0000 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-21 09:43:13 +0100 |
commit | a8260d3876389eb52ca5c62ed4d80cdb7e025c85 (patch) | |
tree | acf70c8ec9214f7c7560c180fbbc531ad75c830d | |
parent | 681d61362d3f766a00806b89d6581869041f73cb (diff) |
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>
-rw-r--r-- | Makefile | 13 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | pc-bios/qemu-icon.bmp | bin | 630 -> 0 bytes | |||
-rw-r--r-- | ui/gtk.c | 17 | ||||
-rw-r--r-- | ui/icons/Makefile | 13 | ||||
-rw-r--r-- | ui/icons/qemu.svg (renamed from pc-bios/qemu_logo_no_text.svg) | 0 | ||||
-rw-r--r-- | ui/icons/qemu_128x128.png | bin | 0 -> 8286 bytes | |||
-rw-r--r-- | ui/icons/qemu_16x16.png | bin | 0 -> 765 bytes | |||
-rw-r--r-- | ui/icons/qemu_24x24.png | bin | 0 -> 1201 bytes | |||
-rw-r--r-- | ui/icons/qemu_256x256.png | bin | 0 -> 17572 bytes | |||
-rw-r--r-- | ui/icons/qemu_32x32.bmp | bin | 0 -> 4234 bytes | |||
-rw-r--r-- | ui/icons/qemu_32x32.png | bin | 0 -> 1696 bytes | |||
-rw-r--r-- | ui/icons/qemu_48x48.png | bin | 0 -> 2694 bytes | |||
-rw-r--r-- | ui/icons/qemu_512x512.png | bin | 0 -> 38007 bytes | |||
-rw-r--r-- | ui/icons/qemu_64x64.png | bin | 0 -> 3807 bytes | |||
-rw-r--r-- | ui/sdl2.c | 16 |
16 files changed, 38 insertions, 23 deletions
@@ -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 @@ -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 diff --git a/pc-bios/qemu-icon.bmp b/pc-bios/qemu-icon.bmp Binary files differdeleted file mode 100644 index 72d9a2f561..0000000000 --- a/pc-bios/qemu-icon.bmp +++ /dev/null @@ -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); diff --git a/ui/icons/Makefile b/ui/icons/Makefile new file mode 100644 index 0000000000..20bd64ccce --- /dev/null +++ b/ui/icons/Makefile @@ -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 diff --git a/pc-bios/qemu_logo_no_text.svg b/ui/icons/qemu.svg index 24ca23a1e9..24ca23a1e9 100644 --- a/pc-bios/qemu_logo_no_text.svg +++ b/ui/icons/qemu.svg diff --git a/ui/icons/qemu_128x128.png b/ui/icons/qemu_128x128.png Binary files differnew file mode 100644 index 0000000000..96831807ba --- /dev/null +++ b/ui/icons/qemu_128x128.png diff --git a/ui/icons/qemu_16x16.png b/ui/icons/qemu_16x16.png Binary files differnew file mode 100644 index 0000000000..ff4f046024 --- /dev/null +++ b/ui/icons/qemu_16x16.png diff --git a/ui/icons/qemu_24x24.png b/ui/icons/qemu_24x24.png Binary files differnew file mode 100644 index 0000000000..f039c6e25d --- /dev/null +++ b/ui/icons/qemu_24x24.png diff --git a/ui/icons/qemu_256x256.png b/ui/icons/qemu_256x256.png Binary files differnew file mode 100644 index 0000000000..a39c0e307e --- /dev/null +++ b/ui/icons/qemu_256x256.png diff --git a/ui/icons/qemu_32x32.bmp b/ui/icons/qemu_32x32.bmp Binary files differnew file mode 100644 index 0000000000..c0daa54abe --- /dev/null +++ b/ui/icons/qemu_32x32.bmp diff --git a/ui/icons/qemu_32x32.png b/ui/icons/qemu_32x32.png Binary files differnew file mode 100644 index 0000000000..b746096cf8 --- /dev/null +++ b/ui/icons/qemu_32x32.png diff --git a/ui/icons/qemu_48x48.png b/ui/icons/qemu_48x48.png Binary files differnew file mode 100644 index 0000000000..067281225d --- /dev/null +++ b/ui/icons/qemu_48x48.png diff --git a/ui/icons/qemu_512x512.png b/ui/icons/qemu_512x512.png Binary files differnew file mode 100644 index 0000000000..86aaa6395f --- /dev/null +++ b/ui/icons/qemu_512x512.png diff --git a/ui/icons/qemu_64x64.png b/ui/icons/qemu_64x64.png Binary files differnew file mode 100644 index 0000000000..e00c8b4c9b --- /dev/null +++ b/ui/icons/qemu_64x64.png @@ -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,15 +836,12 @@ 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); - 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); + 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); } gui_grab = 0; |