Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_ph_video.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | e49147870aac |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
40 #include "SDL_ph_wm_c.h" | 40 #include "SDL_ph_wm_c.h" |
41 #include "SDL_ph_gl.h" | 41 #include "SDL_ph_gl.h" |
42 #include "SDL_phyuv_c.h" | 42 #include "SDL_phyuv_c.h" |
43 #include "../blank_cursor.h" | 43 #include "../blank_cursor.h" |
44 | 44 |
45 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat); | 45 static int ph_VideoInit (_THIS, SDL_PixelFormat * vformat); |
46 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | 46 static SDL_Surface *ph_SetVideoMode (_THIS, SDL_Surface * current, int width, |
47 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); | 47 int height, int bpp, Uint32 flags); |
48 static void ph_VideoQuit(_THIS); | 48 static int ph_SetColors (_THIS, int firstcolor, int ncolors, |
49 static void ph_DeleteDevice(SDL_VideoDevice *device); | 49 SDL_Color * colors); |
50 | 50 static void ph_VideoQuit (_THIS); |
51 static int phstatus=-1; | 51 static void ph_DeleteDevice (SDL_VideoDevice * device); |
52 | 52 |
53 static int ph_Available(void) | 53 static int phstatus = -1; |
54 { | 54 |
55 if (phstatus!=0) | 55 static int |
56 { | 56 ph_Available (void) |
57 phstatus=PtInit(NULL); | 57 { |
58 if (phstatus==0) | 58 if (phstatus != 0) { |
59 { | 59 phstatus = PtInit (NULL); |
60 return 1; | 60 if (phstatus == 0) { |
61 } | 61 return 1; |
62 else | 62 } else { |
63 { | 63 return 0; |
64 return 0; | |
65 } | 64 } |
66 } | 65 } |
67 return 1; | 66 return 1; |
68 } | 67 } |
69 | 68 |
70 static SDL_VideoDevice* ph_CreateDevice(int devindex) | 69 static SDL_VideoDevice * |
71 { | 70 ph_CreateDevice (int devindex) |
72 SDL_VideoDevice* device; | 71 { |
72 SDL_VideoDevice *device; | |
73 | 73 |
74 /* Initialize all variables that we clean on shutdown */ | 74 /* Initialize all variables that we clean on shutdown */ |
75 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); | 75 device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); |
76 if (device) | 76 if (device) { |
77 { | 77 SDL_memset (device, 0, (sizeof *device)); |
78 SDL_memset(device, 0, (sizeof *device)); | 78 device->hidden = (struct SDL_PrivateVideoData *) |
79 device->hidden = (struct SDL_PrivateVideoData*)SDL_malloc((sizeof *device->hidden)); | 79 SDL_malloc ((sizeof *device->hidden)); |
80 device->gl_data = NULL; | 80 device->gl_data = NULL; |
81 } | 81 } |
82 if ((device == NULL) || (device->hidden == NULL)) | 82 if ((device == NULL) || (device->hidden == NULL)) { |
83 { | 83 SDL_OutOfMemory (); |
84 SDL_OutOfMemory(); | 84 ph_DeleteDevice (device); |
85 ph_DeleteDevice(device); | |
86 return NULL; | 85 return NULL; |
87 } | 86 } |
88 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); | 87 SDL_memset (device->hidden, 0, (sizeof *device->hidden)); |
89 | 88 |
90 /* Set the driver flags */ | 89 /* Set the driver flags */ |
91 device->handles_any_size = 1; | 90 device->handles_any_size = 1; |
92 | 91 |
93 /* Set the function pointers */ | 92 /* Set the function pointers */ |
96 device->ListModes = ph_ListModes; | 95 device->ListModes = ph_ListModes; |
97 device->SetVideoMode = ph_SetVideoMode; | 96 device->SetVideoMode = ph_SetVideoMode; |
98 device->ToggleFullScreen = ph_ToggleFullScreen; | 97 device->ToggleFullScreen = ph_ToggleFullScreen; |
99 device->UpdateMouse = ph_UpdateMouse; | 98 device->UpdateMouse = ph_UpdateMouse; |
100 device->SetColors = ph_SetColors; | 99 device->SetColors = ph_SetColors; |
101 device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */ | 100 device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */ |
102 device->VideoQuit = ph_VideoQuit; | 101 device->VideoQuit = ph_VideoQuit; |
103 device->AllocHWSurface = ph_AllocHWSurface; | 102 device->AllocHWSurface = ph_AllocHWSurface; |
104 device->CheckHWBlit = ph_CheckHWBlit; | 103 device->CheckHWBlit = ph_CheckHWBlit; |
105 device->FillHWRect = ph_FillHWRect; | 104 device->FillHWRect = ph_FillHWRect; |
106 device->SetHWColorKey = ph_SetHWColorKey; | 105 device->SetHWColorKey = ph_SetHWColorKey; |
131 device->GL_LoadLibrary = ph_GL_LoadLibrary; | 130 device->GL_LoadLibrary = ph_GL_LoadLibrary; |
132 device->GL_GetProcAddress = ph_GL_GetProcAddress; | 131 device->GL_GetProcAddress = ph_GL_GetProcAddress; |
133 #endif /* SDL_VIDEO_OPENGL */ | 132 #endif /* SDL_VIDEO_OPENGL */ |
134 | 133 |
135 device->free = ph_DeleteDevice; | 134 device->free = ph_DeleteDevice; |
136 | 135 |
137 return device; | 136 return device; |
138 } | 137 } |
139 | 138 |
140 VideoBootStrap ph_bootstrap = { | 139 VideoBootStrap ph_bootstrap = { |
141 "photon", "QNX Photon video output", | 140 "photon", "QNX Photon video output", |
142 ph_Available, ph_CreateDevice | 141 ph_Available, ph_CreateDevice |
143 }; | 142 }; |
144 | 143 |
145 static void ph_DeleteDevice(SDL_VideoDevice *device) | 144 static void |
146 { | 145 ph_DeleteDevice (SDL_VideoDevice * device) |
147 if (device) | 146 { |
148 { | 147 if (device) { |
149 if (device->hidden) | 148 if (device->hidden) { |
150 { | 149 SDL_free (device->hidden); |
151 SDL_free(device->hidden); | |
152 device->hidden = NULL; | 150 device->hidden = NULL; |
153 } | 151 } |
154 if (device->gl_data) | 152 if (device->gl_data) { |
155 { | 153 SDL_free (device->gl_data); |
156 SDL_free(device->gl_data); | |
157 device->gl_data = NULL; | 154 device->gl_data = NULL; |
158 } | 155 } |
159 SDL_free(device); | 156 SDL_free (device); |
160 device = NULL; | 157 device = NULL; |
161 } | 158 } |
162 } | 159 } |
163 | 160 |
164 static PtWidget_t *ph_CreateWindow(_THIS) | 161 static PtWidget_t * |
162 ph_CreateWindow (_THIS) | |
165 { | 163 { |
166 PtWidget_t *widget; | 164 PtWidget_t *widget; |
167 | 165 |
168 widget = PtCreateWidget(PtWindow, NULL, 0, NULL); | 166 widget = PtCreateWidget (PtWindow, NULL, 0, NULL); |
169 | 167 |
170 return widget; | 168 return widget; |
171 } | 169 } |
172 | 170 |
173 static int ph_SetupWindow(_THIS, int w, int h, int flags) | 171 static int |
174 { | 172 ph_SetupWindow (_THIS, int w, int h, int flags) |
175 PtArg_t args[32]; | 173 { |
176 PhPoint_t pos = {0, 0}; | 174 PtArg_t args[32]; |
177 PhDim_t* olddim; | 175 PhPoint_t pos = { 0, 0 }; |
178 PhDim_t dim = {w, h}; | 176 PhDim_t *olddim; |
179 PhRect_t desktopextent; | 177 PhDim_t dim = { w, h }; |
180 int nargs = 0; | 178 PhRect_t desktopextent; |
181 const char* windowpos; | 179 int nargs = 0; |
182 const char* iscentered; | 180 const char *windowpos; |
183 int x, y; | 181 const char *iscentered; |
182 int x, y; | |
184 | 183 |
185 /* check if window size has been changed by Window Manager */ | 184 /* check if window size has been changed by Window Manager */ |
186 PtGetResource(window, Pt_ARG_DIM, &olddim, 0); | 185 PtGetResource (window, Pt_ARG_DIM, &olddim, 0); |
187 if ((olddim->w!=w) || (olddim->h!=h)) | 186 if ((olddim->w != w) || (olddim->h != h)) { |
188 { | 187 PtSetArg (&args[nargs++], Pt_ARG_DIM, &dim, 0); |
189 PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0); | 188 } |
190 } | 189 |
191 | 190 if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE) { |
192 if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE) | 191 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, |
193 { | 192 Ph_WM_CLOSE); |
194 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_CLOSE); | 193 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, |
195 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_RESIZE); | 194 Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_RESIZE); |
196 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_CLOSE | Ph_WM_MAX | Ph_WM_RESTORE); | 195 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, |
197 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); | 196 Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_CLOSE | Ph_WM_MAX | |
198 PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_TRUE, Pt_RESIZE_XY_AS_REQUIRED); | 197 Ph_WM_RESTORE); |
199 } | 198 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, |
200 else | 199 Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | |
201 { | 200 Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); |
202 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_CLOSE); | 201 PtSetArg (&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_TRUE, |
203 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE); | 202 Pt_RESIZE_XY_AS_REQUIRED); |
204 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_MOVE | Ph_WM_CLOSE); | 203 } else { |
205 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); | 204 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, |
206 PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED); | 205 Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_CLOSE); |
207 } | 206 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, |
208 | 207 Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE); |
209 if (((flags & SDL_NOFRAME)==SDL_NOFRAME) || ((flags & SDL_FULLSCREEN)==SDL_FULLSCREEN)) | 208 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, |
210 { | 209 Ph_WM_MOVE | Ph_WM_CLOSE); |
211 if ((flags & SDL_RESIZABLE) != SDL_RESIZABLE) | 210 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, |
212 { | 211 Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | |
213 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Pt_TRUE); | 212 Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); |
214 } | 213 PtSetArg (&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, |
215 else | 214 Pt_RESIZE_XY_AS_REQUIRED); |
216 { | 215 } |
217 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Pt_TRUE); | 216 |
218 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_BORDER); | 217 if (((flags & SDL_NOFRAME) == SDL_NOFRAME) |
219 } | 218 || ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)) { |
220 } | 219 if ((flags & SDL_RESIZABLE) != SDL_RESIZABLE) { |
221 else | 220 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, |
222 { | 221 Pt_FALSE, Pt_TRUE); |
223 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_BORDER | Ph_WM_RENDER_TITLE | | 222 } else { |
224 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_MENU | Ph_WM_RENDER_MIN); | 223 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, |
225 } | 224 Pt_FALSE, Pt_TRUE); |
226 | 225 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, |
227 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) | 226 Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_BORDER); |
228 { | 227 } |
229 PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); | 228 } else { |
230 PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL); | 229 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, |
231 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_FFRONT | Ph_WM_MAX | Ph_WM_TOFRONT | Ph_WM_CONSWITCH); | 230 Ph_WM_RENDER_BORDER | Ph_WM_RENDER_TITLE | |
232 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY); | 231 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_MENU | Ph_WM_RENDER_MIN); |
233 } | 232 } |
234 else | 233 |
235 { | 234 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { |
236 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_FFRONT | Ph_WM_CONSWITCH); | 235 PtSetArg (&args[nargs++], Pt_ARG_POS, &pos, 0); |
237 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFRONT); | 236 PtSetArg (&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, |
238 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY); | 237 Pt_BASIC_PREVENT_FILL); |
239 | 238 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, |
240 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) | 239 Ph_WM_FFRONT | Ph_WM_MAX | Ph_WM_TOFRONT | Ph_WM_CONSWITCH); |
241 { | 240 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, |
242 PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL); | 241 Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | |
243 } | 242 Ph_WM_STATE_ISALTKEY); |
244 else | 243 } else { |
245 { | 244 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, |
246 PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0); | 245 Ph_WM_FFRONT | Ph_WM_CONSWITCH); |
247 } | 246 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, |
248 if (!currently_maximized) | 247 Ph_WM_STATE_ISFRONT); |
249 { | 248 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, |
250 windowpos = SDL_getenv("SDL_VIDEO_WINDOW_POS"); | 249 Ph_WM_STATE_ISALTKEY); |
251 iscentered = SDL_getenv("SDL_VIDEO_CENTERED"); | 250 |
252 | 251 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) { |
253 if ((iscentered) || ((windowpos) && (SDL_strcmp(windowpos, "center")==0))) | 252 PtSetArg (&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, |
254 { | 253 Pt_BASIC_PREVENT_FILL); |
255 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent); | 254 } else { |
256 if (desktop_mode.width>w) | 255 PtSetArg (&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0); |
257 { | 256 } |
258 pos.x = (desktop_mode.width - w)/2; | 257 if (!currently_maximized) { |
258 windowpos = SDL_getenv ("SDL_VIDEO_WINDOW_POS"); | |
259 iscentered = SDL_getenv ("SDL_VIDEO_CENTERED"); | |
260 | |
261 if ((iscentered) | |
262 || ((windowpos) | |
263 && (SDL_strcmp (windowpos, "center") == 0))) { | |
264 PhWindowQueryVisible (Ph_QUERY_CONSOLE, 0, 0, &desktopextent); | |
265 if (desktop_mode.width > w) { | |
266 pos.x = (desktop_mode.width - w) / 2; | |
259 } | 267 } |
260 if (desktop_mode.height>h) | 268 if (desktop_mode.height > h) { |
261 { | 269 pos.y = (desktop_mode.height - h) / 2; |
262 pos.y = (desktop_mode.height - h)/2; | |
263 } | 270 } |
264 | 271 |
265 pos.x+=desktopextent.ul.x; | 272 pos.x += desktopextent.ul.x; |
266 pos.y+=desktopextent.ul.y; | 273 pos.y += desktopextent.ul.y; |
267 PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); | 274 PtSetArg (&args[nargs++], Pt_ARG_POS, &pos, 0); |
268 } | 275 } else { |
269 else | 276 if (windowpos) { |
270 { | 277 if (SDL_sscanf (windowpos, "%d,%d", &x, &y) == 2) { |
271 if (windowpos) | 278 if ((x < desktop_mode.width) |
272 { | 279 && (y < desktop_mode.height)) { |
273 if (SDL_sscanf(windowpos, "%d,%d", &x, &y) == 2) | 280 PhWindowQueryVisible |
274 { | 281 (Ph_QUERY_CONSOLE, 0, 0, &desktopextent); |
275 if ((x<desktop_mode.width) && (y<desktop_mode.height)) | 282 pos.x = x + desktopextent.ul.x; |
276 { | 283 pos.y = y + desktopextent.ul.y; |
277 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent); | |
278 pos.x=x+desktopextent.ul.x; | |
279 pos.y=y+desktopextent.ul.y; | |
280 } | 284 } |
281 PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); | 285 PtSetArg (&args[nargs++], Pt_ARG_POS, &pos, 0); |
282 } | 286 } |
283 } | 287 } |
284 } | 288 } |
285 } | 289 } |
286 | 290 |
287 /* if window is maximized render it as maximized */ | 291 /* if window is maximized render it as maximized */ |
288 if (currently_maximized) | 292 if (currently_maximized) { |
289 { | 293 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, |
290 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISMAX); | 294 Ph_WM_STATE_ISMAX); |
291 } | 295 } else { |
292 else | 296 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, |
293 { | 297 Ph_WM_STATE_ISMAX); |
294 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISMAX); | |
295 } | 298 } |
296 | 299 |
297 /* do not grab the keyboard by default */ | 300 /* do not grab the keyboard by default */ |
298 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY); | 301 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, |
302 Ph_WM_STATE_ISALTKEY); | |
299 | 303 |
300 /* bring the focus to the window */ | 304 /* bring the focus to the window */ |
301 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFOCUS); | 305 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, |
306 Ph_WM_STATE_ISFOCUS); | |
302 | 307 |
303 /* allow to catch hide event */ | 308 /* allow to catch hide event */ |
304 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_HIDE); | 309 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, |
305 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_HIDE); | 310 Ph_WM_HIDE); |
306 } | 311 PtSetArg (&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, |
307 | 312 Ph_WM_HIDE); |
308 PtSetResources(window, nargs, args); | 313 } |
309 PtRealizeWidget(window); | 314 |
310 PtWindowToFront(window); | 315 PtSetResources (window, nargs, args); |
311 | 316 PtRealizeWidget (window); |
312 #if 0 /* FIXME */ | 317 PtWindowToFront (window); |
313 PtGetResource(window, Pt_ARG_POS, &olddim, 0); | 318 |
314 fprintf(stderr, "POSITION: %d, %d\n", olddim->w, olddim->h); | 319 #if 0 /* FIXME */ |
320 PtGetResource (window, Pt_ARG_POS, &olddim, 0); | |
321 fprintf (stderr, "POSITION: %d, %d\n", olddim->w, olddim->h); | |
315 #endif | 322 #endif |
316 | 323 |
317 return 0; | 324 return 0; |
318 } | 325 } |
319 | 326 |
320 static const struct ColourMasks* ph_GetColourMasks(int bpp) | 327 static const struct ColourMasks * |
328 ph_GetColourMasks (int bpp) | |
321 { | 329 { |
322 /* The alpha mask doesn't appears to be needed */ | 330 /* The alpha mask doesn't appears to be needed */ |
323 static const struct ColourMasks phColorMasks[5] = { | 331 static const struct ColourMasks phColorMasks[5] = { |
324 /* 8 bit */ {0, 0, 0, 0, 8}, | 332 /* 8 bit */ {0, 0, 0, 0, 8}, |
325 /* 15 bit ARGB */ {0x7C00, 0x03E0, 0x001F, 0x8000, 15}, | 333 /* 15 bit ARGB */ {0x7C00, 0x03E0, 0x001F, 0x8000, 15}, |
326 /* 16 bit RGB */ {0xF800, 0x07E0, 0x001F, 0x0000, 16}, | 334 /* 16 bit RGB */ {0xF800, 0x07E0, 0x001F, 0x0000, 16}, |
327 /* 24 bit RGB */ {0xFF0000, 0x00FF00, 0x0000FF, 0x000000, 24}, | 335 /* 24 bit RGB */ {0xFF0000, 0x00FF00, 0x0000FF, 0x000000, 24}, |
328 /* 32 bit ARGB */ {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, 32}, | 336 /* 32 bit ARGB */ {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, |
337 32}, | |
329 }; | 338 }; |
330 | 339 |
331 switch (bpp) | 340 switch (bpp) { |
332 { | 341 case 8: |
333 case 8: | 342 return &phColorMasks[0]; |
334 return &phColorMasks[0]; | 343 case 15: |
335 case 15: | 344 return &phColorMasks[1]; |
336 return &phColorMasks[1]; | 345 case 16: |
337 case 16: | 346 return &phColorMasks[2]; |
338 return &phColorMasks[2]; | 347 case 24: |
339 case 24: | 348 return &phColorMasks[3]; |
340 return &phColorMasks[3]; | 349 case 32: |
341 case 32: | 350 return &phColorMasks[4]; |
342 return &phColorMasks[4]; | |
343 } | 351 } |
344 return NULL; | 352 return NULL; |
345 } | 353 } |
346 | 354 |
347 static int ph_VideoInit(_THIS, SDL_PixelFormat* vformat) | 355 static int |
356 ph_VideoInit (_THIS, SDL_PixelFormat * vformat) | |
348 { | 357 { |
349 PgHWCaps_t hwcaps; | 358 PgHWCaps_t hwcaps; |
350 int i; | 359 int i; |
351 | 360 |
352 window=NULL; | 361 window = NULL; |
353 desktoppal=SDLPH_PAL_NONE; | 362 desktoppal = SDLPH_PAL_NONE; |
354 | 363 |
355 #if SDL_VIDEO_OPENGL | 364 #if SDL_VIDEO_OPENGL |
356 oglctx=NULL; | 365 oglctx = NULL; |
357 oglbuffers=NULL; | 366 oglbuffers = NULL; |
358 oglflags=0; | 367 oglflags = 0; |
359 oglbpp=0; | 368 oglbpp = 0; |
360 #endif | 369 #endif |
361 | 370 |
362 old_video_mode=-1; | 371 old_video_mode = -1; |
363 old_refresh_rate=-1; | 372 old_refresh_rate = -1; |
364 | 373 |
365 if (NULL == (phevent = SDL_malloc(EVENT_SIZE))) | 374 if (NULL == (phevent = SDL_malloc (EVENT_SIZE))) { |
366 { | 375 SDL_OutOfMemory (); |
367 SDL_OutOfMemory(); | |
368 return -1; | 376 return -1; |
369 } | 377 } |
370 SDL_memset(phevent, 0x00, EVENT_SIZE); | 378 SDL_memset (phevent, 0x00, EVENT_SIZE); |
371 | 379 |
372 window = ph_CreateWindow(this); | 380 window = ph_CreateWindow (this); |
373 if (window == NULL) | 381 if (window == NULL) { |
374 { | 382 SDL_SetError ("ph_VideoInit(): Couldn't create video window !\n"); |
375 SDL_SetError("ph_VideoInit(): Couldn't create video window !\n"); | |
376 return -1; | 383 return -1; |
377 } | 384 } |
378 | 385 |
379 /* Create the blank cursor */ | 386 /* Create the blank cursor */ |
380 SDL_BlankCursor = this->CreateWMCursor(this, blank_cdata, blank_cmask, | 387 SDL_BlankCursor = this->CreateWMCursor (this, blank_cdata, blank_cmask, |
381 (int)BLANK_CWIDTH, (int)BLANK_CHEIGHT, | 388 (int) BLANK_CWIDTH, |
382 (int)BLANK_CHOTX, (int)BLANK_CHOTY); | 389 (int) BLANK_CHEIGHT, |
383 | 390 (int) BLANK_CHOTX, |
384 if (SDL_BlankCursor == NULL) | 391 (int) BLANK_CHOTY); |
385 { | 392 |
393 if (SDL_BlankCursor == NULL) { | |
386 return -1; | 394 return -1; |
387 } | 395 } |
388 | 396 |
389 if (PgGetGraphicsHWCaps(&hwcaps) < 0) | 397 if (PgGetGraphicsHWCaps (&hwcaps) < 0) { |
390 { | 398 SDL_SetError |
391 SDL_SetError("ph_VideoInit(): GetGraphicsHWCaps function failed !\n"); | 399 ("ph_VideoInit(): GetGraphicsHWCaps function failed !\n"); |
392 this->FreeWMCursor(this, SDL_BlankCursor); | 400 this->FreeWMCursor (this, SDL_BlankCursor); |
393 return -1; | 401 return -1; |
394 } | 402 } |
395 | 403 |
396 if (PgGetVideoModeInfo(hwcaps.current_video_mode, &desktop_mode) < 0) | 404 if (PgGetVideoModeInfo (hwcaps.current_video_mode, &desktop_mode) < 0) { |
397 { | 405 SDL_SetError |
398 SDL_SetError("ph_VideoInit(): PgGetVideoModeInfo function failed !\n"); | 406 ("ph_VideoInit(): PgGetVideoModeInfo function failed !\n"); |
399 this->FreeWMCursor(this, SDL_BlankCursor); | 407 this->FreeWMCursor (this, SDL_BlankCursor); |
400 return -1; | 408 return -1; |
401 } | 409 } |
402 | 410 |
403 /* Determine the current screen size */ | 411 /* Determine the current screen size */ |
404 this->info.current_w = desktop_mode.width; | 412 this->info.current_w = desktop_mode.width; |
405 this->info.current_h = desktop_mode.height; | 413 this->info.current_h = desktop_mode.height; |
406 | 414 |
407 /* We need to return BytesPerPixel as it in used by CreateRGBsurface */ | 415 /* We need to return BytesPerPixel as it in used by CreateRGBsurface */ |
408 vformat->BitsPerPixel = desktop_mode.bits_per_pixel; | 416 vformat->BitsPerPixel = desktop_mode.bits_per_pixel; |
409 vformat->BytesPerPixel = desktop_mode.bytes_per_scanline/desktop_mode.width; | 417 vformat->BytesPerPixel = |
418 desktop_mode.bytes_per_scanline / desktop_mode.width; | |
410 desktopbpp = desktop_mode.bits_per_pixel; | 419 desktopbpp = desktop_mode.bits_per_pixel; |
411 | 420 |
412 /* save current palette */ | 421 /* save current palette */ |
413 if (desktopbpp==8) | 422 if (desktopbpp == 8) { |
414 { | 423 PgGetPalette (savedpal); |
415 PgGetPalette(savedpal); | 424 PgGetPalette (syspalph); |
416 PgGetPalette(syspalph); | 425 } else { |
417 } | 426 for (i = 0; i < _Pg_MAX_PALETTE; i++) { |
418 else | 427 savedpal[i] = PgRGB (0, 0, 0); |
419 { | 428 syspalph[i] = PgRGB (0, 0, 0); |
420 for(i=0; i<_Pg_MAX_PALETTE; i++) | 429 } |
421 { | 430 } |
422 savedpal[i]=PgRGB(0, 0, 0); | 431 |
423 syspalph[i]=PgRGB(0, 0, 0); | |
424 } | |
425 } | |
426 | |
427 currently_fullscreen = 0; | 432 currently_fullscreen = 0; |
428 currently_hided = 0; | 433 currently_hided = 0; |
429 currently_maximized = 0; | 434 currently_maximized = 0; |
430 current_overlay = NULL; | 435 current_overlay = NULL; |
431 | 436 |
435 OCImage.oldDC = NULL; | 440 OCImage.oldDC = NULL; |
436 OCImage.CurrentFrameData = NULL; | 441 OCImage.CurrentFrameData = NULL; |
437 OCImage.FrameData0 = NULL; | 442 OCImage.FrameData0 = NULL; |
438 OCImage.FrameData1 = NULL; | 443 OCImage.FrameData1 = NULL; |
439 videomode_emulatemode = 0; | 444 videomode_emulatemode = 0; |
440 | 445 |
441 this->info.wm_available = 1; | 446 this->info.wm_available = 1; |
442 | 447 |
443 ph_UpdateHWInfo(this); | 448 ph_UpdateHWInfo (this); |
444 | 449 |
445 return 0; | 450 return 0; |
446 } | 451 } |
447 | 452 |
448 static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) | 453 static SDL_Surface * |
449 { | 454 ph_SetVideoMode (_THIS, SDL_Surface * current, int width, int height, int bpp, |
450 const struct ColourMasks* mask; | 455 Uint32 flags) |
456 { | |
457 const struct ColourMasks *mask; | |
451 | 458 |
452 /* Lock the event thread, in multi-threading environments */ | 459 /* Lock the event thread, in multi-threading environments */ |
453 SDL_Lock_EventThread(); | 460 SDL_Lock_EventThread (); |
454 | 461 |
455 current->flags = flags; | 462 current->flags = flags; |
456 | 463 |
457 /* if we do not have desired fullscreen mode, then fallback into window mode */ | 464 /* if we do not have desired fullscreen mode, then fallback into window mode */ |
458 if (((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && (ph_GetVideoMode(width, height, bpp)==0)) | 465 if (((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) |
459 { | 466 && (ph_GetVideoMode (width, height, bpp) == 0)) { |
460 current->flags &= ~SDL_FULLSCREEN; | 467 current->flags &= ~SDL_FULLSCREEN; |
461 current->flags &= ~SDL_NOFRAME; | 468 current->flags &= ~SDL_NOFRAME; |
462 current->flags &= ~SDL_RESIZABLE; | 469 current->flags &= ~SDL_RESIZABLE; |
463 } | 470 } |
464 | 471 |
465 ph_SetupWindow(this, width, height, current->flags); | 472 ph_SetupWindow (this, width, height, current->flags); |
466 | 473 |
467 mask = ph_GetColourMasks(bpp); | 474 mask = ph_GetColourMasks (bpp); |
468 if (mask != NULL) | 475 if (mask != NULL) { |
469 { | 476 SDL_ReallocFormat (current, mask->bpp, mask->red, mask->green, |
470 SDL_ReallocFormat(current, mask->bpp, mask->red, mask->green, mask->blue, 0); | 477 mask->blue, 0); |
471 } | 478 } else { |
472 else | 479 SDL_SetError |
473 { | 480 ("ph_SetVideoMode(): desired bpp is not supported by photon !\n"); |
474 SDL_SetError("ph_SetVideoMode(): desired bpp is not supported by photon !\n"); | |
475 return NULL; | 481 return NULL; |
476 } | 482 } |
477 | 483 |
478 if (current->flags & SDL_INTERNALOPENGL) | 484 if (current->flags & SDL_INTERNALOPENGL) { |
479 { | |
480 #if !SDL_VIDEO_OPENGL | 485 #if !SDL_VIDEO_OPENGL |
481 /* if no built-in OpenGL support */ | 486 /* if no built-in OpenGL support */ |
482 SDL_SetError("ph_SetVideoMode(): no OpenGL support, you need to recompile SDL.\n"); | 487 SDL_SetError |
488 ("ph_SetVideoMode(): no OpenGL support, you need to recompile SDL.\n"); | |
483 current->flags &= ~SDL_INTERNALOPENGL; | 489 current->flags &= ~SDL_INTERNALOPENGL; |
484 return NULL; | 490 return NULL; |
485 #endif /* SDL_VIDEO_OPENGL */ | 491 #endif /* SDL_VIDEO_OPENGL */ |
486 } | 492 } else { |
487 else | |
488 { | |
489 /* Initialize internal variables */ | 493 /* Initialize internal variables */ |
490 if ((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) | 494 if ((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { |
491 { | 495 if (bpp == 8) { |
492 if (bpp==8) | 496 desktoppal = SDLPH_PAL_SYSTEM; |
493 { | |
494 desktoppal=SDLPH_PAL_SYSTEM; | |
495 } | 497 } |
496 | 498 |
497 current->flags &= ~SDL_RESIZABLE; /* no resize for Direct Context */ | 499 current->flags &= ~SDL_RESIZABLE; /* no resize for Direct Context */ |
498 current->flags |= SDL_HWSURFACE; | 500 current->flags |= SDL_HWSURFACE; |
499 } | 501 } else { |
500 else | |
501 { | |
502 /* remove this if we'll have support for the non-fullscreen sw/hw+doublebuf one day */ | 502 /* remove this if we'll have support for the non-fullscreen sw/hw+doublebuf one day */ |
503 current->flags &= ~SDL_DOUBLEBUF; | 503 current->flags &= ~SDL_DOUBLEBUF; |
504 | 504 |
505 /* Use offscreen memory if SDL_HWSURFACE flag is set */ | 505 /* Use offscreen memory if SDL_HWSURFACE flag is set */ |
506 if ((current->flags & SDL_HWSURFACE) == SDL_HWSURFACE) | 506 if ((current->flags & SDL_HWSURFACE) == SDL_HWSURFACE) { |
507 { | 507 if (desktopbpp != bpp) { |
508 if (desktopbpp!=bpp) | 508 current->flags &= ~SDL_HWSURFACE; |
509 { | |
510 current->flags &= ~SDL_HWSURFACE; | |
511 } | 509 } |
512 } | 510 } |
513 | 511 |
514 /* using palette emulation code in window mode */ | 512 /* using palette emulation code in window mode */ |
515 if (bpp==8) | 513 if (bpp == 8) { |
516 { | 514 if (desktopbpp >= 15) { |
517 if (desktopbpp>=15) | |
518 { | |
519 desktoppal = SDLPH_PAL_EMULATE; | 515 desktoppal = SDLPH_PAL_EMULATE; |
520 } | 516 } else { |
521 else | |
522 { | |
523 desktoppal = SDLPH_PAL_SYSTEM; | 517 desktoppal = SDLPH_PAL_SYSTEM; |
524 } | 518 } |
525 } | 519 } else { |
526 else | 520 desktoppal = SDLPH_PAL_NONE; |
527 { | |
528 desktoppal = SDLPH_PAL_NONE; | |
529 } | 521 } |
530 } | 522 } |
531 } | 523 } |
532 | 524 |
533 current->w = width; | 525 current->w = width; |
534 current->h = height; | 526 current->h = height; |
535 | 527 |
536 if (desktoppal==SDLPH_PAL_SYSTEM) | 528 if (desktoppal == SDLPH_PAL_SYSTEM) { |
537 { | 529 current->flags |= SDL_HWPALETTE; |
538 current->flags|=SDL_HWPALETTE; | |
539 } | 530 } |
540 | 531 |
541 /* Must call at least once for setup image planes */ | 532 /* Must call at least once for setup image planes */ |
542 if (ph_SetupUpdateFunction(this, current, current->flags)==-1) | 533 if (ph_SetupUpdateFunction (this, current, current->flags) == -1) { |
543 { | |
544 /* Error string was filled in the ph_SetupUpdateFunction() */ | 534 /* Error string was filled in the ph_SetupUpdateFunction() */ |
545 return NULL; | 535 return NULL; |
546 } | 536 } |
547 | 537 |
548 /* finish window drawing, if we are not in fullscreen, of course */ | 538 /* finish window drawing, if we are not in fullscreen, of course */ |
549 if ((current->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) | 539 if ((current->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) { |
550 { | 540 PtFlush (); |
551 PtFlush(); | 541 } else { |
552 } | 542 PgFlush (); |
553 else | 543 } |
554 { | 544 |
555 PgFlush(); | 545 visualbpp = bpp; |
556 } | 546 |
557 | 547 ph_UpdateHWInfo (this); |
558 visualbpp=bpp; | 548 |
559 | 549 SDL_Unlock_EventThread (); |
560 ph_UpdateHWInfo(this); | |
561 | |
562 SDL_Unlock_EventThread(); | |
563 | 550 |
564 /* We've done! */ | 551 /* We've done! */ |
565 return (current); | 552 return (current); |
566 } | 553 } |
567 | 554 |
568 static void ph_VideoQuit(_THIS) | 555 static void |
556 ph_VideoQuit (_THIS) | |
569 { | 557 { |
570 /* restore palette */ | 558 /* restore palette */ |
571 if (desktopbpp==8) | 559 if (desktopbpp == 8) { |
572 { | 560 PgSetPalette (syspalph, 0, -1, 0, 0, 0); |
573 PgSetPalette(syspalph, 0, -1, 0, 0, 0); | 561 PgSetPalette (savedpal, 0, 0, _Pg_MAX_PALETTE, |
574 PgSetPalette(savedpal, 0, 0, _Pg_MAX_PALETTE, Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0); | 562 Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0); |
575 PgFlush(); | 563 PgFlush (); |
576 } | 564 } |
577 | 565 |
578 ph_DestroyImage(this, SDL_VideoSurface); | 566 ph_DestroyImage (this, SDL_VideoSurface); |
579 | 567 |
580 if (window) | 568 if (window) { |
581 { | 569 PtUnrealizeWidget (window); |
582 PtUnrealizeWidget(window); | 570 PtDestroyWidget (window); |
583 PtDestroyWidget(window); | 571 window = NULL; |
584 window=NULL; | 572 } |
585 } | 573 |
586 | 574 if (phevent != NULL) { |
587 if (phevent!=NULL) | 575 SDL_free (phevent); |
588 { | 576 phevent = NULL; |
589 SDL_free(phevent); | 577 } |
590 phevent=NULL; | 578 } |
591 } | 579 |
592 } | 580 static int |
593 | 581 ph_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors) |
594 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | |
595 { | 582 { |
596 int i; | 583 int i; |
597 SDL_Rect updaterect; | 584 SDL_Rect updaterect; |
598 | 585 |
599 updaterect.x = updaterect.y = 0; | 586 updaterect.x = updaterect.y = 0; |
600 updaterect.w = this->screen->w; | 587 updaterect.w = this->screen->w; |
601 updaterect.h = this->screen->h; | 588 updaterect.h = this->screen->h; |
602 | 589 |
603 /* palette emulation code, using palette of the PhImage_t struct */ | 590 /* palette emulation code, using palette of the PhImage_t struct */ |
604 if (desktoppal==SDLPH_PAL_EMULATE) | 591 if (desktoppal == SDLPH_PAL_EMULATE) { |
605 { | 592 if ((SDL_Image) && (SDL_Image->palette)) { |
606 if ((SDL_Image) && (SDL_Image->palette)) | 593 for (i = firstcolor; i < firstcolor + ncolors; i++) { |
607 { | 594 syspalph[i] = |
608 for (i=firstcolor; i<firstcolor+ncolors; i++) | 595 PgRGB (colors[i - firstcolor].r, |
609 { | 596 colors[i - firstcolor].g, |
610 syspalph[i] = PgRGB(colors[i-firstcolor].r, colors[i-firstcolor].g, colors[i-firstcolor].b); | 597 colors[i - firstcolor].b); |
611 SDL_Image->palette[i] = syspalph[i]; | 598 SDL_Image->palette[i] = syspalph[i]; |
612 } | 599 } |
613 | 600 |
614 /* image needs to be redrawn */ | 601 /* image needs to be redrawn */ |
615 this->UpdateRects(this, 1, &updaterect); | 602 this->UpdateRects (this, 1, &updaterect); |
616 } | 603 } |
617 } | 604 } else { |
618 else | 605 if (desktoppal == SDLPH_PAL_SYSTEM) { |
619 { | 606 for (i = firstcolor; i < firstcolor + ncolors; i++) { |
620 if (desktoppal==SDLPH_PAL_SYSTEM) | 607 syspalph[i] = |
621 { | 608 PgRGB (colors[i - firstcolor].r, |
622 for (i=firstcolor; i<firstcolor+ncolors; i++) | 609 colors[i - firstcolor].g, |
623 { | 610 colors[i - firstcolor].b); |
624 syspalph[i] = PgRGB(colors[i-firstcolor].r, colors[i-firstcolor].g, colors[i-firstcolor].b); | |
625 } | 611 } |
626 | 612 |
627 if ((this->screen->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) | 613 if ((this->screen->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) { |
628 { | 614 /* window mode must use soft palette */ |
629 /* window mode must use soft palette */ | 615 PgSetPalette (&syspalph[firstcolor], 0, firstcolor, |
630 PgSetPalette(&syspalph[firstcolor], 0, firstcolor, ncolors, Pg_PALSET_GLOBAL, 0); | 616 ncolors, Pg_PALSET_GLOBAL, 0); |
631 /* image needs to be redrawn */ | 617 /* image needs to be redrawn */ |
632 this->UpdateRects(this, 1, &updaterect); | 618 this->UpdateRects (this, 1, &updaterect); |
619 } else { | |
620 /* fullscreen mode must use hardware palette */ | |
621 PgSetPalette (&syspalph[firstcolor], 0, firstcolor, | |
622 ncolors, Pg_PALSET_GLOBAL, 0); | |
633 } | 623 } |
634 else | 624 } else { |
635 { | |
636 /* fullscreen mode must use hardware palette */ | |
637 PgSetPalette(&syspalph[firstcolor], 0, firstcolor, ncolors, Pg_PALSET_GLOBAL, 0); | |
638 } | |
639 } | |
640 else | |
641 { | |
642 /* SDLPH_PAL_NONE do nothing */ | 625 /* SDLPH_PAL_NONE do nothing */ |
643 } | 626 } |
644 } | 627 } |
645 | 628 |
646 return 1; | 629 return 1; |
647 } | 630 } |
648 | 631 |
632 /* vi: set ts=4 sw=4 expandtab: */ |