gtkmm: Gdk::Window Class Reference

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

Inheritance diagram for Gdk::Window:
Collaboration diagram for Gdk::Window:

Public Member Functions

 Window (Window&& src) noexcept
 
Windowoperator= (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< Visualget_visual ()
 Gets the Gdk::Visual describing the pixel format of window. More...

 
Glib::RefPtr< const Visualget_visual () const
 Gets the Gdk::Visual describing the pixel format of window. More...

 
Glib::RefPtr< Screenget_screen ()
 Gets the Gdk::Screen associated with a Gdk::Window. More...

 
Glib::RefPtr< const Screenget_screen () const
 Gets the Gdk::Screen associated with a Gdk::Window. More...

 
Glib::RefPtr< Displayget_display ()
 Gets the Gdk::Display associated with a Gdk::Window. More...

 
Glib::RefPtr< const Displayget_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 clear ()
 Clears an entire window to the background color or background pixmap. More...

 
void clear_area (int x, int y, int width, int height)
 Clears an area of window to the background color or background pixmap. More...

 
void clear_area_e (int x, int y, int width, int height)
 Like clear_area(), but also generates an expose event for the cleared area. 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 set_override_redirect (bool override_redirect=true)
 An override redirect window is not under the control of the window manager. 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 its window, both pixels and children, by the given amount. More...

 
void move_region (const 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_mask (const Glib::RefPtr< Bitmap >& mask, int x, int y)
 Applies a shape mask to window. More...

 
void unset_shape_combine_mask ()
 
void shape_combine_region (const Region& shape_region, int offset_x, int offset_y)
 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...

 
bool get_composited () const
 Determines whether window is composited. More...

 
void set_composited (bool composited=TRUE)
 Sets a Gdk::Window as composited, or unsets it. More...

 
void merge_child_shapes ()
 Merges the shape masks for any child windows into the shape mask for window. More...

 
void input_shape_combine_mask (const Glib::RefPtr< Bitmap >& mask, int x, int y)
 Like shape_combine_mask(), but the shape applies only to event handling. More...

 
void input_shape_combine_region (const 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...

 
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 set_static_gravities (bool use_static=true)
 Set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity. 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 begin_paint_rect (Rectangle& rectangle)
 A convenience wrapper around begin_paint_region() which creates a rectangular region for you. More...

 
void begin_paint_region (const Region& region)
 Indicates that you are beginning the process of redrawing region. More...

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

 
void flush ()
 Flush all outstanding cached operations on a window, leaving the window in a state which reflects all that has been drawn before. 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_background (const Color& color)
 Sets the background color of window. More...

 
void set_back_pixmap (const Glib::RefPtr< Pixmap >& pixmap, bool parent_relative=true)
 Sets the background pixmap of window. More...

 
void unset_back_pixmap ()
 Unsets the background pixmap of window so that the window will have no background. More...

 
::Cairo::RefPtr< ::Cairo::Patternget_background_pattern ()
 Gets the pattern used to clear the background on window. More...

 
::Cairo::RefPtr< const ::Cairo::Patternget_background_pattern () const
 Gets the pattern used to clear the background on window. More...

 
void set_cursor (const Cursor& cursor)
 Sets the mouse pointer for a Gdk::Window. More...

 
void set_cursor ()
 Use the parent window's cursor. 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, int& depth) 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, where the parent window is the normal parent as returned by get_parent() for normal windows, and the window's embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows. 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, where the parent window is the normal parent as returned by get_parent() for normal windows, and the window's embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows. 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)
 Obtains the bounding box of the window, including window manager titlebar/borders if any. More...

 
Glib::RefPtr< Windowget_pointer (int& x, int& y, ModifierType& mask)
 Obtains the current pointer position and modifier state. More...

 
Glib::RefPtr< Windowget_parent ()
 Obtains the parent of window, as known to GDK. More...

 
Glib::RefPtr< const Windowget_parent () const
 Obtains the parent of window, as known to GDK. More...

 
Glib::RefPtr< Windowget_toplevel ()
 Gets the toplevel window that's an ancestor of window. More...

 
Glib::RefPtr< const Windowget_toplevel () const
 Gets the toplevel window that's an ancestor of window. More...

 
Glib::RefPtr< Windowget_effective_parent ()
 Obtains the parent of window, as known to GDK. More...

 
Glib::RefPtr< const Windowget_effective_parent () const
 Obtains the parent of window, as known to GDK. More...

 
Glib::RefPtr< Windowget_effective_toplevel ()
 Gets the toplevel window that's an ancestor of window. More...

 
Glib::ListHandle< Glib::RefPtr< Window > > get_children ()
 Gets the list of children of window known to GDK. More...

 
Glib::ListHandle< 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. More...

 
void set_events (EventMask event_mask)
 The event mask for a window determines which events will be reported for that window. More...

 
void set_icon_list (const Glib::ListHandle< Glib::RefPtr< Gdk::Pixbuf > >& pixbufs)
 Sets a list of icons for the window. More...

 
void set_icon (const Glib::RefPtr< Window >& icon_window, const Glib::RefPtr< Pixmap >& pixmap, const Glib::RefPtr< Bitmap >& mask)
 Sets the icon of window as a pixmap or window. More...

 
void set_icon (const Glib::RefPtr< Window >& icon_window, const Glib::RefPtr< Pixmap >& pixmap)
 
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< Windowget_group ()
 Returns the group leader window for window. More...

 
Glib::RefPtr< const Windowget_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 #gdk_window_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::Surfacecreate_similar_surface (::Cairo::Content content, int width, int height)
 Create a new surface that is as compatible as possible with 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 ()
 
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 begin_move_drag (int button, int root_x, int root_y, guint32 timestamp)
 Begins a window move operation (for a toplevel window). More...

 
Glib::RefPtr< DragContextdrag_begin (const Glib::StringArrayHandle& 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 Region& region, bool invalidate_children=true)
 Adds region to the update area for window. More...

 
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 Gdk::Window::freeze_updates(). More...

 
void process_updates (bool update_children)
 Sends one or more expose events to window. More...

 
void get_internal_paint_info (Glib::RefPtr< Drawable >& real_drawable, int& x_offset, int& y_offset) const
 
void enable_synchronized_configure ()
 Indicates that the application will cooperate with the window system in synchronizing the window repaint with the window manager during resizing operations. More...

 
void configure_finished ()
 Signal to the window system that the application has finished handling Configure events it has received. 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 unfullscreen ()
 Moves the window out of fullscreen mode. More...

 
GrabStatus pointer_grab (bool owner_events, EventMask event_mask, const Glib::RefPtr< const Window >& confine_to, const Cursor& cursor, guint32 time_)
 
GrabStatus pointer_grab (bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp)
 Grabs the pointer to a specific window. More...

 
GrabStatus pointer_grab (bool owner_events, EventMask event_mask, guint32 timestamp)
 Grabs the pointer to a specific window. More...

 
GrabStatus keyboard_grab (bool owner_events, guint32 timestamp)
 
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)
 Request the windowing system to make window 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...

 
Glib::RefPtr< Pixmapget_offscreen_pixmap ()
 Gets the offscreen pixmap that an offscreen window renders into. More...

 
Glib::RefPtr< const Pixmapget_offscreen_pixmap () const
 Gets the offscreen pixmap that an offscreen window renders into. More...

 
Glib::RefPtr< Windowget_offscreen_embedder ()
 Gets the window that window is embedded in. More...

 
Glib::RefPtr< const Windowget_offscreen_embedder () const
 Gets the window that window is embedded in. More...

 
void set_offscreen_embedder (const Glib::RefPtr< Window >& embedder)
 Sets window to be embedded in embedder. More...

 
void redirect_to_drawable (const Glib::RefPtr< Drawable >& drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
 Redirects drawing into window so that drawing to the window in the rectangle specified by src_x, src_y, width and height is also drawn into drawable at dest_x, dest_y. More...

 
void remove_redirection ()
 Removes any active redirection started by redirect_to_drawable(). More...

 
void geometry_changed ()
 This function informs GDK that the geometry of an embedded offscreen window has changed. More...

 
- Public Member Functions inherited from Gdk::Drawable
 Drawable (Drawable&& src) noexcept
 
Drawableoperator= (Drawable&& src) noexcept
 
 ~Drawable () noexceptoverride
 
GdkDrawable* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdkDrawable* gobj () const
 Provides access to the underlying C GObject. More...

 
GdkDrawable* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
void get_size (int& width, int& height)
 Fills * width and * height with the size of drawable. More...

 
void get_size (int& width, int& height) const
 Fills * width and * height with the size of drawable. More...

 
int get_depth () const
 Obtains the bit depth of the drawable, that is, the number of bits that make up a pixel in the drawable's visual. More...

 
void set_colormap (const Glib::RefPtr< Colormap >& colormap)
 Sets the colormap associated with drawable. More...

 
Glib::RefPtr< Colormapget_colormap ()
 Gets the colormap for drawable, if one is set; returns nullptr otherwise. More...

 
Glib::RefPtr< Visualget_visual ()
 Gets the Gdk::Visual describing the pixel format of drawable. More...

 
void draw_point (const Glib::RefPtr< const GC >& gc, int x, int y)
 Draws a point, using the foreground color and other attributes of the Gdk::GC. More...

 
void draw_points (const Glib::RefPtr< const GC >& gc, const Glib::ArrayHandle< Point >& points)
 
void draw_line (const Glib::RefPtr< const GC >& gc, int x1, int y1, int x2, int y2)
 Draws a line, using the foreground color and other attributes of the Gdk::GC. More...

 
void draw_lines (const Glib::RefPtr< const GC >& gc, const Glib::ArrayHandle< Point >& points)
 
void draw_rectangle (const Glib::RefPtr< const GC >& gc, bool filled, int x, int y, int width, int height)
 Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the Gdk::GC. More...

 
void draw_arc (const Glib::RefPtr< const GC >& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2)
 Draws an arc or a filled 'pie slice'. More...

 
void draw_polygon (const Glib::RefPtr< const GC >& gc, bool filled, const Glib::ArrayHandle< Point >& points)
 
void draw_drawable (const Glib::RefPtr< const GC >& gc, const Glib::RefPtr< const Drawable >& src, int xsrc, int ysrc, int xdest, int ydest, int width=-1, int height=-1)
 Copies the width x height region of src at coordinates ( xsrc, ysrc) to coordinates ( xdest, ydest) in drawable. More...

 
void draw_image (const Glib::RefPtr< const GC >& gc, const Glib::RefPtr< const Image >& image, int xsrc, int ysrc, int xdest, int ydest, int width=-1, int height=-1)
 Draws a Gdk::Image onto a drawable. More...

 
void draw_segments (const Glib::RefPtr< const GC >& gc, GdkSegment* segs, int nsegs)
 Draws a number of unconnected lines. More...

 
void draw_glyphs (const Glib::RefPtr< const GC >& gc, const Glib::RefPtr< const Pango::Font >& font, int x, int y, const Pango::GlyphString& glyphs)
 This is a low-level function; 99% of text rendering should be done using gdk_draw_layout() instead. More...

 
void draw_layout_line (const Glib::RefPtr< const GC >& gc, int x, int y, const Glib::RefPtr< const Pango::LayoutLine >& line)
 Render a Pango::LayoutLine onto an GDK drawable. More...

 
void draw_layout_line (const Glib::RefPtr< const GC >& gc, int x, int y, const Glib::RefPtr< const Pango::LayoutLine >& line, const Color& foreground, const Color& background)
 Render a Pango::LayoutLine onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background. More...

 
void draw_layout (const Glib::RefPtr< const GC >& gc, int x, int y, const Glib::RefPtr< const Pango::Layout >& layout)
 Render a Pango::Layout onto a GDK drawable. More...

 
void draw_layout (const Glib::RefPtr< const GC >& gc, int x, int y, const Glib::RefPtr< const Pango::Layout >& layout, const Color& foreground, const Color& background)
 Render a Pango::Layout onto a Gdk::Drawable, overriding the layout's normal colors with foreground and/or background. More...

 
void draw_pixbuf (const Glib::RefPtr< const GC >& gc, const Glib::RefPtr< Pixbuf >& pixbuf, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither)
 Renders a rectangular portion of a pixbuf to a drawable. More...

 
void draw_pixbuf (const Glib::RefPtr< Pixbuf >& pixbuf, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither)
 Renders a rectangular portion of a pixbuf to a drawable. More...

 
Glib::RefPtr< Imageget_image (int x, int y, int width, int height) const
 A Gdk::Image stores client-side image data (pixels). More...

 
void copy_to_image (const Glib::RefPtr< Image >& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) const
 
Region get_clip_region () const
 Computes the region of a drawable that potentially can be written to by drawing primitives. More...

 
Region get_visible_region () const
 Computes the region of a drawable that is potentially visible. More...

 
void draw_rgb_image (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride)
 
void draw_rgb_image_dithalign (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, int xdith, int ydith)
 
void draw_rgb_32_image (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride)
 
void draw_rgb_32_image_dithalign (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* buf, int rowstride, int xdith, int ydith)
 Like gdk_draw_rgb_32_image(), but allows you to specify the dither offsets. More...

 
void draw_gray_image (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride)
 
void draw_indexed_image (const Glib::RefPtr< const GC >& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, const RgbCmap& cmap)
 
Glib::RefPtr< Screenget_screen ()
 Gets the Gdk::Screen associated with a Gdk::Drawable. More...

 
Glib::RefPtr< const Screenget_screen () const
 Gets the Gdk::Screen associated with a Gdk::Drawable. More...

 
Glib::RefPtr< Displayget_display ()
 Gets the Gdk::Display associated with a Gdk::Drawable. More...

 
Glib::RefPtr< const Displayget_display () const
 Gets the Gdk::Display associated with a Gdk::Drawable. More...

 
Cairo::RefPtr< Cairo::Contextcreate_cairo_context ()
 Creates a Cairo context for drawing to drawable. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (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::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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 ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (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< Windowcreate (const Glib::RefPtr< Window >& parent, GdkWindowAttr* attributes, int attributes_mask)
 
static void set_sm_client_id (const Glib::ustring& sm_client_id)
 Sets the <literal>SM_CLIENT_ID</literal> property on the application's leader window so that the window manager can save the application's state using the X11R6 ICCCM session management protocol. More...

 
static void unset_sm_client_id ()
 
static Glib::ListHandle< Glib::RefPtr< Window > > get_toplevels ()
 Obtains a list of all toplevel windows known to GDK on the default screen (see gdk_window_get_toplevels_for_screen()). More...

 
static void process_all_updates ()
 Calls process_updates() for all windows (see Gdk::Window) in the application. More...

 
static void set_debug_updates (bool setting=true)
 With update debugging enabled, calls to invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during process_updates(). 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 void pointer_ungrab (guint32 timestamp)
 Ungrabs the pointer on the default display, if it is grabbed by this application. More...

 
static void keyboard_ungrab (guint32 timestamp)
 Ungrabs the keyboard on the default display, if it is grabbed by this application. More...

 
static Glib::RefPtr< Windowget_default_root_window ()
 Obtains the root window (parent all other windows are inside) for the default display and screen. More...

 
- Static Public Member Functions inherited from Gdk::Drawable
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Drawablecreate ()
 

Protected Member Functions

 Window (const Glib::RefPtr< Window >& parent, GdkWindowAttr* attributes, int attributes_mask)
 
- Protected Member Functions inherited from Gdk::Drawable
 Drawable ()
 
- 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
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Windowwrap (GdkWindowObject* 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
 

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
Gdk::Window::Window ( const Glib::RefPtr< Window >&  parent,
GdkWindowAttr *  attributes,
int  attributes_mask 
)
protected

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.

See Gdk::Display::add_client_message_filter() if you are interested in X ClientMessage events.

Parameters
functionFilter callback.
dataData 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:
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).

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.

Parameters
buttonThe button being used to drag.
root_xRoot window X coordinate of mouse click that began the drag.
root_yRoot window Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag.
void Gdk::Window::begin_paint_rect ( Rectangle rectangle)

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

See begin_paint_region() for details.

Parameters
rectangleRectangle you intend to draw to.
void Gdk::Window::begin_paint_region ( const Region region)

Indicates that you are beginning the process of redrawing region.

A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background pixmap for window. Then, all drawing operations performed on window will be diverted to the backing store. When you call end_paint(), the backing store will be copied to window, making it visible onscreen. 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_paint(). If you draw to window directly without calling begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.

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

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

Parameters
regionRegion you intend to draw to.
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).

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.

Parameters
edgeThe edge or corner from which the drag is started.
buttonThe button being used to drag.
root_xRoot window X coordinate of mouse click that began the drag.
root_yRoot window Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag (use Gdk::Event::get_time()).
void Gdk::Window::clear ( )

Clears an entire window to the background color or background pixmap.

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

Clears an area of window to the background color or background pixmap.

Parameters
xX coordinate of rectangle to clear.
yY coordinate of rectangle to clear.
widthWidth of rectangle to clear.
heightHeight of rectangle to clear.
void Gdk::Window::clear_area_e ( int  x,
int  y,
int  width,
int  height 
)

Like clear_area(), but also generates an expose event for the cleared area.

This function has a stupid name because it dates back to the mists time, pre-GDK-1.0.

Parameters
xX coordinate of rectangle to clear.
yY coordinate of rectangle to clear.
widthWidth of rectangle to clear.
heightHeight of rectangle to clear.
void Gdk::Window::configure_finished ( )

Signal to the window system that the application has finished handling Configure events it has received.

Window Managers can use this to better synchronize the frame repaint with the application. GTK+ applications will automatically call this function when appropriate.

This function can only be called if enable_synchronized_configure() was called previously.

Since gtkmm 2.6:
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
geometryA Gdk::Geometry structure.
flagsA mask indicating what portions of geometry are set.
widthDesired width of window.
heightDesired height of the window.
new_widthLocation to store resulting width.
new_heightLocation 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, where the parent window is the normal parent as returned by get_parent() for normal windows, and the window's embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows.

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

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

See also: coords_to_parent()

Since gtkmm 2.22:
Parameters
parent_xX coordinate in parent's coordinate system.
parent_yY coordinate in parent's coordinate system.
xReturn location for X coordinate in child's coordinate system.
yReturn 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, where the parent window is the normal parent as returned by get_parent() for normal windows, and the window's embedder as returned by gdk_offscreen_window_get_embedder() for offscreen windows.

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

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

See also: coords_from_parent()

Since gtkmm 2.22:
Parameters
xX coordinate in child's coordinate system.
yY coordinate in child's coordinate system.
parent_xReturn location for X coordinate in parent's coordinate system, or nullptr.
parent_yReturn location for Y coordinate in parent's coordinate system, or nullptr.
static Glib::RefPtr<Window> Gdk::Window::create ( const Glib::RefPtr< Window >&  parent,
GdkWindowAttr *  attributes,
int  attributes_mask 
)
static
::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
contentThe content for the new surface.
widthWidth of the new surface.
heightHeight 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.

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 Glib::StringArrayHandle targets)

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

This method is called by the drag source.

Parameters
windowThe source window for this drag.
targetsA list of the offered targets names.
Returns
A newly created Gdk::DragContext.
Since gtkmm 2.24:
void Gdk::Window::enable_synchronized_configure ( )

Indicates that the application will cooperate with the window system in synchronizing the window repaint with the window manager during resizing operations.

After an application calls this function, it must call configure_finished() every time it has finished all processing associated with a set of Configure events. Toplevel GTK+ windows automatically use this protocol.

On X, calling this function makes window participate in the _NET_WM_SYNC_REQUEST window manager protocol.

Since gtkmm 2.6:
void Gdk::Window::end_paint ( )

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

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

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.

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

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

Flush all outstanding cached operations on a window, leaving the window in a state which reflects all that has been drawn before.

Gdk uses multiple kinds of caching to get better performance and nicer drawing. For instance, during exposes all paints to a window using double buffered rendering are keep on a pixmap until the last window has been exposed. It also delays window moves/scrolls until as long as possible until next update to avoid tearing when moving windows.

Normally this should be completely invisible to applications, as we automatically flush the windows when required, but this might be needed if you for instance mix direct native drawing with gdk drawing. For Gtk widgets that don't use double buffering this will be called automatically before sending the expose event.

Since gtkmm 2.18:
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
timestampTimestamp 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 Gdk::Window::thaw_updates() is called. If Gdk::Window::freeze_updates() has been called more than once, Gdk::Window::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:
void Gdk::Window::geometry_changed ( )

This function informs GDK that the geometry of an embedded offscreen window has changed.

This is necessary for GDK to keep track of which offscreen window the pointer is in.

Since gtkmm 2.18:
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.
::Cairo::RefPtr< ::Cairo::Pattern> Gdk::Window::get_background_pattern ( )

Gets the pattern used to clear the background on window.

If window does not have its own background and reuses the parent's, nullptr is returned and you'll have to query it yourself.

Since gtkmm 2.22:
Returns
The pattern to use for the background or nullptr to use the parent's background.
::Cairo::RefPtr<const ::Cairo::Pattern> Gdk::Window::get_background_pattern ( ) const

Gets the pattern used to clear the background on window.

If window does not have its own background and reuses the parent's, nullptr is returned and you'll have to query it yourself.

Since gtkmm 2.22:
Returns
The pattern to use for the background or nullptr to use the parent's background.
Glib::ListHandle< 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.
Glib::ListHandle< 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.
bool Gdk::Window::get_composited ( ) const

Determines whether window is composited.

See set_composited().

Since gtkmm 2.22:
Returns
true if the window is composited.
bool Gdk::Window::get_decorations ( WMDecoration decorations) const

Returns the decorations set on the GdkWindow with #gdk_window_set_decorations.

Parameters
decorationsThe 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<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.
Glib::RefPtr<Window> Gdk::Window::get_effective_parent ( )

Obtains the parent of window, as known to GDK.

Works like get_parent() for normal windows, but returns the window's embedder for offscreen windows.

See also: gdk_offscreen_window_get_embedder()

Since gtkmm 2.22:
Returns
Effective parent of window.
Glib::RefPtr<const Window> Gdk::Window::get_effective_parent ( ) const

Obtains the parent of window, as known to GDK.

Works like get_parent() for normal windows, but returns the window's embedder for offscreen windows.

See also: gdk_offscreen_window_get_embedder()

Since gtkmm 2.22:
Returns
Effective parent of window.
Glib::RefPtr<Window> Gdk::Window::get_effective_toplevel ( )

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

Works like get_toplevel(), but treats an offscreen window's embedder as its parent, using get_effective_parent().

See also: gdk_offscreen_window_get_embedder()

Since gtkmm 2.22:
Returns
The effective toplevel window containing window.
EventMask Gdk::Window::get_events ( ) const

Gets the event mask for window.

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)

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
rectRectangle to fill with bounding box of the window frame.
void Gdk::Window::get_geometry ( int &  x,
int &  y,
int &  width,
int &  height,
int &  depth 
) 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() and Gdk::Drawable::get_size() instead, because it avoids the roundtrip to the X server and because Gdk::Drawable::get_size() supports the full 32-bit coordinate space, whereas get_geometry() is restricted to the 16-bit coordinates of X11. </note>

Parameters
xReturn location for X coordinate of window (relative to its parent).
yReturn location for Y coordinate of window (relative to its parent).
widthReturn location for width of window.
heightReturn location for height of window.
depthReturn location for bit depth 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.
void Gdk::Window::get_internal_paint_info ( Glib::RefPtr< Drawable >&  real_drawable,
int &  x_offset,
int &  y_offset 
) const
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.
Glib::RefPtr<Window> Gdk::Window::get_offscreen_embedder ( )

Gets the window that window is embedded in.

Since gtkmm 2.18:
Returns
The embedding Gdk::Window, or nullptr if window is not an embedded offscreen window.
Glib::RefPtr<const Window> Gdk::Window::get_offscreen_embedder ( ) const

Gets the window that window is embedded in.

Since gtkmm 2.18:
Returns
The embedding Gdk::Window, or nullptr if window is not an embedded offscreen window.
Glib::RefPtr<Pixmap> Gdk::Window::get_offscreen_pixmap ( )

Gets the offscreen pixmap that an offscreen window renders into.

If you need to keep this around over window resizes, you need to add a reference to it.

Since gtkmm 2.18:
Returns
The offscreen pixmap, or nullptr if not offscreen.
Glib::RefPtr<const Pixmap> Gdk::Window::get_offscreen_pixmap ( ) const

Gets the offscreen pixmap that an offscreen window renders into.

If you need to keep this around over window resizes, you need to add a reference to it.

Since gtkmm 2.18:
Returns
The offscreen pixmap, or nullptr if not offscreen.
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
xReturn location for X coordinate.
yReturn 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 new(), not the actual parent. This should never matter unless you're using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

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

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 new(), not the actual parent. This should never matter unless you're using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

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

Returns
Parent of window.
Glib::RefPtr<Window> Gdk::Window::get_pointer ( int &  x,
int &  y,
ModifierType mask 
)

Obtains the current pointer position and modifier state.

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

Parameters
xReturn location for X coordinate of pointer or nullptr to not return the X coordinate.
yReturn location for Y coordinate of pointer or nullptr to not return the Y coordinate.
maskReturn location for modifier mask or nullptr to not return the modifier mask.
Returns
The window containing the pointer (as with at_pointer()), or nullptr if the window containing the pointer isn't known to GDK.
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
xX coordinate of window.
yY 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 go pass in any position in the window, not just the origin.

Since gtkmm 2.18:
Parameters
xX coordinate in window.
yY coordinate in window.
root_xReturn location for X coordinate.
root_yReturn 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
xReturn location for X position of window frame.
yReturn location for Y position of window frame.
Glib::RefPtr<Screen> Gdk::Window::get_screen ( )

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

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.

Returns
The Gdk::Screen associated with 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.
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.

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

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.

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

Returns
The toplevel window containing window.
static Glib::ListHandle< Glib::RefPtr<Window> > Gdk::Window::get_toplevels ( )
static

Obtains a list of all toplevel windows known to GDK on the default screen (see gdk_window_get_toplevels_for_screen()).

A toplevel window is a child of the root window (see gdk_get_default_root_window()).

Returns
List of toplevel windows.
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.
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
dataReturn location for user data.
Glib::RefPtr<Visual> Gdk::Window::get_visual ( )

Gets the Gdk::Visual describing the pixel format of window.

Since gtkmm 2.24:
Returns
A Gdk::Visual.
Glib::RefPtr<const Visual> Gdk::Window::get_visual ( ) const

Gets the Gdk::Visual describing the pixel format of window.

Since gtkmm 2.24:
Returns
A Gdk::Visual.
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_mask ( const Glib::RefPtr< Bitmap >&  mask,
int  x,
int  y 
)

Like shape_combine_mask(), 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
maskShape mask, or nullptr.
xX position of shape mask with respect to window.
yY position of shape mask with respect to window.
void Gdk::Window::input_shape_combine_region ( const 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_regionRegion of window to be non-transparent.
offset_xX position of shape_region in window coordinates.
offset_yY 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_childrenWhether 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
rectRectangle to invalidate.
invalidate_childrenWhether to also invalidate child windows.
void Gdk::Window::invalidate_region ( const 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
regionA Gdk::Region.
invalidate_childrentrue 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.
GrabStatus Gdk::Window::keyboard_grab ( bool  owner_events,
guint32  timestamp 
)
static void Gdk::Window::keyboard_ungrab ( guint32  timestamp)
static

Ungrabs the keyboard on the default display, if it is grabbed by this application.

Parameters
timestampA timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no timestamp is available.
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_mask().

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

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
xX coordinate relative to window's parent.
yY coordinate relative to window's parent.
void Gdk::Window::move_region ( const 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
regionThe Gdk::Region to move.
dxAmount to move in the X direction.
dyAmount 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
xNew X position relative to window's parent.
yNew Y position relative to window's parent.
widthNew width.
heightNew height.
Window& Gdk::Window::operator= ( Window&&  src)
noexcept
GrabStatus Gdk::Window::pointer_grab ( bool  owner_events,
EventMask  event_mask,
const Glib::RefPtr< const Window >&  confine_to,
const Cursor cursor,
guint32  time_ 
)
GrabStatus Gdk::Window::pointer_grab ( bool  owner_events,
EventMask  event_mask,
const Cursor cursor,
guint32  timestamp 
)

Grabs the pointer to a specific window.

Requires a corresponding call to pointer_ungrab().

Arguments:

Parameters
owner_eventsSpecifies whether events will be reported as is, or relative to the window.
event_maskMasks only interesting events.
cursorChanges the cursor for the duration of the grab.
timestampSpecifies the time.
GrabStatus Gdk::Window::pointer_grab ( bool  owner_events,
EventMask  event_mask,
guint32  timestamp 
)

Grabs the pointer to a specific window.

Requires a corresponding call to pointer_ungrab().

Arguments:

Parameters
owner_eventsSpecifies whether events will be reported as is, or relative to the window.
event_maskMasks only interesting events.
timestampSpecifies the time.
static void Gdk::Window::pointer_ungrab ( guint32  timestamp)
static

Ungrabs the pointer on the default display, if it is grabbed by this application.

Parameters
timestampA timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no timestamp is available.
static void Gdk::Window::process_all_updates ( )
static

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

void Gdk::Window::process_updates ( bool  update_children)

Sends one or more expose events to window.

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

Parameters
update_childrenWhether to also process updates for child windows.
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::redirect_to_drawable ( const Glib::RefPtr< Drawable >&  drawable,
int  src_x,
int  src_y,
int  dest_x,
int  dest_y,
int  width,
int  height 
)

Redirects drawing into window so that drawing to the window in the rectangle specified by src_x, src_y, width and height is also drawn into drawable at dest_x, dest_y.

Only drawing between begin_paint_region() or begin_paint_rect() and end_paint() is redirected.

Redirection is active until remove_redirection() is called.

Since gtkmm 2.14:
Parameters
drawableA Gdk::Drawable.
src_xX position in window.
src_yY position in window.
dest_xX position in drawable.
dest_yY position in drawable.
widthWidth of redirection, or -1 to use the width of window.
heightHeight of redirection or -1 to use the height of window.
void Gdk::Window::register_dnd ( )
void Gdk::Window::remove_filter ( GdkFilterFunc  function,
gpointer  data 
)

Remove a filter previously added with add_filter().

Parameters
functionPreviously-added filter function.
dataUser data for previously-added filter function.
void Gdk::Window::remove_redirection ( )

Removes any active redirection started by redirect_to_drawable().

Since gtkmm 2.14:
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_parentNew parent to move window into.
xX location inside the new parent.
yY 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
widthNew width of the window.
heightNew height of the window.
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
siblingA Gdk::Window that is a sibling of window, or nullptr.
aboveA 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
aboveWhether to raise or lower the window.
Since gtkmm 2.18:
void Gdk::Window::scroll ( int  dx,
int  dy 
)

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

Portions of the window that the scroll operation brings in from offscreen areas are invalidated.

Parameters
dxAmount to scroll in the X direction.
dyAmount 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_focustrue if the window should receive input focus.
void Gdk::Window::set_back_pixmap ( const Glib::RefPtr< Pixmap >&  pixmap,
bool  parent_relative = true 
)

Sets the background pixmap of window.

A background pixmap will be tiled, positioning the first tile at the origin of window, or if parent_relative is true, the tiling will be done based on the origin of the parent window (useful to align tiles in a parent with tiles in a child).

The windowing system will normally fill a window with its background when the window is obscured then exposed, and when you call clear().

See also unset_back_pixmap().

Parameters
pixmapA Gdk::Pixmap.
parent_relativeWhether the tiling origin is at the origin of window's parent.
void Gdk::Window::set_background ( const Color color)

Sets the background color of window.

(However, when using GTK+, set the background of a widget with gtk_widget_modify_bg() - if you're an application - or gtk_style_set_background() - if you're implementing a custom widget.)

The color must be allocated; gdk_rgb_find_color() is the best way to allocate a color.

See also gdk_window_set_background_pixmap().

Parameters
colorAn allocated Gdk::Color.
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_composited ( bool  composited = TRUE)

Sets a Gdk::Window as composited, or unsets it.

Composited windows do not automatically have their contents drawn to the screen. Drawing is redirected to an offscreen buffer and an expose event is emitted on the parent of the composited window. It is the responsibility of the parent's expose handler to manually merge the off-screen content onto the screen in whatever way it sees fit. See <xref linkend="composited-window-example"> for an example.

It only makes sense for child windows to be composited; see set_opacity() if you need translucent toplevel windows.

An additional effect of this call is that the area of this window is no longer clipped from regions marked for invalidation on its parent. Draws done on the parent window are also no longer clipped by the child.

This call is only supported on some systems (currently, only X11 with new enough Xcomposite and Xdamage extensions). You must call Gdk::Display::supports_composite() to check if setting a window as composited is supported before attempting to do so.

Since gtkmm 2.12:
Parameters
compositedtrue to set the window as composited.
void Gdk::Window::set_cursor ( const 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
cursorA 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.

static void Gdk::Window::set_debug_updates ( bool  setting = true)
static

With update debugging enabled, calls to invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during process_updates().

The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.

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

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

Parameters
settingtrue to turn on update debugging.
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
decorationsDecoration hint mask.
void Gdk::Window::set_events ( EventMask  event_mask)

The event mask for a window determines which events will be reported for that 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.

Parameters
event_maskEvent 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_maptrue if the window should receive input focus when mapped.
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
functionsBitmask 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 or windows where override redirect has been turned on via set_override_redirect() since these windows are not resizable by the user.

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

Parameters
geometryGeometry hints.
geom_maskBitmask 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
leaderGroup leader window, or nullptr to restore the default group leader window.
void Gdk::Window::set_icon ( const Glib::RefPtr< Window >&  icon_window,
const Glib::RefPtr< Pixmap >&  pixmap,
const Glib::RefPtr< Bitmap >&  mask 
)

Sets the icon of window as a pixmap or window.

If using GTK+, investigate gtk_window_set_default_icon_list() first, and then gtk_window_set_icon_list() and gtk_window_set_icon(). If those don't meet your needs, look at set_icon_list(). Only if all those are too high-level do you want to fall back to set_icon().

Parameters
icon_windowA Gdk::Window to use for the icon.
pixmapA Gdk::Pixmap to use as the icon,.
maskA 1-bit pixmap (Gdk::Bitmap) to use as mask for pixmap.
void Gdk::Window::set_icon ( const Glib::RefPtr< Window >&  icon_window,
const Glib::RefPtr< Pixmap >&  pixmap 
)
void Gdk::Window::set_icon_list ( const Glib::ListHandle< 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.

Parameters
pixbufsA 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.

Parameters
nameName 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
settingWhether 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
settingWhether 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
modaltrue if the window is modal, false otherwise.
void Gdk::Window::set_offscreen_embedder ( const Glib::RefPtr< Window >&  embedder)

Sets window to be embedded in embedder.

To fully embed an offscreen window, in addition to calling this function, it is also necessary to handle the Gdk::Window::signal_pick_embedded_child() signal on the embedder and the Gdk::Window::signal_to_embedder() and Gdk::Window::signal_from_embedder() signals on window.

Since gtkmm 2.18:
Parameters
embedderThe Gdk::Window that window gets embedded in.
void Gdk::Window::set_opacity ( double  opacity)

Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque.

(Values of the opacity parameter are clamped to the [0,1] range.)

On X11, this works only on X screens with a compositing manager running.

For setting up per-pixel alpha, see Gdk::Screen::get_rgba_colormap(). For making non-toplevel windows translucent, see set_composited().

Since gtkmm 2.12:
Parameters
opacityOpacity.
void Gdk::Window::set_override_redirect ( bool  override_redirect = true)

An override redirect window is not under the control of the window manager.

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

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

Parameters
override_redirecttrue if window should be override redirect.
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
roleA string indicating its role.
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_pagertrue 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_taskbartrue to skip the taskbar.
static void Gdk::Window::set_sm_client_id ( const Glib::ustring sm_client_id)
static

Sets the <literal>SM_CLIENT_ID</literal> property on the application's leader window so that the window manager can save the application's state using the X11R6 ICCCM session management protocol.

See the X Session Management Library documentation for more information on session management and the Inter-Client Communication Conventions Manual (ICCCM) for information on the <literal>WM_CLIENT_LEADER</literal> property. (Both documents are part of the X Window System distribution.)

Parameters
sm_client_idThe client id assigned by the session manager when the connection was opened.
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_idA string with startup-notification identifier.
bool Gdk::Window::set_static_gravities ( bool  use_static = true)

Set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity.

This is used if you are implementing scary features that involve deep knowledge of the windowing system. Don't worry about it unless you have to.

Parameters
use_statictrue to turn on static gravity.
Returns
true if the server supports static gravity.
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
titleTitle 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
parentAnother 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
hintA 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
urgenttrue 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_dataUser data.
void Gdk::Window::shape_combine_mask ( const Glib::RefPtr< Bitmap >&  mask,
int  x,
int  y 
)

Applies a shape mask to window.

Pixels in window corresponding to set bits in the mask will be visible; pixels in window corresponding to unset bits in the mask will be transparent. This gives a non-rectangular window.

If mask is nullptr, the shape mask will be unset, and the x/ y parameters are not used.

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
maskShape mask.
xX position of shape mask with respect to window.
yY position of shape mask with respect to window.
void Gdk::Window::shape_combine_region ( const Region shape_region,
int  offset_x,
int  offset_y 
)

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

See also shape_combine_mask() to use a bitmap as the mask.

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_regionRegion of window to be non-transparent.
offset_xX position of shape_region in window coordinates.
offset_yY 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).

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 Gdk::Window::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_back_pixmap ( )

Unsets the background pixmap of window so that the window will have no background.

A window with no background will never have its background filled by the windowing system, instead the window will contain whatever pixels were already in the corresponding area of the display.

See also
set_back_pixmap().
Since gtkmm 2.14:
void Gdk::Window::unset_icon ( )
void Gdk::Window::unset_shape_combine_mask ( )
static void Gdk::Window::unset_sm_client_id ( )
static
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 ( GdkWindowObject *  object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse 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.

The documentation for this class was generated from the following file:
  • gdkmm/window.h