Index: src_plugins/lib_gtk_common/dlg_command.c =================================================================== --- src_plugins/lib_gtk_common/dlg_command.c (revision 8701) +++ src_plugins/lib_gtk_common/dlg_command.c (revision 8702) @@ -256,6 +256,26 @@ command_window_close_cb(ctx); } +static pcb_bool command_escape_cb(GtkWidget * widget, GdkEventKey * kev, gpointer data) +{ + gint ksym = kev->keyval; + + if (ksym != GDK_KEY_Escape) + return FALSE; + + if (command_window) { + gtk_widget_destroy(command_window); + return TRUE; + } + + if (ghid_entry_loop && g_main_loop_is_running(ghid_entry_loop)) /* should always be */ + g_main_loop_quit(ghid_entry_loop); + command_entered = NULL; /* We are aborting */ + + return TRUE; +} + + /* If conf_hid_gtk.plugins.hid_gtk.use_command_window is TRUE this will get called from | ActionCommand() to show the command window. */ @@ -279,9 +299,12 @@ gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); gtk_container_add(GTK_CONTAINER(command_window), vbox); - if (!ctx->command_combo_box) + if (!ctx->command_combo_box) { command_combo_box_entry_create(ctx); + g_signal_connect(G_OBJECT(ctx->command_entry), "key_press_event", G_CALLBACK(command_escape_cb), NULL); + } + gtk_box_pack_start(GTK_BOX(vbox), ctx->command_combo_box, FALSE, FALSE, 0); combo_vbox = vbox; @@ -311,21 +334,7 @@ } -static pcb_bool command_escape_cb(GtkWidget * widget, GdkEventKey * kev, gpointer data) -{ - gint ksym = kev->keyval; - if (ksym != GDK_KEY_Escape) - return FALSE; - - if (ghid_entry_loop && g_main_loop_is_running(ghid_entry_loop)) /* should always be */ - g_main_loop_quit(ghid_entry_loop); - command_entered = NULL; /* We are aborting */ - - return TRUE; -} - - /* This is the command entry function called from ActionCommand() when | conf_hid_gtk.plugins.hid_gtk.use_command_window is FALSE. The command_combo_box is already | packed into the status line label hbox in this case.