+2004-12-14 [colin] 0.9.13cvs17
+
+ * src/gtk/gtkutils.c
+ * src/gtk/gtkutils.h
+ * src/gtk/prefswindow.c
+ Catch Enter in prefswindow while in text
+ widget. Patch by Alfons.
+
2004-12-14 [paul] 0.9.13cvs16
* ChangeLog
( cvs diff -u -r 1.17 -r 1.18 src/gtk/prefswindow.c; cvs diff -u -r 1.9 -r 1.10 src/gtk/pluginwindow.c; ) > 0.9.13cvs14.patchset
( cvs diff -u -r 1.8 -r 1.9 src/plugins/spamassassin/libspamc.c; ) > 0.9.13cvs15.patchset
( cvs diff -u -r 1.449 -r 1.450 ChangeLog; cvs diff -u -r 1.444 -r 1.445 ChangeLog.jp; cvs diff -u -r 1.18 -r 1.19 src/action.c; cvs diff -u -r 1.463 -r 1.464 src/compose.c; cvs diff -u -r 1.60 -r 1.61 src/common/utils.c; ) > 0.9.13cvs16.patchset
+( cvs diff -u -r 1.7 -r 1.8 src/gtk/gtkutils.c; cvs diff -u -r 1.6 -r 1.7 src/gtk/gtkutils.h; cvs diff -u -r 1.18 -r 1.19 src/gtk/prefswindow.c; ) > 0.9.13cvs17.patchset
MICRO_VERSION=13
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=16
+EXTRA_VERSION=17
EXTRA_RELEASE=
if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
gtk_widget_set_style(widget, newstyle);
}
+/*!
+ *\brief Tries to find a focused child using a lame strategy
+ */
+GtkWidget *gtkut_get_focused_child(GtkContainer *parent)
+{
+ GtkWidget *result = NULL;
+ GList *child_list = NULL;
+ GList *c;
+
+ g_return_val_if_fail(parent, NULL);
+
+ /* Get children list and see which has the focus. */
+ child_list = gtk_container_children(parent);
+ if (!child_list)
+ return NULL;
+ for (c = child_list; c != NULL; c = g_list_next(c)) {
+ if (c->data && GTK_IS_WIDGET(c->data)) {
+ if (GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(c->data))) {
+ result = GTK_WIDGET(c->data);
+ break;
+ }
+ }
+ }
+
+ /* See if the returned widget is a container itself; if it is,
+ * see if one of its children is focused. If the focused
+ * container has no focused child, it is itself a focusable
+ * child, and has focus. */
+ if (result && GTK_IS_CONTAINER(result)) {
+ GtkWidget *tmp = gtkut_get_focused_child(GTK_CONTAINER(result));
+
+ if (tmp)
+ result = tmp;
+ } else {
+ /* Try the same for each container in the chain */
+ for (c = child_list; c != NULL && !result; c = g_list_next(c)) {
+ if (c->data && GTK_IS_WIDGET(c->data)
+ && GTK_IS_CONTAINER(c->data)) {
+ result = gtkut_get_focused_child
+ (GTK_CONTAINER(c->data));
+ }
+ }
+
+ }
+
+ g_list_free(child_list);
+
+ return result;
+}
void gtkut_set_widget_bgcolor_rgb (GtkWidget *widget,
guint rgbvalue);
+GtkWidget *gtkut_get_focused_child (GtkContainer *parent);
#endif /* __GTKUTILS_H__ */
#include <string.h>
#include <gtk/gtk.h>
+#include <gtk/gtktext.h>
#include <gdk/gdkkeysyms.h>
#include "intl.h"
static gboolean prefswindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
+ GtkWidget *focused_child;
+
if (event) {
switch (event->keyval) {
case GDK_Escape :
break;
case GDK_Return :
case GDK_KP_Enter :
- ok_button_released(NULL, data);
+ focused_child = gtkut_get_focused_child
+ (GTK_CONTAINER(data->notebook));
+ /* Press ok, if the focused child is not a text view
+ * and text (anything that accepts return) (can pass
+ * NULL to any of the GTK_xxx() casts) */
+ if (!GTK_IS_TEXT(focused_child))
+ ok_button_released(NULL, data);
break;
default:
break;