Re: Some performance notes



Here is the patch.

Index: gdk/gdkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkwindow.c,v
retrieving revision 1.120
diff -u -r1.120 gdkwindow.c
--- gdk/gdkwindow.c	2001/07/18 20:09:27	1.120
+++ gdk/gdkwindow.c	2001/08/06 11:00:54
@@ -394,8 +394,6 @@
 gdk_window_set_user_data (GdkWindow *window,
 			  gpointer   user_data)
 {
-  g_return_if_fail (window != NULL);
-  
   ((GdkWindowObject*)window)->user_data = user_data;
 }
 
@@ -1897,6 +1895,17 @@
   return FALSE;
 }
 
+static void
+add_idle ()
+{
+  if (!update_idle)
+    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+				   gdk_window_update_idle, NULL, NULL);
+#if 0
+  gdk_window_process_all_updates ();
+#endif
+}
+
 /**
  * gdk_window_process_updates:
  * @window: a #GdkWindow
@@ -2033,10 +2042,24 @@
           /* Draw ugly color all over the newly-invalid region */
           GdkRectangle ugly_rect;
           GdkGC *ugly_gc;
-          GdkColor ugly_color = { 0, 60000, 10000, 10000 };
+          GdkColor ugly_color;
+
+	  if (!private->update_freeze_count)
+	    {
+	      ugly_color.pixel = 0;
+	      ugly_color.red = 60000;
+	      ugly_color.green = 10000;
+	      ugly_color.blue = 10000;
+	    }
+	  else
+	    {
+	      ugly_color.pixel = 0;
+	      ugly_color.red = 60000;
+	      ugly_color.green = 60000;
+	      ugly_color.blue = 5000;
+	    }
           
           ugly_gc = gdk_gc_new (window);
-
           gdk_gc_set_rgb_fg_color (ugly_gc, &ugly_color);
           
 	  gdk_region_get_clipbox (visible_region, &ugly_rect);
@@ -2059,9 +2082,8 @@
 	  update_windows = g_slist_prepend (update_windows, window);
 	  private->update_area = gdk_region_copy (visible_region);
 	  
-	  if (!private->update_freeze_count && !update_idle)
-	    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-					   gdk_window_update_idle, NULL, NULL);
+	  if (!private->update_freeze_count)
+	    add_idle();
 	}
       
       if (invalidate_children)
@@ -2176,9 +2198,8 @@
   g_return_if_fail (private->update_freeze_count > 0);
 
   private->update_freeze_count--;
-  if (!private->update_freeze_count && private->update_area && !update_idle)
-    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-				   gdk_window_update_idle, NULL, NULL);
+  if (!private->update_freeze_count)
+    add_idle();
 }
 
 /**
Index: gtk/gtkbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkbutton.c,v
retrieving revision 1.65
diff -u -r1.65 gtkbutton.c
--- gtk/gtkbutton.c	2001/07/18 23:39:21	1.65
+++ gtk/gtkbutton.c	2001/08/06 11:00:55
@@ -520,8 +520,8 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-  gdk_window_set_user_data (widget->window, button);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
+					     &attributes, attributes_mask);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
   gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
Index: gtk/gtkcalendar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcalendar.c,v
retrieving revision 1.35
diff -u -r1.35 gtkcalendar.c
--- gtk/gtkcalendar.c	2001/07/18 23:39:21	1.35
+++ gtk/gtkcalendar.c	2001/08/06 11:00:55
@@ -869,9 +869,11 @@
 			      - 3 - private_data->arrow_width);
 	      break;
 	    }
-	  private_data->arrow_win[i] = gdk_window_new (private_data->header_win,
-						       &attributes, 
-						       attributes_mask);
+	  private_data->arrow_win[i] =
+	    gtk_widget_create_window (widget,
+				      private_data->header_win,
+				      &attributes, 
+				      attributes_mask);
 	  private_data->arrow_state[i] = GTK_STATE_NORMAL;
 	  gdk_window_set_background (private_data->arrow_win[i],
 				     HEADER_BG_COLOR (GTK_WIDGET (calendar)));
@@ -912,8 +914,10 @@
       attributes.y = 2;
       attributes.width = widget->allocation.width - 4;
       attributes.height = private_data->header_h;
-      private_data->header_win = gdk_window_new (widget->window,
-					     &attributes, attributes_mask);
+      private_data->header_win =
+	gtk_widget_create_window (widget,
+				  widget->window,
+				  &attributes, attributes_mask);
       
       gdk_window_set_background (private_data->header_win,
 				 HEADER_BG_COLOR (GTK_WIDGET (calendar)));
@@ -957,7 +961,8 @@
 			  - (widget->style->xthickness + INNER_BORDER) 
 			  * 2);
       attributes.height = private_data->day_name_h;
-      private_data->day_name_win = gdk_window_new (widget->window,
+      private_data->day_name_win = gtk_widget_create_window (widget,
+						   widget->window,
 						   &attributes, 
 						   attributes_mask);
       gdk_window_set_background (private_data->day_name_win, 
@@ -999,8 +1004,9 @@
 		      + (widget->style->ythickness + INNER_BORDER));
       attributes.width = private_data->week_width;
       attributes.height = private_data->main_h;
-      private_data->week_win = gdk_window_new (widget->window,
-					       &attributes, attributes_mask);
+      private_data->week_win =
+	gtk_widget_create_window (widget, widget->window,
+				  &attributes, attributes_mask);
       gdk_window_set_background (private_data->week_win,  
 				 BACKGROUND_COLOR (GTK_WIDGET (calendar)));
       gdk_window_show (private_data->week_win);
@@ -1041,8 +1047,9 @@
   attributes.colormap = gtk_widget_get_colormap (widget);
   
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (widget->parent->window,
-				   &attributes, attributes_mask);
+  widget->window =
+    gtk_widget_create_window (widget, widget->parent->window,
+			      &attributes, attributes_mask);
   
   widget->style = gtk_style_attach (widget->style, widget->window);
   
@@ -1067,8 +1074,9 @@
   attributes.width = (widget->allocation.width - attributes.x 
 		      - (widget->style->xthickness + INNER_BORDER));
   attributes.height = private_data->main_h;
-  private_data->main_win = gdk_window_new (widget->window,
-					   &attributes, attributes_mask);
+  private_data->main_win =
+      gtk_widget_create_window (widget, widget->window,
+				&attributes, attributes_mask);
   gdk_window_set_background (private_data->main_win, 
 			     BACKGROUND_COLOR ( GTK_WIDGET ( calendar)));
   gdk_window_show (private_data->main_win);
Index: gtk/gtkcheckbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcheckbutton.c,v
retrieving revision 1.32
diff -u -r1.32 gtkcheckbutton.c
--- gtk/gtkcheckbutton.c	2001/07/18 23:39:21	1.32
+++ gtk/gtkcheckbutton.c	2001/08/06 11:00:55
@@ -381,11 +381,9 @@
   GtkShadowType shadow_type;
   GdkRectangle restrict_area;
   GdkRectangle new_area;
-  gint width, height;
   gint x, y;
   gint indicator_size;
   gint indicator_spacing;
-  GdkWindow *window;
   
   g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
   
@@ -394,57 +392,53 @@
   
   if (GTK_WIDGET_DRAWABLE (check_button))
     {
-      window = widget->window;
-      
       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
 						    
-      state_type = GTK_WIDGET_STATE (widget);
-      if (state_type != GTK_STATE_NORMAL &&
-	  state_type != GTK_STATE_PRELIGHT)
-	state_type = GTK_STATE_NORMAL;
-      
-      restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
-      restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
-      restrict_area.width = widget->allocation.width - ( 2 * GTK_CONTAINER (widget)->border_width);
-      restrict_area.height = widget->allocation.height - ( 2 * GTK_CONTAINER (widget)->border_width);
-      
-      if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
+      if (GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
 	{
-	  if (state_type != GTK_STATE_NORMAL)
-	    gtk_paint_flat_box (widget->style, window, state_type, 
-				GTK_SHADOW_ETCHED_OUT, 
-				area, widget, "checkbutton",
-				new_area.x, new_area.y,
-				new_area.width, new_area.height);
+	  restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
+	  restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
+	  restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
+	  restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
+
+	  if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
+	    {
+	      gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
+				  GTK_SHADOW_ETCHED_OUT, 
+				  area, widget, "checkbutton",
+				  new_area.x, new_area.y,
+				  new_area.width, new_area.height);
+	    }
 	}
       
       x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
       y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
-      width = indicator_size;
-      height = indicator_size;
 
-      if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
+      if (toggle_button->inconsistent)
         {
-          state_type = GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE ? GTK_STATE_NORMAL : GTK_WIDGET_STATE (widget);
-          shadow_type = GTK_SHADOW_ETCHED_IN;
+          shadow_type = GTK_SHADOW_OUT;
+	  state_type = GTK_STATE_ACTIVE;
         }
-      else if (GTK_TOGGLE_BUTTON (widget)->active)
+      else if (toggle_button->active)
 	{
-	  state_type = GTK_STATE_ACTIVE;
 	  shadow_type = GTK_SHADOW_IN;
+	  if (GTK_WIDGET_STATE (widget) == GTK_STATE_NORMAL)
+	    state_type = GTK_STATE_ACTIVE;
+	  else
+	    state_type = GTK_STATE_NORMAL;
 	}
       else
 	{
 	  shadow_type = GTK_SHADOW_OUT;
 	  state_type = GTK_WIDGET_STATE (widget);
 	}
-
+      
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-	x = widget->allocation.x + widget->allocation.width - (width + x - widget->allocation.x);
-
-      gtk_paint_check (widget->style, window,
+	x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
+      
+      gtk_paint_check (widget->style, widget->window,
 		       state_type, shadow_type,
 		       area, widget, "checkbutton",
-		       x, y, width, height);
+		       x, y, indicator_size, indicator_size);
     }
 }
Index: gtk/gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.200
diff -u -r1.200 gtkclist.c
--- gtk/gtkclist.c	2001/07/18 23:39:21	1.200
+++ gtk/gtkclist.c	2001/08/06 11:00:55
@@ -4477,8 +4477,8 @@
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
   /* main window */
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-				   &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
+					     &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, clist);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
@@ -4492,8 +4492,8 @@
   attributes.width = clist->column_title_area.width;
   attributes.height = clist->column_title_area.height;
   
