| Ticket UUID: | a53a902ac6e179ab41a650f8d97c5124f99f37db | |||
| Title: | overrideredirect on linux/mac prevents certain binds from working | |||
| Type: | Bug | Version: | 8.6.1, 8.6.6 | |
| Submitter: | anonymous | Created on: | 2016-08-25 18:02:52 | |
| Subsystem: | 55. [focus] | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-21 15:08:44 | |
| Resolution: | Fixed | Closed By: | nemethi | |
| Closed on: | 2026-10-21 15:08:44 | |||
| Description: |
Keypress and other bindings do not work in a window with overrideredirect on mac and linux.
See:
http://stackoverflow.com/questions/34582637/tkinters-overrideredirect-prevents-certain-events-in-mac-and-linux
If I comment out the overrideredirect in the code below, and use the following
configuration with the devilspie program to create an undecorated window, then the keypress bindings work:
I have only tested on Linux.
(if (is (application_name) "t.tcl")
(begin (undecorate)(below)(geometry "+100+100")))
#!/usr/bin/env wish
wm title . t.tcl
wm overrideredirect . True
wm geometry . "399x25+100+300"
bind . <KeyPress> {+puts "<KeyPress %K>"}
bind . <Button-1> {puts "<Button-1>"}
bind . <Enter> {puts "<Enter>"}
bind . <Leave> {puts "<Leave>"}
bind . <FocusIn> {puts "<FocusIn>"}
bind . <FocusOut> {puts "<FocusOut>"}
| |||
| User Comments: |
nemethi (claiming to be Csaba Nemethi) added on 2026-10-21 15:08:44:
Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [a341a0f7], [7e01f27b], and [503a0d9d]. serhiy.storchaka added on 2026-09-22 06:29:42: The branches for [220892] and [a4fa3ad2d6] add an extended version of testxfocus (with an optional window argument which sets the X focus). When merging, keep that version; the test here works with it unchanged. serhiy.storchaka added on 2026-09-19 11:40:04: The window manager never gives the focus to an override-redirect window, and Tk refused to set the X focus to it even with focus -force (an old olvwm workaround for menus), so focus reported the window while key events went elsewhere. focus -force now works for such windows on X11 ([98ea86d9d7], branch x11-override-redirect-focus); a window without it still cannot get the focus. macOS not checked. pspjuth added on 2016-08-28 11:59:29: A window with overrideredircct is deliberately prevented from taking focus, and thus cannot get key events: http://core.tcl.tk/tk/artifact/7892c68f49012d2d71222ae0e312a1e7dc69a801?txt=1&ln=51-64 That line and comment is ancient, and might be possible to remove. Not sure though. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki