[Tkabber-dev] r1272 - in trunk/tkabber: . ifacetk

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Oct 11 23:49:10 MSD 2007


Author: sergei
Date: 2007-10-11 23:49:10 +0400 (Thu, 11 Oct 2007)
New Revision: 1272

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ifacetk/iface.tcl
Log:
	* ifacetk/iface.tcl:
	  Also, cleaned up corresponding hooks.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-10-11 19:28:10 UTC (rev 1271)
+++ trunk/tkabber/ChangeLog	2007-10-11 19:49:10 UTC (rev 1272)
@@ -2,6 +2,7 @@
 
 	* ifacetk/iface.tcl: Fixed binding of <FocusIn> and <FocusOut> to chat
 	  windows/tabs (thanks to Konstantin Khomoutov).
+	  Also, cleaned up corresponding hooks.
 
 2007-10-10  Sergei Golovan  <sgolovan at nes.ru>
 

Modified: trunk/tkabber/ifacetk/iface.tcl
===================================================================
--- trunk/tkabber/ifacetk/iface.tcl	2007-10-11 19:28:10 UTC (rev 1271)
+++ trunk/tkabber/ifacetk/iface.tcl	2007-10-11 19:49:10 UTC (rev 1272)
@@ -94,7 +94,6 @@
     isource iroster.tcl
     isource systray.tcl
     
-    variable focused ""
     variable after_focused_id ""
 
     variable number_msg
@@ -1146,12 +1145,12 @@
 
 proc ifacetk::chat_window_is_active {chatid} {
     global usetabbar
-    variable focused
 
     set cw [chat::winid $chatid]
     set w [winfo toplevel $cw]
-    if {[cequal $w $focused] && \
-	    (!$usetabbar || ([cequal [.nb raise] [nbpage $cw]]))} {
+    set f [focus]
+    if {($f != "") && ($w == [winfo toplevel $f]) && \
+	    (!$usetabbar || ([.nb raise] == [nbpage $cw]))} {
 	return 1
     } else {
 	return 0
@@ -1160,7 +1159,6 @@
 
 proc ifacetk::add_number_of_messages_to_title {chatid from type body extras} {
     global usetabbar
-    variable focused
     variable number_msg
     variable personal_msg
 
@@ -1287,23 +1285,22 @@
 }
 
 proc ifacetk::get_focus {path} {
-    variable focused
-    variable after_focused_id
-    variable options
-
     if {![winfo exists $path]} return
+    hook::run got_focus_hook $path
+}
 
-    if {$focused != $path} {
-	if {$after_focused_id != ""} {
-	    after cancel $after_focused_id
-	}
-	set after_focused_id \
-	    [after $options(update_title_delay) [list [namespace current]::set_title $path]]
-	set focused $path
+proc ifacetk::on_focus_got {path} {
+    variable options
+    variable after_focused_id
 
-	hook::run got_focus_hook $path
+    if {$after_focused_id != ""} {
+	after cancel $after_focused_id
     }
+    set after_focused_id \
+	[after $options(update_title_delay) \
+	       [list [namespace current]::set_title $path]]
 }
+hook::add got_focus_hook [namespace current]::ifacetk::on_focus_got
 
 proc ifacetk::set_title {path} {
     global usetabbar
@@ -1328,20 +1325,20 @@
 }
 
 proc ifacetk::loose_focus {path} {
-    variable focused
-    variable after_focused_id
-
     if {![winfo exists $path]} return
+    hook::run lost_focus_hook $path
+}
 
-    if {($focused == $path) && ($after_focused_id != "")} {
+proc ifacetk::on_focus_lost {path} {
+    variable after_focused_id
+
+    if {$after_focused_id != ""} {
 	after cancel $after_focused_id
 	set after_focused_id ""
     }
-    set focused ""
     balloon::destroy
-
-    hook::run lost_focus_hook $path
 }
+hook::add lost_focus_hook [namespace current]::ifacetk::on_focus_lost
 
 proc ifacetk::tab_move {nb shift args} {
     set len [llength [$nb pages]]
@@ -1410,7 +1407,6 @@
     global usetabbar
     global tabcolors
     global alert_lvls alert_colors
-    variable focused
     variable number_msg
     variable personal_msg
 



More information about the Tkabber-dev mailing list