diff pidgin/pidgintooltip.c @ 32667:e2a1510da13d

propagate from branch 'im.pidgin.pidgin' (head 5da91575f92c8c13d7a85eef338ec6da55e6fb26) to branch 'im.pidgin.cpw.qulogic.gtk3' (head 53d36fd22e482079303664b9f3e13fa2a4b6f9b2)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 22 Aug 2011 21:27:03 +0000
parents a7397a3d67ef 6ee534f155d7
children 3828a61c44da
line wrap: on
line diff
--- a/pidgin/pidgintooltip.c	Mon Apr 25 20:13:05 2011 +0000
+++ b/pidgin/pidgintooltip.c	Mon Aug 22 21:27:03 2011 +0000
@@ -139,6 +139,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;
@@ -159,6 +160,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)
@@ -180,6 +184,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);