Tk Source Code

View Ticket
Login
2026-09-25
10:24 • Closed ticket [3414089f]: Grab interaction problem on Windows-XP plus 4 other changes artifact: 9f560892 user: serhiy.storchaka
10:24 • Closed ticket [3009450f]: Can't deiconify window if a child toplevel is grabbed plus 4 other changes artifact: 70ca1123 user: serhiy.storchaka
10:24 • Closed ticket [2901053f]: iconified toplevel cannot be restored (Windows only) plus 4 other changes artifact: a6d29a7d user: serhiy.storchaka
10:21 • Ticket [3138512f] Tk applicatications after grab command (both local/global mo status still Open with 3 other changes artifact: 20bcd4ff user: serhiy.storchaka
2026-09-24
18:54 • Closed ticket [658279ff]: Possible transient bug plus 4 other changes artifact: 8d4a0caa user: serhiy.storchaka
2026-09-15
20:06 • Closed ticket [ed6c3a78]: Modal window is not restored after "show desktop" (win+d) is pressed plus 5 other changes artifact: 2dc51c38 user: jan.nijtmans
15:15 • Ticket [ed6c3a78]: 4 changes artifact: 9effa5d4 user: jan.nijtmans
15:12
Fix [ed6c3a787d]: Modal window is not restored after "show desktop" check-in: b86736bb user: jan.nijtmans tags: trunk, main
15:10
Fix [ed6c3a787d]: Modal window is not restored after "show desktop" check-in: 10583c42 user: jan.nijtmans tags: core-9-0-branch
15:08
Fix [ed6c3a787d]: Modal window is not restored after "show desktop" check-in: bfaaec21 user: jan.nijtmans tags: core-8-6-branch
05:08 • Ticket [ed6c3a78] Modal window is not restored after "show desktop" (win+d) is pressed status still Open with 4 other changes artifact: 30c85698 user: oehhar
2026-09-14
17:14 • Ticket [ed6c3a78]: 4 changes artifact: f705986f user: nemethi
09:49 • Ticket [ed6c3a78]: 4 changes artifact: e4f5a9de user: oehhar
09:15
Fix [ed6c3a787d]: Modal window is not restored after "show desktop" (win+d) is pressed (rebase on main branch)

"Show desktop" minimizes windows without WM_SYSCOMMAND, and SC_RESTORE was ignored for windows outside the grab tree, so the main window could not be restored from the taskbar, and neither could the modal dialog owned by it. closed check-in: 73e29b0c user: oehhar tags: ed6c3a78-win-grab-restore-main

08:17 • Ticket [ed6c3a78] Modal window is not restored after "show desktop" (win+d) is pressed status still Open with 5 other changes artifact: e57acd37 user: oehhar
2026-09-13
20:22 • Ticket [ed6c3a78]: 1 change artifact: d2926968 user: serhiy.storchaka
20:22 • Ticket [ed6c3a78]: 1 change artifact: fb39c0fa user: serhiy.storchaka
20:21 • Ticket [ed6c3a78]: 2 changes artifact: 6ff2db5d user: serhiy.storchaka
20:14
Fix [ed6c3a787d]: Modal window is not restored after "show desktop" (win+d) is pressed

"Show desktop" minimizes windows without WM_SYSCOMMAND, and SC_RESTORE was ignored for windows outside the grab tree, so the main window could not be restored from the taskbar, and neither could the modal dialog owned by it. closed check-in: 2838273d user: serhiy.storchaka tags: win-grab-restore

2024-07-09
21:11 • Ticket [ed6c3a78] Modal window is not restored after "show desktop" (win+d) is pressed status still Open with 3 other changes artifact: 76942f45 user: fvogel
2024-06-24
20:02 • Ticket [ed6c3a78]: 4 changes artifact: a3b9781f user: oehhar
17:57 • New ticket [ed6c3a78]. artifact: 24fcf555 user: serhiy.storchaka

Ticket UUID: ed6c3a787d00e8b68ee6d8a15039c6c964fd1292
Title: Modal window is not restored after "show desktop" (win+d) is pressed
Type: Bug Version: 8.6
Submitter: serhiy.storchaka Created on: 2024-06-24 17:57:44
Subsystem: 68. Win Window Operations Assigned To: oehhar
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-15 20:06:58
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2026-09-15 20:06:58
Description:

This issue was first reported on the Python bug tracker: https://github.com/python/cpython/issues/114422, but it is reproducible on pure Tcl/Tk. It is reproducible on Windows.

Way to reproduce the bug. Run any program in Windows and later the below script. The script will open main windows and modal dialog over it. Then press Win-d to hide all programs and show desktop. You can now switch to any program (by selecting it in the task bar or using Alt-Tab) except the Tk program.

toplevel .dialog
wm transient .dialog .
grab set .dialog


serhiy.storchaka added on 2026-09-13 20:46:49 UTC:
WmProc ignores SC_RESTORE for windows outside the grab tree, so after "show desktop" (which minimizes without WM_SYSCOMMAND) the main window cannot be restored from the taskbar. Fix on branch [win-grab-restore]: allow SC_RESTORE; the dialog is owned by the main window and is restored with it. Verified on Windows 11 with Tk 9.0.4.

User Comments: jan.nijtmans added on 2026-09-15 15:15:03:

I'm glad I can be of some help here ;-)

Merged to [b86736bbf7d63932|trunk], core-9-0-branch and core-8-6-branch

Many thanks to all!


oehhar added on 2026-09-15 05:08:32:

Thanks Csaba, If CI is clean, this may be merged. My own CI run had 0 failures.

I am on travel, back on Thursday. If nobody will merge before, I will merge on Friday.

Thanks for all, Harald


nemethi (claiming to be Csaba Nemethi) added on 2026-09-14 17:14:03:

I have applied the patch to tkWinWm.c in the main branch (i.e., trunk) and tested successfully that it works as expected.

BTW: I have also verified that Win+d and Win+m minimize the windows without making use of WM_SYSCOMMAND and SC_MINIMIZE, as correctly stated by Serhiy.


oehhar added on 2026-09-14 09:49:20:

Here is my test script from a fresh wish start typed in the console:

pack [button .b -text nofocus -command "puts nofocus"]
toplevel .t
pack [button .t.t -text close -command "destroy .t"]
grab .t.t

Patch rebased to main by commit [73e29b0c] in new branch [ed6c3a78-win-grab-restore-main].

What I observe with the test script compared to 9.0.4 release:

  • With 9.0.4, the parent Window gets totally unresponsive after a Win+D on 9.0.4. It can not be restored by Alt-Tab or the task bar icon. This changed with the patch and is IMHO an improvement.

Otherwise, the grab survives a Win+D. Pressing the "nofocus" button has no effect and the close-button gets a visual feedback, if the t child window is visible (e.g. not minimized in the taskbar). This is already the case with 9.0.4.

So, for me, this is an improvement.

I will start CI.

I would love to have another opinion if possible (Csaba?). This is a critical field, sorry. And there are so many cases.

Merge in one week or other positive feedback (if CI clean).

Thanks for all, Harald


oehhar added on 2026-09-14 08:17:27:

Serhi,

thanks for the patch of this very long standing annoyance. Highly appreciated.

I personally can imagine that there might be side effects of the patch. In addition, it is not testable.

Please give me one week to test. Then, I will merge to main.

Thanks again, Harald


oehhar added on 2024-06-24 20:02:12:

Dear Storchaka,

I can only say, that the issue is known. There are other situation where a grab is removed by Windows actions. Grab never worked reliable on Windows.

Any patches welcome!

Take care, Harald