From 21ee0c54b0de01104f3fa193e48ea0d738860904 Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Thu, 24 Aug 2000 00:12:46 +0000 Subject: [PATCH] fix 41305. r=jfrancis. send correct charcode for contrl key on mac. --- widget/src/mac/nsMacEventHandler.cpp | 65 +++++++++++++++------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/widget/src/mac/nsMacEventHandler.cpp b/widget/src/mac/nsMacEventHandler.cpp index 8f5b8199d753..91170aa56b4d 100644 --- a/widget/src/mac/nsMacEventHandler.cpp +++ b/widget/src/mac/nsMacEventHandler.cpp @@ -788,47 +788,54 @@ void nsMacEventHandler::InitializeKeyEvent(nsKeyEvent& aKeyEvent, EventRecord& a // nsKeyEvent parts // if (message == NS_KEY_PRESS - && !IsSpecialRaptorKey((aOSEvent.message & keyCodeMask) >> 8) ) + && !IsSpecialRaptorKey((aOSEvent.message & keyCodeMask) >> 8) ) { - if ( aKeyEvent.isControl ) - { - aKeyEvent.charCode = (aOSEvent.message & charCodeMask); - if ( aKeyEvent.charCode <= 26 ) - { - if ( aKeyEvent.isShift ) - aKeyEvent.charCode += 'A' - 1; - else - aKeyEvent.charCode += 'a' - 1; - } - } - else - if ( !aKeyEvent.isMeta) - { - aKeyEvent.isShift = aKeyEvent.isControl = aKeyEvent.isAlt = aKeyEvent.isMeta = 0; - } + if ( aKeyEvent.isControl ) + { + aKeyEvent.charCode = (aOSEvent.message & charCodeMask); + if ( aKeyEvent.charCode <= 26 ) + { + if ( aKeyEvent.isShift ) + aKeyEvent.charCode += 'A' - 1; + else + aKeyEvent.charCode += 'a' - 1; + } // if ( aKeyEvent.charCode <= 26 ) - aKeyEvent.keyCode = 0; - aKeyEvent.charCode = ConvertKeyEventToUnicode(aOSEvent); - NS_ASSERTION(0 != aKeyEvent.charCode, "nsMacEventHandler::InitializeKeyEvent: ConvertKeyEventToUnicode returned 0."); - } + aKeyEvent.keyCode = 0; + } // if ( aKeyEvent.isControl ) + else // else for if ( aKeyEvent.isControl ) + { + if ( !aKeyEvent.isMeta) + { + aKeyEvent.isShift = aKeyEvent.isControl = aKeyEvent.isAlt = aKeyEvent.isMeta = 0; + } // if ( !aKeyEvent.isMeta) + + aKeyEvent.keyCode = 0; + aKeyEvent.charCode = ConvertKeyEventToUnicode(aOSEvent); + NS_ASSERTION(0 != aKeyEvent.charCode, "nsMacEventHandler::InitializeKeyEvent: ConvertKeyEventToUnicode returned 0."); + } // else for if ( aKeyEvent.isControl ) + } // if (message == NS_KEY_PRESS && !IsSpecialRaptorKey((aOSEvent.message & keyCodeMask) >> 8) ) else { - aKeyEvent.keyCode = ConvertMacToRaptorKeyCode(aOSEvent.message, aOSEvent.modifiers); - aKeyEvent.charCode = 0; - } + aKeyEvent.keyCode = ConvertMacToRaptorKeyCode(aOSEvent.message, aOSEvent.modifiers); + aKeyEvent.charCode = 0; + } // else for if (message == NS_KEY_PRESS && !IsSpecialRaptorKey((aOSEvent.message & keyCodeMask) >> 8) ) // // obscure cursor if appropriate // - if ( message == NS_KEY_PRESS - && !aKeyEvent.isMeta - && aKeyEvent.keyCode != NS_VK_PAGE_UP && aKeyEvent.keyCode != NS_VK_PAGE_DOWN - // also consider: function keys and sole modifier keys - ) + if ( message == NS_KEY_PRESS + && !aKeyEvent.isMeta + && aKeyEvent.keyCode != NS_VK_PAGE_UP && aKeyEvent.keyCode != NS_VK_PAGE_DOWN + // also consider: function keys and sole modifier keys + ) + { ::ObscureCursor(); + } // if ( message == NS_KEY_PRESS && !aKeyEvent.isMeta && aKeyEvent.keyCode != NS_VK_PAGE_UP && aKeyEvent.keyCode != NS_VK_PAGE_DOWN } + //------------------------------------------------------------------------- // // IsSpecialRaptorKey