comparison 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
comparison
equal deleted inserted replaced
3096:ae4e80dbe330 3097:0d12e8f1de3c
189 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { 189 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
190 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN, 190 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_SHOWN,
191 0, 0); 191 0, 0);
192 SDL_SendWindowEvent(data->windowID, 192 SDL_SendWindowEvent(data->windowID,
193 SDL_WINDOWEVENT_RESTORED, 0, 0); 193 SDL_WINDOWEVENT_RESTORED, 0, 0);
194 #ifndef _WIN32_WCE /* WinCE misses IsZoomed() */
194 if (IsZoomed(hwnd)) { 195 if (IsZoomed(hwnd)) {
195 SDL_SendWindowEvent(data->windowID, 196 SDL_SendWindowEvent(data->windowID,
196 SDL_WINDOWEVENT_MAXIMIZED, 0, 0); 197 SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
197 } 198 }
199 #endif
198 if (keyboard && keyboard->focus != data->windowID) { 200 if (keyboard && keyboard->focus != data->windowID) {
199 SDL_SetKeyboardFocus(index, data->windowID); 201 SDL_SetKeyboardFocus(index, data->windowID);
200 } 202 }
201 /* FIXME: Update keyboard state */ 203 /* FIXME: Update keyboard state */
202 } else { 204 } else {
208 SDL_WINDOWEVENT_MINIMIZED, 0, 0); 210 SDL_WINDOWEVENT_MINIMIZED, 0, 0);
209 } 211 }
210 } 212 }
211 } 213 }
212 return (0); 214 return (0);
215
216 /* WinCE has no RawInput, so we use the classic mouse events.
217 In classic Win32 this is done by WM_INPUT
218 */
219 #ifdef _WIN32_WCE
220 case WM_MOUSEMOVE:
221 SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
222 break;
223
224 case WM_LBUTTONDOWN:
225 SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
226 SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT);
227 break;
228
229 case WM_LBUTTONUP:
230 SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
231 SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT);
232 break;
233 #else /* _WIN32_WCE */
213 234
214 case WM_INPUT: /* mouse events */ 235 case WM_INPUT: /* mouse events */
215 { 236 {
216 LPBYTE lpb; 237 LPBYTE lpb;
217 const RAWINPUTHEADER *header; 238 const RAWINPUTHEADER *header;
221 const RAWMOUSE *raw_mouse = NULL; 242 const RAWMOUSE *raw_mouse = NULL;
222 POINT point; 243 POINT point;
223 USHORT flags; 244 USHORT flags;
224 int w, h; 245 int w, h;
225 246
226 /* we're collecting data from the mouse */ 247 /* we're collecting raw data to be able to identify the mouse (if there are several) */
227 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, 248 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
228 sizeof(RAWINPUTHEADER)); 249 sizeof(RAWINPUTHEADER));
229 lpb = SDL_stack_alloc(BYTE, size); 250 lpb = SDL_stack_alloc(BYTE, size);
230 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, 251 GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size,
231 sizeof(RAWINPUTHEADER)); 252 sizeof(RAWINPUTHEADER));
238 if (mice[i] == header->hDevice) { 259 if (mice[i] == header->hDevice) {
239 index = i; 260 index = i;
240 break; 261 break;
241 } 262 }
242 } 263 }
243 /* FIXME: Doesn't this defeat the point of using raw input? */ 264
244 GetCursorPos(&point); 265 GetCursorPos(&point);
245 ScreenToClient(hwnd, &point); 266 ScreenToClient(hwnd, &point);
246 267
247 SDL_GetWindowSize(data->windowID, &w, &h); 268 SDL_GetWindowSize(data->windowID, &w, &h);
248 if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) { 269 if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) {
290 (short) raw->data.mouse.usButtonData); 311 (short) raw->data.mouse.usButtonData);
291 } 312 }
292 SDL_stack_free(lpb); 313 SDL_stack_free(lpb);
293 } 314 }
294 return (0); 315 return (0);
295 316 #endif /* _WIN32_WCE */
317
296 case WM_MOUSELEAVE: 318 case WM_MOUSELEAVE:
297 { 319 {
298 int i; 320 int i;
299 321
300 for (i = 0; i < SDL_GetNumMice(); ++i) { 322 for (i = 0; i < SDL_GetNumMice(); ++i) {