Mercurial > sdl-ios-xcode
annotate src/video/windib/SDL_dibvideo.c @ 78:e9582f471c02
Added the environment variable SDL_MOUSE_NORELATIVE to completely disable
relative mouse motion if the application desires it. UNDOCUMENTED!!
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Sat, 23 Jun 2001 18:51:29 +0000 |
parents | 3dcf26fa9d15 |
children | 9ef74357a5fb |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997, 1998, 1999 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@devolution.com | |
21 */ | |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #include <stdio.h> | |
29 #include <stdlib.h> | |
30 #include <malloc.h> | |
31 #include <windows.h> | |
32 | |
33 /* Not yet in the mingw32 cross-compile headers */ | |
34 #ifndef CDS_FULLSCREEN | |
35 #define CDS_FULLSCREEN 4 | |
36 #endif | |
37 | |
38 #include "SDL.h" | |
39 #include "SDL_mutex.h" | |
40 #include "SDL_syswm.h" | |
41 #include "SDL_sysvideo.h" | |
42 #include "SDL_sysevents.h" | |
43 #include "SDL_events_c.h" | |
44 #include "SDL_pixels_c.h" | |
45 #include "SDL_dibvideo.h" | |
46 #include "SDL_syswm_c.h" | |
47 #include "SDL_sysmouse_c.h" | |
48 #include "SDL_dibevents_c.h" | |
49 #include "SDL_wingl_c.h" | |
50 | |
51 #ifdef _WIN32_WCE | |
52 #define NO_GETDIBITS | |
53 #define NO_CHANGEDISPLAYSETTINGS | |
54 #define NO_GAMMA_SUPPORT | |
55 #endif | |
56 | |
57 /* Initialization/Query functions */ | |
58 static int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat); | |
59 static SDL_Rect **DIB_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | |
60 SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | |
61 static int DIB_SetColors(_THIS, int firstcolor, int ncolors, | |
62 SDL_Color *colors); | |
63 static void DIB_CheckGamma(_THIS); | |
64 static void DIB_SwapGamma(_THIS); | |
65 static void DIB_QuitGamma(_THIS); | |
66 #ifndef NO_GAMMA_SUPPORT | |
67 static int DIB_SetGammaRamp(_THIS, Uint16 *ramp); | |
68 static int DIB_GetGammaRamp(_THIS, Uint16 *ramp); | |
69 #endif | |
70 static void DIB_VideoQuit(_THIS); | |
71 | |
72 /* Hardware surface functions */ | |
73 static int DIB_AllocHWSurface(_THIS, SDL_Surface *surface); | |
74 static int DIB_LockHWSurface(_THIS, SDL_Surface *surface); | |
75 static void DIB_UnlockHWSurface(_THIS, SDL_Surface *surface); | |
76 static void DIB_FreeHWSurface(_THIS, SDL_Surface *surface); | |
77 | |
78 /* Windows message handling functions */ | |
79 static void DIB_RealizePalette(_THIS); | |
80 static void DIB_PaletteChanged(_THIS, HWND window); | |
81 static void DIB_WinPAINT(_THIS, HDC hdc); | |
82 | |
83 /* helper fn */ | |
84 static int DIB_SussScreenDepth(); | |
85 | |
86 /* DIB driver bootstrap functions */ | |
87 | |
88 static int DIB_Available(void) | |
89 { | |
90 return(1); | |
91 } | |
92 | |
93 static void DIB_DeleteDevice(SDL_VideoDevice *device) | |
94 { | |
95 if ( device ) { | |
96 if ( device->hidden ) { | |
97 free(device->hidden); | |
98 } | |
99 if ( device->gl_data ) { | |
100 free(device->gl_data); | |
101 } | |
102 free(device); | |
103 } | |
104 } | |
105 | |
106 static SDL_VideoDevice *DIB_CreateDevice(int devindex) | |
107 { | |
108 SDL_VideoDevice *device; | |
109 | |
110 /* Initialize all variables that we clean on shutdown */ | |
111 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); | |
112 if ( device ) { | |
113 memset(device, 0, (sizeof *device)); | |
114 device->hidden = (struct SDL_PrivateVideoData *) | |
115 malloc((sizeof *device->hidden)); | |
116 device->gl_data = (struct SDL_PrivateGLData *) | |
117 malloc((sizeof *device->gl_data)); | |
118 } | |
119 if ( (device == NULL) || (device->hidden == NULL) || | |
120 (device->gl_data == NULL) ) { | |
121 SDL_OutOfMemory(); | |
122 DIB_DeleteDevice(device); | |
123 return(NULL); | |
124 } | |
125 memset(device->hidden, 0, (sizeof *device->hidden)); | |
126 memset(device->gl_data, 0, (sizeof *device->gl_data)); | |
127 | |
128 /* Set the function pointers */ | |
129 device->VideoInit = DIB_VideoInit; | |
130 device->ListModes = DIB_ListModes; | |
131 device->SetVideoMode = DIB_SetVideoMode; | |
132 device->UpdateMouse = WIN_UpdateMouse; | |
133 device->SetColors = DIB_SetColors; | |
134 device->UpdateRects = NULL; | |
135 device->VideoQuit = DIB_VideoQuit; | |
136 device->AllocHWSurface = DIB_AllocHWSurface; | |
137 device->CheckHWBlit = NULL; | |
138 device->FillHWRect = NULL; | |
139 device->SetHWColorKey = NULL; | |
140 device->SetHWAlpha = NULL; | |
141 device->LockHWSurface = DIB_LockHWSurface; | |
142 device->UnlockHWSurface = DIB_UnlockHWSurface; | |
143 device->FlipHWSurface = NULL; | |
144 device->FreeHWSurface = DIB_FreeHWSurface; | |
145 #ifndef NO_GAMMA_SUPPORT | |
146 device->SetGammaRamp = DIB_SetGammaRamp; | |
147 device->GetGammaRamp = DIB_GetGammaRamp; | |
148 #endif | |
149 #ifdef HAVE_OPENGL | |
150 device->GL_LoadLibrary = WIN_GL_LoadLibrary; | |
151 device->GL_GetProcAddress = WIN_GL_GetProcAddress; | |
152 device->GL_GetAttribute = WIN_GL_GetAttribute; | |
153 device->GL_MakeCurrent = WIN_GL_MakeCurrent; | |
154 device->GL_SwapBuffers = WIN_GL_SwapBuffers; | |
155 #endif | |
156 device->SetCaption = WIN_SetWMCaption; | |
157 device->SetIcon = WIN_SetWMIcon; | |
158 device->IconifyWindow = WIN_IconifyWindow; | |
159 device->GrabInput = WIN_GrabInput; | |
160 device->GetWMInfo = WIN_GetWMInfo; | |
161 device->FreeWMCursor = WIN_FreeWMCursor; | |
162 device->CreateWMCursor = WIN_CreateWMCursor; | |
163 device->ShowWMCursor = WIN_ShowWMCursor; | |
164 device->WarpWMCursor = WIN_WarpWMCursor; | |
165 device->CheckMouseMode = WIN_CheckMouseMode; | |
166 device->InitOSKeymap = DIB_InitOSKeymap; | |
167 device->PumpEvents = DIB_PumpEvents; | |
168 | |
169 /* Set up the windows message handling functions */ | |
170 WIN_RealizePalette = DIB_RealizePalette; | |
171 WIN_PaletteChanged = DIB_PaletteChanged; | |
172 WIN_SwapGamma = DIB_SwapGamma; | |
173 WIN_WinPAINT = DIB_WinPAINT; | |
174 HandleMessage = DIB_HandleMessage; | |
175 | |
176 device->free = DIB_DeleteDevice; | |
177 | |
178 /* We're finally ready */ | |
179 return device; | |
180 } | |
181 | |
182 VideoBootStrap WINDIB_bootstrap = { | |
183 "windib", "Win95/98/NT/2000 GDI", | |
184 DIB_Available, DIB_CreateDevice | |
185 }; | |
186 | |
187 #ifndef NO_CHANGEDISPLAYSETTINGS | |
188 | |
189 static int cmpmodes(const void *va, const void *vb) | |
190 { | |
191 SDL_Rect *a = *(SDL_Rect **)va; | |
192 SDL_Rect *b = *(SDL_Rect **)vb; | |
193 if(a->w > b->w) | |
194 return -1; | |
195 return b->h - a->h; | |
196 } | |
197 | |
198 static int DIB_AddMode(_THIS, int bpp, int w, int h) | |
199 { | |
200 SDL_Rect *mode; | |
201 int i, index; | |
202 int next_mode; | |
203 | |
204 /* Check to see if we already have this mode */ | |
205 if ( bpp < 8 ) { /* Not supported */ | |
206 return(0); | |
207 } | |
208 index = ((bpp+7)/8)-1; | |
209 for ( i=0; i<SDL_nummodes[index]; ++i ) { | |
210 mode = SDL_modelist[index][i]; | |
211 if ( (mode->w == w) && (mode->h == h) ) { | |
212 return(0); | |
213 } | |
214 } | |
215 | |
216 /* Set up the new video mode rectangle */ | |
217 mode = (SDL_Rect *)malloc(sizeof *mode); | |
218 if ( mode == NULL ) { | |
219 SDL_OutOfMemory(); | |
220 return(-1); | |
221 } | |
222 mode->x = 0; | |
223 mode->y = 0; | |
224 mode->w = w; | |
225 mode->h = h; | |
226 | |
227 /* Allocate the new list of modes, and fill in the new mode */ | |
228 next_mode = SDL_nummodes[index]; | |
229 SDL_modelist[index] = (SDL_Rect **) | |
230 realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *)); | |
231 if ( SDL_modelist[index] == NULL ) { | |
232 SDL_OutOfMemory(); | |
233 SDL_nummodes[index] = 0; | |
234 free(mode); | |
235 return(-1); | |
236 } | |
237 SDL_modelist[index][next_mode] = mode; | |
238 SDL_modelist[index][next_mode+1] = NULL; | |
239 SDL_nummodes[index]++; | |
240 | |
241 return(0); | |
242 } | |
243 | |
244 #endif /* !NO_CHANGEDISPLAYSETTINGS */ | |
245 | |
246 static HPALETTE DIB_CreatePalette(int bpp) | |
247 { | |
248 /* RJR: March 28, 2000 | |
249 moved palette creation here from "DIB_VideoInit" */ | |
250 | |
251 HPALETTE handle = NULL; | |
252 | |
253 if ( bpp <= 8 ) | |
254 { | |
255 LOGPALETTE *palette; | |
256 HDC hdc; | |
257 int ncolors; | |
258 int i; | |
259 | |
260 ncolors = 1; | |
261 for ( i=0; i<bpp; ++i ) { | |
262 ncolors *= 2; | |
263 } | |
264 palette = (LOGPALETTE *)malloc(sizeof(*palette)+ | |
265 ncolors*sizeof(PALETTEENTRY)); | |
266 palette->palVersion = 0x300; | |
267 palette->palNumEntries = ncolors; | |
268 hdc = GetDC(SDL_Window); | |
269 GetSystemPaletteEntries(hdc, 0, ncolors, palette->palPalEntry); | |
270 ReleaseDC(SDL_Window, hdc); | |
271 handle = CreatePalette(palette); | |
272 free(palette); | |
273 } | |
274 | |
275 return handle; | |
276 } | |
277 | |
278 int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) | |
279 { | |
280 #ifndef NO_CHANGEDISPLAYSETTINGS | |
281 int i; | |
282 DEVMODE settings; | |
283 #endif | |
284 | |
285 /* Create the window */ | |
286 if ( DIB_CreateWindow(this) < 0 ) { | |
287 return(-1); | |
288 } | |
289 DX5_SoundFocus(SDL_Window); | |
290 | |
291 /* Determine the screen depth */ | |
292 vformat->BitsPerPixel = DIB_SussScreenDepth(); | |
293 switch (vformat->BitsPerPixel) { | |
294 case 15: | |
295 vformat->Rmask = 0x00007c00; | |
296 vformat->Gmask = 0x000003e0; | |
297 vformat->Bmask = 0x0000001f; | |
298 vformat->BitsPerPixel = 16; | |
299 break; | |
300 case 16: | |
301 vformat->Rmask = 0x0000f800; | |
302 vformat->Gmask = 0x000007e0; | |
303 vformat->Bmask = 0x0000001f; | |
304 break; | |
305 case 24: | |
306 case 32: | |
307 /* GDI defined as 8-8-8 */ | |
308 vformat->Rmask = 0x00ff0000; | |
309 vformat->Gmask = 0x0000ff00; | |
310 vformat->Bmask = 0x000000ff; | |
311 break; | |
312 default: | |
313 break; | |
314 } | |
315 | |
316 /* See if gamma is supported on this screen */ | |
317 DIB_CheckGamma(this); | |
318 | |
319 #ifndef NO_CHANGEDISPLAYSETTINGS | |
320 /* Query for the list of available video modes */ | |
321 for ( i=0; EnumDisplaySettings(NULL, i, &settings); ++i ) { | |
322 DIB_AddMode(this, settings.dmBitsPerPel, | |
323 settings.dmPelsWidth, settings.dmPelsHeight); | |
324 } | |
325 /* Sort the mode lists */ | |
326 for ( i=0; i<NUM_MODELISTS; ++i ) { | |
327 if ( SDL_nummodes[i] > 0 ) { | |
328 qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes); | |
329 } | |
330 } | |
331 #endif /* !NO_CHANGEDISPLAYSETTINGS */ | |
332 | |
333 /* Grab an identity palette if we are in a palettized mode */ | |
334 if ( vformat->BitsPerPixel <= 8 ) { | |
335 /* RJR: March 28, 2000 | |
336 moved palette creation to "DIB_CreatePalette" */ | |
337 screen_pal = DIB_CreatePalette(vformat->BitsPerPixel); | |
338 } | |
339 | |
340 /* Fill in some window manager capabilities */ | |
341 this->info.wm_available = 1; | |
342 | |
343 /* We're done! */ | |
344 return(0); | |
345 } | |
346 | |
347 /* We support any format at any dimension */ | |
348 SDL_Rect **DIB_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | |
349 { | |
350 #ifdef NO_CHANGEDISPLAYSETTINGS | |
351 return((SDL_Rect **)-1); | |
352 #else | |
353 if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { | |
354 return(SDL_modelist[((format->BitsPerPixel+7)/8)-1]); | |
355 } else { | |
356 return((SDL_Rect **)-1); | |
357 } | |
358 #endif | |
359 } | |
360 | |
361 | |
362 /* | |
363 Helper fn to work out which screen depth windows is currently using. | |
364 15 bit mode is considered 555 format, 16 bit is 565. | |
365 returns 0 for unknown mode. | |
366 (Derived from code in sept 1999 Windows Developer Journal | |
367 http://www.wdj.com/code/archive.html) | |
368 */ | |
369 static int DIB_SussScreenDepth() | |
370 { | |
371 #ifdef NO_GETDIBITS | |
372 int depth; | |
373 HDC hdc; | |
374 | |
375 hdc = GetDC(SDL_Window); | |
376 depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); | |
377 ReleaseDC(SDL_Window, hdc); | |
378 if ( depth == 16 ) { | |
379 depth = 15; /* GDI defined as RGB 555 */ | |
380 } | |
381 return(depth); | |
382 #else | |
383 int dib_size; | |
384 LPBITMAPINFOHEADER dib_hdr; | |
385 HDC hdc; | |
386 HBITMAP hbm; | |
387 | |
388 /* Allocate enough space for a DIB header plus palette (for | |
389 * 8-bit modes) or bitfields (for 16- and 32-bit modes) | |
390 */ | |
391 dib_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD); | |
392 dib_hdr = (LPBITMAPINFOHEADER) malloc(dib_size); | |
393 memset(dib_hdr, 0, dib_size); | |
394 dib_hdr->biSize = sizeof(BITMAPINFOHEADER); | |
395 | |
396 /* Get a device-dependent bitmap that's compatible with the | |
397 screen. | |
398 */ | |
399 hdc = GetDC(NULL); | |
400 hbm = CreateCompatibleBitmap( hdc, 1, 1 ); | |
401 | |
402 /* Convert the DDB to a DIB. We need to call GetDIBits twice: | |
403 * the first call just fills in the BITMAPINFOHEADER; the | |
404 * second fills in the bitfields or palette. | |
405 */ | |
406 GetDIBits(hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS); | |
407 GetDIBits(hdc, hbm, 0, 1, NULL, (LPBITMAPINFO) dib_hdr, DIB_RGB_COLORS); | |
408 DeleteObject(hbm); | |
409 ReleaseDC(NULL, hdc); | |
410 | |
411 switch( dib_hdr->biBitCount ) | |
412 { | |
413 case 8: return 8; | |
414 case 24: return 24; | |
415 case 32: return 32; | |
416 case 16: | |
417 if( dib_hdr->biCompression == BI_BITFIELDS ) { | |
418 /* check the red mask */ | |
419 switch( ((DWORD*)((char*)dib_hdr + dib_hdr->biSize))[0] ) { | |
420 case 0xf800: return 16; /* 565 */ | |
421 case 0x7c00: return 15; /* 555 */ | |
422 } | |
423 } | |
424 } | |
425 return 0; /* poo. */ | |
426 #endif /* NO_GETDIBITS */ | |
427 } | |
428 | |
429 | |
430 /* Various screen update functions available */ | |
431 static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); | |
432 | |
433 SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, | |
434 int width, int height, int bpp, Uint32 flags) | |
435 { | |
436 SDL_Surface *video; | |
437 Uint32 prev_flags; | |
438 DWORD style; | |
439 const DWORD directstyle = | |
440 (WS_POPUP); | |
441 const DWORD windowstyle = | |
442 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
443 #ifndef _WIN32_WCE |
0 | 444 const DWORD resizestyle = |
445 (WS_THICKFRAME|WS_MAXIMIZEBOX); | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
446 #endif |
0 | 447 int binfo_size; |
448 BITMAPINFO *binfo; | |
449 HDC hdc; | |
450 RECT bounds; | |
451 int x, y; | |
452 BOOL was_visible; | |
453 Uint32 Rmask, Gmask, Bmask; | |
454 | |
455 /* See whether or not we should center the window */ | |
456 was_visible = IsWindowVisible(SDL_Window); | |
457 | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
458 #ifdef HAVE_OPENGL |
0 | 459 /* Clean up any GL context that may be hanging around */ |
460 if ( current->flags & SDL_OPENGL ) { | |
461 WIN_GL_ShutDown(this); | |
462 } | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
463 #endif /* HAVE_OPENGL */ |
0 | 464 |
465 /* Recalculate the bitmasks if necessary */ | |
466 if ( bpp == current->format->BitsPerPixel ) { | |
467 video = current; | |
468 } else { | |
469 switch (bpp) { | |
470 case 15: | |
471 case 16: | |
472 if ( DIB_SussScreenDepth() == 15 ) { | |
473 /* 5-5-5 */ | |
474 Rmask = 0x00007c00; | |
475 Gmask = 0x000003e0; | |
476 Bmask = 0x0000001f; | |
477 } else { | |
478 /* 5-6-5 */ | |
479 Rmask = 0x0000f800; | |
480 Gmask = 0x000007e0; | |
481 Bmask = 0x0000001f; | |
482 } | |
483 break; | |
484 case 24: | |
485 case 32: | |
486 /* GDI defined as 8-8-8 */ | |
487 Rmask = 0x00ff0000; | |
488 Gmask = 0x0000ff00; | |
489 Bmask = 0x000000ff; | |
490 break; | |
491 default: | |
492 Rmask = 0x00000000; | |
493 Gmask = 0x00000000; | |
494 Bmask = 0x00000000; | |
495 break; | |
496 } | |
497 video = SDL_CreateRGBSurface(SDL_SWSURFACE, | |
498 0, 0, bpp, Rmask, Gmask, Bmask, 0); | |
499 if ( video == NULL ) { | |
500 SDL_OutOfMemory(); | |
501 return(NULL); | |
502 } | |
503 } | |
504 | |
505 /* Fill in part of the video surface */ | |
506 prev_flags = video->flags; | |
507 video->flags = 0; /* Clear flags */ | |
508 video->w = width; | |
509 video->h = height; | |
510 video->pitch = SDL_CalculatePitch(video); | |
511 | |
512 #ifndef NO_CHANGEDISPLAYSETTINGS | |
513 /* Set fullscreen mode if appropriate */ | |
514 if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { | |
515 DEVMODE settings; | |
516 | |
517 memset(&settings, 0, sizeof(DEVMODE)); | |
518 settings.dmSize = sizeof(DEVMODE); | |
519 settings.dmBitsPerPel = video->format->BitsPerPixel; | |
520 settings.dmPelsWidth = width; | |
521 settings.dmPelsHeight = height; | |
522 settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; | |
523 if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) { | |
524 video->flags |= SDL_FULLSCREEN; | |
525 } | |
526 } | |
527 #endif /* !NO_CHANGEDISPLAYSETTINGS */ | |
528 | |
45
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
529 /* Reset the palette and create a new one if necessary */ |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
530 if ( screen_pal != NULL ) { |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
531 /* RJR: March 28, 2000 |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
532 delete identity palette if switching from a palettized mode */ |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
533 DeleteObject(screen_pal); |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
534 screen_pal = NULL; |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
535 } |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
536 if ( bpp <= 8 ) |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
537 { |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
538 /* RJR: March 28, 2000 |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
539 create identity palette switching to a palettized mode */ |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
540 screen_pal = DIB_CreatePalette(bpp); |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
541 } |
60a6e045808e
Fix palette creation in windowed mode at 8 bpp
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
542 |
0 | 543 style = GetWindowLong(SDL_Window, GWL_STYLE); |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
544 #ifndef _WIN32_WCE |
0 | 545 style &= ~(resizestyle|WS_MAXIMIZE); |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
546 #endif |
0 | 547 if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { |
548 style &= ~windowstyle; | |
549 style |= directstyle; | |
550 } else { | |
551 #ifndef NO_CHANGEDISPLAYSETTINGS | |
552 if ( (prev_flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { | |
553 ChangeDisplaySettings(NULL, 0); | |
554 } | |
555 #endif | |
556 if ( flags & SDL_NOFRAME ) { | |
557 style &= ~windowstyle; | |
558 style |= directstyle; | |
559 video->flags |= SDL_NOFRAME; | |
560 } else { | |
561 style &= ~directstyle; | |
562 style |= windowstyle; | |
563 if ( flags & SDL_RESIZABLE ) { | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
564 #ifndef _WIN32_WCE |
0 | 565 style |= resizestyle; |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
566 #endif |
0 | 567 video->flags |= SDL_RESIZABLE; |
568 } | |
569 } | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
570 #ifndef _WIN32_WCE |
0 | 571 if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE; |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
572 #endif |
0 | 573 } |
574 SetWindowLong(SDL_Window, GWL_STYLE, style); | |
575 | |
576 /* Delete the old bitmap if necessary */ | |
577 if ( screen_bmp != NULL ) { | |
578 DeleteObject(screen_bmp); | |
579 } | |
580 if ( ! (flags & SDL_OPENGL) ) { | |
581 BOOL is16bitmode = (video->format->BytesPerPixel == 2); | |
582 | |
583 /* Suss out the bitmap info header */ | |
584 binfo_size = sizeof(*binfo); | |
585 if( is16bitmode ) { | |
586 /* 16bit modes, palette area used for rgb bitmasks */ | |
587 binfo_size += 3*sizeof(DWORD); | |
588 } else if ( video->format->palette ) { | |
589 binfo_size += video->format->palette->ncolors * | |
590 sizeof(RGBQUAD); | |
591 } | |
592 binfo = (BITMAPINFO *)malloc(binfo_size); | |
593 if ( ! binfo ) { | |
594 if ( video != current ) { | |
595 SDL_FreeSurface(video); | |
596 } | |
597 SDL_OutOfMemory(); | |
598 return(NULL); | |
599 } | |
600 | |
601 binfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | |
602 binfo->bmiHeader.biWidth = video->w; | |
603 binfo->bmiHeader.biHeight = -video->h; /* -ve for topdown bitmap */ | |
604 binfo->bmiHeader.biPlanes = 1; | |
605 binfo->bmiHeader.biSizeImage = video->h * video->pitch; | |
606 binfo->bmiHeader.biXPelsPerMeter = 0; | |
607 binfo->bmiHeader.biYPelsPerMeter = 0; | |
608 binfo->bmiHeader.biClrUsed = 0; | |
609 binfo->bmiHeader.biClrImportant = 0; | |
610 binfo->bmiHeader.biBitCount = video->format->BitsPerPixel; | |
611 | |
612 if ( is16bitmode ) { | |
613 /* BI_BITFIELDS tells CreateDIBSection about the rgb masks in the palette */ | |
614 binfo->bmiHeader.biCompression = BI_BITFIELDS; | |
615 ((Uint32*)binfo->bmiColors)[0] = video->format->Rmask; | |
616 ((Uint32*)binfo->bmiColors)[1] = video->format->Gmask; | |
617 ((Uint32*)binfo->bmiColors)[2] = video->format->Bmask; | |
618 } else { | |
619 binfo->bmiHeader.biCompression = BI_RGB; /* BI_BITFIELDS for 565 vs 555 */ | |
620 if ( video->format->palette ) { | |
621 memset(binfo->bmiColors, 0, | |
622 video->format->palette->ncolors*sizeof(RGBQUAD)); | |
623 } | |
624 } | |
625 | |
626 /* Create the offscreen bitmap buffer */ | |
627 hdc = GetDC(SDL_Window); | |
628 screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS, | |
629 (void **)(&video->pixels), NULL, 0); | |
630 ReleaseDC(SDL_Window, hdc); | |
631 free(binfo); | |
632 if ( screen_bmp == NULL ) { | |
633 if ( video != current ) { | |
634 SDL_FreeSurface(video); | |
635 } | |
636 SDL_SetError("Couldn't create DIB section"); | |
637 return(NULL); | |
638 } | |
639 this->UpdateRects = DIB_NormalUpdate; | |
640 | |
641 /* Set video surface flags */ | |
642 if ( bpp <= 8 ) { | |
643 /* BitBlt() maps colors for us */ | |
644 video->flags |= SDL_HWPALETTE; | |
645 } | |
646 } | |
647 | |
648 /* Resize the window */ | |
649 if ( SDL_windowid == NULL ) { | |
650 UINT swp_flags; | |
651 | |
652 SDL_resizing = 1; | |
653 bounds.left = 0; | |
654 bounds.top = 0; | |
655 bounds.right = video->w; | |
656 bounds.bottom = video->h; | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
657 #ifndef _WIN32_WCE |
0 | 658 AdjustWindowRect(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE); |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
659 #else |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
660 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE,0); |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
661 #endif |
0 | 662 width = bounds.right-bounds.left; |
663 height = bounds.bottom-bounds.top; | |
664 x = (GetSystemMetrics(SM_CXSCREEN)-width)/2; | |
665 y = (GetSystemMetrics(SM_CYSCREEN)-height)/2; | |
666 if ( y < 0 ) { /* Cover up title bar for more client area */ | |
667 y -= GetSystemMetrics(SM_CYCAPTION)/2; | |
668 } | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
669 #ifndef _WIN32_WCE |
0 | 670 swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW); |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
671 #else |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
672 swp_flags = (SWP_NOZORDER | SWP_SHOWWINDOW); |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
673 #endif |
0 | 674 if ( was_visible && !(flags & SDL_FULLSCREEN) ) { |
675 swp_flags |= SWP_NOMOVE; | |
676 } | |
677 SetWindowPos(SDL_Window, NULL, x, y, width, height, swp_flags); | |
678 SDL_resizing = 0; | |
679 SetForegroundWindow(SDL_Window); | |
680 } | |
681 | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
682 #ifdef HAVE_OPENGL |
0 | 683 /* Set up for OpenGL */ |
684 if ( flags & SDL_OPENGL ) { | |
685 if ( WIN_GL_SetupWindow(this) < 0 ) { | |
686 return(NULL); | |
687 } | |
688 video->flags |= SDL_OPENGL; | |
689 } | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
690 #endif /* HAVE_OPENGL */ |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
691 |
0 | 692 /* We're live! */ |
693 return(video); | |
694 } | |
695 | |
696 /* We don't actually allow hardware surfaces in the DIB driver */ | |
697 static int DIB_AllocHWSurface(_THIS, SDL_Surface *surface) | |
698 { | |
699 return(-1); | |
700 } | |
701 static void DIB_FreeHWSurface(_THIS, SDL_Surface *surface) | |
702 { | |
703 return; | |
704 } | |
705 static int DIB_LockHWSurface(_THIS, SDL_Surface *surface) | |
706 { | |
707 return(0); | |
708 } | |
709 static void DIB_UnlockHWSurface(_THIS, SDL_Surface *surface) | |
710 { | |
711 return; | |
712 } | |
713 | |
714 static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) | |
715 { | |
716 HDC hdc, mdc; | |
717 int i; | |
718 | |
719 hdc = GetDC(SDL_Window); | |
720 if ( screen_pal ) { | |
721 SelectPalette(hdc, screen_pal, FALSE); | |
722 } | |
723 mdc = CreateCompatibleDC(hdc); | |
724 SelectObject(mdc, screen_bmp); | |
725 for ( i=0; i<numrects; ++i ) { | |
726 BitBlt(hdc, rects[i].x, rects[i].y, rects[i].w, rects[i].h, | |
727 mdc, rects[i].x, rects[i].y, SRCCOPY); | |
728 } | |
729 DeleteDC(mdc); | |
730 ReleaseDC(SDL_Window, hdc); | |
731 } | |
732 | |
733 int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | |
734 { | |
735 RGBQUAD *pal; | |
736 int i; | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
737 #ifndef _WIN32_WCE |
0 | 738 HDC hdc, mdc; |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
739 #else |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
740 HDC hdc; |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
741 #endif |
0 | 742 |
743 /* Update the display palette */ | |
744 hdc = GetDC(SDL_Window); | |
745 if ( screen_pal ) { | |
746 PALETTEENTRY *entries; | |
747 | |
748 entries = (PALETTEENTRY *)alloca(ncolors*sizeof(PALETTEENTRY)); | |
749 for ( i=0; i<ncolors; ++i ) { | |
750 entries[i].peRed = colors[i].r; | |
751 entries[i].peGreen = colors[i].g; | |
752 entries[i].peBlue = colors[i].b; | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
753 #ifndef _WIN32_WCE |
0 | 754 entries[i].peFlags = PC_NOCOLLAPSE; |
46
3dcf26fa9d15
*** empty log message ***
Sam Lantinga <slouken@lokigames.com>
parents:
45
diff
changeset
|
755 #else |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
756 entries[i].peFlags = 0; |
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
757 #endif |
0 | 758 } |
759 SetPaletteEntries(screen_pal, firstcolor, ncolors, entries); | |
760 SelectPalette(hdc, screen_pal, FALSE); | |
761 RealizePalette(hdc); | |
762 } | |
763 | |
764 /* Copy palette colors into DIB palette */ | |
765 pal = (RGBQUAD *)alloca(ncolors*sizeof(RGBQUAD)); | |
766 for ( i=0; i<ncolors; ++i ) { | |
767 pal[i].rgbRed = colors[i].r; | |
768 pal[i].rgbGreen = colors[i].g; | |
769 pal[i].rgbBlue = colors[i].b; | |
770 pal[i].rgbReserved = 0; | |
771 } | |
772 | |
773 /* Set the DIB palette and update the display */ | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
774 #ifndef _WIN32_WCE |
0 | 775 mdc = CreateCompatibleDC(hdc); |
776 SelectObject(mdc, screen_bmp); | |
777 SetDIBColorTable(mdc, firstcolor, ncolors, pal); | |
778 BitBlt(hdc, 0, 0, this->screen->w, this->screen->h, | |
779 mdc, 0, 0, SRCCOPY); | |
780 DeleteDC(mdc); | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
781 #endif |
0 | 782 ReleaseDC(SDL_Window, hdc); |
783 return(1); | |
784 } | |
785 | |
786 static void DIB_CheckGamma(_THIS) | |
787 { | |
788 #ifndef NO_GAMMA_SUPPORT | |
789 HDC hdc; | |
790 WORD ramp[3*256]; | |
791 | |
792 /* If we fail to get gamma, disable gamma control */ | |
793 hdc = GetDC(SDL_Window); | |
794 if ( ! GetDeviceGammaRamp(hdc, ramp) ) { | |
795 this->GetGammaRamp = NULL; | |
796 this->SetGammaRamp = NULL; | |
797 } | |
798 ReleaseDC(SDL_Window, hdc); | |
799 #endif /* !NO_GAMMA_SUPPORT */ | |
800 } | |
801 static void DIB_SwapGamma(_THIS) | |
802 { | |
803 #ifndef NO_GAMMA_SUPPORT | |
804 HDC hdc; | |
805 | |
806 if ( gamma_saved ) { | |
807 hdc = GetDC(SDL_Window); | |
808 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
809 /* About to leave active state, restore gamma */ | |
810 SetDeviceGammaRamp(hdc, gamma_saved); | |
811 } else { | |
812 /* About to enter active state, set game gamma */ | |
813 GetDeviceGammaRamp(hdc, gamma_saved); | |
814 SetDeviceGammaRamp(hdc, this->gamma); | |
815 } | |
816 ReleaseDC(SDL_Window, hdc); | |
817 } | |
818 #endif /* !NO_GAMMA_SUPPORT */ | |
819 } | |
820 static void DIB_QuitGamma(_THIS) | |
821 { | |
822 #ifndef NO_GAMMA_SUPPORT | |
823 if ( gamma_saved ) { | |
824 /* Restore the original gamma if necessary */ | |
825 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
826 HDC hdc; | |
827 | |
828 hdc = GetDC(SDL_Window); | |
829 SetDeviceGammaRamp(hdc, gamma_saved); | |
830 ReleaseDC(SDL_Window, hdc); | |
831 } | |
832 | |
833 /* Free the saved gamma memory */ | |
834 free(gamma_saved); | |
835 gamma_saved = 0; | |
836 } | |
837 #endif /* !NO_GAMMA_SUPPORT */ | |
838 } | |
839 | |
840 #ifndef NO_GAMMA_SUPPORT | |
841 | |
842 static int DIB_SetGammaRamp(_THIS, Uint16 *ramp) | |
843 { | |
844 HDC hdc; | |
845 BOOL succeeded; | |
846 | |
847 /* Set the ramp for the display */ | |
848 if ( ! gamma_saved ) { | |
849 gamma_saved = (WORD *)malloc(3*256*sizeof(*gamma_saved)); | |
850 if ( ! gamma_saved ) { | |
851 SDL_OutOfMemory(); | |
852 return -1; | |
853 } | |
854 hdc = GetDC(SDL_Window); | |
855 GetDeviceGammaRamp(hdc, gamma_saved); | |
856 ReleaseDC(SDL_Window, hdc); | |
857 } | |
858 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
859 hdc = GetDC(SDL_Window); | |
860 succeeded = SetDeviceGammaRamp(hdc, ramp); | |
861 ReleaseDC(SDL_Window, hdc); | |
862 } else { | |
863 succeeded = TRUE; | |
864 } | |
865 return succeeded ? 0 : -1; | |
866 } | |
867 | |
868 static int DIB_GetGammaRamp(_THIS, Uint16 *ramp) | |
869 { | |
870 HDC hdc; | |
871 BOOL succeeded; | |
872 | |
873 /* Get the ramp from the display */ | |
874 hdc = GetDC(SDL_Window); | |
875 succeeded = GetDeviceGammaRamp(hdc, ramp); | |
876 ReleaseDC(SDL_Window, hdc); | |
877 return succeeded ? 0 : -1; | |
878 } | |
879 | |
880 #endif /* !NO_GAMMA_SUPPORT */ | |
881 | |
882 void DIB_VideoQuit(_THIS) | |
883 { | |
884 /* Destroy the window and everything associated with it */ | |
885 if ( SDL_Window ) { | |
886 /* Delete the screen bitmap (also frees screen->pixels) */ | |
887 if ( this->screen ) { | |
888 #ifndef NO_CHANGEDISPLAYSETTINGS | |
889 if ( this->screen->flags & SDL_FULLSCREEN ) { | |
890 ChangeDisplaySettings(NULL, 0); | |
891 } | |
892 #endif | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
893 #ifdef HAVE_OPENGL |
0 | 894 if ( this->screen->flags & SDL_OPENGL ) { |
895 WIN_GL_ShutDown(this); | |
896 } | |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
897 #endif /* HAVE_OPENGL */ |
0 | 898 this->screen->pixels = NULL; |
899 } | |
900 if ( screen_bmp ) { | |
901 DeleteObject(screen_bmp); | |
902 screen_bmp = NULL; | |
903 } | |
904 if ( screen_icn ) { | |
905 DestroyIcon(screen_icn); | |
906 screen_icn = NULL; | |
907 } | |
908 DIB_QuitGamma(this); | |
909 DIB_DestroyWindow(this); | |
910 | |
911 SDL_Window = NULL; | |
912 } | |
913 } | |
914 | |
915 /* Exported for the windows message loop only */ | |
916 static void DIB_FocusPalette(_THIS, int foreground) | |
917 { | |
918 if ( screen_pal != NULL ) { | |
919 HDC hdc; | |
920 | |
921 hdc = GetDC(SDL_Window); | |
922 SelectPalette(hdc, screen_pal, FALSE); | |
923 if ( RealizePalette(hdc) ) | |
924 InvalidateRect(SDL_Window, NULL, FALSE); | |
925 ReleaseDC(SDL_Window, hdc); | |
926 } | |
927 } | |
928 static void DIB_RealizePalette(_THIS) | |
929 { | |
930 DIB_FocusPalette(this, 1); | |
931 } | |
932 static void DIB_PaletteChanged(_THIS, HWND window) | |
933 { | |
934 if ( window != SDL_Window ) { | |
935 DIB_FocusPalette(this, 0); | |
936 } | |
937 } | |
938 | |
939 /* Exported for the windows message loop only */ | |
940 static void DIB_WinPAINT(_THIS, HDC hdc) | |
941 { | |
942 HDC mdc; | |
943 | |
944 if ( screen_pal ) { | |
945 SelectPalette(hdc, screen_pal, FALSE); | |
946 } | |
947 mdc = CreateCompatibleDC(hdc); | |
948 SelectObject(mdc, screen_bmp); | |
949 BitBlt(hdc, 0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h, | |
950 mdc, 0, 0, SRCCOPY); | |
951 DeleteDC(mdc); | |
952 } | |
953 | |
954 /* Stub in case DirectX isn't available */ | |
955 #ifndef ENABLE_DIRECTX | |
956 void DX5_SoundFocus(HWND hwnd) | |
957 { | |
958 return; | |
959 } | |
960 #endif |