-  clist->title_window = gdk_window_new (widget->window, &attributes,
-					attributes_mask);
+  clist->title_window = gtk_widget_create_window (widget, widget->window, &attributes,
+						  attributes_mask);
   gdk_window_set_user_data (clist->title_window, clist);
 
   gtk_style_set_background (widget->style, clist->title_window,
@@ -4515,8 +4515,8 @@
   attributes.width = clist->clist_window_width;
   attributes.height = clist->clist_window_height;
   
-  clist->clist_window = gdk_window_new (widget->window, &attributes,
-					attributes_mask);
+  clist->clist_window = gtk_widget_create_window (widget, widget->window, &attributes,
+						  attributes_mask);
   gdk_window_set_user_data (clist->clist_window, clist);
 
   gdk_window_set_background (clist->clist_window,
@@ -4542,8 +4542,8 @@
 
   for (i = 0; i < clist->columns; i++)
     {
-      clist->column[i].window = gdk_window_new (clist->title_window,
-						&attributes, attributes_mask);
+      clist->column[i].window = gtk_widget_create_window (widget, clist->title_window,
+							  &attributes, attributes_mask);
       gdk_window_set_user_data (clist->column[i].window, clist);
     }
 
Index: gtk/gtkcontainer.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcontainer.c,v
retrieving revision 1.85
diff -u -r1.85 gtkcontainer.c
--- gtk/gtkcontainer.c	2001/07/20 18:05:32	1.85
+++ gtk/gtkcontainer.c	2001/08/06 11:00:56
@@ -1059,6 +1059,7 @@
 	  switch (resize_container->resize_mode)
 	    {
 	    case GTK_RESIZE_QUEUE:
+#if 0
 	      if (!GTK_CONTAINER_RESIZE_PENDING (resize_container))
 		{
 		  GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
@@ -1072,6 +1073,11 @@
 	      GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_NEEDED);
 	      resize_container->resize_widgets =
 		g_slist_prepend (resize_container->resize_widgets, container);
+#endif
+	      GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_NEEDED);
+	      resize_container->resize_widgets =
+		g_slist_prepend (resize_container->resize_widgets, container);
+	      gtk_container_check_resize (resize_container);
 	      break;
 
 	    case GTK_RESIZE_IMMEDIATE:
Index: gtk/gtkdrawingarea.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdrawingarea.c,v
retrieving revision 1.17
diff -u -r1.17 gtkdrawingarea.c
--- gtk/gtkdrawingarea.c	2001/07/18 23:39:22	1.17
+++ gtk/gtkdrawingarea.c	2001/08/06 11:00:56
@@ -119,7 +119,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, darea);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.146
diff -u -r1.146 gtkentry.c
--- gtk/gtkentry.c	2001/07/19 18:47:03	1.146
+++ gtk/gtkentry.c	2001/08/06 11:00:57
@@ -966,7 +966,7 @@
 			    GDK_LEAVE_NOTIFY_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, entry);
 
   if (entry->has_frame)
@@ -985,7 +985,7 @@
   attributes.cursor = gdk_cursor_new (GDK_XTERM);
   attributes_mask |= GDK_WA_CURSOR;
 
