src/video/x11/SDL_x11window.c
changeset 2990 502adab079a4
parent 2967 e4a469d6ddab
child 3009 546c022a9ae5
equal deleted inserted replaced
2989:aba5a5cc2e63 2990:502adab079a4
   657         SDL_Surface *surface;
   657         SDL_Surface *surface;
   658         int propsize;
   658         int propsize;
   659         Uint32 *propdata;
   659         Uint32 *propdata;
   660 
   660 
   661         /* Convert the icon to ARGB for modern window managers */
   661         /* Convert the icon to ARGB for modern window managers */
   662         SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
   662         SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
       
   663                        0xFF000000);
   663         surface = SDL_ConvertSurface(icon, &format, 0);
   664         surface = SDL_ConvertSurface(icon, &format, 0);
   664         if (!surface) {
   665         if (!surface) {
   665             return;
   666             return;
   666         }
   667         }
   667 
   668 
   668         /* Set the _NET_WM_ICON property */
   669         /* Set the _NET_WM_ICON property */
   669         propsize = 2+(icon->w*icon->h);
   670         propsize = 2 + (icon->w * icon->h);
   670         propdata = SDL_malloc(propsize * sizeof(Uint32));
   671         propdata = SDL_malloc(propsize * sizeof(Uint32));
   671         if (propdata) {
   672         if (propdata) {
   672             propdata[0] = icon->w;
   673             propdata[0] = icon->w;
   673             propdata[1] = icon->h;
   674             propdata[1] = icon->h;
   674             SDL_memcpy(&propdata[2], surface->pixels, surface->h*surface->pitch);
   675             SDL_memcpy(&propdata[2], surface->pixels,
   675             XChangeProperty(display, data->window, _NET_WM_ICON, 
   676                        surface->h * surface->pitch);
   676                             XA_CARDINAL, 32, PropModeReplace,
   677             XChangeProperty(display, data->window, _NET_WM_ICON, XA_CARDINAL,
   677                             (unsigned char *) propdata, propsize);
   678                             32, PropModeReplace, (unsigned char *) propdata,
       
   679                             propsize);
   678         }
   680         }
   679         SDL_FreeSurface(surface);
   681         SDL_FreeSurface(surface);
   680     } else {
   682     } else {
   681         XDeleteProperty(display, data->window, _NET_WM_ICON);
   683         XDeleteProperty(display, data->window, _NET_WM_ICON);
   682     }
   684     }