From da740e099480cf76f6be22259dc599878d92f50b Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 15 Jan 2008 22:18:18 +0100 Subject: [PATCH 1/1] shrink game window to fit on screen if necessary --- res/whead.tcl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/res/whead.tcl b/res/whead.tcl index a46bb92..1255d5b 100644 --- a/res/whead.tcl +++ b/res/whead.tcl @@ -80,8 +80,17 @@ set visual [winfo screenvisual $win] set depth [winfo screendepth $win] set screenwidth [winfo screenwidth $win] set screenheight [winfo screenheight $win] -#set screenwidth 1200 -#set screenheight 900 +set initialwidth 1200 +set initialheight 900 + +if {$screenwidth < $initialwidth} { + set initialwidth $screenwidth +} + +if {$screenheight < $initialheight} { + set initialheight $screenheight +} + if {!(("$visual" == "pseudocolor") || ("$visual" == "truecolor") || @@ -116,7 +125,7 @@ bind $win {tk_traverseToMenu %W %A} wm title $win "Micropolis Controls" wm iconname $win {Micropolis Controls} -wm geometry $win 1200x900+0+0 +wm geometry $win ${initialwidth}x${initialheight}+0+0 #wm positionfrom $win user wm withdraw $win wm maxsize $win $screenwidth $screenheight -- 2.39.2