-  entry->text_area = gdk_window_new (widget->window, &attributes, attributes_mask);
+  entry->text_area = gtk_widget_create_window (widget, widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (entry->text_area, entry);
 
   gdk_cursor_destroy (attributes.cursor);
Index: gtk/gtkeventbox.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkeventbox.c,v
retrieving revision 1.22
diff -u -r1.22 gtkeventbox.c
--- gtk/gtkeventbox.c	2001/07/18 23:39:22	1.22
+++ gtk/gtkeventbox.c	2001/08/06 11:00:57
@@ -126,7 +126,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkfixed.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfixed.c,v
retrieving revision 1.27
diff -u -r1.27 gtkfixed.c
--- gtk/gtkfixed.c	2001/07/19 14:57:11	1.27
+++ gtk/gtkfixed.c	2001/08/06 11:00:57
@@ -194,7 +194,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, 
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, 
 				   attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
Index: gtk/gtkhandlebox.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhandlebox.c,v
retrieving revision 1.81
diff -u -r1.81 gtkhandlebox.c
--- gtk/gtkhandlebox.c	2001/07/18 23:39:22	1.81
+++ gtk/gtkhandlebox.c	2001/08/06 11:00:57
@@ -398,7 +398,7 @@
   attributes.event_mask = (gtk_widget_get_events (widget)
 			   | GDK_EXPOSURE_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   attributes.x = 0;
@@ -413,7 +413,7 @@
 			    GDK_BUTTON_PRESS_MASK |
 			    GDK_BUTTON_RELEASE_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  hb->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask);
+  hb->bin_window = gtk_widget_create_window (widget, widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (hb->bin_window, widget);
   if (GTK_BIN (hb)->child)
     gtk_widget_set_parent_window (GTK_BIN (hb)->child, hb->bin_window);
@@ -433,7 +433,7 @@
 			   GDK_FOCUS_CHANGE_MASK |
 			   GDK_STRUCTURE_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  hb->float_window = gdk_window_new (NULL, &attributes, attributes_mask);
+  hb->float_window = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
   gdk_window_set_user_data (hb->float_window, widget);
   gdk_window_set_decorations (hb->float_window, 0);
   gdk_window_set_type_hint (hb->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
Index: gtk/gtkhpaned.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhpaned.c,v
retrieving revision 1.31
diff -u -r1.31 gtkhpaned.c
--- gtk/gtkhpaned.c	2001/07/18 23:39:22	1.31
+++ gtk/gtkhpaned.c	2001/08/06 11:00:57
@@ -315,6 +315,19 @@
 		 widget->allocation.height - 1);
 }
 
+static void
+gtk_hpaned_update_position (GtkPaned *paned)
+{
+  GObject *object = G_OBJECT (paned);
+
+  paned->position_set = TRUE;
+  g_object_freeze_notify (object);
+  g_object_notify (object, "position");
+  g_object_notify (object, "position_set");
+  g_object_thaw_notify (object);
+  gtk_widget_queue_resize (GTK_WIDGET (paned));
+}
+
 static gboolean
 gtk_hpaned_button_press (GtkWidget      *widget,
 			 GdkEventButton *event)
@@ -327,6 +340,10 @@
   if (!paned->in_drag &&
       event->window == paned->handle && event->button == 1)
     {
+      gboolean opaque_resize;
+
+      gtk_widget_style_get (widget, "opaque_resize", &opaque_resize, NULL);
+      
       paned->in_drag = TRUE;
       /* We need a server grab here, not gtk_grab_add(), since
        * we don't want to pass events on to the widget's children */
@@ -340,7 +357,8 @@
 				  widget->allocation.width
 				  - handle_size
 				  - 2 * GTK_CONTAINER (paned)->border_width);
-      gtk_hpaned_xor_line (paned);
+      if (!opaque_resize)
+	gtk_hpaned_xor_line (paned);
 
       return TRUE;
     }
@@ -353,19 +371,19 @@
 			   GdkEventButton *event)
 {
   GtkPaned *paned = GTK_PANED (widget);
-  GObject *object = G_OBJECT (widget);
 
   if (paned->in_drag && (event->button == 1))
     {
-      gtk_hpaned_xor_line (paned);
+      gboolean opaque_resize;
+
+      gtk_widget_style_get (widget, "opaque_resize", &opaque_resize, NULL);
+      if (!opaque_resize)
+	gtk_hpaned_xor_line (paned);
+
       paned->in_drag = FALSE;
-      paned->position_set = TRUE;
       gdk_pointer_ungrab (event->time);
-      gtk_widget_queue_resize (GTK_WIDGET (paned));
-      g_object_freeze_notify (object);
-      g_object_notify (object, "position");
-      g_object_notify (object, "position_set");
-      g_object_thaw_notify (object);
+
+      gtk_hpaned_update_position (paned);
   
       return TRUE;
     }
@@ -380,11 +398,15 @@
   GtkPaned *paned = GTK_PANED (widget);
   gint x;
   gint handle_size;
+  gboolean opaque_resize;
 
-  gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
+  gtk_widget_style_get (widget,
+			"handle_size", &handle_size,
+			"opaque_resize", &opaque_resize,
+			NULL);
 
   if (event->is_hint || event->window != widget->window)
-    gtk_widget_get_pointer(widget, &x, NULL);
+    gtk_widget_get_pointer (widget, &x, NULL);
   else
     x = event->x;
 
@@ -392,9 +414,13 @@
     {
       gint size = x - GTK_CONTAINER (paned)->border_width - handle_size / 2;
 
-      gtk_hpaned_xor_line (paned);
+      if (!opaque_resize)
+	gtk_hpaned_xor_line (paned);
       paned->child1_size = CLAMP (size, paned->min_position, paned->max_position);
-      gtk_hpaned_xor_line (paned);
+      if (opaque_resize)
+	gtk_hpaned_update_position (paned);
+      else
+	gtk_hpaned_xor_line (paned);
     }
 
   return TRUE;
Index: gtk/gtkhsv.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhsv.c,v
retrieving revision 1.14
diff -u -r1.14 gtkhsv.c
--- gtk/gtkhsv.c	2001/07/19 14:57:12	1.14
+++ gtk/gtkhsv.c	2001/08/06 11:00:57
@@ -299,7 +299,7 @@
   widget->window = parent_window;
   gdk_window_ref (widget->window);
   
-  priv->window = gdk_window_new (parent_window, &attr, attr_mask);
+  priv->window = gtk_widget_create_window (widget, parent_window, &attr, attr_mask);
   gdk_window_set_user_data (priv->window, hsv);
   
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkinvisible.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkinvisible.c,v
retrieving revision 1.11
diff -u -r1.11 gtkinvisible.c
--- gtk/gtkinvisible.c	2001/07/18 23:39:22	1.11
+++ gtk/gtkinvisible.c	2001/08/06 11:00:57
@@ -134,7 +134,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
 
-  widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
   
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkitem.c,v
retrieving revision 1.23
diff -u -r1.23 gtkitem.c
--- gtk/gtkitem.c	2001/07/19 14:57:12	1.23
+++ gtk/gtkitem.c	2001/08/06 11:00:58
@@ -167,7 +167,7 @@
 			   GDK_POINTER_MOTION_MASK);
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.97
diff -u -r1.97 gtklabel.c
--- gtk/gtklabel.c	2001/07/18 23:39:22	1.97
+++ gtk/gtklabel.c	2001/08/06 11:00:58
@@ -1906,7 +1906,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
 
-  label->select_info->window = gdk_window_new (widget->window,
+  label->select_info->window = gtk_widget_create_window (widget, widget->window,
                                                &attributes, attributes_mask);
   gdk_window_set_user_data (label->select_info->window, widget);  
 }
Index: gtk/gtklayout.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklayout.c,v
retrieving revision 1.41
diff -u -r1.41 gtklayout.c
--- gtk/gtklayout.c	2001/07/19 14:57:12	1.41
+++ gtk/gtklayout.c	2001/08/06 11:00:58
@@ -577,7 +577,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
@@ -588,7 +588,7 @@
   attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | 
                           gtk_widget_get_events (widget);
 
-  layout->bin_window = gdk_window_new (widget->window,
+  layout->bin_window = gtk_widget_create_window (widget, widget->window,
 					&attributes, attributes_mask);
   gdk_window_set_user_data (layout->bin_window, widget);
 
Index: gtk/gtklist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklist.c,v
retrieving revision 1.63
diff -u -r1.63 gtklist.c
--- gtk/gtklist.c	2001/07/19 14:57:12	1.63
+++ gtk/gtklist.c	2001/08/06 11:00:58
@@ -466,7 +466,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
Index: gtk/gtklistitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklistitem.c,v
retrieving revision 1.30
diff -u -r1.30 gtklistitem.c
--- gtk/gtklistitem.c	2001/07/18 23:39:22	1.30
+++ gtk/gtklistitem.c	2001/08/06 11:00:58
@@ -442,7 +442,7 @@
 			   GDK_LEAVE_NOTIFY_MASK);
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkmenu.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenu.c,v
retrieving revision 1.70
diff -u -r1.70 gtkmenu.c
--- gtk/gtkmenu.c	2001/07/25 13:36:02	1.70
+++ gtk/gtkmenu.c	2001/08/06 11:00:58
@@ -1012,7 +1012,7 @@
 			    GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );
   
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
   
   border_width = GTK_CONTAINER (widget)->border_width;
