From dcbe3e56827ceee82a67fdfad9bb19aeff82d3ee Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 21 Sep 2006 16:15:53 +0000
Subject: [PATCH] when we click on systray, do not hide roster, just move it.
 Fixes #2403

---
 src/gtkgui_helpers.py | 4 +++-
 src/systray.py        | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py
index 98c37ec2d4..9d0c6a186b 100644
--- a/src/gtkgui_helpers.py
+++ b/src/gtkgui_helpers.py
@@ -390,7 +390,7 @@ def possibly_move_window_in_current_desktop(window):
 	current virtual desktop
 	window is GTK window'''
 	if os.name == 'nt':
-		return
+		return False
 
 	root_window = gtk.gdk.screen_get_default().get_root_window()
 	# current user's vd
@@ -406,6 +406,8 @@ def possibly_move_window_in_current_desktop(window):
 			# we are in another VD that the window was
 			# so show it in current VD
 			window.present()
+			return True
+	return False
 
 def file_is_locked(path_to_file):
 	'''returns True if file is locked (WINDOWS ONLY)'''
diff --git a/src/systray.py b/src/systray.py
index a9072501d4..aa12cc0db5 100644
--- a/src/systray.py
+++ b/src/systray.py
@@ -253,11 +253,11 @@ class Systray:
 		if len(gajim.events.get_systray_events()) == 0:
 			# no pending events, so toggle visible/hidden for roster window
 			if win.get_property('visible'): # visible in ANY virtual desktop?
-				win.hide() # we hide it from VD that was visible in
 
-				# but we could be in another VD right now. eg vd2
-				# and we want not only to hide it in vd1 but also show it in vd2
-				gtkgui_helpers.possibly_move_window_in_current_desktop(win)
+				# we could be in another VD right now. eg vd2
+				# and we want to show it in vd2
+				if not gtkgui_helpers.possibly_move_window_in_current_desktop(win):
+					win.hide() # else we hide it from VD that was visible in
 			else:
 				win.present()
 		else:
-- 
GitLab