Fixed bug 1022
authorSam Lantinga
Sat, 17 Jul 2010 18:44:34 -0700
changeset 4528f06faa886423
parent 4527 3ce59cbecaa3
child 4529 05ab4141ce93
Fixed bug 1022

Fixed the X11 icon on 64-bit systems
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11window.c	Wed Jul 14 21:25:15 2010 -0700
     1.2 +++ b/src/video/x11/SDL_x11window.c	Sat Jul 17 18:44:34 2010 -0700
     1.3 @@ -865,7 +865,7 @@
     1.4          SDL_PixelFormat format;
     1.5          SDL_Surface *surface;
     1.6          int propsize;
     1.7 -        Uint32 *propdata;
     1.8 +        long *propdata;
     1.9  
    1.10          /* Convert the icon to ARGB for modern window managers */
    1.11          SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
    1.12 @@ -879,10 +879,19 @@
    1.13          propsize = 2 + (icon->w * icon->h);
    1.14          propdata = SDL_malloc(propsize * sizeof(Uint32));
    1.15          if (propdata) {
    1.16 +            int x, y;
    1.17 +            Uint32 *src;
    1.18 +            long *dst;
    1.19 +
    1.20              propdata[0] = icon->w;
    1.21              propdata[1] = icon->h;
    1.22 -            SDL_memcpy(&propdata[2], surface->pixels,
    1.23 -                       surface->h * surface->pitch);
    1.24 +            dst = &propdata[2];
    1.25 +            for (y = 0; y < icon->h; ++y) {
    1.26 +                src = (Uint32*)((Uint8*)surface->pixels + y * surface->pitch);
    1.27 +                for (x = 0; x < icon->w; ++x) {
    1.28 +                    *dst++ = *src++;
    1.29 +                }
    1.30 +            }
    1.31              XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
    1.32                              32, PropModeReplace, (unsigned char *) propdata,
    1.33                              propsize);