Struct gdk::Window

source · []
#[repr(transparent)]
pub struct Window { /* private fields */ }
Expand description

This is an Abstract Base Class, you cannot instantiate it.

Implements

WindowExtManual

Implementations

Emits a short beep associated to self in the appropriate display, if supported. Otherwise, emits a short beep on the display just as Display::beep().

Available on crate feature v3_22 only.

Indicates that you are beginning the process of redrawing region on self, and provides you with a DrawingContext.

If self is a top level Window, backed by a native window implementation, a backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background surface for self. Then, all drawing operations performed on self will be diverted to the backing store. When you call gdk_window_end_frame(), the contents of the backing store will be copied to self, making it visible on screen. Only the part of self contained in region will be modified; that is, drawing operations are clipped to region.

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call end_draw_frame(). If you draw to self directly without calling begin_draw_frame(), the user may see flicker as individual drawing operations are performed in sequence.

When using GTK+, the widget system automatically places calls to begin_draw_frame() and end_draw_frame() around emissions of the GtkWidget::draw signal. That is, if you’re drawing the contents of the widget yourself, you can assume that the widget has a cleared background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code in GTK does not need to call begin_draw_frame() explicitly.

region

a Cairo region

Returns

a DrawingContext context that should be used to draw the contents of the window; the returned context is owned by GDK.

Begins a window move operation (for a toplevel window).

This function assumes that the drag is controlled by the client pointer device, use begin_move_drag_for_device() to begin a drag with a different device.

button

the button being used to drag, or 0 for a keyboard-initiated drag

root_x

root window X coordinate of mouse click that began the drag

root_y

root window Y coordinate of mouse click that began the drag

timestamp

timestamp of mouse click that began the drag

Begins a window move operation (for a toplevel window). You might use this function to implement a “window move grip,” for example. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

device

the device used for the operation

button

the button being used to drag, or 0 for a keyboard-initiated drag

root_x

root window X coordinate of mouse click that began the drag

root_y

root window Y coordinate of mouse click that began the drag

timestamp

timestamp of mouse click that began the drag

A convenience wrapper around begin_paint_region() which creates a rectangular region for you. See begin_paint_region() for details.

Deprecated since 3.22

Use begin_draw_frame() instead

rectangle

rectangle you intend to draw to

Indicates that you are beginning the process of redrawing region. A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background surface for self. Then, all drawing operations performed on self will be diverted to the backing store. When you call end_paint(), the backing store will be copied to self, making it visible onscreen. Only the part of self contained in region will be modified; that is, drawing operations are clipped to region.

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call end_paint(). If you draw to self directly without calling begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.

When using GTK+, the widget system automatically places calls to begin_paint_region() and end_paint() around emissions of the expose_event signal. That is, if you’re writing an expose event handler, you can assume that the exposed area in EventExpose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call begin_paint_region(). (You can disable the automatic calls around expose events on a widget-by-widget basis by calling gtk_widget_set_double_buffered().)

If you call this function multiple times before calling the matching end_paint(), the backing stores are pushed onto a stack. end_paint() copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to end_paint() is required for each call to begin_paint_region().

Deprecated since 3.22

Use begin_draw_frame() instead

region

region you intend to draw to

Begins a window resize operation (for a toplevel window).

This function assumes that the drag is controlled by the client pointer device, use begin_resize_drag_for_device() to begin a drag with a different device.

edge

the edge or corner from which the drag is started

button

the button being used to drag, or 0 for a keyboard-initiated drag

root_x

root window X coordinate of mouse click that began the drag

root_y

root window Y coordinate of mouse click that began the drag

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

Begins a window resize operation (for a toplevel window). You might use this function to implement a “window resize grip,” for example; in fact GtkStatusbar uses it. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

edge

the edge or corner from which the drag is started

device

the device used for the operation

button

the button being used to drag, or 0 for a keyboard-initiated drag

root_x

root window X coordinate of mouse click that began the drag

root_y

root window Y coordinate of mouse click that began the drag

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

Transforms window coordinates from a parent window to a child window, where the parent window is the normal parent as returned by parent() for normal windows, and the window’s embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows.

For normal windows, calling this function is equivalent to subtracting the return values of position() from the parent coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the GdkWindow::from-embedder: signal to translate the coordinates.

You should always use this function when writing generic code that walks down a window hierarchy.

See also: coords_to_parent()

parent_x

X coordinate in parent’s coordinate system

parent_y

Y coordinate in parent’s coordinate system

Returns
x

return location for X coordinate in child’s coordinate system

y

return location for Y coordinate in child’s coordinate system

Transforms window coordinates from a child window to its parent window, where the parent window is the normal parent as returned by parent() for normal windows, and the window’s embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows.

For normal windows, calling this function is equivalent to adding the return values of position() to the child coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the GdkWindow::to-embedder: signal to translate the coordinates.

You should always use this function when writing generic code that walks up a window hierarchy.

See also: coords_from_parent()

x

X coordinate in child’s coordinate system

y

Y coordinate in child’s coordinate system

Returns
parent_x

