Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 1022
Fixed the X11 icon on 64-bit systems
  • Loading branch information
slouken committed Jul 18, 2010
1 parent 7fad52d commit a1e3927
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -865,7 +865,7 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
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,
Expand All @@ -879,10 +879,19 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
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);
Expand Down

0 comments on commit a1e3927

Please sign in to comment.