<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <linklocation="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
This method is used if an application has window movement grips. When GDK can support it, the window movement will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.
It will not return the size of the window border drawn by the window manager, which is the normal case when using a windowing system. See <seecref="M:Gdk.Window.GetFrameExtents"/> to get the standard window border extents.) See also <seecref="P:Gtk.Window.HasFrame"/>, <seecref="M:Gtk.Window.SetFrameDimensions"/>.
Note that you shouldn't assume the <paramrefname="window"/> is definitely iconified afterward, because other entities (e.g. the user or window manager) could deiconify it again, or there may not be a window manager in which case iconification isn't possible, etc. But normally the <paramrefname="window"/> will end up iconified. Just do not write code that crashes if not.
Note that you shouldn't assume the <paramrefname="window"/> is definitely unstuck afterward, because other entities (e.g. the user or window manager) could stick it again. But normally the <paramrefname="window"/> will end up stuck. Just do not write code that crashes if not.
Note that you shouldn't assume the <paramrefname="window"/> is definitely unmaximized afterward, because other entities (e.g. the user or window manager) could maximize it again, and not all window managers honor requests to unmaximize. But normally the <paramrefname="window"/> will end up unmaximized. Just don't write code that crashes if not.
If <paramrefname="window"/> is not onscreen, it returns the size GTK# will suggest to the window manager for the initial window size (but this is not reliably the same as the size the window manager will actually select). The size obtained by <seecref="M:Gtk.Window.GetSize"/> is the last size received in a GdkEventConfigure, that is, GTK# uses its locally-stored size, rather than querying the X server for the size. As a result, if you call <seecref="M:Gtk.Window.Resize"/> then immediately call <seecref="M:Gtk.Window.GetSize"/>, the size would not have taken effect yet. After the window manager processes the resize request, GTK# receives notification that the size has changed via a configure event, and the size of the <paramrefname="window"/> gets updated.
Note 1: Nearly any use of this method creates a race condition, because the size of the <paramrefname="window"/> may change between the time that you get the size and the time that you perform some action assuming that size is the current size. To avoid race conditions, connect to <seecref="F:Gtk.Widget.ConfigureEvent"/> on the <paramrefname="window"/> and adjust your size-dependent state to match the size delivered in the GdkEventConfigure.
A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimension, so the "natural" size of the <paramrefname="window"/> will be used.
The default geometry constraint is that windows may not be smaller than their size request; to override this constraint, call <seecref="M:Gtk.Widget.SetSizeRequest"/> to set the <paramrefname="window"/>'s request to a smaller value.
If <seecref="M:Gtk.Window.Resize"/> is called before showing a <paramrefname="window"/> for the first time, it overrides any default size set with <seecref="M:Gtk.Window.SetDefaultSize"/>. Windows may not be resized smaller than 1 by 1 pixels.
If either a size or a position can be extracted from the geometry string, <seecref="M:Gtk.Window.ParseGeometry"/> returns <seelangword="true"/> and calls <seecref="M:Gtk.Window.SetDefaultSize"/> and/or <seecref="M:Gtk.Window.Move"/> to resize/move the <paramrefname="window"/>.
If <seecref="M:Gtk.Window.ParseGeometry"/> returns <seelangword="true"/>, it will also set the <paramrefname="F:Gdk.WindowHints.UserPos"/> and/or <seecref="F:Gdk.WindowHints.UserSize"/> hints indicating to the window manager that the size/position of the <paramrefname="window"/> was user-specified. This causes most window managers to honor the geometry.
Note that for <seecref="M:Gtk.Window.ParseGeometry"/> to work as expected, it has to be called when the <paramrefname="window"/> has its "final" size, i.e. after calling <seecref="M:Gtk.Widget.ShowAll"/> on the contents and <seecref="M:Gtk.Window.SetGeometryHints"/> on the <paramrefname="window"/>.
Note that you shouldn't assume the <paramrefname="window"/> is definitely stuck afterward, because other entities (e.g. the user or window manager) could unstick it again, and some window managers do not support sticking windows. But normally the <paramrefname="window"/> will end up stuck. Just don't write code that crashes if not.
You can track stickiness via the <seecref="F:Gtk.Widget.WindowStateEvent"/> event on GtkWidget. It's permitted to call this method before showing a <paramrefname="window"/>.
Note: this is a special-purpose method intended for the framebuffer port; see <seecref="P:Gtk.Window.HasFrame"/>. It will have no effect on the window border drawn by the window manager, which is the normal case when using the X Window system.
This method is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.
<summary>This method returns the position you need to pass to <seecref="M:Gtk.Window.Move"/> to keep <paramrefname="window"/> in its current position.</summary>
If you haven't changed the window gravity, its gravity will be <seecref="F:Gdk.Gravity.NorthWest"/>. This means that <seecref="M:Gtk.Window.GetPosition"/> gets the position of the top-left corner of the window manager frame for the <paramrefname="window"/>. <seecref="M:Gtk.Window.Move"/> sets the position of this same top-left corner.
<seecref="M:Gtk.Window.GetPosition"/> is not 100% reliable because the X Window System does not specify a way to obtain the geometry of the decorations placed on a <paramrefname="window"/> by the window manager. Thus GTK# is using a "best guess" that works with most window managers.
Moreover, nearly all window managers are historically broken with respect to their handling of window gravity. So moving a <paramrefname="window"/> to its current position as returned by <seecref="M:Gtk.Window.GetPostion"/> tends to result in moving the <paramrefname="window"/> slightly. Window managers are slowly getting better over time.
If a <paramrefname="window"/> has gravity <seecref="F.Gdk.Gravity.Static"/> the window manager frame is not relevant, and thus <seecref="M:Gtk.Window.GetPosition"/> will always produce accurate results. However you can't use static gravity to do things like place a <paramrefname="window"/> in a corner of the screen, because static gravity ignores the window manager decorations.
If you are saving and restoring your application's <paramrefname="window"/> positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state. The Correct Mechanism is to support the session management protocol (see the "GnomeClient" object in the GNOME libraries for example) and allow the window manager to save your <paramrefname="window"/> sizes and positions.
Note that you shouldn't assume the <paramrefname="window"/> is definitely deiconified afterward, because other entities (e.g. the user or window manager) could iconify it again before your code which assumes deiconification gets to run.
That is unless the current focused <paramrefname="widget"/> has been configured to receive the default (see <seecref="F:Gtk.WidgetFlags.ReceivesDefault"/>) action in which case the case the focused <paramrefname="widget"/> is activated.
Note that you shouldn't assume the <paramrefname="window"/> is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization. But normally the <paramrefname="window"/> will end up maximized. Just don't write code that crashes if not.
You can track maximization via the <seecref="F:Gtk.Widget.WindowStateEvent"/> event on <seecref="T.Gtk.Widget"/>. It's permitted to call this method before showing a <paramrefname="window"/>, in which case the <paramrefname="window"/> will be maximized when it appears onscreen initially.
<remarks>This is an advanced feature and is not used by typical code. The method adds the specified XID to a list of embedded windows that is maintained as object data on the Window object. This list is used for things like querying X rc settings.</remarks>
According to the ICCCM, you should always set these to the same value for all windows in an application, and GTK# sets them to that value by default, so calling this method is sort of pointless. However, you may want to call <seecref="P:Gtk.Window.Role"/> on each <paramrefname="window"/> in your application, for the benefit of the session manager. Setting the role allows the window manager to restore window positions when loading a saved session.
<remarks>This is an advanced feature and is not used by typical code. The method removess the specified XID to a list of embedded windows that is maintained as object data on the Window object. This list is used for things like querying X rc settings.</remarks>
If the <paramrefname="window"/>'s "natural" size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the <paramrefname="window"/> (<seecref="M:Gtk.Window.SetGeometryHints"/> can be used to set these explicitly), the default size will be clamped to the nearest permitted size.
Unlike <seecref="M:Gtk.Widget.SetSizeRequest"/> which sets a size request for a <paramrefname="widget"/> and thus would keep users from shrinking the <paramrefname="window"/>, this method only sets the initial size, just as if the user had resized the <paramrefname="window"/> themselves. Users can still shrink the <paramrefname="window"/> again as they normally would. Setting a default size of -1 means to use the "natural" default size (the size request of the <paramrefname="window"/>).
For some uses, <seecref="M:Gtk.Window.Resize"/> is a more appropriate method. <seecref="M:Gtk.Window.Resize"/> changes the current size of the <paramrefname="window"/>, rather than the size to be used on initial display. <seecref="M:Gtk.Window.Resize"/> always affects the <paramrefname="window"/> itself, not the geometry widget.
The default size of a <paramrefname="window"/> only affects the first time a <paramrefname="window"/> is shown; if a <paramrefname="window"/> is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.
This may mean raising the <paramrefname="window"/> in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences. If <paramrefname="window"/> is hidden, this method calls <seecref="M:Gtk.Widget.Show"/> as well.
This method should be used when the user tries to open a <paramrefname="window"/> that's already open. Say for example the preferences dialog is currently open, and the user chooses Preferences from the menu a second time; use <seecref="M:Gtk.Window.Present"/> to move the already-open dialog where the user can see it.
Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the <paramrefname="window"/> has already been shown.
Note: the position is the position of the gravity-determined reference point for the <paramrefname="window"/>. The gravity determines two things: first, the location of the reference point in root <paramrefname="window"/> coordinates; and second, which point on the <paramrefname="window"/> is positioned at the reference point.
By default the gravity is <seecref="F:Gdk.Gravity.NorthWest"/> so the reference point is simply the x, y supplied to <seecref="M:Gtk.Window.Move"/>. The top-left corner of the <paramrefname="window"/> decorations (aka window frame or border) will be placed at <paramrefname="x"/>, <paramrefname="y"/>. Therefore, to position a <paramrefname="window"/> at the top left of the screen, you want to use the default gravity (which is <seecref="F:Gdk.Gravity.NorthWest"/>) and move the <paramrefname="window"/> to 0,0.
To position a <paramrefname="window"/> at the bottom right corner of the screen, you would set <seecref="F:Gdk.Gravity.SouthEast"/>, which means that the reference point is at x + the <paramrefname="window"/> width and y + the <paramrefname="window"/> height, and the bottom-right corner of the window border will be placed at that reference point.
You can set a minimum and maximum size; allowed resize increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. See <seecref="T:Gdk.Geometry"/>.
Creates a new Window object, wich can be of type TopLevel ( most of the cases ) or PopUp. Take care with the use of PopUp type, since it is not controlled by the window manager.
Creates a new TopLevel Window object, using <paramrefname="string"/> as the title. You get the same if you use the public Window ( Gtk.WindowType type ) constructor and later set the string Title property.
The default <paramrefname="widget"/> is the widget that's activated when the user presses Enter in a dialog (for example). When setting (rather than unsetting) the default <paramrefname="widget"/> it's generally easier to call <seecref="M:Gtk.Widget.GrabFocus"/> on the <paramrefname="widget"/>. Before making a default <paramrefname="widget"/>, you must set the <seecref="F:Gtk.WidgetFlags.CanDefault"/> flag on the <paramrefname="widget"/> you'd like to make the default.
<summary>If this function is called on a <paramrefname="window"/> with setting of <seelangword="true"/>, before it is realized or showed, it will have a "frame" <paramrefname="window"/> around widget->window, accessible in window->frame. Or it access the "frame" <paramrefname="window"/> exterior to widget->window.</summary>
Using the event <seecref="F:Gtk.WIndow.FrameEvent"/> you can receive all events targeted at the frame. This method is used by the linux-fb port to implement managed windows, but it could concievably be used by X-programs that want to do their own window decorations.
Note: This is a special-purpose method for the framebuffer port, this causes GTK# to draw its own window border. For most applications you want <seecref="P:Gtk.Window.Decorated"/> instead, which tells the window manager whether to draw the window border.
The default window gravity is <seecref="F:Gdk.Gravity.NorthWest"/> which is typically "do what you mean". See <seecref="M:Gtk.Window.Move"/> and <seecref="T:Gdk.Gravity"/>.
By setting the type hint for the <paramrefname="window"/>, you allow the window manager to decorate and handle the <paramrefname="window"/> in a way which is suitable to the function of the <paramrefname="window"/> in your application. This property should be called before the <paramrefname="window"/> becomes visible.
Dialog windows should be transient for the main <paramrefname="window"/> they were spawned from, this allows windows managers to e.g. keep the dialog on top of the main <paramrefname="window"/>, or center the dialog over the main <paramrefname="window"/>.
On Windows(tm), this function will and put the child <paramrefname="window"/> on top of the parent, much as the <paramrefname="window"/> would have done in X.
<summary>Sets a <paramrefname="widget"/> to be the focus widget for the <paramrefname="window"/> if it is not the current focus widget, and its focusable, or retrieves the current focused <paramrefname="widget"/> within the <paramrefname="window"/>.</summary>
Note: when retrieving the current focused <paramrefname="widget"/> is the <paramrefname="widget"/> that would have the focus if the toplevel focused; if the toplevel <paramrefname="window"/> is not focused then <seecref="P:Gtk.Widget.HasFocus"/> will not be <seelangword="true"/> for the <paramrefname="widget"/>.
<value>The role of the <paramrefname="window"/> if set, or <seelangword="null"/>. The returned is owned by the widget and must not be modified or freed.</value>
In combination with the <paramrefname="window"/> title, the <paramrefname="window"/> role allows a window manager to identify "the same" <paramrefname="window"/> when an application is restarted. So for example you might set the "toolbox" role on your app's toolbox <paramrefname="window"/>, so that when the user restarts their session, the session manager can put the toolbox back in the same place.
If a <paramrefname="window"/> already has a unique title, you don't need to set the role, since the WM can use the title to identigy the <paramrefname="window"/> when restoring the session.
By default, windows are decorated with a title bar and resize controls. Some window managers allow to disable these decorations, creating a borderless Window. If you set this property as false, Gtk# will try to convince the window manager not to decorate the <paramrefname="window"/>.
By default, the <paramrefname="window"/> are resizable, so you can change the size of them. But if you set this property to false, the user won't be able to change the size of them.
This property will alow you to define where a <paramrefname="window"/> should be displayed on the screen. Position values are described in the <seecref="T:Gtk.WindowPosition"/> definition.
This property will allow you to define the default height for your <paramrefname="window"/>. It only define the default one, so if the <paramrefname="window"/> is resized, it won't be able to do anything.
Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use <seecref="P:Gtk.Window.TransientFor"/> to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.
<value>The title of the <paramrefname="window"/>, or <seelangword="null"/> if none has been set explicitely. The returned string is owned by the <paramrefname="widget"/> and must not be modified or freed.</value>
This property will allow you to set the <paramrefname="window"/> title. The title of a <paramrefname="window"/> will be displayed in its title bar. Since the title bar is rendered by the window managers on X Window System, the way it appears will depend on the user preferences. This title should help the users to distinguish a <paramrefname="window"/> from others opened. A good title will have the application name an the actual document, for example.
This property will allow you to define the default width for <paramrefname="window"/>. It only define the default one, so if the <paramrefname="window"/> is resized, it won't be able to do anything.
By default, after showing the first <seecref="T:Gtk.Window"/> for each <seecref="T:Gdk.Screen"/>, GTK# calls <seecref="M:Gdk.Global.NotifyStartupComplete"/>. Use this property to disable the automatic startup notification.
You might do this if your first <paramrefname="window"/> is a splash screen, and you want to delay notification until after your real main <paramrefname="window"/> has been shown, for example. In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main <paramrefname="window"/> would automatically result in notification.
<summary>Sets an icon to be used as fallback for windows that haven't had <seecref="P:Gtk.Window.IconList"/> called on them from a file on disk.</summary>
<paramname="filename">Location of icon file.</param>
Note that you shouldn't assume the <paramrefname="window"/> is definitely full screen afterward, because other entities (e.g. the user or window manager) could unfullscreen it again, and not all window managers honor requests to fullscreen windows. But normally the <paramrefname="window"/> will end up restored to its normal state. Just don't write code that crashes if not.
Note that you shouldn't assume the <paramrefname="window"/> is definitely not full screen afterward, because other entities (e.g. the user or window manager) could fullscreen it again, and not all window managers honor requests to unfullscreen windows. But normally the <paramrefname="window"/> will end up restored to its normal state. Just don't write code that crashes if not.
<summary>Sets or obtains the icon list to be used as fallback for windows that haven't had <seecref="M:Gtk.Window.IconList"/> called on them to set up a window-specific icon list.</summary>
The icon is used when <paramrefname="window"/> is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts.
</para>
<para>
<seecref="M:Gtk.Window.IconList"/> allows you to pass the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is available in; that is, don't scale the image before passing it to GTK#. Scaling is postponed unitl the last minute, when the desired final size is known, to allow best quality. By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.
</para>
<para>
Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them).
</para>
<para>
Note that transient windows (those who have been set transient for another <paramrefname="window"/> using <seecref="P:Gtk.Window.TransientFor"/> will inherit their icon from their transient parent. So there's no need to explicity set the icon on transient windows.
</para>
<para>
When retrieving the list is copied, but the reference count on each won't be incremented.
A value of -1 for the size indicates that a default size has not been explicitly set for that dimension, so the "natural" size of the <paramrefname="window"/> will be used.
</para>
<para>
If the <paramrefname="window"/>'s "natural" size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the <paramrefname="window"/> (<seecref="M:Gtk.Window.SetGeometryHints"/> can be used to set these explicitly), the default size will be clamped to the nearest permitted size.
</para>
<para>
Unlike <seecref="M:Gtk.Widget.SizeRequest"/>, which sets a size request for a <paramrefname="widget"/> and thus would keep users from shrinking the <paramrefname="window"/>, this method only sets the initial size, just as if the user had resized the <paramrefname="window"/> themselves. Users can still shrink the <paramrefname="window"/> again as they normally would. Setting a default size of -1 means to use the "natural" default size (the size request of the <paramrefname="window"/>).
</para>
<para>
For more control over a <paramrefname="window"/>'s initial size and how resizing works, read <seecref="M:Gtk.Window.SetGeometryHints"/>.
</para>
<para>
For some uses, <seecref="M:Gtk.Window.Resize"/> is a more appropriate method. <seecref="M:Gtk.Window.Resize"/> changes the current size of the <paramrefname="window"/>, rather than the size to be used on initial display. <seecref="M:Gtk.Window.Resize"/> always affects the <paramrefname="window"/> itself, not the geometry widget.
</para>
<para>
The default size of a <paramrefname="window"/> only affects the first time a <paramrefname="window"/> is shown; if a <paramrefname="window"/> is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.
</para>
<para>
Windows can't actually be 0x0 in size, they must be at least 1x1, but passing 0 is OK, resulting in a 1x1 default size.
<para>Note that you should not assume the window is definitely below afterward, because other entities (e.g. the user or window manager) could not keep it below, and not all window managers support putting windows below. But normally the window will be kept below. Just do not write code that crashes if not.</para>
<para>It is permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially.</para>
<para>You can track the below state via <seecref="E:Gtk.Widget.WindowStateEvent"/> event.</para>
<para>Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
<para>Note that you should not assume the window is definitely below afterward, because other entities (e.g. the user or window manager) could not keep it above, and not all window managers support putting windows below. But normally the window will be kept above. Just do not write code that crashes if not.</para>
<para>It is permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially.</para>
<para>You can track the below state via <seecref="E:Gtk.Widget.WindowStateEvent"/> event.</para>
<para>Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
<remarks>This is normally called by the default KeyPressEvent handler for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.</remarks>
<para><seecref="M:Gtk.Window.SetPolicy()"/> is deprecated and should not be used in newly-written code. Use <seecref="M:Gtk.Window.SetResizable()"/> instead.
If set to <seelangword="true"/>, the allow_grow parameter allows the user to expand the window beyond the size request of its child widgets. If allow_grow is <seelangword="true"/>, be sure to check that your child widgets work properly as the window is resized.
</para><para>
A toplevel window will always change size to ensure its child widgets receive their requested size. This means that if you add child widgets, the toplevel window will expand to contain them. However, normally the toplevel will not shrink to fit the size request of its children if it's too large; the auto_shrink parameter causes the window to shrink when child widgets have too much space. auto_shrink is normally used with the second of the two window policies mentioned above. That is, set auto_shrink to <seelangword="true"/> if you want the window to have a fixed, always-optimal size determined by your program.
</para><para>
Note that auto_shrink does not do anything if allow_shrink and allow_grow are both set to <seelangword="false"/>.
</para><para>
Neither of the two suggested window policies set the allow_shrink parameter to <seelangword="true"/>. If allow_shrink is <seelangword="true"/>, the user can shrink the window so that its children do not receive their full size request; this is basically a bad thing, because most widgets will look wrong if this happens. Furthermore Gtk has a tendency to re-expand the window if size is recalculated for any reason. The upshot is that allow_shrink should always be set to <seelangword="false"/>.
</para><para>
Sometimes when you think you want to use allow_shrink, the real problem is that some specific child widget is requesting too much space, so the user can't shrink the window sufficiently. Perhaps you are calling gtk_widget_set_size_request() on a child widget, and forcing its size request to be too large. Instead of setting the child's usize, consider using gtk_window_set_default_size() so that the child gets a larger allocation than it requests.</para></remarks>
<summary>Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles <paramrefname="evnt"/>.</summary>
<remarks>This is normally called by the default KeyPressEvent and KeyReleaseEvent handlers for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.</remarks>