return location for X coordinate in parent’s coordinate system, or None

parent_y

return location for Y coordinate in parent’s coordinate system, or None

Creates a new GLContext matching the framebuffer format to the visual of the Window. The context is disconnected from any particular window or surface.

If the creation of the GLContext failed, error will be set.

Before using the returned GLContext, you will need to call GLContext::make_current() or GLContext::realize().

Returns

the newly created GLContext, or None on error

Attempt to deiconify (unminimize) self. On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use gtk_window_deiconify() instead of the Window variant. Or better yet, you probably want to use gtk_window_present_with_time(), which raises the window, focuses it, unminimizes it, and puts it on the current desktop.

Available on crate feature v3_22 only.

Indicates that the drawing of the contents of self started with gdk_window_begin_frame() has been completed.

This function will take care of destroying the DrawingContext.

It is an error to call this function without a matching gdk_window_begin_frame() first.

context

the DrawingContext created by begin_draw_frame()

Indicates that the backing store created by the most recent call to begin_paint_region() should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region. See begin_paint_region() for full details.

It is an error to call this function without a matching begin_paint_region() first.

Tries to ensure that there is a window-system native window for this GdkWindow. This may fail in some situations, returning false.

Offscreen window and children of them can never have native windows.

Some backends may not support native child windows.

Returns

true if the window has a native window, false otherwise

Sets keyboard focus to self. In most cases, gtk_window_present_with_time() should be used on a GtkWindow, rather than calling this function.

timestamp

timestamp of the event triggering the window focus

Temporarily freezes a window such that it won’t receive expose events. The window will begin receiving expose events again when thaw_updates() is called. If freeze_updates() has been called more than once, thaw_updates() must be called an equal number of times to begin processing exposes.

Moves the window into fullscreen mode. This means the window covers the entire screen and is above any panels or task bars.

If the window was already fullscreen, then this function does nothing.

On X11, asks the window manager to put self in a fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “fullscreen”; so you can’t rely on the fullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Moves the window into fullscreen mode on the given monitor. This means the window covers the entire screen and is above any panels or task bars.

If the window was already fullscreen, then this function does nothing.

monitor

Which monitor to display fullscreen on.

This function informs GDK that the geometry of an embedded offscreen window has changed. This is necessary for GDK to keep track of which offscreen window the pointer is in.

Determines whether or not the desktop environment shuld be hinted that the window does not want to receive input focus.

Returns

whether or not the window should receive input focus.

Gets the list of children of self known to GDK. This function only returns children created via GDK, so for example it’s useless when used with the root window; it only returns windows an application created itself.

The returned list must be freed, but the elements in the list need not be.

Returns

list of child windows inside self

Computes the region of a window that potentially can be written to by drawing primitives. This region may not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.

Returns

a cairo::Region. This must be freed with cairo_region_destroy() when you are done.

Retrieves a Cursor pointer for the cursor currently set on the specified Window, or None. If the return value is None then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Returns

a Cursor, or None. The returned object is owned by the Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window

Returns the decorations set on the GdkWindow with set_decorations().

Returns

true if the window has decorations set, false otherwise.

decorations

The window decorations will be written here

Retrieves a Cursor pointer for the device currently set on the specified Window, or None. If the return value is None then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

device

a master, pointer Device.

Returns

a Cursor, or None. The returned object is owned by the Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window

Returns the event mask for self corresponding to an specific device.

device

a Device.

Returns

device event mask for self

Obtains the current device position and modifier state. The position is given in coordinates relative to the upper left corner of self.

Use device_position_double() if you need subpixel precision.

device

pointer Device to query to.

Returns

The window underneath device (as with Device::window_at_position()), or None if the window is not known to GDK.

x

return location for the X coordinate of device, or None.

y

return location for the Y coordinate of device, or None.

mask

return location for the modifier mask, or None.

Obtains the current device position in doubles and modifier state. The position is given in coordinates relative to the upper left corner of self.

device

pointer Device to query to.

Returns

The window underneath device (as with Device::window_at_position()), or None if the window is not known to GDK.

x

return location for the X coordinate of device, or None.

y

return location for the Y coordinate of device, or None.

mask

return location for the modifier mask, or None.

Gets the Display associated with a Window.

Returns

the Display associated with self

Finds out the DND protocol supported by a window.

Returns

the supported DND protocol.

target

location of the window where the drop should happen. This may be self or a proxy window, or None if self does not support Drag and Drop.

Obtains the parent of self, as known to GDK. Works like parent() for normal windows, but returns the window’s embedder for offscreen windows.

See also: gdk_offscreen_window_get_embedder()

Returns

effective parent of self

Gets the toplevel window that’s an ancestor of self.

Works like toplevel(), but treats an offscreen window’s embedder as its parent, using effective_parent().

See also: gdk_offscreen_window_get_embedder()

Returns

the effective toplevel window containing self

Get the current event compression setting for this window.

Returns

true if motion events will be compressed

Gets the event mask for self for all master input devices. See set_events().

Returns

event mask for self

Determines whether or not the desktop environment should be hinted that the window does not want to receive input focus when it is mapped.