@@ -1030,14 +1030,14 @@
   if (menu->lower_arrow_visible)
     attributes.height -= MENU_SCROLL_ARROW_HEIGHT;
 
-  menu->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
+  menu->view_window = gtk_widget_create_window (widget, widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (menu->view_window, menu);
 
   attributes.x = 0;
   attributes.y = 0;
   attributes.height = MAX (1, widget->requisition.height - (border_width + widget->style->ythickness) * 2);
   
-  menu->bin_window = gdk_window_new (menu->view_window, &attributes, attributes_mask);
+  menu->bin_window = gtk_widget_create_window (widget, menu->view_window, &attributes, attributes_mask);
   gdk_window_set_user_data (menu->bin_window, menu);
 
   children = GTK_MENU_SHELL (menu)->children;
Index: gtk/gtkmenushell.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenushell.c,v
retrieving revision 1.46
diff -u -r1.46 gtkmenushell.c
--- gtk/gtkmenushell.c	2001/07/25 13:36:02	1.46
+++ gtk/gtkmenushell.c	2001/08/06 11:00:58
@@ -372,7 +372,7 @@
 			    GDK_LEAVE_NOTIFY_MASK);
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkmisc.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmisc.c,v
retrieving revision 1.23
diff -u -r1.23 gtkmisc.c
--- gtk/gtkmisc.c	2001/07/18 23:39:22	1.23
+++ gtk/gtkmisc.c	2001/08/06 11:00:58
@@ -352,7 +352,7 @@
       attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+      widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
       gdk_window_set_user_data (widget->window, widget);
 
       widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtknotebook.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtknotebook.c,v
retrieving revision 1.97
diff -u -r1.97 gtknotebook.c
--- gtk/gtknotebook.c	2001/07/31 21:23:19	1.97
+++ gtk/gtknotebook.c	2001/08/06 11:00:58
@@ -775,7 +775,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, notebook);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
@@ -1885,7 +1885,7 @@
     attributes.x = (widget->allocation.x +
 		    GTK_CONTAINER (notebook)->border_width);
 
-  notebook->panel = gdk_window_new (widget->window, &attributes, 
+  notebook->panel = gtk_widget_create_window (widget, widget->window, &attributes, 
 				    attributes_mask);
   gtk_style_set_background (widget->style, notebook->panel, 
 			    GTK_STATE_NORMAL);
Index: gtk/gtkpaned.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpaned.c,v
retrieving revision 1.37
diff -u -r1.37 gtkpaned.c
--- gtk/gtkpaned.c	2001/07/19 14:57:13	1.37
+++ gtk/gtkpaned.c	2001/08/06 11:00:59
@@ -135,6 +135,12 @@
 							     G_MAXINT,
 							     5,
 							     G_PARAM_READABLE));
+  gtk_widget_class_install_style_property (widget_class,
+					   g_param_spec_boolean ("opaque_resize",
+								 _("Opaque resizing"),
+								 _("Whether the paned widgets are resized opaquely"),
+								 TRUE,
+								 G_PARAM_READABLE));
 }
 
 static GtkType
@@ -235,7 +241,7 @@
   attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window(widget),
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window(widget),
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, paned);
 
@@ -250,7 +256,7 @@
 			    GDK_POINTER_MOTION_HINT_MASK);
   attributes_mask |= GDK_WA_CURSOR;
 
-  paned->handle = gdk_window_new (widget->window,
+  paned->handle = gtk_widget_create_window (widget, widget->window,
 				  &attributes, attributes_mask);
   gdk_window_set_user_data (paned->handle, paned);
   gdk_cursor_destroy (attributes.cursor);
@@ -292,8 +298,6 @@
   if (GTK_WIDGET_CLASS (parent_class)->unrealize)
     (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
 }
-
-
 
 static gint
 gtk_paned_expose (GtkWidget      *widget,
Index: gtk/gtkplug.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkplug.c,v
retrieving revision 1.31
diff -u -r1.31 gtkplug.c
--- gtk/gtkplug.c	2001/07/25 13:36:02	1.31
+++ gtk/gtkplug.c	2001/08/06 11:00:59
@@ -422,7 +422,7 @@
       attributes.window_type = GDK_WINDOW_TOPLEVEL;
 
       gdk_error_trap_push ();
-      widget->window = gdk_window_new (plug->socket_window, 
+      widget->window = gtk_widget_create_window (widget, plug->socket_window, 
 				       &attributes, attributes_mask);
       gdk_flush ();
       if (gdk_error_trap_pop ()) /* Uh-oh */
@@ -431,7 +431,7 @@
 	  gdk_window_destroy (widget->window);
 	  gdk_flush ();
 	  gdk_error_trap_pop ();
-	  widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
+	  widget->window = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
 	}
       
       gdk_window_add_filter (widget->window, gtk_plug_filter_func, widget);
@@ -442,7 +442,7 @@
       xembed_set_info (widget->window, 0);
     }
   else
-    widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);      
+    widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);      
   
   gdk_window_set_user_data (widget->window, window);
 
Index: gtk/gtkpreview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpreview.c,v
retrieving revision 1.36
diff -u -r1.36 gtkpreview.c
--- gtk/gtkpreview.c	2001/07/18 23:39:23	1.36
+++ gtk/gtkpreview.c	2001/08/06 11:00:59
@@ -496,7 +496,7 @@
   attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkprogress.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkprogress.c,v
retrieving revision 1.15
diff -u -r1.15 gtkprogress.c
--- gtk/gtkprogress.c	2001/07/18 23:39:23	1.15
+++ gtk/gtkprogress.c	2001/08/06 11:00:59
@@ -254,7 +254,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, progress);
 
Index: gtk/gtkradiobutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkradiobutton.c,v
retrieving revision 1.28
diff -u -r1.28 gtkradiobutton.c
--- gtk/gtkradiobutton.c	2001/07/18 23:39:23	1.28
+++ gtk/gtkradiobutton.c	2001/08/06 11:00:59
@@ -415,7 +415,6 @@
 				 GdkRectangle   *area)
 {
   GtkWidget *widget;
-  GtkButton *button;
   GtkToggleButton *toggle_button;
   GtkStateType state_type;
   GtkShadowType shadow_type;
@@ -426,50 +425,57 @@
 
   g_return_if_fail (GTK_IS_RADIO_BUTTON (check_button));
 
-  if (GTK_WIDGET_VISIBLE (check_button) && GTK_WIDGET_MAPPED (check_button))
-    {
-      widget = GTK_WIDGET (check_button);
-      button = GTK_BUTTON (check_button);
-      toggle_button = GTK_TOGGLE_BUTTON (check_button);
-
-      state_type = GTK_WIDGET_STATE (widget);
-      if ((state_type != GTK_STATE_NORMAL) &&
-	  (state_type != GTK_STATE_PRELIGHT))
-	state_type = GTK_STATE_NORMAL;
+  widget = GTK_WIDGET (check_button);
+  toggle_button = GTK_TOGGLE_BUTTON (check_button);
 
+  if (GTK_WIDGET_DRAWABLE (check_button))
+    {
       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
-
-      restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
-      restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
-      restrict_area.width = widget->allocation.width - ( 2 * GTK_CONTAINER (widget)->border_width);
-      restrict_area.height = widget->allocation.height - ( 2 * GTK_CONTAINER (widget)->border_width);
 
-      if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
+      if (GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT)
 	{
-	   if (state_type != GTK_STATE_NORMAL)
-	     gtk_paint_flat_box(widget->style, widget->window, state_type, 
-				GTK_SHADOW_ETCHED_OUT,
-				area, widget, "radiobutton",
-				new_area.x, new_area.y,
-				new_area.width, new_area.height);
+	  restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
+	  restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
+	  restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
+	  restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
+
+	  if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
+	    {
+	      gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
+				  GTK_SHADOW_ETCHED_OUT,
+				  area, widget, "radiobutton",
+				  new_area.x, new_area.y,
+				  new_area.width, new_area.height);
+	    }
 	}
       
       x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
       y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
-      
-      if (GTK_TOGGLE_BUTTON (widget)->active)
-	shadow_type = GTK_SHADOW_IN;
-      else
-	shadow_type = GTK_SHADOW_OUT;
 
-      if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
-        shadow_type = GTK_SHADOW_ETCHED_IN;
+      if (toggle_button->inconsistent)
+	{
+	  shadow_type = GTK_SHADOW_OUT;
+	  state_type = GTK_STATE_ACTIVE;
+	}
+      else if (toggle_button->active)
+	{
+	  shadow_type = GTK_SHADOW_IN;
+	  if (GTK_WIDGET_STATE (widget) == GTK_STATE_NORMAL)
+	    state_type = GTK_STATE_ACTIVE;
+	  else
+	    state_type = GTK_STATE_NORMAL;
+	}
+      else
+	{
+	  shadow_type = GTK_SHADOW_OUT;
+	  state_type = GTK_WIDGET_STATE (widget);
+	}
       
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
 	x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
 
       gtk_paint_option (widget->style, widget->window,
-			GTK_WIDGET_STATE (widget), shadow_type,
+			state_type, shadow_type,
 			area, widget, "radiobutton",
 			x, y, indicator_size, indicator_size);
     }
Index: gtk/gtkrange.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
retrieving revision 1.65
diff -u -r1.65 gtkrange.c
--- gtk/gtkrange.c	2001/07/18 23:39:23	1.65
+++ gtk/gtkrange.c	2001/08/06 11:00:59
@@ -757,7 +757,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, range);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtkruler.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkruler.c,v
retrieving revision 1.23
diff -u -r1.23 gtkruler.c
--- gtk/gtkruler.c	2001/07/18 23:39:23	1.23
+++ gtk/gtkruler.c	2001/08/06 11:00:59
@@ -373,7 +373,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, ruler);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtksocket.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksocket.c,v
retrieving revision 1.30
diff -u -r1.30 gtksocket.c
--- gtk/gtksocket.c	2001/07/18 23:39:23	1.30
+++ gtk/gtksocket.c	2001/08/06 11:00:59
@@ -309,7 +309,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), 
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), 
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, socket);
 
Index: gtk/gtkspinbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkspinbutton.c,v
retrieving revision 1.69
diff -u -r1.69 gtkspinbutton.c
--- gtk/gtkspinbutton.c	2001/07/18 23:39:23	1.69
+++ gtk/gtkspinbutton.c	2001/08/06 11:01:00
@@ -490,7 +490,7 @@
   attributes.width = ARROW_SIZE + 2 * widget->style->xthickness;
   attributes.height = widget->requisition.height;
   
-  spin_button->panel = gdk_window_new (gtk_widget_get_parent_window (widget), 
+  spin_button->panel = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), 
 				       &attributes, attributes_mask);
   gdk_window_set_user_data (spin_button->panel, widget);
 
Index: gtk/gtkstatusbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstatusbar.c,v
retrieving revision 1.30
diff -u -r1.30 gtkstatusbar.c
--- gtk/gtkstatusbar.c	2001/07/18 23:39:23	1.30
+++ gtk/gtkstatusbar.c	2001/08/06 11:01:00
@@ -466,7 +466,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y;
 
-  statusbar->grip_window = gdk_window_new (widget->window,
+  statusbar->grip_window = gtk_widget_create_window (widget, widget->window,
                                            &attributes, attributes_mask);
   gdk_window_set_user_data (statusbar->grip_window, widget);
 }
Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.71
diff -u -r1.71 gtkstyle.c
--- gtk/gtkstyle.c	2001/08/04 13:17:32	1.71
+++ gtk/gtkstyle.c	2001/08/06 11:01:00
@@ -332,7 +332,6 @@
   RADIO_BLACK,
   RADIO_DARK,
   RADIO_LIGHT,
-  RADIO_MID,
   RADIO_TEXT
 } IndicatorPart;
 
@@ -359,19 +358,16 @@
  0x00,0x60,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 static char radio_base_bits[] = {
  0x00,0x00,0x00,0x00,0xf0,0x01,0xf8,0x03,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,
- 0x07,0xfc,0x07,0xf8,0x03,0xf0,0x01,0x00,0x00,0x00,0x00};
+ 0x07,0xfc,0x03,0xf8,0x03,0xf0,0x00,0x00,0x00,0x00,0x00};
 static char radio_black_bits[] = {
- 0x00,0x00,0xf0,0x01,0x08,0x02,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,
+ 0x00,0x00,0xf0,0x01,0x0c,0x02,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,
  0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 static char radio_dark_bits[] = {
- 0xf0,0x01,0x08,0x02,0x04,0x04,0x02,0x04,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
- 0x00,0x01,0x00,0x02,0x00,0x0c,0x00,0x00,0x00,0x00,0x00};
+ 0xf0,0x00,0x0c,0x02,0x02,0x04,0x02,0x04,0x01,0x08,0x01,0x08,0x01,0x08,0x01,
+ 0x08,0x00,0x04,0x02,0x04,0x0c,0x03,0xf0,0x00,0x00,0x00};
 static char radio_light_bits[] = {
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
- 0x10,0x00,0x10,0x00,0x08,0x00,0x04,0x08,0x02,0xf0,0x01};
-static char radio_mid_bits[] = {
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,
- 0x08,0x00,0x08,0x00,0x04,0x00,0x02,0xf0,0x01,0x00,0x00};
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
+ 0x10,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x03,0xf0,0x00};
 static char radio_text_bits[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0xf0,0x01,0xf0,0x01,0xf0,
  0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
@@ -391,7 +387,6 @@
   { radio_black_bits, NULL },
   { radio_dark_bits, NULL },
   { radio_light_bits, NULL },
-  { radio_mid_bits, NULL },
   { radio_text_bits, NULL }
 };
 
@@ -3079,7 +3074,11 @@
 	  draw_part (window, style->dark_gc[state_type], area, x, y, CHECK_DARK);
 	  draw_part (window, style->mid_gc[state_type], area, x, y, CHECK_MID);
 	  draw_part (window, style->light_gc[state_type], area, x, y, CHECK_LIGHT);
