comparison src/video/win32/SDL_win32window.c @ 4569:e1664f94f026

Andrey A. I made a video driver GAPI/RAW for WinCE (SDL-1.3). RAW mode has a priority, and also, GAPI mode works with environment "SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw". I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA, + tested all modes with WindowsMobile Emulator. Also, correctly draws the pointer position and the scale of the pointer for VGA/WVGA modes, correctly draws top left position for DM orientation screen, and portrait/landscape/square geometry the screen also correct. Also, I added a small fix for GDI fullscreen mode. Patch for latest revision SDL-1.3 in an attachment. Also added small path for mingw32ce build.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 27 Jul 2010 21:31:28 -0700
parents eff4e88cc1e8
children c24ba2cc9583
comparison
equal deleted inserted replaced
4568:25b9cd8bdc30 4569:e1664f94f026
32 #include "../SDL_sysvideo.h" 32 #include "../SDL_sysvideo.h"
33 #include "../SDL_pixels_c.h" 33 #include "../SDL_pixels_c.h"
34 #include "../../events/SDL_keyboard_c.h" 34 #include "../../events/SDL_keyboard_c.h"
35 35
36 #include "SDL_win32video.h" 36 #include "SDL_win32video.h"
37 #include "SDL_win32window.h"
37 38
38 /* This is included after SDL_win32video.h, which includes windows.h */ 39 /* This is included after SDL_win32video.h, which includes windows.h */
39 #include "SDL_syswm.h" 40 #include "SDL_syswm.h"
40 41 #include "SDL_gapirender.h"
41 42
42 #define SHFS_SHOWTASKBAR 0x0001
43 #define SHFS_HIDETASKBAR 0x0002
44 #define SHFS_SHOWSIPBUTTON 0x0004
45 #define SHFS_HIDESIPBUTTON 0x0008
46 #define SHFS_SHOWSTARTICON 0x0010
47 #define SHFS_HIDESTARTICON 0x0020
48
49 #ifdef _WIN32_WCE
50 // dynamically load aygshell dll because we want SDL to work on HPC and be300
51 int aygshell_loaded = 0;
52 BOOL(WINAPI * SHFullScreen) (HWND hwndRequester, DWORD dwState) = 0;
53
54
55 static BOOL
56 CE_SHFullScreen(HWND hwndRequester, DWORD dwState)
57 {
58 if (SHFullScreen == 0 && aygshell_loaded == 0) {
59 aygshell_loaded = 0;
60 void *lib = SDL_LoadObject("aygshell.dll");
61 if (lib) {
62 SHFullScreen =
63 (BOOL(WINAPI *) (HWND, DWORD)) SDL_LoadFunction(lib,
64 "SHFullScreen");
65 }
66 }
67
68 if (SHFullScreen) {
69 SHFullScreen(hwndRequester, dwState);
70 //printf("SHFullscreen(%i)\n",dwState);
71 }
72 }
73
74 #endif
75 43
76 /* Fake window to help with DirectInput events. */ 44 /* Fake window to help with DirectInput events. */
77 HWND SDL_HelperWindow = NULL; 45 HWND SDL_HelperWindow = NULL;
78 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); 46 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
79 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); 47 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
470 } 438 }
471 439
472 void 440 void
473 WIN_ShowWindow(_THIS, SDL_Window * window) 441 WIN_ShowWindow(_THIS, SDL_Window * window)
474 { 442 {
475 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; 443 #ifdef _WIN32_WCE
476 444 WINCE_ShowWindow(_this, window, 1);
445 #else
446 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
477 ShowWindow(hwnd, SW_SHOW); 447 ShowWindow(hwnd, SW_SHOW);
478 448 #endif
449 }
450
451 void
452 WIN_HideWindow(_THIS, SDL_Window * window)
453 {
479 #ifdef _WIN32_WCE 454 #ifdef _WIN32_WCE
480 if (window->flags & SDL_WINDOW_FULLSCREEN) { 455 WINCE_ShowWindow(_this, window, 0);
481 CE_SHFullScreen(hwnd, 456 #else
482 SHFS_HIDESTARTICON | SHFS_HIDETASKBAR | 457 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
483 SHFS_HIDESIPBUTTON);
484 }
485 #endif
486 }
487
488 void
489 WIN_HideWindow(_THIS, SDL_Window * window)
490 {
491 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
492
493 ShowWindow(hwnd, SW_HIDE); 458 ShowWindow(hwnd, SW_HIDE);
494
495 #ifdef _WIN32_WCE
496 if (window->flags & SDL_WINDOW_FULLSCREEN) {
497 CE_SHFullScreen(hwnd,
498 SHFS_SHOWSTARTICON | SHFS_SHOWTASKBAR |
499 SHFS_SHOWSIPBUTTON);
500 }
501 #endif 459 #endif
502 } 460 }
503 461
504 void 462 void
505 WIN_RaiseWindow(_THIS, SDL_Window * window) 463 WIN_RaiseWindow(_THIS, SDL_Window * window)
511 top = HWND_TOPMOST; 469 top = HWND_TOPMOST;
512 } else { 470 } else {
513 top = HWND_NOTOPMOST; 471 top = HWND_NOTOPMOST;
514 } 472 }
515 SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE)); 473 SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE));
474 }
475
476 void
477 WIN_MaximizeWindow(_THIS, SDL_Window * window)
478 {
479 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
480 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
516 481
517 #ifdef _WIN32_WCE 482 #ifdef _WIN32_WCE
518 if (window->flags & SDL_WINDOW_FULLSCREEN) { 483 if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
519 CE_SHFullScreen(hwnd, 484 videodata->SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
520 SHFS_HIDESTARTICON | SHFS_HIDETASKBAR | 485 #endif
521 SHFS_HIDESIPBUTTON);
522 }
523 #endif
524 }
525
526 void
527 WIN_MaximizeWindow(_THIS, SDL_Window * window)
528 {
529 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
530 486
531 ShowWindow(hwnd, SW_MAXIMIZE); 487 ShowWindow(hwnd, SW_MAXIMIZE);
488 }
489
490 void
491 WIN_MinimizeWindow(_THIS, SDL_Window * window)
492 {
493 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
494 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
495
496 ShowWindow(hwnd, SW_MINIMIZE);
532 497
533 #ifdef _WIN32_WCE 498 #ifdef _WIN32_WCE
534 if (window->flags & SDL_WINDOW_FULLSCREEN) { 499 if((window->flags & SDL_WINDOW_FULLSCREEN) && videodata->SHFullScreen)
535 CE_SHFullScreen(hwnd, 500 videodata->SHFullScreen(hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
536 SHFS_HIDESTARTICON | SHFS_HIDETASKBAR |
537 SHFS_HIDESIPBUTTON);
538 }
539 #endif
540 }
541
542 void
543 WIN_MinimizeWindow(_THIS, SDL_Window * window)
544 {
545 HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
546
547 ShowWindow(hwnd, SW_MINIMIZE);
548
549 #ifdef _WIN32_WCE
550 if (window->flags & SDL_WINDOW_FULLSCREEN) {
551 CE_SHFullScreen(hwnd,
552 SHFS_SHOWSTARTICON | SHFS_SHOWTASKBAR |
553 SHFS_SHOWSIPBUTTON);
554 }
555 #endif 501 #endif
556 } 502 }
557 503
558 void 504 void
559 WIN_RestoreWindow(_THIS, SDL_Window * window) 505 WIN_RestoreWindow(_THIS, SDL_Window * window)
584 WIN_DestroyWindow(_THIS, SDL_Window * window) 530 WIN_DestroyWindow(_THIS, SDL_Window * window)
585 { 531 {
586 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 532 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
587 533
588 if (data) { 534 if (data) {
535 #ifdef _WIN32_WCE
536 WINCE_ShowWindow(_this, window, 0);
537 #endif
589 ReleaseDC(data->hwnd, data->hdc); 538 ReleaseDC(data->hwnd, data->hdc);
590 if (data->created) { 539 if (data->created) {
591 DestroyWindow(data->hwnd); 540 DestroyWindow(data->hwnd);
592 } 541 }
593 SDL_free(data); 542 SDL_free(data);