diff console/libgnt/gntmain.c @ 14091:ae4cbed1b309

[gaim-migrate @ 16715] Add support for tab-completion and save-history in GntEntry. Also, the keyboard-commands should now work for Xterms. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 12 Aug 2006 10:27:29 +0000
parents 2d1b41e3cf0d
children c0ee28af3ca2
line wrap: on
line diff
--- a/console/libgnt/gntmain.c	Sat Aug 12 10:20:19 2006 +0000
+++ b/console/libgnt/gntmain.c	Sat Aug 12 10:27:29 2006 +0000
@@ -13,6 +13,11 @@
 #include <unistd.h>
 #include <string.h>
 
+/**
+ * Notes: Interesting functions to look at:
+ * 	scr_dump, scr_init, scr_restore: for workspaces
+ */
+
 static int lock_focus_list;
 static GList *focus_list;
 
@@ -52,6 +57,14 @@
 static void draw_taskbar();
 static void bring_on_top(GntWidget *widget);
 
+static gboolean
+update_screen(gpointer null)
+{
+	update_panels();
+	doupdate();
+	return TRUE;
+}
+
 void gnt_screen_take_focus(GntWidget *widget)
 {
 	GntWidget *w = NULL;
@@ -119,8 +132,7 @@
 		GntNode *nd = g_hash_table_lookup(nodes, window_list.window);
 		top_panel(nd->panel);
 	}
-	update_panels();
-	doupdate();
+	update_screen(NULL);
 	draw_taskbar();
 }
 
@@ -437,6 +449,8 @@
 		dump_screen();
 	}
 
+	gnt_keys_refine(buffer);
+
 	if (mode == GNT_KP_MODE_NORMAL)
 	{
 		if (focus_list)
@@ -499,6 +513,14 @@
 				{
 					shift_window(focus_list->data, 1);
 				}
+				else if (strcmp(buffer + 1, "l") == 0)
+				{
+					touchwin(stdscr);
+					touchwin(newscr);
+					wrefresh(newscr);
+					update_screen(NULL);
+					draw_taskbar();
+				}
 			}
 		}
 	}
@@ -557,8 +579,7 @@
 				GntNode *node = g_hash_table_lookup(nodes, widget);
 				gnt_widget_set_position(widget, x, y);
 				move_panel(node->panel, y, x);
-				update_panels();
-				doupdate();
+				update_screen(NULL);
 			}
 		}
 		else if (*buffer == '\r')
@@ -656,6 +677,10 @@
 		ascii_only = TRUE;
 
 	initscr();
+	typeahead(-1);
+	noecho();
+	curs_set(0);
+
 	gnt_init_colors();
 	gnt_init_styles();
 
@@ -671,7 +696,6 @@
 	nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node);
 
 	wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
-	noecho();
 	refresh();
 #if 0
 	mousemask(NCURSES_BUTTON_PRESSED | NCURSES_BUTTON_RELEASED | REPORT_MOUSE_POSITION, NULL);
@@ -729,8 +753,7 @@
 		}
 	}
 
-	update_panels();
-	doupdate();
+	update_screen(NULL);
 }
 
 void gnt_screen_release(GntWidget *widget)
@@ -750,8 +773,7 @@
 		gnt_tree_remove(GNT_TREE(window_list.tree), widget);
 	}
 
-	update_panels();
-	doupdate();
+	update_screen(NULL);
 }
 
 void gnt_screen_update(GntWidget *widget)
@@ -779,8 +801,7 @@
 		top_panel(nd->panel);
 	}
 
-	update_panels();
-	doupdate();
+	update_screen(NULL);
 }
 
 gboolean gnt_widget_has_focus(GntWidget *widget)
@@ -844,8 +865,7 @@
 		gnt_widget_draw(widget);
 		replace_panel(node->panel, widget->window);
 		show_panel(node->panel);
-		update_panels();
-		doupdate();
+		update_screen(NULL);
 	}
 }