Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11window.c @ 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 | a256e1dadf3f |
children | 9e73d17638d3 |
comparison
equal
deleted
inserted
replaced
4527:3ce59cbecaa3 | 4528:f06faa886423 |
---|---|
863 | 863 |
864 if (icon) { | 864 if (icon) { |
865 SDL_PixelFormat format; | 865 SDL_PixelFormat format; |
866 SDL_Surface *surface; | 866 SDL_Surface *surface; |
867 int propsize; | 867 int propsize; |
868 Uint32 *propdata; | 868 long *propdata; |
869 | 869 |
870 /* Convert the icon to ARGB for modern window managers */ | 870 /* Convert the icon to ARGB for modern window managers */ |
871 SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, | 871 SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, |
872 0xFF000000); | 872 0xFF000000); |
873 surface = SDL_ConvertSurface(icon, &format, 0); | 873 surface = SDL_ConvertSurface(icon, &format, 0); |
877 | 877 |
878 /* Set the _NET_WM_ICON property */ | 878 /* Set the _NET_WM_ICON property */ |
879 propsize = 2 + (icon->w * icon->h); | 879 propsize = 2 + (icon->w * icon->h); |
880 propdata = SDL_malloc(propsize * sizeof(Uint32)); | 880 propdata = SDL_malloc(propsize * sizeof(Uint32)); |
881 if (propdata) { | 881 if (propdata) { |
882 int x, y; | |
883 Uint32 *src; | |
884 long *dst; | |
885 | |
882 propdata[0] = icon->w; | 886 propdata[0] = icon->w; |
883 propdata[1] = icon->h; | 887 propdata[1] = icon->h; |
884 SDL_memcpy(&propdata[2], surface->pixels, | 888 dst = &propdata[2]; |
885 surface->h * surface->pitch); | 889 for (y = 0; y < icon->h; ++y) { |
890 src = (Uint32*)((Uint8*)surface->pixels + y * surface->pitch); | |
891 for (x = 0; x < icon->w; ++x) { | |
892 *dst++ = *src++; | |
893 } | |
894 } | |
886 XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL, | 895 XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL, |
887 32, PropModeReplace, (unsigned char *) propdata, | 896 32, PropModeReplace, (unsigned char *) propdata, |
888 propsize); | 897 propsize); |
889 } | 898 } |
890 SDL_FreeSurface(surface); | 899 SDL_FreeSurface(surface); |