Method

GtkWindowset_default_size

Declaration [src]

void
gtk_window_set_default_size (
  GtkWindow* window,
  int width,
  int height
)

Description [src]

Sets the default size of a window.

The default size of a window is the size that will be used if no other constraints apply.

The default size will be updated whenever the window is resized to reflect the new size, unless the window is forced to a size, like when it is maximized or fullscreened.

If the window’s minimum size request is larger than the default, the default will be ignored.

Setting the default size to a value <= 0 will cause it to be ignored and the natural size request will be used instead. It is possible to do this while the window is showing to “reset” it to its initial size.

Unlike gtk_widget_set_size_request(), which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the “natural” default size (the size request of the window).

If you use this function to reestablish a previously saved window size, note that the appropriate size to save is the one returned by gtk_window_get_default_size(). Using the window allocation directly will not work in all circumstances and can lead to growing or shrinking windows.

Parameters

width

Type: int

Width in pixels, or -1 to unset the default width.

height

Type: int

Height in pixels, or -1 to unset the default height.