From 6e45d58cd32b973f93a6550d3254740f2aba4502 Mon Sep 17 00:00:00 2001 From: John Popplewell Date: Sun, 26 Sep 2004 01:55:04 +0000 Subject: [PATCH] Fix for missing icon on XP. Moved the call to seticon() and the underlying SDL_WM_SetIcon() to _before_ the first call of SDL_SetVideoMode() like it says in the docs. Fix for loss of icon transparency on win32. Discovered that using a NULL mask in the call to SDL_WM_SetIcon() restored the icon transparency. --- src/tuxpaint.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index a63571af9..08688fe83 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -4994,6 +4994,11 @@ void setup(int argc, char * argv[]) #endif + /* Set window icon and caption: */ + + seticon(); + SDL_WM_SetCaption("Tux Paint", "Tux Paint"); + /* Open Window: */ if (fullscreen) @@ -5101,12 +5106,6 @@ void setup(int argc, char * argv[]) - /* Set window icon and caption: */ - - seticon(); - SDL_WM_SetCaption("Tux Paint", "Tux Paint"); - - /* Create drawing canvas: */ canvas = SDL_CreateRGBSurface(screen->flags, @@ -5716,7 +5715,6 @@ void seticon(void) Uint8 * mask; SDL_Surface * icon; - /* Load icon into a surface: */ #ifndef WIN32 @@ -5735,21 +5733,21 @@ void seticon(void) } +#ifndef WIN32 /* Create mask: */ - masklen = (((icon -> w) + 7) / 8) * (icon -> h); mask = malloc(masklen * sizeof(Uint8)); memset(mask, 0xFF, masklen); - /* Set icon: */ - SDL_WM_SetIcon(icon, mask); - /* Free icon surface & mask: */ - free(mask); +#else + /* Set icon: */ + SDL_WM_SetIcon(icon, NULL); +#endif SDL_FreeSurface(icon);