mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-26 18:31:29 +00:00
Remove the Enter->Return key hackery, as this is done now when the key event is generated.
This commit is contained in:
parent
b114503f81
commit
2b75e4e24e
@ -237,8 +237,6 @@ PRBool nsTextAreaWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
||||||
{
|
{
|
||||||
#define enterKey 0x03 /* ascii code for enter key */
|
|
||||||
|
|
||||||
// filter cursor keys
|
// filter cursor keys
|
||||||
PRBool passKeyEvent = PR_TRUE;
|
PRBool passKeyEvent = PR_TRUE;
|
||||||
switch (aEvent.message)
|
switch (aEvent.message)
|
||||||
@ -246,14 +244,19 @@ PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
|||||||
case NS_KEY_DOWN:
|
case NS_KEY_DOWN:
|
||||||
case NS_KEY_UP:
|
case NS_KEY_UP:
|
||||||
{
|
{
|
||||||
// hack: if Enter is pressed, pass Return
|
|
||||||
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
|
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;
|
EventRecord* theOSEvent = (EventRecord*)aEvent.nativeMsg;
|
||||||
if (theOSEvent && ((theOSEvent->message & charCodeMask) == enterKey))
|
if (theOSEvent && ((theOSEvent->message & charCodeMask) == kEnterCharCode))
|
||||||
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + NS_VK_RETURN;
|
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + kReturnCharCode;
|
||||||
|
|
||||||
switch (keyEvent->keyCode)
|
switch (keyEvent->keyCode)
|
||||||
{
|
{
|
||||||
@ -318,7 +321,7 @@ PRBool nsTextAreaWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
|
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
|
||||||
theChar = keyEvent->keyCode;
|
theChar = keyEvent->charCode;
|
||||||
if (keyEvent->isShift)
|
if (keyEvent->isShift)
|
||||||
theModifiers = shiftKey;
|
theModifiers = shiftKey;
|
||||||
if (keyEvent->isControl)
|
if (keyEvent->isControl)
|
||||||
|
@ -168,8 +168,6 @@ PRBool nsTextWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
||||||
{
|
{
|
||||||
#define enterKey 0x03 /* ascii code for enter key */
|
|
||||||
|
|
||||||
// filter cursor keys
|
// filter cursor keys
|
||||||
PRBool passKeyEvent = PR_TRUE;
|
PRBool passKeyEvent = PR_TRUE;
|
||||||
switch (aEvent.message)
|
switch (aEvent.message)
|
||||||
@ -179,12 +177,18 @@ PRBool nsTextWidget::DispatchWindowEvent(nsGUIEvent &aEvent)
|
|||||||
{
|
{
|
||||||
// hack: if Enter is pressed, pass Return
|
// hack: if Enter is pressed, pass Return
|
||||||
nsKeyEvent* keyEvent = (nsKeyEvent*)&aEvent;
|
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;
|
EventRecord* theOSEvent = (EventRecord*)aEvent.nativeMsg;
|
||||||
if (theOSEvent && ((theOSEvent->message & charCodeMask) == enterKey))
|
if (theOSEvent && ((theOSEvent->message & charCodeMask) == kEnterCharCode))
|
||||||
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + NS_VK_RETURN;
|
theOSEvent->message = (theOSEvent->message & ~charCodeMask) + kReturnCharCode;
|
||||||
|
|
||||||
switch (keyEvent->keyCode)
|
switch (keyEvent->keyCode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user