Removed Windows CE support from SDL 2.0.

It's a long-dead platform, and we don't have any way to build for, test, or
maintain it, so there's no sense in doing acrobatics to support it.

If you need Windows CE support, use SDL 1.2. If you need Windows Phone support,
send SDL 2.0 patches for the newer Windows Mobile platform.
This commit is contained in:
Ryan C. Gordon 2012-09-15 10:59:39 -04:00
parent 8253567b09
commit 5c732d6324
34 changed files with 22 additions and 848 deletions

View file

@ -1,55 +1,9 @@
Project files for embedded Visual C++ 3.0, 4.0 and Windows CE is no longer supported by SDL.
Visual Studio 2005 can be found in VisualCE.zip
SDL supports GAPI and WinDib output for Windows CE. We have left the CE support in SDL 1.2 for those that must have it, and we
will accept patches that support more modern Windows Mobile platforms for
SDL 2.0.
GAPI driver supports: --ryan.
- all possible WinCE devices (Pocket PC, Smartphones, HPC)
with different orientations of video memory and resolutions.
- 4, 8 and 16 bpp devices
- special handling of 8bpp on 8bpp devices
- VGA mode, you can even switch between VGA and GAPI in runtime
(between 240x320 and 480x640 for example). On VGA devices you can
use either GAPI or VGA.
- Landscape mode and automatic rotation of buttons and stylus coordinates.
To enable landscape mode make width of video screen bigger than height.
For example:
SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN)
- WM2005
- SDL_ListModes
NOTE:
There are several SDL features not available in the WinCE port of SDL.
- DirectX is not yet available
- Semaphores are not available
- Joystick support is not available
- CD-ROM control is not available
In addition, there are several features that run in "degraded" mode:
Preprocessor Symbol Effect
=================== =================================
SDL_systimer.c:
USE_GETTICKCOUNT Less accurate values for SDL time functions
USE_SETTIMER Use only a single marginally accurate timer
SDL_syswm.c:
DISABLE_ICON_SUPPORT Can't set the runtime window icon
SDL_sysmouse.c:
USE_STATIC_CURSOR Only the arrow cursor is available
SDL_sysevents.c:
NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus
SDL_dibevents.c:
NO_GETKEYBOARDSTATE Very limited keycode translation
SDL_dibvideo.c:
NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp
NO_CHANGEDISPLAYSETTINGS No fullscreen support
NO_GAMMA_SUPPORT Gamma correction not available

View file

@ -1908,6 +1908,8 @@ CheckWINDOWS()
],[ ],[
],[ ],[
have_wince=yes have_wince=yes
AC_MSG_ERROR([
*** Sorry, Windows CE is no longer supported.
]) ])
AC_MSG_RESULT($have_wince) AC_MSG_RESULT($have_wince)
@ -2239,82 +2241,6 @@ case "$host" in
have_timers=yes have_timers=yes
fi fi
;; ;;
*-wince* | *-mingw32ce)
ARCH=win32
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckWINDOWS
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
have_video=yes
AC_ARG_ENABLE(render-d3d,
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
, enable_render_d3d=yes)
enable_render_d3d=no
if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
fi
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
if test x$have_dsound = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
fi
if test x$have_xaudio2 = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
fi
have_audio=yes
fi
# Set up dummy files for the joystick for now
if test x$enable_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
have_joystick=yes
fi
# Set up files for the thread library
if test x$enable_threads = xyes; then
AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
have_threads=yes
fi
# Set up files for the timer library
if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMER_WINCE, 1, [ ])
SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
have_timers=yes
fi
# Set up files for the shared object loading library
if test x$enable_loadso = xyes; then
AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
have_loadso=yes
fi
# Set up the system libraries we need
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
# mingw32ce library
case "$host" in
*-mingw32ce)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
;;
*)
;;
esac
# The Windows platform requires special setup
SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
EXTRA_LDFLAGS="-lSDL2main $EXTRA_LDFLAGS"
;;
*-*-cygwin* | *-*-mingw32*) *-*-cygwin* | *-*-mingw32*)
ARCH=win32 ARCH=win32
if test "$build" != "$host"; then # cross-compiling if test "$build" != "$host"; then # cross-compiling

View file

@ -49,9 +49,9 @@ on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it. assert can have unique static variables associated with it.
*/ */
#if defined(_MSC_VER) && !defined(_WIN32_WCE) #if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */ /* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void); extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak() #define SDL_TriggerBreakpoint() __debugbreak()
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )

View file

@ -65,7 +65,7 @@
/* Need to do this here because intrin.h has C++ code in it */ /* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(_WIN32_WCE) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
#include <intrin.h> #include <intrin.h>
#define HAVE_MSC_ATOMICS 1 #define HAVE_MSC_ATOMICS 1
#endif #endif

View file

@ -242,7 +242,6 @@
#undef SDL_TIMER_NDS #undef SDL_TIMER_NDS
#undef SDL_TIMER_UNIX #undef SDL_TIMER_UNIX
#undef SDL_TIMER_WINDOWS #undef SDL_TIMER_WINDOWS
#undef SDL_TIMER_WINCE
/* Enable various video drivers */ /* Enable various video drivers */
#undef SDL_VIDEO_DRIVER_BWINDOW #undef SDL_VIDEO_DRIVER_BWINDOW

View file

@ -85,9 +85,7 @@ typedef unsigned int uintptr_t;
#define HAVE_STRING_H 1 #define HAVE_STRING_H 1
#define HAVE_CTYPE_H 1 #define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1 #define HAVE_MATH_H 1
#ifndef _WIN32_WCE
#define HAVE_SIGNAL_H 1 #define HAVE_SIGNAL_H 1
#endif
/* C library functions */ /* C library functions */
#define HAVE_MALLOC 1 #define HAVE_MALLOC 1
@ -143,22 +141,15 @@ typedef unsigned int uintptr_t;
#endif #endif
/* Enable various audio drivers */ /* Enable various audio drivers */
#ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_XAUDIO2 1
#endif
#define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */ /* Enable various input drivers */
#ifdef _WIN32_WCE
#define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DUMMY 1
#else
#define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_DINPUT 1
#define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_DINPUT 1
#endif
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1 #define SDL_LOADSO_WINDOWS 1
@ -167,24 +158,17 @@ typedef unsigned int uintptr_t;
#define SDL_THREAD_WINDOWS 1 #define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */ /* Enable various timer systems */
#ifdef _WIN32_WCE
#define SDL_TIMER_WINCE 1
#else
#define SDL_TIMER_WINDOWS 1 #define SDL_TIMER_WINDOWS 1
#endif
/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1 #define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef _WIN32_WCE
#ifndef SDL_VIDEO_RENDER_D3D #ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1 #define SDL_VIDEO_RENDER_D3D 1
#endif #endif
#endif
/* Enable OpenGL support */ /* Enable OpenGL support */
#ifndef _WIN32_WCE
#ifndef SDL_VIDEO_OPENGL #ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1 #define SDL_VIDEO_OPENGL 1
#endif #endif
@ -194,7 +178,6 @@ typedef unsigned int uintptr_t;
#ifndef SDL_VIDEO_RENDER_OGL #ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1 #define SDL_VIDEO_RENDER_OGL 1
#endif #endif
#endif
/* Enable system power support */ /* Enable system power support */
#define SDL_POWER_WINDOWS 1 #define SDL_POWER_WINDOWS 1

View file

@ -32,7 +32,7 @@
/* Need to do this here because intrin.h has C++ code in it */ /* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(_WIN32_WCE) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
#include <intrin.h> #include <intrin.h>
#ifndef _WIN64 #ifndef _WIN64
#define __MMX__ #define __MMX__

View file

@ -86,9 +86,7 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
* library! * library!
*/ */
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
#ifndef _WIN32_WCE
#include <process.h> /* This has _beginthread() and _endthread() defined! */ #include <process.h> /* This has _beginthread() and _endthread() defined! */
#endif
typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
unsigned (__stdcall * unsigned (__stdcall *
@ -106,21 +104,11 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread); pfnSDL_CurrentEndThread pfnEndThread);
#if defined(_WIN32_WCE)
/**
* Create a thread.
*/
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, NULL, NULL)
#else
/** /**
* Create a thread. * Create a thread.
*/ */
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex) #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex)
#endif
#else #else
/** /**

View file

@ -288,11 +288,7 @@ SDL_GetPlatform()
#elif __SOLARIS__ #elif __SOLARIS__
return "Solaris"; return "Solaris";
#elif __WIN32__ #elif __WIN32__
#ifdef _WIN32_WCE
return "Windows CE";
#else
return "Windows"; return "Windows";
#endif
#elif __IPHONEOS__ #elif __IPHONEOS__
return "iPhone OS"; return "iPhone OS";
#else #else

View file

@ -1028,7 +1028,7 @@ open_audio_device(const char *devname, int iscapture,
char name[64]; char name[64];
SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) (id + 1)); SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) (id + 1));
/* !!! FIXME: this is nasty. */ /* !!! FIXME: this is nasty. */
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) #if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread #undef SDL_CreateThread
device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL); device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL);
#else #else

View file

@ -31,9 +31,6 @@
#include "SDL_audio.h" #include "SDL_audio.h"
#include "../SDL_audio_c.h" #include "../SDL_audio_c.h"
#include "SDL_winmm.h" #include "SDL_winmm.h"
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
#include "win_ce_semaphore.h"
#endif
#define DETECT_DEV_IMPL(typ, capstyp) \ #define DETECT_DEV_IMPL(typ, capstyp) \
static void DetectWave##typ##Devs(SDL_AddAudioDevice addfn) { \ static void DetectWave##typ##Devs(SDL_AddAudioDevice addfn) { \
@ -75,11 +72,7 @@ CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance,
return; return;
/* Signal that we have a new buffer of data */ /* Signal that we have a new buffer of data */
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
ReleaseSemaphoreCE(this->hidden->audio_sem, 1, NULL);
#else
ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
#endif
} }
@ -95,11 +88,7 @@ FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
return; return;
/* Signal that we are done playing a buffer */ /* Signal that we are done playing a buffer */
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
ReleaseSemaphoreCE(this->hidden->audio_sem, 1, NULL);
#else
ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
#endif
} }
static void static void
@ -123,11 +112,7 @@ static void
WINMM_WaitDevice(_THIS) WINMM_WaitDevice(_THIS)
{ {
/* Wait for an audio chunk to finish */ /* Wait for an audio chunk to finish */
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
WaitForSemaphoreCE(this->hidden->audio_sem, INFINITE);
#else
WaitForSingleObject(this->hidden->audio_sem, INFINITE); WaitForSingleObject(this->hidden->audio_sem, INFINITE);
#endif
} }
static Uint8 * static Uint8 *
@ -173,11 +158,7 @@ WINMM_CloseDevice(_THIS)
int i; int i;
if (this->hidden->audio_sem) { if (this->hidden->audio_sem) {
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
CloseSynchHandle(this->hidden->audio_sem);
#else
CloseHandle(this->hidden->audio_sem); CloseHandle(this->hidden->audio_sem);
#endif
this->hidden->audio_sem = 0; this->hidden->audio_sem = 0;
} }
@ -349,11 +330,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
/* Create the audio buffer semaphore */ /* Create the audio buffer semaphore */
this->hidden->audio_sem = this->hidden->audio_sem =
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
CreateSemaphoreCE(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
#else
CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL); CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
#endif
if (this->hidden->audio_sem == NULL) { if (this->hidden->audio_sem == NULL) {
WINMM_CloseDevice(this); WINMM_CloseDevice(this);
SDL_SetError("Couldn't create semaphore"); SDL_SetError("Couldn't create semaphore");

View file

@ -43,9 +43,6 @@
#ifdef __WIN32__ #ifdef __WIN32__
/* Functions to read/write Win32 API file pointers */ /* Functions to read/write Win32 API file pointers */
/* Will not use it on WinCE because stdio is buffered, it means
faster, and all stdio functions anyway are embedded in coredll.dll -
the main wince dll*/
#include "../core/windows/SDL_windows.h" #include "../core/windows/SDL_windows.h"
@ -58,9 +55,7 @@
static int SDLCALL static int SDLCALL
windows_file_open(SDL_RWops * context, const char *filename, const char *mode) windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
{ {
#ifndef _WIN32_WCE
UINT old_error_mode; UINT old_error_mode;
#endif
HANDLE h; HANDLE h;
DWORD r_right, w_right; DWORD r_right, w_right;
DWORD must_exist, truncate; DWORD must_exist, truncate;
@ -98,16 +93,6 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
SDL_OutOfMemory(); SDL_OutOfMemory();
return -1; return -1;
} }
#ifdef _WIN32_WCE
{
LPTSTR tstr = WIN_UTF8ToString(filename);
h = CreateFile(tstr, (w_right | r_right),
(w_right) ? 0 : FILE_SHARE_READ, NULL,
(must_exist | truncate | a_mode),
FILE_ATTRIBUTE_NORMAL, NULL);
SDL_free(tstr);
}
#else
/* Do not open a dialog box if failure */ /* Do not open a dialog box if failure */
old_error_mode = old_error_mode =
SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
@ -123,7 +108,6 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
/* restore old behavior */ /* restore old behavior */
SetErrorMode(old_error_mode); SetErrorMode(old_error_mode);
#endif /* _WIN32_WCE */
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
SDL_free(context->hidden.windowsio.buffer.data); SDL_free(context->hidden.windowsio.buffer.data);

View file

@ -49,14 +49,7 @@ SDL_LoadObject(const char *sofile)
void * void *
SDL_LoadFunction(void *handle, const char *name) SDL_LoadFunction(void *handle, const char *name)
{ {
#ifdef _WIN32_WCE
LPTSTR tstr = WIN_UTF8ToString(name);
void *symbol = (void *) GetProcAddress((HMODULE) handle, tstr);
SDL_free(tstr);
#else
void *symbol = (void *) GetProcAddress((HMODULE) handle, name); void *symbol = (void *) GetProcAddress((HMODULE) handle, name);
#endif
if (symbol == NULL) { if (symbol == NULL) {
char errbuf[512]; char errbuf[512];
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf)); SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));

View file

@ -18,16 +18,9 @@
#include "SDL_main.h" #include "SDL_main.h"
#ifdef main #ifdef main
# ifndef _WIN32_WCE_EMULATION
# undef main # undef main
# endif /* _WIN32_WCE_EMULATION */
#endif /* main */ #endif /* main */
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
/* seems to be undefined in Win CE although in online help */
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
#endif /* _WIN32_WCE < 300 */
static void static void
UnEscapeQuotes(char *arg) UnEscapeQuotes(char *arg)
{ {
@ -130,7 +123,7 @@ OutOfMemory(void)
return FALSE; return FALSE;
} }
#if defined(_MSC_VER) && !defined(_WIN32_WCE) #if defined(_MSC_VER)
/* The VC++ compiler needs main defined */ /* The VC++ compiler needs main defined */
#define console_main main #define console_main main
#endif #endif
@ -158,28 +151,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int sw)
char **argv; char **argv;
int argc; int argc;
char *cmdline; char *cmdline;
#ifdef _WIN32_WCE
wchar_t *bufp;
int nLen;
#else
char *bufp; char *bufp;
size_t nLen; size_t nLen;
#endif
#ifdef _WIN32_WCE
nLen = wcslen(szCmdLine) + 128 + 1;
bufp = SDL_stack_alloc(wchar_t, nLen * 2);
wcscpy(bufp, TEXT("\""));
GetModuleFileName(NULL, bufp + 1, 128 - 3);
wcscpy(bufp + wcslen(bufp), TEXT("\" "));
wcsncpy(bufp + wcslen(bufp), szCmdLine, nLen - wcslen(bufp));
nLen = wcslen(bufp) + 1;
cmdline = SDL_stack_alloc(char, nLen);
if (cmdline == NULL) {
return OutOfMemory();
}
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
#else
/* Grab the command line */ /* Grab the command line */
bufp = GetCommandLine(); bufp = GetCommandLine();
nLen = SDL_strlen(bufp) + 1; nLen = SDL_strlen(bufp) + 1;
@ -188,7 +162,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int sw)
return OutOfMemory(); return OutOfMemory();
} }
SDL_strlcpy(cmdline, bufp, nLen); SDL_strlcpy(cmdline, bufp, nLen);
#endif
/* Parse it into argv and argc */ /* Parse it into argv and argc */
argc = ParseCommandLine(cmdline, NULL); argc = ParseCommandLine(cmdline, NULL);

