diff src/gtkconv.c @ 9260:947876140943

[gaim-migrate @ 10059] Patch by Stu Tomlinson to add gaim_conversation_has_focus() and gaim_conv_window_has_focus(), and the (optional) UI ops. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 11 Jun 2004 00:08:29 +0000
parents 933c7418fd03
children 7a8aa87164ae
line wrap: on
line diff
--- a/src/gtkconv.c	Thu Jun 10 20:57:52 2004 +0000
+++ b/src/gtkconv.c	Fri Jun 11 00:08:29 2004 +0000
@@ -4601,6 +4601,18 @@
 	return (index == -1 ? 0 : index);
 }
 
+static gboolean
+gaim_gtk_has_focus(GaimConvWindow *win)
+{
+	GaimGtkWindow *gtkwin;
+	gboolean has_focus = FALSE;
+
+	gtkwin = GAIM_GTK_WINDOW(win);
+	g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL);
+
+	return has_focus;
+}
+
 static GaimConvWindowUiOps window_ui_ops =
 {
 	gaim_gtk_conversations_get_conv_ui_ops,
@@ -4614,7 +4626,8 @@
 	gaim_gtk_add_conversation,
 	gaim_gtk_remove_conversation,
 	gaim_gtk_move_conversation,
-	gaim_gtk_get_active_index
+	gaim_gtk_get_active_index,
+	gaim_gtk_has_focus
 };
 
 GaimConvWindowUiOps *
@@ -5208,6 +5221,21 @@
 	gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
 }
 
+static gboolean
+gaim_gtkconv_has_focus(GaimConversation *conv)
+{
+	GaimConvWindow *win;
+	GaimGtkWindow *gtkwin;
+	gboolean has_focus;
+
+	win = gaim_conversation_get_window(conv);
+	gtkwin = GAIM_GTK_WINDOW(win);
+
+	g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL);
+
+	return has_focus;
+}
+
 static void
 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type)
 {
@@ -5345,6 +5373,7 @@
 	gaim_gtkconv_chat_remove_user,   /* chat_remove_user     */
 	gaim_gtkconv_chat_remove_users,  /* chat_remove_users    */
 	NULL,                            /* update_progress      */
+	gaim_gtkconv_has_focus,          /* has_focus            */
 	gaim_gtkconv_updated             /* updated              */
 };