Mercurial > pidgin.yaz
changeset 24268:1335376ba33f
Allow focusing conversation history and the userlist focusable via
keyboard. We used to have this feature in older versions (2.3 and below),
thanks to the GtkPaned widget we used to use (for the resizable entry!).
The bindings are F6, or Ctrl+F6. Fixes #7148.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 29 Oct 2008 19:38:14 +0000 |
parents | ea5909557bc5 |
children | 6c6edb71035d |
files | pidgin/gtkconv.c |
diffstat | 1 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Wed Oct 29 16:46:38 2008 +0000 +++ b/pidgin/gtkconv.c Wed Oct 29 19:38:14 2008 +0000 @@ -1911,6 +1911,40 @@ } static gboolean +gtkconv_cycle_focus(PidginConversation *gtkconv, GtkDirectionType dir) +{ + PurpleConversation *conv = gtkconv->active_conv; + gboolean chat = purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT; + GtkWidget *next = NULL; + struct { + GtkWidget *from; + GtkWidget *to; + } transitions[] = { + {gtkconv->entry, gtkconv->imhtml}, + {gtkconv->imhtml, chat ? gtkconv->u.chat->list : gtkconv->entry}, + {chat ? gtkconv->u.chat->list : NULL, gtkconv->entry}, + {NULL, NULL} + }, *ptr; + + for (ptr = transitions; !next && ptr->from; ptr++) { + GtkWidget *from, *to; + if (dir == GTK_DIR_TAB_FORWARD) { + from = ptr->from; + to = ptr->to; + } else { + from = ptr->to; + to = ptr->from; + } + if (gtk_widget_is_focus(from)) + next = to; + } + + if (next) + gtk_widget_grab_focus(next); + return !!next; +} + +static gboolean conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) { PidginWindow *win; @@ -1971,7 +2005,10 @@ #endif return TRUE; break; - + case GDK_F6: + if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) + return TRUE; + break; } /* End of switch */ } @@ -1998,6 +2035,10 @@ return TRUE; } break; + case GDK_F6: + if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) + return TRUE; + break; } } return FALSE;