hgk: fix pop-up windows
authorAndrew Shadura <bugzilla@tut.by>
Tue, 16 Oct 2012 15:31:56 +0200
changeset 18804 870505ec3e56
parent 18803 82289176717d
child 18805 6a0578d07024
hgk: fix pop-up windows Create pop-up windows properly so they go to the floating layer in tiling window managers.
contrib/hgk
--- a/contrib/hgk	Sun Mar 10 16:12:26 2013 +0100
+++ b/contrib/hgk	Tue Oct 16 15:31:56 2012 +0200
@@ -139,6 +139,18 @@
     }
 }
 
+proc popupify {w} {
+    wm resizable $w 0 0
+    wm withdraw $w
+    update
+    set x [expr {([winfo screenwidth .]-[winfo reqwidth $w])/2}]
+    set y [expr {([winfo screenheight .]-[winfo reqheight $w])/2}]
+    wm geometry  $w +$x+$y
+    wm transient $w .
+    wm deiconify $w
+    wm resizable $w 1 1
+}
+
 proc getcommits {rargs} {
     global commits commfd phase canv mainfont env
     global startmsecs nextupdate ncmupdate
@@ -529,6 +541,7 @@
     ttk::button $w.ok -text OK -command "destroy $w"
     pack $w.ok -side bottom -fill x
     bind $w <Visibility> "grab $w; focus $w"
+    popupify $w
     tkwait window $w
 }
 
@@ -949,6 +962,7 @@
     pack $w.m -side top -fill x -padx 20 -pady 20
     ttk::button $w.ok -text Close -command "destroy $w"
     pack $w.ok -side bottom
+    popupify $w
 }
 
 set aunextcolor 0
@@ -3755,6 +3769,7 @@
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
     grid $top.buts - -pady 10 -sticky ew
     focus $top.fname
+    popupify $top
 }
 
 proc mkpatchrev {} {
@@ -3822,6 +3837,7 @@
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
     grid $top.buts - -pady 10 -sticky ew
     focus $top.tag
+    popupify $top
 }
 
 proc domktag {} {
@@ -3906,6 +3922,7 @@
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
     grid $top.buts - -pady 10 -sticky ew
     focus $top.fname
+    popupify $top
 }
 
 proc wrcomgo {} {