#include "tilda-window.h"
#include "tilda-window-dbus-glue.h"
+/**
+ * Find the TildaTerminal corresponding to the currently selected
+ * tab in self->notebook. This could go away if TildaTerminal were
+ * a proper subclass of GtkWidget.
+ */
+static TildaTerminal *
+tilda_window_find_current_terminal (TildaWindow *self)
+{
+ gint i;
+ TildaTerminal *ret;
+ gint current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(self->notebook));
+ GtkWidget *box = gtk_notebook_get_nth_page (GTK_NOTEBOOK(self->notebook), current_page);
+
+ for (i=0; i<self->terms->len; ++i)
+ {
+ ret = g_ptr_array_index (self->terms, i);
+
+ if (ret->hbox == box)
+ return ret;
+ }
+
+ g_printerr ("FIXME: unable to find current terminal!\n");
+ return NULL;
+}
+
static gint
tilda_window_find_next_free_terminal_number (TildaWindow *tw)
{
tilda_window_keybinding_cb (const gchar *keystr, gpointer data)
{
TildaWindow *self = TILDA_WINDOW(data);
+ TildaTerminal *tt;
g_print ("tilda_window_keybinding_cb() called! -- window %d\n", self->number);
// FIXME: this doesn't handle animation!
/* Pull Down */
tomboy_window_present_hardcore (GTK_WINDOW(self->window));
self->state = WINDOW_DOWN;
+
+ // Focusing the term here works perfectly, near as I can tell
+ tt = tilda_window_find_current_terminal (self);
+ gtk_widget_grab_focus (GTK_WIDGET(tt->vte_term));
break;
case WINDOW_DOWN: