From 31f6b36e6e188b6b5c7a5007b15b99100b597bab Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Apr 2012 22:23:17 +0000 Subject: Fix bug 533519 --- library/bgerror.tcl | 5 +++-- library/choosedir.tcl | 2 +- library/clrpick.tcl | 2 +- library/dialog.tcl | 22 ++-------------------- library/msgbox.tcl | 2 +- library/tk.tcl | 20 ++++++++------------ library/tkfbox.tcl | 2 +- win/tkWinWm.c | 17 ++++------------- 8 files changed, 21 insertions(+), 51 deletions(-) diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 4ecabd8..06c72a1 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -242,8 +242,9 @@ proc ::tk::dialog::error::bgerror err { bind .bgerrorDialog [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. + # 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 diff --git a/library/choosedir.tcl b/library/choosedir.tcl index b9c2aa8..0fd3f01 100644 --- a/library/choosedir.tcl +++ b/library/choosedir.tcl @@ -79,7 +79,7 @@ proc ::tk::dialog::file::chooseDir:: {args} { # 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. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/library/clrpick.tcl b/library/clrpick.tcl index cfbfb4f..02793cc 100644 --- a/library/clrpick.tcl +++ b/library/clrpick.tcl @@ -89,7 +89,7 @@ proc ::tk::dialog::color:: {args} { # 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. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/library/dialog.tcl b/library/dialog.tcl index 04acb3b..1ec578e 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -152,27 +152,9 @@ proc ::tk_dialog {w title text bitmap default args} { # 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 + # display (Motif style) and de-iconify it. + ::tk::PlaceWindow $w tkwait visibility $w # 7. Set a grab and claim the focus too. diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 2a22d54..e5a363d 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -406,7 +406,7 @@ proc ::tk::MessageBox {args} { # 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. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) diff --git a/library/tk.tcl b/library/tk.tcl index b9c3872..1935bbc 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -106,20 +106,16 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} { 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 {$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 < 0} { - set y 0 - } elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} { - set y [expr {[winfo screenheight $w]-[winfo reqheight $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. diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index b778bd0..bf6cf87 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -869,7 +869,7 @@ proc ::tk::dialog::file:: {type args} { # 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. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 2097938..59287c8 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -5994,19 +5994,10 @@ Tk_GetVRootGeometry(tkwin, xPtr, yPtr, widthPtr, heightPtr) * here. */ int *widthPtr, *heightPtr; /* Store dimensions of virtual root here. */ { - TkWindow *winPtr = (TkWindow *) tkwin; - - /* - * XXX: This is not correct for multiple monitors. There may be many - * changes required to get this right, and it may effect existing - * applications that don't consider possible <0 vroot. See - * http://msdn.microsoft.com/library/en-us/gdi/monitor_3lrn.asp - * for more info. - */ - *xPtr = 0; - *yPtr = 0; - *widthPtr = DisplayWidth(winPtr->display, winPtr->screenNum); - *heightPtr = DisplayHeight(winPtr->display, winPtr->screenNum); + *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); + *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); + *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); + *heightPtr = GetSystemMetrics(SM_CYVIRTUALSCREEN); } /* -- cgit v0.12 From f4876885b53d6ed34fb1c3577e0c2d238a871953 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Apr 2012 22:26:50 +0000 Subject: set [wm maxsize] as well --- library/tk.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/library/tk.tcl b/library/tk.tcl index 1935bbc..57525f1 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -122,6 +122,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} { if {$y < 22} { set y 22 } } } + wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w] wm geometry $w +$x+$y wm deiconify $w } -- cgit v0.12