changeset 31611:6ee534f155d7

Fix a bug where the tooltip is destroyed when it have a lot of information. Fixes #10510
author masca@cpw.pidgin.im
date Fri, 13 May 2011 04:32:48 +0000
parents 5ef22297ea91
children 4aeca6c1c143
files ChangeLog pidgin/pidgintooltip.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 12 12:47:40 2011 +0000
+++ b/ChangeLog	Fri May 13 04:32:48 2011 +0000
@@ -18,6 +18,8 @@
 	  stream to the existing call. (Jakub Adam) (#13537)
 	* Pidgin plugins can now override tab completion and detect clicks on
 	  usernames in the chat userlist. (kawaii.neko) (#12599)
+	* Fix the tooltip being destroyed when it is full of information and
+	  cover the mouse (dliang) (#10510)
 
 	libpurple:
 	* media: Allow obtaining active local and remote candidates. (Jakub
--- a/pidgin/pidgintooltip.c	Thu May 12 12:47:40 2011 +0000
+++ b/pidgin/pidgintooltip.c	Fri May 13 04:32:48 2011 +0000
@@ -134,6 +134,7 @@
 {
 	int sig;
 	int scr_w, scr_h, x, y, dy;
+	int preserved_x, preserved_y;
 	int mon_num;
 	GdkScreen *screen = NULL;
 	GdkRectangle mon_size;
@@ -154,6 +155,9 @@
 	if (h > mon_size.height)
 		h = mon_size.height - 10;
 
+	preserved_x = x;
+	preserved_y = y;
+
 	x -= ((w >> 1) + 4);
 
 	if ((y + h + 4) > scr_h)
@@ -175,6 +179,12 @@
 			x = mon_size.x;
 	}
 
+	/* If the mouse covered by the tipwindow, move the tipwindow
+	 * to the righ side of the it */
+	if ((preserved_x >= x) && (preserved_x <= (x + w))
+			&& (preserved_y >= y) && (preserved_y <= (y + h)))
+		x = preserved_x + dy;
+
 	gtk_widget_set_size_request(tipwindow, w, h);
 	gtk_window_move(GTK_WINDOW(tipwindow), x, y);
 	gtk_widget_show(tipwindow);