When clicking on a non-active tab, focus the first widget in the tab, not

Wed Nov 13 11:55:25 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtknotebook.c (gtk_notebook_button_press):
        When clicking on a non-active tab, focus the first
        widget in the tab, not the tab itself. (#98322)

        * gtk/gtknotebook.c (gtk_notebook_focus_changed):
        Eliminate synchronous drawing, just call redraw_tabs.

        * gtk/gtknotebook.c (gtk_notebook_init): Don't set
        the RECEIVES_DEFAULT flag, we no longer do anything
        with Return/Enter key.
This commit is contained in:
Owen Taylor 2002-11-13 17:20:33 +00:00 committed by Owen Taylor
parent e76d752e9a
commit 83cda922f2
7 changed files with 89 additions and 62 deletions

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -1,3 +1,16 @@
Wed Nov 13 11:55:25 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_button_press):
When clicking on a non-active tab, focus the first
widget in the tab, not the tab itself. (#98322)
* gtk/gtknotebook.c (gtk_notebook_focus_changed):
Eliminate synchronous drawing, just call redraw_tabs.
* gtk/gtknotebook.c (gtk_notebook_init): Don't set
the RECEIVES_DEFAULT flag, we no longer do anything
with Return/Enter key.
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com> Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab * gtk/gtkcombo.c: Fix up grabs to be robust; grab

View File

@ -188,8 +188,6 @@ static void gtk_notebook_forall (GtkContainer *container,
/*** GtkNotebook Private Functions ***/ /*** GtkNotebook Private Functions ***/
static void gtk_notebook_redraw_tabs (GtkNotebook *notebook); static void gtk_notebook_redraw_tabs (GtkNotebook *notebook);
static void gtk_notebook_redraw_arrows (GtkNotebook *notebook); static void gtk_notebook_redraw_arrows (GtkNotebook *notebook);
static void gtk_notebook_focus_changed (GtkNotebook *notebook,
GtkNotebookPage *old_page);
static void gtk_notebook_real_remove (GtkNotebook *notebook, static void gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list); GList *list);
static void gtk_notebook_update_labels (GtkNotebook *notebook); static void gtk_notebook_update_labels (GtkNotebook *notebook);
@ -576,7 +574,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
static void static void
gtk_notebook_init (GtkNotebook *notebook) gtk_notebook_init (GtkNotebook *notebook)
{ {
GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS | GTK_RECEIVES_DEFAULT); GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW);
notebook->cur_page = NULL; notebook->cur_page = NULL;
@ -1611,24 +1609,15 @@ gtk_notebook_button_press (GtkWidget *widget,
(x <= (page->allocation.x + page->allocation.width)) && (x <= (page->allocation.x + page->allocation.width)) &&
(y <= (page->allocation.y + page->allocation.height))) (y <= (page->allocation.y + page->allocation.height)))
{ {
if (page == notebook->cur_page && notebook->focus_tab && gboolean page_changed = page != notebook->cur_page;
notebook->focus_tab != children && gboolean was_focus = gtk_widget_is_focus (notebook);
GTK_WIDGET_HAS_FOCUS (notebook))
{ gtk_notebook_switch_focus_tab (notebook, children);
GtkNotebookPage *old_page; gtk_widget_grab_focus (widget);
notebook->child_has_focus = FALSE; if (page_changed && !was_focus)
old_page = (GtkNotebookPage *) gtk_widget_child_focus (page->child, GTK_DIR_TAB_FORWARD);
(notebook->focus_tab->data);
gtk_notebook_switch_focus_tab (notebook, children);
gtk_notebook_focus_changed (notebook, old_page);
}
else
{
gtk_notebook_switch_focus_tab (notebook, children);
gtk_widget_grab_focus (widget);
gtk_notebook_switch_page (notebook, page, num);
}
break; break;
} }
children = children->next; children = children->next;
@ -2207,7 +2196,6 @@ gtk_notebook_child_type (GtkContainer *container)
/* Private GtkNotebook Functions: /* Private GtkNotebook Functions:
* *
* gtk_notebook_redraw_tabs * gtk_notebook_redraw_tabs
* gtk_notebook_focus_changed
* gtk_notebook_real_remove * gtk_notebook_real_remove
* gtk_notebook_update_labels * gtk_notebook_update_labels
* gtk_notebook_timer * gtk_notebook_timer
@ -2284,45 +2272,6 @@ gtk_notebook_redraw_arrows (GtkNotebook *notebook)
} }
} }
static void
gtk_notebook_focus_changed (GtkNotebook *notebook,
GtkNotebookPage *old_page)
{
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
if (GTK_WIDGET_DRAWABLE (notebook) && notebook->show_tabs)
{
GdkRectangle area;
gint focus_width;
gtk_widget_style_get (GTK_WIDGET (notebook), "focus-line-width", &focus_width, NULL);
if (notebook->focus_tab)
{
GtkNotebookPage *page;
page = notebook->focus_tab->data;
area.x = page->tab_label->allocation.x - focus_width;
area.y = page->tab_label->allocation.y - focus_width;
area.width = page->tab_label->allocation.width + 2 * focus_width;
area.height = page->tab_label->allocation.height + 2 * focus_width;
gtk_notebook_draw_tab (notebook, page, &area);
}
if (old_page)
{
area.x = old_page->tab_label->allocation.x - focus_width;
area.y = old_page->tab_label->allocation.y - focus_width;
area.width = old_page->tab_label->allocation.width + 2 * focus_width;
area.height = old_page->tab_label->allocation.height + 2 * focus_width;
gtk_notebook_draw_tab (notebook, old_page, &area);
}
}
}
static gint static gint
gtk_notebook_timer (GtkNotebook *notebook) gtk_notebook_timer (GtkNotebook *notebook)
{ {
@ -3678,7 +3627,7 @@ gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
page = notebook->focus_tab->data; page = notebook->focus_tab->data;
if (GTK_WIDGET_MAPPED (page->tab_label)) if (GTK_WIDGET_MAPPED (page->tab_label))
gtk_notebook_focus_changed (notebook, old_page); gtk_notebook_redraw_tabs (notebook);
else else
gtk_notebook_pages_allocate (notebook); gtk_notebook_pages_allocate (notebook);