Patchwork [4,of,9] hgk: fix pop-up windows

login
register
mail settings
Submitter Andrew Shadura
Date March 10, 2013, 4:24 p.m.
Message ID <c9806449456004b3f3e0.1362932685@localhost.localdomain>
Download mbox | patch
Permalink /patch/1103/
State Accepted
Commit 870505ec3e56b2779bede780fa92f876c18da629
Headers show

Comments

Andrew Shadura - March 10, 2013, 4:24 p.m.
# HG changeset patch
# User Andrew Shadura <bugzilla@tut.by>
# Date 1350394316 -7200
# Node ID c9806449456004b3f3e0e395dc8d98881bee6fe7
# Parent  2e31d3c5d8f7912ce2e1e68848bb39bae9564aba
hgk: fix pop-up windows

Create pop-up windows properly so they go to the floating layer in
tiling window managers.

Patch

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -139,6 +139,18 @@  proc gitdir {} {
     }
 }
 
+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 @@  proc error_popup msg {
     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 @@  Use and redistribute under the terms of 
     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 @@  proc mkpatch {} {
     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 @@  proc mktag {} {
     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 @@  proc writecommit {} {
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
     grid $top.buts - -pady 10 -sticky ew
     focus $top.fname
+    popupify $top
 }
 
 proc wrcomgo {} {