Index: gtktogglebutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktogglebutton.c,v
retrieving revision 1.59
diff -u -p -u -r1.59 gtktogglebutton.c
--- gtktogglebutton.c	26 Mar 2005 05:49:14 -0000	1.59
+++ gtktogglebutton.c	22 Apr 2005 22:14:43 -0000
@@ -400,10 +400,16 @@ gtk_toggle_button_expose (GtkWidget     
     {
       GtkWidget *child = GTK_BIN (widget)->child;
       GtkButton *button = GTK_BUTTON (widget);
-      GtkStateType state_type;
       GtkShadowType shadow_type;
+      GtkStateType state_type;
 
       state_type = GTK_WIDGET_STATE (widget);
+
+      if (state_type == GTK_STATE_PRELIGHT)
+	state_type = GTK_STATE_NORMAL;
+
+      if (button->in_button && !button->depressed)
+	state_type = GTK_STATE_PRELIGHT;
       
       if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
         {
Index: gtkbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkbutton.c,v
retrieving revision 1.125
diff -u -p -u -r1.125 gtkbutton.c
--- gtkbutton.c	31 Mar 2005 17:04:25 -0000	1.125
+++ gtkbutton.c	22 Apr 2005 22:14:43 -0000
@@ -1078,7 +1078,7 @@ _gtk_button_paint (GtkButton    *button,
 			    "focus-line-width", &focus_width,
 			    "focus-padding", &focus_pad,
 			    NULL); 
-	
+      
       x = widget->allocation.x + border_width;
       y = widget->allocation.y + border_width;
       width = widget->allocation.width - border_width * 2;
@@ -1113,8 +1113,7 @@ _gtk_button_paint (GtkButton    *button,
 	  height -= 2 * (focus_width + focus_pad);
 	}
 
-      if (button->relief != GTK_RELIEF_NONE || button->depressed ||
-	  GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT)
+      if (button->relief != GTK_RELIEF_NONE || button->depressed || state_type == GTK_STATE_PRELIGHT)
 	gtk_paint_box (widget->style, widget->window,
 		       state_type,
 		       shadow_type, area, widget, "button",
@@ -1167,9 +1166,17 @@ gtk_button_expose (GtkWidget      *widge
   if (GTK_WIDGET_DRAWABLE (widget))
     {
       GtkButton *button = GTK_BUTTON (widget);
+      GtkStateType state_type;
+
+      state_type = GTK_WIDGET_STATE (widget);
+
+      if (state_type == GTK_STATE_PRELIGHT)
+	  state_type = GTK_STATE_NORMAL;
+      
+      if (button->in_button && !button->depressed)
+	state_type = GTK_STATE_PRELIGHT;
       
-      _gtk_button_paint (button, &event->area,
-			 GTK_WIDGET_STATE (widget),
+      _gtk_button_paint (button, &event->area, state_type,
 			 button->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
 			 "button", "buttondefault");
       
Index: gtknotebook.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtknotebook.c,v
retrieving revision 1.183
diff -u -p -u -r1.183 gtknotebook.c
--- gtknotebook.c	26 Mar 2005 05:49:14 -0000	1.183
+++ gtknotebook.c	22 Apr 2005 22:14:44 -0000
@@ -112,12 +112,21 @@ struct _GtkNotebookPage
   guint fill         : 1;
   guint pack         : 1;
 
+  guint prelight     : 1;
+  
   GtkRequisition requisition;
   GtkAllocation allocation;
 
   guint mnemonic_activate_signal;
 };
 
+typedef struct _GtkNotebookPrivate GtkNotebookPrivate;
+struct _GtkNotebookPrivate
+{
+  int x;
+  int y;
+};
+
 #ifdef G_DISABLE_CHECKS
 #define CHECK_FIND_CHILD(notebook, child)                           \
  gtk_notebook_find_child (notebook, child, G_STRLOC)
@@ -283,6 +292,7 @@ static void gtk_notebook_set_tab_hborder
 							guint        tab_hborder);
 static void gtk_notebook_set_tab_vborder_internal      (GtkNotebook *notebook,
 							guint        tab_vborder);
+static void gtk_notebook_update_tab_states (GtkNotebook *notebook);
 
 static gboolean focus_tabs_in  (GtkNotebook      *notebook);
 static gboolean focus_child_in (GtkNotebook      *notebook,
@@ -290,7 +300,9 @@ static gboolean focus_child_in (GtkNoteb
 
 static void stop_scrolling (GtkNotebook *notebook);
 
-
+#define GTK_NOTEBOOK_GET_PRIVATE(o)  \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_NOTEBOOK, GtkNotebookPrivate))
+ 
 static GtkContainerClass *parent_class = NULL;
 static guint notebook_signals[LAST_SIGNAL] = { 0 };
 
@@ -688,11 +700,14 @@ gtk_notebook_class_init (GtkNotebookClas
 
   add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
   add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
+
+  g_type_class_add_private (gobject_class, sizeof (GtkNotebookPrivate)); 
 }
 
 static void
 gtk_notebook_init (GtkNotebook *notebook)
 {
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
   GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
   GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW);
 
@@ -722,6 +737,9 @@ gtk_notebook_init (GtkNotebook *notebook
   notebook->has_before_next     = 0;
   notebook->has_after_previous  = 0;
   notebook->has_after_next      = 1;
+
+  priv->x = -1;
+  priv->y = -1;
 }
 
 static gboolean
@@ -1156,7 +1174,8 @@ gtk_notebook_realize (GtkWidget *widget)
   attributes.height = event_window_pos.height;
   attributes.wclass = GDK_INPUT_ONLY;
   attributes.event_mask = gtk_widget_get_events (widget);
-  attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
+  attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+			    GDK_POINTER_MOTION_MASK |
 			    GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
 			    GDK_SCROLL_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y;
@@ -1520,6 +1539,8 @@ gtk_notebook_size_allocate (GtkWidget   
 
       gtk_notebook_pages_allocate (notebook);
     }
+
+  gtk_notebook_update_tab_states (notebook);
 }
 
 static gint
@@ -1743,6 +1764,9 @@ get_widget_coordinates (GtkWidget *widge
   GdkWindow *window = ((GdkEventAny *)event)->window;
   gdouble tx, ty;
 
+  *x = -1;
+  *y = -1;
+  
   if (!gdk_event_get_coords (event, &tx, &ty))
     return FALSE;
 
@@ -1769,6 +1793,17 @@ get_widget_coordinates (GtkWidget *widge
 }
 
 static gboolean
+point_in_tab (GtkNotebookPage *page, gint x, gint y)
+{
+  return (GTK_WIDGET_VISIBLE (page->child) &&
+	  page->tab_label && GTK_WIDGET_MAPPED (page->tab_label) &&
+	  (x >= page->allocation.x) &&
+	  (y >= page->allocation.y) &&
+	  (x <= (page->allocation.x + page->allocation.width - 1)) &&
+	  (y <= (page->allocation.y + page->allocation.height - 1)));
+}
+
+static gboolean
 gtk_notebook_scroll (GtkWidget      *widget,
                      GdkEventScroll *event)
 {
@@ -1839,13 +1874,8 @@ gtk_notebook_button_press (GtkWidget    
   while (children)
     {
       page = children->data;
-      
-      if (GTK_WIDGET_VISIBLE (page->child) &&
-	  page->tab_label && GTK_WIDGET_MAPPED (page->tab_label) &&
-	  (x >= page->allocation.x) &&
-	  (y >= page->allocation.y) &&
-	  (x <= (page->allocation.x + page->allocation.width)) &&
-	  (y <= (page->allocation.y + page->allocation.height)))
+
+      if (point_in_tab (page, x, y))
 	{
 	  gboolean page_changed = page != notebook->cur_page;
 	  gboolean was_focus = gtk_widget_is_focus (widget);
@@ -1909,17 +1939,19 @@ gtk_notebook_enter_notify (GtkWidget    
 {
   GtkNotebook *notebook;
   GtkNotebookArrow arrow;
-  gint x, y;
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (widget);
 
   g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
   notebook = GTK_NOTEBOOK (widget);
 
-  if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+  if (!get_widget_coordinates (widget, (GdkEvent *)event, &priv->x, &priv->y))
     return FALSE;
-
-  arrow = gtk_notebook_get_arrow (notebook, x, y);
+  
+  gtk_notebook_update_tab_states (notebook);
+  
+  arrow = gtk_notebook_get_arrow (notebook, priv->x, priv->y);
 
   if (arrow != notebook->in_child)
     {
@@ -1937,20 +1969,21 @@ gtk_notebook_leave_notify (GtkWidget    
 			   GdkEventCrossing *event)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookArrow arrow;
-  gint x, y;
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (widget);
 
-  if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+  if (!get_widget_coordinates (widget, (GdkEvent *)event, &priv->x, &priv->y))
     return FALSE;
 
-  arrow = gtk_notebook_get_arrow (notebook, x, y);
-
+  gtk_notebook_update_tab_states (notebook);
+  
   if (notebook->in_child)
     {
       notebook->in_child = 0;
       gtk_notebook_redraw_arrows (notebook);
     }
 
+  gtk_notebook_redraw_tabs (notebook);
+  
   return TRUE;
 }
 
@@ -1960,21 +1993,25 @@ gtk_notebook_motion_notify (GtkWidget   
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
   GtkNotebookArrow arrow;
-  gint x, y;
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (widget);
   
   if (notebook->button)
     return FALSE;
 
-  if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+  if (!get_widget_coordinates (widget, (GdkEvent *)event, &priv->x, &priv->y))
     return FALSE;
 
-  arrow = gtk_notebook_get_arrow (notebook, x, y);
+  gtk_notebook_update_tab_states (notebook);
+  
+  arrow = gtk_notebook_get_arrow (notebook, priv->x, priv->y);
 
   if (arrow != notebook->in_child)
     {
       notebook->in_child = arrow;
       gtk_notebook_redraw_arrows (notebook);
     }
+
+  gtk_notebook_redraw_tabs (notebook);
   
   return TRUE;
 }
@@ -3021,7 +3058,9 @@ gtk_notebook_draw_tab (GtkNotebook     *
 	  break;
 	}
       
-      if (notebook->cur_page == page)
+      if (page->prelight )
+	state_type = GTK_STATE_PRELIGHT;
+      else if (notebook->cur_page == page)
 	state_type = GTK_STATE_NORMAL;
       else 
 	state_type = GTK_STATE_ACTIVE;
@@ -3773,6 +3812,7 @@ gtk_notebook_calc_tabs (GtkNotebook  *no
 static void
 gtk_notebook_update_tab_states (GtkNotebook *notebook)
 {
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
   GList *list;
 
   for (list = notebook->children; list != NULL; list = list->next)
@@ -3781,12 +3821,25 @@ gtk_notebook_update_tab_states (GtkNoteb
       
       if (page->tab_label)
 	{
-	  if (page == notebook->cur_page)
-	    gtk_widget_set_state (page->tab_label, GTK_STATE_NORMAL);
+	  if (point_in_tab (page, priv->x, priv->y))
+	    {
+	      gtk_widget_set_state (page->tab_label, GTK_STATE_PRELIGHT);
+
+	      page->prelight = TRUE;
+	    }
 	  else
-	    gtk_widget_set_state (page->tab_label, GTK_STATE_ACTIVE);
+	    {
+	      if (page == notebook->cur_page)
+		gtk_widget_set_state (page->tab_label, GTK_STATE_NORMAL);
+	      else
+		gtk_widget_set_state (page->tab_label, GTK_STATE_ACTIVE);
+
+	      page->prelight = FALSE;
+	    }
 	}
     }
+
+  gtk_notebook_redraw_tabs (notebook);
 }
 
 /* Private GtkNotebook Page Switch Methods:
@@ -4407,6 +4460,8 @@ gtk_notebook_insert_page_menu (GtkNotebo
   gtk_widget_child_notify (child, "position");
   gtk_widget_thaw_child_notify (child);
 
+  gtk_notebook_update_tab_states (notebook);
+  
   return position;
 }
 
