pidgin: 34ebad1a: Make pidgin_blist_toggle_visibility() hi...

charkins at pidgin.im charkins at pidgin.im
Thu Jun 26 20:10:49 EDT 2008


-----------------------------------------------------------------
Revision: 34ebad1a339cefdab142795e0b3a045ad7016658
Ancestor: 79640e5d8ef63294f565d44aa56de5f46611c506
Author: charkins at pidgin.im
Date: 2008-06-27T00:01:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/34ebad1a339cefdab142795e0b3a045ad7016658

Modified files:
        pidgin/gtkblist.c

ChangeLog: 

Make pidgin_blist_toggle_visibility() hide the buddy list when it is
partially obscured but has the focus. This ensures we do something
reasonable if the buddy list is obscured by an "always on top" window.
Fixes #5145.


-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	c1100856c3d80e836fc90c458565683e97cb8cad
+++ pidgin/gtkblist.c	0c9f37ddfd176c41874770e7085cabb1b4f40fd5
@@ -129,6 +129,7 @@ static GdkVisibilityState gtk_blist_visi
 
 static guint visibility_manager_count = 0;
 static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED;
+static gboolean gtk_blist_focused = FALSE;
 static gboolean editing_blist = FALSE;
 
 static GList *pidgin_blist_sort_methods = NULL;
@@ -5077,9 +5078,14 @@ static int
 /******************************************/
 
 static int
-blist_focus_cb(GtkWidget *widget, gpointer data, PidginBuddyList *gtkblist)
+blist_focus_cb(GtkWidget *widget, GdkEventFocus *event, PidginBuddyList *gtkblist)
 {
-	pidgin_set_urgent(GTK_WINDOW(gtkblist->window), FALSE);
+	if(event->in) {
+		gtk_blist_focused = TRUE;
+		pidgin_set_urgent(GTK_WINDOW(gtkblist->window), FALSE);
+	} else {
+		gtk_blist_focused = FALSE;
+	}
 	return 0;
 }
 
@@ -5166,6 +5172,8 @@ static void pidgin_blist_show(PurpleBudd
 	gtkblist->window = pidgin_create_window(_("Buddy List"), 0, "buddy_list", TRUE);
 	g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event",
 			 G_CALLBACK(blist_focus_cb), gtkblist);
+	g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event",
+			 G_CALLBACK(blist_focus_cb), gtkblist);
 	GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
 
 	gtkblist->main_vbox = gtk_vbox_new(FALSE, 0);
@@ -6886,8 +6894,15 @@ pidgin_blist_toggle_visibility()
 {
 	if (gtkblist && gtkblist->window) {
 		if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
+			/* make the buddy list visible if it is iconified or if it is
+			 * obscured and not currently focused (the focus part ensures
+			 * that we do something reasonable if the buddy list is obscured
+			 * by a window set to always be on top), otherwise hide the
+			 * buddy list
+			 */
 			purple_blist_set_visible(PIDGIN_WINDOW_ICONIFIED(gtkblist->window) ||
-					gtk_blist_visibility != GDK_VISIBILITY_UNOBSCURED);
+					((gtk_blist_visibility != GDK_VISIBILITY_UNOBSCURED) &&
+					!gtk_blist_focused));
 		} else {
 			purple_blist_set_visible(TRUE);
 		}


More information about the Commits mailing list