Remove the Enter->Return key hackery, as this is done now when the key event is generated.

This commit is contained in:
sfraser%netscape.com 1999-03-25 03:41:07 +00:00
parent b114503f81
commit 2b75e4e24e
2 changed files with 23 additions and 16 deletions

View File

@ -237,8 +237,6 @@ PRBool nsTextAreaWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
//-------------------------------------------------------------------------
PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
{
#define enterKey 0x03 /* ascii code for enter key */
// filter cursor keys
PRBool passKeyEvent = PR_TRUE;
switch (aEvent.message)
@ -246,14 +244,19 @@ PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
case NS_KEY_DOWN:
case NS_KEY_UP:
{
// hack: if Enter is pressed, pass Return
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
if (keyEvent->keyCode == enterKey)
keyEvent->keyCode = NS_VK_RETURN;
#if 0
// this hack is no longer needed, since Enter is being mapped to
// VK_RETURN in the event handler
if (keyEvent->keyCode == kEnterCharCode)
keyEvent->keyCode = NS_VK_RETURN;
#endif
// is this hack really needed?
EventRecord* theOSEvent = (EventRecord*)aEvent.nativeMsg;
if (theOSEvent && ((theOSEvent->message & charCodeMask) == enterKey))
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + NS_VK_RETURN;
if (theOSEvent && ((theOSEvent->message & charCodeMask) == kEnterCharCode))
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + kReturnCharCode;
switch (keyEvent->keyCode)
{
@ -318,7 +321,7 @@ PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
else
{
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
theChar = keyEvent->keyCode;
theChar = keyEvent->charCode;
if (keyEvent->isShift)
theModifiers = shiftKey;
if (keyEvent->isControl)

View File

@ -168,8 +168,6 @@ PRBool nsTextWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
//-------------------------------------------------------------------------
PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
{
#define enterKey 0x03 /* ascii code for enter key */
// filter cursor keys
PRBool passKeyEvent = PR_TRUE;
switch (aEvent.message)
@ -179,12 +177,18 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
{
// hack: if Enter is pressed, pass Return
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
if (keyEvent->keyCode == enterKey)
keyEvent->keyCode = NS_VK_RETURN;
#if 0
// this hack is no longer needed, since Enter is being mapped to
// VK_RETURN in the event handler
if (keyEvent->keyCode == kEnterCharCode)
keyEvent->keyCode = NS_VK_RETURN;
#endif
// is this hack really needed?
EventRecord* theOSEvent = (EventRecord*)aEvent.nativeMsg;
if (theOSEvent && ((theOSEvent->message & charCodeMask) == enterKey))
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + NS_VK_RETURN;
if (theOSEvent && ((theOSEvent->message & charCodeMask) == kEnterCharCode))
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + kReturnCharCode;
switch (keyEvent->keyCode)
{