diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-09-27 10:08:02 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-09-27 10:08:02 (GMT) |
commit | 94ca8fddecf8a8e3b0e446e9d71eaf77bda8f1e6 (patch) | |
tree | 0d9541fd8369d4716b0cc2beb3deefdf7a0f24b0 | |
parent | 1119e63470fa87743572b452320e7d583e5faf19 (diff) | |
parent | 8480a73fc23b0812d1681db23c634c3555e8d263 (diff) | |
download | tk-94ca8fddecf8a8e3b0e446e9d71eaf77bda8f1e6.zip tk-94ca8fddecf8a8e3b0e446e9d71eaf77bda8f1e6.tar.gz tk-94ca8fddecf8a8e3b0e446e9d71eaf77bda8f1e6.tar.bz2 |
Fix [720879afe9] - WM_CHAR message handling. Patch from Christian Werner backported from http://www.androwish.org/index.html/info/a0da5845594cec28
-rw-r--r-- | doc/menu.n | 2 | ||||
-rw-r--r-- | library/text.tcl | 8 | ||||
-rw-r--r-- | win/tkWinX.c | 19 |
3 files changed, 16 insertions, 13 deletions
@@ -101,7 +101,7 @@ textual field is displayed to the right of the label. The accelerator typically describes a keystroke sequence that may be used in the application to cause the same result as invoking the menu entry. This is a display option, it does not actually set the corresponding -binding (which can be achieved using the \fBbind\fR command). +binding (which can be achieved using the \fBbind\fR command). The third field is an \fIindicator\fR. The indicator is present only for checkbutton or radiobutton entries. It indicates whether the entry is selected or not, and is displayed to the left of the entry's diff --git a/library/text.tcl b/library/text.tcl index 02a8939..59e395c 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -1261,17 +1261,17 @@ proc ::tk::TextUndoRedoProcessMarks {w} { set il1 [lindex $ind $i] set ir1 [lindex $ind [expr {$i + 1}]] lappend indices $il1 $ir1 - + for {set j [expr {$i + 2}]} {$j < $nUndoMarks} {incr j 2} { set il2 [lindex $ind $j] set ir2 [lindex $ind [expr {$j + 1}]] - + if {[$w compare $il2 > $ir1]} { # second range starts after the end of first range # -> further second ranges do not need to be considered # because ranges were sorted by increasing first index set j $nUndoMarks - + } else { if {[$w compare $ir2 > $ir1]} { # second range overlaps first range @@ -1289,7 +1289,7 @@ proc ::tk::TextUndoRedoProcessMarks {w} { set ind [lreplace $ind $j [expr {$j + 1}]] incr j -2 incr nUndoMarks -2 - + } } diff --git a/win/tkWinX.c b/win/tkWinX.c index 6be54e2..cbb84cf 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 |