If window is not visible on screen, this function return the size GTK+
will suggest to the [window manager][gtk-X11-arch] for the initial window
size (but this is not reliably the same as the size the window manager
will actually select). See: Window.setDefaultSize.
Depending on the windowing system and the window manager constraints,
the size returned by this function may not match the size set using
Window.resize; additionally, since Window.resize may be
implemented as an asynchronous operation, GTK+ cannot guarantee in any
way that this code:
// width and height are set elsewhere
gtk_window_resize (window, width, height);
int new_width, new_height;
gtk_window_get_size (window, &new_width, &new_height);
will result in new_width and new_height matching width and
height, respectively.
This function will return the logical size of the gtk.Window,
excluding the widgets used in client side decorations; there is,
however, no guarantee that the result will be completely accurate
because client side decoration may include widgets that depend on
the user preferences and that may not be visibile at the time you
call this function.
The dimensions returned by this function are suitable for being
stored across sessions; use Window.setDefaultSize to
restore them when before showing the window.
To avoid potential race conditions, you should only call this
function in response to a size change notification, for instance
inside a handler for the size-allocate signal, or
inside a handler for the configure-event signal:
Note that, if you connect to the size-allocate signal,
you should not use the dimensions of the GtkAllocation passed to
the signal handler, as the allocation may contain client side
decorations added by GTK+, depending on the windowing system in
use.
If you are getting a window size in order to position the window
on the screen, you should, instead, simply set the window’s semantic
type with Window.setTypeHint, which allows the window manager
to e.g. center dialogs. Also, if you set the transient parent of
dialogs with Window.setTransientFor window managers will
often center the dialog over its parent window. It's much preferred
to let the window manager handle these cases rather than doing it
yourself, because all apps will behave consistently and according to
user or system preferences, if the window manager handles it. Also,
the window manager can take into account the size of the window
decorations and border that it may add, and of which GTK+ has no
knowledge. Additionally, positioning windows in global screen coordinates
may not be allowed by the windowing system. For more information,
see: Window.setPosition.
Obtains the current size of window.
If window is not visible on screen, this function return the size GTK+ will suggest to the [window manager][gtk-X11-arch] for the initial window size (but this is not reliably the same as the size the window manager will actually select). See: Window.setDefaultSize.
Depending on the windowing system and the window manager constraints, the size returned by this function may not match the size set using Window.resize; additionally, since Window.resize may be implemented as an asynchronous operation, GTK+ cannot guarantee in any way that this code:
will result in new_width and new_height matching width and height, respectively.
This function will return the logical size of the gtk.Window, excluding the widgets used in client side decorations; there is, however, no guarantee that the result will be completely accurate because client side decoration may include widgets that depend on the user preferences and that may not be visibile at the time you call this function.
The dimensions returned by this function are suitable for being stored across sessions; use Window.setDefaultSize to restore them when before showing the window.
To avoid potential race conditions, you should only call this function in response to a size change notification, for instance inside a handler for the size-allocate signal, or inside a handler for the configure-event signal:
Note that, if you connect to the size-allocate signal, you should not use the dimensions of the GtkAllocation passed to the signal handler, as the allocation may contain client side decorations added by GTK+, depending on the windowing system in use.
If you are getting a window size in order to position the window on the screen, you should, instead, simply set the window’s semantic type with Window.setTypeHint, which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with Window.setTransientFor window managers will often center the dialog over its parent window. It's much preferred to let the window manager handle these cases rather than doing it yourself, because all apps will behave consistently and according to user or system preferences, if the window manager handles it. Also, the window manager can take into account the size of the window decorations and border that it may add, and of which GTK+ has no knowledge. Additionally, positioning windows in global screen coordinates may not be allowed by the windowing system. For more information, see: Window.setPosition.