210 } |
210 } |
211 |
211 |
212 static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
212 static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
213 { |
213 { |
214 static uint32 keycode = 0; |
214 static uint32 keycode = 0; |
|
215 static bool console = false; |
215 |
216 |
216 switch (msg) { |
217 switch (msg) { |
217 case WM_CREATE: |
218 case WM_CREATE: |
218 SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc); |
219 SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc); |
219 break; |
220 break; |
361 if (len != 0) _codepage = _ttoi(locale); |
362 if (len != 0) _codepage = _ttoi(locale); |
362 return 1; |
363 return 1; |
363 } |
364 } |
364 #endif /* UNICODE */ |
365 #endif /* UNICODE */ |
365 |
366 |
|
367 case WM_DEADCHAR: |
|
368 console = GB(lParam, 16, 8) == 41; |
|
369 return 0; |
|
370 |
366 case WM_CHAR: { |
371 case WM_CHAR: { |
367 /* Silently drop all non-text messages as those were handled by WM_KEYDOWN */ |
372 /* Silently drop all non-text messages as those were handled by WM_KEYDOWN */ |
368 if (wParam < VK_SPACE) return 0; |
373 if (wParam < VK_SPACE) return 0; |
369 uint scancode = GB(lParam, 16, 8); |
374 uint scancode = GB(lParam, 16, 8); |
370 uint charcode = wParam; |
375 uint charcode = wParam; |
|
376 |
|
377 /* If the console key is a dead-key, we need to press it twice to get a WM_CHAR message. |
|
378 * But we then get two WM_CHAR messages, so ignore the first one */ |
|
379 if (console && scancode == 41) { |
|
380 console = false; |
|
381 return 0; |
|
382 } |
371 |
383 |
372 #if !defined(UNICODE) |
384 #if !defined(UNICODE) |
373 wchar_t w; |
385 wchar_t w; |
374 int len = MultiByteToWideChar(_codepage, 0, (char*)&charcode, 1, &w, 1); |
386 int len = MultiByteToWideChar(_codepage, 0, (char*)&charcode, 1, &w, 1); |
375 charcode = len == 1 ? w : 0; |
387 charcode = len == 1 ? w : 0; |
657 memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256); |
669 memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256); |
658 bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
670 bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
659 |
671 |
660 if (_wnd.double_size) { |
672 if (_wnd.double_size) { |
661 w = ALIGN(w, 4); |
673 w = ALIGN(w, 4); |
662 _wnd.alloced_bits = _wnd.buffer_bits = (Pixel*)malloc(w * h); |
674 _wnd.alloced_bits = _wnd.buffer_bits = (Pixel *)malloc(w * h * sizeof(Pixel)); |
663 w *= 2; |
675 w *= 2; |
664 h *= 2; |
676 h *= 2; |
665 } |
677 } |
666 |
678 |
667 bi->bmiHeader.biWidth = _wnd.width = w; |
679 bi->bmiHeader.biWidth = _wnd.width = w; |