]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkwindow.c
Change FSF Address
[~andy/gtk] / gtk / gtkwindow.c
index 62b9ac07344c003e3f532b98f28273f6b44b8853..19acb329efe5ca17d396d6a5881b50a1c13807e0 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -1044,7 +1042,7 @@ gtk_window_class_init (GtkWindowClass *klass)
                                                         P_("GtkApplication"),
                                                         P_("The GtkApplication for the window"),
                                                         GTK_TYPE_APPLICATION,
-                                                        GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+                                                        GTK_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   window_signals[SET_FOCUS] =
     g_signal_new (I_("set-focus"),
@@ -2621,7 +2619,7 @@ gtk_window_get_transient_for (GtkWindow *window)
 /**
  * gtk_window_set_attached_to:
  * @window: a #GtkWindow
- * @attach_widget (allow-none): a #GtkWidget, or %NULL
+ * @attach_widget: (allow-none): a #GtkWidget, or %NULL
  *
  * Marks @window as attached to @attach_widget. This creates a logical binding
  * between the window and the widget it belongs to, which is used by GTK+ to
@@ -2651,6 +2649,9 @@ gtk_window_set_attached_to (GtkWindow *window,
 
   priv = window->priv;
 
+  if (priv->attach_widget == attach_widget)
+    return;
+
   remove_attach_widget (window);
 
   priv->attach_widget = attach_widget;
@@ -2659,7 +2660,7 @@ gtk_window_set_attached_to (GtkWindow *window,
     {
       _gtk_widget_add_attached_window (priv->attach_widget, window);
 
-      g_object_ref_sink (priv->attach_widget);
+      g_object_ref (priv->attach_widget);
     }
 
   /* Update the style, as the widget path might change. */
@@ -4517,7 +4518,7 @@ gtk_window_move (GtkWindow *window,
 /**
  * gtk_window_get_position:
  * @window: a #GtkWindow
- * @root_x: (out) (allow-none): eturn location for X coordinate of
+ * @root_x: (out) (allow-none): return location for X coordinate of
  *     gravity-determined reference point, or %NULL
  * @root_y: (out) (allow-none): return location for Y coordinate of
  *     gravity-determined reference point, or %NULL
@@ -5330,8 +5331,6 @@ gtk_window_realize (GtkWidget *widget)
     }
 #endif
 
-  gtk_window_set_application (window, gtk_window_get_application (window));
-
   /* Icons */
   gtk_window_realize_icon (window);
   
@@ -5532,34 +5531,55 @@ set_grip_position (GtkWindow *window)
                           rect.width, rect.height);
 }
 
-static void
-gtk_window_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+/* _gtk_window_set_allocation:
+ * @window: a #GtkWindow
+ * @allocation: the new allocation
+ *
+ * This function is like gtk_widget_set_allocation()
+ * but does the necessary extra work to update
+ * the resize grip positioning, etc.
+ *
+ * Call this instead of gtk_widget_set_allocation()
+ * when overriding ::size_allocate in a GtkWindow
+ * subclass without chaining up.
+ */
+void
+_gtk_window_set_allocation (GtkWindow     *window,
+                            GtkAllocation *allocation)
 {
-  GtkWindow *window = GTK_WINDOW (widget);
-  GtkAllocation child_allocation;
-  GtkWidget *child;
-  guint border_width;
+  GtkWidget *widget = (GtkWidget *)window;
 
   gtk_widget_set_allocation (widget, allocation);
 
   if (gtk_widget_get_realized (widget))
     {
-      /* If it's not a toplevel we're embedded, we need to resize the window's 
-       * window and skip the grip.
+      /* If it's not a toplevel we're embedded, we need to resize
+       * the window's window and skip the grip.
        */
       if (!gtk_widget_is_toplevel (widget))
-       {
-         gdk_window_move_resize (gtk_widget_get_window (widget),
-                                 allocation->x, allocation->y,
-                                 allocation->width, allocation->height);
-       }
+        {
+          gdk_window_move_resize (gtk_widget_get_window (widget),
+                                  allocation->x, allocation->y,
+                                  allocation->width, allocation->height);
+        }
       else
-       {
-         update_grip_visibility (window);
-         set_grip_position (window);
-       }
+        {
+          update_grip_visibility (window);
+          set_grip_position (window);
+        }
     }
+}
+
+static void
+gtk_window_size_allocate (GtkWidget     *widget,
+                          GtkAllocation *allocation)
+{
+  GtkWindow *window = GTK_WINDOW (widget);
+  GtkAllocation child_allocation;
+  GtkWidget *child;
+  guint border_width;
+
+  _gtk_window_set_allocation (window, allocation);
 
   child = gtk_bin_get_child (&(window->bin));
   if (child && gtk_widget_get_visible (child))
@@ -5567,10 +5587,8 @@ gtk_window_size_allocate (GtkWidget     *widget,
       border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
       child_allocation.x = border_width;
       child_allocation.y = border_width;
-      child_allocation.width =
-       MAX (1, (gint)allocation->width - child_allocation.x * 2);
-      child_allocation.height =
-       MAX (1, (gint)allocation->height - child_allocation.y * 2);
+      child_allocation.width = MAX (1, allocation->width - border_width * 2);
+      child_allocation.height = MAX (1, allocation->height - border_width * 2);
 
       gtk_widget_size_allocate (child, &child_allocation);
     }
@@ -5906,7 +5924,7 @@ gtk_window_get_has_resize_grip (GtkWindow *window)
  * Since: 3.0
  */
 gboolean
-gtk_window_get_resize_grip_area (GtkWindow *window,
+gtk_window_get_resize_grip_area (GtkWindow    *window,
                                  GdkRectangle *rect)
 {
   GtkWidget *widget = GTK_WIDGET (window);