Tk Source Code

View Ticket
Login
Ticket UUID: e362a2cc027e2e35be72d8288d5c2a6cd84da12a
Title: bind KeyRelease KeyPress %K
Type: Bug Version: 8.6.18, 9.0.5
Submitter: anonymous Created on: 2022-04-22 16:39:56
Subsystem: 01. Bindings Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-23 09:33:51
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-10-23 09:33:51
Description:
Hi! There is such a code:

bind . <KeyRelease> { puts "up   %K" } 
bind . <KeyPress>   { puts "down %K" } 

If I use the russian layout and press some key, then this is displayed in the console:

down Cyrillic_ve
up   d

That is, the essence is such that for the same key different keysums are obtained.
User Comments: serhiy.storchaka added on 2026-10-23 09:33:51:

Fixed on X11 by [8510c93fa0] (main), [d1210ec7fb] (9.0) and [7407bcb401] (8.6), as part of [701d8f8953]: KeyPress and KeyRelease now look up the keysym in the current XKB group, so both report Cyrillic_ve with a Cyrillic layout. The Windows Shift_R/Shift_L difference mentioned in the comments is a separate issue; please open a new ticket if it still happens.


serhiy.storchaka added on 2026-09-17 20:47:16:

On X11, TkpGetKeySym() looked the keysym up in the first XKB group for KeyRelease (and for KeyPress with input methods off), so it returned the Latin letter of the key. Fixed on branch x11-nonlatin-shortcuts in [b052917bd2] (ticket [701d8f8953]); both events now report Cyrillic_ve.


anonymous added on 2022-05-25 15:59:46:
>Could the reporter please clarify which windowing system they are using (Windows, Mac Aqua, or X11)?

X11

oehhar added on 2022-05-23 10:33:26:

I suppose, the concerned character is "в", which is on the "d" key of an English keyboard.

Here is a test on Windows 10 GER:

  • Windows 10: Language->Add Language-> Russisch (German for Russian)
  • Start Wish 8.6.12
  • Paste the 2 test lines in the console
  • Choose "RU" in the Windows Task line
  • Press "d" Key

Console shows only question marks:

down ??
up   ??
  • Focus on console
  • Press "d" Key

Console shows correctly:

в

Also, the standard Bindings Ctrl-C etc do not work.

So, I tried:

bind . <Cyrillic_ve> {puts .}
bind . <d> {puts !}

This does not fire neither.

Sorry, no reproduction, it is worse here...

Thank you, Harald


fvogel added on 2022-05-22 20:09:26:
I'm seeing this on Windows when I hit the shift key physically located at the right of my keyboard. The output of the script is:

down Shift_R
up   Shift_L

AFAIK no other key (with my layout) shows this issue.

chrstphrchvz added on 2022-04-29 10:00:31:

Could the reporter please clarify which windowing system they are using (Windows, Mac Aqua, or X11)?