move the other if-else into the switch

This commit is contained in:
Daniel Micay 2012-09-28 12:18:13 -04:00
parent a4de8fdbc1
commit 4f515865f6
1 changed files with 25 additions and 24 deletions

View File

@ -580,9 +580,21 @@ static void synthesize_keypress(GtkWidget *widget, unsigned keyval) {
gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *info) {
gboolean ret = FALSE;
if (event->keyval == GDK_KEY_Escape) {
switch (event->keyval) {
case GDK_KEY_Tab:
synthesize_keypress(GTK_WIDGET(entry), GDK_KEY_Down);
return TRUE;
case GDK_KEY_ISO_Left_Tab:
synthesize_keypress(GTK_WIDGET(entry), GDK_KEY_Up);
return TRUE;
case GDK_KEY_Down:
// this stops the down key from leaving the GtkEntry...
event->hardware_keycode = 0;
break;
case GDK_KEY_Escape:
ret = TRUE;
} else if (event->keyval == GDK_KEY_Return) {
break;
case GDK_KEY_Return: {
const char *text = gtk_entry_get_text(entry);
switch (info->panel.mode) {
@ -603,17 +615,6 @@ gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *i
}
ret = TRUE;
}
switch (event->keyval) {
case GDK_KEY_Tab:
synthesize_keypress(GTK_WIDGET(entry), GDK_KEY_Down);
return TRUE;
case GDK_KEY_ISO_Left_Tab:
synthesize_keypress(GTK_WIDGET(entry), GDK_KEY_Up);
return TRUE;
case GDK_KEY_Down:
// this stops the down key from leaving the GtkEntry...
event->hardware_keycode = 0;
}
if (ret) {