Mercurial > sdl-ios-xcode
changeset 4528:f06faa886423
Fixed bug 1022
Fixed the X11 icon on 64-bit systems
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 17 Jul 2010 18:44:34 -0700 |
parents | 3ce59cbecaa3 |
children | 05ab4141ce93 |
files | src/video/x11/SDL_x11window.c |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11window.c Wed Jul 14 21:25:15 2010 -0700 +++ b/src/video/x11/SDL_x11window.c Sat Jul 17 18:44:34 2010 -0700 @@ -865,7 +865,7 @@ SDL_PixelFormat format; SDL_Surface *surface; int propsize; - Uint32 *propdata; + long *propdata; /* Convert the icon to ARGB for modern window managers */ SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, @@ -879,10 +879,19 @@ propsize = 2 + (icon->w * icon->h); propdata = SDL_malloc(propsize * sizeof(Uint32)); if (propdata) { + int x, y; + Uint32 *src; + long *dst; + propdata[0] = icon->w; propdata[1] = icon->h; - SDL_memcpy(&propdata[2], surface->pixels, - surface->h * surface->pitch); + dst = &propdata[2]; + for (y = 0; y < icon->h; ++y) { + src = (Uint32*)((Uint8*)surface->pixels + y * surface->pitch); + for (x = 0; x < icon->w; ++x) { + *dst++ = *src++; + } + } XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) propdata, propsize);