View file

@ -30,19 +30,11 @@
SDL_bool SDL_bool
SDL_GetPowerInfo_Windows(SDL_PowerState * state, int *seconds, int *percent) SDL_GetPowerInfo_Windows(SDL_PowerState * state, int *seconds, int *percent)
{ {
#ifdef _WIN32_WCE
SYSTEM_POWER_STATUS_EX status;
#else
SYSTEM_POWER_STATUS status; SYSTEM_POWER_STATUS status;
#endif
SDL_bool need_details = SDL_FALSE; SDL_bool need_details = SDL_FALSE;
/* This API should exist back to Win95 and Windows CE. */ /* This API should exist back to Win95. */
#ifdef _WIN32_WCE
if (!GetSystemPowerStatusEx(&status, FALSE))
#else
if (!GetSystemPowerStatus(&status)) if (!GetSystemPowerStatus(&status))
#endif
{ {
/* !!! FIXME: push GetLastError() into SDL_GetError() */ /* !!! FIXME: push GetLastError() into SDL_GetError() */
*state = SDL_POWERSTATE_UNKNOWN; *state = SDL_POWERSTATE_UNKNOWN;

View file

@ -24,7 +24,7 @@
#ifndef HAVE_GETENV #ifndef HAVE_GETENV
#if defined(__WIN32__) && !defined(_WIN32_WCE) #if defined(__WIN32__)
#include "../core/windows/SDL_windows.h" #include "../core/windows/SDL_windows.h"

View file

@ -44,12 +44,8 @@ SDL_CreateMutex(void)
mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
if (mutex) { if (mutex) {
/* Initialize */ /* Initialize */
#ifdef _WIN32_WCE
InitializeCriticalSection(&mutex->cs);
#else
/* On SMP systems, a non-zero spin count generally helps performance */ /* On SMP systems, a non-zero spin count generally helps performance */
InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
#endif
} else { } else {
SDL_OutOfMemory(); SDL_OutOfMemory();
} }

View file

@ -27,18 +27,10 @@
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "SDL_thread.h" #include "SDL_thread.h"
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
#include "win_ce_semaphore.h"
#endif
struct SDL_semaphore struct SDL_semaphore
{ {
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
SYNCHHANDLE id;
#else
HANDLE id; HANDLE id;
#endif
LONG count; LONG count;
}; };
@ -53,11 +45,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
if (sem) { if (sem) {
/* Create the semaphore, with max value 32K */ /* Create the semaphore, with max value 32K */
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
sem->id = CreateSemaphoreCE(NULL, initial_value, 32 * 1024, NULL);
#else
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL); sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
#endif
sem->count = initial_value; sem->count = initial_value;
if (!sem->id) { if (!sem->id) {
SDL_SetError("Couldn't create semaphore"); SDL_SetError("Couldn't create semaphore");
@ -76,11 +64,7 @@ SDL_DestroySemaphore(SDL_sem * sem)
{ {
if (sem) { if (sem) {
if (sem->id) { if (sem->id) {
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
CloseSynchHandle(sem->id);
#else
CloseHandle(sem->id); CloseHandle(sem->id);
#endif
sem->id = 0; sem->id = 0;
} }
SDL_free(sem); SDL_free(sem);
@ -103,11 +87,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
} else { } else {
dwMilliseconds = (DWORD) timeout; dwMilliseconds = (DWORD) timeout;
} }
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
switch (WaitForSemaphoreCE(sem->id, dwMilliseconds)) {
#else
switch (WaitForSingleObject(sem->id, dwMilliseconds)) { switch (WaitForSingleObject(sem->id, dwMilliseconds)) {
#endif
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
InterlockedDecrement(&sem->count); InterlockedDecrement(&sem->count);
retval = 0; retval = 0;
@ -159,11 +139,7 @@ SDL_SemPost(SDL_sem * sem)
* is waiting for this semaphore. * is waiting for this semaphore.
*/ */
InterlockedIncrement(&sem->count); InterlockedIncrement(&sem->count);
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
if (ReleaseSemaphoreCE(sem->id, 1, NULL) == FALSE) {
#else
if (ReleaseSemaphore(sem->id, 1, NULL) == FALSE) { if (ReleaseSemaphore(sem->id, 1, NULL) == FALSE) {
#endif
InterlockedDecrement(&sem->count); /* restore */ InterlockedDecrement(&sem->count); /* restore */
SDL_SetError("ReleaseSemaphore() failed"); SDL_SetError("ReleaseSemaphore() failed");
return -1; return -1;

View file

@ -30,10 +30,8 @@
#include "SDL_systhread_c.h" #include "SDL_systhread_c.h"
#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
#ifndef _WIN32_WCE
/* We'll use the C library from this DLL */ /* We'll use the C library from this DLL */
#include <process.h> #include <process.h>
#endif
/* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */ /* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */
#if (defined(__MINGW32__) && (__GNUC__ < 4)) #if (defined(__MINGW32__) && (__GNUC__ < 4))
@ -112,13 +110,8 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
int int
SDL_SYS_CreateThread(SDL_Thread * thread, void *args) SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
{ {
#ifdef _WIN32_WCE
pfnSDL_CurrentBeginThread pfnBeginThread = NULL;
pfnSDL_CurrentEndThread pfnEndThread = NULL;
#else
pfnSDL_CurrentBeginThread pfnBeginThread = _beginthreadex; pfnSDL_CurrentBeginThread pfnBeginThread = _beginthreadex;
pfnSDL_CurrentEndThread pfnEndThread = _endthreadex; pfnSDL_CurrentEndThread pfnEndThread = _endthreadex;
#endif
#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */ #endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
pThreadStartParms pThreadParms = pThreadStartParms pThreadParms =
(pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms)); (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms));

View file

@ -1,233 +0,0 @@
/* win_ce_semaphore.c
Copyright (c) 1998, Johnson M. Hart
(with corrections 2001 by Rainer Loritz)
Permission is granted for any and all use providing that this
copyright is properly acknowledged.
There are no assurances of suitability for any use whatsoever.
WINDOWS CE: There is a collection of Windows CE functions to simulate
semaphores using only a mutex and an event. As Windows CE events cannot
be named, these simulated semaphores cannot be named either.
Implementation notes:
1. All required internal data structures are allocated on the process's heap.
2. Where appropriate, a new error code is returned (see the header
file), or, if the error is a Win32 error, that code is unchanged.
3. Notice the new handle type "SYNCHHANDLE" that has handles, counters,
and other information. This structure will grow as new objects are added
to this set; some members are specific to only one or two of the objects.
4. Mutexes are used for critical sections. These could be replaced with
CRITICAL_SECTION objects but then this would give up the time out
capability.
5. The implementation shows several interesting aspects of synchronization, some
of which are specific to Win32 and some of which are general. These are pointed
out in the comments as appropriate.
6. The wait function emulates WaitForSingleObject only. An emulation of
WaitForMultipleObjects is much harder to implement outside the kernel,
and it is not clear how to handle a mixture of WCE semaphores and normal
events and mutexes.
*/
#include "SDL_config.h"
#if SDL_THREAD_WINDOWS
#include "../../core/windows/SDL_windows.h"
#include "win_ce_semaphore.h"
static SYNCHHANDLE CleanUp(SYNCHHANDLE hSynch, DWORD Flags);
SYNCHHANDLE
CreateSemaphoreCE(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, /* pointer to security attributes */
LONG lInitialCount, /* initial count */
LONG lMaximumCount, /* maximum count */
LPCTSTR lpName)
/* Semaphore for use with Windows CE that does not support them directly.
Requires a counter, a mutex to protect the counter, and an
autoreset event.
Here are the rules that must always hold between the autoreset event
and the mutex (any violation of these rules by the CE semaphore functions
will, in all likelihood, result in a defect):
1. No thread can set, pulse, or reset the event,
nor can it access any part of the SYNCHHANDLE structure,
without first gaining ownership of the mutex.
BUT, a thread can wait on the event without owning the mutex
(this is clearly necessary or else the event could never be set).
2. The event is in a signaled state if and only if the current semaphore
count ("CurCount") is greater than zero.
3. The semaphore count is always >= 0 and <= the maximum count */
{
SYNCHHANDLE hSynch = NULL, result = NULL;
__try {
if (lInitialCount > lMaximumCount || lMaximumCount < 0
|| lInitialCount < 0) {
/* Bad parameters */
SetLastError(SYNCH_ERROR);
__leave;
}
hSynch =
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, SYNCH_HANDLE_SIZE);
if (hSynch == NULL)
__leave;
hSynch->MaxCount = lMaximumCount;
hSynch->CurCount = lInitialCount;
hSynch->lpName = lpName;
hSynch->hMutex = CreateMutex(lpSemaphoreAttributes, FALSE, NULL);
WaitForSingleObject(hSynch->hMutex, INFINITE);
/* Create the event. It is initially signaled if and only if the
initial count is > 0 */
hSynch->hEvent = CreateEvent(lpSemaphoreAttributes, FALSE,
lInitialCount > 0, NULL);
ReleaseMutex(hSynch->hMutex);
hSynch->hSemph = NULL;
}
__finally {
/* Return with the handle, or, if there was any error, return
a null after closing any open handles and freeing any allocated memory. */
result =
CleanUp(hSynch, 6 /* An event and a mutex, but no semaphore. */ );
}
return result;
}
BOOL
ReleaseSemaphoreCE(SYNCHHANDLE hSemCE, LONG cReleaseCount,
LPLONG lpPreviousCount)
/* Windows CE equivalent to ReleaseSemaphore. */
{
BOOL Result = TRUE;
/* Gain access to the object to assure that the release count
would not cause the total count to exceed the maximum. */
__try {
WaitForSingleObject(hSemCE->hMutex, INFINITE);
/* reply only if asked to */
if (lpPreviousCount != NULL)
*lpPreviousCount = hSemCE->CurCount;
if (hSemCE->CurCount + cReleaseCount > hSemCE->MaxCount
|| cReleaseCount <= 0) {
SetLastError(SYNCH_ERROR);
Result = FALSE;
__leave;
}
hSemCE->CurCount += cReleaseCount;
/* Set the autoreset event, releasing exactly one waiting thread, now or
in the future. */
SetEvent(hSemCE->hEvent);
}
__finally {
ReleaseMutex(hSemCE->hMutex);
}
return Result;
}
DWORD
WaitForSemaphoreCE(SYNCHHANDLE hSemCE, DWORD dwMilliseconds)
/* Windows CE semaphore equivalent of WaitForSingleObject. */
{
DWORD WaitResult;
WaitResult = WaitForSingleObject(hSemCE->hMutex, dwMilliseconds);
if (WaitResult != WAIT_OBJECT_0 && WaitResult != WAIT_ABANDONED_0)
return WaitResult;
while (hSemCE->CurCount <= 0) {
/* The count is 0, and the thread must wait on the event (which, by
the rules, is currently reset) for semaphore resources to become
available. First, of course, the mutex must be released so that another
thread will be capable of setting the event. */
ReleaseMutex(hSemCE->hMutex);
/* Wait for the event to be signaled, indicating a semaphore state change.
The event is autoreset and signaled with a SetEvent (not PulseEvent)
so exactly one waiting thread (whether or not there is currently
a waiting thread) is released as a result of the SetEvent. */
WaitResult = WaitForSingleObject(hSemCE->hEvent, dwMilliseconds);
if (WaitResult != WAIT_OBJECT_0)
return WaitResult;
/* This is where the properties of setting of an autoreset event is critical
to assure that, even if the semaphore state changes between the
preceding Wait and the next, and even if NO threads are waiting
on the event at the time of the SetEvent, at least one thread
will be released.
Pulsing a manual reset event would appear to work, but it would have
a defect which could appear if the semaphore state changed between
the two waits. */
WaitResult = WaitForSingleObject(hSemCE->hMutex, dwMilliseconds);
if (WaitResult != WAIT_OBJECT_0 && WaitResult != WAIT_ABANDONED_0)
return WaitResult;
}
/* The count is not zero and this thread owns the mutex. */
hSemCE->CurCount--;
/* The event is now unsignaled, BUT, the semaphore count may not be
zero, in which case the event should be signaled again
before releasing the mutex. */
if (hSemCE->CurCount > 0)
SetEvent(hSemCE->hEvent);
ReleaseMutex(hSemCE->hMutex);
return WaitResult;
}
BOOL
CloseSynchHandle(SYNCHHANDLE hSynch)
/* Close a synchronization handle.
Improvement: Test for a valid handle before dereferencing the handle. */
{
BOOL Result = TRUE;
if (hSynch->hEvent != NULL)
Result = Result && CloseHandle(hSynch->hEvent);
if (hSynch->hMutex != NULL)
Result = Result && CloseHandle(hSynch->hMutex);
if (hSynch->hSemph != NULL)
Result = Result && CloseHandle(hSynch->hSemph);
HeapFree(GetProcessHeap(), 0, hSynch);
return (Result);
}
static SYNCHHANDLE
CleanUp(SYNCHHANDLE hSynch, DWORD Flags)
{ /* Prepare to return from a create of a synchronization handle.
If there was any failure, free any allocated resources.
"Flags" indicates which Win32 objects are required in the
synchronization handle. */
BOOL ok = TRUE;
if (hSynch == NULL)
return NULL;
if ((Flags & 4) == 1 && (hSynch->hEvent == NULL))
ok = FALSE;
if ((Flags & 2) == 1 && (hSynch->hMutex == NULL))
ok = FALSE;
if ((Flags & 1) == 1 && (hSynch->hEvent == NULL))
ok = FALSE;
if (!ok) {
CloseSynchHandle(hSynch);
return NULL;
}
/* Everything worked */
return hSynch;
}
#endif /* SDL_THREAD_WINDOWS */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -1,25 +0,0 @@
/* win_ce_semaphore.h - header file to go with win_ce_semaphore.c */
typedef struct _SYNCH_HANDLE_STRUCTURE
{
HANDLE hEvent;
HANDLE hMutex;
HANDLE hSemph;
LONG MaxCount;
volatile LONG CurCount;
LPCTSTR lpName;
} SYNCH_HANDLE_STRUCTURE, *SYNCHHANDLE;
#define SYNCH_HANDLE_SIZE sizeof (SYNCH_HANDLE_STRUCTURE)
/* Error codes - all must have bit 29 set */
#define SYNCH_ERROR 0X20000000 /* EXERCISE - REFINE THE ERROR NUMBERS */
extern SYNCHHANDLE CreateSemaphoreCE(LPSECURITY_ATTRIBUTES, LONG, LONG,
LPCTSTR);
extern BOOL ReleaseSemaphoreCE(SYNCHHANDLE, LONG, LPLONG);
extern DWORD WaitForSemaphoreCE(SYNCHHANDLE, DWORD);
extern BOOL CloseSynchHandle(SYNCHHANDLE);
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -223,7 +223,7 @@ SDL_TimerInit(void)
data->active = SDL_TRUE; data->active = SDL_TRUE;
/* !!! FIXME: this is nasty. */ /* !!! FIXME: this is nasty. */
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) #if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread #undef SDL_CreateThread
data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL); data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL);
#else #else

View file

@ -1,110 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#ifdef SDL_TIMER_WINCE
#include "../../core/windows/SDL_windows.h"
#include "SDL_timer.h"
static Uint64 start_date;
static Uint64 start_ticks;
static Uint64
wce_ticks(void)
{
return ((Uint64) GetTickCount());
}
static Uint64
wce_date(void)
{
union
{
FILETIME ftime;
Uint64 itime;
} ftime;
SYSTEMTIME stime;
GetSystemTime(&stime);
SystemTimeToFileTime(&stime, &ftime.ftime);
ftime.itime /= 10000; // Convert 100ns intervals to 1ms intervals
// Remove ms portion, which can't be relied on
ftime.itime -= (ftime.itime % 1000);
return (ftime.itime);
}
static Sint32
wce_rel_ticks(void)
{
return ((Sint32) (wce_ticks() - start_ticks));
}
static Sint32
wce_rel_date(void)
{
return ((Sint32) (wce_date() - start_date));
}
/* Recard start-time of application for reference */
void
SDL_StartTicks(void)
{
start_date = wce_date();
start_ticks = wce_ticks();
}
/* Return time in ms relative to when SDL was started */
Uint32
SDL_GetTicks()
{
Sint32 offset = wce_rel_date() - wce_rel_ticks();
if ((offset < -1000) || (offset > 1000)) {
// fprintf(stderr,"Time desync(%+d), resyncing\n",offset/1000);
start_ticks -= offset;
}
return ((Uint32) wce_rel_ticks());
}
Uint64
SDL_GetPerformanceCounter(void)
{
return SDL_GetTicks();
}
Uint64
SDL_GetPerformanceFrequency(void)
{
return 1000;
}
/* Give up approx. givem milliseconds to the OS. */
void
SDL_Delay(Uint32 ms)
{
Sleep(ms);
}
#endif /* SDL_TIMER_WINCE */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -27,10 +27,6 @@
#include "SDL_timer.h" #include "SDL_timer.h"
#ifdef _WIN32_WCE
#error This is WinCE. Please use src/timer/wince/SDL_systimer.c instead.
#endif
#define TIME_WRAP_VALUE (~(DWORD)0) #define TIME_WRAP_VALUE (~(DWORD)0)
/* The first (low-resolution) ticks value of the application */ /* The first (low-resolution) ticks value of the application */

View file

@ -33,7 +33,7 @@
into the general blitting mechanism. into the general blitting mechanism.
*/ */
#if ((defined(_MFC_VER) && defined(_M_IX86)/* && !defined(_WIN32_WCE) still needed? */) || \ #if ((defined(_MFC_VER) && defined(_M_IX86)) || \
defined(__WATCOMC__) || \ defined(__WATCOMC__) || \
(defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES
/* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct /* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct

View file

@ -92,11 +92,7 @@ WIN_SetClipboardText(_THIS, const char *text)
WIN_SetError("Couldn't set clipboard data"); WIN_SetError("Couldn't set clipboard data");
result = -1; result = -1;
} }
#ifdef _WIN32_WCE
data->clipboard_count = 0;
#else
data->clipboard_count = GetClipboardSequenceNumber(); data->clipboard_count = GetClipboardSequenceNumber();
#endif
} }
SDL_free(tstr); SDL_free(tstr);
@ -150,13 +146,7 @@ WIN_HasClipboardText(_THIS)
void void
WIN_CheckClipboardUpdate(struct SDL_VideoData * data) WIN_CheckClipboardUpdate(struct SDL_VideoData * data)
{ {
DWORD count; const DWORD count = GetClipboardSequenceNumber();
#ifdef _WIN32_WCE
count = 0;
#else
count = GetClipboardSequenceNumber();
#endif
if (count != data->clipboard_count) { if (count != data->clipboard_count) {
if (data->clipboard_count) { if (data->clipboard_count) {
SDL_SendClipboardUpdate(); SDL_SendClipboardUpdate();

View file

@ -164,12 +164,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(data->window, SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_WINDOWEVENT_RESTORED, 0, 0);
#ifndef _WIN32_WCE /* WinCE misses IsZoomed() */
if (IsZoomed(hwnd)) { if (IsZoomed(hwnd)) {
SDL_SendWindowEvent(data->window, SDL_SendWindowEvent(data->window,
SDL_WINDOWEVENT_MAXIMIZED, 0, 0); SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
} }
#endif
if (SDL_GetKeyboardFocus() != data->window) { if (SDL_GetKeyboardFocus() != data->window) {
SDL_SetKeyboardFocus(data->window); SDL_SetKeyboardFocus(data->window);
} }
@ -211,20 +209,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if(SDL_GetMouse()->relative_mode) if(SDL_GetMouse()->relative_mode)
break; break;
#ifdef _WIN32_WCE
/* transform coords for VGA, WVGA... */
{
SDL_VideoData *videodata = data->videodata;
if(videodata->CoordTransform) {
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
videodata->CoordTransform(data->window, &pt);
SDL_SendMouseMotion(data->window, 0, pt.x, pt.y);
break;
}
}
#endif
SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam)); SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam));
break; break;
@ -463,16 +447,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
style = GetWindowLong(hwnd, GWL_STYLE); style = GetWindowLong(hwnd, GWL_STYLE);
#ifdef _WIN32_WCE
menu = FALSE;
#else
/* DJM - according to the docs for GetMenu(), the /* DJM - according to the docs for GetMenu(), the
return value is undefined if hwnd is a child window. return value is undefined if hwnd is a child window.
Aparently it's too difficult for MS to check Aparently it's too difficult for MS to check
inside their function, so I have to do it here. inside their function, so I have to do it here.
*/ */
menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
#endif
AdjustWindowRectEx(&size, style, menu, 0); AdjustWindowRectEx(&size, style, menu, 0);
w = size.right - size.left; w = size.right - size.left;
h = size.bottom - size.top; h = size.bottom - size.top;

View file

@ -24,18 +24,12 @@
#include "SDL_windowsvideo.h" #include "SDL_windowsvideo.h"
#ifndef _WIN32_WCE
#define HAVE_GETDIBITS
#endif
int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
size_t size; size_t size;
LPBITMAPINFO info; LPBITMAPINFO info;
#ifdef HAVE_GETDIBITS
HBITMAP hbm; HBITMAP hbm;
#endif
/* Free the old framebuffer surface */ /* Free the old framebuffer surface */
if (data->mdc) { if (data->mdc) {
@ -49,7 +43,6 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD); size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size); info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
#ifdef HAVE_GETDIBITS
SDL_memset(info, 0, size); SDL_memset(info, 0, size);
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -69,7 +62,6 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
*format = SDL_MasksToPixelFormatEnum(bpp, masks[0], masks[1], masks[2], 0); *format = SDL_MasksToPixelFormatEnum(bpp, masks[0], masks[1], masks[2], 0);
} }
if (*format == SDL_PIXELFORMAT_UNKNOWN) if (*format == SDL_PIXELFORMAT_UNKNOWN)
#endif
{ {
/* We'll use RGB format for now */ /* We'll use RGB format for now */
*format = SDL_PIXELFORMAT_RGB888; *format = SDL_PIXELFORMAT_RGB888;

View file

@ -22,10 +22,6 @@
#if SDL_VIDEO_DRIVER_WINDOWS #if SDL_VIDEO_DRIVER_WINDOWS
#ifdef _WIN32_WCE
#define SDL_DISABLE_WINDOWS_IME
#endif
#include "SDL_windowsvideo.h" #include "SDL_windowsvideo.h"
#include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_keyboard_c.h"

View file

@ -34,9 +34,7 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
{ {
SDL_DisplayModeData *data; SDL_DisplayModeData *data;
DEVMODE devmode; DEVMODE devmode;
#ifndef _WIN32_WCE
HDC hdc; HDC hdc;
#endif
devmode.dmSize = sizeof(devmode); devmode.dmSize = sizeof(devmode);
devmode.dmDriverExtra = 0; devmode.dmDriverExtra = 0;
@ -59,17 +57,7 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
mode->h = devmode.dmPelsHeight; mode->h = devmode.dmPelsHeight;
mode->refresh_rate = devmode.dmDisplayFrequency; mode->refresh_rate = devmode.dmDisplayFrequency;
mode->driverdata = data; mode->driverdata = data;
#ifdef _WIN32_WCE
/* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation
into account but GetSystemMetrics does. */
if (index == ENUM_CURRENT_SETTINGS) {
mode->w = GetSystemMetrics(SM_CXSCREEN);
mode->h = GetSystemMetrics(SM_CYSCREEN);
}
#endif
/* WinCE has no GetDIBits, therefore we can't use it to get the display format */
#ifndef _WIN32_WCE
if (index == ENUM_CURRENT_SETTINGS if (index == ENUM_CURRENT_SETTINGS
&& (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
@ -105,9 +93,7 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
} else if (bmi->bmiHeader.biBitCount == 4) { } else if (bmi->bmiHeader.biBitCount == 4) {
mode->format = SDL_PIXELFORMAT_INDEX4LSB; mode->format = SDL_PIXELFORMAT_INDEX4LSB;
} }
} else } else {
#endif /* _WIN32_WCE */
{
/* FIXME: Can we tell what this will be? */ /* FIXME: Can we tell what this will be? */
if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) {
switch (devmode.dmBitsPerPel) { switch (devmode.dmBitsPerPel) {
@ -233,18 +219,11 @@ WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
{ {
SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata;
#ifdef _WIN32_WCE
// WINCE: DEVMODE.dmPosition not found, or may be mingw32ce bug
rect->x = 0;
rect->y = 0;
rect->w = _this->windows->w;
rect->h = _this->windows->h;
#else
rect->x = (int)data->DeviceMode.dmPosition.x; rect->x = (int)data->DeviceMode.dmPosition.x;
rect->y = (int)data->DeviceMode.dmPosition.y; rect->y = (int)data->DeviceMode.dmPosition.y;
rect->w = data->DeviceMode.dmPelsWidth; rect->w = data->DeviceMode.dmPelsWidth;
rect->h = data->DeviceMode.dmPelsHeight; rect->h = data->DeviceMode.dmPelsHeight;
#endif
return 0; return 0;
} }
@ -278,14 +257,6 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
LONG status; LONG status;
#ifdef _WIN32_WCE
/* TODO: implement correctly.
On my Asus MyPAL, if I execute the code below
I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays
visible ... (SDL_RaiseWindow() would fix that one) */
return 0;
#endif
status = status =
ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode, ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode,
NULL, CDS_FULLSCREEN, NULL); NULL, CDS_FULLSCREEN, NULL);

View file

@ -51,11 +51,6 @@ WIN_DeleteDevice(SDL_VideoDevice * device)
SDL_VideoData *data = (SDL_VideoData *) device->driverdata; SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
SDL_UnregisterApp(); SDL_UnregisterApp();
#ifdef _WIN32_WCE
if(data->hAygShell) {
SDL_UnloadObject(data->hAygShell);
}
#endif
if (data->userDLL) { if (data->userDLL) {
SDL_UnloadObject(data->userDLL); SDL_UnloadObject(data->userDLL);
} }
@ -88,15 +83,6 @@ WIN_CreateDevice(int devindex)
} }
device->driverdata = data; device->driverdata = data;
#ifdef _WIN32_WCE
data->hAygShell = SDL_LoadObject("\\windows\\aygshell.dll");
if(0 == data->hAygShell)
data->hAygShell = SDL_LoadObject("aygshell.dll");
data->SHFullScreen = (0 != data->hAygShell ?
(PFNSHFullScreen) SDL_LoadFunction(data->hAygShell, "SHFullScreen") : 0);
data->CoordTransform = NULL;
#endif
data->userDLL = SDL_LoadObject("USER32.DLL"); data->userDLL = SDL_LoadObject("USER32.DLL");
if (data->userDLL) { if (data->userDLL) {
data->CloseTouchInputHandle = (BOOL (WINAPI *)( HTOUCHINPUT )) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->CloseTouchInputHandle = (BOOL (WINAPI *)( HTOUCHINPUT )) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");

View file

@ -27,7 +27,7 @@
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#if defined(_MSC_VER) && !defined(_WIN32_WCE) #if defined(_MSC_VER)
#include <msctf.h> #include <msctf.h>
#else #else
#include "SDL_msctf.h" #include "SDL_msctf.h"
@ -115,12 +115,6 @@ typedef struct SDL_VideoData
{ {
int render; int render;
#ifdef _WIN32_WCE
void* hAygShell;
PFNSHFullScreen SHFullScreen;
PFCoordTransform CoordTransform;
#endif
const SDL_Scancode *key_layout; const SDL_Scancode *key_layout;
DWORD clipboard_count; DWORD clipboard_count;

View file

@ -324,10 +324,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
} }
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
/* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */
#ifndef _WIN32_WCE
hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
#endif
} }
SDL_RWclose(dst); SDL_RWclose(dst);
SDL_stack_free(icon_bmp); SDL_stack_free(icon_bmp);
@ -361,11 +358,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
rect.top = 0; rect.top = 0;
rect.right = window->w; rect.right = window->w;
rect.bottom = window->h; rect.bottom = window->h;
#ifdef _WIN32_WCE
menu = FALSE;
#else
menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
#endif
AdjustWindowRectEx(&rect, style, menu, 0); AdjustWindowRectEx(&rect, style, menu, 0);
w = (rect.right - rect.left); w = (rect.right - rect.left);
h = (rect.bottom - rect.top); h = (rect.bottom - rect.top);
@ -387,56 +380,18 @@ WIN_SetWindowSize(_THIS, SDL_Window * window)
WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE); WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE);
} }
#ifdef _WIN32_WCE
void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible)
{
SDL_WindowData* windowdata = (SDL_WindowData*) window->driverdata;
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
if(visible) {
if(window->flags & SDL_WINDOW_FULLSCREEN) {
if(videodata->SHFullScreen)
videodata->SHFullScreen(windowdata->hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_HIDE);
}
ShowWindow(windowdata->hwnd, SW_SHOW);
SetForegroundWindow(windowdata->hwnd);
} else {
ShowWindow(windowdata->hwnd, SW_HIDE);
if(window->flags & SDL_WINDOW_FULLSCREEN) {
if(videodata->SHFullScreen)
videodata->SHFullScreen(windowdata->hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_SHOW);
}
}
}
#endif /* _WIN32_WCE */
void void
WIN_ShowWindow(_THIS, SDL_Window * window) WIN_ShowWindow(_THIS, SDL_Window * window)
{ {
#ifdef _WIN32_WCE
WINCE_ShowWindow(_this, window, 1);
#else
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
ShowWindow(hwnd, SW_SHOW); ShowWindow(hwnd, SW_SHOW);
#endif
} }
void void
WIN_HideWindow(_THIS, SDL_Window * window) WIN_HideWindow(_THIS, SDL_Window * window)
{ {
#ifdef _WIN32_WCE
WINCE_ShowWindow(_this, window, 0);
#else
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
ShowWindow(hwnd, SW_HIDE); ShowWindow(hwnd, SW_HIDE);
#endif
} }
void void
@ -457,14 +412,6 @@ void
WIN_MaximizeWindow(_THIS, SDL_Window * window) WIN_MaximizeWindow(_THIS, SDL_Window * window)
{ {
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
#ifdef _WIN32_WCE
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
videodata->SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
}
#endif
ShowWindow(hwnd, SW_MAXIMIZE); ShowWindow(hwnd, SW_MAXIMIZE);
} }
@ -472,15 +419,7 @@ void
WIN_MinimizeWindow(_THIS, SDL_Window * window) WIN_MinimizeWindow(_THIS, SDL_Window * window)
{ {
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
ShowWindow(hwnd, SW_MINIMIZE); ShowWindow(hwnd, SW_MINIMIZE);
#ifdef _WIN32_WCE
if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen) {
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
videodata->SHFullScreen(hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
}
#endif
} }
void void
@ -543,11 +482,7 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
rect.top = 0; rect.top = 0;
rect.right = window->windowed.w; rect.right = window->windowed.w;
rect.bottom = window->windowed.h; rect.bottom = window->windowed.h;
#ifdef _WIN32_WCE
menu = FALSE;
#else
menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
#endif
AdjustWindowRectEx(&rect, style, menu, 0); AdjustWindowRectEx(&rect, style, menu, 0);
w = (rect.right - rect.left); w = (rect.right - rect.left);
h = (rect.bottom - rect.top); h = (rect.bottom - rect.top);
@ -561,10 +496,6 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
int int
WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
{ {
#ifdef _WIN32_WCE
SDL_Unsupported();
return -1;
#else
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
HDC hdc; HDC hdc;
@ -579,16 +510,11 @@ WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
DeleteDC(hdc); DeleteDC(hdc);
} }
return succeeded ? 0 : -1; return succeeded ? 0 : -1;
#endif
} }
int int
WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
{ {
#ifdef _WIN32_WCE
SDL_Unsupported();
return -1;
#else
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
HDC hdc; HDC hdc;
@ -603,7 +529,6 @@ WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
DeleteDC(hdc); DeleteDC(hdc);
} }
return succeeded ? 0 : -1; return succeeded ? 0 : -1;
#endif
} }
void void
@ -629,9 +554,6 @@ WIN_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (data) { if (data) {
#ifdef _WIN32_WCE
WINCE_ShowWindow(_this, window, 0);
#endif
ReleaseDC(data->hwnd, data->hdc); ReleaseDC(data->hwnd, data->hdc);
if (data->created) { if (data->created) {
DestroyWindow(data->hwnd); DestroyWindow(data->hwnd);
@ -675,7 +597,6 @@ SDL_HelperWindowCreate(void)
{ {
HINSTANCE hInstance = GetModuleHandle(NULL); HINSTANCE hInstance = GetModuleHandle(NULL);
WNDCLASS wce; WNDCLASS wce;
HWND hWndParent = NULL;
/* Make sure window isn't created twice. */ /* Make sure window isn't created twice. */
if (SDL_HelperWindow != NULL) { if (SDL_HelperWindow != NULL) {
@ -695,17 +616,12 @@ SDL_HelperWindowCreate(void)
return -1; return -1;
} }
#ifndef _WIN32_WCE
/* WinCE doesn't have HWND_MESSAGE */
hWndParent = HWND_MESSAGE;
#endif
/* Create the window. */ /* Create the window. */
SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName, SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName,
SDL_HelperWindowName, SDL_HelperWindowName,
WS_OVERLAPPED, CW_USEDEFAULT, WS_OVERLAPPED, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, hWndParent, NULL, CW_USEDEFAULT, HWND_MESSAGE, NULL,
hInstance, NULL); hInstance, NULL);
if (SDL_HelperWindow == NULL) { if (SDL_HelperWindow == NULL) {
UnregisterClass(SDL_HelperWindowClassName, hInstance); UnregisterClass(SDL_HelperWindowClassName, hInstance);

View file

@ -23,15 +23,6 @@
#ifndef _SDL_windowswindow_h #ifndef _SDL_windowswindow_h
#define _SDL_windowswindow_h #define _SDL_windowswindow_h
#ifdef _WIN32_WCE
#define SHFS_SHOWTASKBAR 0x0001
#define SHFS_HIDETASKBAR 0x0002
#define SHFS_SHOWSIPBUTTON 0x0004
#define SHFS_HIDESIPBUTTON 0x0008
#define SHFS_SHOWSTARTICON 0x0010
#define SHFS_HIDESTARTICON 0x0020
#endif
typedef struct typedef struct
{ {
SDL_Window *window; SDL_Window *window;