Index: gtk/gtkstatusbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstatusbar.c,v
retrieving revision 1.35
diff -u -b -B -p -r1.35 gtkstatusbar.c
--- gtk/gtkstatusbar.c	3 Dec 2002 21:49:39 -0000	1.35
+++ gtk/gtkstatusbar.c	17 May 2003 22:13:33 -0000
@@ -445,10 +445,10 @@ get_grip_rect (GtkStatusbar *statusbar,
   w = 18;
   h = 18;
 
-  if (w > (widget->allocation.width))
+  if (w > widget->allocation.width)
     w = widget->allocation.width;
 
-  if (h > (widget->allocation.height - widget->style->ythickness))
+  if (h > widget->allocation.height - widget->style->ythickness)
     h = widget->allocation.height - widget->style->ythickness;
   
   rect->width = w;
@@ -459,6 +459,11 @@ get_grip_rect (GtkStatusbar *statusbar,
       rect->x = widget->allocation.x + widget->allocation.width - w;
   else 
       rect->x = widget->allocation.x + widget->style->xthickness;
+
+  g_print ("allocation: %d %d %d %d  rect: %d %d %d %d\n", 
+	   widget->allocation.x, widget->allocation.y, 
+	   widget->allocation.width, widget->allocation.height,
+	   rect->x, rect->y, rect->width, rect->height);
 }
 
 static void
@@ -640,19 +645,6 @@ gtk_statusbar_size_request   (GtkWidget 
   gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
   
   GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
-
-  if (statusbar->has_resize_grip)
-    {
-      GdkRectangle rect;
-
-      /* x, y in the grip rect depend on size allocation, but
-       * w, h do not so this is OK
-       */
-      get_grip_rect (statusbar, &rect);
-      
-      requisition->width += rect.width;
-      requisition->height = MAX (requisition->height, rect.height);
-    }
 }
 
 static void
@@ -663,30 +655,18 @@ gtk_statusbar_size_allocate  (GtkWidget 
   
   statusbar = GTK_STATUSBAR (widget);
 
-  if (statusbar->has_resize_grip)
+  /* chain up normally */
+  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+
+  if (statusbar->has_resize_grip && statusbar->grip_window)
     {
       GdkRectangle rect;
-      GtkRequisition saved_req;
       
-      widget->allocation = *allocation; /* get_grip_rect needs this info */
       get_grip_rect (statusbar, &rect);
   
-      if (statusbar->grip_window)
         gdk_window_move_resize (statusbar->grip_window,
                                 rect.x, rect.y,
                                 rect.width, rect.height);
-      
-      /* enter the bad hack zone */      
-      saved_req = widget->requisition;
-      widget->requisition.width -= rect.width; /* HBox::size_allocate needs this */
-      if (widget->requisition.width < 0)
-        widget->requisition.width = 0;
-      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
-      widget->requisition = saved_req;
-    }
-  else
-    {
-      /* chain up normally */
-      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
     }
 }
+
Index: gtk/gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.138
diff -u -b -B -p -r1.138 gtklabel.c
--- gtk/gtklabel.c	10 Dec 2002 12:02:43 -0000	1.138
+++ gtk/gtklabel.c	17 May 2003 22:13:34 -0000
@@ -1717,6 +1717,7 @@ gtk_label_draw_cursor (GtkLabel  *label,
       GtkTextDirection dir1 = GTK_TEXT_DIR_NONE;
       GtkTextDirection dir2 = GTK_TEXT_DIR_NONE;
       GdkGC *gc;
+      GdkRegion *clip;
 
       keymap_direction =
 	(gdk_keymap_get_direction (gdk_keymap_get_for_display (gtk_widget_get_display (widget))) == PANGO_DIRECTION_LTR) ?
@@ -1760,9 +1761,13 @@ gtk_label_draw_cursor (GtkLabel  *label,
       cursor_location.height = PANGO_PIXELS (cursor1->height);
 
       gc = _gtk_get_insertion_cursor_gc (widget, TRUE);
+      clip = gdk_region_rectangle (&widget->allocation);
+      gdk_gc_set_clip_region (gc, clip);
       _gtk_draw_insertion_cursor (widget, widget->window, gc,
 				  &cursor_location, dir1,
                                   dir2 != GTK_TEXT_DIR_NONE);
+      gdk_gc_set_clip_region (gc, NULL);
+      gdk_region_destroy (clip);	  
       g_object_unref (gc);
       
       if (dir2 != GTK_TEXT_DIR_NONE)
@@ -1773,8 +1778,12 @@ gtk_label_draw_cursor (GtkLabel  *label,
 	  cursor_location.height = PANGO_PIXELS (cursor2->height);
 
 	  gc = _gtk_get_insertion_cursor_gc (widget, FALSE);
+	  clip = gdk_region_rectangle (&widget->allocation);
+	  gdk_gc_set_clip_region (gc, clip);
 	  _gtk_draw_insertion_cursor (widget, widget->window, gc,
 				      &cursor_location, dir2, TRUE);
+	  gdk_gc_set_clip_region (gc, NULL);
+	  gdk_region_destroy (clip);	  
 	  g_object_unref (gc);
 	}
     }
@@ -1815,7 +1824,7 @@ gtk_label_expose (GtkWidget      *widget
            label->select_info->selection_end))
         {
           gint range[2];
-          GdkRegion *clip;
+          GdkRegion *clip, *area;
 	  GtkStateType state;
 	  
           range[0] = label->select_info->selection_anchor;
@@ -1833,6 +1842,10 @@ gtk_label_expose (GtkWidget      *widget
                                                    range,
                                                    1);
 
+	  area = gdk_region_rectangle (&event->area);
+	  gdk_region_intersect (clip, area);
+          gdk_region_destroy (area);	  
+	  
           /* FIXME should use gtk_paint, but it can't use a clip
            * region
            */
