move the other if-else into the switch
This commit is contained in:
parent
a4de8fdbc1
commit
4f515865f6
27
termite.cc
27
termite.cc
|
@ -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 entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *info) {
|
||||||
gboolean ret = FALSE;
|
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;
|
ret = TRUE;
|
||||||
} else if (event->keyval == GDK_KEY_Return) {
|
break;
|
||||||
|
case GDK_KEY_Return: {
|
||||||
const char *text = gtk_entry_get_text(entry);
|
const char *text = gtk_entry_get_text(entry);
|
||||||
|
|
||||||
switch (info->panel.mode) {
|
switch (info->panel.mode) {
|
||||||
|
@ -603,17 +615,6 @@ gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *i
|
||||||
}
|
}
|
||||||
ret = TRUE;
|
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) {
|
if (ret) {
|
||||||
|
|
Loading…
Reference in New Issue