gtkmm: Gdk::Window Class Reference

gtkmm 3.89.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gdk::Window Class Reference

A Gdk::Window is a rectangular region on the screen. More...

`#include <gdkmm/window.h>`

Inheritance diagram for Gdk::Window:
[legend]

## Public Member Functions
| Window (Window&& src) noexcept
Window& | operator= (Window&& src) noexcept
| ~Window () noexceptoverride
GdkWindow* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkWindow* | gobj () const
| Provides access to the underlying C GObject. More...
GdkWindow* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
WindowType | get_window_type () const
| Gets the type of the window. More...
Glib::RefPtr< Screen > | get_screen ()
| Gets the Gdk::Screen associated with a Gdk::Window. More...
Glib::RefPtr< const Screen > | get_screen () const
| Gets the Gdk::Screen associated with a Gdk::Window. More...
Glib::RefPtr< Display > | get_display ()
| Gets the Gdk::Display associated with a Gdk::Window. More...
Glib::RefPtr< const Display > | get_display () const
| Gets the Gdk::Display associated with a Gdk::Window. More...
void | show ()
| 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). More...
void | hide ()
| 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. More...
void | withdraw ()
| Withdraws a window (unmaps it and asks the window manager to forget about it). More...
void | show_unraised ()
| Shows a Gdk::Window onscreen, but does not modify its stacking order. More...
void | move (int x, int y)
| Repositions a window relative to its parent window. More...
void | resize (int width, int height)
| Resizes window; for toplevel windows, asks the window manager to resize the window. More...
void | move_resize (int x, int y, int width, int height)
| Equivalent to calling move() and resize(), except that both operations are performed at once, avoiding strange visual effects. More...
void | reparent (const Glib::RefPtr< Window >& new_parent, int x, int y)
| Reparents window into the given new_parent. More...
void | raise ()
| Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window. More...
void | lower ()
| Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window. More...
void | restack (const Glib::RefPtr< Window >& sibling, bool above)
| Changes the position of window in the Z-order (stacking order), so that it is above sibling (if above is `true`) or below sibling (if above is `false`). More...
void | restack (bool above)
| Changes the position of this window in the Z-order (stacking order). More...
void | focus (guint32 timestamp)
| Sets keyboard focus to window. More...
void | set_user_data (gpointer user_data)
| For most purposes this function is deprecated in favor of Glib::object_set_data(). More...
void | add_filter (GdkFilterFunc function, gpointer data)
| Adds an event filter to window, allowing you to intercept events before they reach GDK. More...
void | remove_filter (GdkFilterFunc function, gpointer data)
| Remove a filter previously added with add_filter(). More...
void | scroll (int dx, int dy)
| Scroll the contents of window, both pixels and children, by the given amount. More...
void | move_region (const ::Cairo::RefPtr< ::Cairo::Region >& region, int dx, int dy)
| Move the part of window indicated by region by dy pixels in the Y direction and dx pixels in the X direction. More...
bool | ensure_native ()
| Tries to ensure that there is a window-system native window for this GdkWindow. More...
void | shape_combine_region (const ::Cairo::RefPtr< ::Cairo::Region >& shape_region, int offset_x=0, int offset_y=0)
| Makes pixels in window outside shape_region be transparent, so that the window may be nonrectangular. More...
void | set_child_shapes ()
| Sets the shape mask of window to the union of shape masks for all children of window, ignoring the shape mask of window itself. More...
void | merge_child_shapes ()
| Merges the shape masks for any child windows into the shape mask for window. More...
void | input_shape_combine_region (const ::Cairo::RefPtr< ::Cairo::Region >& shape_region, int offset_x, int offset_y)
| Like shape_combine_region(), but the shape applies only to event handling. More...
void | set_child_input_shapes ()
| Sets the input shape mask of window to the union of input shape masks for all children of window, ignoring the input shape mask of window itself. More...
void | merge_child_input_shapes ()
| Merges the input shape masks for any child windows into the input shape mask for window. More...
void | set_pass_through (bool pass_through=true)
| Sets whether input to the window is passed through to the window below. More...
bool | get_pass_through () const
| Returns whether input to the window is passed through to the window below. More...
bool | is_visible () const
| Checks whether the window has been mapped (with show() or show_unraised()). More...
bool | is_viewable () const
| Check if the window and all ancestors of the window are mapped. More...
bool | is_input_only () const
| Determines whether or not the window is an input only window. More...
bool | is_shaped () const
| Determines whether or not the window is shaped. More...
WindowState | get_state () const
| Gets the bitwise OR of the currently active window state flags, from the Gdk::WindowState enumeration. More...
bool | has_native () const
| Checks whether the window has a native window or not. More...
void | set_type_hint (WindowTypeHint hint)
| The application can use this call to provide a hint to the window manager about the functionality of a window. More...
WindowTypeHint | get_type_hint ()
| This function returns the type hint set for a window. More...
bool | get_modal_hint () const
| Determines whether or not the window manager is hinted that window has modal behaviour. More...
void | set_modal_hint (bool modal=true)
| The application can use this hint to tell the window manager that a certain window has modal behaviour. More...
void | set_geometry_hints (const Geometry& geometry, WindowHints geom_mask)
| Sets the geometry hints for window. More...
void | set_title (const Glib::ustring& title)
| Sets the title of a toplevel window, to be displayed in the titlebar. More...
void | set_role (const Glib::ustring& role)
| When using GTK+, typically you should use gtk_window_set_role() instead of this low-level function. More...
void | set_startup_id (const Glib::ustring& startup_id)
| When using GTK+, typically you should use gtk_window_set_startup_id() instead of this low-level function. More...
void | set_transient_for (const Glib::RefPtr< Window >& parent)
| Indicates to the window manager that window is a transient dialog associated with the application window parent. More...
void | set_cursor (const Glib::RefPtr< Cursor >& cursor)
| Sets the mouse pointer for a Gdk::Window. More...
void | set_cursor ()
| Use the parent window's cursor. More...
void | set_device_cursor (const Glib::RefPtr< Device >& device, const Glib::RefPtr< Cursor >& cursor)
| Sets a specific Gdk::Cursor for a given device when it gets inside window. More...
void | set_device_cursor (const Glib::RefPtr< Device >& device)
| Use the parent window's cursor. More...
Glib::RefPtr< Cursor > | get_device_cursor (const Glib::RefPtr< Device >& device)
| Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Window, or `nullptr`. More...
Glib::RefPtr< const Cursor > | get_device_cursor (const Glib::RefPtr< const Device >& device) const
| Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Window, or `nullptr`. More...
Glib::RefPtr< Cursor > | get_cursor ()
| Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Window, or `nullptr`. More...
Glib::RefPtr< const Cursor > | get_cursor () const
| Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Window, or `nullptr`. More...
void | get_user_data (gpointer* data)
| Retrieves the user data for window, which is normally the widget that window belongs to. More...
void | get_geometry (int& x, int& y, int& width, int& height) const
| Any of the return location arguments to this function may be `nullptr`, if you aren’t interested in getting the value of that field. More...
int | get_width () const
| Returns the width of the given window. More...
int | get_height () const
| Returns the height of the given window. More...
void | get_position (int& x, int& y) const
| Obtains the position of the window as reported in the most-recently-processed Gdk::EventConfigure. More...
int | get_origin (int& x, int& y) const
| Obtains the position of a window in root window coordinates. More...
void | get_root_coords (int x, int y, int& root_x, int& root_y)
| Obtains the position of a window position in root window coordinates. More...
void | coords_to_parent (double x, double y, double& parent_x, double& parent_y)
| Transforms window coordinates from a child window to its parent window. More...
void | coords_from_parent (double parent_x, double parent_y, double& x, double& y)
| Transforms window coordinates from a parent window to a child window. More...
void | get_root_origin (int& x, int& y) const
| Obtains the top-left corner of the window manager frame in root window coordinates. More...
void | get_frame_extents (Rectangle& rect) const
| Obtains the bounding box of the window, including window manager titlebar/borders if any. More...
int | get_scale_factor () const
| Returns the internal scale factor that maps from window coordiantes to the actual device pixels. More...
Glib::RefPtr< Window > | get_parent ()
| Obtains the parent of window, as known to GDK. More...
Glib::RefPtr< const Window > | get_parent () const
| Obtains the parent of window, as known to GDK. More...
Glib::RefPtr< Window > | get_toplevel ()
| Gets the toplevel window that’s an ancestor of window. More...
Glib::RefPtr< const Window > | get_toplevel () const
| Gets the toplevel window that’s an ancestor of window. More...
Glib::RefPtr< Window > | get_device_position (const Glib::RefPtr< const Device >& device, int& x, int& y, ModifierType& mask) const
| Obtains the current device position and modifier state. More...
Glib::RefPtr< Window > | get_device_position (const Glib::RefPtr< const Device >& device, double& x, double& y, ModifierType& mask) const
| Obtains the current device position in doubles and modifier state. More...
std::vector< Glib::RefPtr< Window > > | get_children ()
| Gets the list of children of window known to GDK. More...
std::vector< Glib::RefPtr< const Window > > | get_children () const
| Gets the list of children of window known to GDK. More...
EventMask | get_events () const
| Gets the event mask for window for all master input devices. More...
void | set_events (EventMask event_mask)
| The event mask for a window determines which events will be reported for that window from all master input devices. More...
EventMask | get_device_events (const Glib::RefPtr< const Device >& device) const
| Returns the event mask for window corresponding to an specific device. More...
void | set_device_events (const Glib::RefPtr< Device >& device, EventMask event_mask)
| Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to window. More...
EventMask | get_source_events (InputSource source) const
| Returns the event mask for window corresponding to the device class specified by source. More...
void | set_source_events (InputSource source, EventMask event_mask)
| Sets the event mask for any floating device (i.e. not attached to any visible pointer) that has the source defined as source. More...
void | set_icon_list (const std::vector< Glib::RefPtr< Gdk::Pixbuf > >& pixbufs)
| Sets a list of icons for the window. More...
void | unset_icon ()
void | set_icon_name (const Glib::ustring& name)
| Windows may have a name used while minimized, distinct from the name they display in their titlebar. More...
void | set_group (const Glib::RefPtr< Window >& leader)
| Sets the group leader window for window. More...
Glib::RefPtr< Window > | get_group ()
| Returns the group leader window for window. More...
Glib::RefPtr< const Window > | get_group () const
| Returns the group leader window for window. More...
void | set_decorations (WMDecoration decorations)
| “Decorations” are the features the window manager adds to a toplevel Gdk::Window. More...
bool | get_decorations (WMDecoration& decorations) const
| Returns the decorations set on the GdkWindow with set_decorations(). More...
void | set_functions (WMFunction functions)
| Sets hints about the window management functions to make available via buttons on the window frame. More...
::Cairo::RefPtr< ::Cairo::Surface > | create_similar_surface (::Cairo::Content content, int width, int height)
| Create a new surface that is as compatible as possible with the given window. More...
::Cairo::RefPtr< ::Cairo::Surface > | create_similar_image_surface (::Cairo::Format format, int width, int height, int scale)
| Create a new image surface that is efficient to draw on the given window. More...
void | beep ()
| Emits a short beep associated to window in the appropriate display, if supported. More...
void | iconify ()
| Asks to iconify (minimize) window. More...
void | deiconify ()
| Attempt to deiconify (unminimize) window. More...
void | stick ()
| “Pins” a window such that it’s on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports. More...
void | unstick ()
| Reverse operation for stick(); see stick(), and gtk_window_unstick(). More...
void | maximize ()
| Maximizes the window. More...
void | unmaximize ()
| Unmaximizes the window. More...
void | register_dnd ()
| Registers a window as a potential drop destination. More...
DragProtocol | get_drag_protocol (Glib::RefPtr< Window >& target) const
| Finds out the DND protocol supported by a window. More...
DragProtocol | get_drag_protocol () const
| Finds out the DND protocol supported by a window. More...
void | begin_resize_drag (WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp)
| Begins a window resize operation (for a toplevel window). More...
void | resize_drag (WindowEdge edge, const Glib::RefPtr< Device >& device, int button, int root_x, int root_y, guint32 timestamp)
| Begins a window resize operation (for a toplevel window). More...
void | begin_move_drag (int button, int root_x, int root_y, guint32 timestamp)
| Begins a window move operation (for a toplevel window). More...
void | begin_move_drag (const Glib::RefPtr< Device >& device, int button, int root_x, int root_y, guint32 timestamp)
| Begins a window move operation (for a toplevel window). More...
Glib::RefPtr< DragContext > | drag_begin (const std::vector< Glib::ustring >& targets)
| Starts a drag and creates a new drag context for it. More...
void | invalidate_rect (const Rectangle& rect, bool invalidate_children)
| A convenience wrapper around invalidate_region() which invalidates a rectangular region. More...
void | invalidate (bool invalidate_children)
| A convenience wrapper around invalidate_region() which invalidates the whole region. More...
void | invalidate_region (const ::Cairo::RefPtr< ::Cairo::Region >& region, bool invalidate_children=true)
| Adds region to the update area for window. More...
::Cairo::RefPtr< ::Cairo::Region > | get_update_area ()
| Transfers ownership of the update area from window to the caller of the function. More...
void | freeze_updates ()
| Temporarily freezes a window such that it won’t receive expose events. More...
void | thaw_updates ()
| Thaws a window frozen with freeze_updates(). More...
void | set_skip_taskbar_hint (bool skips_taskbar=true)
| Toggles whether a window should appear in a task list or window list. More...
void | set_skip_pager_hint (bool skips_pager=true)
| 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). More...
void | set_urgency_hint (bool urgent=true)
| Toggles whether a window needs the user's urgent attention. More...
void | fullscreen ()
| Moves the window into fullscreen mode. More...
void | set_fullscreen_mode (FullscreenMode mode)
| Specifies whether the window should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode. More...
FullscreenMode | get_fullscreen_mode () const
| Obtains the Gdk::FullscreenMode of the window. More...
void | unfullscreen ()
| Moves the window out of fullscreen mode. More...
void | set_keep_above (bool setting=true)
| Set if window must be kept above other windows. More...
void | set_keep_below (bool setting=true)
| Set if window must be kept below other windows. More...
void | set_opacity (double opacity)
| Set window to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. More...
bool | get_accept_focus () const
| Determines whether or not the desktop environment shuld be hinted that the window does not want to receive input focus. More...
void | set_accept_focus (bool accept_focus=true)
| Setting accept_focus to `false` hints the desktop environment that the window doesn’t want to receive input focus. More...
bool | get_focus_on_map () const
| Determines whether or not the desktop environment should be hinted that the window does not want to receive input focus when it is mapped. More...
void | set_focus_on_map (bool focus_on_map)
| Setting focus_on_map to `false` hints the desktop environment that the window doesn’t want to receive input focus when it is mapped. More...
void | set_support_multidevice (bool support_multidevice=true)
| This function will enable multidevice features in window. More...
bool | get_support_multidevice ()
| Returns `true` if the window is aware of the existence of multiple devices. More...
::Cairo::RefPtr< ::Cairo::Region > | get_clip_region () const
| Computes the region of a window that potentially can be written to by drawing primitives. More...
::Cairo::RefPtr< ::Cairo::Region > | get_visible_region () const
| Computes the region of the window that is potentially visible. More...
void | set_opaque_region (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| For optimisation purposes, compositing window managers may like to not draw obscured regions of windows, or turn off blending during for these regions. More...
void | set_event_compression (bool event_compression=true)
| Determines whether or not extra unprocessed motion events in the event queue can be discarded. More...
bool | get_event_compression () const
| Get the current event compression setting for this window. More...
void | set_shadow_width (int left, int right, int top, int bottom)
| Newer GTK+ windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. More...
bool | show_window_menu (GdkEvent* event)
| Asks the windowing system to show the window menu. More...
Glib::RefPtr< Gdk::GLContext > | create_gl_context ()
| Creates a new GLContext matching the framebuffer format to the visual of the Window. More...
Glib::RefPtr< DrawingContext > | begin_draw_frame (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| Indicates that you are beginning the process of redrawing region on window, and provides you with a Gdk::DrawingContext. More...
void | end_draw_frame (const Glib::RefPtr< DrawingContext >& context)
| Indicates that the drawing of the contents of window started with gdk_window_begin_frame() has been completed. More...
Glib::PropertyProxy< Glib::RefPtr< Cursor > > | property_cursor ()
| The mouse pointer for a Gdk::Window. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Cursor > > | property_cursor () const
| The mouse pointer for a Gdk::Window. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const
| The Gdk::Display connection of the window. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< Window > | create_toplevel (const Glib::RefPtr< Display >& display, EventMask event_mask, int width, int height)
| Creates a new toplevel window. More...
static Glib::RefPtr< Window > | create_popup (const Glib::RefPtr< Display >& display, EventMask event_mask, const Rectangle& position)
| Creates a new toplevel popup window. More...
static Glib::RefPtr< Window > | create_child (const Glib::RefPtr< Window >& parent, EventMask event_mask, const Rectangle& position)
| Creates a new client-side child window. More...
static Glib::RefPtr< Window > | create_input (const Glib::RefPtr< Window >& parent, EventMask event_mask, const Rectangle& position)
| Creates a new client-side input-only window. More...
static void | constrain_size (const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height)
| Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size). More...
static Glib::RefPtr< Window > | get_default_root_window ()
| Obtains the root window (parent all other windows are inside) for the default display and screen. More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gdk::Window > | wrap (GdkWindow* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexceptoverride
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Detailed Description

A Gdk::Window is a rectangular region on the screen.

It's a low-level object, used to implement high-level objects such as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Windows. For example, each Gtk::Button has a Gdk::Window associated with it.

## Constructor & Destructor Documentation

Gdk::Window::Window | ( | Window&& | src | ) |
| noexcept

Gdk::Window::~Window | ( |  | ) |
| overridenoexcept

## Member Function Documentation

void Gdk::Window::add_filter | ( | GdkFilterFunc | function,
|  | gpointer | data
| ) |  |

Adds an event filter to window, allowing you to intercept events before they reach GDK.

This is a low-level operation and makes it easy to break GDK and/or GTK+, so you have to know what you're doing. Pass `nullptr` for window to get all events for all windows, instead of events for a specific window.

If you are interested in X GenericEvents, bear in mind that XGetEventData() has been already called on the event, and XFreeEventData() must not be called within function.

Parameters

  function | Filter callback.
  data | Data to pass to filter callback.

void Gdk::Window::beep | ( |  | ) |

Emits a short beep associated to window in the appropriate display, if supported.

Otherwise, emits a short beep on the display just as Gdk::Display::beep().

Since gtkmm 2.12:

Glib::RefPtr<DrawingContext> Gdk::Window::begin_draw_frame | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | region | ) |

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

If window is a top level Gdk::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 window. Then, all drawing operations performed on window will be diverted to the backing store. When you call gdk_window_end_frame(), the contents of the backing store will be copied to window, making it visible on screen. Only the part of window 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 window 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.

Since gtkmm 3.22:

Parameters

  region | A Cairo region.

Returns
  A Gdk::DrawingContext context that should be used to draw the contents of the window; the returned context is owned by GDK.

void Gdk::Window::begin_move_drag | ( | int | button,
|  | int | root_x,
|  | int | root_y,
|  | guint32 | timestamp
| ) |  |

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.

Parameters

  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.

void Gdk::Window::begin_move_drag | ( | const Glib::RefPtr< Device >& | device,
|  | int | button,
|  | int | root_x,
|  | int | root_y,
|  | guint32 | timestamp
| ) |  |

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.

Since gtkmm 3.4:

Parameters

  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.

void Gdk::Window::begin_resize_drag | ( | WindowEdge | edge,
|  | int | button,
|  | int | root_x,
|  | int | root_y,
|  | guint32 | timestamp
| ) |  |

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.

Parameters

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

static void Gdk::Window::constrain_size | ( | const Geometry& | geometry,
|  | guint | flags,
|  | int | width,
|  | int | height,
|  | int & | new_width,
|  | int & | new_height
| ) |  |
| static

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

Parameters

  geometry | A Gdk::Geometry structure.
  flags | A mask indicating what portions of geometry are set.
  width | Desired width of window.
  height | Desired height of the window.
  new_width | Location to store resulting width.
  new_height | Location to store resulting height.

void Gdk::Window::coords_from_parent | ( | double | parent_x,
|  | double | parent_y,
|  | double & | x,
|  | double & | y
| ) |  |

Transforms window coordinates from a parent window to a child window.

Calling this function is equivalent to subtracting the return values of get_position() from the parent coordinates.

See also: coords_to_parent()

Since gtkmm 2.22:

Parameters

  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.

void Gdk::Window::coords_to_parent | ( | double | x,
|  | double | y,
|  | double & | parent_x,
|  | double & | parent_y
| ) |  |

Transforms window coordinates from a child window to its parent window.

Calling this function is equivalent to adding the return values of get_position() to the child coordinates.

See also: coords_from_parent()

Since gtkmm 2.22:

Parameters

  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 `nullptr`.
  parent_y | Return location for Y coordinate in parent’s coordinate system, or `nullptr`.

static Glib::RefPtr<Window> Gdk::Window::create_child | ( | const Glib::RefPtr< Window >& | parent,
|  | EventMask | event_mask,
|  | const Rectangle& | position
| ) |  |
| static

Creates a new client-side child window.

Since gtkmm 3.90:

Parameters

  parent | The parent window.
  event_mask | Event mask (see set_events()).
  position | Placement of the window inside parent.

Returns
  The new Gdk::Window.

Glib::RefPtr<Gdk::GLContext> Gdk::Window::create_gl_context | ( |  | ) |

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 an error will be thrown.

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

Since gtkmm 3.18:

Returns
  GLContext The newly created context.

Exceptions

  GLError | On missing GL implementation or extension required for context creation.

static Glib::RefPtr<Window> Gdk::Window::create_input | ( | const Glib::RefPtr< Window >& | parent,
|  | EventMask | event_mask,
|  | const Rectangle& | position
| ) |  |
| static

Creates a new client-side input-only window.

Since gtkmm 3.90:

Parameters

  parent | The parent window.
  event_mask | Event mask (see set_events()).
  position | Placement of the window inside parent.

Returns
  The new Gdk::Window.

static Glib::RefPtr<Window> Gdk::Window::create_popup | ( | const Glib::RefPtr< Display >& | display,
|  | EventMask | event_mask,
|  | const Rectangle& | position
| ) |  |
| static

Creates a new toplevel popup window.

The window will bypass window management.

Since gtkmm 3.90:

Parameters

  display | The display to create the window on.
  event_mask | Event mask (see set_events()).
  position | Position of the window on screen.

Returns
  The new Gdk::Window.

::Cairo::RefPtr< ::Cairo::Surface> Gdk::Window::create_similar_image_surface | ( | ::Cairo::Format | format,
|  | int | width,
|  | int | height,
|  | int | scale
| ) |  |

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

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 window, 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 window you can use:

[C example ellipted]

Since gtkmm 3.10:

Parameters

  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 window.

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.

::Cairo::RefPtr< ::Cairo::Surface> Gdk::Window::create_similar_surface | ( | ::Cairo::Content | content,
|  | int | width,
|  | int | height
| ) |  |

Create a new surface that is as compatible as possible with the given window.

For example the new surface will have the same fallback resolution and font options as window. Generally, the new surface will also use the same backend as window, 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.)

Since gtkmm 2.22:

Parameters

  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.

static Glib::RefPtr<Window> Gdk::Window::create_toplevel | ( | const Glib::RefPtr< Display >& | display,
|  | EventMask | event_mask,
|  | int | width,
|  | int | height
| ) |  |
| static

Creates a new toplevel window.

The window will be managed by the window manager.

Since gtkmm 3.90:

Parameters

  display | The display to create the window on.
  event_mask | Event mask (see set_events()).
  width | Width of new window.
  height | Height of new window.

Returns
  The new Gdk::Window.

void Gdk::Window::deiconify | ( |  | ) |

Attempt to deiconify (unminimize) window.

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

Glib::RefPtr<DragContext> Gdk::Window::drag_begin | ( | const std::vector< Glib::ustring > & | targets | ) |

Starts a drag and creates a new drag context for it.

This method is called by the drag source.

Parameters

  targets | A list of the offered targets names.

Returns
  A newly created Gdk::DragContext.

Since gtkmm 2.24:

void Gdk::Window::end_draw_frame | ( | const Glib::RefPtr< DrawingContext >& | context | ) |

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

This function will take care of destroying the Gdk::DrawingContext.

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

Since gtkmm 3.22:

Parameters

  context | The Gdk::DrawingContext created by begin_draw_frame().

