comparison src/video/win32/SDL_win32window.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 089a77aebb7d
children 7f684f249ec9
comparison
equal deleted inserted replaced
3096:ae4e80dbe330 3097:0d12e8f1de3c
241 g_hCtx = tmp_hctx; 241 g_hCtx = tmp_hctx;
242 } 242 }
243 g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); 243 g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
244 } 244 }
245 245
246 #ifndef _WIN32_WCE /* has no RawInput */
246 /* we're telling the window, we want it to report raw input events from mice */ 247 /* we're telling the window, we want it to report raw input events from mice */
247 Rid.usUsagePage = 0x01; 248 Rid.usUsagePage = 0x01;
248 Rid.usUsage = 0x02; 249 Rid.usUsage = 0x02;
249 Rid.dwFlags = RIDEV_INPUTSINK; 250 Rid.dwFlags = RIDEV_INPUTSINK;
250 Rid.hwndTarget = hwnd; 251 Rid.hwndTarget = hwnd;
251 RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); 252 RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
253 #endif
252 254
253 WIN_PumpEvents(_this); 255 WIN_PumpEvents(_this);
254 256
255 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { 257 if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) {
256 DestroyWindow(hwnd); 258 DestroyWindow(hwnd);
358 Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch; 360 Uint8 *src = (Uint8 *) surface->pixels + y * surface->pitch;
359 SDL_RWwrite(dst, src, surface->pitch, 1); 361 SDL_RWwrite(dst, src, surface->pitch, 1);
360 } 362 }
361 SDL_FreeSurface(surface); 363 SDL_FreeSurface(surface);
362 364
365 /* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */
366 #ifndef _WIN32_WCE
363 hicon = 367 hicon =
364 CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); 368 CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
369 #endif
365 } 370 }
366 SDL_RWclose(dst); 371 SDL_RWclose(dst);
367 SDL_stack_free(icon_bmp); 372 SDL_stack_free(icon_bmp);
368 } 373 }
369 374
551 * Creates a HelperWindow used for DirectInput events. 556 * Creates a HelperWindow used for DirectInput events.
552 */ 557 */
553 int 558 int
554 SDL_HelperWindowCreate(void) 559 SDL_HelperWindowCreate(void)
555 { 560 {
556 HINSTANCE hInstance = GetModuleHandleA(NULL); 561 HINSTANCE hInstance = GetModuleHandle(NULL);
557 WNDCLASSEX wce; 562 WNDCLASS wce;
558 563
559 /* Make sure window isn't created twice. */ 564 /* Make sure window isn't created twice. */
560 if (SDL_HelperWindow != NULL) { 565 if (SDL_HelperWindow != NULL) {
561 return 0; 566 return 0;
562 } 567 }
563 568
564 /* Create the class. */ 569 /* Create the class. */
565 SDL_zero(wce); 570 SDL_zero(wce);
566 wce.cbSize = sizeof(WNDCLASSEX); 571 wce.lpfnWndProc = DefWindowProc;
567 wce.lpfnWndProc = DefWindowProcA;
568 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; 572 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
569 wce.hInstance = hInstance; 573 wce.hInstance = hInstance;
570 574
571 /* Register the class. */ 575 /* Register the class. */
572 SDL_HelperWindowClass = RegisterClassEx(&wce); 576 SDL_HelperWindowClass = RegisterClass(&wce);
573 if (SDL_HelperWindowClass == 0) { 577 if (SDL_HelperWindowClass == 0) {
574 SDL_SetError("Unable to create Helper Window Class: error %d.", 578 SDL_SetError("Unable to create Helper Window Class: error %d.",
575 GetLastError()); 579 GetLastError());
576 return -1; 580 return -1;
577 } 581 }
598 * Destroys the HelperWindow previously created with SDL_HelperWindowCreate. 602 * Destroys the HelperWindow previously created with SDL_HelperWindowCreate.
599 */ 603 */
600 void 604 void
601 SDL_HelperWindowDestroy(void) 605 SDL_HelperWindowDestroy(void)
602 { 606 {
603 HINSTANCE hInstance = GetModuleHandleA(NULL); 607 HINSTANCE hInstance = GetModuleHandle(NULL);
604 608
605 /* Destroy the window. */ 609 /* Destroy the window. */
606 if (SDL_HelperWindow != NULL) { 610 if (SDL_HelperWindow != NULL) {
607 if (DestroyWindow(SDL_HelperWindow) == 0) { 611 if (DestroyWindow(SDL_HelperWindow) == 0) {
608 SDL_SetError("Unable to destroy Helper Window: error %d.", 612 SDL_SetError("Unable to destroy Helper Window: error %d.",