Returns

whether or not the window wants to receive input focus when it is mapped.

Gets the frame clock for the window. The frame clock for a window never changes unless the window is reparented to a new toplevel window.

Returns

the frame clock

Obtains the bounding box of the window, including window manager titlebar/borders if any. The frame position is given in root window coordinates. To get the position of the window itself (rather than the frame) in root window coordinates, use origin().

Returns
rect

rectangle to fill with bounding box of the window frame

Obtains the FullscreenMode of the self.

Returns

The FullscreenMode applied to the window when fullscreen.

Any of the return location arguments to this function may be None, if you aren’t interested in getting the value of that field.

The X and Y coordinates returned are relative to the parent window of self, which for toplevels usually means relative to the window decorations (titlebar, etc.) rather than relative to the root window (screen-size background window).

On the X11 platform, the geometry is obtained from the X server, so reflects the latest position of self; this may be out-of-sync with the position of self delivered in the most-recently-processed EventConfigure. position() in contrast gets the position from the most recent configure event.

Note: If self is not a toplevel, it is much better to call position(), width() and height() instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit coordinate space, whereas geometry() is restricted to the 16-bit coordinates of X11.

Returns
x

return location for X coordinate of window (relative to its parent)

y

return location for Y coordinate of window (relative to its parent)

width

return location for width of window

height

return location for height of window

Returns the group leader window for self. See set_group().

Returns

the group leader window for self

Returns the height of the given self.

On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.

Returns

The height of self

Determines whether or not the window manager is hinted that self has modal behaviour.

Returns

whether or not the window has the modal hint set.

Obtains the position of a window in root window coordinates. (Compare with position() and geometry() which return the position of a window relative to its parent window.)

Returns

not meaningful, ignore

x

return location for X coordinate

y

return location for Y coordinate

Obtains the parent of self, as known to GDK. Does not query the X server; thus this returns the parent as passed to new(), not the actual parent. This should never matter unless you’re using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

Note that you should use effective_parent() when writing generic code that walks up a window hierarchy, because parent() will most likely not do what you expect if there are offscreen windows in the hierarchy.

Returns

parent of self

Returns whether input to the window is passed through to the window below.

See set_pass_through() for details

Obtains the position of the window as reported in the most-recently-processed EventConfigure. Contrast with geometry() which queries the X server for the current window position, regardless of which events have been received or processed.

The position coordinates are relative to the window’s parent window.

Returns
x

X coordinate of window

y

Y coordinate of window

Obtains the position of a window position in root window coordinates. This is similar to origin() but allows you to pass in any position in the window, not just the origin.

x

X coordinate in window

y

Y coordinate in window

Returns
root_x

return location for X coordinate

root_y

return location for Y coordinate

Obtains the top-left corner of the window manager frame in root window coordinates.

Returns
x

return location for X position of window frame

y

return location for Y position of window frame

Returns the internal scale factor that maps from window coordiantes to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).

A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.

The scale of a window may change during runtime, if this happens a configure event will be sent to the toplevel window.

Returns

the scale factor

Gets the Screen associated with a Window.

Returns

the Screen associated with self

Returns the event mask for self corresponding to the device class specified by source.

source

a InputSource to define the source class.

Returns

source event mask for self

Gets the bitwise OR of the currently active window state flags, from the WindowState enumeration.

Returns

window state bitfield

Returns true if the window is aware of the existence of multiple devices.

Returns

true if the window handles multidevice features.

Gets the toplevel window that’s an ancestor of self.

Any window type but WindowType::Child is considered a toplevel window, as is a WindowType::Child window that has a root window as parent.

Note that you should use effective_toplevel() when you want to get to a window’s toplevel as seen on screen, because toplevel() will most likely not do what you expect if there are offscreen windows in the hierarchy.

Returns

the toplevel window containing self

This function returns the type hint set for a window.

Returns

The type hint set for self

Transfers ownership of the update area from self to the caller of the function. That is, after calling this function, self will no longer have an invalid/dirty region; the update area is removed from self and handed to you. If a window has no update area, update_area() returns None. You are responsible for calling cairo_region_destroy() on the returned region if it’s non-None.

Returns

the update area for self

Computes the region of the self that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.

Returns

a cairo::Region. This must be freed with cairo_region_destroy() when you are done.

Gets the Visual describing the pixel format of self.

Returns

a Visual

Returns the width of the given self.

On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.

Returns

The width of self

Gets the type of the window. See WindowType.

Returns

type of window

Checks whether the window has a native window or not. Note that you can use ensure_native() if a native window is needed.

Returns

true if the self has a native window, false otherwise.

For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won’t be displayed. Normally done automatically as part of gtk_widget_hide().

Asks to iconify (minimize) self. The window manager may choose to ignore the request, but normally will honor it. Using gtk_window_iconify() is preferred, if you have a GtkWindow widget.

This function only makes sense when self is a toplevel window.

Like shape_combine_region(), but the shape applies only to event handling. Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the window below self.

An input shape is typically used with RGBA windows. The alpha channel of the window defines which pixels are invisible and allows for nicely antialiased borders, and the input shape controls where the window is “clickable”.

On the X11 platform, this requires version 1.1 of the shape extension.

On the Win32 platform, this functionality is not present and the function does nothing.

shape_region

region of window to be non-transparent

offset_x

X position of shape_region in self coordinates

offset_y

Y position of shape_region in self coordinates

Adds region to the update area for self. The update area is the region that needs to be redrawn, or “dirty region.” The call process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of self in response to those expose events.

GDK will call process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there’s no need to do that manually, you just need to invalidate regions that you know should be redrawn.

The child_func parameter controls whether the region of each child window that intersects region will also be invalidated. Only children for which child_func returns true will have the area invalidated.

region

a cairo::Region

child_func

function to use to decide if to recurse to a child, None means never recurse.

A convenience wrapper around invalidate_region() which invalidates a rectangular region. See invalidate_region() for details.

rect

rectangle to invalidate or None to invalidate the whole window

invalidate_children

whether to also invalidate child windows

Adds region to the update area for self. The update area is the region that needs to be redrawn, or “dirty region.” The call process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of self in response to those expose events.

GDK will call process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there’s no need to do that manually, you just need to invalidate regions that you know should be redrawn.

The invalidate_children parameter controls whether the region of each child window that intersects region will also be invalidated. If false, then the update area for child windows will remain unaffected. See gdk_window_invalidate_maybe_recurse if you need fine grained control over which children are invalidated.

region

a cairo::Region

invalidate_children

true to also invalidate child windows

Check to see if a window is destroyed..

Returns

true if the window is destroyed

Determines whether or not the window is an input only window.

Returns

true if self is input only

Determines whether or not the window is shaped.

Returns

true if self is shaped

Check if the window and all ancestors of the window are mapped. (This is not necessarily “viewable” in the X sense, since we only check as far as we have GDK window parents, not to the root window.)

Returns

true if the window is viewable

Checks whether the window has been mapped (with show() or show_unraised()).

Returns

true if the window is mapped

Lowers self to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above self. This is true whether or not the other windows are visible.

If self is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, lower() only requests the restack, does not guarantee it.

Note that show() raises the window again, so don’t call this function before show(). (Try show_unraised().)

