* 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/>.
*/
/*
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"),
/**
* 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
priv = window->priv;
+ if (priv->attach_widget == attach_widget)
+ return;
+
remove_attach_widget (window);
priv->attach_widget = attach_widget;
{
_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. */
/**
* 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
}
#endif
- gtk_window_set_application (window, gtk_window_get_application (window));
-
/* Icons */
gtk_window_realize_icon (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))
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);
}
* 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);