summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDaniel P. Berrangé2019-01-10 13:00:47 +0100
committerGerd Hoffmann2019-01-21 09:43:13 +0100
commita442fe2f2b2f20e7be0934277e9400b844b11999 (patch)
treeb0104c4e31de4df8e5e6428b57957c4c52019177 /ui
parentui: fix icon display for GTK frontend under GNOME Shell with Wayland (diff)
downloadqemu-a442fe2f2b2f20e7be0934277e9400b844b11999.tar.gz
qemu-a442fe2f2b2f20e7be0934277e9400b844b11999.tar.xz
qemu-a442fe2f2b2f20e7be0934277e9400b844b11999.zip
sdl: add support for high resolution window icon
Modern desktop environments can render icons at very large sizes, especially with high DPI screens. Providing a 32x32 pixel bitmap is nowhere near sufficient anymore. When displayed in GNOME shell the QEMU icon looks awful, having been scaled up to at least x4 its base size. This is compounded by the fact that the BMP file doesn't do transparency, so while we've removed white pixels, we still have anti-aliased nearly-white pixels which make the logo look appalling on black backgrounds. Loading a high resolution PNG icon addresses both problems, but requires use of the extra SDL2_image library. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20190110120047.25369-4-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/sdl2.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 4c0d5db473..cde7feba91 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -764,6 +764,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
uint8_t data = 0;
int i;
SDL_SysWMinfo info;
+ SDL_Surface *icon = NULL;
assert(o->type == DISPLAY_TYPE_SDL);
@@ -835,13 +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. */
- 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);
+ 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;