gtkmm: Gdk::Surface Class Reference

gtkmm 3.95.1

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

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

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

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

`#include <gdkmm/surface.h>`

Inheritance diagram for Gdk::Surface:
[legend]

## Public Types
enum | Type { Type::TOPLEVEL, Type::CHILD, Type::TEMP }
| Describes the kind of surface. More...
enum | State { State::WITHDRAWN = 1 << 0, State::ICONIFIED = 1 << 1, State::MAXIMIZED = 1 << 2, State::STICKY = 1 << 3, State::FULLSCREEN = 1 << 4, State::ABOVE = 1 << 5, State::BELOW = 1 << 6, State::FOCUSED = 1 << 7, State::TILED = 1 << 8, State::TOP_TILED = 1 << 9, State::TOP_RESIZABLE = 1 << 10, State::RIGHT_TILED = 1 << 11, State::RIGHT_RESIZABLE = 1 << 12, State::BOTTOM_TILED = 1 << 13, State::BOTTOM_RESIZABLE = 1 << 14, State::LEFT_TILED = 1 << 15, State::LEFT_RESIZABLE = 1 << 16 }
| Specifies the state of a toplevel surface. More...
enum | Hints { Hints::POS = 1 << 0, Hints::MIN_SIZE = 1 << 1, Hints::MAX_SIZE = 1 << 2, Hints::BASE_SIZE = 1 << 3, Hints::ASPECT = 1 << 4, Hints::RESIZE_INC = 1 << 5, Hints::WIN_GRAVITY = 1 << 6, Hints::USER_POS = 1 << 7, Hints::USER_SIZE = 1 << 8 }
| Used to indicate which fields of a Gdk::Geometry struct should be paid attention to. More...
enum | TypeHint { TypeHint::NORMAL, TypeHint::DIALOG, TypeHint::MENU, TypeHint::TOOLBAR, TypeHint::SPLASHSCREEN, TypeHint::UTILITY, TypeHint::DOCK, TypeHint::DESKTOP, TypeHint::DROPDOWN_MENU, TypeHint::POPUP_MENU, TypeHint::TOOLTIP, TypeHint::NOTIFICATION, TypeHint::COMBO, TypeHint::DND }
| These are hints for the window manager that indicate what type of function the window has. More...
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
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| Surface (Surface&& src) noexcept
Surface& | operator= (Surface&& src) noexcept
| ~Surface () noexcept override
GdkSurface* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkSurface* | gobj () const
| Provides access to the underlying C GObject. More...
GdkSurface* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Type | get_surface_type () const
| Gets the type of the surface. More...
Glib::RefPtr< Display > | get_display ()
| Gets the Gdk::Display associated with a Gdk::Surface. More...
Glib::RefPtr< const Display > | get_display () const
| Gets the Gdk::Display associated with a Gdk::Surface. More...
void | show ()
| Like show_unraised(), but also raises the surface to the top of the surface stack (moves the surface to the front of the Z-order). More...
void | hide ()
| For toplevel surfaces, withdraws them, so they will no longer be known to the window manager; for all surfaces, unmaps them, so they won’t be displayed. More...
void | show_unraised ()
| Shows a Gdk::Surface onscreen, but does not modify its stacking order. More...
void | move (int x, int y)
| Repositions a surface relative to its parent surface. More...
void | resize (int width, int height)
| Resizes surface; for toplevel surfaces, asks the window manager to resize the surface. 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 | move_to_rect (const Rectangle& rect, Gravity rect_anchor, Gravity surface_anchor, AnchorHints anchor_hints, int rect_anchor_dx, int rect_anchor_dy)
| Moves surface to rect, aligning their anchor points. More...
void | raise ()
| Raises surface to the top of the Z-order (stacking order), so that other surfaces with the same parent surface appear below surface. More...
void | lower ()
| Lowers surface to the bottom of the Z-order (stacking order), so that other surfaces with the same parent surface appear above surface. More...
void | restack (const Glib::RefPtr< Surface >& sibling, bool above)
| Changes the position of surface 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 surface in the Z-order (stacking order). More...
void | focus (guint32 timestamp)
| Sets keyboard focus to surface. More...
void | input_shape_combine_region (const ::Cairo::RefPtr< ::Cairo::Region >& shape_region, int offset_x, int offset_y)
| Like gdk_surface_shape_combine_region(), but the shape applies only to event handling. More...
void | set_child_input_shapes ()
| Sets the input shape mask of surface to the union of input shape masks for all children of surface, ignoring the input shape mask of surface itself. More...
void | merge_child_input_shapes ()
| Merges the input shape masks for any child surfaces into the input shape mask for surface. More...
void | set_pass_through (bool pass_through=true)
| Sets whether input to the surface is passed through to the surface below. More...
bool | get_pass_through () const
| Returns whether input to the surface is passed through to the surface below. More...
bool | is_visible () const
| Checks whether the surface has been mapped (with show() or show_unraised()). More...
bool | is_viewable () const
| Check if the surface and all ancestors of the surface are mapped. More...
bool | is_input_only () const
| Determines whether or not the surface is an input only surface. More...
State | get_state () const
| Gets the bitwise OR of the currently active surface state flags, from the Gdk::Surface::State enumeration. More...
bool | has_native () const
| Checks whether the surface has a native surface or not. More...
void | set_type_hint (TypeHint hint)
| The application can use this call to provide a hint to the surface manager about the functionality of a surface. More...
TypeHint | get_type_hint ()
| This function returns the type hint set for a surface. More...
bool | get_modal_hint () const
| Determines whether or not the window manager is hinted that surface 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 surface has modal behaviour. More...
void | set_geometry_hints (const Geometry& geometry, Hints geom_mask)
| Sets the geometry hints for surface. More...
void | set_title (const Glib::ustring& title)
| Sets the title of a toplevel surface, to be displayed in the titlebar. 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< Surface >& parent)
| Indicates to the window manager that surface is a transient dialog associated with the application surface parent. More...
void | set_cursor (const Glib::RefPtr< Cursor >& cursor)
| Sets the default mouse pointer for a Gdk::Surface. More...
void | set_cursor ()
| Use the parent surface's cursor. More...
void | set_device_cursor (const Glib::RefPtr< Device >& device, const Glib::RefPtr< Cursor >& cursor)
| Sets a specific Gdk::Cursor for a given device when it gets inside surface. More...
Glib::RefPtr< Cursor > | get_device_cursor (const Glib::RefPtr< Device >& device)
| Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Surface, or `nullptr`. More...
Glib::RefPtr< const Cursor > | get_device_cursor (const Glib::RefPtr< const Device >& device) const
| Retrieves a Gdk::Cursor pointer for the device currently set on the specified Gdk::Surface, or `nullptr`. More...
Glib::RefPtr< Cursor > | get_cursor ()
| Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Surface, or `nullptr`. More...
Glib::RefPtr< const Cursor > | get_cursor () const
| Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Surface, or `nullptr`. More...
void | get_geometry (int& x, int& y, int& width, int& height) const
| Any of the return location arguments to this function may be `nullptr`, if you aren’t interested in getting the value of that field. More...
int | get_width () const
| Returns the width of the given surface. More...
int | get_height () const
| Returns the height of the given surface. More...
void | get_position (int& x, int& y) const
| Obtains the position of the surface as reported in the most-recently-processed Gdk::EventConfigure. More...
int | get_origin (int& x, int& y) const
| Obtains the position of a surface in root window coordinates. More...
void | get_root_coords (int x, int y, int& root_x, int& root_y)
| Obtains the position of a surface position in root window coordinates. More...
void | coords_to_parent (double x, double y, double& parent_x, double& parent_y)
| Transforms surface coordinates from a child surface to its parent surface. More...
void | coords_from_parent (double parent_x, double parent_y, double& x, double& y)
| Transforms surface coordinates from a parent surface to a child surface. More...
void | get_root_origin (int& x, int& y) const
| Obtains the top-left corner of the window manager frame in root surface coordinates. More...
void | get_frame_extents (Rectangle& rect) const
| Obtains the bounding box of the surface, including window manager titlebar/borders if any. More...
int | get_scale_factor () const
| Returns the internal scale factor that maps from surface coordiantes to the actual device pixels. More...
Glib::RefPtr< Surface > | get_parent ()
| Obtains the parent of surface, as known to GDK. More...
Glib::RefPtr< const Surface > | get_parent () const
| Obtains the parent of surface, as known to GDK. More...
Glib::RefPtr< Surface > | get_toplevel ()
| Gets the toplevel surface that’s an ancestor of surface. More...
Glib::RefPtr< const Surface > | get_toplevel () const
| Gets the toplevel surface that’s an ancestor of surface. More...
Glib::RefPtr< Surface > | get_device_position (const Glib::RefPtr< const Device >& device, double& x, double& y, ModifierType& mask) const
| Obtains the current device position in doubles and modifier state. More...
std::vector< Glib::RefPtr< Surface > > | get_children ()
| Gets the list of children of surface known to GDK. More...
std::vector< Glib::RefPtr< const Surface > > | get_children () const
| Gets the list of children of surface known to GDK. More...
void | set_icon_list (const std::vector< Glib::RefPtr< Texture >>& textures)
| Sets a list of icons for the surface. More...
void | unset_icon ()
void | set_icon_name (const Glib::ustring& name)
| Surfaces may have a name used while minimized, distinct from the name they display in their titlebar. More...
void | set_decorations (WMDecoration decorations)
| “Decorations” are the features the window manager adds to a toplevel Gdk::Surface. More...
bool | get_decorations (WMDecoration& decorations) const
| Returns the decorations set on the GdkSurface with set_decorations(). More...
void | set_functions (WMFunction functions)
| Sets hints about the window management functions to make available via buttons on the window frame. More...
::Cairo::RefPtr< ::Cairo::Surface > | create_similar_surface (::Cairo::Content content, int width, int height)
| Create a new surface that is as compatible as possible with the given surface. More...
void | beep ()
| Emits a short beep associated to surface in the appropriate display, if supported. More...
void | iconify ()
| Asks to iconify (minimize) surface. More...
void | deiconify ()
| Attempt to deiconify (unminimize) surface. More...
void | stick ()
| “Pins” a surface 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 surface. More...
void | unmaximize ()
| Unmaximizes the surface. More...
void | register_dnd ()
| Registers a surface as a potential drop destination. More...
void | begin_resize_drag (SurfaceEdge edge, int button, int root_x, int root_y, guint32 timestamp)
| Begins a surface resize operation (for a toplevel surface). More...
void | resize_drag (SurfaceEdge edge, const Glib::RefPtr< Device >& device, int button, int root_x, int root_y, guint32 timestamp)
| Begins a surface resize operation (for a toplevel surface). More...
void | begin_move_drag (int button, int root_x, int root_y, guint32 timestamp)
| Begins a surface move operation (for a toplevel surface). More...
void | begin_move_drag (const Glib::RefPtr< Device >& device, int button, int root_x, int root_y, guint32 timestamp)
| Begins a surface move operation (for a toplevel surface). More...
Glib::RefPtr< Drag > | drag_begin_from_point (const Glib::RefPtr< Device >& device, const Glib::RefPtr< ContentProvider >& content, DragAction actions, int dx, int dy)
| Starts a drag and creates a new drag context for it. More...
void | queue_expose ()
| Forces an expose event for surface to be scheduled. More...
void | freeze_updates ()
| Temporarily freezes a surface such that it won’t receive expose events. More...
void | thaw_updates ()
| Thaws a surface frozen with freeze_updates(). More...
void | fullscreen ()
| Moves the surface into fullscreen mode. More...
void | fullscreen_on_monitor (const Glib::RefPtr< Monitor >& monitor)
| Moves the surface into fullscreen mode on the given monitor. More...
void | set_fullscreen_mode (FullscreenMode mode)
| Specifies whether the surface should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode. More...
FullscreenMode | get_fullscreen_mode () const
| Obtains the Gdk::FullscreenMode of the surface. More...
void | unfullscreen ()
| Moves the surface out of fullscreen mode. More...
void | set_keep_above (bool setting=true)
| Set if surface must be kept above other surfaces. More...
void | set_keep_below (bool setting=true)
| Set if surface must be kept below other surfaces. More...
void | set_opacity (double opacity)
| Set surface to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. More...
bool | get_accept_focus () const
| Determines whether or not the desktop environment shuld be hinted that the surface 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 surface 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 surface 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 surface doesn’t want to receive input focus when it is mapped. More...
void | set_support_multidevice (bool support_multidevice=true)
| This function will enable multidevice features in surface. More...
bool | get_support_multidevice ()
| Returns `true` if the surface is aware of the existence of multiple devices. More...
Glib::RefPtr< FrameClock > | get_frame_clock ()
| Gets the frame clock for the surface. More...
Glib::RefPtr< const FrameClock > | get_frame_clock () const
| Gets the frame clock for the surface. More...
void | set_opaque_region (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| For optimisation purposes, compositing window managers may like to not draw obscured regions of surfaces, or turn off blending during for these regions. More...
void | set_shadow_width (int left, int right, int top, int bottom)
| Newer GTK windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. More...
bool | show_window_menu (const Glib::RefPtr< const Event >& event)
| Asks the windowing system to show the window menu. More...
Glib::RefPtr< Gdk::GLContext > | create_gl_context ()
| Creates a new GLContext matching the framebuffer format to the visual of the Surface. More...
Glib::RefPtr< Gdk::CairoContext > | create_cairo_context ()
| Creates a new Gdk::CairoContext for rendering on surface. More...
Glib::SignalProxy< void(const Gdk::Rectangle&, const Gdk::Rectangle&, bool, bool)> | signal_moved_to_rect ()
Glib::SignalProxy< void(int, int)> | signal_size_changed ()
Glib::SignalProxy< bool(const ::Cairo::RefPtr< const ::Cairo::Region >&)> | signal_render ()
Glib::SignalProxy< bool(const Glib::RefPtr< const Event >&)> | signal_event ()
Glib::PropertyProxy< Glib::RefPtr< Cursor > > | property_cursor ()
| The mouse pointer for a Gdk::Surface. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Cursor > > | property_cursor () const
| The mouse pointer for a Gdk::Surface. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const
| The Gdk::Display connection of the surface. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FrameClock > > | property_frame_clock () const
| Frame Clock. More...
Glib::PropertyProxy_ReadOnly< State > | property_state () const
| State. More...
Glib::PropertyProxy_ReadOnly< bool > | property_mapped () const
| Mapped. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (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) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *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< Surface > | create_toplevel (const Glib::RefPtr< Display >& display, int width, int height)
| Creates a new toplevel surface. More...
static Glib::RefPtr< Surface > | create_popup (const Glib::RefPtr< Display >& display, const Rectangle& position)
| Creates a new toplevel popup surface. More...
static Glib::RefPtr< Surface > | create_child (const Glib::RefPtr< Surface >& parent, const Rectangle& position)
| Creates a new client-side child surface. More...
static void | constrain_size (const Geometry& geometry, Hints 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...

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

## Additional Inherited Members
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Detailed Description

A Gdk::Surface 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::Surfaces. For example, each Gtk::Button has a Gdk::Surface associated with it.

## Constructor & Destructor Documentation

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

Gdk::Surface::~Surface | ( |  | ) |
| overridenoexcept

## Member Function Documentation

void Gdk::Surface::beep | ( |  | ) |

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

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

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

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

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

Parameters

  button | The button being used to drag, or 0 for a keyboard-initiated drag.
  root_x | Surface X coordinate of mouse click that began the drag.
  root_y | Surface Y coordinate of mouse click that began the drag.
  timestamp | Timestamp of mouse click that began the drag.

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

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

Parameters

  device | The device used for the operation.
  button | The button being used to drag, or 0 for a keyboard-initiated drag.
  root_x | Surface X coordinate of mouse click that began the drag.
  root_y | Surface Y coordinate of mouse click that began the drag.
  timestamp | Timestamp of mouse click that began the drag.

void Gdk::Surface::begin_resize_drag | ( | SurfaceEdge | edge,
|  | int | button,
|  | int | root_x,
|  | int | root_y,
|  | guint32 | timestamp
| ) |  |

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

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

Parameters

  edge | The edge or corner from which the drag is started.
  button | The button being used to drag, or 0 for a keyboard-initiated drag.
  root_x | Surface X coordinate of mouse click that began the drag.
  root_y | Surface Y coordinate of mouse click that began the drag.
  timestamp | Timestamp of mouse click that began the drag (use Gdk::Event::get_time()).

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

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

Parameters

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

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

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

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

See also: coords_to_parent()

Parameters

  parent_x | X coordinate in parent’s coordinate system.
  parent_y | Y coordinate in parent’s coordinate system.
  x | Return location for X coordinate in child’s coordinate system.
  y | Return location for Y coordinate in child’s coordinate system.

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

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

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

See also: coords_from_parent()

Parameters

  x | X coordinate in child’s coordinate system.
  y | Y coordinate in child’s coordinate system.
  parent_x | Return location for X coordinate in parent’s coordinate system, or `nullptr`.
  parent_y | Return location for Y coordinate in parent’s coordinate system, or `nullptr`.

Glib::RefPtr<Gdk::CairoContext> Gdk::Surface::create_cairo_context | ( |  | ) |

Creates a new Gdk::CairoContext for rendering on surface.

Returns
  The newly created Gdk::CairoContext.

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

Creates a new client-side child surface.

Parameters

  parent | The parent surface.
  position | Placement of the surface inside parent.

Returns
  The new Gdk::Surface.

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

Creates a new GLContext matching the framebuffer format to the visual of the Surface.

The context is disconnected from any particular surface.

If the creation of the GLContext failed an error will be thrown.

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

Since gtkmm 3.18:

Returns
  GLContext The newly created context.

Exceptions

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

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

Creates a new toplevel popup surface.

The surface will bypass surface management.

Parameters

  display | The display to create the surface on.
  position | Position of the surface on screen.

Returns
  The new Gdk::Surface.

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

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

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

Parameters

  content | The content for the new surface.
  width | Width of the new surface.
  height | Height of the new surface.

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

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

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

Creates a new toplevel surface.

The surface will be managed by the surface manager.

Parameters

  display | The display to create the surface on.
  width | Width of new surface.
  height | Height of new surface.

Returns
  The new Gdk::Surface.

void Gdk::Surface::deiconify | ( |  | ) |

Attempt to deiconify (unminimize) surface.

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

Glib::RefPtr<Drag> Gdk::Surface::drag_begin_from_point | ( | const Glib::RefPtr< Device >& | device,
|  | const Glib::RefPtr< ContentProvider >& | content,
|  | DragAction | actions,
|  | int | dx,
|  | int | dy
| ) |  |

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

This function is called by the drag source.

Parameters

  device | The device that controls this drag.
  content | The offered content.
  actions | The actions supported by this drag.
  dx | The x offset to device's position where the drag nominally started.
  dy | The y offset to device's position where the drag nominally started.

Returns
  A newly created Gdk::Drag or `nullptr` on error.

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

Sets keyboard focus to surface.

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

Parameters

  timestamp | Timestamp of the event triggering the surface focus.

void Gdk::Surface::freeze_updates | ( |  | ) |

Temporarily freezes a surface such that it won’t receive expose events.

The surface will begin receiving expose events again when thaw_updates() is called. If freeze_updates() has been called more than once, thaw_updates() must be called an equal number of times to begin processing exposes.

void Gdk::Surface::fullscreen | ( |  | ) |

Moves the surface into fullscreen mode.

This means the surface covers the entire screen and is above any panels or task bars.

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

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

void Gdk::Surface::fullscreen_on_monitor | ( | const Glib::RefPtr< Monitor >& | monitor | ) |

Moves the surface into fullscreen mode on the given monitor.

This means the surface covers the entire screen and is above any panels or task bars.

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

Parameters

  monitor | Which monitor to display fullscreen on.

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

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

Returns
  Whether or not the surface should receive input focus.

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

Gets the list of children of surface 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 surfaces an application created itself.

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

Returns
  List of child surfaces inside surface.

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

Gets the list of children of surface 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 surfaces an application created itself.

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

Returns
  List of child surfaces inside surface.

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

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

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

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

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

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

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

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

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

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

Parameters

  decorations | The surface decorations will be written here.

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

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

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

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

Parameters

  device | A master, pointer Gdk::Device.

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

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

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

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

Parameters

  device | A master, pointer Gdk::Device.

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

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

Obtains the current device position in doubles and modifier state.

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

Parameters

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

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

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

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

Returns
  The Gdk::Display associated with surface.

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

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

Returns
  The Gdk::Display associated with surface.

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

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

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

Glib::RefPtr<FrameClock> Gdk::Surface::get_frame_clock | ( |  | ) |

Gets the frame clock for the surface.

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

Since gtkmm 3.24:

Returns
  The frame clock.

Glib::RefPtr<const FrameClock> Gdk::Surface::get_frame_clock | ( |  | ) | const

Gets the frame clock for the surface.

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

Since gtkmm 3.24:

Returns
  The frame clock.

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

Obtains the bounding box of the surface, including window manager titlebar/borders if any.

The frame position is given in root window coordinates. To get the position of the surface itself (rather than the frame) in root window coordinates, use get_origin().

Parameters

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

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

Obtains the Gdk::FullscreenMode of the surface.

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

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

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

The X and Y coordinates returned are relative to the parent surface of surface, which for toplevels usually means relative to the surface 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 surface; this may be out-of-sync with the position of surface delivered in the most-recently-processed Gdk::EventConfigure. get_position() in contrast gets the position from the most recent configure event.

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

Parameters

  x | Return location for X coordinate of surface (relative to its parent).
  y | Return location for Y coordinate of surface (relative to its parent).
  width | Return location for width of surface.
  height | Return location for height of surface.

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

Returns the height of the given surface.

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

Returns
  The height of surface.

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

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

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

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

Obtains the position of a surface in root window coordinates.

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

Parameters

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

Returns
  Not meaningful, ignore.

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

Obtains the parent of surface, as known to GDK.

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

Returns
  Parent of surface.

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

Obtains the parent of surface, as known to GDK.

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

Returns
  Parent of surface.

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

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

See set_pass_through() for details

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

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

Contrast with get_geometry() which queries the X server for the current surface position, regardless of which events have been received or processed.

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

Parameters

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

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

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

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

Parameters

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

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

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

Parameters

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

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

Returns the internal scale factor that maps from surface coordiantes to the actual device pixels.

On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).

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

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

Returns
  The scale factor.

State Gdk::Surface::get_state | ( |  | ) | const

Gets the bitwise OR of the currently active surface state flags, from the Gdk::Surface::State enumeration.

Returns
  Surface state bitfield.

bool Gdk::Surface::get_support_multidevice | ( |  | ) |

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

Returns
  `true` if the surface handles multidevice features.

Type Gdk::Surface::get_surface_type | ( |  | ) | const

Gets the type of the surface.

See Gdk::Surface::Type.

Returns
  Type of surface.

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

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

Any surface type but Gdk::Surface::Type::CHILD is considered a toplevel surface, as is a Gdk::Surface::Type::CHILD surface that has a root surface as parent.

Returns
  The toplevel surface containing surface.

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

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

Any surface type but Gdk::Surface::Type::CHILD is considered a toplevel surface, as is a Gdk::Surface::Type::CHILD surface that has a root surface as parent.

Returns
  The toplevel surface containing surface.

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

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

TypeHint Gdk::Surface::get_type_hint | ( |  | ) |

This function returns the type hint set for a surface.

Returns
  The type hint set for surface.

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

Returns the width of the given surface.

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

Returns
  The width of surface.

GdkSurface* Gdk::Surface::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GdkSurface* Gdk::Surface::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GdkSurface* Gdk::Surface::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::Surface::has_native | ( |  | ) | const

Checks whether the surface has a native surface or not.

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

void Gdk::Surface::hide | ( |  | ) |

For toplevel surfaces, withdraws them, so they will no longer be known to the window manager; for all surfaces, unmaps them, so they won’t be displayed.

Normally done automatically as part of gtk_widget_hide().

void Gdk::Surface::iconify | ( |  | ) |

Asks to iconify (minimize) surface.

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 surface is a toplevel surface.

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

Like gdk_surface_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 surface below surface.

An input shape is typically used with RGBA surfaces. The alpha channel of the surface defines which pixels are invisible and allows for nicely antialiased borders, and the input shape controls where the surface 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.

Parameters

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

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

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

Returns
  `true` if surface is input only.

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

Check if the surface and all ancestors of the surface are mapped.

(This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK surface parents, not to the root surface.)

Returns
  `true` if the surface is viewable.

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

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

Returns
  `true` if the surface is mapped.

void Gdk::Surface::lower | ( |  | ) |

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

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

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

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

void Gdk::Surface::maximize | ( |  | ) |

Maximizes the surface.

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

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

void Gdk::Surface::merge_child_input_shapes | ( |  | ) |

Merges the input shape masks for any child surfaces into the input shape mask for surface.

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

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

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

Repositions a surface relative to its parent surface.

For toplevel surfaces, 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 surfaces, the move will reliably succeed.

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

Parameters

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

void Gdk::Surface::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 surface first move, then resize, if you don’t use move_resize().)

Parameters

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

void Gdk::Surface::move_to_rect | ( | const Rectangle& | rect,
|  | Gravity | rect_anchor,
|  | Gravity | surface_anchor,
|  | AnchorHints | anchor_hints,
|  | int | rect_anchor_dx,
|  | int | rect_anchor_dy
| ) |  |

Moves surface to rect, aligning their anchor points.

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

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

Connect to the Gdk::Surface::signal_moved_to_rect() signal to find out how it was actually positioned.

Parameters

  rect | The destination Gdk::Rectangle to align surface with.
  rect_anchor | The point on rect to align with surface's anchor point.
  surface_anchor | The point on surface to align with rect's anchor point.
  anchor_hints | Positioning hints to use when limited on space.
  rect_anchor_dx | Horizontal offset to shift surface, i.e. rect's anchor point.
  rect_anchor_dy | Vertical offset to shift surface, i.e. rect's anchor point.

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

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

The mouse pointer for a Gdk::Surface.

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

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

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

The mouse pointer for a Gdk::Surface.

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

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

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

The Gdk::Display connection of the surface.

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

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

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FrameClock> > Gdk::Surface::property_frame_clock | ( |  | ) | const

Frame Clock.

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

Glib::PropertyProxy_ReadOnly< bool > Gdk::Surface::property_mapped | ( |  | ) | const

Mapped.

Default value: `false`

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

Glib::PropertyProxy_ReadOnly< State > Gdk::Surface::property_state | ( |  | ) | const

State.

Default value: Gdk::Surface::State::WITHDRAWN

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

void Gdk::Surface::queue_expose | ( |  | ) |

Forces an expose event for surface to be scheduled.

If the invalid area of surface is empty, an expose event will still be emitted. Its invalid region will be empty.

This function is useful for implementations that track invalid regions on their own.

void Gdk::Surface::raise | ( |  | ) |

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

This is true whether or not the surfaces are visible.

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

void Gdk::Surface::register_dnd | ( |  | ) |

Registers a surface as a potential drop destination.

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

Resizes surface; for toplevel surfaces, asks the window manager to resize the surface.

The window manager may not allow the resize. When using GTK, use gtk_window_resize() instead of this low-level GDK function.

Surfaces may not be resized below 1x1.

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

Parameters

  width | New width of the surface.
  height | New height of the surface.

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

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

You might use this function to implement a “window resize grip,”

Parameters

  edge | The edge or corner from which the drag is started.
  device | The device used for the operation.
  button | The button being used to drag, or 0 for a keyboard-initiated drag.
  root_x | Surface X coordinate of mouse click that began the drag.
  root_y | Surface Y coordinate of mouse click that began the drag.
  timestamp | Timestamp of mouse click that began the drag (use Gdk::Event::get_time()).

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

Changes the position of surface 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 surface.

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

Parameters

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

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

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

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

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

Parameters

  above | Whether to raise or lower the surface.

Since gtkmm 2.18:

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

Setting accept_focus to `false` hints the desktop environment that the surface 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.

Parameters

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

void Gdk::Surface::set_child_input_shapes | ( |  | ) |

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

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

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

Sets the default mouse pointer for a Gdk::Surface.

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

Use Gdk::Cursor::new_from_name() or Gdk::Cursor::new_from_texture() to create the cursor. To make the cursor invisible, use Gdk::Cursor::Type::BLANK_CURSOR. Passing `nullptr` for the cursor argument to set_cursor() means that surface will use the cursor of its parent surface. Most surfaces should use this default.

Parameters

  cursor | A cursor.

void Gdk::Surface::set_cursor | ( |  | ) |

Use the parent surface's cursor.

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

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

“Decorations” are the features the window manager adds to a toplevel Gdk::Surface.

This function sets the traditional Motif window manager hints that tell the window manager which decorations you would like your surface 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::WMDecoration::ALL is included in the mask, the other bits indicate which decorations should be turned off. If Gdk::WMDecoration::ALL is not included, then the other bits indicate which decorations should be turned on.

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

Parameters

  decorations | Decoration hint mask.

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

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

Use gdk_cursor_new_fromm_name() or Gdk::Cursor::new_from_texture() to create the cursor. To make the cursor invisible, use Gdk::Cursor::Type::BLANK_CURSOR. Passing `nullptr` for the cursor argument to set_cursor() means that surface will use the cursor of its parent surface. Most surfaces should use this default.

Parameters

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

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

Setting focus_on_map to `false` hints the desktop environment that the surface doesn’t want to receive input focus when it is mapped.

focus_on_map should be turned off for surfaces 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.

Parameters

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

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

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

The mode argument is from the Gdk::FullscreenMode enumeration. If Gdk::FullscreenMode::ON_ALL_MONITORS is specified, the fullscreen surface will span over all monitors of the display.

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

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

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

Parameters

  mode | Fullscreen mode.

void Gdk::Surface::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::WMFunction::ALL, then the other bits indicate which functions to disable; if it doesn’t include Gdk::WMFunction::ALL, it indicates which functions to enable.

Parameters

  functions | Bitmask of operations to allow on surface.

void Gdk::Surface::set_geometry_hints | ( | const Geometry& | geometry,
|  | Hints | geom_mask
| ) |  |

Sets the geometry hints for surface.

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 surfaceing system about acceptable sizes for a toplevel surface. 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 surface to the provided values and constrain programatic resizing via resize() or move_resize().

Note that on X11, this effect has no effect on surfaces of type Gdk::Surface::Type::TEMP since these surfaces are not resizable by the user.

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

Parameters

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

void Gdk::Surface::set_icon_list | ( | const std::vector< Glib::RefPtr< Texture >>& | textures | ) |

Sets a list of icons for the surface.

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

Note that some platforms don't support surface icons.

Parameters

  textures | A list of image surfaces, of different sizes.

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

Surfaces may have a name used while minimized, distinct from the name they display in their titlebar.

Most of the time this is a bad idea from a user interface standpoint. But you can set such a name with this function, if you like.

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

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

Note that some platforms don't support surface icons.

Parameters

  name | Name of surface while iconified (minimized).

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

Set if surface must be kept above other surfaces.

If the surface was already above, then this function does nothing.

On X11, asks the window manager to keep surface 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 surface being kept above. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

  setting | Whether to keep surface above other surfaces.

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

Set if surface must be kept below other surfaces.

If the surface was already below, then this function does nothing.

On X11, asks the window manager to keep surface 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 surface being kept below. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

  setting | Whether to keep surface below other surfaces.

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

The application can use this hint to tell the window manager that a certain surface has modal behaviour.

The window manager can use this information to handle modal surfaces in a special way.

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

Parameters

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

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

Set surface to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque.

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

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

Support for non-toplevel surfaces was added in 3.8.

Parameters

  opacity | Opacity.

void Gdk::Surface::set_opaque_region | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | region | ) |

For optimisation purposes, compositing window managers may like to not draw obscured regions of surfaces, or turn off blending during for these regions.

With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.

This function only works for toplevel surfaces.

GTK will update this property automatically if the surface background is opaque, as we know where the opaque regions are. If your surface background is not opaque, please update this property in your Gtk::Widget::signal_style_updated() handler.

Parameters

  region | A region, or `nullptr`.

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

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

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

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

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

Parameters

  pass_through | A boolean.

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

Newer GTK windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders.

Window managers that want to maximize windows or snap to edges need to know where the extents of the actual frame lie, so that users don’t feel like windows are snapping against random invisible edges.

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

Parameters

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

void Gdk::Surface::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.

Parameters

  startup_id | A string with startup-notification identifier.

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

This function will enable multidevice features in surface.

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

Parameters

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

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

Sets the title of a toplevel surface, to be displayed in the titlebar.

If you haven’t explicitly set the icon name for the surface (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 and GTK). title may not be `nullptr`.

Parameters

  title | Title of surface.

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

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

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

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

Parameters

  parent | Another toplevel Gdk::Surface.

void Gdk::Surface::set_type_hint | ( | TypeHint | hint | ) |

The application can use this call to provide a hint to the surface manager about the functionality of a surface.

The window manager can use this information when determining the decoration and behaviour of the surface.

The hint must be set before the surface is mapped.

Parameters

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

void Gdk::Surface::show | ( |  | ) |

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

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

When implementing a Gtk::Widget, you should call this function on the widget's Gdk::Surface as part of the “map” method.

void Gdk::Surface::show_unraised | ( |  | ) |

Shows a Gdk::Surface onscreen, but does not modify its stacking order.

In contrast, show() will raise the surface to the top of the surface 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 surface).

bool Gdk::Surface::show_window_menu | ( | const Glib::RefPtr< const Event >& | event | ) |

Asks the windowing system to show the window menu.

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

Parameters

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

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

Glib::SignalProxy<bool(const Glib::RefPtr<const Event>&)> Gdk::Surface::signal_event | ( |  | ) |

Slot Prototype:
  `bool on_my_event(const Glib::RefPtr<const Event>& event)`

Flags: Run Last

Emitted when GDK receives an input event for surface.

Parameters

  event | An input event.

Returns
  `true` to indicate that the event has been handled.

Glib::SignalProxy<void(const Gdk::Rectangle&, const Gdk::Rectangle&, bool, bool)> Gdk::Surface::signal_moved_to_rect | ( |  | ) |

Slot Prototype:
  `void on_my_moved_to_rect(const Gdk::Rectangle& flipped_rect, const Gdk::Rectangle& final_rect, bool flipped_x, bool flipped_y)`

Flags: Run First

Emitted when the position of surface is finalized after being moved to a destination rectangle.

surface might be flipped over the destination rectangle in order to keep it on-screen, in which case flipped_x and flipped_y will be set to `true` accordingly.

flipped_rect is the ideal position of surface after any possible flipping, but before any possible sliding. final_rect is flipped_rect, but possibly translated in the case that flipping is still ineffective in keeping surface on-screen. Stability: Private

Parameters

  flipped_rect | The position of surface after any possible flipping or `nullptr` if the backend can't obtain it.
  final_rect | The final position of surface or `nullptr` if the backend can't obtain it.
  flipped_x | `true` if the anchors were flipped horizontally.
  flipped_y | `true` if the anchors were flipped vertically.

Glib::SignalProxy<bool(const ::Cairo::RefPtr<const ::Cairo::Region>&)> Gdk::Surface::signal_render | ( |  | ) |

Slot Prototype:
  `bool on_my_render(const Cairo::RefPtr<const ::Cairo::Region>& expose_region)`

Flags: Run Last

Emitted when part of the surface needs to be redrawn.

Parameters

  expose_region | The region that needs to be redrawn.

Returns
  `true` to indicate that the signal has been handled.

Glib::SignalProxy<void(int, int)> Gdk::Surface::signal_size_changed | ( |  | ) |

Slot Prototype:
  `void on_my_size_changed(int width, int height)`

Flags: Run First

Emitted when the size of surface is changed.

Parameters

  width | The new width.
  height | The new height.

void Gdk::Surface::stick | ( |  | ) |

“Pins” a surface 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 surface. For window managers that don’t support this operation, there’s nothing you can do to force it to happen.

void Gdk::Surface::thaw_updates | ( |  | ) |

Thaws a surface frozen with freeze_updates().

void Gdk::Surface::unfullscreen | ( |  | ) |

Moves the surface out of fullscreen mode.

If the surface was not fullscreen, does nothing.

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

void Gdk::Surface::unmaximize | ( |  | ) |

Unmaximizes the surface.

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

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

void Gdk::Surface::unset_icon | ( |  | ) |

void Gdk::Surface::unstick | ( |  | ) |

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

## Friends And Related Function Documentation

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

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

Parameters

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

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