349 |
349 |
350 case WM_KEYDOWN: { |
350 case WM_KEYDOWN: { |
351 // this is the rewritten ascii input function |
351 // this is the rewritten ascii input function |
352 // it disables windows deadkey handling --> more linux like :D |
352 // it disables windows deadkey handling --> more linux like :D |
353 wchar_t w = 0; |
353 wchar_t w = 0; |
|
354 #if !defined(WINCE) |
354 byte ks[256]; |
355 byte ks[256]; |
|
356 #endif |
355 uint scancode; |
357 uint scancode; |
356 uint32 pressed_key; |
358 uint32 pressed_key; |
357 |
359 |
|
360 #if defined(WINCE) |
|
361 /* On WinCE GetKeyboardState isn't supported */ |
|
362 w = wParam; |
|
363 #else |
358 GetKeyboardState(ks); |
364 GetKeyboardState(ks); |
359 if (ToUnicode(wParam, 0, ks, &w, 1, 0) != 1) { |
365 if (ToUnicode(wParam, 0, ks, &w, 1, 0) != 1) { |
360 /* On win9x ToUnicode always fails, so fall back to ToAscii */ |
366 /* On win9x ToUnicode always fails, so fall back to ToAscii */ |
361 if (ToAscii(wParam, 0, ks, (LPWORD)&w, 0) != 1) w = 0; // no translation was possible |
367 if (ToAscii(wParam, 0, ks, (LPWORD)&w, 0) != 1) w = 0; // no translation was possible |
362 } |
368 } |
|
369 #endif |
363 |
370 |
364 pressed_key = w | MapWindowsKey(wParam) << 16; |
371 pressed_key = w | MapWindowsKey(wParam) << 16; |
365 |
372 |
366 scancode = GB(lParam, 16, 8); |
373 scancode = GB(lParam, 16, 8); |
367 if (scancode == 41) pressed_key = w | WKC_BACKQUOTE << 16; |
374 if (scancode == 41) pressed_key = w | WKC_BACKQUOTE << 16; |
536 if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) { |
545 if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) { |
537 DestroyWindow(_wnd.main_wnd); |
546 DestroyWindow(_wnd.main_wnd); |
538 _wnd.main_wnd = 0; |
547 _wnd.main_wnd = 0; |
539 } |
548 } |
540 |
549 |
|
550 #if defined(WINCE) |
|
551 /* WinCE is always fullscreen */ |
|
552 #else |
541 if (full_screen) { |
553 if (full_screen) { |
542 DEVMODE settings; |
554 DEVMODE settings; |
543 |
555 |
544 memset(&settings, 0, sizeof(settings)); |
556 memset(&settings, 0, sizeof(settings)); |
545 settings.dmSize = sizeof(settings); |
557 settings.dmSize = sizeof(settings); |
577 /* On window creation, check if we were in maximize mode before */ |
590 /* On window creation, check if we were in maximize mode before */ |
578 if (_window_maximize) showstyle = SW_SHOWMAXIMIZED; |
591 if (_window_maximize) showstyle = SW_SHOWMAXIMIZED; |
579 SetRect(&r, 0, 0, _wnd.width, _wnd.height); |
592 SetRect(&r, 0, 0, _wnd.width, _wnd.height); |
580 } |
593 } |
581 |
594 |
|
595 #if !defined(WINCE) |
582 AdjustWindowRect(&r, style, FALSE); |
596 AdjustWindowRect(&r, style, FALSE); |
|
597 #endif |
583 w = r.right - r.left; |
598 w = r.right - r.left; |
584 h = r.bottom - r.top; |
599 h = r.bottom - r.top; |
585 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
600 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
586 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
601 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
587 |
602 |
667 }; |
682 }; |
668 |
683 |
669 static void FindResolutions(void) |
684 static void FindResolutions(void) |
670 { |
685 { |
671 uint n = 0; |
686 uint n = 0; |
|
687 #if defined(WINCE) |
|
688 /* EnumDisplaySettingsW is only supported in CE 4.2+ */ |
|
689 /* XXX -- One might argue that we assume 4.2+ on every system. Then we can use this function safely */ |
|
690 #else |
672 uint i; |
691 uint i; |
673 DEVMODEA dm; |
692 DEVMODEA dm; |
674 |
693 |
675 /* XXX - EnumDisplaySettingsW crashes with unicows.dll on Windows95 |
694 /* XXX - EnumDisplaySettingsW crashes with unicows.dll on Windows95 |
676 * Doesn't really matter since we don't pass a string anyways, but still |
695 * Doesn't really matter since we don't pass a string anyways, but still |
693 _resolutions[j][1] = dm.dmPelsHeight; |
712 _resolutions[j][1] = dm.dmPelsHeight; |
694 if (++n == lengthof(_resolutions)) break; |
713 if (++n == lengthof(_resolutions)) break; |
695 } |
714 } |
696 } |
715 } |
697 } |
716 } |
|
717 #endif |
698 |
718 |
699 /* We have found no resolutions, show the default list */ |
719 /* We have found no resolutions, show the default list */ |
700 if (n == 0) { |
720 if (n == 0) { |
701 memcpy(_resolutions, default_resolutions, sizeof(default_resolutions)); |
721 memcpy(_resolutions, default_resolutions, sizeof(default_resolutions)); |
702 n = lengthof(default_resolutions); |
722 n = lengthof(default_resolutions); |
733 { |
753 { |
734 DeleteObject(_wnd.gdi_palette); |
754 DeleteObject(_wnd.gdi_palette); |
735 DeleteObject(_wnd.dib_sect); |
755 DeleteObject(_wnd.dib_sect); |
736 DestroyWindow(_wnd.main_wnd); |
756 DestroyWindow(_wnd.main_wnd); |
737 |
757 |
|
758 #if !defined(WINCE) |
738 if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0); |
759 if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0); |
|
760 #endif |
739 if (_double_size) { |
761 if (_double_size) { |
740 _cur_resolution[0] *= 2; |
762 _cur_resolution[0] *= 2; |
741 _cur_resolution[1] *= 2; |
763 _cur_resolution[1] *= 2; |
742 } |
764 } |
743 |
765 |