[Tkabber-dev] r1577 - in trunk/tkabber-plugins: . floatingcontact

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Oct 23 22:52:07 MSD 2008


Author: sergei
Date: 2008-10-23 22:52:07 +0400 (Thu, 23 Oct 2008)
New Revision: 1577

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/floatingcontact/floatingcontact.tcl
Log:
	* floatingcontact/floatingcontact.tcl: Fixed saving floating windows
	  coordinates on disconnect and moved restoring them from loading
	  stage to connected stage.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2008-10-23 18:49:58 UTC (rev 1576)
+++ trunk/tkabber-plugins/ChangeLog	2008-10-23 18:52:07 UTC (rev 1577)
@@ -1,3 +1,9 @@
+2008-10-23  Sergei Golovan <sgolovan at nes.ru>
+
+	* floatingcontact/floatingcontact.tcl: Fixed saving floating windows
+	  coordinates on disconnect and moved restoring them from loading
+	  stage to connected stage.
+
 2008-10-22  Sergei Golovan <sgolovan at nes.ru>
 
 	* floatingcontact/*: Added a new plugin which allows roster contacts

Modified: trunk/tkabber-plugins/floatingcontact/floatingcontact.tcl
===================================================================
--- trunk/tkabber-plugins/floatingcontact/floatingcontact.tcl	2008-10-23 18:49:58 UTC (rev 1576)
+++ trunk/tkabber-plugins/floatingcontact/floatingcontact.tcl	2008-10-23 18:52:07 UTC (rev 1577)
@@ -52,12 +52,21 @@
 
     foreach idx [array names float_is_float $xlib,*] {
 	set jid [string range $idx [string length $xlib,] end]
-	catch {destroy $float_floats($xlib,$jid)}
-	catch {unset float_floats($xlib,$jid)}
-	lappend fl($bjid) $jid \
-			  $float_is_float($xlib,$jid) \
-			  $float_x($xlib,$jid) \
-			  $float_y($xlib,$jid)
+	set float $float_is_float($xlib,$jid)
+
+	set float_is_float($xlib,$jid) 0
+	float_toggle $xlib $jid
+
+	if {[info exists float_x($xlib,$jid)] && \
+				[info exists float_y($xlib,$jid)]} {
+	    lappend fl($bjid) $jid \
+			      $float \
+			      $float_x($xlib,$jid) \
+			      $float_y($xlib,$jid)
+	    unset float_x($xlib,$jid)
+	    unset float_y($xlib,$jid)
+	}
+	unset float_is_float($xlib,$jid)
     }
 
     if {[llength $fl($bjid)] == 0} {
@@ -67,7 +76,7 @@
     set floating_jids_list [array get fl]
 }
 
-hook::add predisconnected_hook ::ifacetk::roster::save_float_list
+hook::add disconnected_hook ::ifacetk::roster::save_float_list
 
 
 ###############################################################################
@@ -82,8 +91,12 @@
     variable iroster
 
     if {![info exists float_is_float($xlib,$jid)] || !$float_is_float($xlib,$jid)} {
-	catch {destroy $float_floats($xlib,$jid)}
-	catch {unset float_floats($xlib,$jid)}
+	if {[info exists float_floats($xlib,$jid)]} {
+	    set w $float_floats($xlib,$jid)
+	    unset float_floats($xlib,$jid)
+	    catch {destroy $w}
+	    array unset iroster $w,*
+	}
     } else {
 	set w [toplevel .float[incr float_winid] -relief flat -bd 1 -class Balloon]
 	$w configure -bg [option get $w foreground Balloon]
@@ -122,9 +135,11 @@
 	float_redraw $xlib
 
 	bind $w <ButtonPress-1> \
-		[list [namespace current]::float_start_drag $w %x %y]
+		[list [namespace current]::float_start_drag %x %y]
 	bind $w <Button1-Motion> \
 		[list [namespace current]::float_motion_drag $w $xlib $jid %X %Y]
+	bind $w <ButtonRelease-1> \
+		[list [namespace current]::float_stop_drag %x %y]
 
 	wm deiconify $w
     }
@@ -178,7 +193,7 @@
 hook::add client_presence_hook ::ifacetk::roster::float_on_change_jid_presence 100
 
 ###############################################################################
-proc ::ifacetk::roster::float_start_drag {w x y} {
+proc ::ifacetk::roster::float_start_drag {x y} {
     variable float_savex $x
     variable float_savey $y
 }
@@ -193,6 +208,13 @@
     wm geometry $w +$float_x($xlib,$jid)+$float_y($xlib,$jid)
 }
 
+proc ::ifacetk::roster::float_stop_drag {x y} {
+    variable float_savex
+    variable float_savey
+    catch {unset float_savex}
+    catch {unset float_savey}
+}
+
 ###############################################################################
 
 proc ::ifacetk::roster::float_create_menu {m xlib jid} {



More information about the Tkabber-dev mailing list