diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/i_video.c | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 8c69a161..f4565395 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -178,7 +178,7 @@ EXTRA_DIST = \ if HAVE_PYTHON -icon.c : ../data/doom.png +icon.c : ../data/doom.ico ../data/convert-icon $^ $@ endif diff --git a/src/i_video.c b/src/i_video.c index 66b9ccaf..7222d1b0 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -849,6 +849,23 @@ void I_SetWindowCaption(void) void I_SetWindowIcon(void) { SDL_Surface *surface; + Uint8 *mask; + int i; + + // Generate the mask + + mask = malloc(icon_w * icon_h / 8); + memset(mask, 0, icon_w * icon_h / 8); + + for (i=0; i<icon_w * icon_h; ++i) + { + if (icon_data[i * 3] != 0x00 + || icon_data[i * 3 + 1] != 0x00 + || icon_data[i * 3 + 2] != 0x00) + { + mask[i / 8] |= 1 << (7 - i % 8); + } + } surface = SDL_CreateRGBSurfaceFrom(icon_data, icon_w, @@ -860,8 +877,9 @@ void I_SetWindowIcon(void) 0xff << 16, 0); - SDL_WM_SetIcon(surface, NULL); + SDL_WM_SetIcon(surface, mask); SDL_FreeSurface(surface); + free(mask); } // Pick the modes list to use: |