Mercurial > sdl-ios-xcode
diff src/video/win32/SDL_win32events.c @ 3097:0d12e8f1de3c
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
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 23 Mar 2009 05:35:21 +0000 |
parents | 75483112b97f |
children | 73fe1f73a56f |
line wrap: on
line diff
--- a/src/video/win32/SDL_win32events.c Mon Mar 23 05:21:40 2009 +0000 +++ b/src/video/win32/SDL_win32events.c Mon Mar 23 05:35:21 2009 +0000 @@ -191,10 +191,12 @@ 0, 0); SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0); +#ifndef _WIN32_WCE /* WinCE misses IsZoomed() */ if (IsZoomed(hwnd)) { SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } +#endif if (keyboard && keyboard->focus != data->windowID) { SDL_SetKeyboardFocus(index, data->windowID); } @@ -211,6 +213,25 @@ } 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 */ { LPBYTE lpb; @@ -223,7 +244,7 @@ USHORT flags; 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, sizeof(RAWINPUTHEADER)); lpb = SDL_stack_alloc(BYTE, size); @@ -240,7 +261,7 @@ break; } } -/* FIXME: Doesn't this defeat the point of using raw input? */ + GetCursorPos(&point); ScreenToClient(hwnd, &point); @@ -292,7 +313,8 @@ SDL_stack_free(lpb); } return (0); - +#endif /* _WIN32_WCE */ + case WM_MOUSELEAVE: { int i;