If you call this during a paint (e.g. between begin_paint_region() and end_paint() then GDK will mark the current clip region of the window as being drawn. This is required when mixing GL rendering via gdk_cairo_draw_from_gl() and cairo rendering, as otherwise GDK has no way of knowing when something paints over the GL-drawn regions.

This is typically called automatically by GTK+ and you don’t need to care about this.

cr

a cairo::Context

Maximizes the window. If the window was already maximized, then this function does nothing.

On X11, asks the window manager to maximize self, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “maximized”; so you can’t rely on the maximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably maximizes the window.

Merges the input shape masks for any child windows into the input shape mask for self. i.e. the union of all input masks for self and its children will become the new input mask for self. See input_shape_combine_region().

This function is distinct from set_child_input_shapes() because it includes self’s input shape mask in the set of shapes to be merged.

Merges the shape masks for any child windows into the shape mask for self. i.e. the union of all masks for self and its children will become the new mask for self. See shape_combine_region().

This function is distinct from set_child_shapes() because it includes self’s shape mask in the set of shapes to be merged.

Move the part of self indicated by region by dy pixels in the Y direction and dx pixels in the X direction. The portions of region that not covered by the new position of region are invalidated.

Child windows are not moved.

region

The cairo::Region to move

dx

Amount to move in the X direction

dy

Amount to move in the Y direction

Equivalent to calling move_() and resize(), except that both operations are performed at once, avoiding strange visual effects. (i.e. the user may be able to see the window first move, then resize, if you don’t use move_resize().)

x

new X position relative to window’s parent

y

new Y position relative to window’s parent

width

new width

height

new height

Available on crate feature v3_24 only.

Moves self to rect, aligning their anchor points.

rect is relative to the top-left corner of the window that self is transient for. rect_anchor and window_anchor determine anchor points on rect and self to pin together. rect’s anchor point can optionally be offset by rect_anchor_dx and rect_anchor_dy, which is equivalent to offsetting the position of self.

anchor_hints determines how self will be moved if the anchor points cause it to move off-screen. For example, AnchorHints::FLIP_X will replace Gravity::NorthWest with Gravity::NorthEast and vice versa if self extends beyond the left or right edges of the monitor.

Connect to the signal::Window::moved-to-rect signal to find out how it was actually positioned.

rect

the destination Rectangle to align self with

rect_anchor

the point on rect to align with self’s anchor point

window_anchor

the point on self to align with rect’s anchor point

anchor_hints

positioning hints to use when limited on space

rect_anchor_dx

horizontal offset to shift self, i.e. rect’s anchor point

rect_anchor_dy

vertical offset to shift self, i.e. rect’s anchor point

Like children(), but does not copy the list of children, so the list does not need to be freed.

Returns

a reference to the list of child windows in self

Sends one or more expose events to self. The areas in each expose event will cover the entire update area for the window (see invalidate_region() for details). Normally GDK calls process_all_updates() on your behalf, so there’s no need to call this function unless you want to force expose events to be delivered immediately and synchronously (vs. the usual case, where GDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example.

Deprecated since 3.22
update_children

whether to also process updates for child windows

Raises self to the top of the Z-order (stacking order), so that other windows with the same parent window appear below self. This is true whether or not the windows are visible.

If self is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, raise() only requests the restack, does not guarantee it.

Registers a window as a potential drop destination.

Reparents self into the given new_parent. The window being reparented will be unmapped as a side effect.

new_parent

new parent to move self into

x

X location inside the new parent

y

Y location inside the new parent

Resizes self; for toplevel windows, asks the window manager to resize the window. The window manager may not allow the resize. When using GTK+, use gtk_window_resize() instead of this low-level GDK function.

Windows may not be resized below 1x1.

If you’re also planning to move the window, use move_resize() to both move and resize simultaneously, for a nicer visual effect.

width

new width of the window

height

new height of the window

Changes the position of self in the Z-order (stacking order), so that it is above sibling (if above is true) or below sibling (if above is false).

If sibling is None, then this either raises (if above is true) or lowers the window.

If self is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, restack() only requests the restack, does not guarantee it.

sibling

a Window that is a sibling of self, or None

above

a boolean

Scroll the contents of self, both pixels and children, by the given amount. self itself does not move. Portions of the window that the scroll operation brings in from offscreen areas are invalidated. The invalidated region may be bigger than what would strictly be necessary.

For X11, a minimum area will be invalidated if the window has no subwindows, or if the edges of the window’s parent do not extend beyond the edges of the window. In other cases, a multi-step process is used to scroll the window which may produce temporary visual artifacts and unnecessary invalidations.

dx

Amount to scroll in the X direction

dy

Amount to scroll in the Y direction

Setting accept_focus to false hints the desktop environment that the window doesn’t want to receive input focus.

On X, it is the responsibility of the window manager to interpret this hint. ICCCM-compliant window manager usually respect it.

accept_focus

true if the window should receive input focus

Sets the background color of self.

See also [set_background_pattern()][Self::set_background_pattern()].

Deprecated since 3.22

Don’t use this function

rgba

a RGBA color

Sets the input shape mask of self to the union of input shape masks for all children of self, ignoring the input shape mask of self itself. Contrast with merge_child_input_shapes() which includes the input shape mask of self in the masks to be merged.

Sets the shape mask of self to the union of shape masks for all children of self, ignoring the shape mask of self itself. Contrast with merge_child_shapes() which includes the shape mask of self in the masks to be merged.

Sets the default mouse pointer for a Window.

Note that cursor must be for the same display as self.

Use Cursor::for_display() or Cursor::from_pixbuf() to create the cursor. To make the cursor invisible, use CursorType::BlankCursor. Passing None for the cursor argument to set_cursor() means that self will use the cursor of its parent window. Most windows should use this default.

cursor

a cursor

“Decorations” are the features the window manager adds to a toplevel Window. This function sets the traditional Motif window manager hints that tell the window manager which decorations you would like your window to have. Usually you should use gtk_window_set_decorated() on a GtkWindow instead of using the GDK function directly.

The decorations argument is the logical OR of the fields in the WMDecoration enumeration. If WMDecoration::ALL is included in the mask, the other bits indicate which decorations should be turned off. If WMDecoration::ALL is not included, then the other bits indicate which decorations should be turned on.

Most window managers honor a decorations hint of 0 to disable all decorations, but very few honor all possible combinations of bits.

decorations

decoration hint mask

Sets a specific Cursor for a given device when it gets inside self. Use Cursor::for_display() or Cursor::from_pixbuf() to create the cursor. To make the cursor invisible, use CursorType::BlankCursor. Passing None for the cursor argument to set_cursor() means that self will use the cursor of its parent window. Most windows should use this default.

device

a master, pointer Device

cursor

a Cursor

Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to self. For example, an event mask including EventMask::BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the EventMask enumeration.

See the [input handling overview][event-masks] for details.

device

Device to enable events for.

event_mask

event mask for self

Determines whether or not extra unprocessed motion events in the event queue can be discarded. If true only the most recent event will be delivered.

Some types of applications, e.g. paint programs, need to see all motion events and will benefit from turning off event compression.

By default, event compression is enabled.

event_compression

true if motion events should be compressed

The event mask for a window determines which events will be reported for that window from all master input devices. For example, an event mask including EventMask::BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the EventMask enumeration.

See the [input handling overview][event-masks] for details.

event_mask

event mask for self

Setting focus_on_map to false hints the desktop environment that the window doesn’t want to receive input focus when it is mapped. focus_on_map should be turned off for windows that aren’t triggered interactively (such as popups from network activity).

On X, it is the responsibility of the window manager to interpret this hint. Window managers following the freedesktop.org window manager extension specification should respect it.

focus_on_map

true if the window should receive input focus when mapped

Specifies whether the self should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode.

The mode argument is from the FullscreenMode enumeration. If FullscreenMode::AllMonitors is specified, the fullscreen self will span over all monitors from the Screen.

On X11, searches through the list of monitors from the Screen the ones which delimit the 4 edges of the entire Screen and will ask the window manager to span the self over these monitors.

If the XINERAMA extension is not available or not usable, this function has no effect.

Not all window managers support this, so you can’t rely on the fullscreen window to span over the multiple monitors when FullscreenMode::AllMonitors is specified.

mode

fullscreen mode

Sets hints about the window management functions to make available via buttons on the window frame.

On the X backend, this function sets the traditional Motif window manager hint for this purpose. However, few window managers do anything reliable or interesting with this hint. Many ignore it entirely.

The functions argument is the logical OR of values from the WMFunction enumeration. If the bitmask includes WMFunction::ALL, then the other bits indicate which functions to disable; if it doesn’t include WMFunction::ALL, it indicates which functions to enable.

functions

bitmask of operations to allow on self

Sets the geometry hints for self. Hints flagged in geom_mask are set, hints not flagged in geom_mask are unset. To unset all hints, use a geom_mask of 0 and a geometry of None.

This function provides hints to the windowing system about acceptable sizes for a toplevel window. The purpose of this is to constrain user resizing, but the windowing system will typically (but is not required to) also constrain the current size of the window to the provided values and constrain programatic resizing via resize() or move_resize().

Note that on X11, this effect has no effect on windows of type WindowType::Temp or windows where override redirect has been turned on via set_override_redirect() since these windows are not resizable by the user.

Since you can’t count on the windowing system doing the constraints for programmatic resizes, you should generally call constrain_size() yourself to determine appropriate sizes.

geometry

geometry hints

geom_mask

bitmask indicating fields of geometry to pay attention to

Sets the group leader window for self. By default, GDK sets the group leader for all toplevel windows to a global window implicitly created by GDK. With this function you can override this default.

The group leader window allows the window manager to distinguish all windows that belong to a single application. It may for example allow users to minimize/unminimize all windows belonging to an application at once. You should only set a non-default group window if your application pretends to be multiple applications.

leader

group leader window, or None to restore the default group leader window

Sets a list of icons for the window. One of these will be used to represent the window when it has been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality since the window manager may only need to scale the icon by a small amount or not at all.

Note that some platforms don’t support window icons.

pixbufs

A list of pixbufs, of different sizes.

Windows may have a name used while minimized, distinct from the name they display in their titlebar. Most of the time this is a bad idea from a user interface standpoint. But you can set such a name with this function, if you like.

After calling this with a non-None name, calls to set_title() will not update the icon title.

Using None for name unsets the icon title; further calls to set_title() will again update the icon title as well.

Note that some platforms don’t support window icons.

name

name of window while iconified (minimized)

Set if self must be kept above other windows. If the window was already above, then this function does nothing.

On X11, asks the window manager to keep self above, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “keep above”; so you can’t rely on the window being kept above. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

setting

whether to keep self above other windows

Set if self must be kept below other windows. If the window was already below, then this function does nothing.

On X11, asks the window manager to keep self below, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “keep below”; so you can’t rely on the window being kept below. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

setting

whether to keep self below other windows

The application can use this hint to tell the window manager that a certain window has modal behaviour. The window manager can use this information to handle modal windows in a special way.

You should only use this on windows for which you have previously called set_transient_for()

true if the window is modal, false otherwise.

Set self to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.)

For toplevel windows this depends on support from the windowing system that may not always be there. For instance, On X11, this works only on X screens with a compositing manager running. On Wayland, there is no per-window opacity value that the compositor would apply. Instead, use gdk_window_set_opaque_region (window, NULL) to tell the compositor that the entire window is (potentially) non-opaque, and draw your content with alpha, or use gtk_widget_set_opacity() to set an overall opacity for your widgets.

For child windows this function only works for non-native windows.

For setting up per-pixel alpha topelevels, see Screen::rgba_visual(), and for non-toplevels, see gdk_window_set_composited().

Support for non-toplevel windows was added in 3.8.

opacity

opacity

For optimisation purposes, compositing window managers may like to not draw obscured regions of windows, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.

This function only works for toplevel windows.

GTK+ will update this property automatically if the self background is opaque, as we know where the opaque regions are. If your window background is not opaque, please update this property in your GtkWidget::style-updated handler.

region

a region, or None

An override redirect window is not under the control of the window manager. This means it won’t have a titlebar, won’t be minimizable, etc. - it will be entirely under the control of the application. The window manager can’t see the override redirect window at all.

Override redirect should only be used for short-lived temporary windows, such as popup menus. GtkMenu uses an override redirect window in its implementation, for example.

override_redirect

true if window should be override redirect

Sets whether input to the window is passed through to the window below.

The default value of this is false, which means that pointer events that happen inside the window are send first to the window, but if the event is not selected by the event mask then the event is sent to the parent window, and so on up the hierarchy.

If pass_through is true then such pointer events happen as if the window wasn’t there at all, and thus will be sent first to any windows below self. This is useful if the window is used in a transparent fashion. In the terminology of the web this would be called “pointer-events: none”.

Note that a window with pass_through true can still have a subwindow without pass through, so you can get events on a subset of a window. And in that cases you would get the in-between related events such as the pointer enter/leave events on its way to the destination window.

pass_through

a boolean

When using GTK+, typically you should use gtk_window_set_role() instead of this low-level function.

The window manager and session manager use a window’s role to distinguish it from other kinds of window in the same application. When an application is restarted after being saved in a previous session, all windows with the same title and role are treated as interchangeable. So if you have two windows with the same title that should be distinguished for session management purposes, you should set the role on those windows. It doesn’t matter what string you use for the role, as long as you have a different role for each non-interchangeable kind of window.

role

a string indicating its role

Newer GTK+ windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. Window managers that want to maximize windows or snap to edges need to know where the extents of the actual frame lie, so that users don’t feel like windows are snapping against random invisible edges.

Note that this property is automatically updated by GTK+, so this function should only be used by applications which do not use GTK+ to create toplevel windows.

left

The left extent

The right extent

top

The top extent

bottom

The bottom extent

Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop). If a window’s semantic type as specified with set_type_hint() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

skips_pager

true to skip the pager

Toggles whether a window should appear in a task list or window list. If a window’s semantic type as specified with set_type_hint() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

skips_taskbar

true to skip the taskbar

Sets the event mask for any floating device (i.e. not attached to any visible pointer) that has the source defined as source. This event mask will be applied both to currently existing, newly added devices after this call, and devices being attached/detached.

source

a InputSource to define the source class.

event_mask

event mask for self

When using GTK+, typically you should use gtk_window_set_startup_id() instead of this low-level function.

startup_id

a string with startup-notification identifier

This function will enable multidevice features in self.

Multidevice aware windows will need to handle properly multiple, per device enter/leave events, device grabs and grab ownerships.

support_multidevice

true to enable multidevice support in self.

Sets the title of a toplevel window, to be displayed in the titlebar. If you haven’t explicitly set the icon name for the window (using set_icon_name()), the icon name will be set to title as well. title must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). title may not be None.

title

title of self

Indicates to the window manager that self is a transient dialog associated with the application window parent. This allows the window manager to do things like center self on parent and keep self above parent.

See gtk_window_set_transient_for() if you’re using GtkWindow or GtkDialog.

parent

another toplevel Window

The application can use this call to provide a hint to the window manager about the functionality of a window. The window manager can use this information when determining the decoration and behaviour of the window.

