summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-27 09:58:34 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-27 09:58:34 (GMT)
commit6864f7029a8095dec62bdc53e31f4e3c30c31b0b (patch)
treed33fbf0652a1256dcc5745d6f9bd75bc6732ff1a /win
parent1b5c660e330eddb121d8400dafafffa917beeb46 (diff)
downloadtk-6864f7029a8095dec62bdc53e31f4e3c30c31b0b.zip
tk-6864f7029a8095dec62bdc53e31f4e3c30c31b0b.tar.gz
tk-6864f7029a8095dec62bdc53e31f4e3c30c31b0b.tar.bz2
Fix [720879afe9] - WM_CHAR message handling. Patch from Christian Werner backported from http://www.androwish.org/index.html/info/a0da5845594cec28
Diffstat (limited to 'win')
-rw-r--r--win/tkWinX.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index cbd6032..af28e41 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -137,7 +137,7 @@ static Tcl_ThreadDataKey dataKey;
static void GenerateXEvent(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam);
-static void GetTranslatedKey(XKeyEvent *xkey);
+static void GetTranslatedKey(XKeyEvent *xkey, UINT type);
static void UpdateInputLanguage(int charset);
static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
@@ -1187,7 +1187,8 @@ GenerateXEvent(
event.type = KeyPress;
event.xany.send_event = -1;
event.xkey.keycode = wParam;
- GetTranslatedKey(&event.xkey);
+ GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR :
+ WM_SYSCHAR);
break;
case WM_SYSKEYUP:
@@ -1243,9 +1244,10 @@ GenerateXEvent(
if (IsDBCSLeadByte((BYTE) wParam)) {
MSG msg;
- if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0)
+ if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR,
+ PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
- GetMessage(&msg, NULL, 0, 0);
+ GetMessage(&msg, NULL, WM_CHAR, WM_CHAR);
event.xkey.nbytes = 2;
event.xkey.trans_chars[1] = (char) msg.wParam;
}
@@ -1392,19 +1394,20 @@ GetState(
static void
GetTranslatedKey(
- XKeyEvent *xkey)
+ XKeyEvent *xkey,
+ UINT type)
{
MSG msg;
xkey->nbytes = 0;
while ((xkey->nbytes < XMaxTransChars)
- && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
- if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) {
+ && PeekMessage(&msg, NULL, type, type, PM_NOREMOVE)) {
+ if (msg.message != type) {
break;
}
- GetMessage(&msg, NULL, 0, 0);
+ GetMessage(&msg, NULL, type, type);
/*
* If this is a normal character message, we may need to strip off the