Commit d2d2e1c3 authored by Sam Lantinga's avatar Sam Lantinga

Date: Thu, 05 Feb 2009 18:07:35 +0100

From: Stefan Klug
Subject: [SDL] SDL 1.3 WinCE backend

as promised, I've started to work on the WinCE backend of SDL 1.3
I've modified the win32 video backend and the gdi renderer, to work
properly in WinCE.
The results till now are great, but there is still some work to do.

Attached are two patches with my changes.
I would be happy if someone could review and propably commit them.

The first one (configure.in.patch) should be straight forward without
any side effects.

The second one does the necessary changes to the win32 backend. I was
really unhappy to start slicing this shiny new backend with
#ifdef/#endif but I saw no other option.

The most problematic issues are:
- WinCe has no GetDIBits, so its practically impossible to fill a
BITMAPINFO with correct values. I therefore removed the bmi member from
the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not
properly initialized  bmi.
- In SDL_win32window.c I exchanged some ASCII function by their general
counterparts, (In CE only the Unicode versions are available). I don't
know if this has a negative effect when running in win32


Cheers
Stefan

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403564
parent e403bb29
...@@ -2531,6 +2531,71 @@ case "$host" in ...@@ -2531,6 +2531,71 @@ case "$host" in
have_haptic=yes have_haptic=yes
fi fi
;; ;;
*-wince* | *-mingw32ce)
ARCH=win32
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckWIN32
CheckNASM
#SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
#AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
have_video=yes
AC_ARG_ENABLE(render-gdi,
AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
, enable_render_gdi=yes)
if test x$enable_render_gdi = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_GDI)
fi
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)
fi
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
if test x$have_dsound = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
fi
have_audio=yes
fi
# Set up files for the thread library
if test x$enable_threads = xyes; then
AC_DEFINE(SDL_THREAD_WIN32)
SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
SOURCES="$SOURCES $srcdir/src/thread/win32/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)
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_WIN32)
SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
have_loadso=yes
fi
# Set up the system libraries we need
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
# The Win32 platform requires special setup
SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
SDL_LIBS="-lSDLmain $SDL_LIBS"
;;
*-*-cygwin* | *-*-mingw32*) *-*-cygwin* | *-*-mingw32*)
ARCH=win32 ARCH=win32
if test "$build" != "$host"; then # cross-compiling if test "$build" != "$host"; then # cross-compiling
...@@ -2850,10 +2915,10 @@ esac ...@@ -2850,10 +2915,10 @@ esac
# Verify that we have all the platform specific files we need # Verify that we have all the platform specific files we need
if test x$enable_joystick = xyes; then if test x$enable_joystick = xyes; then
if test x$have_joystick != xyes; then if test x$have_joystick != xyes; then
# Wants joystick subsystem, but doesn't have a platform-specific backend... AC_DEFINE(SDL_JOYSTICK_DISABLED)
fi
SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
fi
fi fi
if test x$have_haptic != xyes; then if test x$have_haptic != xyes; then
if test x$enable_haptic = xyes; then if test x$enable_haptic = xyes; then
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "../SDL_yuv_sw_c.h" #include "../SDL_yuv_sw_c.h"
#include "../SDL_alphamult.h" #include "../SDL_alphamult.h"
#ifdef _WIN32_WCE
#define NO_GETDIBBITS 1
#endif
/* GDI renderer implementation */ /* GDI renderer implementation */
static SDL_Renderer *GDI_CreateRenderer(SDL_Window * window, Uint32 flags); static SDL_Renderer *GDI_CreateRenderer(SDL_Window * window, Uint32 flags);
...@@ -106,7 +110,9 @@ typedef struct ...@@ -106,7 +110,9 @@ typedef struct
HDC render_hdc; HDC render_hdc;
HDC memory_hdc; HDC memory_hdc;
HDC current_hdc; HDC current_hdc;
#ifndef NO_GETDIBBITS
LPBITMAPINFO bmi; LPBITMAPINFO bmi;
#endif
HBITMAP hbm[3]; HBITMAP hbm[3];
int current_hbm; int current_hbm;
SDL_DirtyRectList dirty; SDL_DirtyRectList dirty;
...@@ -197,6 +203,7 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -197,6 +203,7 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags)
data->render_hdc = CreateCompatibleDC(data->window_hdc); data->render_hdc = CreateCompatibleDC(data->window_hdc);
data->memory_hdc = CreateCompatibleDC(data->window_hdc); data->memory_hdc = CreateCompatibleDC(data->window_hdc);
#ifndef NO_GETDIBBITS
/* Fill in the compatible bitmap info */ /* Fill in the compatible bitmap info */
bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD);
data->bmi = (LPBITMAPINFO) SDL_calloc(1, bmi_size); data->bmi = (LPBITMAPINFO) SDL_calloc(1, bmi_size);
...@@ -211,6 +218,7 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -211,6 +218,7 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags)
GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS);
GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS);
DeleteObject(hbm); DeleteObject(hbm);
#endif
if (flags & SDL_RENDERER_SINGLEBUFFER) { if (flags & SDL_RENDERER_SINGLEBUFFER) {
renderer->info.flags |= renderer->info.flags |=
...@@ -473,6 +481,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -473,6 +481,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
/* Crap, we've lost the original pixel data... *sigh* */ /* Crap, we've lost the original pixel data... *sigh* */
} }
return 0; return 0;
#ifndef _WIN32_WCE /* WinCE has no alphablend */
case SDL_BLENDMODE_MASK: case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND: case SDL_BLENDMODE_BLEND:
if (!data->premultiplied && data->pixels) { if (!data->premultiplied && data->pixels) {
...@@ -504,6 +513,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -504,6 +513,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
} }
} }
return 0; return 0;
#endif
default: default:
SDL_Unsupported(); SDL_Unsupported();
texture->blendMode = SDL_BLENDMODE_NONE; texture->blendMode = SDL_BLENDMODE_NONE;
...@@ -585,12 +595,17 @@ GDI_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -585,12 +595,17 @@ GDI_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
} }
} }
} else if (rect->w == texture->w && pitch == data->pitch) { } else if (rect->w == texture->w && pitch == data->pitch) {
#ifndef NO_GETDIBBITS
if (!SetDIBits if (!SetDIBits
(renderdata->window_hdc, data->hbm, rect->y, rect->h, pixels, (renderdata->window_hdc, data->hbm, rect->y, rect->h, pixels,
renderdata->bmi, DIB_RGB_COLORS)) { renderdata->bmi, DIB_RGB_COLORS)) {
WIN_SetError("SetDIBits()"); WIN_SetError("SetDIBits()");
return -1; return -1;
} }
#else
SDL_SetError("FIXME: Update Texture");
return -1;
#endif
} else { } else {
SDL_SetError SDL_SetError
("FIXME: Need to allocate temporary memory and do GetDIBits() followed by SetDIBits(), since we can only set blocks of scanlines at a time"); ("FIXME: Need to allocate temporary memory and do GetDIBits() followed by SetDIBits(), since we can only set blocks of scanlines at a time");
...@@ -611,7 +626,10 @@ GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -611,7 +626,10 @@ GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels, return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
pitch); pitch);
} else if (data->pixels) { } else if (data->pixels) {
#ifndef _WIN32_WCE
/* WinCE has no GdiFlush */
GdiFlush(); GdiFlush();
#endif
*pixels = *pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch + (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format)); rect->x * SDL_BYTESPERPIXEL(texture->format));
...@@ -760,6 +778,10 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -760,6 +778,10 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
RealizePalette(data->memory_hdc); RealizePalette(data->memory_hdc);
} }
if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) { if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
#ifdef _WIN32_WCE
SDL_SetError("Texture has blendmode not supported under WinCE");
return -1;
#else
BLENDFUNCTION blendFunc = { BLENDFUNCTION blendFunc = {
AC_SRC_OVER, AC_SRC_OVER,
0, 0,
...@@ -773,6 +795,7 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -773,6 +795,7 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
WIN_SetError("AlphaBlend()"); WIN_SetError("AlphaBlend()");
return -1; return -1;
} }
#endif
} else { } else {
if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
if (!BitBlt if (!BitBlt
...@@ -851,9 +874,11 @@ GDI_DestroyRenderer(SDL_Renderer * renderer) ...@@ -851,9 +874,11 @@ GDI_DestroyRenderer(SDL_Renderer * renderer)
if (data) { if (data) {
DeleteDC(data->render_hdc); DeleteDC(data->render_hdc);
DeleteDC(data->memory_hdc); DeleteDC(data->memory_hdc);
#ifndef NO_GETDIBBITS
if (data->bmi) { if (data->bmi) {
SDL_free(data->bmi); SDL_free(data->bmi);
} }
#endif
for (i = 0; i < SDL_arraysize(data->hbm); ++i) { for (i = 0; i < SDL_arraysize(data->hbm); ++i) {
if (data->hbm[i]) { if (data->hbm[i]) {
DeleteObject(data->hbm[i]); DeleteObject(data->hbm[i]);
......
...@@ -191,10 +191,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -191,10 +191,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
0, 0); 0, 0);
SDL_SendWindowEvent(data->windowID, SDL_SendWindowEvent(data->windowID,
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->windowID, SDL_SendWindowEvent(data->windowID,
SDL_WINDOWEVENT_MAXIMIZED, 0, 0); SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
} }
#endif
if (keyboard && keyboard->focus != data->windowID) { if (keyboard && keyboard->focus != data->windowID) {
SDL_SetKeyboardFocus(index, data->windowID); SDL_SetKeyboardFocus(index, data->windowID);
} }
...@@ -211,6 +213,25 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -211,6 +213,25 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
return (0); return (0);
/* WinCE has no RawInput, so we use the classic mouse events.
In classic Win32 this is done by WM_INPUT
*/
#ifdef _WIN32_WCE
case WM_MOUSEMOVE:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
break;
case WM_LBUTTONDOWN:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT);
break;
case WM_LBUTTONUP:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT);
break;
#else /* _WIN32_WCE */
case WM_INPUT: /* mouse events */ case WM_INPUT: /* mouse events */
{ {
LPBYTE lpb; LPBYTE lpb;
...@@ -223,7 +244,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -223,7 +244,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
USHORT flags; USHORT flags;
int w, h; int w, h;
/* we're collecting data from the mouse */ /* we're collecting raw data to be able to identify the mouse (if there are several) */
GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
sizeof(RAWINPUTHEADER)); sizeof(RAWINPUTHEADER));
lpb = SDL_stack_alloc(BYTE, size); lpb = SDL_stack_alloc(BYTE, size);
...@@ -240,7 +261,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -240,7 +261,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
} }
} }
/* FIXME: Doesn't this defeat the point of using raw input? */
GetCursorPos(&point); GetCursorPos(&point);
ScreenToClient(hwnd, &point); ScreenToClient(hwnd, &point);
...@@ -292,7 +313,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -292,7 +313,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_stack_free(lpb); SDL_stack_free(lpb);
} }
return (0); return (0);
#endif /* _WIN32_WCE */
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
{ {
int i; int i;
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
int int
WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp) WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
#ifdef _WIN32_WCE
return -1;
#else
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
HDC hdc; HDC hdc;
BOOL succeeded = FALSE; BOOL succeeded = FALSE;
...@@ -40,11 +43,15 @@ WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp) ...@@ -40,11 +43,15 @@ WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
DeleteDC(hdc); DeleteDC(hdc);
} }
return succeeded ? 0 : -1; return succeeded ? 0 : -1;
#endif
} }
int int
WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp) WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
#ifdef _WIN32_WCE
return -1;
#else
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
HDC hdc; HDC hdc;
BOOL succeeded = FALSE; BOOL succeeded = FALSE;
...@@ -58,6 +65,7 @@ WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp) ...@@ -58,6 +65,7 @@ WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
DeleteDC(hdc); DeleteDC(hdc);
} }
return succeeded ? 0 : -1; return succeeded ? 0 : -1;
#endif
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -53,7 +53,17 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) ...@@ -53,7 +53,17 @@ 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 GetSystemMetrixs 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)];
...@@ -87,7 +97,10 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) ...@@ -87,7 +97,10 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
} else if (bmi->bmiHeader.biBitCount == 8) { } else if (bmi->bmiHeader.biBitCount == 8) {
mode->format = SDL_PIXELFORMAT_INDEX8; mode->format = SDL_PIXELFORMAT_INDEX8;
} }
} else { } else
#endif /* _WIN32_WCE */
{
/* FIXME: Can we tell what this will be? */ /* FIXME: Can we tell what this will be? */
switch (devmode.dmBitsPerPel) { switch (devmode.dmBitsPerPel) {
case 32: case 32:
...@@ -198,6 +211,14 @@ WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -198,6 +211,14 @@ WIN_SetDisplayMode(_THIS, 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(data->DeviceName, &data->DeviceMode, NULL, ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,
......
...@@ -50,6 +50,13 @@ WIN_InitMouse(_THIS) ...@@ -50,6 +50,13 @@ WIN_InitMouse(_THIS)
const char *rdp = "rdp_mou"; const char *rdp = "rdp_mou";
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
/* WinCE has no RawInputDeviceList */
#ifdef _WIN32_WCE
SDL_Mouse mouse;
SDL_zero(mouse);
mouse.id = 0;
SDL_AddMouse(&mouse, "Stylus", 0, 0, 1);
#else
/* we're checking for the number of rawinput devices */ /* we're checking for the number of rawinput devices */
if (GetRawInputDeviceList(NULL, &devCount, sizeof(RAWINPUTDEVICELIST))) { if (GetRawInputDeviceList(NULL, &devCount, sizeof(RAWINPUTDEVICELIST))) {
return; return;
...@@ -190,6 +197,7 @@ WIN_InitMouse(_THIS) ...@@ -190,6 +197,7 @@ WIN_InitMouse(_THIS)
} }
total_mice = index; total_mice = index;
SDL_free(deviceList); SDL_free(deviceList);
#endif /*_WIN32_WCE*/
} }
void void
......
...@@ -243,12 +243,14 @@ WIN_CreateWindow(_THIS, SDL_Window * window) ...@@ -243,12 +243,14 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
} }
#ifndef _WIN32_WCE /* has no RawInput */
/* we're telling the window, we want it to report raw input events from mice */ /* we're telling the window, we want it to report raw input events from mice */
Rid.usUsagePage = 0x01; Rid.usUsagePage = 0x01;
Rid.usUsage = 0x02; Rid.usUsage = 0x02;
Rid.dwFlags = RIDEV_INPUTSINK; Rid.dwFlags = RIDEV_INPUTSINK;
Rid.hwndTarget = hwnd; Rid.hwndTarget = hwnd;
RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
#endif
WIN_PumpEvents(_this); WIN_PumpEvents(_this);
...@@ -360,8 +362,11 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -360,8 +362,11 @@ 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 = hicon =
CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
#endif
} }
SDL_RWclose(dst); SDL_RWclose(dst);
SDL_stack_free(icon_bmp); SDL_stack_free(icon_bmp);
...@@ -553,8 +558,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) ...@@ -553,8 +558,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int int
SDL_HelperWindowCreate(void) SDL_HelperWindowCreate(void)
{ {
HINSTANCE hInstance = GetModuleHandleA(NULL); HINSTANCE hInstance = GetModuleHandle(NULL);
WNDCLASSEX wce; WNDCLASS wce;
/* Make sure window isn't created twice. */ /* Make sure window isn't created twice. */
if (SDL_HelperWindow != NULL) { if (SDL_HelperWindow != NULL) {
...@@ -563,13 +568,12 @@ SDL_HelperWindowCreate(void) ...@@ -563,13 +568,12 @@ SDL_HelperWindowCreate(void)
/* Create the class. */ /* Create the class. */
SDL_zero(wce); SDL_zero(wce);
wce.cbSize = sizeof(WNDCLASSEX); wce.lpfnWndProc = DefWindowProc;
wce.lpfnWndProc = DefWindowProcA;
wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
wce.hInstance = hInstance; wce.hInstance = hInstance;
/* Register the class. */ /* Register the class. */
SDL_HelperWindowClass = RegisterClassEx(&wce); SDL_HelperWindowClass = RegisterClass(&wce);
if (SDL_HelperWindowClass == 0) { if (SDL_HelperWindowClass == 0) {
SDL_SetError("Unable to create Helper Window Class: error %d.", SDL_SetError("Unable to create Helper Window Class: error %d.",
GetLastError()); GetLastError());
...@@ -600,7 +604,7 @@ SDL_HelperWindowCreate(void) ...@@ -600,7 +604,7 @@ SDL_HelperWindowCreate(void)
void void
SDL_HelperWindowDestroy(void) SDL_HelperWindowDestroy(void)
{ {
HINSTANCE hInstance = GetModuleHandleA(NULL); HINSTANCE hInstance = GetModuleHandle(NULL);
/* Destroy the window. */ /* Destroy the window. */
if (SDL_HelperWindow != NULL) { if (SDL_HelperWindow != NULL) {
......
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