-	  draw_part (window, style->base_gc[state_type], area, x, y, CHECK_BASE);
+
+	  if (state_type == GTK_STATE_ACTIVE)
+	    draw_part (window, style->bg_gc[state_type], area, x, y, CHECK_BASE);
+	  else
+	    draw_part (window, style->base_gc[state_type], area, x, y, CHECK_BASE);
 	  
 	  if (shadow_type == GTK_SHADOW_IN)
 	    {
@@ -3140,9 +3139,12 @@
 	{
 	  draw_part (window, style->black_gc, area, x, y, RADIO_BLACK);
 	  draw_part (window, style->dark_gc[state_type], area, x, y, RADIO_DARK);
-	  draw_part (window, style->mid_gc[state_type], area, x, y, RADIO_MID);
 	  draw_part (window, style->light_gc[state_type], area, x, y, RADIO_LIGHT);
-	  draw_part (window, style->base_gc[state_type], area, x, y, RADIO_BASE);
+
+	  if (state_type == GTK_STATE_ACTIVE)
+	    draw_part (window, style->bg_gc[state_type], area, x, y, RADIO_BASE);
+	  else
+	    draw_part (window, style->base_gc[state_type], area, x, y, RADIO_BASE);
 	  
 	  if (shadow_type == GTK_SHADOW_IN)
 	    draw_part (window, style->text_gc[state_type], area, x, y, RADIO_TEXT);
Index: gtk/gtktext.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.c,v
retrieving revision 1.104
diff -u -r1.104 gtktext.c
--- gtk/gtktext.c	2001/07/18 23:39:23	1.104
+++ gtk/gtktext.c	2001/08/06 11:01:00
@@ -1318,7 +1318,7 @@
 			    GDK_KEY_PRESS_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, text);
   
   attributes.x = (widget->style->xthickness + TEXT_BORDER_ROOM);
@@ -1329,7 +1329,7 @@
   attributes.cursor = gdk_cursor_new (GDK_XTERM);
   attributes_mask |= GDK_WA_CURSOR;
   
-  text->text_area = gdk_window_new (widget->window, &attributes, attributes_mask);
+  text->text_area = gtk_widget_create_window (widget, widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (text->text_area, text);
 
   gdk_cursor_destroy (attributes.cursor); /* The X server will keep it around as long as necessary */
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.104
diff -u -r1.104 gtktextview.c
--- gtk/gtktextview.c	2001/07/19 14:57:13	1.104
+++ gtk/gtktextview.c	2001/08/06 11:01:01
@@ -2900,8 +2900,8 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                                   &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
+					     &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
   /* must come before text_window_realize calls */
@@ -5418,9 +5418,9 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  win->window = gdk_window_new (parent,
-                                &attributes,
-                                attributes_mask);
+  win->window = gtk_widget_create_window (win, parent,
+					  &attributes,
+					  attributes_mask);
 
   gdk_window_show (win->window);
   gdk_window_set_user_data (win->window, win->widget);
@@ -5438,9 +5438,9 @@
                            GDK_POINTER_MOTION_HINT_MASK |
                            gtk_widget_get_events (win->widget));
 
-  win->bin_window = gdk_window_new (win->window,
-                                    &attributes,
-                                    attributes_mask);
+  win->bin_window = gtk_widget_create_window (win, win->window,
+					      &attributes,
+					      attributes_mask);
 
   gdk_window_show (win->bin_window);
   gdk_window_set_user_data (win->bin_window, win->widget);
Index: gtk/gtktogglebutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktogglebutton.c,v
retrieving revision 1.39
diff -u -r1.39 gtktogglebutton.c
--- gtk/gtktogglebutton.c	2001/07/18 23:39:23	1.39
+++ gtk/gtktogglebutton.c	2001/08/06 11:01:01
@@ -702,7 +702,7 @@
       widget->window = gtk_widget_get_parent_window (widget);
       gdk_window_ref (widget->window);
       
-      toggle_button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
+      toggle_button->event_window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 						    &attributes, attributes_mask);
       gdk_window_set_user_data (toggle_button->event_window, toggle_button);
     }
@@ -712,7 +712,7 @@
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
       attributes.visual = gtk_widget_get_visual (widget);
       attributes.colormap = gtk_widget_get_colormap (widget);
-      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+      widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 				       &attributes, attributes_mask);
       gdk_window_set_user_data (widget->window, toggle_button);
     }
Index: gtk/gtktree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktree.c,v
retrieving revision 1.47
diff -u -r1.47 gtktree.c
--- gtk/gtktree.c	2001/07/19 14:57:14	1.47
+++ gtk/gtktree.c	2001/08/06 11:01:01
@@ -567,7 +567,7 @@
   
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
   
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.116
diff -u -r1.116 gtktreeview.c
--- gtk/gtktreeview.c	2001/07/31 19:55:02	1.116
+++ gtk/gtktreeview.c	2001/08/06 11:01:02
@@ -1109,7 +1109,7 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
 				   &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
 
@@ -1127,7 +1127,7 @@
     GDK_BUTTON_RELEASE_MASK |
     gtk_widget_get_events (widget);
 
-  tree_view->priv->bin_window = gdk_window_new (widget->window,
+  tree_view->priv->bin_window = gtk_widget_create_window (widget, widget->window,
 						&attributes, attributes_mask);
   gdk_window_set_user_data (tree_view->priv->bin_window, widget);
 
@@ -1144,7 +1144,7 @@
 			   GDK_KEY_RELEASE_MASK) |
     gtk_widget_get_events (widget);
 
-  tree_view->priv->header_window = gdk_window_new (widget->window,
+  tree_view->priv->header_window = gtk_widget_create_window (widget, widget->window,
 						   &attributes, attributes_mask);
   gdk_window_set_user_data (tree_view->priv->header_window, widget);
 
@@ -1927,7 +1927,7 @@
 	  attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
 	  attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
 	  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-	  tree_view->priv->drag_highlight_window = gdk_window_new (tree_view->priv->header_window, &attributes, attributes_mask);
+	  tree_view->priv->drag_highlight_window = gtk_widget_create_window (widget, tree_view->priv->header_window, &attributes, attributes_mask);
 	  gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
 
 	  width = tree_view->priv->drag_column->button->allocation.width;
@@ -1994,7 +1994,7 @@
 	  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 	  attributes.width = width;
 	  attributes.height = height;
-	  tree_view->priv->drag_highlight_window = gdk_window_new (NULL, &attributes, attributes_mask);
+	  tree_view->priv->drag_highlight_window = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
 	  gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
 
 	  mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
@@ -2068,7 +2068,7 @@
 	  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 	  attributes.width = width;
 	  attributes.height = height;
-	  tree_view->priv->drag_highlight_window = gdk_window_new (NULL, &attributes, attributes_mask);
+	  tree_view->priv->drag_highlight_window = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
 	  gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
 
 	  mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
@@ -5411,9 +5411,10 @@
       attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-      tree_view->priv->drag_window = gdk_window_new (tree_view->priv->bin_window,
-						     &attributes,
-						     attributes_mask);
+      tree_view->priv->drag_window = gtk_widget_create_window (tree_view,
+							       tree_view->priv->bin_window,
+							       &attributes,
+							       attributes_mask);
       gdk_window_set_user_data (tree_view->priv->drag_window, GTK_WIDGET (tree_view));
     }
 
Index: gtk/gtktreeviewcolumn.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeviewcolumn.c,v
retrieving revision 1.55
diff -u -r1.55 gtktreeviewcolumn.c
--- gtk/gtktreeviewcolumn.c	2001/07/19 14:57:14	1.55
+++ gtk/gtktreeviewcolumn.c	2001/08/06 11:01:02
@@ -914,8 +914,8 @@
 
   attr.x = (column->button->allocation.x + column->button->allocation.width) - 3;
           
-  column->window = gdk_window_new (tree_view->priv->header_window,
-				   &attr, attributes_mask);
+  column->window = gtk_widget_create_window (column, tree_view->priv->header_window,
+					     &attr, attributes_mask);
   gdk_window_set_user_data (column->window, tree_view);
 
   gtk_tree_view_column_update_button (column);
Index: gtk/gtkviewport.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkviewport.c,v
retrieving revision 1.49
diff -u -r1.49 gtkviewport.c
--- gtk/gtkviewport.c	2001/07/19 14:57:14	1.49
+++ gtk/gtkviewport.c	2001/08/06 11:01:02
@@ -442,8 +442,8 @@
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-				   &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, gtk_widget_get_parent_window (widget),
+					     &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, viewport);
 
   if (viewport->shadow_type != GTK_SHADOW_NONE)
@@ -461,7 +461,7 @@
   attributes.height = MAX (1, (gint)widget->allocation.height - attributes.y * 2 - border_width * 2);
   attributes.event_mask = 0;
 
-  viewport->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
+  viewport->view_window = gtk_widget_create_window (widget, widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (viewport->view_window, viewport);
 
   attributes.x = 0;
@@ -475,7 +475,7 @@
   
   attributes.event_mask = event_mask;
 
-  viewport->bin_window = gdk_window_new (viewport->view_window, &attributes, attributes_mask);
+  viewport->bin_window = gtk_widget_create_window (widget, viewport->view_window, &attributes, attributes_mask);
   gdk_window_set_user_data (viewport->bin_window, viewport);
 
   if (bin->child)
@@ -552,7 +552,7 @@
 
       if (event->window == widget->window)
 	gtk_viewport_paint (widget, &event->area);
-      else if (event->window == viewport->bin_window)
+      else if (event->window == viewport->bin_window || event->window == viewport->view_window)
 	{
 	  child_event = *event;
 
Index: gtk/gtkvpaned.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkvpaned.c,v
retrieving revision 1.33
diff -u -r1.33 gtkvpaned.c
--- gtk/gtkvpaned.c	2001/07/18 23:39:25	1.33
+++ gtk/gtkvpaned.c	2001/08/06 11:01:02
@@ -156,10 +156,12 @@
 
   widget->allocation = *allocation;
   if (GTK_WIDGET_REALIZED (widget))
-    gdk_window_move_resize (widget->window,
-			    allocation->x, allocation->y,
-			    allocation->width,
-			    allocation->height);
+      {
+	  gdk_window_move_resize (widget->window,
+				  allocation->x, allocation->y,
+				  allocation->width,
+				  allocation->height);
+      }
 
   if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
       paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
@@ -317,6 +319,20 @@
 		 ypos);
 }
 
+static void
+gtk_vpaned_update_position (GtkPaned *paned)
+{
+  GObject *object = G_OBJECT (paned);
+  
+  paned->position_set = TRUE;
+  g_object_freeze_notify (object);
+  g_object_notify (object, "position");
+  g_object_notify (object, "position_set");
+  g_object_thaw_notify (object);
+  gtk_widget_queue_resize (GTK_WIDGET (paned));
+  gdk_window_process_all_updates ();
+}
+
 static gboolean
 gtk_vpaned_button_press (GtkWidget      *widget,
 			 GdkEventButton *event)
@@ -329,6 +345,10 @@
   if (!paned->in_drag &&
       (event->window == paned->handle) && (event->button == 1))
     {
+      gboolean opaque_resize;
+
+      gtk_widget_style_get (widget, "opaque_resize", &opaque_resize, NULL);
+      
       paned->in_drag = TRUE;
       /* We need a server grab here, not gtk_grab_add(), since
        * we don't want to pass events on to the widget's children */
@@ -342,7 +362,8 @@
 				  widget->allocation.height -
 				  handle_size -
 				  2 * GTK_CONTAINER (paned)->border_width);
-      gtk_vpaned_xor_line(paned);
+      if (!opaque_resize)
+	gtk_vpaned_xor_line(paned);
 
       return TRUE;
     }
@@ -359,15 +380,16 @@
 
   if (paned->in_drag && (event->button == 1))
     {
-      gtk_vpaned_xor_line (paned);
+      gboolean opaque_resize;
+
+      gtk_widget_style_get (widget, "opaque_resize", &opaque_resize, NULL);
+      if (!opaque_resize)
+	gtk_vpaned_xor_line (paned);
+
       paned->in_drag = FALSE;
-      paned->position_set = TRUE;
       gdk_pointer_ungrab (event->time);
-      gtk_widget_queue_resize (GTK_WIDGET (paned));
-      g_object_freeze_notify (object);
-      g_object_notify (object, "position");
-      g_object_notify (object, "position_set");
-      g_object_thaw_notify (object);
+
+      gtk_vpaned_update_position (paned);
 
       return TRUE;
     }
@@ -382,21 +404,46 @@
   GtkPaned *paned = GTK_PANED (widget);
   gint y;
   gint handle_size;
+  gint mask;
+  gboolean opaque_resize;
 
-  gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
+  gtk_widget_style_get (widget,
+			"handle_size", &handle_size,
+			"opaque_resize", &opaque_resize,
+			NULL);
 
-  if (event->is_hint || event->window != widget->window)
-    gtk_widget_get_pointer (widget, NULL, &y);
-  else
-    y = event->y;
-
   if (paned->in_drag)
     {
-      gint size = y - GTK_CONTAINER(paned)->border_width - handle_size / 2;
+	if (event->is_hint || event->window != widget->window)
+	    gdk_window_get_pointer (widget->window, NULL, &y, &mask);
+	else
+	    y = event->y;
 
-      gtk_vpaned_xor_line (paned);
-      paned->child1_size = CLAMP (size, paned->min_position, paned->max_position);
-      gtk_vpaned_xor_line(paned);
+      if (mask & GDK_BUTTON1_MASK)
+	{
+	  gint size = y - GTK_CONTAINER (paned)->border_width - handle_size / 2;
+	  
+	  if (!opaque_resize)
+	    gtk_vpaned_xor_line (paned);
+	  paned->child1_size = CLAMP (size, paned->min_position, paned->max_position);
+	  if (opaque_resize)
+	    gtk_vpaned_update_position (paned);
+	  else
+	    gtk_vpaned_xor_line (paned);
+	}
+      else
+	{
+	  gboolean opaque_resize;
+	  
+	  gtk_widget_style_get (widget, "opaque_resize", &opaque_resize, NULL);
+	  if (!opaque_resize)
+	    gtk_vpaned_xor_line (paned);
+	  
+	  paned->in_drag = FALSE;
+	  gdk_pointer_ungrab (event->time);
+	  
+	  gtk_vpaned_update_position (paned);
+	}
     }
 
   return TRUE;
Index: gtk/gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.246
diff -u -r1.246 gtkwidget.c
--- gtk/gtkwidget.c	2001/07/31 21:23:19	1.246
+++ gtk/gtkwidget.c	2001/08/06 11:01:03
@@ -1302,6 +1302,7 @@
   widget->allocation.height = 1;
   widget->window = NULL;
   widget->parent = NULL;
+  widget->owned_windows = NULL;
 
   GTK_WIDGET_SET_FLAGS (widget,
 			GTK_SENSITIVE |
@@ -1713,7 +1714,7 @@
 	gtk_widget_queue_resize (widget);
       gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
       g_object_notify (G_OBJECT (widget), "visible");
-      g_object_unref (G_OBJECT (widget));
+      g_object_unref (G_OBJECT (widget));      
     }
 }
 
@@ -2203,7 +2204,9 @@
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
+#if 0
   gtk_widget_queue_clear (widget);
+#endif
 
   _gtk_size_group_queue_resize (widget);
 }
@@ -2290,6 +2293,14 @@
   _gtk_size_group_get_child_requisition (widget, requisition);
 }
 
+static void
+container_expose_children (GtkWidget *w, gpointer data)
+{
+  GdkRectangle *rect = data;
+  if (gtk_widget_intersect (w, rect, NULL))
+    gtk_widget_queue_draw_area (w, rect->x, rect->y, rect->width, rect->height);
+}
+
 /**
  * gtk_widget_size_allocate:
  * @widget: a #GtkWidget
@@ -2306,6 +2317,7 @@
   GtkWidgetAuxInfo *aux_info;
   GtkAllocation real_allocation;
   gboolean needs_draw = FALSE;
+  GdkRectangle exposed1, exposed2;
   
   g_return_if_fail (GTK_IS_WIDGET (widget));
   
@@ -2337,7 +2349,6 @@
 	  widget->allocation.width != real_allocation.width ||
 	  widget->allocation.height != real_allocation.height)
 	{
-	  gtk_widget_queue_clear_child (widget);
 	  needs_draw = TRUE;
 	}
     }
@@ -2347,16 +2358,53 @@
       needs_draw = TRUE;
     }
 
+  if (needs_draw)
+    {
+      gint max_w, min_w, max_h, min_h;
+      
+      max_w = MAX (widget->allocation.width, real_allocation.width);
+      min_w = MIN (widget->allocation.width, real_allocation.width);
+      max_h = MAX (widget->allocation.height, real_allocation.height);
+      min_h = MIN (widget->allocation.height, real_allocation.height);
+      
+      exposed1.width  = max_w - min_w;
+      exposed1.height = max_h;
+      exposed1.x      = min_w;
+      exposed1.y      = 0;
+
+      exposed2.width  = max_w;
+      exposed2.height = max_h - min_h;
+      exposed2.y      = min_h;
+      exposed2.x      = 0;
+    }
+  
   if (GTK_IS_RESIZE_CONTAINER (widget))
     gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
 
   gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], &real_allocation);
 
+  if (widget->parent && GTK_CONTAINER (widget->parent)->reallocate_redraws)
+    gtk_widget_queue_draw (widget->parent);
+
   if (needs_draw)
     {
-      gtk_widget_queue_draw (widget);
-      if (widget->parent && GTK_CONTAINER (widget->parent)->reallocate_redraws)
-	gtk_widget_queue_draw (widget->parent);
+      if (GTK_WIDGET_REALIZED (widget))
+	{
+	    GSList *s;
+
+	    if (GTK_WIDGET_NO_WINDOW (widget))
+		gdk_window_invalidate_rect (widget->window, NULL, FALSE);
+	    else
+		for (s = widget->owned_windows; s != NULL; s = s->next)
+		    gdk_window_invalidate_rect (s->data, NULL, FALSE);
+
+	    gtk_widget_queue_clear_area (widget,
+					 exposed1.x, exposed1.y,
+					 exposed1.width, exposed1.height);
+	    gtk_widget_queue_clear_area (widget,
+					 exposed2.x, exposed2.y,
+					 exposed2.width, exposed2.height);
+	}
     }
 }
 
@@ -3005,6 +3053,21 @@
   gdk_region_intersect (dest, region);
 
   return dest;
+}
+
+GdkWindow *
+gtk_widget_create_window (GtkWidget     *widget,
+			  GdkWindow     *parent,
+			  GdkWindowAttr *attributes,
+			  gint           attributes_mask)
+{
+  GdkWindow *window;
+
+  window = gdk_window_new (parent, attributes, attributes_mask);
+  gdk_window_set_user_data (window, widget);
+  widget->owned_windows = g_slist_prepend (widget->owned_windows, window);
+
+  return window;
 }
 
 /**
Index: gtk/gtkwidget.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.h,v
retrieving revision 1.117
diff -u -r1.117 gtkwidget.h
--- gtk/gtkwidget.h	2001/07/19 14:57:15	1.117
+++ gtk/gtkwidget.h	2001/08/06 11:01:03
@@ -215,6 +215,10 @@
    *  GTK_NO_WINDOW flag being set).
    */
   GdkWindow *window;
+
+  /* The list of GdkWindows that this widgets owns
+   */
+  GSList *owned_windows;
   
   /* The widgets parent.
    */
@@ -529,6 +533,11 @@
 					   GdkRectangle	       *intersection);
 GdkRegion *gtk_widget_region_intersect	  (GtkWidget	       *widget,
 					   GdkRegion	       *region);
+
+GdkWindow *gtk_widget_create_window       (GtkWidget	       *widget,
+					   GdkWindow           *parent,
+					   GdkWindowAttr       *attributes,
+					   gint                 attributes_mask);
 
 void	gtk_widget_freeze_child_notify	  (GtkWidget	       *widget);
 void	gtk_widget_child_notify		  (GtkWidget	       *widget,
Index: gtk/gtkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwindow.c,v
retrieving revision 1.138
diff -u -r1.138 gtkwindow.c
--- gtk/gtkwindow.c	2001/07/25 13:36:01	1.138
+++ gtk/gtkwindow.c	2001/08/06 11:01:03
@@ -2065,7 +2065,7 @@
       
       attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
       
-      window->frame = gdk_window_new (NULL, &attributes, attributes_mask);
+      window->frame = gtk_widget_create_window (widget, NULL, &attributes, attributes_mask);
       gdk_window_set_user_data (window->frame, widget);
       
       attributes.window_type = GDK_WINDOW_CHILD;
@@ -2095,7 +2095,7 @@
   attributes_mask |= GDK_WA_VISUAL | GDK_WA_COLORMAP;
   attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
   attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
-  widget->window = gdk_window_new (parent_window, &attributes, attributes_mask);
+  widget->window = gtk_widget_create_window (widget, parent_window, &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, window);
       
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: tests/testgtk.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testgtk.c,v
retrieving revision 1.270
diff -u -r1.270 testgtk.c
--- tests/testgtk.c	2001/08/04 23:30:11	1.270
+++ tests/testgtk.c	2001/08/06 11:01:04
@@ -383,6 +383,10 @@
       button = gtk_check_button_new_with_label ("button3");
       gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
 
+      button = gtk_check_button_new_with_label ("insensitive");
+      gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+      gtk_widget_set_sensitive (button, FALSE);
+
       button = gtk_check_button_new_with_label ("inconsistent");
       gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
       gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
@@ -456,6 +460,12 @@
 
       button = gtk_radio_button_new_with_label (
                  gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
+		 "insensitive");
+      gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+      gtk_widget_set_sensitive (button, FALSE);
+      
+      button = gtk_radio_button_new_with_label (
+                 gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
 		 "inconsistent");
       gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
       gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
@@ -10092,6 +10102,7 @@
   GtkWidget *scrolled_window;
   GtkWidget *button;
   GtkWidget *label;
+  GtkWidget *paned;
   gchar buffer[64];
   GtkWidget *separator;
   GdkGeometry geometry;
@@ -10140,7 +10151,6 @@
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
      		                  GTK_POLICY_NEVER, 
                                   GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
 
   box2 = gtk_vbox_new (FALSE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
@@ -10162,18 +10172,20 @@
       gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
     }
 
-  separator = gtk_hseparator_new ();
-  gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
+  paned = gtk_vpaned_new ();
+  gtk_paned_add1 (GTK_PANED (paned), scrolled_window);
 
+  gtk_box_pack_start (GTK_BOX (box1), paned, TRUE, TRUE, 0);
+  
   box2 = gtk_vbox_new (FALSE, 10);
   gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
-  gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
+  gtk_paned_add2 (GTK_PANED (paned), box2);
 
   button = gtk_button_new_with_mnemonic ("_Close");
   gtk_signal_connect (GTK_OBJECT (button), "clicked",
 		      GTK_SIGNAL_FUNC (do_exit),
 		      window);
-  gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
   GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
   gtk_widget_grab_default (button);
 
@@ -10313,6 +10325,10 @@
     gtk_rc_add_default_file ("testgtkrc");
 
   gtk_init (&argc, &argv);
+
+#if 0
+  gdk_window_set_debug_updates (TRUE);
+#endif
 
   /*  benchmarking
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]