bool Gdk::Window::ensure_native | ( |  | ) |

Tries to ensure that there is a window-system native window for this GdkWindow.

This may fail in some situations, returning `false`.

Some backends may not support native child windows.

Since gtkmm 2.18:

Returns
  `true` if the window has a native window, `false` otherwise.

void Gdk::Window::focus | ( | guint32 | timestamp | ) |

Sets keyboard focus to window.

In most cases, gtk_window_present() should be used on a Gtk::Window, rather than calling this function.

Parameters

  timestamp | Timestamp of the event triggering the window focus.

void Gdk::Window::freeze_updates | ( |  | ) |

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.

void Gdk::Window::fullscreen | ( |  | ) |

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 window 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.

Since gtkmm 2.2:

bool Gdk::Window::get_accept_focus | ( |  | ) | const

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

Since gtkmm 2.22:

Returns
  Whether or not the window should receive input focus.

std::vector< Glib::RefPtr<Window> > Gdk::Window::get_children | ( |  | ) |

Gets the list of children of window 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 window.

std::vector< Glib::RefPtr<const Window> > Gdk::Window::get_children | ( |  | ) | const

Gets the list of children of window 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 window.

::Cairo::RefPtr< ::Cairo::Region> Gdk::Window::get_clip_region | ( |  | ) | const

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_t. This must be freed with cairo_region_destroy() when you are done.

Glib::RefPtr<Cursor> Gdk::Window::get_cursor | ( |  | ) |

Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Window, or `nullptr`.

If the return value is `nullptr` then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Since gtkmm 2.18:

Returns
  A Gdk::Cursor, or `nullptr`. The returned object is owned by the Gdk::Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window.

Glib::RefPtr<const Cursor> Gdk::Window::get_cursor | ( |  | ) | const

Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Window, or `nullptr`.

If the return value is `nullptr` then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Since gtkmm 2.18:

Returns
  A Gdk::Cursor, or `nullptr`. The returned object is owned by the Gdk::Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window.

bool Gdk::Window::get_decorations | ( | WMDecoration& | decorations | ) | const

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

Parameters

  decorations | The window decorations will be written here.

Returns
  `true` if the window has decorations set, `false` otherwise.

static Glib::RefPtr<Window> Gdk::Window::get_default_root_window | ( |  | ) |
| static

Obtains the root window (parent all other windows are inside) for the default display and screen.

Returns
  The default root window.

Glib::RefPtr<Cursor> Gdk::Window::get_device_cursor | ( | const Glib::RefPtr< Device >& | device | ) |

Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Window, or `nullptr`.

If the return value is `nullptr` then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Since gtkmm 3.0:

Parameters

  device | A master, pointer Gdk::Device.

Returns
  A Gdk::Cursor, or `nullptr`. The returned object is owned by the Gdk::Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window.

Glib::RefPtr<const Cursor> Gdk::Window::get_device_cursor | ( | const Glib::RefPtr< const Device >& | device | ) | const

Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Window, or `nullptr`.

If the return value is `nullptr` then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Since gtkmm 3.0:

Parameters

  device | A master, pointer Gdk::Device.

Returns
  A Gdk::Cursor, or `nullptr`. The returned object is owned by the Gdk::Window and should not be unreferenced directly. Use set_cursor() to unset the cursor of the window.

EventMask Gdk::Window::get_device_events | ( | const Glib::RefPtr< const Device >& | device | ) | const

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

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.

Returns
  Device event mask for window.

Glib::RefPtr<Window> Gdk::Window::get_device_position | ( | const Glib::RefPtr< const Device >& | device,
|  | int & | x,
|  | int & | y,
|  | ModifierType& | mask
| ) |  | const

Obtains the current device position and modifier state.

The position is given in coordinates relative to the upper left corner of window.

Use get_device_position_double() if you need subpixel precision.

Since gtkmm 3.0:

Parameters

  device | Pointer Gdk::Device to query to.
  x | Return location for the X coordinate of device, or `nullptr`.
  y | Return location for the Y coordinate of device, or `nullptr`.
  mask | Return location for the modifier mask, or `nullptr`.

Returns
  The window underneath device (as with Gdk::Device::get_window_at_position()), or `nullptr` if the window is not known to GDK.

Glib::RefPtr<Window> Gdk::Window::get_device_position | ( | const Glib::RefPtr< const Device >& | device,
|  | double & | x,
|  | double & | y,
|  | ModifierType& | mask
| ) |  | const

Obtains the current device position in doubles and modifier state.

The position is given in coordinates relative to the upper left corner of window.

Since gtkmm 3.10:

Parameters

  device | Pointer Gdk::Device to query to.
  x | Return location for the X coordinate of device, or `nullptr`.
  y | Return location for the Y coordinate of device, or `nullptr`.
  mask | Return location for the modifier mask, or `nullptr`.

Returns
  The window underneath device (as with Gdk::Device::get_window_at_position()), or `nullptr` if the window is not known to GDK.

Glib::RefPtr<Display> Gdk::Window::get_display | ( |  | ) |

Gets the Gdk::Display associated with a Gdk::Window.

Since gtkmm 2.24:

Returns
  The Gdk::Display associated with window.

Glib::RefPtr<const Display> Gdk::Window::get_display | ( |  | ) | const

Gets the Gdk::Display associated with a Gdk::Window.

Since gtkmm 2.24:

Returns
  The Gdk::Display associated with window.

DragProtocol Gdk::Window::get_drag_protocol | ( | Glib::RefPtr< Window >& | target | ) | const

Finds out the DND protocol supported by a window.

Since gtkmm 3.0:

Parameters

  target | Location of the window where the drop should happen. This may be window or a proxy window, or `nullptr` if window does not support Drag and Drop.

Returns
  The supported DND protocol.

DragProtocol Gdk::Window::get_drag_protocol | ( |  | ) | const

Finds out the DND protocol supported by a window.

Since gtkmm 3.0:

Returns
  The supported DND protocol.

bool Gdk::Window::get_event_compression | ( |  | ) | const

Get the current event compression setting for this window.

Since gtkmm 3.12:

Returns
  `true` if motion events will be compressed.

EventMask Gdk::Window::get_events | ( |  | ) | const

Gets the event mask for window for all master input devices.

See set_events().

Returns
  Event mask for window.

bool Gdk::Window::get_focus_on_map | ( |  | ) | const

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

Since gtkmm 2.22:

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

void Gdk::Window::get_frame_extents | ( | Rectangle& | rect | ) | const

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 get_origin().

Parameters

  rect | Rectangle to fill with bounding box of the window frame.

FullscreenMode Gdk::Window::get_fullscreen_mode | ( |  | ) | const

Obtains the Gdk::FullscreenMode of the window.

Since gtkmm 3.8:

Returns
  The Gdk::FullscreenMode applied to the window when fullscreen.

void Gdk::Window::get_geometry | ( | int & | x,
|  | int & | y,
|  | int & | width,
|  | int & | height
| ) |  | const

Any of the return location arguments to this function may be `nullptr`, 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 window, 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 window; this may be out-of-sync with the position of window delivered in the most-recently-processed Gdk::EventConfigure. get_position() in contrast gets the position from the most recent configure event.

Note
  If window is not a toplevel, it is much better to call get_position(), get_width() and get_height() instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit coordinate space, whereas get_geometry() is restricted to the 16-bit coordinates of X11.

Parameters

  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.

Glib::RefPtr<Window> Gdk::Window::get_group | ( |  | ) |

Returns the group leader window for window.

See set_group().

Since gtkmm 2.4:

Returns
  The group leader window for window.

Glib::RefPtr<const Window> Gdk::Window::get_group | ( |  | ) | const

Returns the group leader window for window.

See set_group().

Since gtkmm 2.4:

Returns
  The group leader window for window.

int Gdk::Window::get_height | ( |  | ) | const

Returns the height of the given window.

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.

Since gtkmm 2.24:

Returns
  The height of window.

bool Gdk::Window::get_modal_hint | ( |  | ) | const

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

Since gtkmm 2.22:

Returns
  Whether or not the window has the modal hint set.

int Gdk::Window::get_origin | ( | int & | x,
|  | int & | y
| ) |  | const

Obtains the position of a window in root window coordinates.

(Compare with get_position() and get_geometry() which return the position of a window relative to its parent window.)

Parameters

  x | Return location for X coordinate.
  y | Return location for Y coordinate.

Returns
  Not meaningful, ignore.

Glib::RefPtr<Window> Gdk::Window::get_parent | ( |  | ) |

Obtains the parent of window, as known to GDK.

Does not query the X server; thus this returns the parent as passed to gdk_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.

Returns
  Parent of window.

Glib::RefPtr<const Window> Gdk::Window::get_parent | ( |  | ) | const

Obtains the parent of window, as known to GDK.

Does not query the X server; thus this returns the parent as passed to gdk_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.

Returns
  Parent of window.

bool Gdk::Window::get_pass_through | ( |  | ) | const

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

See set_pass_through() for details

Since gtkmm 3.18:

void Gdk::Window::get_position | ( | int & | x,
|  | int & | y
| ) |  | const

Obtains the position of the window as reported in the most-recently-processed Gdk::EventConfigure.

Contrast with 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.

Parameters

  x | X coordinate of window.
  y | Y coordinate of window.

void Gdk::Window::get_root_coords | ( | int | x,
|  | int | y,
|  | int & | root_x,
|  | int & | root_y
| ) |  |

Obtains the position of a window position in root window coordinates.

This is similar to get_origin() but allows you to pass in any position in the window, not just the origin.

Since gtkmm 2.18:

Parameters

  x | X coordinate in window.
  y | Y coordinate in window.
  root_x | Return location for X coordinate.
  root_y | Return location for Y coordinate.

void Gdk::Window::get_root_origin | ( | int & | x,
|  | int & | y
| ) |  | const

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

Parameters

  x | Return location for X position of window frame.
  y | Return location for Y position of window frame.

int Gdk::Window::get_scale_factor | ( |  | ) | const

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.

Since gtkmm 3.10:

Returns
  The scale factor.

Glib::RefPtr<Screen> Gdk::Window::get_screen | ( |  | ) |

Gets the Gdk::Screen associated with a Gdk::Window.

Since gtkmm 2.24:

Returns
  The Gdk::Screen associated with window.

Glib::RefPtr<const Screen> Gdk::Window::get_screen | ( |  | ) | const

Gets the Gdk::Screen associated with a Gdk::Window.

Since gtkmm 2.24:

Returns
  The Gdk::Screen associated with window.

EventMask Gdk::Window::get_source_events | ( | InputSource | source | ) | const

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

Parameters

  source | A Gdk::InputSource to define the source class.

Returns
  Source event mask for window.

WindowState Gdk::Window::get_state | ( |  | ) | const

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

Returns
  Window state bitfield.

bool Gdk::Window::get_support_multidevice | ( |  | ) |

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

Since gtkmm 3.0:

Returns
  `true` if the window handles multidevice features.

Glib::RefPtr<Window> Gdk::Window::get_toplevel | ( |  | ) |

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

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

Returns
  The toplevel window containing window.

Glib::RefPtr<const Window> Gdk::Window::get_toplevel | ( |  | ) | const

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

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

Returns
  The toplevel window containing window.

static GType Gdk::Window::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

WindowTypeHint Gdk::Window::get_type_hint | ( |  | ) |

This function returns the type hint set for a window.

Since gtkmm 2.10:

Returns
  The type hint set for window.

::Cairo::RefPtr< ::Cairo::Region> Gdk::Window::get_update_area | ( |  | ) |

Transfers ownership of the update area from window to the caller of the function.

That is, after calling this function, window will no longer have an invalid/dirty region; the update area is removed from window and handed to you. If a window has no update area, get_update_area() returns an invalid Region.

Returns
  The update area for window.

void Gdk::Window::get_user_data | ( | gpointer * | data | ) |

Retrieves the user data for window, which is normally the widget that window belongs to.

See set_user_data().

Parameters

  data | Return location for user data.

::Cairo::RefPtr< ::Cairo::Region> Gdk::Window::get_visible_region | ( |  | ) | const

Computes the region of the window 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_t. This must be freed with cairo_region_destroy() when you are done.

int Gdk::Window::get_width | ( |  | ) | const

Returns the width of the given window.

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.

Since gtkmm 2.24:

Returns
  The width of window.

WindowType Gdk::Window::get_window_type | ( |  | ) | const

Gets the type of the window.

See Gdk::WindowType.

Returns
  Type of window.

GdkWindow* Gdk::Window::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GdkWindow* Gdk::Window::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GdkWindow* Gdk::Window::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gdk::Window::has_native | ( |  | ) | const

Checks whether the window has a native window or not.

Note that you can use ensure_native() if a native window is needed.

Since gtkmm 2.22:

Returns
  `true` if the window has a native window, `false` otherwise.

void Gdk::Window::hide | ( |  | ) |

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

void Gdk::Window::iconify | ( |  | ) |

Asks to iconify (minimize) window.

The window manager may choose to ignore the request, but normally will honor it. Using gtk_window_iconify() is preferred, if you have a Gtk::Window widget.

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

void Gdk::Window::input_shape_combine_region | ( | const ::Cairo::RefPtr< ::Cairo::Region > & | shape_region,
|  | int | offset_x,
|  | int | offset_y
| ) |  |

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 window.

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.

Since gtkmm 2.10:

Parameters

  shape_region | Region of window to be non-transparent.
  offset_x | X position of shape_region in window coordinates.
  offset_y | Y position of shape_region in window coordinates.

void Gdk::Window::invalidate | ( | bool | invalidate_children | ) |

A convenience wrapper around invalidate_region() which invalidates the whole region.

See invalidate_region() for details.

Parameters

  invalidate_children | Whether to also invalidate child windows.

void Gdk::Window::invalidate_rect | ( | const Rectangle& | rect,
|  | bool | invalidate_children
| ) |  |

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

See invalidate_region() for details. See also the invalidate_rect() method overload with no rect parameter, to invalidate the whole region.

Parameters

  rect | Rectangle to invalidate.
  invalidate_children | Whether to also invalidate child windows.

void Gdk::Window::invalidate_region | ( | const ::Cairo::RefPtr< ::Cairo::Region > & | region,
|  | bool | invalidate_children = `true`
| ) |  |

Adds region to the update area for window.

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 window 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.

Parameters

  region | A #cairo_region_t.
  invalidate_children | `true` to also invalidate child windows.

bool Gdk::Window::is_input_only | ( |  | ) | const

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

Since gtkmm 2.22:

Returns
  `true` if window is input only.

bool Gdk::Window::is_shaped | ( |  | ) | const

Determines whether or not the window is shaped.

Since gtkmm 2.22:

Returns
  `true` if window is shaped.

bool Gdk::Window::is_viewable | ( |  | ) | const

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.

bool Gdk::Window::is_visible | ( |  | ) | const

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

Returns
  `true` if the window is mapped.

void Gdk::Window::lower | ( |  | ) |

Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window.

This is true whether or not the other windows are visible.

If window 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().)

void Gdk::Window::maximize | ( |  | ) |

Maximizes the window.

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

On X11, asks the window manager to maximize window, 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.

void Gdk::Window::merge_child_input_shapes | ( |  | ) |

Merges the input shape masks for any child windows into the input shape mask for window.

i.e. the union of all input masks for window and its children will become the new input mask for window. See input_shape_combine_region().

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

Since gtkmm 2.10:

void Gdk::Window::merge_child_shapes | ( |  | ) |

Merges the shape masks for any child windows into the shape mask for window.

i.e. the union of all masks for window and its children will become the new mask for window. See shape_combine_region().

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

void Gdk::Window::move | ( | int | x,
|  | int | y
| ) |  |

Repositions a window relative to its parent window.

For toplevel windows, window managers may ignore or modify the move; you should probably use gtk_window_move() on a Gtk::Window widget anyway, instead of using GDK functions. For child windows, the move will reliably succeed.

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

Parameters

  x | X coordinate relative to window’s parent.
  y | Y coordinate relative to window’s parent.

void Gdk::Window::move_region | ( | const ::Cairo::RefPtr< ::Cairo::Region > & | region,
|  | int | dx,
|  | int | dy
| ) |  |

Move the part of window 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.

Since gtkmm 2.8:

Parameters

  region | The #cairo_region_t to move.
  dx | Amount to move in the X direction.
  dy | Amount to move in the Y direction.

void Gdk::Window::move_resize | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |

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

Parameters

  x | New X position relative to window’s parent.
  y | New Y position relative to window’s parent.
  width | New width.
  height | New height.

Window& Gdk::Window::operator= | ( | Window&& | src | ) |
| noexcept

Glib::PropertyProxy< Glib::RefPtr<Cursor> > Gdk::Window::property_cursor | ( |  | ) |

The mouse pointer for a Gdk::Window.

See Gdk::Window::set_cursor() and Gdk::Window::get_cursor() for details.

Since gtkmm 2.18:

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Cursor> > Gdk::Window::property_cursor | ( |  | ) | const

The mouse pointer for a Gdk::Window.

See Gdk::Window::set_cursor() and Gdk::Window::get_cursor() for details.

Since gtkmm 2.18:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> > Gdk::Window::property_display | ( |  | ) | const

The Gdk::Display connection of the window.

See Gdk::Window::get_display() for details.

Since gtkmm 3.90:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

void Gdk::Window::raise | ( |  | ) |

Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window.

This is true whether or not the windows are visible.

If window 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.

void Gdk::Window::register_dnd | ( |  | ) |

Registers a window as a potential drop destination.

void Gdk::Window::remove_filter | ( | GdkFilterFunc | function,
|  | gpointer | data
| ) |  |

Remove a filter previously added with add_filter().

Parameters

  function | Previously-added filter function.
  data | User data for previously-added filter function.

void Gdk::Window::reparent | ( | const Glib::RefPtr< Window >& | new_parent,
|  | int | x,
|  | int | y
| ) |  |

Reparents window into the given new_parent.

The window being reparented will be unmapped as a side effect.

Parameters

  new_parent | New parent to move window into.
  x | X location inside the new parent.
  y | Y location inside the new parent.

void Gdk::Window::resize | ( | int | width,
|  | int | height
| ) |  |

Resizes window; 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.

Parameters

  width | New width of the window.
  height | New height of the window.

void Gdk::Window::resize_drag | ( | WindowEdge | edge,
|  | const Glib::RefPtr< Device >& | device,
|  | int | button,
|  | int | root_x,
|  | int | root_y,
|  | guint32 | timestamp
| ) |  |

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

You might use this function to implement a “window resize grip,” for example; in fact Gtk::Statusbar 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.

Since gtkmm 3.4:

Parameters

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

void Gdk::Window::restack | ( | const Glib::RefPtr< Window >& | sibling,
|  | bool | above
| ) |  |

Changes the position of window 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 `nullptr`, then this either raises (if above is `true`) or lowers the window.

If window 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.

Since gtkmm 2.18:

Parameters

  sibling | A Gdk::Window that is a sibling of window, or `nullptr`.
  above | A boolean.

void Gdk::Window::restack | ( | bool | above | ) |

Changes the position of this window in the Z-order (stacking order).

This either raises (if above is true) or lowers the window.

If this 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 but does not guarantee it.

Parameters

  above | Whether to raise or lower the window.

Since gtkmm 2.18:

void Gdk::Window::scroll | ( | int | dx,
|  | int | dy
| ) |  |

Scroll the contents of window, both pixels and children, by the given amount.

window 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.

Parameters

  dx | Amount to scroll in the X direction.
  dy | Amount to scroll in the Y direction.

void Gdk::Window::set_accept_focus | ( | bool | accept_focus = `true` | ) |

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.

Since gtkmm 2.4:

Parameters

  accept_focus | `true` if the window should receive input focus.

void Gdk::Window::set_child_input_shapes | ( |  | ) |

Sets the input shape mask of window to the union of input shape masks for all children of window, ignoring the input shape mask of window itself.

Contrast with merge_child_input_shapes() which includes the input shape mask of window in the masks to be merged.

Since gtkmm 2.10:

void Gdk::Window::set_child_shapes | ( |  | ) |

Sets the shape mask of window to the union of shape masks for all children of window, ignoring the shape mask of window itself.

Contrast with merge_child_shapes() which includes the shape mask of window in the masks to be merged.

void Gdk::Window::set_cursor | ( | const Glib::RefPtr< Cursor >& | cursor | ) |

Sets the mouse pointer for a Gdk::Window.

To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create a cursor with no pixels in it.

Parameters

  cursor | A cursor.

void Gdk::Window::set_cursor | ( |  | ) |

Use the parent window's cursor.

For top-level windows this means that it will use the default cursor for the ROOT window.

void Gdk::Window::set_decorations | ( | WMDecoration | decorations | ) |

“Decorations” are the features the window manager adds to a toplevel Gdk::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 Gtk::Window instead of using the GDK function directly.

The decorations argument is the logical OR of the fields in the Gdk::WMDecoration enumeration. If Gdk::DECOR_ALL is included in the mask, the other bits indicate which decorations should be turned off. If Gdk::DECOR_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.

Parameters

  decorations | Decoration hint mask.

void Gdk::Window::set_device_cursor | ( | const Glib::RefPtr< Device >& | device,
|  | const Glib::RefPtr< Cursor >& | cursor
| ) |  |

Sets a specific Gdk::Cursor for a given device when it gets inside window.

Use Gdk::Cursor::new_for_display() or Gdk::Cursor::new_from_pixbuf() to create the cursor. To make the cursor invisible, use Gdk::BLANK_CURSOR. Passing `nullptr` for the cursor argument to set_cursor() means that window will use the cursor of its parent window. Most windows should use this default.

Since gtkmm 3.0:

Parameters

  device | A master, pointer Gdk::Device.
  cursor | A Gdk::Cursor.

void Gdk::Window::set_device_cursor | ( | const Glib::RefPtr< Device >& | device | ) |

Use the parent window's cursor.

For top-level windows this means that it will use the default cursor for the ROOT window.

void Gdk::Window::set_device_events | ( | const Glib::RefPtr< Device >& | device,
|  | EventMask | event_mask
| ) |  |

Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to window.

For example, an event mask including Gdk::BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the Gdk::EventMask enumeration.

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

Since gtkmm 3.0:

Parameters

  device | Gdk::Device to enable events for.
  event_mask | Event mask for window.

void Gdk::Window::set_event_compression | ( | bool | event_compression = `true` | ) |

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.

Since gtkmm 3.12:

Parameters

  event_compression | `true` if motion events should be compressed.

void Gdk::Window::set_events | ( | EventMask | event_mask | ) |

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 Gdk::BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the Gdk::EventMask enumeration.

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

Parameters

  event_mask | Event mask for window.

void Gdk::Window::set_focus_on_map | ( | bool | focus_on_map | ) |

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.

Since gtkmm 2.6:

Parameters

  focus_on_map | `true` if the window should receive input focus when mapped.

void Gdk::Window::set_fullscreen_mode | ( | FullscreenMode | mode | ) |

Specifies whether the window 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 Gdk::FullscreenMode enumeration. If Gdk::FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen window will span over all monitors from the Gdk::Screen.

On X11, searches through the list of monitors from the Gdk::Screen the ones which delimit the 4 edges of the entire Gdk::Screen and will ask the window manager to span the window 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 Gdk::FULLSCREEN_ON_ALL_MONITORS is specified.

Since gtkmm 3.8:

Parameters

  mode | Fullscreen mode.

void Gdk::Window::set_functions | ( | WMFunction | functions | ) |

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 Gdk::WMFunction enumeration. If the bitmask includes Gdk::FUNC_ALL, then the other bits indicate which functions to disable; if it doesn’t include Gdk::FUNC_ALL, it indicates which functions to enable.

Parameters

  functions | Bitmask of operations to allow on window.

void Gdk::Window::set_geometry_hints | ( | const Geometry& | geometry,
|  | WindowHints | geom_mask
| ) |  |

Sets the geometry hints for window.

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 `nullptr`.

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 Gdk::WINDOW_TEMP 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.

Parameters

  geometry | Geometry hints.
  geom_mask | Bitmask indicating fields of geometry to pay attention to.

void Gdk::Window::set_group | ( | const Glib::RefPtr< Window >& | leader | ) |

Sets the group leader window for window.

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.

Parameters

  leader | Group leader window, or `nullptr` to restore the default group leader window.

void Gdk::Window::set_icon_list | ( | const std::vector< Glib::RefPtr< Gdk::Pixbuf > >& | pixbufs | ) |

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.

Parameters

  pixbufs | A list of pixbufs, of different sizes.

void Gdk::Window::set_icon_name | ( | const Glib::ustring & | name | ) |

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-`nullptr` name, calls to set_title() will not update the icon title.

Using `nullptr` 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.

Parameters

  name | Name of window while iconified (minimized).

void Gdk::Window::set_keep_above | ( | bool | setting = `true` | ) |

Set if window 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 window 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.

Since gtkmm 2.4:

Parameters

  setting | Whether to keep window above other windows.

void Gdk::Window::set_keep_below | ( | bool | setting = `true` | ) |

Set if window 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 window 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.

Since gtkmm 2.4:

Parameters

  setting | Whether to keep window below other windows.

void Gdk::Window::set_modal_hint | ( | bool | modal = `true` | ) |

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()

Parameters

  modal | `true` if the window is modal, `false` otherwise.

void Gdk::Window::set_opacity | ( | double | opacity | ) |

Set window 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, <tt>nullptr</tt>)` 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.

Support for non-toplevel windows was added in 3.8.

Since gtkmm 2.12:

Parameters

  opacity | Opacity.

void Gdk::Window::set_opaque_region | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | 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 window background is opaque, as we know where the opaque regions are. If your window background is not opaque, please update this property in your Gtk::Widget::signal_style_updated() handler.

Since gtkmm 3.10:

Parameters

  region | A region, or `nullptr`.

void Gdk::Window::set_pass_through | ( | bool | pass_through = `true` | ) |

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 window. 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.

Since gtkmm 3.18:

Parameters

  pass_through | A boolean.

void Gdk::Window::set_role | ( | const Glib::ustring & | role | ) |

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.

Parameters

  role | A string indicating its role.

void Gdk::Window::set_shadow_width | ( | int | left,
|  | int | right,
|  | int | top,
|  | int | bottom
| ) |  |

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.

Since gtkmm 3.12:

Parameters

  left | The left extent.
  right | The right extent.
  top | The top extent.
  bottom | The bottom extent.

void Gdk::Window::set_skip_pager_hint | ( | bool | skips_pager = `true` | ) |

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.

Since gtkmm 2.2:

Parameters

  skips_pager | `true` to skip the pager.

void Gdk::Window::set_skip_taskbar_hint | ( | bool | skips_taskbar = `true` | ) |

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.

Since gtkmm 2.2:

Parameters

  skips_taskbar | `true` to skip the taskbar.

void Gdk::Window::set_source_events | ( | InputSource | source,
|  | EventMask | event_mask
| ) |  |

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.

Since gtkmm 3.0:

Parameters

  source | A Gdk::InputSource to define the source class.
  event_mask | Event mask for window.

void Gdk::Window::set_startup_id | ( | const Glib::ustring & | startup_id | ) |

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

Since gtkmm 2.12:

Parameters

  startup_id | A string with startup-notification identifier.

void Gdk::Window::set_support_multidevice | ( | bool | support_multidevice = `true` | ) |

This function will enable multidevice features in window.

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

Since gtkmm 3.0:

Parameters

  support_multidevice | `true` to enable multidevice support in window.

void Gdk::Window::set_title | ( | const Glib::ustring & | title | ) |

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 `nullptr`.

Parameters

  title | Title of window.

void Gdk::Window::set_transient_for | ( | const Glib::RefPtr< Window >& | parent | ) |

Indicates to the window manager that window is a transient dialog associated with the application window parent.

This allows the window manager to do things like center window on parent and keep window above parent.

See gtk_window_set_transient_for() if you’re using Gtk::Window or Gtk::Dialog.

Parameters

  parent | Another toplevel Gdk::Window.

void Gdk::Window::set_type_hint | ( | WindowTypeHint | hint | ) |

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.

Parameters

  hint | A hint of the function this window will have.

void Gdk::Window::set_urgency_hint | ( | bool | urgent = `true` | ) |

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

Since gtkmm 2.8:

Parameters

  urgent | `true` if the window is urgent.

void Gdk::Window::set_user_data | ( | gpointer | user_data | ) |

For most purposes this function is deprecated in favor of Glib::object_set_data().

However, for historical reasons GTK+ stores the Gtk::Widget that owns a Gdk::Window as user data on the Gdk::Window. So, custom widget implementations should use this function for that. If GTK+ receives an event for a Gdk::Window, and the user data for the window is non-`nullptr`, GTK+ will assume the user data is a Gtk::Widget, and forward the event to that widget.

Parameters

  user_data | User data.

void Gdk::Window::shape_combine_region | ( | const ::Cairo::RefPtr< ::Cairo::Region > & | shape_region,
|  | int | offset_x = `0`,
|  | int | offset_y = `0`
| ) |  |

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

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

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.

Parameters

  shape_region | Region of window to be non-transparent.
  offset_x | X position of shape_region in window coordinates.
  offset_y | Y position of shape_region in window coordinates.

void Gdk::Window::show | ( |  | ) |

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 Gtk::Widget, you should call this function on the widget's Gdk::Window as part of the “map” method.

void Gdk::Window::show_unraised | ( |  | ) |

Shows a Gdk::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).

bool Gdk::Window::show_window_menu | ( | GdkEvent * | event | ) |

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.

Since gtkmm 3.14:

Parameters

  event | A Gdk::Event to show the menu for.

Returns
  `true` if the window menu was shown and `false` otherwise.

void Gdk::Window::stick | ( |  | ) |

“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 Gtk::Window, 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.

void Gdk::Window::thaw_updates | ( |  | ) |

Thaws a window frozen with freeze_updates().

void Gdk::Window::unfullscreen | ( |  | ) |

Moves the window out of fullscreen mode.

If the window was not fullscreen, does nothing.

On X11, asks the window manager to move window 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.

Since gtkmm 2.2:

void Gdk::Window::unmaximize | ( |  | ) |

Unmaximizes the window.

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

On X11, asks the window manager to unmaximize window, 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.

void Gdk::Window::unset_icon | ( |  | ) |

void Gdk::Window::unstick | ( |  | ) |

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

void Gdk::Window::withdraw | ( |  | ) |

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.

## Friends And Related Function Documentation

Glib::RefPtr< Gdk::Window > wrap | ( | GdkWindow * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.