From fda146bdaef5881c2711220d37102ef2eb459741 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sat, 25 Feb 2012 21:27:30 -0500
Subject: [PATCH] added automatic refocusing of parent when closing a window

---
 src/pd.tk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/pd.tk b/src/pd.tk
index 2c88b0f7d..1cd202b64 100644
--- a/src/pd.tk
+++ b/src/pd.tk
@@ -1572,10 +1572,13 @@ proc menu_close {name} {
 	if {$name == ".texteditor.text"} { 
 		set topname [string trimright $name .text]
 		texteditor_send $name
-		destroy $topname   
+		destroy $topname
+		focus . 
 	} else {
+		set parent [menu_windowparent $name]
 		pdtk_canvas_checkgeometry $name
     	pd [concat $name menuclose 0 \;]
+		focus $parent
 	}
 }
 
-- 
GitLab