Use gtk_widget_grab_focus to deal with the focus issues.
This commit is contained in:
parent
2df3250792
commit
1b2e2a1697
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
typedef struct search_panel_info {
|
typedef struct search_panel_info {
|
||||||
GtkWidget *vte;
|
GtkWidget *vte;
|
||||||
|
GtkWidget *entry;
|
||||||
GtkBin *panel;
|
GtkBin *panel;
|
||||||
bool reverse;
|
bool reverse;
|
||||||
} search_panel_info;
|
} search_panel_info;
|
||||||
|
@ -37,6 +38,7 @@ static gboolean search_key_press_cb(GtkEntry *entry, GdkEventKey *event, search_
|
||||||
if (event->keyval == GDK_KEY_Return) {
|
if (event->keyval == GDK_KEY_Return) {
|
||||||
search(VTE_TERMINAL(info->vte), gtk_entry_get_text(GTK_ENTRY(entry)), info->reverse);
|
search(VTE_TERMINAL(info->vte), gtk_entry_get_text(GTK_ENTRY(entry)), info->reverse);
|
||||||
gtk_widget_hide(GTK_WIDGET(info->panel));
|
gtk_widget_hide(GTK_WIDGET(info->panel));
|
||||||
|
gtk_widget_grab_focus(info->vte);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -63,10 +65,12 @@ static gboolean key_press_cb(GtkWidget *vte, GdkEventKey *event, search_panel_in
|
||||||
case KEY(KEY_SEARCH):
|
case KEY(KEY_SEARCH):
|
||||||
info->reverse = false;
|
info->reverse = false;
|
||||||
gtk_widget_show(GTK_WIDGET(info->panel));
|
gtk_widget_show(GTK_WIDGET(info->panel));
|
||||||
|
gtk_widget_grab_focus(info->entry);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case KEY(KEY_RSEARCH):
|
case KEY(KEY_RSEARCH):
|
||||||
info->reverse = true;
|
info->reverse = true;
|
||||||
gtk_widget_show(GTK_WIDGET(info->panel));
|
gtk_widget_show(GTK_WIDGET(info->panel));
|
||||||
|
gtk_widget_grab_focus(info->entry);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case KEY(KEY_URL):
|
case KEY(KEY_URL):
|
||||||
search(VTE_TERMINAL(vte), url_regex, false);
|
search(VTE_TERMINAL(vte), url_regex, false);
|
||||||
|
@ -233,6 +237,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
search_panel_info info = {
|
search_panel_info info = {
|
||||||
.vte = vte,
|
.vte = vte,
|
||||||
|
.entry = entry,
|
||||||
.panel = GTK_BIN(alignment),
|
.panel = GTK_BIN(alignment),
|
||||||
.reverse = false
|
.reverse = false
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue