aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl.c
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2011-02-16 21:15:40 +0100
committerAurelien Jarno <aurelien@aurel32.net>2011-04-01 21:53:57 +0200
commit09cec717bfaaaabd4c2789e480626ce70fdab204 (patch)
treec589db8955bc467b809b474aa473f4315af630d8 /ui/sdl.c
parentd818bfc5c34c59e9c6d03b3b9983bb5435967292 (diff)
downloadqemu-09cec717bfaaaabd4c2789e480626ce70fdab204.zip
qemu-09cec717bfaaaabd4c2789e480626ce70fdab204.tar.gz
qemu-09cec717bfaaaabd4c2789e480626ce70fdab204.tar.bz2
ui/sdl: Load optional QEMU icon
Load an optional QEMU icon file. If there is no icon file named qemu.bmp in QEMU's default search path, QEMU will run with the usual system default icon. A matching icon file will be loaded and used by X Windows managers or MS Windows while a QEMU instance is running. SDL requires icon files in 32x32x4 bmp format. Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'ui/sdl.c')
-rw-r--r--ui/sdl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/sdl.c b/ui/sdl.c
index c5bb0a3..dc5c3a1 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -812,6 +812,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
uint8_t data = 0;
DisplayAllocator *da;
const SDL_VideoInfo *vi;
+ char *filename;
#if defined(__APPLE__)
/* always use generic keymaps */
@@ -844,6 +845,18 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
vi = SDL_GetVideoInfo();
host_format = *(vi->vfmt);
+ /* 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_SRCCOLORKEY, colorkey);
+ SDL_WM_SetIcon(image, NULL);
+ }
+ qemu_free(filename);
+ }
+
dcl = qemu_mallocz(sizeof(DisplayChangeListener));
dcl->dpy_update = sdl_update;
dcl->dpy_resize = sdl_resize;