Tk Source Code

Check-in [53c95a25]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow. Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 53c95a25edfe3f718d6b4c99e6f32e372433c5b5
User & Date: jan.nijtmans 2012-04-20 12:16:36
Context
2012-04-22
22:03
[Bug 3520202]: %K must not work with <MouseWheel> or effects are undefined! check-in: 09655b04 user: dkf tags: core-8-4-branch
2012-04-20
12:50
fix (hopefully) menu posting in the same way as window placement check-in: b1dda72b user: jan.nijtmans tags: bug-533519
12:23
Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow. Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there. check-in: 9fc800bf user: jan.nijtmans tags: core-8-5-branch
12:16
Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow. Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there. check-in: 53c95a25 user: jan.nijtmans tags: core-8-4-branch
2012-04-18
18:08
make some more internal tables CONST check-in: aa726163 user: jan.nijtmans tags: core-8-4-branch
2012-04-16
22:26
set [wm maxsize] as well check-in: d6d2ddb5 user: jan.nijtmans tags: bug-533519
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.









1
2
3
4
5
6
7








2012-04-13  Jan Nijtmans  <[email protected]>

	* win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
	__strtoi64)

2012-04-07  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2012-04-20  Jan Nijtmans  <[email protected]>

	* generic/tk.tcl: Use vroot size in stead of screen size for
	clipping window coordinates in ::tk::PlaceWindow.
	* generic/dialog.tcl: Use ::tk::PlaceWindow in dialog.tcl, in
	stead of dumplicating the code there.
	(harmless part of [Bug 533519])

2012-04-13  Jan Nijtmans  <[email protected]>

	* win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
	__strtoi64)

2012-04-07  Jan Nijtmans  <[email protected]>

Changes to library/bgerror.tcl.

238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
    # The "OK" button is the default for this dialog.
    .bgerrorDialog.ok configure -default active

    bind .bgerrorDialog <Return>	[namespace code Return]
    bind .bgerrorDialog <Destroy>	[namespace code [list Destroy %W]]
    .bgerrorDialog.function configure -command [namespace code Details]

    # 6. Update all the geometry information so we know how big it wants
    # to be, then center the window in the display and deiconify it.


    ::tk::PlaceWindow .bgerrorDialog

    # 7. Ensure that we are topmost.

    raise .bgerrorDialog
    if {$tcl_platform(platform) eq "windows"} {







|
|
>







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
    # The "OK" button is the default for this dialog.
    .bgerrorDialog.ok configure -default active

    bind .bgerrorDialog <Return>	[namespace code Return]
    bind .bgerrorDialog <Destroy>	[namespace code [list Destroy %W]]
    .bgerrorDialog.function configure -command [namespace code Details]

    # 6. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.

    ::tk::PlaceWindow .bgerrorDialog

    # 7. Ensure that we are topmost.

    raise .bgerrorDialog
    if {$tcl_platform(platform) eq "windows"} {

Changes to library/choosedir.tcl.

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

    set data(filter) "*"
    set data(previousEntryText) ""
    ::tk::dialog::file::UpdateWhenIdle $w

    # Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(ent)







|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

    set data(filter) "*"
    set data(previousEntryText) ""
    ::tk::dialog::file::UpdateWhenIdle $w

    # Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(ent)

Changes to library/clrpick.tcl.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

    if {[winfo viewable [winfo toplevel $data(-parent)]] } {
	wm transient $w $data(-parent)
    }

    # 5. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # 6. Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(okBtn)







|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

    if {[winfo viewable [winfo toplevel $data(-parent)]] } {
	wm transient $w $data(-parent)
    }

    # 5. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # 6. Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(okBtn)

Changes to library/dialog.tcl.

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    # button variable to -1;  this is needed in case something happens
    # that destroys the window, such as its parent window being destroyed.

    bind $w <Destroy> {set ::tk::Priv(button) -1}

    # 6. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display and de-iconify it.

    wm withdraw $w
    update idletasks
    set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
	    - [winfo vrootx [winfo parent $w]]}]
    set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
	    - [winfo vrooty [winfo parent $w]]}]
    # Make sure that the window is on the screen and set the maximum
    # size of the window is the size of the screen.  That'll let things
    # fail fairly gracefully when very large messages are used. [Bug 827535]
    if {$x < 0} {
	set x 0
    }
    if {$y < 0} {
	set y 0
    }
    wm maxsize $w [winfo screenwidth $w] [winfo screenheight $w]
    wm geometry $w +$x+$y
    wm deiconify $w

    tkwait visibility $w

    # 7. Set a grab and claim the focus too.

    set oldFocus [focus]
    set oldGrab [grab current $w]
    if {$oldGrab ne ""} {







|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|







148
149
150
151
152
153
154
155
156


















157
158
159
160
161
162
163
164
    # button variable to -1;  this is needed in case something happens
    # that destroys the window, such as its parent window being destroyed.

    bind $w <Destroy> {set ::tk::Priv(button) -1}

    # 6. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.



















    ::tk::PlaceWindow $w 
    tkwait visibility $w

    # 7. Set a grab and claim the focus too.

    set oldFocus [focus]
    set oldGrab [grab current $w]
    if {$oldGrab ne ""} {

Changes to library/msgbox.tcl.

402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    }

    # Invoke the designated cancelling operation
    bind $w <Escape> [list $w.$cancel invoke]

    # 7. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)

    # 8. Set a grab and claim the focus too.

    if {$data(-default) ne ""} {
	set focus $w.$data(-default)







|







402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    }

    # Invoke the designated cancelling operation
    bind $w <Escape> [list $w.$cancel invoke]

    # 7. Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)

    # 8. Set a grab and claim the focus too.

    if {$data(-default) ne ""} {
	set focus $w.$data(-default)

Changes to library/tk.tcl.

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
    set windowingsystem [tk windowingsystem]

    if {$windowingsystem eq "win32"} {
        # Bug 533519: win32 multiple desktops may produce negative geometry.
        set checkBounds 0
    }
    if {$checkBounds} {
	if {$x < 0} {
	    set x 0
	} elseif {$x > ([winfo screenwidth $w]-[winfo reqwidth $w])} {
	    set x [expr {[winfo screenwidth $w]-[winfo reqwidth $w]}]
	}
	if {$y < 0} {
	    set y 0
	} elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} {
	    set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}]
	}
	if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	    # Avoid the native menu bar which sits on top of everything.
	    if {$y < 22} { set y 22 }
	}
    }

    wm geometry $w +$x+$y
    wm deiconify $w
}

# ::tk::SetFocusGrab --
#   swap out current focus and grab temporarily (for dialogs)
# Arguments:







|
|
|
|

|
|
|
|






>







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    set windowingsystem [tk windowingsystem]

    if {$windowingsystem eq "win32"} {
        # Bug 533519: win32 multiple desktops may produce negative geometry.
        set checkBounds 0
    }
    if {$checkBounds} {
	if {$x < [winfo vrootx $w]} {
	    set x [winfo vrootx $w]
	} elseif {$x > ([winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w])} {
	    set x [expr {[winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w]}]
	}
	if {$y < [winfo vrooty $w]} {
	    set y [winfo vrooty $w]
	} elseif {$y > ([winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w])} {
	    set y [expr {[winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w]}]
	}
	if {$windowingsystem eq "classic" || $windowingsystem eq "aqua"} {
	    # Avoid the native menu bar which sits on top of everything.
	    if {$y < 22} { set y 22 }
	}
    }
    wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w]
    wm geometry $w +$x+$y
    wm deiconify $w
}

# ::tk::SetFocusGrab --
#   swap out current focus and grab temporarily (for dialogs)
# Arguments:

Changes to library/tkfbox.tcl.

865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
	$data(typeMenuBtn) configure -state disabled -takefocus 0
	$data(typeMenuLab) configure -state disabled
    }
    ::tk::dialog::file::UpdateWhenIdle $w

    # Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(ent)







|







865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
	$data(typeMenuBtn) configure -state disabled -takefocus 0
	$data(typeMenuLab) configure -state disabled
    }
    ::tk::dialog::file::UpdateWhenIdle $w

    # Withdraw the window, then update all the geometry information
    # so we know how big it wants to be, then center the window in the
    # display (Motif style) and de-iconify it.

    ::tk::PlaceWindow $w widget $data(-parent)
    wm title $w $data(-title)

    # Set a grab and claim the focus too.

    ::tk::SetFocusGrab $w $data(ent)