Commit b72ceb7a authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug 1022

Fixed the X11 icon on 64-bit systems
parent c1eb1e8f
...@@ -865,7 +865,7 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -865,7 +865,7 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
SDL_PixelFormat format; SDL_PixelFormat format;
SDL_Surface *surface; SDL_Surface *surface;
int propsize; int propsize;
Uint32 *propdata; long *propdata;
/* Convert the icon to ARGB for modern window managers */ /* Convert the icon to ARGB for modern window managers */
SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
...@@ -879,10 +879,19 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -879,10 +879,19 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
propsize = 2 + (icon->w * icon->h); propsize = 2 + (icon->w * icon->h);
propdata = SDL_malloc(propsize * sizeof(Uint32)); propdata = SDL_malloc(propsize * sizeof(Uint32));
if (propdata) { if (propdata) {
int x, y;
Uint32 *src;
long *dst;
propdata[0] = icon->w; propdata[0] = icon->w;
propdata[1] = icon->h; propdata[1] = icon->h;
SDL_memcpy(&propdata[2], surface->pixels, dst = &propdata[2];
surface->h * surface->pitch); 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, XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
32, PropModeReplace, (unsigned char *) propdata, 32, PropModeReplace, (unsigned char *) propdata,
propsize); propsize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment