mirror of https://github.com/OpenTTD/OpenTTD
(svn r9852) [0.5] -Backport from trunk (r9728, r9834):
- Fix: [win32] Dead key and open/close console. (r9728) - Add: win9x check in win32 buildsrelease/0.5
parent
4b6d1f9027
commit
c50cf74889
|
@ -212,6 +212,7 @@ static void CALLBACK TrackMouseTimerProc(HWND hwnd, UINT msg, UINT event, DWORD
|
||||||
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static uint32 keycode = 0;
|
static uint32 keycode = 0;
|
||||||
|
static bool console = false;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
|
@ -363,6 +364,10 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
}
|
}
|
||||||
#endif /* UNICODE */
|
#endif /* UNICODE */
|
||||||
|
|
||||||
|
case WM_DEADCHAR:
|
||||||
|
console = GB(lParam, 16, 8) == 41;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case WM_CHAR: {
|
case WM_CHAR: {
|
||||||
uint scancode = GB(lParam, 16, 8);
|
uint scancode = GB(lParam, 16, 8);
|
||||||
uint charcode = wParam;
|
uint charcode = wParam;
|
||||||
|
@ -370,6 +375,13 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
/* Silently drop all non-text messages as those were handled by WM_KEYDOWN */
|
/* Silently drop all non-text messages as those were handled by WM_KEYDOWN */
|
||||||
if (wParam < VK_SPACE) return 0;
|
if (wParam < VK_SPACE) return 0;
|
||||||
|
|
||||||
|
/* If the console key is a dead-key, we need to press it twice to get a WM_CHAR message.
|
||||||
|
* But we then get two WM_CHAR messages, so ignore the first one */
|
||||||
|
if (console && scancode == 41) {
|
||||||
|
console = false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(UNICODE)
|
#if !defined(UNICODE)
|
||||||
{
|
{
|
||||||
wchar_t w;
|
wchar_t w;
|
||||||
|
|
3
win32.c
3
win32.c
|
@ -887,6 +887,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||||
* save it because argv[] points into this buffer and thus needs to
|
* save it because argv[] points into this buffer and thus needs to
|
||||||
* be available between subsequent calls to FS2OTTD() */
|
* be available between subsequent calls to FS2OTTD() */
|
||||||
char cmdlinebuf[MAX_PATH];
|
char cmdlinebuf[MAX_PATH];
|
||||||
|
|
||||||
|
/* Check if a win9x user started the win32 version */
|
||||||
|
if (HASBIT(GetVersion(), 31)) error("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
|
||||||
#endif /* UNICODE */
|
#endif /* UNICODE */
|
||||||
|
|
||||||
cmdline = WIDE_TO_MB_BUFFER(GetCommandLine(), cmdlinebuf, lengthof(cmdlinebuf));
|
cmdline = WIDE_TO_MB_BUFFER(GetCommandLine(), cmdlinebuf, lengthof(cmdlinebuf));
|
||||||
|
|
Loading…
Reference in New Issue