The hint must be set before the window is mapped.

hint

A hint of the function this window will have

Toggles whether a window needs the user’s urgent attention.

urgent

true if the window is urgent

Makes pixels in self outside shape_region be transparent, so that the window may be nonrectangular.

If shape_region is None, the shape will be unset, so the whole window will be opaque again. offset_x and offset_y are ignored if shape_region is None.

On the X11 platform, this uses an X server extension which is widely available on most common platforms, but not available on very old X servers, and occasionally the implementation will be buggy. On servers without the shape extension, this function will do nothing.

This function works on both toplevel and child windows.

shape_region

region of window to be non-transparent

offset_x

X position of shape_region in self coordinates

offset_y

Y position of shape_region in self coordinates

Like show_unraised(), but also raises the window to the top of the window stack (moves the window to the front of the Z-order).

This function maps a window so it’s visible onscreen. Its opposite is hide().

When implementing a GtkWidget, you should call this function on the widget’s Window as part of the “map” method.

Shows a Window onscreen, but does not modify its stacking order. In contrast, show() will raise the window to the top of the window stack.

On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal GDK state, which means that you can’t really use XMapWindow() directly on a GDK window).

Asks the windowing system to show the window menu. The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows using client-side decorations, activating it with a right-click on the window decorations.

event

a GdkEvent to show the menu for

Returns

true if the window menu was shown and false otherwise.

“Pins” a window such that it’s on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports. (When using GtkWindow, gtk_window_stick() may be more useful.)

On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don’t support this operation, there’s nothing you can do to force it to happen.

Thaws a window frozen with freeze_updates().

Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing.

On X11, asks the window manager to move self out of the fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “fullscreen”; so you can’t rely on the unfullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Unmaximizes the window. If the window wasn’t maximized, then this function does nothing.

On X11, asks the window manager to unmaximize self, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “maximized”; so you can’t rely on the unmaximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably unmaximizes the window.

Reverse operation for stick(); see stick(), and gtk_window_unstick().

Withdraws a window (unmaps it and asks the window manager to forget about it). This function is not really useful as hide() automatically withdraws toplevel windows before hiding them.

Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).

geometry

a Geometry structure

flags

a mask indicating what portions of geometry are set

width

desired width of window

height

desired height of the window

Returns
new_width

location to store resulting width

new_height

location to store resulting height

Calls process_updates() for all windows (see Window) in the application.

Deprecated since 3.22

With update debugging enabled, calls to invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during process_updates(). The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.

