summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-09-25 20:13:53 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-09-25 20:13:53 (GMT)
commitff1f4d2274c7c14ccb776c30e7b26c66c7e6ac1e (patch)
tree493d5c424156a0b96f6def119acb8b8d5dcd3bac /win/tkWinX.c
parent13b0ea92ae0d9159c5e7c9c3f3715f945e077782 (diff)
downloadtk-ff1f4d2274c7c14ccb776c30e7b26c66c7e6ac1e.zip
tk-ff1f4d2274c7c14ccb776c30e7b26c66c7e6ac1e.tar.gz
tk-ff1f4d2274c7c14ccb776c30e7b26c66c7e6ac1e.tar.bz2
New attempt to fix [720879afe9] - WM_CHAR message handling. Patch from Christian Werner backported from http://www.androwish.org/index.html/info/a0da5845594cec28
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index bb60a2d..e13bb4f 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -92,7 +92,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);
@@ -1157,7 +1157,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:
@@ -1229,9 +1230,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;
}
@@ -1370,19 +1372,20 @@ GetState(
static void
GetTranslatedKey(
- XKeyEvent *xkey)
+ XKeyEvent *xkey,
+ UINT type)
{
MSG msg;
xkey->nbytes = 0;
while ((xkey->nbytes < XMaxTransChars)
- && PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) {
- if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) {
+ && (PeekMessageA(&msg, NULL, type, type, PM_NOREMOVE) != 0)) {
+ if (msg.message != type) {
break;
}
- GetMessageA(&msg, NULL, 0, 0);
+ GetMessageA(&msg, NULL, type, type);
/*
* If this is a normal character message, we may need to strip off the