@matheusbsbs / matheus-bagliano / commits / 2810a58dba
Fork 0

git-gui: fix size and position of window panes on startup

The themed panedwindow needs to have the sash position set after the widget has been mapped therefore apply this setting in the Map event binding. To avoid visible redraws as the application is constructed the main window should be withdrawn until all the widgets have been added Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Pat Thoyts committed Aug 2, 2010 at 13:42 UTC 2810a58dba6d06f4d1816fb06500c117feebd830
1 file changed +37 -18
git-gui.sh
+37 -18
@@ -334,6 +334,8 @@ proc _trace_exec {cmd} {
334 puts stderr $d
335 }
336
337 +#'" fix poor old emacs font-lock mode
338 +
339 proc _git_cmd {name} {
340 global _git_cmd_path
341
@@ -648,6 +650,7 @@ proc rmsel_tag {text} {
650 return $text
651 }
652
653 +wm withdraw .
654 set root_exists 0
655 bind . <Visibility> {
656 bind . <Visibility> {}
@@ -2919,6 +2922,7 @@ blame {
2922 set current_branch $head
2923 }
2924
2925 + wm deiconify .
2926 switch -- $subcommand {
2927 browser {
2928 if {$jump_spec ne {}} usage
@@ -3492,29 +3496,44 @@ $main_status show [mc "Initializing..."]
3496
3497 # -- Load geometry
3498 #
3495 -catch {
3496 -set gm $repo_config(gui.geometry)
3497 -wm geometry . [lindex $gm 0]
3498 -if {$use_ttk} {
3499 - .vpane sashpos 0 [lindex $gm 1]
3500 - .vpane.files sashpos 0 [lindex $gm 2]
3501 -} else {
3502 - .vpane sash place 0 \
3503 - [lindex $gm 1] \
3504 - [lindex [.vpane sash coord 0] 1]
3505 - .vpane.files sash place 0 \
3506 - [lindex [.vpane.files sash coord 0] 0] \
3507 - [lindex $gm 2]
3499 +proc on_ttk_pane_mapped {w pane pos} {
3500 + bind $w <Map> {}
3501 + after 0 [list after idle [list $w sashpos $pane $pos]]
3502 +}
3503 +proc on_tk_pane_mapped {w pane x y} {
3504 + bind $w <Map> {}
3505 + after 0 [list after idle [list $w sash place $pane $x $y]]
3506 +}
3507 +proc on_application_mapped {} {
3508 + global repo_config use_ttk
3509 + bind . <Map> {}
3510 + set gm $repo_config(gui.geometry)
3511 + if {$use_ttk} {
3512 + bind .vpane <Map> \
3513 + [list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
3514 + bind .vpane.files <Map> \
3515 + [list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
3516 + } else {
3517 + bind .vpane <Map> \
3518 + [list on_tk_pane_mapped %W 0 \
3519 + [lindex $gm 1] \
3520 + [lindex [.vpane sash coord 0] 1]]
3521 + bind .vpane.files <Map> \
3522 + [list on_tk_pane_mapped %W 0 \
3523 + [lindex [.vpane.files sash coord 0] 0] \
3524 + [lindex $gm 2]]
3525 + }
3526 + wm geometry . [lindex $gm 0]
3527 }
3509 -unset gm
3528 +if {[info exists repo_config(gui.geometry)]} {
3529 + bind . <Map> [list on_application_mapped]
3530 + wm geometry . [lindex $repo_config(gui.geometry) 0]
3531 }
3532
3533 # -- Load window state
3534 #
3514 -catch {
3515 -set gws $repo_config(gui.wmstate)
3516 -wm state . $gws
3517 -unset gws
3535 +if {[info exists repo_config(gui.wmstate)]} {
3536 + catch {wm state . $repo_config(gui.wmstate)}
3537 }
3538
3539 # -- Key Bindings