Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32modes.c @ 3426:ee0178f1c507
Fixed bug #878
Jack Jansen 2009-11-05 14:20:22 PST
I'm building "fat" SDL 1.3 libraries for MacOSX, but now I am running into the
issue that audio does not work on PowerPC macintoshes if you build the library
on an Intel.
The problem is that configure hard-codes the byteorder, which is then stored in
SDL_config.h
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 09 Nov 2009 04:13:51 +0000 |
parents | 51750b7a966f |
children | 4b594623401b |
rev | line source |
---|---|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_win32video.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 static SDL_bool |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 SDL_DisplayModeData *data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 DEVMODE devmode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 HDC hdc; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 devmode.dmSize = sizeof(devmode); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 devmode.dmDriverExtra = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 if (!EnumDisplaySettings(deviceName, index, &devmode)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 return SDL_FALSE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 if (!data) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 return SDL_FALSE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 SDL_memcpy(data->DeviceName, deviceName, sizeof(data->DeviceName)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 data->DeviceMode = devmode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 data->DeviceMode.dmFields = |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 DM_DISPLAYFLAGS); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 /* Fill in the mode information */ |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
51 mode->format = SDL_PIXELFORMAT_UNKNOWN; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 mode->w = devmode.dmPelsWidth; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 mode->h = devmode.dmPelsHeight; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 mode->refresh_rate = devmode.dmDisplayFrequency; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 mode->driverdata = data; |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
56 #ifdef _WIN32_WCE |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
57 /* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation |
3139 | 58 into account but GetSystemMetrixs does. */ |
59 if (index == ENUM_CURRENT_SETTINGS) { | |
60 mode->w = GetSystemMetrics(SM_CXSCREEN); | |
61 mode->h = GetSystemMetrics(SM_CYSCREEN); | |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
62 } |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
63 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
65 /* WinCE has no GetDIBits, therefore we can't use it to get the display format */ |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
66 #ifndef _WIN32_WCE |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
67 if (index == ENUM_CURRENT_SETTINGS |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
68 && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 LPBITMAPINFO bmi; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 HBITMAP hbm; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 SDL_zero(bmi_data); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 bmi = (LPBITMAPINFO) bmi_data; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 hbm = CreateCompatibleBitmap(hdc, 1, 1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 DeleteObject(hbm); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 DeleteDC(hdc); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 if (bmi->bmiHeader.biCompression == BI_BITFIELDS) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 switch (*(Uint32 *) bmi->bmiColors) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 case 0x00FF0000: |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
85 mode->format = SDL_PIXELFORMAT_RGB888; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 case 0x000000FF: |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
88 mode->format = SDL_PIXELFORMAT_BGR888; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 case 0xF800: |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
91 mode->format = SDL_PIXELFORMAT_RGB565; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 case 0x7C00: |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
94 mode->format = SDL_PIXELFORMAT_RGB555; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 } else if (bmi->bmiHeader.biBitCount == 8) { |
1965
a788656ca29a
SDL constants are all uppercase.
Sam Lantinga <slouken@libsdl.org>
parents:
1913
diff
changeset
|
98 mode->format = SDL_PIXELFORMAT_INDEX8; |
3175
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
99 } else if (bmi->bmiHeader.biBitCount == 4) { |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
100 mode->format = SDL_PIXELFORMAT_INDEX4LSB; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 } |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
102 } else |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
103 #endif /* _WIN32_WCE */ |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
104 { |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
105 /* FIXME: Can we tell what this will be? */ |
3186 | 106 if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { |
3175
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
107 switch (devmode.dmBitsPerPel) { |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
108 case 32: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
109 mode->format = SDL_PIXELFORMAT_RGB888; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
110 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
111 case 24: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
112 mode->format = SDL_PIXELFORMAT_RGB24; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
113 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
114 case 16: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
115 mode->format = SDL_PIXELFORMAT_RGB565; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
116 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
117 case 15: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
118 mode->format = SDL_PIXELFORMAT_RGB555; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
119 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
120 case 8: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
121 mode->format = SDL_PIXELFORMAT_INDEX8; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
122 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
123 case 4: |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
124 mode->format = SDL_PIXELFORMAT_INDEX4LSB; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
125 break; |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
126 } |
3186 | 127 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 return SDL_TRUE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
132 static SDL_bool |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
133 WIN_AddDisplay(LPTSTR DeviceName) |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
134 { |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
135 SDL_VideoDisplay display; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
136 SDL_DisplayData *displaydata; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
137 SDL_DisplayMode mode; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
138 |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
139 #ifdef DEBUG_MODES |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
140 printf("Display: %s\n", WIN_StringToUTF8(DeviceName)); |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
141 #endif |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
142 if (!WIN_GetDisplayMode(DeviceName, ENUM_CURRENT_SETTINGS, &mode)) { |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
143 return SDL_FALSE; |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
144 } |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
145 |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
146 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
147 if (!displaydata) { |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
148 return SDL_FALSE; |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
149 } |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
150 SDL_memcpy(displaydata->DeviceName, DeviceName, |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
151 sizeof(displaydata->DeviceName)); |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
152 |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
153 SDL_zero(display); |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
154 display.desktop_mode = mode; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
155 display.current_mode = mode; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
156 display.driverdata = displaydata; |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
157 SDL_AddVideoDisplay(&display); |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
158 return SDL_TRUE; |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
159 } |
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
160 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 WIN_InitModes(_THIS) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
165 DWORD i, j, count; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 DISPLAY_DEVICE device; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 device.cb = sizeof(device); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 for (i = 0;; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 TCHAR DeviceName[32]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 if (!EnumDisplayDevices(NULL, i, &device, 0)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 continue; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 SDL_memcpy(DeviceName, device.DeviceName, sizeof(DeviceName)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 #ifdef DEBUG_MODES |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 printf("Device: %s\n", WIN_StringToUTF8(DeviceName)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 #endif |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
182 count = 0; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 for (j = 0;; ++j) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 if (!EnumDisplayDevices(DeviceName, j, &device, 0)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 continue; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 } |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
190 count += WIN_AddDisplay(device.DeviceName); |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
191 } |
2149
eba4fd03b4f6
Fixed mode code under VMware running Windows 98
Sam Lantinga <slouken@libsdl.org>
parents:
2119
diff
changeset
|
192 if (count == 0) { |
2119
9341a884a4d9
Fixed running on Windows under VMware
Sam Lantinga <slouken@libsdl.org>
parents:
1965
diff
changeset
|
193 WIN_AddDisplay(DeviceName); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 WIN_GetDisplayModes(_THIS) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 DWORD i; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 SDL_DisplayMode mode; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 for (i = 0;; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 } |
3186 | 209 if (mode.format != SDL_PIXELFORMAT_UNKNOWN) |
3175
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
210 if (!SDL_AddDisplayMode(_this->current_display, &mode)) { |
e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
211 SDL_free(mode.driverdata); |
3186 | 212 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 LONG status; |
3139 | 221 |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
222 #ifdef _WIN32_WCE |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
223 /* TODO: implement correctly. |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
224 On my Asus MyPAL, if I execute the code below |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
225 I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays |
3139 | 226 visible ... (SDL_RaiseWindow() would fix that one) */ |
3097
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
227 return 0; |
0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
228 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 status = |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 CDS_FULLSCREEN, NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 if (status == DISP_CHANGE_SUCCESSFUL) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 return 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 const char *reason = "Unknown reason"; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 switch (status) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 case DISP_CHANGE_BADFLAGS: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 reason = "DISP_CHANGE_BADFLAGS"; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 case DISP_CHANGE_BADMODE: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 reason = "DISP_CHANGE_BADMODE"; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 case DISP_CHANGE_BADPARAM: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 reason = "DISP_CHANGE_BADPARAM"; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 case DISP_CHANGE_FAILED: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 reason = "DISP_CHANGE_FAILED"; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 WIN_QuitModes(_THIS) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 ChangeDisplaySettingsEx(NULL, NULL, NULL, 0, NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 /* vi: set ts=4 sw=4 expandtab: */ |