Commit 6b61461a authored by Lars Hamann's avatar Lars Hamann

adapted clist pixmap clipping

        * gtk/gtkctree.c (draw_row): adapted clist pixmap clipping

        * gtk/gtknotebook.h (struct _GtkNotebookClass):
        * gtk/gtknotebook.c (gtk_real_notebook_switch_page):
        added missing argument (according to Joseph Coleman's bug report)

        * gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
        function to fix notebook focus handling
parent 344572dc
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
Wed Jun 10 22:23:27 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (draw_row): adapted clist pixmap clipping
* gtk/gtknotebook.h (struct _GtkNotebookClass):
* gtk/gtknotebook.c (gtk_real_notebook_switch_page):
added missing argument (according to Joseph Coleman's bug report)
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): new class
function to fix notebook focus handling
Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org> Wed Jun 10 12:57:03 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c * gdk/gdkcc.c glib/ghash.c glib/glib.h glib/gstring.c
......
...@@ -970,6 +970,7 @@ draw_row (GtkCList *clist, ...@@ -970,6 +970,7 @@ draw_row (GtkCList *clist,
gint i, offset = 0, width, height, pixmap_width = 0, string_width = 0; gint i, offset = 0, width, height, pixmap_width = 0, string_width = 0;
gint xsrc, ysrc, xdest = 0, ydest; gint xsrc, ysrc, xdest = 0, ydest;
gboolean need_redraw = TRUE; gboolean need_redraw = TRUE;
gboolean draw_pixmap = FALSE;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
...@@ -1418,29 +1419,10 @@ draw_row (GtkCList *clist, ...@@ -1418,29 +1419,10 @@ draw_row (GtkCList *clist,
if (pixmap_width && xdest + pixmap_width >= rect->x && if (pixmap_width && xdest + pixmap_width >= rect->x &&
xdest <= rect->x + rect->width) xdest <= rect->x + rect->width)
{ draw_pixmap = TRUE;
if (GTK_CELL_PIXTEXT (clist_row->cell[i])->mask)
{
gdk_gc_set_clip_mask
(fg_gc, GTK_CELL_PIXTEXT (clist_row->cell[i])->mask);
gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
}
gdk_draw_pixmap (clist->clist_window, fg_gc,
GTK_CELL_PIXTEXT
(clist_row->cell[i])->pixmap, xsrc, ysrc,
xdest, ydest, pixmap_width, height);
if (xdest + pixmap_width >
clip_rectangle.x + clip_rectangle.width)
gdk_draw_rectangle (clist->clist_window, bg_gc, TRUE,
rect->x + rect->width, ydest + 1,
xdest + pixmap_width -
(rect->x + rect->width), height - 1);
}
xdest += (GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing +
pixmap_width);
break; break;
case GTK_JUSTIFY_RIGHT: case GTK_JUSTIFY_RIGHT:
offset_x = 0; offset_x = 0;
...@@ -1566,29 +1548,62 @@ draw_row (GtkCList *clist, ...@@ -1566,29 +1548,62 @@ draw_row (GtkCList *clist,
+ clist_row->cell[i].horizontal); + clist_row->cell[i].horizontal);
if (pixmap_width && xdest + pixmap_width >= rect->x && if (pixmap_width && xdest + pixmap_width >= rect->x &&
xdest <= rect->x + rect->width && xdest >= clip_rectangle.x) xdest <= rect->x + rect->width)
draw_pixmap = TRUE;
break;
default :
break;
}
if (draw_pixmap)
{
if (GTK_CELL_PIXTEXT (clist_row->cell[i])->mask)
{ {
gdk_gc_set_clip_mask gdk_gc_set_clip_mask
(fg_gc, GTK_CELL_PIXTEXT (clist_row->cell[i])->mask); (fg_gc, GTK_CELL_PIXTEXT (clist_row->cell[i])->mask);
gdk_gc_set_clip_origin (fg_gc, xdest, ydest); gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
gdk_draw_pixmap (clist->clist_window, fg_gc,
GTK_CELL_PIXTEXT
(clist_row->cell[i])->pixmap,
xsrc, ysrc, xdest, ydest,
pixmap_width, height);
} }
xdest -= (GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing + if (xdest < clip_rectangle.x)
string_width); {
break; xsrc = clip_rectangle.x - xdest;
default : pixmap_width -= xsrc;
break; xdest = clip_rectangle.x;
}
if (xdest + pixmap_width >
clip_rectangle.x + clip_rectangle.width)
pixmap_width =
(clip_rectangle.x + clip_rectangle.width) - xdest;
if (ydest < clip_rectangle.y)
{
ysrc = clip_rectangle.y - ydest;
height -= ysrc;
ydest = clip_rectangle.y;
}
if (ydest + height > clip_rectangle.y + clip_rectangle.height)
height = (clip_rectangle.y + clip_rectangle.height) - ydest;
gdk_draw_pixmap (clist->clist_window, fg_gc,
GTK_CELL_PIXTEXT
(clist_row->cell[i])->pixmap,
xsrc, ysrc, xdest, ydest,
pixmap_width, height);
} }
if (string_width) if (string_width)
{ {
gint delta; gint delta;
if (clist->column[i].justification == GTK_JUSTIFY_RIGHT)
xdest -= (GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing +
string_width);
else
xdest += (GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing +
pixmap_width);
delta = CELL_SPACING - (rect->y - clip_rectangle.y); delta = CELL_SPACING - (rect->y - clip_rectangle.y);
if (delta > 0) if (delta > 0)
{ {
...@@ -1641,6 +1656,29 @@ draw_row (GtkCList *clist, ...@@ -1641,6 +1656,29 @@ draw_row (GtkCList *clist,
(clist_row->cell[i])->mask); (clist_row->cell[i])->mask);
gdk_gc_set_clip_origin (fg_gc, xdest, ydest); gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
} }
if (xdest < clip_rectangle.x)
{
xsrc = clip_rectangle.x - xdest;
pixmap_width -= xsrc;
xdest = clip_rectangle.x;
}
if (xdest + pixmap_width >
clip_rectangle.x + clip_rectangle.width)
pixmap_width = (clip_rectangle.x + clip_rectangle.width) -
xdest;
if (ydest < clip_rectangle.y)
{
ysrc = clip_rectangle.y - ydest;
height -= ysrc;
ydest = clip_rectangle.y;
}
if (ydest + height > clip_rectangle.y + clip_rectangle.height)
height = (clip_rectangle.y + clip_rectangle.height) - ydest;
gdk_draw_pixmap (clist->clist_window, fg_gc, gdk_draw_pixmap (clist->clist_window, fg_gc,
GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap, GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
xsrc, ysrc, xdest, ydest, pixmap_width, height); xsrc, ysrc, xdest, ydest, pixmap_width, height);
...@@ -1666,7 +1704,29 @@ draw_row (GtkCList *clist, ...@@ -1666,7 +1704,29 @@ draw_row (GtkCList *clist,
(clist_row->cell[i])->mask); (clist_row->cell[i])->mask);
gdk_gc_set_clip_origin (fg_gc, xdest, ydest); gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
} }
if (xdest < clip_rectangle.x)
{
xsrc = clip_rectangle.x - xdest;
pixmap_width -= xsrc;
xdest = clip_rectangle.x;
}
if (xdest + pixmap_width >
clip_rectangle.x + clip_rectangle.width)
pixmap_width = (clip_rectangle.x + clip_rectangle.width)
- xdest;
if (ydest < clip_rectangle.y)
{
ysrc = clip_rectangle.y - ydest;
height -= ysrc;
ydest = clip_rectangle.y;
}
if (ydest + height > clip_rectangle.y + clip_rectangle.height)
height = (clip_rectangle.y + clip_rectangle.height) - ydest;
gdk_draw_pixmap (clist->clist_window, fg_gc, gdk_draw_pixmap (clist->clist_window, fg_gc,
GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap, GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
xsrc, ysrc, xdest, ydest, pixmap_width, height); xsrc, ysrc, xdest, ydest, pixmap_width, height);
......
...@@ -94,6 +94,8 @@ static void gtk_notebook_switch_page (GtkNotebook *notebook, ...@@ -94,6 +94,8 @@ static void gtk_notebook_switch_page (GtkNotebook *notebook,
static void gtk_notebook_draw_tab (GtkNotebook *notebook, static void gtk_notebook_draw_tab (GtkNotebook *notebook,
GtkNotebookPage *page, GtkNotebookPage *page,
GdkRectangle *area); GdkRectangle *area);
static void gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child);
static gint gtk_notebook_focus_in (GtkWidget *widget, static gint gtk_notebook_focus_in (GtkWidget *widget,
GdkEventFocus *event); GdkEventFocus *event);
static gint gtk_notebook_focus_out (GtkWidget *widget, static gint gtk_notebook_focus_out (GtkWidget *widget,
...@@ -121,7 +123,8 @@ static void gtk_notebook_expose_tabs (GtkNotebook *notebook); ...@@ -121,7 +123,8 @@ static void gtk_notebook_expose_tabs (GtkNotebook *notebook);
static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook, static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
GList *new_child); GList *new_child);
static void gtk_real_notebook_switch_page (GtkNotebook *notebook, static void gtk_real_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page); GtkNotebookPage *page,
gint page_num);
static void gtk_notebook_marshal_signal (GtkObject *object, static void gtk_notebook_marshal_signal (GtkObject *object,
GtkSignalFunc func, GtkSignalFunc func,
gpointer func_data, gpointer func_data,
...@@ -215,6 +218,7 @@ gtk_notebook_class_init (GtkNotebookClass *class) ...@@ -215,6 +218,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
container_class->remove = gtk_notebook_remove; container_class->remove = gtk_notebook_remove;
container_class->foreach = gtk_notebook_foreach; container_class->foreach = gtk_notebook_foreach;
container_class->focus = gtk_notebook_focus; container_class->focus = gtk_notebook_focus;
container_class->set_focus_child = gtk_notebook_set_focus_child;
class->switch_page = gtk_real_notebook_switch_page; class->switch_page = gtk_real_notebook_switch_page;
} }
...@@ -240,6 +244,7 @@ gtk_notebook_init (GtkNotebook *notebook) ...@@ -240,6 +244,7 @@ gtk_notebook_init (GtkNotebook *notebook)
notebook->click_child = 0; notebook->click_child = 0;
notebook->button = 0; notebook->button = 0;
notebook->need_timer = 0; notebook->need_timer = 0;
notebook->child_has_focus = FALSE;
} }
GtkWidget* GtkWidget*
...@@ -384,9 +389,6 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook, ...@@ -384,9 +389,6 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook,
if (!notebook->first_tab) if (!notebook->first_tab)
notebook->first_tab = notebook->children; notebook->first_tab = notebook->children;
if (!notebook->focus_tab)
notebook->focus_tab = notebook->children;
gtk_widget_set_parent (child, GTK_WIDGET (notebook)); gtk_widget_set_parent (child, GTK_WIDGET (notebook));
if (tab_label) if (tab_label)
{ {
...@@ -395,7 +397,10 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook, ...@@ -395,7 +397,10 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook,
} }
if (!notebook->cur_page) if (!notebook->cur_page)
gtk_notebook_switch_page (notebook, page, 0); {
gtk_notebook_switch_page (notebook, page, 0);
notebook->focus_tab = NULL;
}
if (GTK_WIDGET_VISIBLE (notebook)) if (GTK_WIDGET_VISIBLE (notebook))
{ {
...@@ -1479,9 +1484,6 @@ gtk_notebook_button_press (GtkWidget *widget, ...@@ -1479,9 +1484,6 @@ gtk_notebook_button_press (GtkWidget *widget,
|| notebook->button) || notebook->button)
return FALSE; return FALSE;
if (!GTK_WIDGET_HAS_FOCUS (widget) && !(GTK_CONTAINER (widget)->focus_child))
gtk_widget_grab_focus (widget);
if (event->window == notebook->panel) if (event->window == notebook->panel)
{ {
if (!GTK_WIDGET_HAS_FOCUS (widget)) if (!GTK_WIDGET_HAS_FOCUS (widget))
...@@ -1495,7 +1497,9 @@ gtk_notebook_button_press (GtkWidget *widget, ...@@ -1495,7 +1497,9 @@ gtk_notebook_button_press (GtkWidget *widget,
notebook->click_child = GTK_ARROW_LEFT; notebook->click_child = GTK_ARROW_LEFT;
if (event->button == 1) if (event->button == 1)
{ {
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT); if (!notebook->focus_tab || notebook->focus_tab->prev)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT);
if (!notebook->timer) if (!notebook->timer)
{ {
notebook->timer = gtk_timeout_add notebook->timer = gtk_timeout_add
...@@ -1515,7 +1519,8 @@ gtk_notebook_button_press (GtkWidget *widget, ...@@ -1515,7 +1519,8 @@ gtk_notebook_button_press (GtkWidget *widget,
notebook->click_child = GTK_ARROW_RIGHT; notebook->click_child = GTK_ARROW_RIGHT;
if (event->button == 1) if (event->button == 1)
{ {
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT); if (!notebook->focus_tab || notebook->focus_tab->next)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT);
if (!notebook->timer) if (!notebook->timer)
{ {
notebook->timer = gtk_timeout_add notebook->timer = gtk_timeout_add
...@@ -1554,14 +1559,13 @@ gtk_notebook_button_press (GtkWidget *widget, ...@@ -1554,14 +1559,13 @@ gtk_notebook_button_press (GtkWidget *widget,
(event->x <= (page->allocation.x + page->allocation.width)) && (event->x <= (page->allocation.x + page->allocation.width)) &&
(event->y <= (page->allocation.y + page->allocation.height))) (event->y <= (page->allocation.y + page->allocation.height)))
{ {
gtk_container_set_focus_child (GTK_CONTAINER (notebook), NULL); if (page == notebook->cur_page && notebook->focus_tab &&
notebook->focus_tab != children &&
if (page == notebook->cur_page &&
notebook->focus_tab != children &&
GTK_WIDGET_HAS_FOCUS (notebook)) GTK_WIDGET_HAS_FOCUS (notebook))
{ {
GtkNotebookPage *old_page; GtkNotebookPage *old_page;
notebook->child_has_focus = FALSE;
old_page = (GtkNotebookPage *) old_page = (GtkNotebookPage *)
(notebook->focus_tab->data); (notebook->focus_tab->data);
notebook->focus_tab = children; notebook->focus_tab = children;
...@@ -1578,6 +1582,8 @@ gtk_notebook_button_press (GtkWidget *widget, ...@@ -1578,6 +1582,8 @@ gtk_notebook_button_press (GtkWidget *widget,
children = children->next; children = children->next;
num++; num++;
} }
if (!children && !GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
} }
return FALSE; return FALSE;
} }
...@@ -1734,9 +1740,15 @@ gtk_notebook_timer (GtkNotebook *notebook) ...@@ -1734,9 +1740,15 @@ gtk_notebook_timer (GtkNotebook *notebook)
if (notebook->timer) if (notebook->timer)
{ {
if (notebook->click_child == GTK_ARROW_LEFT) if (notebook->click_child == GTK_ARROW_LEFT)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT); {
if (!notebook->focus_tab || notebook->focus_tab->prev)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT);
}
else if (notebook->click_child == GTK_ARROW_RIGHT) else if (notebook->click_child == GTK_ARROW_RIGHT)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT); {
if (!notebook->focus_tab || notebook->focus_tab->next)
gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT);
}
if (notebook->need_timer) if (notebook->need_timer)
{ {
...@@ -1803,7 +1815,8 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow) ...@@ -1803,7 +1815,8 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow)
static void static void
gtk_real_notebook_switch_page (GtkNotebook *notebook, gtk_real_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page) GtkNotebookPage *page,
gint page_num)
{ {
g_return_if_fail (notebook != NULL); g_return_if_fail (notebook != NULL);
g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
...@@ -1817,7 +1830,8 @@ gtk_real_notebook_switch_page (GtkNotebook *notebook, ...@@ -1817,7 +1830,8 @@ gtk_real_notebook_switch_page (GtkNotebook *notebook,
notebook->cur_page = page; notebook->cur_page = page;
if (notebook->focus_tab->data != (gpointer) notebook->cur_page) if (!notebook->focus_tab ||
notebook->focus_tab->data != (gpointer) notebook->cur_page)
notebook->focus_tab = notebook->focus_tab =
g_list_find (notebook->children, notebook->cur_page); g_list_find (notebook->children, notebook->cur_page);
...@@ -2072,6 +2086,40 @@ gtk_notebook_draw_tab (GtkNotebook *notebook, ...@@ -2072,6 +2086,40 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
} }
} }
static void
gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
GtkNotebook *notebook;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_NOTEBOOK (container));
if (child)
{
g_return_if_fail (GTK_IS_WIDGET (child));
notebook = GTK_NOTEBOOK (container);
notebook->child_has_focus = TRUE;
if (!notebook->focus_tab)
{
GList *children;
GtkNotebookPage *page;
children = notebook->children;
while (children)
{
page = children->data;
if (page->child == child || page->tab_label == child)
notebook->focus_tab = children;
children = children->next;
}
}
}
parent_class->set_focus_child (container, child);
}
static gint static gint
gtk_notebook_focus_in (GtkWidget *widget, gtk_notebook_focus_in (GtkWidget *widget,
GdkEventFocus *event) GdkEventFocus *event)
...@@ -2080,14 +2128,7 @@ gtk_notebook_focus_in (GtkWidget *widget, ...@@ -2080,14 +2128,7 @@ gtk_notebook_focus_in (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE); g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
if (GTK_CONTAINER (widget)->focus_child) GTK_NOTEBOOK (widget)->child_has_focus = FALSE;
{
if (gtk_notebook_page_select (GTK_NOTEBOOK (widget)))
return FALSE;
else
gtk_container_set_focus_child (GTK_CONTAINER (widget), NULL);
}
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_draw_focus (widget); gtk_widget_draw_focus (widget);
...@@ -2149,43 +2190,48 @@ gtk_notebook_focus_changed (GtkNotebook *notebook, GtkNotebookPage *old_page) ...@@ -2149,43 +2190,48 @@ gtk_notebook_focus_changed (GtkNotebook *notebook, GtkNotebookPage *old_page)
g_return_if_fail (notebook != NULL); g_return_if_fail (notebook != NULL);
g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (old_page != NULL);
widget = GTK_WIDGET (notebook); widget = GTK_WIDGET (notebook);
if (GTK_WIDGET_DRAWABLE (widget) && notebook->show_tabs &&