Message ID | 1296240805-6264-1-git-send-email-weil@mail.berlios.de |
---|---|
State | Superseded |
Headers | show |
Hi Stefan, Am 28.01.2011 um 19:53 schrieb Stefan Weil: > Load an optional QEMU icon file. If there is no icon file named > qemu-icon.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 32x32 bmp format. > > v2: > The first version of this patch also included qemu-icon.bmp > and rules to handle this file. That part will now be published > in a separate patch as soon as the QEMU community has chosen > a common QEMU icon. The SDL code here is useful to try > different icons. > > Cc: Anthony Liguori <aliguori@us.ibm.com> > Signed-off-by: Stefan Weil <weil@mail.berlios.de> Might to explain this in more detail, please? A .bmp file is a device- independent bitmap. The whole point of Windows' icon format was to be device-dependent from 16x16 to 64x64 (or 128x128?) resolution and 2- to 32-bit color spaces. So what does SDL do with it, and if SDL is limiting us here can't we add a .ico file and call the corresponding Win32 API function directly instead? Regards, Andreas
Am 29.01.2011 13:43, schrieb Andreas Färber: > Hi Stefan, > > Am 28.01.2011 um 19:53 schrieb Stefan Weil: > >> Load an optional QEMU icon file. If there is no icon file named >> qemu-icon.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 32x32 bmp format. >> >> v2: >> The first version of this patch also included qemu-icon.bmp >> and rules to handle this file. That part will now be published >> in a separate patch as soon as the QEMU community has chosen >> a common QEMU icon. The SDL code here is useful to try >> different icons. >> >> Cc: Anthony Liguori <aliguori@us.ibm.com> >> Signed-off-by: Stefan Weil <weil@mail.berlios.de> > > Might to explain this in more detail, please? A .bmp file is a > device-independent bitmap. The whole point of Windows' icon format was > to be device-dependent from 16x16 to 64x64 (or 128x128?) resolution > and 2- to 32-bit color spaces. > > So what does SDL do with it, and if SDL is limiting us here can't we > add a .ico file and call the corresponding Win32 API function directly > instead? > > Regards, > Andreas Hi Andreas, SDL offers only one function to set the icon for the window manager. This function takes a SDL_Surface * parameter, and there is only one SDL function to get an SDL_Surface from a file: SDL_WM_SetIcon(SDL_LoadBMP(filename), NULL); See http://www.libsdl.org/docs/html/sdlwmseticon.html and http://www.libsdl.org/docs/html/sdlloadbmp.html for details. Of course it is also possible to use another API to set the icon, but this would require different code for X, Win32, MacOS (?) and maybe others. The SDL solution is very simple and works sufficiently good, so I don't think we need support for the native APIs even if they might result in slightly better looking icons. Regards, Stefan
different icons. Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> --- ui/sdl.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index f599d42..37bc7de 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -818,6 +818,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 */ @@ -846,6 +847,12 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) vi = SDL_GetVideoInfo(); host_format = *(vi->vfmt); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp"); + if (filename) { + SDL_WM_SetIcon(SDL_LoadBMP(filename), NULL); + qemu_free(filename); + } + dcl = qemu_mallocz(sizeof(DisplayChangeListener)); dcl->dpy_update = sdl_update; dcl->dpy_resize = sdl_resize;