I finally got around to not breaking the autohiding originally in Pypanel. 
This version of the mouse-aware autohiding will hide CLOCK_DELAY seconds after
the mouse leaves the panel.

I'll be honest, a 3-second delay really _is_ much nicer than immediately. :)

This patch was already submitted upstream.



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
--- pypanel.original	2008-03-03 20:32:15.000000000 -0500
+++ pypanel_autohide	2008-03-13 09:01:04.000000000 -0400
@@ -43,6 +43,7 @@
 		self.hidden	= 0			# Panel hidden/minimized
 		self.focus	= 0			# Currently focused window
 		self.rpm	= None			# Root pixmap ID
+		self.safelyHide = True	# whether or not we should hide the panel

 		global P_HEIGHT, P_WIDTH, P_LOCATION
 		
@@ -62,7 +63,7 @@
 		self.window = self.screen.root.create_window(P_START, P_LOCATION,
 			P_WIDTH, P_HEIGHT, 0, self.screen.root_depth, window_class=X.InputOutput,
 			visual=X.CopyFromParent, colormap=X.CopyFromParent, 
-			event_mask=(X.ExposureMask|X.ButtonPressMask|X.ButtonReleaseMask|X.EnterWindowMask))
+			event_mask=(X.ExposureMask|X.ButtonPressMask|X.ButtonReleaseMask|X.EnterWindowMask|X.LeaveWindowMask))
 		ppinit(self.window.id, FONT)
 		
 		# Init the panel sections
@@ -851,8 +851,14 @@
 							self.updatePanel(root, win, panel)
 				elif e.type == X.EnterNotify and self.hidden:
 					if e.window.id == win.id:
+						self.safelyHide = False
 						self.toggleHidden() 
 						self.updateTasks(dsp, root, win, panel)
+				elif e.type == X.LeaveNotify and not self.hidden:
+					if e.window.id == win.id:
+						# additional tests so it wont' try to hide if we mouse over an icon
+						if (e.event_y < 0 or e.event_y > P_HEIGHT) or (e.event_x < 0 or e.event_x > P_WIDTH):
+							self.safelyHide = True
 				elif e.type == X.FocusIn:
 					prev_focus = self.focus
 					self.focus = e.window.id
@@ -876,7 +882,7 @@
 						
 			rs, ws, es = select.select([dsp.display.socket], [], [], CLOCK_DELAY) 
 			if not rs:
-				if AUTOHIDE and not self.hidden:
+				if AUTOHIDE and self.safelyHide and not self.hidden:
 					self.toggleHidden()
 			if CLOCK:
 				now = time.strftime(CLOCK_FORMAT, time.localtime())

Reply via email to