changeset 18223:5023ad94ebc9

Notify a window when it loses focus because another window was moved to the workspace.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 22 Jun 2007 05:40:00 +0000
parents ef65d43190e5
children 73ea3328b0d1
files finch/libgnt/gntwidget.c finch/libgnt/gntws.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntwidget.c	Thu Jun 21 21:32:13 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Fri Jun 22 05:40:00 2007 +0000
@@ -576,7 +576,7 @@
 		GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_GIVE_FOCUS], 0);
 	}
-	else if (!set)
+	else if (!set && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS))
 	{
 		GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_LOST_FOCUS], 0);
--- a/finch/libgnt/gntws.c	Thu Jun 21 21:32:13 2007 +0000
+++ b/finch/libgnt/gntws.c	Fri Jun 22 05:40:00 2007 +0000
@@ -87,8 +87,12 @@
 
 void gnt_ws_add_widget(GntWS *ws, GntWidget* wid)
 {
+	GntWidget *oldfocus;
+	oldfocus = ws->ordered ? ws->ordered->data : NULL;
 	ws->list = g_list_append(ws->list, wid);
 	ws->ordered = g_list_prepend(ws->ordered, wid);
+	if (oldfocus)
+		gnt_widget_set_focus(oldfocus, FALSE);
 }
 
 void gnt_ws_remove_widget(GntWS *ws, GntWidget* wid)