mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Don't drop keypress messages with character codes > U+FFFF. Bug 297943, r=karlt
This commit is contained in:
parent
b1df39ca7b
commit
a883004a9e
@ -49,6 +49,8 @@
|
||||
#include "nsGUIEvent.h"
|
||||
#include "keysym2ucs.h"
|
||||
|
||||
#define MAX_UNICODE 0x10FFFF
|
||||
|
||||
struct nsKeyConverter {
|
||||
int vkCode; // Platform independent key code
|
||||
int keysym; // GDK keysym key code
|
||||
@ -334,7 +336,7 @@ PRUint32 nsConvertCharCodeToUnicode(GdkEventKey* aEvent)
|
||||
|
||||
// we're supposedly printable, let's try to convert
|
||||
long ucs = keysym2ucs(aEvent->keyval);
|
||||
if ((ucs != -1) && (ucs < 0x10000))
|
||||
if ((ucs != -1) && (ucs < MAX_UNICODE))
|
||||
return ucs;
|
||||
|
||||
// I guess we couldn't convert
|
||||
|
@ -3443,8 +3443,21 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
|
||||
DispatchEvent(&contextMenuEvent, status);
|
||||
}
|
||||
else {
|
||||
// send the key press event
|
||||
DispatchEvent(&event, status);
|
||||
// If the character code is in the BMP, send the key press event.
|
||||
// Otherwise, send a text event with the equivalent UTF-16 string.
|
||||
if (IS_IN_BMP(event.charCode)) {
|
||||
DispatchEvent(&event, status);
|
||||
}
|
||||
else {
|
||||
nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, this);
|
||||
PRUnichar textString[3];
|
||||
textString[0] = H_SURROGATE(event.charCode);
|
||||
textString[1] = L_SURROGATE(event.charCode);
|
||||
textString[2] = 0;
|
||||
textEvent.theText = textString;
|
||||
textEvent.time = event.time;
|
||||
DispatchEvent(&textEvent, status);
|
||||
}
|
||||
}
|
||||
|
||||
// If the event was consumed, return.
|
||||
|
Loading…
Reference in New Issue
Block a user