Commit 008ece6f authored by Sam Lantinga's avatar Sam Lantinga

GAPI fixes from Stefan Klug

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403531
parent 10fcf368
...@@ -73,7 +73,7 @@ int SDL_KeyboardInit(void) ...@@ -73,7 +73,7 @@ int SDL_KeyboardInit(void)
SDL_EnableKeyRepeat(0, 0); SDL_EnableKeyRepeat(0, 0);
/* Allow environment override to disable special lock-key behavior */ /* Allow environment override to disable special lock-key behavior */
env = getenv("SDL_NO_LOCK_KEYS"); env = SDL_getenv("SDL_NO_LOCK_KEYS");
SDL_NoLockKeys = 0; SDL_NoLockKeys = 0;
if (env) { if (env) {
switch (SDL_atoi(env)) { switch (SDL_atoi(env)) {
......
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "SDL_mouse.h" #include "SDL_mouse.h"
#include "SDL_mutex.h" #include "SDL_mutex.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../windib/SDL_gapidibvideo.h"
/* From gx.h, since it's not really C compliant */ /* From gx.h, since it's not really C compliant */
...@@ -100,13 +101,6 @@ struct GapiFunc ...@@ -100,13 +101,6 @@ struct GapiFunc
#define GX_NORMALKEYS 0x02 #define GX_NORMALKEYS 0x02
#define GX_LANDSCAPEKEYS 0x03 #define GX_LANDSCAPEKEYS 0x03
typedef enum
{
SDL_ORIENTATION_UP,
SDL_ORIENTATION_DOWN,
SDL_ORIENTATION_LEFT,
SDL_ORIENTATION_RIGHT
} SDL_ScreenOrientation;
/* GAPI video mode */ /* GAPI video mode */
typedef enum { typedef enum {
...@@ -117,26 +111,26 @@ typedef enum { ...@@ -117,26 +111,26 @@ typedef enum {
GAPI_PALETTE GAPI_PALETTE
} GAPIVideoMode; } GAPIVideoMode;
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this
typedef unsigned short PIXEL; typedef unsigned short PIXEL;
/* Private display data /* Private display data
begin with DIB private structure to allow DIB events code sharing begin with DIB private structure to allow DIB events code sharing
*/ */
struct SDL_PrivateVideoData { struct GapiInfo {
HBITMAP screen_bmp; /* Rotation which has to be applied to the key (arrow keys) and mouse events measured in quarters of a circle
HPALETTE screen_pal; * counter clockwise */
int coordinateTransform;
char hiresFix; /* using hires mode without defining hires resource */
int invert; //TODO this is only written but never read, so it should be removed
#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
int SDL_nummodes[NUM_MODELISTS]; int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS]; SDL_Rect **SDL_modelist[NUM_MODELISTS];
// The orientation of the video mode user wants to get // The orientation of the video mode user wants to get
// Probably restricted to UP and RIGHT // Probably restricted to UP and RIGHT
SDL_ScreenOrientation userOrientation; SDL_ScreenOrientation userOrientation;
int invert;
char hiresFix; // using hires mode without defining hires resource
// -------------- // --------------
int useGXOpenDisplay; /* use GXOpenDispplay */ int useGXOpenDisplay; /* use GXOpenDispplay */
int alreadyGXOpened; int alreadyGXOpened;
...@@ -158,14 +152,8 @@ struct SDL_PrivateVideoData { ...@@ -158,14 +152,8 @@ struct SDL_PrivateVideoData {
int startOffset; // in bytes int startOffset; // in bytes
int useVga; int useVga;
int suspended; // do not pu anything into video memory int suspended; // do not pu anything into video memory
// The orientation of the system, as defined by SM_CXSCREEN and SM_CYSCREEN
// User can change it by using 'screen layout' in system options
// Restricted to UP or RIGHT
enum SDL_ScreenOrientation systemOrientation;
}; };
#define gapiBuffer this->hidden->buffer
#define gapi this->hidden
#endif /* _SDL_gapivideo_h */ #endif /* _SDL_gapivideo_h */
...@@ -50,9 +50,13 @@ ...@@ -50,9 +50,13 @@
#include "wmmsg.h" #include "wmmsg.h"
#endif #endif
#ifdef _WIN32_WCE #include "../windib/SDL_gapidibvideo.h"
#ifdef SDL_VIDEO_DRIVER_GAPI
#include "../gapi/SDL_gapivideo.h" #include "../gapi/SDL_gapivideo.h"
#endif
#ifdef _WIN32_WCE
#define IsZoomed(HWND) 1 #define IsZoomed(HWND) 1
#define NO_GETKEYBOARDSTATE #define NO_GETKEYBOARDSTATE
#if _WIN32_WCE < 420 #if _WIN32_WCE < 420
...@@ -103,6 +107,9 @@ ToUnicodeFN SDL_ToUnicode = ToUnicode9xME; ...@@ -103,6 +107,9 @@ ToUnicodeFN SDL_ToUnicode = ToUnicode9xME;
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
//AdjustWindowRect is not available under WinCE 2003
#define AdjustWindowRect(a,b,c) (AdjustWindowRectEx((a),(b),(c),0))
// dynamically load aygshell dll because we want SDL to work on HPC and be300 // dynamically load aygshell dll because we want SDL to work on HPC and be300
HINSTANCE aygshell = NULL; HINSTANCE aygshell = NULL;
BOOL (WINAPI *SHFullScreen)(HWND hwndRequester, DWORD dwState) = 0; BOOL (WINAPI *SHFullScreen)(HWND hwndRequester, DWORD dwState) = 0;
...@@ -211,15 +218,19 @@ void WIN_FlushMessageQueue() ...@@ -211,15 +218,19 @@ void WIN_FlushMessageQueue()
static void SDL_RestoreGameMode(void) static void SDL_RestoreGameMode(void)
{ {
#ifdef _WIN32_WCE #ifdef _WIN32_WCE //Under ce we don't minimize, therefore no restore
#ifdef SDL_VIDEO_DRIVER_GAPI
SDL_VideoDevice *this = current_video; SDL_VideoDevice *this = current_video;
if(SDL_strcmp(this->name, "gapi") == 0) if(SDL_strcmp(this->name, "gapi") == 0)
{ {
if( this->hidden->suspended ) if( this->hidden->gapiInfo->suspended )
{ {
this->hidden->suspended = 0; this->hidden->gapiInfo->suspended = 0;
} }
} }
#endif
#else #else
ShowWindow(SDL_Window, SW_RESTORE); ShowWindow(SDL_Window, SW_RESTORE);
#endif #endif
...@@ -234,14 +245,18 @@ static void SDL_RestoreDesktopMode(void) ...@@ -234,14 +245,18 @@ static void SDL_RestoreDesktopMode(void)
{ {
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#ifdef SDL_VIDEO_DRIVER_GAPI
SDL_VideoDevice *this = current_video; SDL_VideoDevice *this = current_video;
if(SDL_strcmp(this->name, "gapi") == 0) if(SDL_strcmp(this->name, "gapi") == 0)
{ {
if( !this->hidden->suspended ) if( !this->hidden->gapiInfo->suspended )
{ {
this->hidden->suspended = 1; this->hidden->gapiInfo->suspended = 1;
} }
} }
#endif
#else #else
/* WinCE does not have a taskbar, so minimizing is not convenient */ /* WinCE does not have a taskbar, so minimizing is not convenient */
ShowWindow(SDL_Window, SW_MINIMIZE); ShowWindow(SDL_Window, SW_MINIMIZE);
...@@ -459,9 +474,9 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -459,9 +474,9 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
posted = SDL_PrivateMouseMotion(0, 1, x, y); posted = SDL_PrivateMouseMotion(0, 1, x, y);
} }
} else { } else {
#ifdef _WIN32_WCE #ifdef SDL_VIDEO_DRIVER_GAPI
if (SDL_VideoSurface) if (SDL_VideoSurface && this->hidden->gapiInfo)
GapiTransform(this->hidden->userOrientation, this->hidden->hiresFix, &x, &y); GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
#endif #endif
posted = SDL_PrivateMouseMotion(0, 0, x, y); posted = SDL_PrivateMouseMotion(0, 0, x, y);
} }
...@@ -564,9 +579,9 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -564,9 +579,9 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} else { } else {
x = (Sint16)LOWORD(lParam); x = (Sint16)LOWORD(lParam);
y = (Sint16)HIWORD(lParam); y = (Sint16)HIWORD(lParam);
#ifdef _WIN32_WCE #ifdef SDL_VIDEO_DRIVER_GAPI
if (SDL_VideoSurface) if (SDL_VideoSurface && this->hidden->gapiInfo)
GapiTransform(this->hidden->userOrientation, this->hidden->hiresFix, &x, &y); GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
#endif #endif
} }
posted = SDL_PrivateMouseButton( posted = SDL_PrivateMouseButton(
......
...@@ -30,9 +30,17 @@ ...@@ -30,9 +30,17 @@
#include "../../events/SDL_sysevents.h" #include "../../events/SDL_sysevents.h"
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#include "../wincommon/SDL_lowvideo.h" #include "../wincommon/SDL_lowvideo.h"
#include "SDL_dibvideo.h" #include "SDL_gapidibvideo.h"
#include "SDL_vkeys.h" #include "SDL_vkeys.h"
#ifdef SDL_VIDEO_DRIVER_GAPI
#include "../gapi/SDL_gapivideo.h"
#endif
#ifdef SDL_VIDEO_DRIVER_WINDIB
#include "SDL_dibvideo.h"
#endif
#ifndef WM_APP #ifndef WM_APP
#define WM_APP 0x8000 #define WM_APP 0x8000
#endif #endif
...@@ -44,6 +52,7 @@ ...@@ -44,6 +52,7 @@
/* The translation table from a Microsoft VK keysym to a SDL keysym */ /* The translation table from a Microsoft VK keysym to a SDL keysym */
static SDLKey VK_keymap[SDLK_LAST]; static SDLKey VK_keymap[SDLK_LAST];
static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed); static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed);
static SDLKey Arrows_keymap[4];
/* Masks for processing the windows KEYDOWN and KEYUP messages */ /* Masks for processing the windows KEYDOWN and KEYUP messages */
#define REPEATED_KEYMASK (1<<30) #define REPEATED_KEYMASK (1<<30)
...@@ -59,22 +68,21 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, ...@@ -59,22 +68,21 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym,
static WNDPROCTYPE userWindowProc = NULL; static WNDPROCTYPE userWindowProc = NULL;
#ifdef _WIN32_WCE #ifdef SDL_VIDEO_DRIVER_GAPI
WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) WPARAM rotateKey(WPARAM key,int direction)
{ {
if (direction != SDL_ORIENTATION_LEFT) if(direction ==0 ) return key;
return key;
switch (key) { switch (key) {
case 0x26: /* up */ case 0x26: /* up */
return 0x27; return Arrows_keymap[(2 + direction) % 4];
case 0x27: /* right */ case 0x27: /* right */
return 0x28; return Arrows_keymap[(1 + direction) % 4];
case 0x28: /* down */ case 0x28: /* down */
return 0x25; return Arrows_keymap[direction % 4];
case 0x25: /* left */ case 0x25: /* left */
return 0x26; return Arrows_keymap[(3 + direction) % 4];
} }
return key; return key;
...@@ -93,14 +101,15 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ...@@ -93,14 +101,15 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_KEYDOWN: { case WM_KEYDOWN: {
SDL_keysym keysym; SDL_keysym keysym;
#ifdef _WIN32_WCE #ifdef SDL_VIDEO_DRIVER_GAPI
if(this->hidden->gapiInfo)
{
// Drop GAPI artefacts // Drop GAPI artefacts
if (wParam == 0x84 || wParam == 0x5B) if (wParam == 0x84 || wParam == 0x5B)
return 0; return 0;
// Rotate key if necessary wParam = rotateKey(wParam, this->hidden->gapiInfo->coordinateTransform);
if (this->hidden->orientation != SDL_ORIENTATION_UP) }
wParam = rotateKey(wParam, this->hidden->orientation);
#endif #endif
/* Ignore repeated keys */ /* Ignore repeated keys */
if ( lParam&REPEATED_KEYMASK ) { if ( lParam&REPEATED_KEYMASK ) {
...@@ -167,14 +176,15 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ...@@ -167,14 +176,15 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_KEYUP: { case WM_KEYUP: {
SDL_keysym keysym; SDL_keysym keysym;
#ifdef _WIN32_WCE #ifdef SDL_VIDEO_DRIVER_GAPI
if(this->hidden->gapiInfo)
{
// Drop GAPI artifacts // Drop GAPI artifacts
if (wParam == 0x84 || wParam == 0x5B) if (wParam == 0x84 || wParam == 0x5B)
return 0; return 0;
// Rotate key if necessary wParam = rotateKey(wParam, this->hidden->gapiInfo->coordinateTransform);
if (this->hidden->orientation != SDL_ORIENTATION_UP) }
wParam = rotateKey(wParam, this->hidden->orientation);
#endif #endif
switch (wParam) { switch (wParam) {
...@@ -222,12 +232,11 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ...@@ -222,12 +232,11 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TranslateKey(wParam,HIWORD(lParam),&keysym,0)); TranslateKey(wParam,HIWORD(lParam),&keysym,0));
} }
return(0); return(0);
#if defined(SC_SCREENSAVE) && defined(SC_MONITORPOWER) #if defined(SC_SCREENSAVE) && defined(SC_MONITORPOWER)
case WM_SYSCOMMAND: { case WM_SYSCOMMAND: {
const DWORD val = (DWORD) (wParam & 0xFFF0); const DWORD val = (DWORD) (wParam & 0xFFF0);
if ((val == SC_SCREENSAVE) || (val == SC_MONITORPOWER)) { if ((val == SC_SCREENSAVE) || (val == SC_MONITORPOWER)) {
if (!allow_screensaver) { if (this->hidden->dibInfo && !allow_screensaver) {
/* Note that this doesn't stop anything on Vista /* Note that this doesn't stop anything on Vista
if the screensaver has a password. */ if the screensaver has a password. */
return(0); return(0);
...@@ -430,6 +439,11 @@ void DIB_InitOSKeymap(_THIS) ...@@ -430,6 +439,11 @@ void DIB_InitOSKeymap(_THIS)
VK_keymap[VK_SNAPSHOT] = SDLK_PRINT; VK_keymap[VK_SNAPSHOT] = SDLK_PRINT;
VK_keymap[VK_CANCEL] = SDLK_BREAK; VK_keymap[VK_CANCEL] = SDLK_BREAK;
VK_keymap[VK_APPS] = SDLK_MENU; VK_keymap[VK_APPS] = SDLK_MENU;
Arrows_keymap[3] = 0x25;
Arrows_keymap[2] = 0x26;
Arrows_keymap[1] = 0x27;
Arrows_keymap[0] = 0x28;
} }
#define EXTKEYPAD(keypad) ((scancode & 0x100)?(mvke):(keypad)) #define EXTKEYPAD(keypad) ((scancode & 0x100)?(mvke):(keypad))
...@@ -485,9 +499,19 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, ...@@ -485,9 +499,19 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym,
keysym->scancode = (unsigned char) scancode; keysym->scancode = (unsigned char) scancode;
keysym->mod = KMOD_NONE; keysym->mod = KMOD_NONE;
keysym->unicode = 0; keysym->unicode = 0;
if ((vkey == VK_RETURN) && (scancode & 0x100)) {
/* No VK_ code for the keypad enter key */
keysym->sym = SDLK_KP_ENTER;
}
else {
keysym->sym = VK_keymap[SDL_MapVirtualKey(scancode, vkey)];
}
if ( pressed && SDL_TranslateUNICODE ) { if ( pressed && SDL_TranslateUNICODE ) {
#ifdef NO_GETKEYBOARDSTATE #ifdef NO_GETKEYBOARDSTATE
/* Uh oh, better hope the vkey is close enough.. */ /* Uh oh, better hope the vkey is close enough.. */
if((keysym->sym == vkey) || (vkey > 0x7f))
keysym->unicode = vkey; keysym->unicode = vkey;
#else #else
BYTE keystate[256]; BYTE keystate[256];
...@@ -501,14 +525,6 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, ...@@ -501,14 +525,6 @@ static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym,
#endif /* NO_GETKEYBOARDSTATE */ #endif /* NO_GETKEYBOARDSTATE */
} }
if ((vkey == VK_RETURN) && (scancode & 0x100)) {
/* No VK_ code for the keypad enter key */
keysym->sym = SDLK_KP_ENTER;
}
else {
keysym->sym = VK_keymap[SDL_MapVirtualKey(scancode, vkey)];
}
#if 0 #if 0
{ {
HKL hLayoutCurrent = GetKeyboardLayout(0); HKL hLayoutCurrent = GetKeyboardLayout(0);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "../SDL_pixels_c.h" #include "../SDL_pixels_c.h"
#include "../../events/SDL_sysevents.h" #include "../../events/SDL_sysevents.h"
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#include "SDL_gapidibvideo.h"
#include "SDL_dibvideo.h" #include "SDL_dibvideo.h"
#include "../wincommon/SDL_syswm_c.h" #include "../wincommon/SDL_syswm_c.h"
#include "../wincommon/SDL_sysmouse_c.h" #include "../wincommon/SDL_sysmouse_c.h"
...@@ -128,6 +129,9 @@ static void DIB_DeleteDevice(SDL_VideoDevice *device) ...@@ -128,6 +129,9 @@ static void DIB_DeleteDevice(SDL_VideoDevice *device)
{ {
if ( device ) { if ( device ) {
if ( device->hidden ) { if ( device->hidden ) {
if ( device->hidden->dibInfo ) {
SDL_free( device->hidden->dibInfo );
}
SDL_free(device->hidden); SDL_free(device->hidden);
} }
if ( device->gl_data ) { if ( device->gl_data ) {
...@@ -147,6 +151,16 @@ static SDL_VideoDevice *DIB_CreateDevice(int devindex) ...@@ -147,6 +151,16 @@ static SDL_VideoDevice *DIB_CreateDevice(int devindex)
SDL_memset(device, 0, (sizeof *device)); SDL_memset(device, 0, (sizeof *device));
device->hidden = (struct SDL_PrivateVideoData *) device->hidden = (struct SDL_PrivateVideoData *)
SDL_malloc((sizeof *device->hidden)); SDL_malloc((sizeof *device->hidden));
if(device->hidden){
SDL_memset(device->hidden, 0, (sizeof *device->hidden));
device->hidden->dibInfo = (DibInfo *)SDL_malloc((sizeof(DibInfo)));
if(device->hidden->dibInfo == NULL)
{
SDL_free(device->hidden);
device->hidden = NULL;
}
}
device->gl_data = (struct SDL_PrivateGLData *) device->gl_data = (struct SDL_PrivateGLData *)
SDL_malloc((sizeof *device->gl_data)); SDL_malloc((sizeof *device->gl_data));
} }
...@@ -156,7 +170,7 @@ static SDL_VideoDevice *DIB_CreateDevice(int devindex) ...@@ -156,7 +170,7 @@ static SDL_VideoDevice *DIB_CreateDevice(int devindex)
DIB_DeleteDevice(device); DIB_DeleteDevice(device);
return(NULL); return(NULL);
} }
SDL_memset(device->hidden, 0, (sizeof *device->hidden)); SDL_memset(device->hidden->dibInfo, 0, (sizeof *device->hidden->dibInfo));
SDL_memset(device->gl_data, 0, (sizeof *device->gl_data)); SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
/* Set the function pointers */ /* Set the function pointers */
...@@ -347,6 +361,8 @@ int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -347,6 +361,8 @@ int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat)
this->hidden->supportRotation = ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL; this->hidden->supportRotation = ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL;
#endif #endif
/* Query for the desktop resolution */ /* Query for the desktop resolution */
SDL_desktop_mode.dmSize = sizeof(SDL_desktop_mode);
SDL_desktop_mode.dmDriverExtra = 0;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &SDL_desktop_mode);
this->info.current_w = SDL_desktop_mode.dmPelsWidth; this->info.current_w = SDL_desktop_mode.dmPelsWidth;
this->info.current_h = SDL_desktop_mode.dmPelsHeight; this->info.current_h = SDL_desktop_mode.dmPelsHeight;
...@@ -744,7 +760,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -744,7 +760,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
video->flags |= SDL_RESIZABLE; video->flags |= SDL_RESIZABLE;
} }
} }
#if WS_MAXIMIZE #if WS_MAXIMIZE && !defined(_WIN32_WCE)
if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE; if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
#endif #endif
} }
...@@ -1006,7 +1022,7 @@ int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) ...@@ -1006,7 +1022,7 @@ int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
entry->peBlue = colors[i].b; entry->peBlue = colors[i].b;
entry->peFlags = PC_NOCOLLAPSE; entry->peFlags = PC_NOCOLLAPSE;
} }
#ifdef SYSPAL_NOSTATIC #if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
/* Check to make sure black and white are in position */ /* Check to make sure black and white are in position */
if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) { if ( GetSystemPaletteUse(hdc) != SYSPAL_NOSTATIC256 ) {
moved_entries += CheckPaletteEntry(screen_logpal, 0, 0x00, 0x00, 0x00); moved_entries += CheckPaletteEntry(screen_logpal, 0, 0x00, 0x00, 0x00);
...@@ -1227,7 +1243,7 @@ void DIB_VideoQuit(_THIS) ...@@ -1227,7 +1243,7 @@ void DIB_VideoQuit(_THIS)
/* Exported for the windows message loop only */ /* Exported for the windows message loop only */
static void DIB_GrabStaticColors(HWND window) static void DIB_GrabStaticColors(HWND window)
{ {
#ifdef SYSPAL_NOSTATIC #if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
HDC hdc; HDC hdc;
hdc = GetDC(window); hdc = GetDC(window);
...@@ -1240,7 +1256,7 @@ static void DIB_GrabStaticColors(HWND window) ...@@ -1240,7 +1256,7 @@ static void DIB_GrabStaticColors(HWND window)
} }
static void DIB_ReleaseStaticColors(HWND window) static void DIB_ReleaseStaticColors(HWND window)
{ {
#ifdef SYSPAL_NOSTATIC #if defined(SYSPAL_NOSTATIC) && !defined(_WIN32_WCE)
HDC hdc; HDC hdc;
hdc = GetDC(window); hdc = GetDC(window);
......
...@@ -27,17 +27,9 @@ ...@@ -27,17 +27,9 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
/* for PDA */
typedef enum
{
SDL_ORIENTATION_UP,
SDL_ORIENTATION_DOWN,
SDL_ORIENTATION_LEFT,
SDL_ORIENTATION_RIGHT
} SDL_ScreenOrientation;
/* Private display data */ /* Private display data */
struct SDL_PrivateVideoData { struct DibInfo {
HBITMAP screen_bmp; HBITMAP screen_bmp;
HPALETTE screen_pal; HPALETTE screen_pal;
LOGPALETTE *screen_logpal; LOGPALETTE *screen_logpal;
...@@ -47,10 +39,7 @@ struct SDL_PrivateVideoData { ...@@ -47,10 +39,7 @@ struct SDL_PrivateVideoData {
int SDL_nummodes[NUM_MODELISTS]; int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS]; SDL_Rect **SDL_modelist[NUM_MODELISTS];
SDL_ScreenOrientation orientation;
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
int invert; /* do to remove, used by GAPI driver! */
char hiresFix; /* using hires mode without defining hires resource */
int supportRotation; /* for Pocket PC devices */ int supportRotation; /* for Pocket PC devices */
DWORD origRotation; /* for Pocket PC devices */ DWORD origRotation; /* for Pocket PC devices */
#endif #endif
...@@ -59,12 +48,12 @@ struct SDL_PrivateVideoData { ...@@ -59,12 +48,12 @@ struct SDL_PrivateVideoData {
int allow_screensaver; int allow_screensaver;
}; };
/* Old variable names */ /* Old variable names */
#define screen_bmp (this->hidden->screen_bmp) #define screen_bmp (this->hidden->dibInfo->screen_bmp)
#define screen_pal (this->hidden->screen_pal) #define screen_pal (this->hidden->dibInfo->screen_pal)
#define screen_logpal (this->hidden->screen_logpal) #define screen_logpal (this->hidden->dibInfo->screen_logpal)
#define grab_palette (this->hidden->grab_palette) #define grab_palette (this->hidden->dibInfo->grab_palette)
#define SDL_nummodes (this->hidden->SDL_nummodes) #define SDL_nummodes (this->hidden->dibInfo->SDL_nummodes)
#define SDL_modelist (this->hidden->SDL_modelist) #define SDL_modelist (this->hidden->dibInfo->SDL_modelist)
#define allow_screensaver (this->hidden->allow_screensaver) #define allow_screensaver (this->hidden->dibInfo->allow_screensaver)
#endif /* _SDL_dibvideo_h */ #endif /* _SDL_dibvideo_h */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_gapidibvideo_h
#define _SDL_gapidibvideo_h
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this
/* typedef these to be able to define pointers, but still force everybody who
* wants to access them to include the corresponding header */
typedef struct GapiInfo GapiInfo;
typedef struct DibInfo DibInfo;
/* for PDA */
typedef enum
{
SDL_ORIENTATION_UP,
SDL_ORIENTATION_DOWN,
SDL_ORIENTATION_LEFT,
SDL_ORIENTATION_RIGHT
} SDL_ScreenOrientation;
/* Private display data shared by gapi and windib*/
struct SDL_PrivateVideoData {
int supportRotation; /* for Pocket PC devices */
DWORD origRotation; /* for Pocket PC devices */
GapiInfo* gapiInfo;
DibInfo* dibInfo;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment