]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkoverlay.c
Small documentation tweak
[~andy/gtk] / gtk / gtkoverlay.c
index ff046e9852d3af6f796de570974fdbe2d3dadd9c..de80637d071cf811365fc122ada5c42033eaae26 100644 (file)
@@ -105,7 +105,7 @@ gtk_overlay_create_child_window (GtkOverlay *overlay,
 
   window = gdk_window_new (gtk_widget_get_window (widget),
                            &attributes, attributes_mask);
-  gdk_window_set_user_data (window, overlay);
+  gtk_widget_register_window (widget, window);
   gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
 
   gtk_widget_set_parent_window (child, window);
@@ -183,7 +183,6 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
   gboolean is_left, is_right, is_top, is_bottom;
   gboolean has_left, has_right, has_top, has_bottom;
   GtkStyleContext *context;
-  gint changed;
 
   context = gtk_widget_get_style_context (child);
   has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
@@ -192,7 +191,6 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
   has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
 
   is_left = is_right = is_top = is_bottom = FALSE;
-  changed = 4;
 
   gtk_overlay_get_main_widget_allocation (overlay, &main_allocation);
   gtk_widget_get_allocation (GTK_WIDGET (overlay), &overlay_allocation);
@@ -221,32 +219,21 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
     gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
   else if (!has_left && is_left)
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
-  else
-    changed--;
 
   if (has_right && !is_right)
     gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
   else if (!has_right && is_right)
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
-  else
-    changed--;
 
   if (has_top && !is_top)
     gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
   else if (!has_top && is_top)
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
-  else
-    changed--;
 
   if (has_bottom && !is_bottom)
     gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
   else if (!has_bottom && is_bottom)
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
-  else
-    changed--;
-
-  if (changed > 0)
-    gtk_widget_reset_style (child);
 }
 
 static void
@@ -436,7 +423,10 @@ gtk_overlay_realize (GtkWidget *widget)
       child = children->data;
 
       if (child->window == NULL)
-        child->window = gtk_overlay_create_child_window (overlay, child->widget);
+       {
+         child->window = gtk_overlay_create_child_window (overlay, child->widget);
+         gtk_overlay_child_allocate (overlay, child);
+       }
     }
 }
 
@@ -453,7 +443,7 @@ gtk_overlay_unrealize (GtkWidget *widget)
       child = children->data;
 
       gtk_widget_set_parent_window (child->widget, NULL);
-      gdk_window_set_user_data (child->window, NULL);
+      gtk_widget_unregister_window (widget, child->window);
       gdk_window_destroy (child->window);
       child->window = NULL;
     }
@@ -549,7 +539,7 @@ gtk_overlay_remove (GtkContainer *container,
         {
           if (child->window != NULL)
             {
-              gdk_window_set_user_data (child->window, NULL);
+              gtk_widget_unregister_window (GTK_WIDGET (container), child->window);
               gdk_window_destroy (child->window);
             }
 
@@ -615,7 +605,7 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
    * GtkOverlay::get-child-position:
    * @overlay: the #GtkOverlay
    * @widget: the child widget to position
-   * @allocation: (out): return location for the allocation
+   * @allocation: (out caller-allocates): return location for the allocation
    *
    * The ::get-child-position signal is emitted to determine
    * the position and size of any overlay child widgets. A