changeset 21624:512785bd7fcb

merge of '2a30e00005809366a1e544824043c204cd66c1a1' and 'd8f84687e4066b00b1340586932f7d23d430579c'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 23 Nov 2007 04:06:23 +0000
parents 6f6f8af235eb (diff) 63e54b7c73fa (current diff)
children e5606c720791 1c34b63076df 4e6e39be7fef
files
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntwm.c	Thu Nov 22 20:37:51 2007 +0000
+++ b/finch/libgnt/gntwm.c	Fri Nov 23 04:06:23 2007 +0000
@@ -81,6 +81,7 @@
 static int widestringwidth(wchar_t *wide);
 #endif
 
+static void ensure_normal_mode(GntWM *wm);
 static gboolean write_already(gpointer data);
 static int write_timeout;
 static time_t last_active_time;
@@ -392,6 +393,10 @@
 	if (!wm->cws->ordered || !wm->cws->ordered->next)
 		return;
 
+	if (wm->mode != GNT_KP_MODE_NORMAL) {
+		ensure_normal_mode(wm);
+	}
+
 	w = wm->cws->ordered->data;
 	pos = g_list_index(wm->cws->list, w);
 	pos += direction;
@@ -503,6 +508,7 @@
 
 	if (wm->cws->ordered) {
 		gnt_widget_destroy(wm->cws->ordered->data);
+		ensure_normal_mode(wm);
 	}
 
 	return TRUE;
@@ -522,6 +528,7 @@
 setup__list(GntWM *wm)
 {
 	GntWidget *tree, *win;
+	ensure_normal_mode(wm);
 	win = wm->_list.window = gnt_box_new(FALSE, FALSE);
 	gnt_box_set_toplevel(GNT_BOX(win), TRUE);
 	gnt_box_set_pad(GNT_BOX(win), 0);
@@ -972,6 +979,16 @@
 	update_screen(wm);
 }
 
+static void
+ensure_normal_mode(GntWM *wm)
+{
+	if (wm->mode != GNT_KP_MODE_NORMAL) {
+		if (wm->cws->ordered)
+			window_reverse(wm->cws->ordered->data, FALSE, wm);
+		wm->mode = GNT_KP_MODE_NORMAL;
+	}
+}
+
 static gboolean
 start_move(GntBindable *bindable, GList *null)
 {
@@ -1453,6 +1470,7 @@
 	if (wm->_list.window) {
 		gnt_widget_destroy(wm->_list.window);
 	}
+	ensure_normal_mode(wm);
 	gnt_ws_hide(wm->cws, wm->nodes);
 	wm->cws = s;
 	gnt_ws_show(wm->cws, wm->nodes);