From a8260d3876389eb52ca5c62ed4d80cdb7e025c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 10 Jan 2019 12:00:45 +0000 Subject: ui: install logo icons to $prefix/share/icons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Message-id: 20190110120047.25369-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 17 +- ui/icons/Makefile | 13 + ui/icons/qemu.svg | 976 ++++++++++++++++++++++++++++++++++++++++++++++ ui/icons/qemu_128x128.png | Bin 0 -> 8286 bytes ui/icons/qemu_16x16.png | Bin 0 -> 765 bytes ui/icons/qemu_24x24.png | Bin 0 -> 1201 bytes ui/icons/qemu_256x256.png | Bin 0 -> 17572 bytes ui/icons/qemu_32x32.bmp | Bin 0 -> 4234 bytes ui/icons/qemu_32x32.png | Bin 0 -> 1696 bytes ui/icons/qemu_48x48.png | Bin 0 -> 2694 bytes ui/icons/qemu_512x512.png | Bin 0 -> 38007 bytes ui/icons/qemu_64x64.png | Bin 0 -> 3807 bytes ui/sdl2.c | 16 +- 13 files changed, 1000 insertions(+), 22 deletions(-) create mode 100644 ui/icons/Makefile create mode 100644 ui/icons/qemu.svg create mode 100644 ui/icons/qemu_128x128.png create mode 100644 ui/icons/qemu_16x16.png create mode 100644 ui/icons/qemu_24x24.png create mode 100644 ui/icons/qemu_256x256.png create mode 100644 ui/icons/qemu_32x32.bmp create mode 100644 ui/icons/qemu_32x32.png create mode 100644 ui/icons/qemu_48x48.png create mode 100644 ui/icons/qemu_512x512.png create mode 100644 ui/icons/qemu_64x64.png (limited to 'ui') diff --git a/ui/gtk.c b/ui/gtk.c index 579990b865..ec63befa16 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -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/ui/icons/qemu.svg b/ui/icons/qemu.svg new file mode 100644 index 0000000000..24ca23a1e9 --- /dev/null +++ b/ui/icons/qemu.svg @@ -0,0 +1,976 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ui/icons/qemu_128x128.png b/ui/icons/qemu_128x128.png new file mode 100644 index 0000000000..96831807ba Binary files /dev/null and b/ui/icons/qemu_128x128.png differ diff --git a/ui/icons/qemu_16x16.png b/ui/icons/qemu_16x16.png new file mode 100644 index 0000000000..ff4f046024 Binary files /dev/null and b/ui/icons/qemu_16x16.png differ diff --git a/ui/icons/qemu_24x24.png b/ui/icons/qemu_24x24.png new file mode 100644 index 0000000000..f039c6e25d Binary files /dev/null and b/ui/icons/qemu_24x24.png differ diff --git a/ui/icons/qemu_256x256.png b/ui/icons/qemu_256x256.png new file mode 100644 index 0000000000..a39c0e307e Binary files /dev/null and b/ui/icons/qemu_256x256.png differ diff --git a/ui/icons/qemu_32x32.bmp b/ui/icons/qemu_32x32.bmp new file mode 100644 index 0000000000..c0daa54abe Binary files /dev/null and b/ui/icons/qemu_32x32.bmp differ diff --git a/ui/icons/qemu_32x32.png b/ui/icons/qemu_32x32.png new file mode 100644 index 0000000000..b746096cf8 Binary files /dev/null and b/ui/icons/qemu_32x32.png differ diff --git a/ui/icons/qemu_48x48.png b/ui/icons/qemu_48x48.png new file mode 100644 index 0000000000..067281225d Binary files /dev/null and b/ui/icons/qemu_48x48.png differ diff --git a/ui/icons/qemu_512x512.png b/ui/icons/qemu_512x512.png new file mode 100644 index 0000000000..86aaa6395f Binary files /dev/null and b/ui/icons/qemu_512x512.png differ diff --git a/ui/icons/qemu_64x64.png b/ui/icons/qemu_64x64.png new file mode 100644 index 0000000000..e00c8b4c9b Binary files /dev/null and b/ui/icons/qemu_64x64.png differ diff --git a/ui/sdl2.c b/ui/sdl2.c index a10b6e3a08..4c0d5db473 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -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; -- cgit v1.2.3