Tk Source Code

View Ticket
Login
2019-05-15
17:25 Ticket [d1989fb7] Aqua: Empty window appears after `package require Tk` status still Open with 4 other changes artifact: 434e1882 user: marc_culler
2019-02-23
04:10
Fix bug [56a1823c73]: Aqua toplevels can fail to appear on screen. check-in: a3d50fdc user: culler tags: trunk
02:30
Fix bug [56a1823c73]: Aqua toplevels can fail to appear on screen. check-in: 5e709226 user: culler tags: core-8-6-branch
02:16 Closed ticket [56a1823c]: In Aqua, tk_GetOpenFile causes toplevels to open off screen plus 8 other changes artifact: 869a4ea9 user: marc_culler
2019-02-18
18:53 Ticket [56a1823c]: 4 changes artifact: 6a9d312f user: marc_culler
18:48
Fix bug [56a1823c73]: Aqua toplevels can fail to appear on screen. Closed-Leaf check-in: 60edb6d4 user: culler tags: bug-56a1823c73
2019-02-17
04:10 New ticket [56a1823c] In Aqua, tk_GetOpenFile causes toplevels to open off screen. artifact: 2f6d1b4b user: marc_culler

Ticket UUID: 56a1823c73d45b29c2b7e7fdde85012a1495b17
Title: In Aqua, tk_GetOpenFile causes toplevels to open off screen
Type: Bug Version: 8.6.9
Submitter: marc_culler Created on: 2019-02-17 04:10:32
Subsystem: 37. [tk_get*File] Assigned To: marc_culler
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2019-02-23 02:16:27
Resolution: Fixed Closed By: marc_culler
    Closed on: 2019-02-23 02:16:27
Description:

In Aqua, running this script in Wish causes a toplevel to appear containing the text "this is a filename":

wm iconify .
set filename "this is a filename"
toplevel .t -width 80 -height 100 
text .t.text
pack .t.text
.t.text insert end $filename

Running the following script opens a file dialog, but when the dialog is dismissed no toplevel appears. Clicking the feather icon in the dock makes a toplevel appear, containing the pathname of the selected file:

wm iconify .
set filename [tk_getOpenFile]
toplevel .t -width 80 -height 100 
text .t.text
pack .t.text
.t.text insert end $filename

Adding these three lines makes an empty toplevel appear:

update
wm iconify .t
wm deiconify .t

Adding an additional focus command makes the pathname appear in the window:

focus .t.text

None of those additional lines should be necessary. It seems that when the filedialog is closed the NSApplication is left for some time in a state where any new NSWindows that are created are opened off screen. Testing indicates that [NSWindow isVisible] returns YES even though the window is not visible.

User Comments: marc_culler (claiming to be Marc Culler) added on 2019-02-23 02:16:27:
Thanks to Kevin Walzer for reviewing these changes!  We agree that the
bugs are fixed and neither of us were able to produce any crashes or
regressions related to the fix.  Also, there are no changes in the regression
test results. So I will merge the fix and close this ticket.

marc_culler (claiming to be Marc Culler) added on 2019-02-18 18:53:49:

I also noticed that if the root window is withdrawn rather than iconified a dead window with black background appears on the screen after the root disappears.

Both of these problems are fixed in check-in 60edb6d4 by processing all pending events in XMapWindow and in the NSApplication method applicationDidFinishLaunching.