ocarina: Focus the window when changing tabs

This prevents the entry widget from gaining focus when switching tabs.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-09-05 09:31:00 -04:00
parent 11b685aeb0
commit 3acbbb048e
1 changed files with 5 additions and 4 deletions

View File

@ -45,7 +45,7 @@ static void window_state(GtkWidget *widget, GdkEvent *event, gpointer data)
}
}
static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
static gboolean key_pressed(GtkWindow *window, GdkEvent *event, gpointer data)
{
string key = gdk_keyval_name(event->key.keyval);
if (key.substr(0, 3) == "KP_")
@ -55,7 +55,7 @@ static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
return TRUE;
if (key == "Escape") {
gtk_window_set_focus(GTK_WINDOW(widget), NULL);
gtk_window_set_focus(window, NULL);
return TRUE;
}
@ -66,9 +66,10 @@ static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
* TODO: something for banning / unbanning songs
* something for incrementing / decrementing the pause after N count
*/
if (key == "b" || key == "l" || key == "r")
if (key == "b" || key == "l" || key == "r") {
playlist_switch_to(key);
else if (key >= "0" && key <= "9")
gtk_window_set_focus(window, NULL);
} else if (key >= "0" && key <= "9")
playlist_switch_to_n(atoi(key.c_str()));
else if (key == "n")
libsaria::deck::next();