In essence, because the GDK rendering model prevents all flicker, if you are redrawing the same region 400 times you may never notice, aside from noticing a speed problem. Enabling update debugging causes GTK to flicker slowly and noticeably, so you can see exactly what’s being redrawn when, in what order.

The –gtk-debug=updates command line option passed to GTK+ programs enables this debug option at application startup time. That’s usually more useful than calling set_debug_updates() yourself, though you might want to use this function to enable updates sometime after application startup time.

Deprecated since 3.22
setting

true to turn on update debugging

The ::create-surface signal is emitted when an offscreen window needs its surface (re)created, which happens either when the window is first drawn to, or when the window is being resized. The first signal handler that returns a non-None surface will stop any further signal emission, and its surface will be used.

Note that it is not possible to access the window’s previous surface from within any callback of this signal. Calling gdk_offscreen_window_get_surface() will lead to a crash.

width

the width of the offscreen surface to create

height

the height of the offscreen surface to create

Returns

the newly created cairo::Surface for the offscreen window

The ::pick-embedded-child signal is emitted to find an embedded child at the given position.

x

x coordinate in the window

y

y coordinate in the window

Returns

the Window of the embedded child at x, y, or None

Creates a new Window using the attributes from attributes. See GdkWindowAttr and GdkWindowAttributesType for more details. Note: to use this on displays other than the default display, parent must be specified.

parent

a Window, or None to create the window as a child of the default root window for the default display.

attributes

attributes of the new window

attributes_mask

mask indicating which fields in attributes are valid

Returns

the new Window

Create a new surface that is as compatible as possible with the given self. For example the new surface will have the same fallback resolution and font options as self. Generally, the new surface will also use the same backend as self, unless that is not possible for some reason. The type of the returned surface may be examined with cairo_surface_get_type().

Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)

content

the content for the new surface

width

width of the new surface

height

height of the new surface

Returns

a pointer to the newly allocated surface. The caller owns the surface and should call cairo_surface_destroy() when done with it.

This function always returns a valid pointer, but it will return a pointer to a “nil” surface if other is already in an error state or any other error occurs.

Create a new image surface that is efficient to draw on the given self.

Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)

The width and height of the new surface are not affected by the scaling factor of the self, or by the scale argument; they are the size of the surface in device pixels. If you wish to create an image surface capable of holding the contents of self you can use:

⚠️ The following code is in C ⚠️

  int scale = gdk_window_get_scale_factor (window);
  int width = gdk_window_get_width (window) * scale;
  int height = gdk_window_get_height (window) * scale;

  // format is set elsewhere
  cairo_surface_t *surface =
    gdk_window_create_similar_image_surface (window,
                                             format,
                                             width, height,
                                             scale);

Note that unlike cairo_surface_create_similar_image(), the new surface’s device scale is set to scale, or to the scale factor of self if scale is 0.

format

the format for the new surface

width

width of the new surface

height

height of the new surface

scale

the scale of the new surface, or 0 to use same as self

Returns

a pointer to the newly allocated surface. The caller owns the surface and should call cairo_surface_destroy() when done with it.

This function always returns a valid pointer, but it will return a pointer to a “nil” surface if other is already in an error state or any other error occurs.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Returns true if the object is an instance of (can be cast to) T.

Returns the type of the object.

Returns the ObjectClass of the object. Read more

Returns the class of the object.

Returns the class of the object in the given type T. Read more

Returns the interface T of the object. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_properties but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::set_properties_from_value but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::property but fails instead of panicking.

Gets the property property_name of the object and cast it to the type V. Read more

Similar to Self::property_value but fails instead of panicking.

Gets the property property_name of the object. Read more

Check if the object has a property property_name of the given type_. Read more

Get the type of the property property_name of this object. Read more

Get the ParamSpec of the property property_name of this object.

Return all ParamSpec of the properties of this object.

Freeze all property notifications until the return guard object is dropped. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Block a given signal handler. Read more

Unblock a given signal handler.

Stop emission of the currently emitted signal.

Stop emission of the currently emitted signal by the (possibly detailed) signal name.

Similar to Self::connect but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_local but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_local_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_unsafe but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_unsafe_id but fails instead of panicking.

Similar to Self::connect_closure but fails instead of panicking.

Connect a closure to the signal signal_name on this object. Read more

Similar to Self::connect_closure_id but fails instead of panicking.

Connect a closure to the signal signal_id on this object. Read more

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to Closure::invoke. Read more

Connect to the signal signal_id on this object. Read more

Similar to Self::emit but fails instead of panicking.

Emit signal by signal id. Read more

Similar to Self::emit_with_values but fails instead of panicking.

Same as Self::emit but takes Value for the arguments.

Similar to Self::emit_by_name but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_values but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_with_details but fails instead of panicking.

Emit signal by signal id with details. Read more

Similar to Self::emit_with_details_and_values but fails instead of panicking.

Emit signal by signal id with details. Read more

Disconnect a previously connected signal handler.

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Notify that the given property has changed its value. Read more

Notify that the given property has changed its value. Read more

Downgrade this object to a weak reference.

Bind property source_property on this object to the target_property on the target object. Read more

Returns the strong reference count of this object.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.