Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11window.c @ 2213:59a667370c57
make indent
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Tue, 24 Jul 2007 18:46:45 +0000 |
parents | 9462f4408ecb |
children | e7164a4dac62 |
comparison
equal
deleted
inserted
replaced
2212:fdadda42d4d4 | 2213:59a667370c57 |
---|---|
182 xattr.background_pixel = 0; | 182 xattr.background_pixel = 0; |
183 xattr.border_pixel = 0; | 183 xattr.border_pixel = 0; |
184 if (visual->class == DirectColor || visual->class == PseudoColor) { | 184 if (visual->class == DirectColor || visual->class == PseudoColor) { |
185 int nmaps; | 185 int nmaps; |
186 XStandardColormap *stdmaps; | 186 XStandardColormap *stdmaps; |
187 int i; | |
188 Bool found = False; | 187 Bool found = False; |
189 | 188 |
189 /* check to see if the colormap we need already exists */ | |
190 if (0 != XGetRGBColormaps(data->display, | 190 if (0 != XGetRGBColormaps(data->display, |
191 RootWindow(data->display, | 191 RootWindow(data->display, |
192 displaydata->screen), &stdmaps, | 192 displaydata->screen), &stdmaps, |
193 &nmaps, XA_RGB_BEST_MAP)) { | 193 &nmaps, XA_RGB_BEST_MAP)) { |
194 int i; | |
194 for (i = 0; i < nmaps; i++) { | 195 for (i = 0; i < nmaps; i++) { |
195 if (stdmaps[i].visualid == visual->visualid) { | 196 if (stdmaps[i].visualid == visual->visualid) { |
196 xattr.colormap = stdmaps[i].colormap; | 197 xattr.colormap = stdmaps[i].colormap; |
198 X11_TrackColormap(data->display, displaydata->screen, | |
199 &stdmaps[i], visual); | |
197 found = True; | 200 found = True; |
198 break; | 201 break; |
199 } | 202 } |
200 } | 203 } |
201 XFree(stdmaps); | 204 XFree(stdmaps); |
202 } | 205 } |
206 | |
207 /* it doesn't exist, so create it */ | |
203 if (!found) { | 208 if (!found) { |
204 int max = visual->map_entries - 1; | 209 int max = visual->map_entries - 1; |
205 XStandardColormap *cmap = | 210 XStandardColormap *cmap = |
206 XmuStandardColormap(data->display, displaydata->screen, | 211 XmuStandardColormap(data->display, displaydata->screen, |
207 visual->visualid, depth, | 212 visual->visualid, depth, |
208 XA_RGB_BEST_MAP, None, | 213 XA_RGB_BEST_MAP, None, |
209 max, max, max); | 214 max, max, max); |
210 if (cmap->visualid = visual->visualid) { | 215 if (NULL != cmap && cmap->visualid == visual->visualid) { |
211 xattr.colormap = cmap->colormap; | 216 xattr.colormap = cmap->colormap; |
217 X11_TrackColormap(data->display, displaydata->screen, cmap, | |
218 visual); | |
212 } else { | 219 } else { |
213 SDL_SetError | 220 SDL_SetError |
214 ("Couldn't create window:XA_RGB_BEST_MAP not found"); | 221 ("Couldn't create window:XA_RGB_BEST_MAP not found"); |
215 return -1; | 222 return -1; |
216 } | 223 } |