From: compudj Date: Sun, 8 Aug 2004 06:59:50 +0000 (+0000) Subject: tweak : select the first widget by default X-Git-Tag: v0.12.20~2814 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0f9d55ef5fb04568bd96089eeb069b549b2b675d;p=lttv.git tweak : select the first widget by default git-svn-id: http://ltt.polymtl.ca/svn@675 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 455113bc..1ea288a5 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -227,9 +227,7 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) * child of this widget. The little trick is to get each child * of each GTK_CONTAINER, even subchildren. */ - { - connect_focus_recursive(viewer, viewer); - } + connect_focus_recursive(viewer, viewer); } } @@ -472,6 +470,11 @@ void create_new_window(GtkWidget* widget, gpointer user_data, gboolean clone) } } +/* Get the currently focused viewer. + * If no viewer is focused, use the first one. + * + * If no viewer available, return NULL. + */ GtkWidget *viewer_container_focus(GtkWidget *container) { GtkWidget *widget; @@ -479,7 +482,14 @@ GtkWidget *viewer_container_focus(GtkWidget *container) widget = (GtkWidget*)g_object_get_data(G_OBJECT(container), "focused_viewer"); - if(widget == NULL) g_debug("no widget focused"); + if(widget == NULL) { + g_debug("no widget focused"); + GList *children = gtk_container_get_children(GTK_CONTAINER(container)); + + if(children != NULL) + widget = GTK_WIDGET(children->data); + } + return widget;