Commit aac308b8 authored by Victor Ananjevsky's avatar Victor Ananjevsky

fix passing focus to a child for notebook and paned dialogs

parent 994b39ca
......@@ -36,6 +36,19 @@
static GtkWidget *notebook;
static guint n_tabs = 0;
static void
stack_switch_cb (GObject *obj, GParamSpec *p, gpointer d)
{
GtkWidget *s = gtk_stack_get_visible_child (GTK_STACK (notebook));
gtk_widget_child_focus (s, GTK_DIR_TAB_FORWARD);
}
static void
notebook_switch_cb (GtkNotebook *nb, GtkWidget *s, guint pn, gpointer d)
{
gtk_widget_child_focus (s, GTK_DIR_TAB_FORWARD);
}
GtkWidget *
notebook_create_widget (GtkWidget * dlg)
{
......@@ -82,7 +95,6 @@ notebook_create_widget (GtkWidget * dlg)
gtk_widget_set_name (w, "yad-notebook-widget");
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (w), options.notebook_data.pos);
}
//gtk_container_set_border_width (GTK_CONTAINER (w), 5);
/* add tabs */
for (i = 0; options.notebook_data.tabs[i] != NULL; i++)
......@@ -142,6 +154,12 @@ notebook_swallow_childs (void)
gtk_socket_add_id (GTK_SOCKET (s), tabs[i].xid);
}
/* add signal handler for passing focus to a child */
if (options.notebook_data.stack)
g_signal_connect (G_OBJECT (notebook), "notify::visible-child", G_CALLBACK (stack_switch_cb), NULL);
else
g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK (notebook_switch_cb), NULL);
/* set active tab */
if (options.notebook_data.active > 0)
{
......
......@@ -50,10 +50,12 @@ paned_create_widget (GtkWidget * dlg)
gtk_widget_set_name (w, "yad-paned-widget");
s = gtk_socket_new ();
gtk_widget_set_can_focus (s, TRUE);
gtk_paned_add1 (GTK_PANED (w), s);
g_object_set_data (G_OBJECT (w), "s1", s);
s = gtk_socket_new ();
gtk_widget_set_can_focus (s, TRUE);
gtk_paned_add2 (GTK_PANED (w), s);
g_object_set_data (G_OBJECT (w), "s2", s);
......@@ -80,6 +82,8 @@ paned_swallow_childs (void)
/* must be after embedding children */
if (options.paned_data.splitter > 0)
gtk_paned_set_position (GTK_PANED (paned), options.paned_data.splitter);
gtk_widget_child_focus (s1, GTK_DIR_TAB_FORWARD);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment