[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gEDA-dev: Escape key in compselect window
El sáb, 07-07-2007 a las 14:47 +0200, Ivan Stankovic escribió:
> On Sat, Jul 07, 2007 at 01:17:10AM +0200, Carlos Nieves Ónega wrote:
> > Hi,
> > some time ago I was able to close the compselect window just hitting Esc
> > key. Now I can't do it that way anymore.
> >
> > I think this was due to Ivan's patch removing code handling escape key
> > in dialogs (since this is already done by GtkDialog):
> > http://git.gpleda.org/?p=gaf.git;a=blobdiff;f=gschem/src/x_compselect.c;h=bfce626366f8be467803412c30198c883a0aa75b;hp=ccf9e4b5bf6d8dada25db4e67fa92f55b812a63f;hb=7067e71ef1558ceb94772a703cde1463233460fe;hpb=2a2fa60eee536f48cc27c16f2577106e78250ed6
> >
> > It seems this is not working for compselect window, so I'm thinking
> > about reverting this change (only in x_compselect.c , of course).
> >
> > Ivan, any thoughts?
>
> This has nothing to do with escape handling code, it seems. The
> problem appears to be the call to gtk_widget_grab_focus()
> when initializing component selector dialog. GTK is confused
> when we try to set the focus to the filter widget, but the
> currently displayed tab is the "In Use" tab.
You are fully right.
> Commenting out the offending line fixes the problem for me (see the
> patch below). We should probably remember which tab was last
> displayed in the dialog and then set the focus accordingly.
[snip]
I think it's better something like the attached patch. What do you
think?
Regards,
Carlos
diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 296c6ca..5e9dbc0 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -203,7 +203,9 @@ x_compselect_open (TOPLEVEL *toplevel)
gtk_window_present (GTK_WINDOW(toplevel->cswindow));
}
gtk_editable_select_region(GTK_EDITABLE(COMPSELECT(toplevel->cswindow)->entry_filter), 0, -1);
- gtk_widget_grab_focus (GTK_WIDGET(COMPSELECT(toplevel->cswindow)->entry_filter));
+ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(COMPSELECT(toplevel->cswindow)->viewtabs)) == 1) {
+ gtk_widget_grab_focus (GTK_WIDGET(COMPSELECT(toplevel->cswindow)->entry_filter));
+ }
}
/*! \brief Closes the component selection dialog.
_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev