From 5179bcd06ae08a0146804808156305fb2e0aa32a Mon Sep 17 00:00:00 2001 From: "nijtmans@users.sourceforge.net" Date: Sun, 10 Jun 2012 14:47:24 +0000 Subject: [Bug 3534137]: $tcl_platform(platform) != [tk windowingsystem] --- ChangeLog | 5 +++++ library/bgerror.tcl | 10 +++++----- library/button.tcl | 4 ++-- library/entry.tcl | 4 ++-- library/menu.tcl | 2 +- library/scale.tcl | 2 +- library/spinbox.tcl | 2 +- library/text.tcl | 6 +++--- library/tk.tcl | 4 ++-- 9 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index b119d67..5ed87a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-10 Jan Nijtmans + + * library/*.tcl: [Bug 3534137]: $tcl_platform(platform) != + [tk windowingsystem] + 2012-06-08 Jan Nijtmans * generic/tkMain.c: Implement TkCygwinMainEx for loading diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 06c72a1..3372115 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -94,7 +94,7 @@ proc ::tk::dialog::error::bgerror err { # we use the default dialog then : set windowingsystem [tk windowingsystem] - if {($tcl_platform(platform) eq "macintosh") + if {($windowingsystem eq "classic") || ($windowingsystem eq "aqua")} { set ok [mc Ok] set messageFont system @@ -143,7 +143,7 @@ proc ::tk::dialog::error::bgerror err { wm iconname .bgerrorDialog ErrorDialog wm protocol .bgerrorDialog WM_DELETE_WINDOW { } - if {($tcl_platform(platform) eq "macintosh") + if {($windowingsystem eq "classic") || ($windowingsystem eq "aqua")} { ::tk::unsupported::MacWindowStyle style .bgerrorDialog moveableAlert {} } elseif {$windowingsystem eq "x11"} { @@ -190,7 +190,7 @@ proc ::tk::dialog::error::bgerror err { set wrapwidth [expr {$wrapwidth-60-[winfo pixels .bgerrorDialog 9m]}] label .bgerrorDialog.msg -justify left -text $text -font $messageFont \ -wraplength $wrapwidth - if {($tcl_platform(platform) eq "macintosh") + if {($windowingsystem eq "classic") || ($windowingsystem eq "aqua")} { # On the Macintosh, use the stop bitmap label .bgerrorDialog.bitmap -bitmap stop @@ -226,7 +226,7 @@ proc ::tk::dialog::error::bgerror err { -padx 10 grid columnconfigure .bgerrorDialog.bot $i -weight 1 # We boost the size of some Mac buttons for l&f - if {($tcl_platform(platform) eq "macintosh") + if {($windowingsystem eq "classic") || ($windowingsystem eq "aqua")} { if {($name eq "ok") || ($name eq "dismiss")} { grid columnconfigure .bgerrorDialog.bot $i -minsize 90 @@ -251,7 +251,7 @@ proc ::tk::dialog::error::bgerror err { # 7. Ensure that we are topmost. raise .bgerrorDialog - if {$tcl_platform(platform) eq "windows"} { + if {[tk windowingsystem] eq "win32"} { # Place it topmost if we aren't at the top of the stacking # order to ensure that it's seen if {[lindex [wm stackorder .] end] ne ".bgerrorDialog"} { diff --git a/library/button.tcl b/library/button.tcl index 0da95f0..195566e 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -36,7 +36,7 @@ if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} { tk::ButtonUp %W } } -if {"windows" eq $tcl_platform(platform)} { +if {"win32" eq [tk windowingsystem]} { bind Checkbutton { tk::CheckRadioInvoke %W select } @@ -125,7 +125,7 @@ bind Radiobutton { tk::ButtonLeave %W } -if {"windows" eq $tcl_platform(platform)} { +if {"win32" eq [tk windowingsystem]} { ######################### # Windows implementation diff --git a/library/entry.tcl b/library/entry.tcl index bfbaccf..93812b7 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -209,7 +209,7 @@ if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} { # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <> event, so we don't need to do anything here. -if {$tcl_platform(platform) ne "windows"} { +if {[tk windowingsystem] ne "win32"} { bind Entry { catch {tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]} } @@ -561,7 +561,7 @@ proc ::tk::EntryTranspose w { # w - The entry window in which the cursor is to move. # start - Position at which to start search. -if {$tcl_platform(platform) eq "windows"} { +if {[tk windowingsystem] eq "win32"} { proc ::tk::EntryNextWord {w start} { set pos [tcl_endOfWord [$w get] [$w index $start]] if {$pos >= 0} { diff --git a/library/menu.tcl b/library/menu.tcl index 782a726..4ce0d8c 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -1189,7 +1189,7 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} { incr x [expr {-[winfo reqwidth $menu]/2}] } - if {$tcl_platform(platform) eq "windows"} { + if {[tk windowingsystem] eq "win32"} { # osVersion is not available in safe interps set ver 5 if {[info exists tcl_platform(osVersion)]} { diff --git a/library/scale.tcl b/library/scale.tcl index 41fd720..d5de754 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -60,7 +60,7 @@ bind Scale { tk::ScaleEndDrag %W tk::ScaleActivate %W %x %y } -if {$tcl_platform(platform) eq "windows"} { +if {[tk windowingsystem] eq "win32"} { # On Windows do the same with button 3, as that is the right mouse button bind Scale <3> [bind Scale <2>] bind Scale [bind Scale ] diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 933c25c..9b63e09 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -217,7 +217,7 @@ if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} { # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <> event, so we don't need to do anything here. -if {$tcl_platform(platform) ne "windows"} { +if {[tk windowingsystem] ne "win32"} { bind Spinbox { catch {::tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]} } diff --git a/library/text.tcl b/library/text.tcl index 3f608f3..3b32991 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -345,7 +345,7 @@ bind Text <> { catch { %W edit redo } } -if {$tcl_platform(platform) ne "windows"} { +if {[tk windowingsystem] ne "win32"} { bind Text { if {!$tk_strictMotif} { tk::TextScrollPages %W 1 @@ -530,7 +530,7 @@ proc ::tk::TextButton1 {w x y} { $w mark set anchor insert # Allow focus in any case on Windows, because that will let the # selection be displayed even for state disabled text widgets. - if {$::tcl_platform(platform) eq "windows" || [$w cget -state] eq "normal"} {focus $w} + if {[tk windowingsystem] eq "win32" || [$w cget -state] eq "normal"} {focus $w} if {[$w cget -autoseparators]} {$w edit separator} } @@ -1040,7 +1040,7 @@ proc ::tk_textPaste w { # w - The text window in which the cursor is to move. # start - Position at which to start search. -if {$tcl_platform(platform) eq "windows"} { +if {[tk windowingsystem] eq "win32"} { proc ::tk::TextNextWord {w start} { TextNextPos $w [TextNextPos $w $start tcl_endOfWord] \ tcl_startOfNextWord diff --git a/library/tk.tcl b/library/tk.tcl index 57525f1..a09cd9c 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -199,7 +199,7 @@ proc ::tk::RestoreFocusGrab {grab focus {destroy destroy}} { # Results: # Returns the selection, or an error if none could be found # -if {$tcl_platform(platform) eq "unix"} { +if {[tk windowingsystem] ne "win32"} { proc ::tk::GetSelection {w {sel PRIMARY}} { if {[catch {selection get -displayof $w -selection $sel \ -type UTF8_STRING} txt] \ @@ -405,7 +405,7 @@ switch [tk windowingsystem] { # ---------------------------------------------------------------------- if {$::tk_library ne ""} { - if {$tcl_platform(platform) eq "macintosh"} { + if {[tk windowingsystem] eq "classic"} { proc ::tk::SourceLibFile {file} { if {[catch { namespace eval :: \ -- cgit v0.12