]> Pileus Git - ~andy/gtk/commitdiff
few cleanups. (gtk_notebook_key_press): call select page function for
authorLars Hamann <lars@gtk.org>
Thu, 21 Jan 1999 02:13:13 +0000 (02:13 +0000)
committerLars Hamann <lars@src.gnome.org>
Thu, 21 Jan 1999 02:13:13 +0000 (02:13 +0000)
Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>

* gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
(gtk_notebook_key_press): call select page function for
GDK_DOWN key in case of tab_pos == TOP. Changed other
positions accordingly.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtknotebook.c

index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index da55cb54dc02a38629348ef41deb9535d12caaef..04696d55c01612cd6fadff761f45b3f3cf5df3fb 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jan 21 02:47:36 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
+       (gtk_notebook_key_press): call select page function for
+       GDK_DOWN key in case of tab_pos == TOP. Changed other
+       positions accordingly.
+
 Wed Jan 20 19:57:14 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdnd.c (gtk_drag_begin): Start off with the
index 75d96dd7aa5b95d33d9f399e91d28ecf4792f192..b2a5a387b99fca75ce6bf6308fbdece97f9f86fb 100644 (file)
@@ -1249,16 +1249,56 @@ gtk_notebook_key_press (GtkWidget   *widget,
   switch (event->keyval)
     {
     case GDK_Up:
-      direction = GTK_DIR_UP;
+      switch (notebook->tab_pos)
+       {
+       case GTK_POS_BOTTOM:
+         gtk_notebook_page_select (GTK_NOTEBOOK (widget));
+         return TRUE;
+       case GTK_POS_TOP:
+         return FALSE;
+       default:
+         direction = GTK_DIR_UP;
+         break;
+       }
       break;
     case GDK_Left:
-      direction = GTK_DIR_LEFT;
+      switch (notebook->tab_pos)
+       {
+       case GTK_POS_RIGHT:
+         gtk_notebook_page_select (GTK_NOTEBOOK (widget));
+         return TRUE;
+       case GTK_POS_LEFT:
+         return FALSE;
+       default:
+         direction = GTK_DIR_LEFT;
+         break;
+       }
       break;
     case GDK_Down:
-      direction = GTK_DIR_DOWN;
+      switch (notebook->tab_pos)
+       {
+       case GTK_POS_TOP:
+         gtk_notebook_page_select (GTK_NOTEBOOK (widget));
+         return TRUE;
+       case GTK_POS_BOTTOM:
+         return FALSE;
+       default:
+         direction = GTK_DIR_DOWN;
+         break;
+       }
       break;
     case GDK_Right:
-      direction = GTK_DIR_RIGHT;
+      switch (notebook->tab_pos)
+       {
+       case GTK_POS_LEFT:
+         gtk_notebook_page_select (GTK_NOTEBOOK (widget));
+         return TRUE;
+       case GTK_POS_RIGHT:
+         return FALSE;
+       default:
+         direction = GTK_DIR_RIGHT;
+         break;
+       }
       break;
     case GDK_Tab:
     case GDK_ISO_Left_Tab:
@@ -1534,7 +1574,6 @@ gtk_notebook_focus (GtkContainer     *container,
                    GtkDirectionType  direction)
 {
   GtkNotebook *notebook;
-  GtkWidget *focus_child;
   GtkNotebookPage *page = NULL;
   GtkNotebookPage *old_page = NULL;
 
@@ -1543,13 +1582,12 @@ gtk_notebook_focus (GtkContainer     *container,
 
   notebook = GTK_NOTEBOOK (container);
 
-  if (!GTK_WIDGET_DRAWABLE (notebook) || !GTK_WIDGET_IS_SENSITIVE (container) ||
-      !notebook->children || !notebook->cur_page)
+  if (!GTK_WIDGET_DRAWABLE (notebook) ||
+      !GTK_WIDGET_IS_SENSITIVE (container) ||
+      !notebook->children ||
+      !notebook->cur_page)
     return FALSE;
 
-  focus_child = container->focus_child;
-  gtk_container_set_focus_child (container, NULL);
-
   if (!notebook->show_tabs)
     {
       if (GTK_WIDGET_DRAWABLE (notebook->cur_page->child) &&
@@ -1563,7 +1601,7 @@ gtk_notebook_focus (GtkContainer     *container,
            }
          else if (GTK_WIDGET_CAN_FOCUS (notebook->cur_page->child))
            {
-             if (!focus_child)
+             if (!container->focus_child)
                {
                  gtk_widget_grab_focus (notebook->cur_page->child);
                  return TRUE;
@@ -1576,24 +1614,28 @@ gtk_notebook_focus (GtkContainer     *container,
   if (notebook->focus_tab)
     old_page = notebook->focus_tab->data;
 
-  if (focus_child && old_page && focus_child == old_page->child &&
-      notebook->child_has_focus)
+  if (container->focus_child && old_page &&
+      container->focus_child == old_page->child && notebook->child_has_focus)
     {
-      if (GTK_WIDGET_DRAWABLE (old_page->child))
+      if (GTK_WIDGET_DRAWABLE (container->focus_child))
        {
-         if (GTK_IS_CONTAINER (old_page->child) &&
-             !GTK_WIDGET_HAS_FOCUS (old_page->child))
+         if (GTK_IS_CONTAINER (container->focus_child) &&
+             !GTK_WIDGET_HAS_FOCUS (container->focus_child))
            {
-             if (gtk_container_focus (GTK_CONTAINER (old_page->child),
+             if (gtk_container_focus (GTK_CONTAINER (container->focus_child),
                                       direction))
                return TRUE;
            }
          gtk_widget_grab_focus (GTK_WIDGET(notebook));
          return TRUE;
        }
+      notebook->focus_tab = NULL;
       return FALSE;
     }
 
+  if (!GTK_WIDGET_HAS_FOCUS (container))
+    notebook->focus_tab = NULL;
+
   switch (direction)
     {
     case GTK_DIR_TAB_FORWARD: