[−][src]Trait gdk::WindowExt
Required methods
fn beep(&self)
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
.
fn begin_draw_frame(&self, region: &Region) -> Option<DrawingContext>
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
WindowExt::end_draw_frame
. If you draw to self
directly without
calling WindowExt::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
WindowExt::begin_draw_frame
and WindowExt::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 WindowExt::begin_draw_frame
explicitly.
Feature: v3_22
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.
fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32)
Begins a window move operation (for a toplevel window).
This function assumes that the drag is controlled by the
client pointer device, use WindowExt::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
fn begin_move_drag_for_device(
&self,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
&self,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
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
fn begin_paint_rect(&self, rectangle: &Rectangle)
A convenience wrapper around WindowExt::begin_paint_region
which
creates a rectangular region for you. See
WindowExt::begin_paint_region
for details.
Deprecated since 3.22
Use WindowExt::begin_draw_frame
instead
rectangle
rectangle you intend to draw to
fn begin_paint_region(&self, region: &Region)
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 WindowExt::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
WindowExt::end_paint
. If you draw to self
directly without
calling WindowExt::begin_paint_region
, the user may see flicker
as individual drawing operations are performed in sequence. The
clipping and background-initializing features of
WindowExt::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
WindowExt::begin_paint_region
and WindowExt::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
WindowExt::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 WindowExt::end_paint
, the backing stores are pushed onto
a stack. WindowExt::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
WindowExt::end_paint
is required for each call to
WindowExt::begin_paint_region
.
Deprecated since 3.22
Use WindowExt::begin_draw_frame
instead
region
region you intend to draw to
fn begin_resize_drag(
&self,
edge: WindowEdge,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
&self,
edge: WindowEdge,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
Begins a window resize operation (for a toplevel window).
This function assumes that the drag is controlled by the
client pointer device, use WindowExt::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
)
fn begin_resize_drag_for_device(
&self,
edge: WindowEdge,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
&self,
edge: WindowEdge,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
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
)
fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64)
Transforms window coordinates from a parent window to a child
window, where the parent window is the normal parent as returned by
WindowExt::get_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 WindowExt::get_position
from the parent coordinates.
For offscreen windows however (which can be arbitrarily transformed),
this function calls the Window
::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: WindowExt::coords_to_parent
parent_x
X coordinate in parent’s coordinate system
parent_y
Y coordinate in parent’s coordinate system
x
return location for X coordinate in child’s coordinate system
y
return location for Y coordinate in child’s coordinate system
fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64)
Transforms window coordinates from a child window to its parent
window, where the parent window is the normal parent as returned by
WindowExt::get_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 WindowExt::get_position
to the child coordinates.
For offscreen windows however (which can be arbitrarily transformed),
this function calls the Window
::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: WindowExt::coords_from_parent
x
X coordinate in child’s coordinate system
y
Y coordinate in child’s coordinate system
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
fn create_gl_context(&self) -> Result<GLContext, Error>
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
.
Feature: v3_16
Returns
the newly created GLContext
, or
None
on error
fn create_similar_image_surface(
&self,
format: i32,
width: i32,
height: i32,
scale: i32
) -> Option<Surface>
&self,
format: i32,
width: i32,
height: i32,
scale: i32
) -> Option<Surface>
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:
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.
fn deiconify(&self)
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.
fn destroy(&self)
Destroys the window system resources associated with self
and decrements self
's
reference count. The window system resources for all children of self
are also
destroyed, but the children’s reference counts are not decremented.
Note that a window will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.
fn destroy_notify(&self)
fn end_draw_frame(&self, context: &DrawingContext)
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.
Feature: v3_22
context
the DrawingContext
created by WindowExt::begin_draw_frame
fn end_paint(&self)
Indicates that the backing store created by the most recent call
to WindowExt::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
WindowExt::begin_paint_region
for full details.
It is an error to call this function without a matching
WindowExt::begin_paint_region
first.
fn ensure_native(&self) -> bool
Tries to ensure that there is a window-system native window for this
Window
. 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
fn focus(&self, timestamp: u32)
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
fn freeze_toplevel_updates_libgtk_only(&self)
Temporarily freezes a window and all its descendants such that it won't
receive expose events. The window will begin receiving expose events
again when WindowExt::thaw_toplevel_updates_libgtk_only
is called. If
WindowExt::freeze_toplevel_updates_libgtk_only
has been called more than once,
WindowExt::thaw_toplevel_updates_libgtk_only
must be called
an equal number of times to begin processing exposes.
This function is not part of the GDK public API and is only for use by GTK+.
Deprecated since 3.16
This symbol was never meant to be used outside of GTK+
fn freeze_updates(&self)
Temporarily freezes a window such that it won’t receive expose
events. The window will begin receiving expose events again when
WindowExt::thaw_updates
is called. If WindowExt::freeze_updates
has been called more than once, WindowExt::thaw_updates
must be called
an equal number of times to begin processing exposes.
fn fullscreen(&self)
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.
fn fullscreen_on_monitor(&self, monitor: i32)
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.
fn geometry_changed(&self)
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.
fn get_accept_focus(&self) -> bool
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.
fn get_children(&self) -> Vec<Window>
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
fn get_clip_region(&self) -> Option<Region>
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.
fn get_composited(&self) -> bool
Determines whether self
is composited.
See WindowExt::set_composited
.
Deprecated since 3.16
Compositing is an outdated technology that only ever worked on X11.
Returns
true
if the window is composited.
fn get_cursor(&self) -> Option<Cursor>
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 WindowExt::set_cursor
to unset the
cursor of the window
fn get_decorations(&self) -> Option<WMDecoration>
Returns the decorations set on the Window
with
WindowExt::set_decorations
.
decorations
The window decorations will be written here
Returns
true
if the window has decorations set, false
otherwise.
fn get_device_cursor(&self, device: &Device) -> Option<Cursor>
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 WindowExt::set_cursor
to unset the
cursor of the window
fn get_device_events(&self, device: &Device) -> EventMask
Returns the event mask for self
corresponding to an specific device.
device
a Device
.
Returns
device event mask for self
fn get_device_position(
&self,
device: &Device
) -> (Option<Window>, i32, i32, ModifierType)
&self,
device: &Device
) -> (Option<Window>, i32, i32, ModifierType)
Obtains the current device position and modifier state.
The position is given in coordinates relative to the upper left
corner of self
.
Use WindowExt::get_device_position_double
if you need subpixel precision.
device
pointer Device
to query to.
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
.
Returns
The window underneath device
(as with Device::get_window_at_position
), or None
if the
window is not known to GDK.
fn get_device_position_double(
&self,
device: &Device
) -> (Option<Window>, f64, f64, ModifierType)
&self,
device: &Device
) -> (Option<Window>, f64, f64, ModifierType)
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.
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
.
Returns
The window underneath device
(as with Device::get_window_at_position
), or None
if the
window is not known to GDK.
fn get_display(&self) -> Display
fn get_drag_protocol(&self) -> (DragProtocol, Window)
Finds out the DND protocol supported by a window.
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.
Returns
the supported DND protocol.
fn get_effective_parent(&self) -> Option<Window>
Obtains the parent of self
, as known to GDK. Works like
WindowExt::get_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
fn get_effective_toplevel(&self) -> Window
Gets the toplevel window that’s an ancestor of self
.
Works like WindowExt::get_toplevel
, but treats an offscreen window's
embedder as its parent, using WindowExt::get_effective_parent
.
See also: gdk_offscreen_window_get_embedder
Returns
the effective toplevel window containing self
fn get_event_compression(&self) -> bool
Get the current event compression setting for this window.
Returns
true
if motion events will be compressed
fn get_events(&self) -> EventMask
Gets the event mask for self
for all master input devices. See
WindowExt::set_events
.
Returns
event mask for self
fn get_focus_on_map(&self) -> bool
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.
fn get_frame_clock(&self) -> Option<FrameClock>
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
fn get_frame_extents(&self) -> Rectangle
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 WindowExt::get_origin
.
rect
rectangle to fill with bounding box of the window frame
fn get_fullscreen_mode(&self) -> FullscreenMode
Obtains the FullscreenMode
of the self
.
Returns
The FullscreenMode
applied to the window when fullscreen.
fn get_geometry(&self) -> (i32, i32, i32, i32)
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
. WindowExt::get_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 WindowExt::get_position
, WindowExt::get_width
and
WindowExt::get_height
instead, because it avoids the roundtrip to
the X server and because these functions support the full 32-bit
coordinate space, whereas WindowExt::get_geometry
is restricted to
the 16-bit coordinates of X11.
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
fn get_group(&self) -> Option<Window>
Returns the group leader window for self
. See WindowExt::set_group
.
Returns
the group leader window for self
fn get_height(&self) -> i32
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
fn get_modal_hint(&self) -> bool
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.
fn get_origin(&self) -> (i32, i32, i32)
Obtains the position of a window in root window coordinates.
(Compare with WindowExt::get_position
and
WindowExt::get_geometry
which return the position of a window
relative to its parent window.)
x
return location for X coordinate
y
return location for Y coordinate
Returns
not meaningful, ignore
fn get_parent(&self) -> Option<Window>
Obtains the parent of self
, as known to GDK. Does not query the
X server; thus this returns the parent as passed to Window::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 WindowExt::get_effective_parent
when
writing generic code that walks up a window hierarchy, because
WindowExt::get_parent
will most likely not do what you expect if
there are offscreen windows in the hierarchy.
Returns
parent of self
fn get_pass_through(&self) -> bool
Returns whether input to the window is passed through to the window below.
See WindowExt::set_pass_through
for details
Feature: v3_18
fn get_position(&self) -> (i32, i32)
Obtains the position of the window as reported in the
most-recently-processed EventConfigure
. Contrast with
WindowExt::get_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.
x
X coordinate of window
y
Y coordinate of window
fn get_root_coords(&self, x: i32, y: i32) -> (i32, i32)
Obtains the position of a window position in root
window coordinates. This is similar to
WindowExt::get_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
root_x
return location for X coordinate
root_y
return location for Y coordinate
fn get_root_origin(&self) -> (i32, i32)
Obtains the top-left corner of the window manager frame in root window coordinates.
x
return location for X position of window frame
y
return location for Y position of window frame
fn get_scale_factor(&self) -> i32
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
fn get_screen(&self) -> Screen
fn get_source_events(&self, source: InputSource) -> EventMask
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
fn get_state(&self) -> WindowState
Gets the bitwise OR of the currently active window state flags,
from the WindowState
enumeration.
Returns
window state bitfield
fn get_support_multidevice(&self) -> bool
Returns true
if the window is aware of the existence of multiple
devices.
Returns
true
if the window handles multidevice features.
fn get_toplevel(&self) -> Window
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 WindowExt::get_effective_toplevel
when
you want to get to a window’s toplevel as seen on screen, because
WindowExt::get_toplevel
will most likely not do what you expect
if there are offscreen windows in the hierarchy.
Returns
the toplevel window containing self
fn get_type_hint(&self) -> WindowTypeHint
fn get_update_area(&self) -> Option<Region>
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,
WindowExt::get_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
fn get_visible_region(&self) -> Option<Region>
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.
fn get_visual(&self) -> Visual
fn get_width(&self) -> i32
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
fn get_window_type(&self) -> WindowType
fn has_native(&self) -> bool
Checks whether the window has a native window or not. Note that
you can use WindowExt::ensure_native
if a native window is needed.
Returns
true
if the self
has a native window, false
otherwise.
fn hide(&self)
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
.
fn iconify(&self)
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.
fn input_shape_combine_region(
&self,
shape_region: &Region,
offset_x: i32,
offset_y: i32
)
&self,
shape_region: &Region,
offset_x: i32,
offset_y: i32
)
Like WindowExt::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
fn invalidate_maybe_recurse(
&self,
region: &Region,
child_func: Option<&mut dyn FnMut(&Window) -> bool>
)
&self,
region: &Region,
child_func: Option<&mut dyn FnMut(&Window) -> bool>
)
Adds region
to the update area for self
. The update area is the
region that needs to be redrawn, or “dirty region.” The call
WindowExt::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 Window::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.
user_data
data passed to child_func
fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool)
A convenience wrapper around WindowExt::invalidate_region
which
invalidates a rectangular region. See
WindowExt::invalidate_region
for details.
rect
rectangle to invalidate or None
to invalidate the whole
window
invalidate_children
whether to also invalidate child windows
fn invalidate_region(&self, region: &Region, invalidate_children: bool)
Adds region
to the update area for self
. The update area is the
region that needs to be redrawn, or “dirty region.” The call
WindowExt::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 Window::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
fn is_destroyed(&self) -> bool
fn is_input_only(&self) -> bool
fn is_shaped(&self) -> bool
fn is_viewable(&self) -> bool
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
fn is_visible(&self) -> bool
Checks whether the window has been mapped (with WindowExt::show
or
WindowExt::show_unraised
).
Returns
true
if the window is mapped
fn lower(&self)
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, WindowExt::lower
only
requests the restack, does not guarantee it.
Note that WindowExt::show
raises the window again, so don’t call this
function before WindowExt::show
. (Try WindowExt::show_unraised
.)
fn mark_paint_from_clip(&self, cr: &Context)
If you call this during a paint (e.g. between WindowExt::begin_paint_region
and WindowExt::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.
Feature: v3_16
cr
a cairo::Context
fn maximize(&self)
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.
fn merge_child_input_shapes(&self)
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 WindowExt::input_shape_combine_region
.
This function is distinct from WindowExt::set_child_input_shapes
because it includes self
’s input shape mask in the set of
shapes to be merged.
fn merge_child_shapes(&self)
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 WindowExt::shape_combine_region
.
This function is distinct from WindowExt::set_child_shapes
because it includes self
’s shape mask in the set of shapes to
be merged.
fn move_(&self, x: i32, y: i32)
fn move_region(&self, region: &Region, dx: i32, dy: i32)
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
fn move_resize(&self, x: i32, y: i32, width: i32, height: i32)
Equivalent to calling WindowExt::move
and WindowExt::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 WindowExt::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
fn move_to_rect(
&self,
rect: &Rectangle,
rect_anchor: Gravity,
window_anchor: Gravity,
anchor_hints: AnchorHints,
rect_anchor_dx: i32,
rect_anchor_dy: i32
)
&self,
rect: &Rectangle,
rect_anchor: Gravity,
window_anchor: Gravity,
anchor_hints: AnchorHints,
rect_anchor_dx: i32,
rect_anchor_dy: i32
)
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::FlipX
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 Window::moved-to-rect
signal to find out how it was
actually positioned.
Feature: v3_24
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
fn peek_children(&self) -> Vec<Window>
Like WindowExt::get_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
fn process_updates(&self, update_children: bool)
Sends one or more expose events to self
. The areas in each
expose event will cover the entire update area for the window (see
WindowExt::invalidate_region
for details). Normally GDK calls
Window::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
fn raise(&self)
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, WindowExt::raise
only
requests the restack, does not guarantee it.
fn register_dnd(&self)
Registers a window as a potential drop destination.
fn reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32)
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
fn resize(&self, width: i32, height: i32)
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 WindowExt::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
fn restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool)
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, WindowExt::restack
only
requests the restack, does not guarantee it.
sibling
a Window
that is a sibling of self
, or None
above
a boolean
fn scroll(&self, dx: i32, dy: i32)
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
fn set_accept_focus(&self, accept_focus: bool)
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
fn set_background_rgba(&self, rgba: &RGBA)
Sets the background color of self
.
See also Window::set_background_pattern
.
Deprecated since 3.22
Don't use this function
rgba
a RGBA
color
fn set_child_input_shapes(&self)
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 WindowExt::merge_child_input_shapes
which includes
the input shape mask of self
in the masks to be merged.
fn set_child_shapes(&self)
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 WindowExt::merge_child_shapes
which includes
the shape mask of self
in the masks to be merged.
fn set_composited(&self, composited: bool)
Sets a Window
as composited, or unsets it. Composited
windows do not automatically have their contents drawn to
the screen. Drawing is redirected to an offscreen buffer
and an expose event is emitted on the parent of the composited
window. It is the responsibility of the parent’s expose handler
to manually merge the off-screen content onto the screen in
whatever way it sees fit.
It only makes sense for child windows to be composited; see
WindowExt::set_opacity
if you need translucent toplevel
windows.
An additional effect of this call is that the area of this window is no longer clipped from regions marked for invalidation on its parent. Draws done on the parent window are also no longer clipped by the child.
This call is only supported on some systems (currently,
only X11 with new enough Xcomposite and Xdamage extensions).
You must call Display::supports_composite
to check if
setting a window as composited is supported before
attempting to do so.
Deprecated since 3.16
Compositing is an outdated technology that only ever worked on X11.
composited
true
to set the window as composited
fn set_cursor(&self, cursor: Option<&Cursor>)
Sets the default mouse pointer for a Window
.
Note that cursor
must be for the same display as self
.
Use Cursor::new_for_display
or Cursor::new_from_pixbuf
to
create the cursor. To make the cursor invisible, use CursorType::BlankCursor
.
Passing None
for the cursor
argument to WindowExt::set_cursor
means
that self
will use the cursor of its parent window. Most windows
should use this default.
cursor
a cursor
fn set_decorations(&self, decorations: WMDecoration)
“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
fn set_device_cursor(&self, device: &Device, cursor: &Cursor)
Sets a specific Cursor
for a given device when it gets inside self
.
Use Cursor::new_for_display
or Cursor::new_from_pixbuf
to create
the cursor. To make the cursor invisible, use CursorType::BlankCursor
. Passing
None
for the cursor
argument to WindowExt::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
fn set_device_events(&self, device: &Device, event_mask: EventMask)
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::ButtonPressMask
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
fn set_event_compression(&self, event_compression: bool)
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
fn set_events(&self, event_mask: EventMask)
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::ButtonPressMask
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
fn set_focus_on_map(&self, focus_on_map: bool)
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
fn set_fullscreen_mode(&self, mode: FullscreenMode)
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
fn set_functions(&self, functions: WMFunction)
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
fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints)
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 WindowExt::resize
or
WindowExt::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 WindowExt::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 Window::constrain_size
yourself to determine
appropriate sizes.
geometry
geometry hints
geom_mask
bitmask indicating fields of geometry
to pay attention to
fn set_group<P: IsA<Window>>(&self, leader: Option<&P>)
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
fn set_icon_list(&self, pixbufs: &[Pixbuf])
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.
fn set_icon_name(&self, name: Option<&str>)
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 WindowExt::set_title
will not update the icon title.
Using None
for name
unsets the icon title; further calls to
WindowExt::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)
fn set_keep_above(&self, setting: bool)
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
fn set_keep_below(&self, setting: bool)
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
fn set_modal_hint(&self, modal: bool)
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 WindowExt::set_transient_for
modal
true
if the window is modal, false
otherwise.
fn set_opacity(&self, opacity: f64)
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::get_rgba_visual
,
and for non-toplevels, see WindowExt::set_composited
.
Support for non-toplevel windows was added in 3.8.
opacity
opacity
fn set_opaque_region(&self, region: Option<&Region>)
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
fn set_override_redirect(&self, override_redirect: bool)
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
fn set_pass_through(&self, pass_through: bool)
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.
Feature: v3_18
pass_through
a boolean
fn set_role(&self, role: &str)
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
fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32)
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
right
The right extent
top
The top extent
bottom
The bottom extent
fn set_skip_pager_hint(&self, skips_pager: bool)
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 WindowExt::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
fn set_skip_taskbar_hint(&self, skips_taskbar: bool)
Toggles whether a window should appear in a task list or window
list. If a window’s semantic type as specified with
WindowExt::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
fn set_source_events(&self, source: InputSource, event_mask: EventMask)
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
fn set_startup_id(&self, startup_id: &str)
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
fn set_static_gravities(&self, use_static: bool) -> bool
Used to set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity. This is used if you are implementing scary features that involve deep knowledge of the windowing system. Don’t worry about it.
Deprecated since 3.16
static gravities haven't worked on anything but X11 for a long time.
use_static
true
to turn on static gravity
Returns
false
fn set_support_multidevice(&self, support_multidevice: bool)
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
.
fn set_title(&self, title: &str)
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 WindowExt::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
fn set_transient_for<P: IsA<Window>>(&self, parent: &P)
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
fn set_type_hint(&self, hint: WindowTypeHint)
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
fn set_urgency_hint(&self, urgent: bool)
fn shape_combine_region(
&self,
shape_region: Option<&Region>,
offset_x: i32,
offset_y: i32
)
&self,
shape_region: Option<&Region>,
offset_x: i32,
offset_y: i32
)
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
fn show(&self)
Like WindowExt::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 WindowExt::hide
.
When implementing a GtkWidget
, you should call this function on the widget's
Window
as part of the “map” method.
fn show_unraised(&self)
Shows a Window
onscreen, but does not modify its stacking
order. In contrast, WindowExt::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).
fn show_window_menu(&self, event: &mut Event) -> bool
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.
fn stick(&self)
“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.
fn thaw_toplevel_updates_libgtk_only(&self)
Thaws a window frozen with
WindowExt::freeze_toplevel_updates_libgtk_only
.
This function is not part of the GDK public API and is only for use by GTK+.
Deprecated since 3.16
This symbol was never meant to be used outside of GTK+
fn thaw_updates(&self)
Thaws a window frozen with WindowExt::freeze_updates
.
fn unfullscreen(&self)
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.
fn unmaximize(&self)
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.
fn unstick(&self)
Reverse operation for WindowExt::stick
; see WindowExt::stick
,
and gtk_window_unstick
.
fn withdraw(&self)
Withdraws a window (unmaps it and asks the window manager to forget about it).
This function is not really useful as WindowExt::hide
automatically
withdraws toplevel windows before hiding them.
fn connect_create_surface<F: Fn(&Self, i32, i32) -> Surface + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
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
fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
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
fn connect_property_cursor_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<Window>> WindowExt for O
[src]
fn beep(&self)
[src]
fn begin_draw_frame(&self, region: &Region) -> Option<DrawingContext>
[src]
fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32)
[src]
fn begin_move_drag_for_device(
&self,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
[src]
&self,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
fn begin_paint_rect(&self, rectangle: &Rectangle)
[src]
fn begin_paint_region(&self, region: &Region)
[src]
fn begin_resize_drag(
&self,
edge: WindowEdge,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
[src]
&self,
edge: WindowEdge,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
fn begin_resize_drag_for_device(
&self,
edge: WindowEdge,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
[src]
&self,
edge: WindowEdge,
device: &Device,
button: i32,
root_x: i32,
root_y: i32,
timestamp: u32
)
fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64)
[src]
fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64)
[src]
fn create_gl_context(&self) -> Result<GLContext, Error>
[src]
fn create_similar_image_surface(
&self,
format: i32,
width: i32,
height: i32,
scale: i32
) -> Option<Surface>
[src]
&self,
format: i32,
width: i32,
height: i32,
scale: i32
) -> Option<Surface>
fn deiconify(&self)
[src]
fn destroy(&self)
[src]
fn destroy_notify(&self)
[src]
fn end_draw_frame(&self, context: &DrawingContext)
[src]
fn end_paint(&self)
[src]
fn ensure_native(&self) -> bool
[src]
fn focus(&self, timestamp: u32)
[src]
fn freeze_toplevel_updates_libgtk_only(&self)
[src]
fn freeze_updates(&self)
[src]
fn fullscreen(&self)
[src]
fn fullscreen_on_monitor(&self, monitor: i32)
[src]
fn geometry_changed(&self)
[src]
fn get_accept_focus(&self) -> bool
[src]
fn get_children(&self) -> Vec<Window>
[src]
fn get_clip_region(&self) -> Option<Region>
[src]
fn get_composited(&self) -> bool
[src]
fn get_cursor(&self) -> Option<Cursor>
[src]
fn get_decorations(&self) -> Option<WMDecoration>
[src]
fn get_device_cursor(&self, device: &Device) -> Option<Cursor>
[src]
fn get_device_events(&self, device: &Device) -> EventMask
[src]
fn get_device_position(
&self,
device: &Device
) -> (Option<Window>, i32, i32, ModifierType)
[src]
&self,
device: &Device
) -> (Option<Window>, i32, i32, ModifierType)
fn get_device_position_double(
&self,
device: &Device
) -> (Option<Window>, f64, f64, ModifierType)
[src]
&self,
device: &Device
) -> (Option<Window>, f64, f64, ModifierType)
fn get_display(&self) -> Display
[src]
fn get_drag_protocol(&self) -> (DragProtocol, Window)
[src]
fn get_effective_parent(&self) -> Option<Window>
[src]
fn get_effective_toplevel(&self) -> Window
[src]
fn get_event_compression(&self) -> bool
[src]
fn get_events(&self) -> EventMask
[src]
fn get_focus_on_map(&self) -> bool
[src]
fn get_frame_clock(&self) -> Option<FrameClock>
[src]
fn get_frame_extents(&self) -> Rectangle
[src]
fn get_fullscreen_mode(&self) -> FullscreenMode
[src]
fn get_geometry(&self) -> (i32, i32, i32, i32)
[src]
fn get_group(&self) -> Option<Window>
[src]
fn get_height(&self) -> i32
[src]
fn get_modal_hint(&self) -> bool
[src]
fn get_origin(&self) -> (i32, i32, i32)
[src]
fn get_parent(&self) -> Option<Window>
[src]
fn get_pass_through(&self) -> bool
[src]
fn get_position(&self) -> (i32, i32)
[src]
fn get_root_coords(&self, x: i32, y: i32) -> (i32, i32)
[src]
fn get_root_origin(&self) -> (i32, i32)
[src]
fn get_scale_factor(&self) -> i32
[src]
fn get_screen(&self) -> Screen
[src]
fn get_source_events(&self, source: InputSource) -> EventMask
[src]
fn get_state(&self) -> WindowState
[src]
fn get_support_multidevice(&self) -> bool
[src]
fn get_toplevel(&self) -> Window
[src]
fn get_type_hint(&self) -> WindowTypeHint
[src]
fn get_update_area(&self) -> Option<Region>
[src]
fn get_visible_region(&self) -> Option<Region>
[src]
fn get_visual(&self) -> Visual
[src]
fn get_width(&self) -> i32
[src]
fn get_window_type(&self) -> WindowType
[src]
fn has_native(&self) -> bool
[src]
fn hide(&self)
[src]
fn iconify(&self)
[src]
fn input_shape_combine_region(
&self,
shape_region: &Region,
offset_x: i32,
offset_y: i32
)
[src]
&self,
shape_region: &Region,
offset_x: i32,
offset_y: i32
)
fn invalidate_maybe_recurse(
&self,
region: &Region,
child_func: Option<&mut dyn FnMut(&Window) -> bool>
)
[src]
&self,
region: &Region,
child_func: Option<&mut dyn FnMut(&Window) -> bool>
)
fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool)
[src]
fn invalidate_region(&self, region: &Region, invalidate_children: bool)
[src]
fn is_destroyed(&self) -> bool
[src]
fn is_input_only(&self) -> bool
[src]
fn is_shaped(&self) -> bool
[src]
fn is_viewable(&self) -> bool
[src]
fn is_visible(&self) -> bool
[src]
fn lower(&self)
[src]
fn mark_paint_from_clip(&self, cr: &Context)
[src]
fn maximize(&self)
[src]
fn merge_child_input_shapes(&self)
[src]
fn merge_child_shapes(&self)
[src]
fn move_(&self, x: i32, y: i32)
[src]
fn move_region(&self, region: &Region, dx: i32, dy: i32)
[src]
fn move_resize(&self, x: i32, y: i32, width: i32, height: i32)
[src]
fn move_to_rect(
&self,
rect: &Rectangle,
rect_anchor: Gravity,
window_anchor: Gravity,
anchor_hints: AnchorHints,
rect_anchor_dx: i32,
rect_anchor_dy: i32
)
[src]
&self,
rect: &Rectangle,
rect_anchor: Gravity,
window_anchor: Gravity,
anchor_hints: AnchorHints,
rect_anchor_dx: i32,
rect_anchor_dy: i32
)
fn peek_children(&self) -> Vec<Window>
[src]
fn process_updates(&self, update_children: bool)
[src]
fn raise(&self)
[src]
fn register_dnd(&self)
[src]
fn reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32)
[src]
fn resize(&self, width: i32, height: i32)
[src]
fn restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool)
[src]
fn scroll(&self, dx: i32, dy: i32)
[src]
fn set_accept_focus(&self, accept_focus: bool)
[src]
fn set_background_rgba(&self, rgba: &RGBA)
[src]
fn set_child_input_shapes(&self)
[src]
fn set_child_shapes(&self)
[src]
fn set_composited(&self, composited: bool)
[src]
fn set_cursor(&self, cursor: Option<&Cursor>)
[src]
fn set_decorations(&self, decorations: WMDecoration)
[src]
fn set_device_cursor(&self, device: &Device, cursor: &Cursor)
[src]
fn set_device_events(&self, device: &Device, event_mask: EventMask)
[src]
fn set_event_compression(&self, event_compression: bool)
[src]
fn set_events(&self, event_mask: EventMask)
[src]
fn set_focus_on_map(&self, focus_on_map: bool)
[src]
fn set_fullscreen_mode(&self, mode: FullscreenMode)
[src]
fn set_functions(&self, functions: WMFunction)
[src]
fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints)
[src]
fn set_group<P: IsA<Window>>(&self, leader: Option<&P>)
[src]
fn set_icon_list(&self, pixbufs: &[Pixbuf])
[src]
fn set_icon_name(&self, name: Option<&str>)
[src]
fn set_keep_above(&self, setting: bool)
[src]
fn set_keep_below(&self, setting: bool)
[src]
fn set_modal_hint(&self, modal: bool)
[src]
fn set_opacity(&self, opacity: f64)
[src]
fn set_opaque_region(&self, region: Option<&Region>)
[src]
fn set_override_redirect(&self, override_redirect: bool)
[src]
fn set_pass_through(&self, pass_through: bool)
[src]
fn set_role(&self, role: &str)
[src]
fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32)
[src]
fn set_skip_pager_hint(&self, skips_pager: bool)
[src]
fn set_skip_taskbar_hint(&self, skips_taskbar: bool)
[src]
fn set_source_events(&self, source: InputSource, event_mask: EventMask)
[src]
fn set_startup_id(&self, startup_id: &str)
[src]
fn set_static_gravities(&self, use_static: bool) -> bool
[src]
fn set_support_multidevice(&self, support_multidevice: bool)
[src]
fn set_title(&self, title: &str)
[src]
fn set_transient_for<P: IsA<Window>>(&self, parent: &P)
[src]
fn set_type_hint(&self, hint: WindowTypeHint)
[src]
fn set_urgency_hint(&self, urgent: bool)
[src]
fn shape_combine_region(
&self,
shape_region: Option<&Region>,
offset_x: i32,
offset_y: i32
)
[src]
&self,
shape_region: Option<&Region>,
offset_x: i32,
offset_y: i32
)
fn show(&self)
[src]
fn show_unraised(&self)
[src]
fn show_window_menu(&self, event: &mut Event) -> bool
[src]
fn stick(&self)
[src]
fn thaw_toplevel_updates_libgtk_only(&self)
[src]
fn thaw_updates(&self)
[src]
fn unfullscreen(&self)
[src]
fn unmaximize(&self)
[src]
fn unstick(&self)
[src]
fn withdraw(&self)
[src]
fn connect_create_surface<F: Fn(&Self, i32, i32) -> Surface + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_cursor_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId