11.147Class GtkWindow

Toplevel which can contain other widgets.

Class GtkWindow( [type] )
type GTK_WINDOW_TOPLEVEL (default) or GTK_WINDOW_POPUP

Creates a new GtkWindow, which is a toplevel window that can contain other widgets. Nearly always, the type of the window should be GTK_WINDOW_TOPLEVEL. If you're implementing something like a popup menu from scratch (which is a bad idea, just use GtkMenu), you might use GTK_WINDOW_POPUP. GTK_WINDOW_POPUP is not for dialogs, though in some other toolkits dialogs are called "popups". In GTK+, GTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the window manager.

If you simply want an undecorated window (no window borders), use gtk_window_set_decorated(), don't use GTK_WINDOW_POPUP.

Methods
activate_defaultActivates the default widget for the window
activate_focusActivates the current focused widget within the window.
add_mnemonicAdds a mnemonic to this window.
begin_move_dragStarts moving a window.
begin_resize_dragStarts resizing a window.
deiconifyAsks to deiconify (i.e. unminimize) the specified window.
fullscreenAsks to place window in the fullscreen state.
get_accept_focusGets the value set by set_accept_focus().
get_decoratedReturns whether the window has been set to have decorations such as a title bar via set_decorated().
get_default_icon_nameGets the window default icon name.
get_default_sizeGets the default size of the window.
get_default_widgetReturns the default widget for window.
get_deletableReturns whether the window has been set to have a close button via set_deletable().
get_destroy_with_parentReturns whether the window will be destroyed with its transient parent.
get_focusRetrieves the current focused widget within the window.
get_focus_on_mapGets the value set by gtk_window_set_focus_on_map().
get_frame_dimensionsRetrieves the dimensions of the frame window for this toplevel.
get_gravityGets the value set by set_gravity().
get_has_frameAccessor for whether the window has a frame window exterior to window->window.
get_icon_nameReturns the name of the themed icon for the window, see set_icon_name().
get_mnemonic_modifierReturns the mnemonic modifier for this window.
get_mnemonics_visibleGets the value of the "mnemonics-visible" property.
get_modalReturns whether the window is modal.
get_opacityFetches the requested opacity for this window.
get_positionGets the window position.
get_resizableGets the value set by set_resizable().
get_roleReturns the role of the window.
get_screenReturns the GdkScreen associated with window.
get_sizeObtains the current size of window.
get_skip_pager_hintGets the value set by set_skip_pager_hint().
get_skip_taskbar_hintGets the value set by set_skip_taskbar_hint()
get_titleRetrieves the title of the window.
get_transient_forFetches the transient parent for this window.
get_type_hintGets the type hint for this window.
get_urgency_hintGets the value set by set_urgency_hint()
get_window_typeGets the type of the window.
has_topelevel_focusReturns whether the input focus is within this GtkWindow.
iconifyAsks to iconify (i.e. minimize) the specified window.
is_activeReturns whether the window is part of the current active toplevel.
list_toplevelsReturns a list of all existing toplevel windows.
maximizeAsks to maximize window, so that it becomes full-screen.
mnemonic_activateActivates the targets associated with the mnemonic.
moveAsks the window manager to move window to the given position.
parse_geometryParses a standard X Window System geometry string
presentPresents a window to the user.
present_with_timePresents a window to the user in response to a user interaction.
remove_mnemonicRemoves a mnemonic from this window.
reshow_initial_sizeHides window, then reshows it, resetting the default size and position of the window.
resizeResizes the window as if the user had done so, obeying geometry constraints.
set_accept_focusSets the window accept-focus hint.
set_auto_startup_notificationSets the window startup notification.
set_decoratedSets the window decorations.
set_defaultSets the default widget.
set_default_icon_nameSets an icon to be used as fallback.
set_default_sizeSets the default size of a window.
set_deletableSets the window deletable.
set_destroy_with_parentDestroys the window along with its parent.
set_focusSets the focus on a widget.
set_focus_on_mapSets the window focus-on-map hint.
set_frame_dimensionsSets the window frame dimensions.
set_geometry_hintsThis function sets up hints about how a window can be resized by the user.
set_gravitySets window gravity.
set_has_frameSets the window frame.
set_icon_nameSets the icon for the window from a named themed icon.
set_keep_aboveAsks to keep window above, so that it stays on top.
set_keep_belowAsks to keep window below, so that it stays in bottom.
set_mnemonic_modifierSets the mnemonic modifier for this window.
set_mnemonics_visibleSets the "mnemonics-visible" property.
set_modalSets a window modal or non-modal.
set_opacitySets the window opacity.
set_positionSets a position constraint for this window.
set_resizableSets whether the user can resize a window.
set_roleSets the window role.
set_screenSets the GdkScreen where the window is displayed.
set_skip_pager_hintSets the window pager hint.
set_skip_taskbar_hintSets the window taskbar hint.
set_startup_idSets the window startup identifier.
set_titleSets the title of the GtkWindow.
set_transient_forSets the window transient for a parent window.
set_type_hintSets the window type hint.
set_urgency_hintSets the window urgency hint.
set_wmclassDon't use this function.
signal_activate_defaultThe ::activate-default signal is a keybinding signal which gets emitted when the user activates the default widget of window.
signal_activate_focusThe activate-focus signal is a keybinding signal which gets emitted when the user activates the currently focused widget of window.
signal_frame_event.
signal_keys_changedThe keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.
signal_set_focus.
stickAsks to stick window, which means that it will appear on all user desktops.
unfullscreenAsks to toggle off the fullscreen state for window.
unmaximizeAsks to unmaximize window.
unstickAsks to unstick window, which means that it will appear on only one of the user's desktops.

Methods

activate_default

Activates the default widget for the window

GtkWindow.activate_default()
Return(boolean) true if a widget got activated.

Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see gtk_widget_set_receives_default()), in which case the focused widget is activated.

activate_focus

Activates the current focused widget within the window.

GtkWindow.activate_focus()
Return(boolean) true if a widget got activated.

add_mnemonic

Adds a mnemonic to this window.

GtkWindow.add_mnemonic( keyval, target )
keyval the mnemonic character
target the widget that gets activated by the mnemonic (GtkWidget)

begin_move_drag

Starts moving a window.

GtkWindow.begin_move_drag( button, root_x, root_y, timestamp )
button mouse button that initiated the drag (integer)
root_x X position where the user clicked to initiate the drag, in root window coordinates (integer)
root_y Y position where the user clicked to initiate the drag (integer)
timestamp timestamp from the click event that initiated the drag (integer)

This function 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.

begin_resize_drag

Starts resizing a window.

GtkWindow.begin_resize_drag( edge, button, root_x, root_y, timestamp )
edge position of the resize control (integer, GdkWindowEdge)
button mouse button that initiated the drag (integer)
root_x X position where the user clicked to initiate the drag, in root window coordinates (integer)
root_y Y position where the user clicked to initiate the drag (integer)
timestamp timestamp from the click event that initiated the drag (integer)

This function 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.

deiconify

Asks to deiconify (i.e. unminimize) the specified window.

GtkWindow.deiconify()

Note that you shouldn't assume the 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.

You can track iconification via the "window-state-event" signal on GtkWidget.

fullscreen

Asks to place window in the fullscreen state.

GtkWindow.fullscreen()

Note that you shouldn't assume the 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 window will end up fullscreen. Just don't write code that crashes if not.

You can track the fullscreen state via the "window-state-event" signal on GtkWidget.

get_accept_focus

Gets the value set by set_accept_focus().

GtkWindow.get_accept_focus()
Returntrue if window should receive the input focus (boolean)

get_decorated

Returns whether the window has been set to have decorations such as a title bar via set_decorated().

GtkWindow.get_decorated()
Return(boolean) true if the window has been set to have decorations

get_default_icon_name

Gets the window default icon name.

GtkWindow.get_default_icon_name()
Returnthe fallback icon name for windows, or nil

Returns the fallback icon name for windows that has been set with set_default_icon_name(). It is only valid until the next call to set_default_icon_name().

get_default_size

Gets the default size of the window.

GtkWindow.get_default_size()
Returnan array [ default width, default height ]

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 window will be used.

get_default_widget

Returns the default widget for window.

GtkWindow.get_default_widget()
Returnthe default widget, or nil if there is none.

get_deletable

Returns whether the window has been set to have a close button via set_deletable().

GtkWindow.get_deletable()
Return(boolean) true if the window has been set to have a close button

get_destroy_with_parent

Returns whether the window will be destroyed with its transient parent.

GtkWindow.get_destroy_with_parent()
Return(boolean) true if the window will be destroyed with its transient parent.

get_focus

Retrieves the current focused widget within the window.

GtkWindow.get_focus()
Returnthe currently focused widget, or nil if there is none.

Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then gtk_widget_has_focus (widget) will not be TRUE for the widget.

get_focus_on_map

Gets the value set by gtk_window_set_focus_on_map().

GtkWindow.get_focus_on_map()
Returntrue if window should receive the input focus when mapped. (boolean)

get_frame_dimensions

Retrieves the dimensions of the frame window for this toplevel.

GtkWindow.get_frame_dimensions()
Returnan array [ left, top, right, bottom ]

(Note: this is a special-purpose function intended for the framebuffer port; see set_has_frame(). 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 gdk_window_get_frame_extents() to get the standard window border extents.)

See gtk_window_set_has_frame(), gtk_window_set_frame_dimensions().

get_gravity

Gets the value set by set_gravity().

GtkWindow.get_gravity()
Return(integer)

get_has_frame

Accessor for whether the window has a frame window exterior to window->window.

GtkWindow.get_has_frame()
Return(boolean) true if a frame has been added to the window via set_has_frame().

Gets the value set by set_has_frame().

get_icon_name

Returns the name of the themed icon for the window, see set_icon_name().

GtkWindow.get_icon_name()
Returnthe icon name or nil if the window has no themed icon

get_mnemonic_modifier

Returns the mnemonic modifier for this window.

GtkWindow.get_mnemonic_modifier()
Returnthe modifier mask used to activate mnemonics on this window. (GdkModifierType)

See set_mnemonic_modifier().

get_mnemonics_visible

Gets the value of the "mnemonics-visible" property.

GtkWindow.get_mnemonics_visible()
ReturnTRUE if mnemonics are supposed to be visible in this window.

get_modal

Returns whether the window is modal.

GtkWindow.get_modal()
Return(boolean) true if the window is set to be modal and establishes a grab when shown

See set_modal().

get_opacity

Fetches the requested opacity for this window.

GtkWindow.get_opacity()
Returnthe requested opacity for this window. (float)

See set_opacity().

get_position

Gets the window position.

GtkWindow.get_position()
Returnan array [ root_x, root_y ]

This function returns the position you need to pass to gtk_window_move() to keep window in its current position. This means that the meaning of the returned value varies with window gravity. See gtk_window_move() for more details.

If you haven't changed the window gravity, its gravity will be GDK_GRAVITY_NORTH_WEST. This means that gtk_window_get_position() gets the position of the top-left corner of the window manager frame for the window. gtk_window_move() sets the position of this same top-left corner.

gtk_window_get_position() is not 100% reliable because the X Window System does not specify a way to obtain the geometry of the decorations placed on a 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 window to its current position as returned by gtk_window_get_position() tends to result in moving the window slightly. Window managers are slowly getting better over time.

If a window has gravity GDK_GRAVITY_STATIC the window manager frame is not relevant, and thus gtk_window_get_position() will always produce accurate results. However you can't use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations.

If you are saving and restoring your application's 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 window sizes and positions.

get_resizable

Gets the value set by set_resizable().

GtkWindow.get_resizable()
ReturnTRUE if the user can resize the window

get_role

Returns the role of the window.

GtkWindow.get_role()
Returnthe role of the window if set, or nil.

See set_role() for further explanation.

get_screen

Returns the GdkScreen associated with window.

GtkWindow.get_screen()
Returna GdkScreen.

get_size

Obtains the current size of window.

GtkWindow.get_size()
Returnan array [ width, height ]

If 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 gtk_window_get_size() 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 gtk_window_resize() then immediately call gtk_window_get_size(), the size won't 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 window gets updated.

Note 1: Nearly any use of this function creates a race condition, because the size of the 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 "configure-event" on the window and adjust your size-dependent state to match the size delivered in the GdkEventConfigure.

Note 2: The returned size does not include the size of the window manager decorations (aka the window frame or border). Those are not drawn by GTK+ and GTK+ has no reliable method of determining their size.

Note 3: If you are getting a window size in order to position the window onscreen, there may be a better way. The preferred way is to simply set the window's semantic type with gtk_window_set_type_hint(), which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with gtk_window_set_transient_for() window managers will often center the dialog over its parent window. It's much preferred to let the window manager handle these things rather than doing it yourself, because all apps will behave consistently and according to user prefs if the window manager handles it. Also, the window manager can take the size of the window decorations/border into account, while your application cannot.

In any case, if you insist on application-specified window positioning, there's still a better way than doing it yourself - gtk_window_set_position() will frequently handle the details for you.

get_skip_pager_hint

Gets the value set by set_skip_pager_hint().

GtkWindow.get_skip_pager_hint()
Returntrue if window shouldn't be in pager (boolean)

get_skip_taskbar_hint

Gets the value set by set_skip_taskbar_hint()

GtkWindow.get_skip_taskbar_hint()
Returntrue if window shouldn't be in taskbar (boolean)

get_title

Retrieves the title of the window.

GtkWindow.get_title()
Returnthe title of the window, or nil if none has been set explicitely.

get_transient_for

Fetches the transient parent for this window.

GtkWindow.get_transient_for()
Returnthe transient parent for this window, or NULL if no transient parent has been set.

get_type_hint

Gets the type hint for this window.

GtkWindow.get_type_hint()
Returnthe type hint for window. (GdkWindowTypeHint)

get_urgency_hint

Gets the value set by set_urgency_hint()

GtkWindow.get_urgency_hint()
Returntrue if window is urgent (boolean)

get_window_type

Gets the type of the window.

GtkWindow.get_window_type()
Returnthe type of the window (GtkWindowType)

has_topelevel_focus

Returns whether the input focus is within this GtkWindow.

GtkWindow.has_topelevel_focus()
Return(boolean)

For real toplevel windows, this is identical to gtk_window_is_active(), but for embedded windows, like GtkPlug, the results will differ.

iconify

Asks to iconify (i.e. minimize) the specified window.

GtkWindow.iconify()

Note that you shouldn't assume the 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 window will end up iconified. Just don't write code that crashes if not.

It's permitted to call this function before showing a window, in which case the window will be iconified before it ever appears onscreen.

You can track iconification via the "window-state-event" signal on GtkWidget.

is_active

Returns whether the window is part of the current active toplevel.

GtkWindow.is_active()
Return(boolean) true if the window part of the current active window.

(That is, the toplevel window receiving keystrokes.) The return value is TRUE if the window is active toplevel itself, but also if it is, say, a GtkPlug embedded in the active toplevel. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window. See gtk_window_has_toplevel_focus()

list_toplevels

Returns a list of all existing toplevel windows.

GtkWindow.list_toplevels()
ReturnAn array of GtkWindow

maximize

Asks to maximize window, so that it becomes full-screen.

GtkWindow.maximize()

Note that you shouldn't assume the 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 window will end up maximized. Just don't write code that crashes if not.

It's permitted to call this function before showing a window, in which case the window will be maximized when it appears onscreen initially.

You can track maximization via the "window-state-event" signal on GtkWidget.

mnemonic_activate

Activates the targets associated with the mnemonic.

GtkWindow.mnemonic_activate( keyval, modifier )
keyval the mnemonic character
modifier the modifiers (GdkModifierType)
Returntrue if the activation is done.

move

Asks the window manager to move window to the given position.

GtkWindow.move( x, y )
x X coordinate to move window to
y Y coordinate to move window to

Asks the window manager to move window to the given position. 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 window has already been shown.

Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point.

By default the gravity is GDK_GRAVITY_NORTH_WEST, so the reference point is simply the x, y supplied to gtk_window_move(). The top-left corner of the window decorations (aka window frame or border) will be placed at x, y. Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is GDK_GRAVITY_NORTH_WEST) and move the window to 0,0.

To position a window at the bottom right corner of the screen, you would set GDK_GRAVITY_SOUTH_EAST, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point. So, to place a window in the bottom right corner you would first set gravity to south east, then write: gtk_window_move (window, gdk_screen_width() - window_width, gdk_screen_height() - window_height) (note that this example does not take multi-head scenarios into account).

The Extended Window Manager Hints specification at http:www.freedesktop.org/Standards/wm-spec has a nice table of gravities in the "implementation notes" section.

The gtk_window_get_position() documentation may also be relevant.

parse_geometry

Parses a standard X Window System geometry string

GtkWindow.parse_geometry( geometry )
geometry geometry string
Returntrue if string was parsed successfully (boolean)

Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this. gtk_window_parse_geometry() does work on all GTK+ ports including Win32 but is primarily intended for an X environment.

If either a size or a position can be extracted from the geometry string, gtk_window_parse_geometry() returns TRUE and calls gtk_window_set_default_size() and/or gtk_window_move() to resize/move the window.

If gtk_window_parse_geometry() returns TRUE, it will also set the GDK_HINT_USER_POS and/or GDK_HINT_USER_SIZE hints indicating to the window manager that the size/position of the window was user-specified. This causes most window managers to honor the geometry.

Note that for gtk_window_parse_geometry() to work as expected, it has to be called when the window has its "final" size, i.e. after calling gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints() on the window.

present

Presents a window to the user.

GtkWindow.present()

This may mean raising the 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 window is hidden, this function calls show() as well.

This function should be used when the user tries to open a 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 present() to move the already-open dialog where the user can see it.

If you are calling this function in response to a user interaction, it is preferable to use present_with_time().

present_with_time

Presents a window to the user in response to a user interaction.

GtkWindow.present_with_time( timestamp )
timestamp the timestamp of the user interaction (typically a button or key press event) which triggered this call

If you need to present a window without a timestamp, use present().

remove_mnemonic

Removes a mnemonic from this window.

GtkWindow.remove_mnemonic( keyval, target )
keyval the mnemonic character
target the widget that gets activated by the mnemonic (GtkWidget)

reshow_initial_size

Hides window, then reshows it, resetting the default size and position of the window.

GtkWindow.reshow_initial_size()

Used by GUI builders only.

resize

Resizes the window as if the user had done so, obeying geometry constraints.

GtkWindow.resize( width, height )
width width in pixels to resize the window to
height height in pixels to resize the window to

The default geometry constraint is that windows may not be smaller than their size request; to override this constraint, call gtk_widget_set_size_request() to set the window's request to a smaller value.

If gtk_window_resize() is called before showing a window for the first time, it overrides any default size set with gtk_window_set_default_size().

Windows may not be resized smaller than 1 by 1 pixels.

set_accept_focus

Sets the window accept-focus hint.

GtkWindow.set_accept_focus( setting )
setting (boolean) True to let this window receive input focus

Windows may set a hint asking the desktop environment not to receive the input focus. This function sets this hint.

set_auto_startup_notification

Sets the window startup notification.

GtkWindow.set_auto_startup_notification( setting )
setting true to automatically do startup notification (boolean)

By default, after showing the first GtkWindow, GTK+ calls gdk_notify_startup_complete(). Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main 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 window would automatically result in notification.

set_decorated

Sets the window decorations.

GtkWindow.set_decorated( setting )
setting (boolean) true to decorate the window

By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow GTK+ to disable these decorations, creating a borderless window. If you set the decorated property to FALSE using this function, GTK+ will do its best to convince the window manager not to decorate the window. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling gtk_window_show().

On Windows, this function always works, since there's no window manager policy involved.

set_default

Sets the default widget.

GtkWindow.set_default( default_widget )
default_widget widget to be the default, or NULL to unset the default widget for the toplevel.

The default widget is the widget that's activated when the user presses Enter in a dialog (for example). This function sets or unsets the default widget for a GtkWindow about. When setting (rather than unsetting) the default widget it's generally easier to call gtk_widget_grab_focus() on the widget. Before making a widget the default widget, you must set the GTK_CAN_DEFAULT flag on the widget you'd like to make the default using GTK_WIDGET_SET_FLAGS().

set_default_icon_name

Sets an icon to be used as fallback.

GtkWindow.set_default_icon_name( name )
name the name of the themed icon

Sets an icon to be used as fallback for windows that haven't had set_icon_list() called on them from a named themed icon, see set_icon_name().

set_default_size

Sets the default size of a window.

GtkWindow.set_default_size( width, height )
width width in pixels, or -1 to unset the default width
height height in pixels, or -1 to unset the default height

If the 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 window (set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

Unlike 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).

For more control over a window's initial size and how resizing works, investigate set_geometry_hints().

For some uses, resize() is a more appropriate function. resize() changes the current size of the window, rather than the size to be used on initial display. resize() always affects the window itself, not the geometry widget.

The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.

Windows can't actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size.

set_deletable

Sets the window deletable.

GtkWindow.set_deletable( setting )
setting (boolean) true to decorate the window as deletable.

By default, windows have a close button in the window frame. Some window managers allow GTK+ to disable this button. If you set the deletable property to FALSE using this function, GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling gtk_window_show().

On Windows, this function always works, since there's no window manager policy involved.

set_destroy_with_parent

Destroys the window along with its parent.

GtkWindow.set_destroy_with_parent( setting )
setting whether to destroy window with its transient parent (boolean)

If setting is TRUE, then destroying the transient parent of window will also destroy window itself. This is useful for dialogs that shouldn't persist beyond the lifetime of the main window they're associated with, for example.

set_focus

Sets the focus on a widget.

GtkWindow.set_focus( focus )
focus widget to be the new focus widget, or NULL to unset any focus widget for the toplevel window.

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. If focus is NULL, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, it is usually more convenient to use grab_focus() instead of this function.

set_focus_on_map

Sets the window focus-on-map hint.

GtkWindow.set_focus_on_map( setting )
setting (boolean) true to let this window receive input focus on map

Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped. This function sets this hint.

set_frame_dimensions

Sets the window frame dimensions.

GtkWindow.set_frame_dimensions( left, top, right, bottom )
left The width of the left border (integer)
top The height of the top border (integer)
right The width of the right border (integer)
bottom The height of the bottom border (integer)

(Note: this is a special-purpose function intended for the framebuffer port; see gtk_window_set_has_frame(). 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.)

For windows with frames (see gtk_window_set_has_frame()) this function can be used to change the size of the frame border.

set_geometry_hints

This function sets up hints about how a window can be resized by the user.

GtkWindow.set_geometry_hints( geometry_widget, geometry, geom_mask )
geometry_widget widget the geometry hints will be applied to or NULL.
geometry GdkGeometry containing geometry information or NULL.
geom_mask mask (GdkWindowHints) indicating which struct fields should be paid attention to

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 the GdkGeometry struct.

set_gravity

Sets window gravity.

GtkWindow.set_gravity( gravity )
gravity a valid GdkGravity value

Window gravity defines the meaning of coordinates passed to move(). See gtk_window_move() and GdkGravity for more details.

The default window gravity is GDK_GRAVITY_NORTH_WEST which will typically "do what you mean."

set_has_frame

Sets the window frame.

GtkWindow.set_has_frame( setting )
setting (boolean)

(Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border. For most applications, you want set_decorated() instead, which tells the window manager whether to draw the window border.)

If this function is called on a window with setting of TRUE, before it is realized or showed, it will have a "frame" window around window->window, accessible in window->frame. Using the signal frame_event you can receive all events targeted at the frame.

This function is used by the linux-fb port to implement managed windows, but it could conceivably be used by X-programs that want to do their own window decorations.

set_icon_name

Sets the icon for the window from a named themed icon.

GtkWindow.set_icon_name( the )
the name of the themed icon (or nil)

See the docs for GtkIconTheme for more details.

Note that this has nothing to do with the WM_ICON_NAME property which is mentioned in the ICCCM.

set_keep_above

Asks to keep window above, so that it stays on top.

GtkWindow.set_keep_above( setting )
setting whether to keep window above other windows (boolean)

Note that you shouldn't assume the window is definitely above afterward, because other entities (e.g. the user or window manager) could not keep it above, and not all window managers support keeping windows above. But normally the window will end kept above. Just don't write code that crashes if not.

It's permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially.

You can track the above state via the "window-state-event" signal on GtkWidget.

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.

set_keep_below

Asks to keep window below, so that it stays in bottom.

GtkWindow.set_keep_below( setting )
setting whether to keep window below other windows (boolean)

Note that you shouldn't 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 don't write code that crashes if not.

It's permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially.

You can track the below state via the "window-state-event" signal on GtkWidget.

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.

set_mnemonic_modifier

Sets the mnemonic modifier for this window.

GtkWindow.set_mnemonic_modifier( modifier )
modifier the modifier mask used to activate mnemonics on this window. (GdkModifierType)

set_mnemonics_visible

Sets the "mnemonics-visible" property.

GtkWindow.set_mnemonics_visible( visible )
visible TRUE to set mnemonics visible

set_modal

Sets a window modal or non-modal.

GtkWindow.set_modal()

Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use set_transient_for() to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

set_opacity

Sets the window opacity.

GtkWindow.set_opacity( opacity )
opacity desired opacity, between 0 and 1 (float)

Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) On X11 this has any effect only on X screens with a compositing manager running. See gtk_widget_is_composited(). On Windows it should work always.

Note that setting a window's opacity after the window has been shown causes it to flicker once on Windows.

set_position

Sets a position constraint for this window.

GtkWindow.set_position( position )
position a position constraint. (GtkWindowPosition)

If the old or new constraint is GTK_WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

set_resizable

Sets whether the user can resize a window.

GtkWindow.set_resizable( resizable )
resizable true if the user can resize this window

Windows are user resizable by default.

set_role

Sets the window role.

GtkWindow.set_role( role )
role unique identifier for the window to be used when restoring a session (string)

This function is only useful on X11, not with other GTK+ targets.

In combination with the window title, the window role allows a window manager to identify "the same" window when an application is restarted. So for example you might set the "toolbox" role on your app's toolbox window, so that when the user restarts their session, the window manager can put the toolbox back in the same place.

If a window already has a unique title, you don't need to set the role, since the WM can use the title to identify the window when restoring the session.

set_screen

Sets the GdkScreen where the window is displayed.

GtkWindow.set_screen( screen )
screen a GdkScreen.

If the window is already mapped, it will be unmapped, and then remapped on the new screen.

set_skip_pager_hint

Sets the window pager hint.

GtkWindow.set_skip_pager_hint( setting )
setting (boolean) true to keep this window from appearing in the pager

Windows may set a hint asking the desktop environment not to display the window in the pager. This function sets this hint. (A "pager" is any desktop navigation tool such as a workspace switcher that displays a thumbnail representation of the windows on the screen.)

set_skip_taskbar_hint

Sets the window taskbar hint.

GtkWindow.set_skip_taskbar_hint( setting )
setting (boolean) true to keep this window from appearing in the task bar

Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint.

set_startup_id

Sets the window startup identifier.

GtkWindow.set_startup_id( startup_id )
startup_id a string with startup-notification identifier

Startup notification identifiers are used by desktop environment to track application startup, to provide user feedback and other features. This function changes the corresponding property on the underlying GdkWindow. Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling present() or any equivalent function generating a window map event.

This function is only useful on X11, not with other GTK+ targets.

set_title

Sets the title of the GtkWindow.

GtkWindow.set_title( title )
title title of the window

The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager, so exactly how the title appears to users may vary according to a user's exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example.

set_transient_for

Sets the window transient for a parent window.

GtkWindow.set_transient_for( parent )
parent parent window, or NULL.

Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window. gtk_dialog_new_with_buttons() and other convenience functions in GTK+ will sometimes call gtk_window_set_transient_for() on your behalf.

Passing NULL for parent unsets the current transient window.

On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X.

set_type_hint

Sets the window type hint.

GtkWindow.set_type_hint( hint )
hint the window type (GdkWindowTypeHint)

By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.

This function should be called before the window becomes visible.

set_urgency_hint

Sets the window urgency hint.

GtkWindow.set_urgency_hint( setting )
setting (boolean) true to mark this window as urgent

Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint.

set_wmclass

Don't use this function.

GtkWindow.set_wmclass( wmclass_name, wmclass_class )
wmclass_name window name hint
wmclass_class window class hint

It sets the X Window System "class" and "name" hints for a window. 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 function is sort of pointless. However, you may want to call gtk_window_set_role() on each 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.

signal_activate_default

The ::activate-default signal is a keybinding signal which gets emitted when the user activates the default widget of window.

GtkWindow.signal_activate_default()

signal_activate_focus

The activate-focus signal is a keybinding signal which gets emitted when the user activates the currently focused widget of window.

GtkWindow.signal_activate_focus()

signal_frame_event

.

GtkWindow.signal_frame_event()

signal_keys_changed

The keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.

GtkWindow.signal_keys_changed()

signal_set_focus

.

GtkWindow.signal_set_focus()

stick

Asks to stick window, which means that it will appear on all user desktops.

GtkWindow.stick()

Note that you shouldn't assume the 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 window will end up stuck. Just don't write code that crashes if not.

It's permitted to call this function before showing a window.

You can track stickiness via the "window-state-event" signal on GtkWidget.

unfullscreen

Asks to toggle off the fullscreen state for window.

GtkWindow.unfullscreen()

Note that you shouldn't assume the 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 window will end up restored to its normal state. Just don't write code that crashes if not.

You can track the fullscreen state via the "window-state-event" signal on GtkWidget.

unmaximize

Asks to unmaximize window.

GtkWindow.unmaximize()

Note that you shouldn't assume the 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 window will end up unmaximized. Just don't write code that crashes if not.

You can track maximization via the "window-state-event" signal on GtkWidget.

unstick

Asks to unstick window, which means that it will appear on only one of the user's desktops.

GtkWindow.unstick()

Note that you shouldn't assume the window is definitely unstuck afterward, because other entities (e.g. the user or window manager) could stick it again. But normally the window will end up stuck. Just don't write code that crashes if not.

You can track stickiness via the "window-state-event" signal on GtkWidget.

Made with http://www.falconpl.org