Tk Source Code

View Ticket
Login
Ticket UUID: e02aac5cab6a9a1c8f6a27582ec21dd356ee601b
Title: Grab documentation does not have caveats for windows & mac
Type: Bug Version: trunk
Submitter: oehhar Created on: 2017-02-20 08:06:47
Subsystem: 56. [grab] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2019-01-09 13:40:17
Resolution: None Closed By: nobody
    Closed on:
Description: (text/x-fossil-wiki)
Grab does not work as described when running under windows 7 x64. In response to my question about grab on comp.lang.tcl, it was stated that it also would not work as described on mac's either. 

Exactly how grab works on windows & macs should be described in the man page for grab.

This was the TCL ticket here [http://core.tcl.tk/tcl/info/4915cf6c4f704430].

The discussion on comp.lang.tcl that originally prompted this ticket is [https://groups.google.com/d/msg/comp.lang.tcl/jRF7NwcURp4/J_lme2tYAQAJ]
User Comments: marc_culler (claiming to be Marc Culler) added on 2019-01-09 13:40:17: (text/x-fossil-wiki)
As of commit [https://core.tcl.tk/tk/info/1edd8b7a16389263|1edd8b7a] the
documentation now describes the behavior on macs.

fvogel added on 2019-01-05 18:31:39: (text/x-fossil-wiki)
X-referencing to [b94c17d280].

cjmcdonald added on 2018-07-10 10:08:34: (text/x-fossil-wiki)
There is another difference in grab behaviour on Windows.  The grab command was changed there so that if one toplevel window in an application has a (non-global) grab then it is not possible to deiconify or raise another toplevel window from the same application in front of it.

I think that the change was ill-advised.  It's caused more problems than it solved; it's introduced an unexpected and unsafe linkage between the grab state and toplevel deiconify and raise; and it's increased inconsistency in behaviour between Windows & Unix.  See tickets [2896605], [3414089], [3009450].  However, if we're stuck with this behaviour on Windows then at least it should be documented in the grab page.

fvogel added on 2018-07-09 20:37:30: (text/x-fossil-wiki)
From what I gather in [https://groups.google.com/d/msg/comp.lang.tcl/jRF7NwcURp4/J_lme2tYAQAJ|that c.l.t. discussion]:

  - global grabs never work on Windows and macOS. grab will force focus on the requested window within the Tk application but has no effect on other windows

  - global grabs may not work on Linux either since the wm or desktop preferences can reject it

Moreover, what I see in the test suite output on macOS is that requests for local grabs are always transformed into global grabs on this platorm, which can rather easily be seen [https://core.tcl.tk/tk/artifact/309e74311e0c3368?ln=429,433|in the source code].

For the records, here is the output when exercising grab.test with current core-8-6-branch on macOS (the failures are all due to the local --> global silent switch in the source code):

<verbatim>
==== grab-2.2 Tk_GrabObjCmd, grab status gives correct status FAILED
==== Contents of test case:

    set curr [grab current .]
    if { [string length $curr] > 0 } {
	grab release $curr
    }
    grab .
    grab status .

---- Result was:
global
---- Result should have been (exact matching):
local
==== grab-2.2 FAILED



==== grab-4.1 Tk_GrabObjCmd, grab release releases grab FAILED
==== Contents of test case:

    set curr [grab current .]
    if { [string length $curr] > 0 } {
	grab release $curr
    }
    grab .
    set result [grab status .]
    grab release .
    lappend result [grab status .]
    grab -global .
    lappend result [grab status .]
    grab release .
    lappend result [grab status .]

---- Result was:
global none global none
---- Result should have been (exact matching):
local none global none
==== grab-4.1 FAILED



==== grab-5.1 Tk_GrabObjCmd, grab set FAILED
==== Contents of test case:

    set curr [grab current .]
    if { [string length $curr] > 0 } {
	grab release $curr
    }
    grab set .
    list [grab current .] [grab status .]

---- Result was:
. global
---- Result should have been (exact matching):
. local
==== grab-5.1 FAILED
</verbatim>