comparison contrib/hgk @ 18804:870505ec3e56

hgk: fix pop-up windows Create pop-up windows properly so they go to the floating layer in tiling window managers.
author Andrew Shadura <bugzilla@tut.by>
date Tue, 16 Oct 2012 15:31:56 +0200
parents 82289176717d
children 6a0578d07024
comparison
equal deleted inserted replaced
18803:82289176717d 18804:870505ec3e56
135 if {[info exists env(GIT_DIR)]} { 135 if {[info exists env(GIT_DIR)]} {
136 return $env(GIT_DIR) 136 return $env(GIT_DIR)
137 } else { 137 } else {
138 return ".hg" 138 return ".hg"
139 } 139 }
140 }
141
142 proc popupify {w} {
143 wm resizable $w 0 0
144 wm withdraw $w
145 update
146 set x [expr {([winfo screenwidth .]-[winfo reqwidth $w])/2}]
147 set y [expr {([winfo screenheight .]-[winfo reqheight $w])/2}]
148 wm geometry $w +$x+$y
149 wm transient $w .
150 wm deiconify $w
151 wm resizable $w 1 1
140 } 152 }
141 153
142 proc getcommits {rargs} { 154 proc getcommits {rargs} {
143 global commits commfd phase canv mainfont env 155 global commits commfd phase canv mainfont env
144 global startmsecs nextupdate ncmupdate 156 global startmsecs nextupdate ncmupdate
527 message $w.m -text $msg -justify center -aspect 400 539 message $w.m -text $msg -justify center -aspect 400
528 pack $w.m -side top -fill x -padx 20 -pady 20 540 pack $w.m -side top -fill x -padx 20 -pady 20
529 ttk::button $w.ok -text OK -command "destroy $w" 541 ttk::button $w.ok -text OK -command "destroy $w"
530 pack $w.ok -side bottom -fill x 542 pack $w.ok -side bottom -fill x
531 bind $w <Visibility> "grab $w; focus $w" 543 bind $w <Visibility> "grab $w; focus $w"
544 popupify $w
532 tkwait window $w 545 tkwait window $w
533 } 546 }
534 547
535 proc makewindow {} { 548 proc makewindow {} {
536 global canv canv2 canv3 linespc charspc ctext cflist textfont 549 global canv canv2 canv3 linespc charspc ctext cflist textfont
947 Use and redistribute under the terms of the GNU General Public License} \ 960 Use and redistribute under the terms of the GNU General Public License} \
948 -justify center -aspect 400 961 -justify center -aspect 400
949 pack $w.m -side top -fill x -padx 20 -pady 20 962 pack $w.m -side top -fill x -padx 20 -pady 20
950 ttk::button $w.ok -text Close -command "destroy $w" 963 ttk::button $w.ok -text Close -command "destroy $w"
951 pack $w.ok -side bottom 964 pack $w.ok -side bottom
965 popupify $w
952 } 966 }
953 967
954 set aunextcolor 0 968 set aunextcolor 0
955 proc assignauthorcolor {name} { 969 proc assignauthorcolor {name} {
956 global authorcolors aucolormap aunextcolor 970 global authorcolors aucolormap aunextcolor
3753 grid $top.buts.gen $top.buts.can 3767 grid $top.buts.gen $top.buts.can
3754 grid columnconfigure $top.buts 0 -weight 1 -uniform a 3768 grid columnconfigure $top.buts 0 -weight 1 -uniform a
3755 grid columnconfigure $top.buts 1 -weight 1 -uniform a 3769 grid columnconfigure $top.buts 1 -weight 1 -uniform a
3756 grid $top.buts - -pady 10 -sticky ew 3770 grid $top.buts - -pady 10 -sticky ew
3757 focus $top.fname 3771 focus $top.fname
3772 popupify $top
3758 } 3773 }
3759 3774
3760 proc mkpatchrev {} { 3775 proc mkpatchrev {} {
3761 global patchtop 3776 global patchtop
3762 3777
3820 grid $top.buts.gen $top.buts.can 3835 grid $top.buts.gen $top.buts.can
3821 grid columnconfigure $top.buts 0 -weight 1 -uniform a 3836 grid columnconfigure $top.buts 0 -weight 1 -uniform a
3822 grid columnconfigure $top.buts 1 -weight 1 -uniform a 3837 grid columnconfigure $top.buts 1 -weight 1 -uniform a
3823 grid $top.buts - -pady 10 -sticky ew 3838 grid $top.buts - -pady 10 -sticky ew
3824 focus $top.tag 3839 focus $top.tag
3840 popupify $top
3825 } 3841 }
3826 3842
3827 proc domktag {} { 3843 proc domktag {} {
3828 global mktagtop env tagids idtags 3844 global mktagtop env tagids idtags
3829 3845
3904 grid $top.buts.gen $top.buts.can 3920 grid $top.buts.gen $top.buts.can
3905 grid columnconfigure $top.buts 0 -weight 1 -uniform a 3921 grid columnconfigure $top.buts 0 -weight 1 -uniform a
3906 grid columnconfigure $top.buts 1 -weight 1 -uniform a 3922 grid columnconfigure $top.buts 1 -weight 1 -uniform a
3907 grid $top.buts - -pady 10 -sticky ew 3923 grid $top.buts - -pady 10 -sticky ew
3908 focus $top.fname 3924 focus $top.fname
3925 popupify $top
3909 } 3926 }
3910 3927
3911 proc wrcomgo {} { 3928 proc wrcomgo {} {
3912 global wrcomtop 3929 global wrcomtop
3913 3930