pidgin: e1aa6fb0: Change the cursor and act on double clic...

sadrul at pidgin.im sadrul at pidgin.im
Sat Feb 6 18:50:47 EST 2010


-----------------------------------------------------------------
Revision: e1aa6fb014f5ca76ed5e43db82f20d5e7090a1bf
Ancestor: d4d86f679550b678b19fb6ca8b2eeac194d66a45
Author: sadrul at pidgin.im
Date: 2010-02-06T23:45:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e1aa6fb014f5ca76ed5e43db82f20d5e7090a1bf

Modified files:
        pidgin/gtkconv.c pidgin/gtkimhtml.c

ChangeLog: 

Change the cursor and act on double click on usernames in chat history.

Use the hand-cursor when hovering over usernames in the chat history, and
pop up an IM on double click. Closes #11295.

On the news tonight: The bird is still the word.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	97d47d6e694e7ff110888a1ba5813520e66cf791
+++ pidgin/gtkconv.c	71cda54228825246882630c3e9e53b6c1596d813
@@ -5621,7 +5621,11 @@ static gboolean buddytag_event(GtkTextTa
 
 		buddyname = (tag->name) + 6;
 
-		if (btn_event->button == 2
+		if (btn_event->button == 1 &&
+				event->type == GDK_2BUTTON_PRESS) {
+			chat_do_im(PIDGIN_CONVERSATION(conv), buddyname);
+			return TRUE;
+		} else if (btn_event->button == 2
 				&& event->type == GDK_2BUTTON_PRESS) {
 			chat_do_info(PIDGIN_CONVERSATION(conv), buddyname);
 
@@ -5683,6 +5687,7 @@ static GtkTextTag *get_buddy_tag(PurpleC
 					"weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
 					NULL);
 
+		g_object_set_data(G_OBJECT(buddytag), "cursor", "");
 		g_signal_connect(G_OBJECT(buddytag), "event",
 				G_CALLBACK(buddytag_event), conv);
 	}
============================================================
--- pidgin/gtkimhtml.c	251c85650db4eedd9afe16526b2862f3f1435dca
+++ pidgin/gtkimhtml.c	e8fe44521117c176144426a7dc17e6ad57890d87
@@ -628,6 +628,7 @@ gtk_motion_event_notify(GtkWidget *imhtm
 	GtkTextTag *tag = NULL, *oldprelit_tag;
 	GtkTextChildAnchor* anchor;
 	gboolean hand = TRUE;
+	GdkCursor *cursor = NULL;
 
 	oldprelit_tag = GTK_IMHTML(imhtml)->prelit_tag;
 
@@ -676,9 +677,9 @@ gtk_motion_event_notify(GtkWidget *imhtm
 			GTK_IMHTML(imhtml)->tip_window = NULL;
 		}
 		if (GTK_IMHTML(imhtml)->editable)
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->text_cursor);
+			cursor = GTK_IMHTML(imhtml)->text_cursor;
 		else
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->arrow_cursor);
+			cursor = GTK_IMHTML(imhtml)->arrow_cursor;
 		if (GTK_IMHTML(imhtml)->tip_timer)
 			g_source_remove(GTK_IMHTML(imhtml)->tip_timer);
 		GTK_IMHTML(imhtml)->tip_timer = 0;
@@ -692,12 +693,25 @@ gtk_motion_event_notify(GtkWidget *imhtm
 	}
 
 	if (tip && *tip) {
-		if (!GTK_IMHTML(imhtml)->editable && hand)
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor);
 		GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT,
 							       gtk_imhtml_tip, imhtml);
+	} else if (!tip) {
+		hand = FALSE;
+		for (templist = tags; templist; templist = templist->next) {
+			tag = templist->data;
+			if ((tip = g_object_get_data(G_OBJECT(tag), "cursor"))) {
+				hand = TRUE;
+				break;
+			}
+		}
 	}
 
+	if (hand && !(GTK_IMHTML(imhtml)->editable))
+		cursor = GTK_IMHTML(imhtml)->hand_cursor;
+
+	if (cursor)
+		gdk_window_set_cursor(win, cursor);
+
 	GTK_IMHTML(imhtml)->tip = tip;
 	g_slist_free(tags);
 	return FALSE;


More information about the Commits mailing list