comparison src/video/x11/SDL_x11wm.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
91 dcmap = DefaultColormap(SDL_Display, SDL_Screen); 91 dcmap = DefaultColormap(SDL_Display, SDL_Screen);
92 if(icon->format->palette) { 92 if(icon->format->palette) {
93 /* The icon has a palette as well - we just have to 93 /* The icon has a palette as well - we just have to
94 find those colours */ 94 find those colours */
95 nwant = icon->format->palette->ncolors; 95 nwant = icon->format->palette->ncolors;
96 memcpy(want, icon->format->palette->colors, 96 SDL_memcpy(want, icon->format->palette->colors,
97 nwant * sizeof want[0]); 97 nwant * sizeof want[0]);
98 } else { 98 } else {
99 /* try the standard 6x6x6 cube for lack of better 99 /* try the standard 6x6x6 cube for lack of better
100 ideas */ 100 ideas */
101 int r, g, b, i; 101 int r, g, b, i;
119 } 119 }
120 } 120 }
121 pXFreeColors(GFX_Display, dcmap, freelist, nfree, 0); 121 pXFreeColors(GFX_Display, dcmap, freelist, nfree, 0);
122 } 122 }
123 if(!SDL_iconcolors) 123 if(!SDL_iconcolors)
124 SDL_iconcolors = malloc(256 * sizeof *SDL_iconcolors); 124 SDL_iconcolors = SDL_malloc(256 * sizeof *SDL_iconcolors);
125 memset(SDL_iconcolors, 0, 256 * sizeof *SDL_iconcolors); 125 SDL_memset(SDL_iconcolors, 0, 256 * sizeof *SDL_iconcolors);
126 126
127 /* try to allocate the colours */ 127 /* try to allocate the colours */
128 memset(got, 0, sizeof got); 128 SDL_memset(got, 0, sizeof got);
129 missing = 0; 129 missing = 0;
130 for(i = 0; i < nwant; i++) { 130 for(i = 0; i < nwant; i++) {
131 XColor c; 131 XColor c;
132 c.red = want[i].r << 8; 132 c.red = want[i].r << 8;
133 c.green = want[i].g << 8; 133 c.green = want[i].g << 8;
177 goto done; 177 goto done;
178 178
179 /* We need the mask as given, except in LSBfirst format instead of 179 /* We need the mask as given, except in LSBfirst format instead of
180 MSBfirst. Reverse the bits in each byte. */ 180 MSBfirst. Reverse the bits in each byte. */
181 masksize = ((sicon->w + 7) >> 3) * sicon->h; 181 masksize = ((sicon->w + 7) >> 3) * sicon->h;
182 LSBmask = malloc(masksize); 182 LSBmask = SDL_malloc(masksize);
183 if ( LSBmask == NULL ) { 183 if ( LSBmask == NULL ) {
184 goto done; 184 goto done;
185 } 185 }
186 memset(LSBmask, 0, masksize); 186 SDL_memset(LSBmask, 0, masksize);
187 for(i = 0; i < masksize; i++) 187 for(i = 0; i < masksize; i++)
188 LSBmask[i] = reverse_byte(mask[i]); 188 LSBmask[i] = reverse_byte(mask[i]);
189 mask_pixmap = pXCreatePixmapFromBitmapData(SDL_Display, WMwindow, 189 mask_pixmap = pXCreatePixmapFromBitmapData(SDL_Display, WMwindow,
190 (char *)LSBmask, 190 (char *)LSBmask,
191 sicon->w, sicon->h, 191 sicon->w, sicon->h,
205 gc = pXCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues); 205 gc = pXCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
206 pXPutImage(SDL_Display, icon_pixmap, gc, icon_image, 206 pXPutImage(SDL_Display, icon_pixmap, gc, icon_image,
207 0, 0, 0, 0, sicon->w, sicon->h); 207 0, 0, 0, 0, sicon->w, sicon->h);
208 pXFreeGC(SDL_Display, gc); 208 pXFreeGC(SDL_Display, gc);
209 pXDestroyImage(icon_image); 209 pXDestroyImage(icon_image);
210 free(LSBmask); 210 SDL_free(LSBmask);
211 sicon->pixels = NULL; 211 sicon->pixels = NULL;
212 212
213 /* Some buggy window managers (some versions of Enlightenment, it 213 /* Some buggy window managers (some versions of Enlightenment, it
214 seems) need an icon window *and* icon pixmap to work properly, while 214 seems) need an icon window *and* icon pixmap to work properly, while
215 it screws up others. The default is only to use a pixmap. */ 215 it screws up others. The default is only to use a pixmap. */
216 p = getenv("SDL_VIDEO_X11_ICONWIN"); 216 p = SDL_getenv("SDL_VIDEO_X11_ICONWIN");
217 if(p && *p) { 217 if(p && *p) {
218 icon_window = pXCreateSimpleWindow(SDL_Display, SDL_Root, 218 icon_window = pXCreateSimpleWindow(SDL_Display, SDL_Root,
219 0, 0, sicon->w, sicon->h, 0, 219 0, 0, sicon->w, sicon->h, 0,
220 CopyFromParent, 220 CopyFromParent,
221 CopyFromParent); 221 CopyFromParent);