From 99f84bd069f2f2299b0982b7679f751d4aa32ccf Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Mon, 20 Sep 1999 21:07:39 +0000 Subject: [PATCH] fixed bug 14271, delete key not generating a keyPress event on windows git-svn-id: svn://10.0.0.236/trunk@48393 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsWindow.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index bd49a498ade..8cdbf267636 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -2029,10 +2029,21 @@ BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode) WORD asciiKey; asciiKey = 0; - return DispatchKeyEvent(NS_KEY_DOWN, asciiKey, aVirtualKeyCode); - // always let the def proc process a WM_KEYDOWN - //return FALSE; + //printf("In OnKeyDown ascii %d virt: %d scan: %d\n", asciiKey, aVirtualKeyCode, aScanCode); + + BOOL result = DispatchKeyEvent(NS_KEY_DOWN, asciiKey, aVirtualKeyCode); + + // XXX: this is a special case hack, should probably use IsSpecialChar and + // do the right thing for all SPECIAL_KEY codes + // "SPECIAL_KEY" keys don't generate a WM_CHAR, so don't generate an NS_KEY_PRESS + // this is a special case for the delete key + if (aVirtualKeyCode==VK_DELETE) + { + DispatchKeyEvent(NS_KEY_PRESS, 0, aVirtualKeyCode); + } + + return result; } #else BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode) @@ -2128,7 +2139,7 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte //if (IsDBCSLeadByte(aVirtualKeyCode) || aVirtualKeyCode == 0xD /*'\n'*/ ) { // return FALSE; //} - //printf("OnChar (KeyDown) %d\n", aVirtualKeyCode); + //printf("OnChar (KeyDown) %d\n", virtualKeyCode); ::MultiByteToWideChar(mCurrentKeyboardCP,MB_PRECOMPOSED,charToConvert,length, &uniChar,sizeof(uniChar));