Mercurial > pidgin.yaz
changeset 18429:10af8f0ccb6b
merge of 'c0dada8d5e1c72e70d6918a158d0c4edf662cf88'
and 'fe3b2f22f6faf15c3a0c1bde403dc1e09d8c2d08'
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Wed, 04 Jul 2007 03:43:37 +0000 |
parents | aed9eceb7b0f (current diff) 1dbd8ce2f11f (diff) |
children | 0877d661a6ff 1c6abf965d62 |
files | |
diffstat | 14 files changed, 388 insertions(+), 170 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntblist.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/gntblist.c Wed Jul 04 03:43:37 2007 +0000 @@ -590,6 +590,9 @@ if (node->ui_data) return; + if (!purple_account_is_connected(buddy->account)) + return; + contact = (PurpleContact*)node->parent; if (!contact) /* When a new buddy is added and show-offline is set */ return; @@ -2135,7 +2138,7 @@ purple_prefs_set_string(PREF_ROOT "/sort_type", n); } -/* XXX: send_im_select* -- Xerox */ +/* send_im_select* -- Xerox */ static void send_im_select_cb(gpointer data, PurpleRequestFields *fields) {
--- a/finch/gntconv.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/gntconv.c Wed Jul 04 03:43:37 2007 +0000 @@ -541,6 +541,8 @@ gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry); + gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(ggc->tv), ggc->entry); + g_signal_connect_after(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); g_signal_connect(G_OBJECT(ggc->entry), "completion", G_CALLBACK(completion_cb), NULL); g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc);
--- a/finch/gntdebug.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/gntdebug.c Wed Jul 04 03:43:37 2007 +0000 @@ -274,6 +274,7 @@ g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); + gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(debug.tview), debug.window); gnt_widget_show(debug.window); }
--- a/finch/libgnt/gnt.h Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gnt.h Wed Jul 04 03:43:37 2007 +0000 @@ -112,7 +112,7 @@ /** * * @param label - * @param callback)() + * @param callback */ void gnt_register_action(const char *label, void (*callback)()); @@ -149,3 +149,11 @@ */ void gnt_set_clipboard_string(gchar *string); +/** + * Spawn a different application that will consume the console. + */ +gboolean gnt_giveup_console(const char *wd, char **argv, char **envp, + gint *stin, gint *stout, gint *sterr); + +gboolean gnt_is_refugee(void); +
--- a/finch/libgnt/gntkeys.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gntkeys.c Wed Jul 04 03:43:37 2007 +0000 @@ -154,7 +154,7 @@ const char *gnt_key_translate(const char *name) { - return g_hash_table_lookup(specials, name); + return name ? g_hash_table_lookup(specials, name) : NULL; } typedef struct {
--- a/finch/libgnt/gntmain.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gntmain.c Wed Jul 04 03:43:37 2007 +0000 @@ -65,6 +65,7 @@ */ static GIOChannel *channel = NULL; +static int channel_read_callback; static gboolean ascii_only; static gboolean mouse_enabled; @@ -220,8 +221,13 @@ io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) { char keys[256]; - int rd = read(STDIN_FILENO, keys + HOLDING_ESCAPE, sizeof(keys) - 1 - HOLDING_ESCAPE); + int rd; char *k; + + if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD) + return FALSE; + + rd = read(STDIN_FILENO, keys + HOLDING_ESCAPE, sizeof(keys) - 1 - HOLDING_ESCAPE); if (rd < 0) { int ch = getch(); /* This should return ERR, but let's see what it really returns */ @@ -288,7 +294,7 @@ g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); #endif - result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, + channel_read_callback = result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), io_invoke, NULL, NULL); @@ -622,7 +628,51 @@ { return clipboard; } + gchar *gnt_get_clipboard_string() { return gnt_clipboard_get_string(clipboard); } + +#if GLIB_CHECK_VERSION(2,4,0) +static void +reap_child(GPid pid, gint status, gpointer data) +{ + wm->mode = GNT_KP_MODE_NORMAL; + clear(); + setup_io(); + refresh_screen(); +} +#endif + +gboolean gnt_giveup_console(const char *wd, char **argv, char **envp, + gint *stin, gint *stout, gint *sterr) +{ +#if GLIB_CHECK_VERSION(2,4,0) + GPid pid = 0; + + if (!g_spawn_async_with_pipes(wd, argv, envp, + G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, + (GSpawnChildSetupFunc)endwin, NULL, + &pid, stin, stout, sterr, NULL)) + return FALSE; + + g_source_remove(channel_read_callback); + wm->mode = GNT_KP_MODE_WAIT_ON_CHILD; + g_child_watch_add(pid, reap_child, NULL); + + return TRUE; +#else + return FALSE; +#endif +} + +gboolean gnt_is_refugee() +{ +#if GLIB_CHECK_VERSION(2,4,0) + return (wm && wm->mode == GNT_KP_MODE_WAIT_ON_CHILD); +#else + return FALSE; +#endif +} +
--- a/finch/libgnt/gnttextview.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gnttextview.c Wed Jul 04 03:43:37 2007 +0000 @@ -20,9 +20,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "gntstyle.h" #include "gnttextview.h" #include "gntutils.h" +#include <stdlib.h> #include <string.h> enum @@ -793,3 +795,43 @@ view->flags |= flag; } +static gboolean +check_for_pager_cb(GntWidget *widget, const char *key, GntTextView *view) +{ + static const char *combin = NULL; + char *argv[] = {NULL, NULL, NULL}; + static char path[1024]; + static int len = -1; + FILE *file; + + if (combin == NULL) { + combin = gnt_key_translate(gnt_style_get_from_name("pager", "key")); + if (combin == NULL) + combin = "\033" "v"; + len = g_snprintf(path, sizeof(path), "%s" G_DIR_SEPARATOR_S "gnt", g_get_tmp_dir()); + } else { + g_snprintf(path + len, sizeof(path) - len, "XXXXXX"); + } + + if (strcmp(key, combin)) { + return FALSE; + } + + file = fdopen(g_mkstemp(path), "wb"); + if (!file) + return FALSE; + + fprintf(file, "%s", view->string->str); + fclose(file); + argv[0] = gnt_style_get_from_name("pager", "path"); + argv[0] = argv[0] ? argv[0] : getenv("PAGER"); + argv[0] = argv[0] ? argv[0] : "less"; + argv[1] = path; + return gnt_giveup_console(NULL, argv, NULL, NULL, NULL, NULL); +} + +void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager) +{ + g_signal_connect(pager, "key_pressed", G_CALLBACK(check_for_pager_cb), view); +} +
--- a/finch/libgnt/gnttextview.h Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gnttextview.h Wed Jul 04 03:43:37 2007 +0000 @@ -184,6 +184,13 @@ void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget); /** + * + * @param view + * @param widget + */ +void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager); + +/** * Set a GntTextViewFlag for the textview widget. * * @param view The textview widget
--- a/finch/libgnt/gnttree.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gnttree.c Wed Jul 04 03:43:37 2007 +0000 @@ -32,6 +32,7 @@ #define SEARCHING(tree) (tree->search && tree->search->len > 0) #define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE) +#define BINARY_DATA(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_BINARY_DATA) enum { @@ -69,6 +70,7 @@ struct _GntTreeCol { char *text; + gboolean isbinary; int span; /* How many columns does it span? */ }; @@ -136,6 +138,8 @@ { GntTree *t = row->tree; if (t->search && t->search->len > 0) { + /* XXX: Allow setting the search column. And make sure the search column + * doesn't contain binary data. */ char *one = g_utf8_casefold(((GntTreeCol*)row->columns->data)->text, -1); char *two = g_utf8_casefold(t->search->str, -1); char *z = strstr(one, two); @@ -288,14 +292,22 @@ { GntTreeCol *col = iter->data; const char *text; - int len = gnt_util_onscreen_width(col->text, NULL); + int len; int fl = 0; gboolean cut = FALSE; int width; + const char *display; if (COLUMN_INVISIBLE(tree, i)) continue; + if (BINARY_DATA(tree, i)) + display = ""; + else + display = col->text; + + len = gnt_util_onscreen_width(display, NULL); + if (i == lastvisible) width = GNT_WIDGET(tree)->priv.width - gnt_util_onscreen_width(string->str, NULL); else @@ -339,8 +351,8 @@ len = width - 1; cut = TRUE; } - text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); - string = g_string_append_len(string, col->text, text - col->text); + text = gnt_util_onscreen_width_to_pointer(display, len - fl, NULL); + string = g_string_append_len(string, display, text - display); if (cut) { /* ellipsis */ if (gnt_ascii_only()) g_string_append_c(string, '~'); @@ -1003,8 +1015,8 @@ free_tree_col(gpointer data) { GntTreeCol *col = data; - - g_free(col->text); + if (col->isbinary) + g_free(col->text); g_free(col); } @@ -1390,8 +1402,12 @@ if (row) { col = g_list_nth_data(row->columns, colno); - g_free(col->text); - col->text = g_strdup(text ? text : ""); + if (BINARY_DATA(tree, colno)) { + col->text = (gpointer)text; + } else { + g_free(col->text); + col->text = g_strdup(text ? text : ""); + } if (get_distance(tree->top, row) >= 0 && get_distance(row, tree->bottom) >= 0) redraw_tree(tree); @@ -1517,7 +1533,13 @@ { GntTreeCol *col = g_new0(GntTreeCol, 1); col->span = 1; - col->text = g_strdup(iter->data ? iter->data : ""); + if (BINARY_DATA(tree, i)) { + col->text = iter->data; + col->isbinary = TRUE; + } else { + col->text = g_strdup(iter->data ? iter->data : ""); + col->isbinary = FALSE; + } row->columns = g_list_append(row->columns, col); } @@ -1662,6 +1684,12 @@ set_column_flag(tree, col, GNT_TREE_COLUMN_FIXED_SIZE, !res); } +void gnt_tree_set_column_is_binary(GntTree *tree, int col, gboolean bin) +{ + g_return_if_fail(col < tree->ncol); + set_column_flag(tree, col, GNT_TREE_COLUMN_FIXED_SIZE, bin); +} + void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]) { int i;
--- a/finch/libgnt/gnttree.h Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gnttree.h Wed Jul 04 03:43:37 2007 +0000 @@ -50,6 +50,7 @@ typedef enum { GNT_TREE_COLUMN_INVISIBLE = 1 << 0, GNT_TREE_COLUMN_FIXED_SIZE = 1 << 1, + GNT_TREE_COLUMN_BINARY_DATA = 1 << 2, } GntTreeColumnFlag; struct _GntTree @@ -103,203 +104,253 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return The GType for GntTree */ GType gnt_tree_get_gtype(void); /** - * + * Create a tree with one column. * - * @return + * @return The newly created tree + * + * @see gnt_tree_new_with_columns */ GntWidget * gnt_tree_new(void); - /* A tree with just one column */ - /** - * - * @param columns + * Create a tree with a specified number of columns. + * + * @param columns Number of columns * - * @return + * @return The newly created tree + * + * @see gnt_tree_new */ GntWidget * gnt_tree_new_with_columns(int columns); /** - * - * @param tree - * @param rows + * The number of rows the tree should display at a time. + * + * @param tree The tree + * @param rows The number of rows */ void gnt_tree_set_visible_rows(GntTree *tree, int rows); /** - * - * @param tree + * Get the number visible rows. * - * @return + * @param tree The tree + * + * @return The number of visible rows */ int gnt_tree_get_visible_rows(GntTree *tree); /** - * - * @param tree - * @param count + * Scroll the contents of the tree. + * + * @param tree The tree + * @param count If positive, the tree will be scrolled down by count rows, + * otherwise, it will be scrolled up by count rows. */ void gnt_tree_scroll(GntTree *tree, int count); /** - * - * @param tree - * @param key - * @param row - * @param parent - * @param bigbro + * Insert a row in the tree. * - * @return + * @param tree The tree + * @param key The key for the row + * @param row The row to insert + * @param parent The key for the parent row + * @param bigbro The key for the row to insert the new row after. + * + * @return The inserted row + * + * @see gnt_tree_create_row + * @see gnt_tree_add_row_last + * @see gnt_tree_add_choice */ GntTreeRow * gnt_tree_add_row_after(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); /** - * - * @param tree - * @param key - * @param row - * @param parent + * Insert a row at the end of the tree. * - * @return + * @param tree The tree + * @param key The key for the row + * @param row The row to insert + * @param parent The key for the parent row + * + * @return The inserted row + * + * @see gnt_tree_create_row + * @see gnt_tree_add_row_after + * @see gnt_tree_add_choice */ GntTreeRow * gnt_tree_add_row_last(GntTree *tree, void *key, GntTreeRow *row, void *parent); /** - * - * @param tree + * Get the key for the selected row. * - * @return + * @param tree The tree + * + * @return The key for the selected row */ gpointer gnt_tree_get_selection_data(GntTree *tree); -/* Returned string needs to be freed */ /** - * - * @param tree + * Get the text displayed for the selected row. * - * @return + * @param tree The tree + * + * @return The text, which needs to be freed by the caller */ char * gnt_tree_get_selection_text(GntTree *tree); /** - * - * @param tree + * Get a list of text of the current row. * - * @return + * @param tree The tree + * + * @return A list of texts of the currently selected row. The list + * and its data should be freed by the caller. */ GList * gnt_tree_get_selection_text_list(GntTree *tree); /** + * Returns the list of rows in the tree. * - * @param tree + * @param tree The tree * - * @constreturn + * @return The list of the rows. The list should not be modified by the caller. */ GList *gnt_tree_get_rows(GntTree *tree); /** - * - * @param tree - * @param key + * Remove a row from the tree. + * + * @param tree The tree + * @param key The key for the row to remove */ void gnt_tree_remove(GntTree *tree, gpointer key); /** - * - * @param tree + * Remove all the item from the tree. + * + * @param tree The tree */ void gnt_tree_remove_all(GntTree *tree); -/* Returns the visible line number of the selected row */ /** - * - * @param tree + * Get the visible line number of the selected row. * - * @return + * @param tree The tree + * + * @return The line number of the currently selected row */ int gnt_tree_get_selection_visible_line(GntTree *tree); /** - * - * @param tree - * @param key - * @param colno - * @param text + * Change the text of a column in a row. + * + * @param tree The tree + * @param key The key for the row + * @param colno The index of the column + * @param text The new text */ void gnt_tree_change_text(GntTree *tree, gpointer key, int colno, const char *text); /** - * - * @param tree - * @param key - * @param row - * @param parent - * @param bigbro + * Add a checkable item in the tree. * - * @return + * @param tree The tree + * @param key The key for the row + * @param row The row to add + * @param parent The parent of the row, or @c NULL + * @param bigbro The row to insert after, or @c NULL + * + * @return The row inserted. + * + * @see gnt_tree_create_row + * @see gnt_tree_create_row_from_list + * @see gnt_tree_add_row_last + * @see gnt_tree_add_row_after */ GntTreeRow * gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); /** - * - * @param tree - * @param key - * @param set + * Set whether a checkable item is checked or not. + * + * @param tree The tree + * @param key The key for the row + * @param set @c TRUE if the item should be checked, @c FALSE if not */ void gnt_tree_set_choice(GntTree *tree, void *key, gboolean set); /** - * - * @param tree - * @param key + * Return whether a row is selected or not, where the row is a checkable item. * - * @return + * @param tree The tree + * @param key The key for the row + * + * @return @c TRUE if the row is checked, @c FALSE otherwise. */ gboolean gnt_tree_get_choice(GntTree *tree, void *key); /** - * - * @param tree - * @param key - * @param flags + * Set flags for the text in a row in the tree. + * + * @param tree The tree + * @param key The key for the row + * @param flags The flags to set */ void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags); /** - * - * @param key + * Select a row. + * + * @param tree The tree + * @param key The key of the row to select */ void gnt_tree_set_selected(GntTree *tree , void *key); /** - * - * @param tree + * Create a row to insert in the tree. + * + * @param tree The tree + * @param ... A string for each column in the tree * - * @return + * @return The row + * + * @see gnt_tree_create_row_from_list + * @see gnt_tree_add_row_after + * @see gnt_tree_add_row_last + * @see gnt_tree_add_choice */ GntTreeRow * gnt_tree_create_row(GntTree *tree, ...); /** - * - * @param tree - * @param list + * Create a row from a list of text. + * + * @param tree The tree + * @param list The list containing the text for each column * - * @return + * @return The row + * + * @see gnt_tree_create_row + * @see gnt_tree_add_row_after + * @see gnt_tree_add_row_last + * @see gnt_tree_add_choice */ GntTreeRow * gnt_tree_create_row_from_list(GntTree *tree, GList *list); /** - * - * @param tree - * @param col - * @param width + * Set the width of a column in the tree. + * + * @param tree The tree + * @param col The index of the column + * @param width The width for the column + * + * @see gnt_tree_set_column_width_ratio + * @see gnt_tree_set_column_resizable */ void gnt_tree_set_col_width(GntTree *tree, int col, int width); @@ -309,64 +360,87 @@ * @param tree The tree * @param index The index of the column * @param title The title for the column + * + * @see gnt_tree_set_column_titles + * @see gnt_tree_set_show_title */ void gnt_tree_set_column_title(GntTree *tree, int index, const char *title); /** - * - * @param tree + * Set the titles of the columns + * + * @param tree The tree + * @param ... One title for each column in the tree + * + * @see gnt_tree_set_column_title + * @see gnt_tree_set_show_title */ void gnt_tree_set_column_titles(GntTree *tree, ...); /** - * - * @param tree - * @param set + * Set whether to display the title of the columns. + * + * @param tree The tree + * @param set If @c TRUE, the column titles are displayed + * + * @see gnt_tree_set_column_title + * @see gnt_tree_set_column_titles */ void gnt_tree_set_show_title(GntTree *tree, gboolean set); /** - * - * @param tree - * @param func + * Set the compare function for sorting the data. + * + * @param tree The tree + * @param func The comparison function, which is used to compare + * the keys + * + * @see gnt_tree_sort_row */ void gnt_tree_set_compare_func(GntTree *tree, GCompareFunc func); /** - * - * @param tree - * @param key - * @param expanded + * Set whether a row, which has child rows, should be expanded. + * + * @param tree The tree + * @param key The key of the row + * @param expanded Whether to expand the child rows */ void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded); /** - * - * @param tree - * @param set + * Set whether to show column separators. + * + * @param tree The tree + * @param set If @c TRUE, the column separators are displayed */ void gnt_tree_set_show_separator(GntTree *tree, gboolean set); /** - * - * @param tree - * @param row + * Sort a row in the tree. + * + * @param tree The tree + * @param row The row to sort + * + * @see gnt_tree_set_compare_func */ void gnt_tree_sort_row(GntTree *tree, void *row); -/* This will try to automatically adjust the width of the columns in the tree */ /** - * - * @param tree + * Automatically adjust the width of the columns in the tree. + * + * @param tree The tree */ void gnt_tree_adjust_columns(GntTree *tree); /** - * - * @param tree - * @param hash - * @param eq - * @param kd + * Set the hash functions to use to hash, compare and free the keys. + * + * @param tree The tree + * @param hash The hashing function + * @param eq The function to compare keys + * @param kd The function to use to free the keys when a row is removed + * from the tree */ void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); @@ -389,10 +463,23 @@ * @param col The index of the column * @param res If @c FALSE, the column will not be resized when the * tree is resized + * + * @see gnt_tree_set_col_width + * @see gnt_tree_set_column_width_ratio */ void gnt_tree_set_column_resizable(GntTree *tree, int col, gboolean res); /** + * Set whether data in a column should be considered as binary data, and + * not as strings. A column containing binary data will be display empty text. + * + * @param tree The tree + * @param col The index of the column + * @param bin @c TRUE if the data for the column is binary + */ +void gnt_tree_set_column_is_binary(GntTree *tree, int col, gboolean bin); + +/** * Set column widths to use when calculating column widths after a tree * is resized. * @@ -400,6 +487,9 @@ * @param cols Array of widths. The width must have the same number * of entries as the number of columns in the tree, or * end with a negative value for a column-width. + * + * @see gnt_tree_set_col_width + * @see gnt_tree_set_column_resizable */ void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]); @@ -408,11 +498,6 @@ /* The following functions should NOT be used by applications. */ /* This should be called by the subclasses of GntTree's in their _new function */ -/** - * - * @param tree - * @param col - */ void _gnt_tree_init_internals(GntTree *tree, int col); #endif /* GNT_TREE_H */
--- a/finch/libgnt/gntwm.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gntwm.c Wed Jul 04 03:43:37 2007 +0000 @@ -204,6 +204,9 @@ static gboolean update_screen(GntWM *wm) { + if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD) + return TRUE; + if (wm->menu) { GntMenu *top = wm->menu; while (top) { @@ -377,13 +380,7 @@ else if (pos >= 0) wid = g_list_nth_data(wm->cws->list, pos); - wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, wid); - - gnt_wm_raise_window(wm, wm->cws->ordered->data); - - if (w != wid) { - gnt_widget_set_focus(w, FALSE); - } + gnt_wm_raise_window(wm, wid); } static gboolean @@ -406,7 +403,6 @@ switch_window_n(GntBindable *bind, GList *list) { GntWM *wm = GNT_WM(bind); - GntWidget *w = NULL; GList *l; int n; @@ -418,17 +414,11 @@ else n = 0; - w = wm->cws->ordered->data; - if ((l = g_list_nth(wm->cws->list, n)) != NULL) { gnt_wm_raise_window(wm, l->data); } - if (l && w != l->data) - { - gnt_widget_set_focus(w, FALSE); - } return TRUE; } @@ -1038,7 +1028,7 @@ gnt_ws_draw_taskbar(wm->cws, TRUE); curs_set(0); /* endwin resets the cursor to normal */ - return FALSE; + return TRUE; } static gboolean @@ -1362,7 +1352,6 @@ gnt_ws_draw_taskbar(wm->cws, TRUE); update_screen(wm); if (wm->cws->ordered) { - gnt_widget_set_focus(wm->cws->ordered->data, TRUE); gnt_wm_raise_window(wm, wm->cws->ordered->data); } @@ -1573,29 +1562,16 @@ if (!transient) { GntWS *ws = wm->cws; if (node->me != wm->_list.window) { - GntWidget *w = NULL; - if (GNT_IS_BOX(widget)) { ws = new_widget_find_workspace(wm, widget); } - - if (ws->ordered) - w = ws->ordered->data; - node->ws = ws; ws->list = g_list_append(ws->list, widget); - - if (wm->event_stack) - ws->ordered = g_list_prepend(ws->ordered, widget); - else - ws->ordered = g_list_append(ws->ordered, widget); - - gnt_widget_set_focus(widget, TRUE); - if (w) - gnt_widget_set_focus(w, FALSE); + ws->ordered = g_list_append(ws->ordered, widget); } - if (wm->event_stack || node->me == wm->_list.window) { + if (wm->event_stack || node->me == wm->_list.window || + node->me == ws->ordered->data) { gnt_wm_raise_window(wm, node->me); } else { bottom_panel(node->panel); /* New windows should not grab focus */ @@ -1976,6 +1952,14 @@ GntWS *ws = gnt_wm_widget_find_workspace(wm, widget); if (wm->cws != ws) gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); + if (widget != wm->cws->ordered->data) { + GntWidget *wid = wm->cws->ordered->data; + wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget); + gnt_widget_set_focus(wid, FALSE); + gnt_widget_draw(wid); + } + gnt_widget_set_focus(widget, TRUE); + gnt_widget_draw(widget); g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget); }
--- a/finch/libgnt/gntwm.h Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gntwm.h Wed Jul 04 03:43:37 2007 +0000 @@ -46,6 +46,7 @@ GNT_KP_MODE_NORMAL, GNT_KP_MODE_RESIZE, GNT_KP_MODE_MOVE, + GNT_KP_MODE_WAIT_ON_CHILD } GntKeyPressMode; typedef struct
--- a/finch/libgnt/gntws.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/gntws.c Wed Jul 04 03:43:37 2007 +0000 @@ -35,6 +35,9 @@ int n, width = 0; int i; + if (gnt_is_refugee()) + return; + if (taskbar == NULL) { taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); } else if (reposition) { @@ -114,11 +117,13 @@ g_list_foreach(ws->ordered, widget_hide, nodes); } -void gnt_ws_widget_hide(GntWidget *widget, GHashTable *nodes) { +void gnt_ws_widget_hide(GntWidget *widget, GHashTable *nodes) +{ widget_hide(widget, nodes); } -void gnt_ws_widget_show(GntWidget *widget, GHashTable *nodes) { +void gnt_ws_widget_show(GntWidget *widget, GHashTable *nodes) +{ widget_show(widget, nodes); }
--- a/finch/libgnt/wms/irssi.c Wed Jul 04 03:42:03 2007 +0000 +++ b/finch/libgnt/wms/irssi.c Wed Jul 04 03:43:37 2007 +0000 @@ -181,8 +181,10 @@ GNT_BOX(node->me)->title); wbkgdset(node->window, '\0' | COLOR_PAIR(gnt_widget_has_focus(node->me) ? GNT_COLOR_TITLE : GNT_COLOR_TITLE_D)); mvwaddstr(node->window, 0, 0, title); - update_panels(); - doupdate(); + if (!gnt_is_refugee()) { + update_panels(); + doupdate(); + } return FALSE; }