gtkmm  3.97.1
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:
Inheritance graph
[legend]

Public Types

enum  Type {
  Type::TOPLEVEL,
  Type::TEMP,
  Type::POPUP
}
 
enum  State {
  State::WITHDRAWN = 1 << 0,
  State::MINIMIZED = 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
}
 
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
}
 
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
}
 
- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 

Public Member Functions

 Surface (Surface&& src) noexcept
 
Surfaceoperator= (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< Surfaceget_parent ()
 Returns the parent surface of a surface, or nullptr if the surface does not have a parent. More...
 
Glib::RefPtr< const Surfaceget_parent () const
 Returns the parent surface of a surface, or nullptr if the surface does not have a parent. More...
 
Glib::RefPtr< Displayget_display ()
 Gets the Gdk::Display associated with a Gdk::Surface. More...
 
Glib::RefPtr< const Displayget_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 resize (int width, int height)
 Resizes surface; for toplevel surfaces, asks the window manager to resize the surface. 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)
 Apply the region to the surface for the purpose of event handling. 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...
 
State get_state () const
 Gets the bitwise OR of the currently active surface state flags, from the Gdk::Surface::State enumeration. 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< Cursorget_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 Cursorget_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< Cursorget_cursor ()
 Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Surface, or nullptr. More...
 
Glib::RefPtr< const Cursorget_cursor () const
 Retrieves a Gdk::Cursor pointer for the cursor currently set on the specified Gdk::Surface, or nullptr. 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 relative to its parent. More...
 
int get_scale_factor () const
 Returns the internal scale factor that maps from surface coordiantes to the actual device pixels. More...
 
void 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...
 
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::Surfacecreate_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 minimize ()
 Asks to minimize the surface. More...
 
void unminimize ()
 Asks to unminimize the 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< Dragdrag_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< FrameClockget_frame_clock ()
 Gets the frame clock for the surface. More...
 
Glib::RefPtr< const FrameClockget_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::GLContextcreate_gl_context ()
 Creates a new GLContext matching the framebuffer format to the visual of the Surface. More...
 
Glib::RefPtr< Gdk::CairoContextcreate_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< Surface > > property_parent () const
 Parent surface. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FrameClock > > property_frame_clock () const
 Frame Clock. More...
 
Glib::PropertyProxy_ReadOnly< Stateproperty_state () const
 State. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_mapped () const
 Mapped. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_autohide () const
 Whether to dismiss the surface on outside clicks. More...
 
Glib::PropertyProxy_ReadOnly< Typeproperty_surface_type () const
 Surface type. 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
 
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
 

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< Surfacecreate_toplevel (const Glib::RefPtr< Display >& display, int width, int height)
 Creates a new toplevel surface. More...
 
static Glib::RefPtr< Surfacecreate_temp (const Glib::RefPtr< Display >& display, const Rectangle& position)
 Creates a new temporary surface. More...
 
static Glib::RefPtr< Surfacecreate_popup (const Glib::RefPtr< Display >& display, const Glib::RefPtr< Surface >& parent, bool autohide)
 Create a new popup 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::Surfacewrap (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
 
ObjectBaseoperator= (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

◆ Surface()

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

◆ ~Surface()

Gdk::Surface::~Surface ( )
overridenoexcept

Member Function Documentation

◆ beep()

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

◆ begin_move_drag() [1/2]

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
deviceThe device used for the operation.
buttonThe button being used to drag, or 0 for a keyboard-initiated drag.
root_xSurface X coordinate of mouse click that began the drag.
root_ySurface Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag.

◆ begin_move_drag() [2/2]

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
buttonThe button being used to drag, or 0 for a keyboard-initiated drag.
root_xSurface X coordinate of mouse click that began the drag.
root_ySurface Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag.

◆ begin_resize_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
edgeThe edge or corner from which the drag is started.
buttonThe button being used to drag, or 0 for a keyboard-initiated drag.
root_xSurface X coordinate of mouse click that began the drag.
root_ySurface Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag (use Gdk::Event::get_time()).

◆ constrain_size()

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
geometryA Gdk::Geometry structure.
flagsA mask indicating what portions of geometry are set.
widthDesired width of surface.
heightDesired height of the surface.
new_widthLocation to store resulting width.
new_heightLocation to store resulting height.

◆ create_cairo_context()

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

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

Returns
The newly created Gdk::CairoContext.

◆ create_gl_context()

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
GLErrorOn missing GL implementation or extension required for context creation.

◆ create_popup()

static Glib::RefPtr<Surface> Gdk::Surface::create_popup ( const Glib::RefPtr< Display >&  display,
const Glib::RefPtr< Surface >&  parent,
bool  autohide 
)
static

Create a new popup surface.

The surface will be attached to parent and can be positioned relative to it using move_to_rect().

Parameters
displayThe display to create the surface on.
parentThe parent surface to attach the surface to.
autohideWhether to hide the surface on outside clicks.
Returns
A new Gdk::Surface.

◆ create_similar_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
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.

◆ create_temp()

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

Creates a new temporary surface.

The surface will bypass surface management.

Parameters
displayThe display to create the surface on.
positionPosition of the surface on screen.
Returns
The new Gdk::Surface.

◆ create_toplevel()

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

Creates a new toplevel surface.

Parameters
displayThe display to create the surface on.
widthWidth of new surface.
heightHeight of new surface.
Returns
The new Gdk::Surface.

◆ drag_begin_from_point()

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. After this call, you probably want to set up the drag icon using the surface returned by get_drag_surface().

Note
if actions include Gdk::DragAction::MOVE, you need to listen for the Gdk::Drag::signal_dnd_finished() signal and delete the data at the source if get_selected_action() returns Gdk::DragAction::MOVE.
Parameters
deviceThe device that controls this drag.
contentThe offered content.
actionsThe actions supported by this drag.
dxThe x offset to device's position where the drag nominally started.
dyThe y offset to device's position where the drag nominally started.
Returns
A newly created Gdk::Drag or nullptr on error.

◆ focus()

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
timestampTimestamp of the event triggering the surface focus.

◆ freeze_updates()

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.

◆ fullscreen()

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.

◆ fullscreen_on_monitor()

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
monitorWhich monitor to display fullscreen on.

◆ get_accept_focus()

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.

◆ get_cursor() [1/2]

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.

◆ get_cursor() [2/2]

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.

◆ get_decorations()

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

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

Parameters
decorationsThe surface decorations will be written here.
Returns
true if the surface has decorations set, false otherwise.

◆ get_device_cursor() [1/2]

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

◆ get_device_cursor() [2/2]

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

◆ get_device_position()

void 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
devicePointer Gdk::Device to query to.
xReturn location for the X coordinate of device, or nullptr.
yReturn location for the Y coordinate of device, or nullptr.
maskReturn location for the modifier mask, or nullptr.

◆ get_display() [1/2]

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

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

Returns
The Gdk::Display associated with surface.

◆ get_display() [2/2]

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.

◆ get_focus_on_map()

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.

◆ get_frame_clock() [1/2]

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.

◆ get_frame_clock() [2/2]

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.

◆ get_fullscreen_mode()

FullscreenMode Gdk::Surface::get_fullscreen_mode ( ) const

Obtains the Gdk::FullscreenMode of the surface.

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

◆ get_height()

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.

◆ get_modal_hint()

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.

◆ get_parent() [1/2]

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

Returns the parent surface of a surface, or nullptr if the surface does not have a parent.

Only popup surfaces have parents.

Returns
The parent of surface, or nullptr.

◆ get_parent() [2/2]

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

Returns the parent surface of a surface, or nullptr if the surface does not have a parent.

Only popup surfaces have parents.

Returns
The parent of surface, or nullptr.

◆ get_position()

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

Obtains the position of the surface relative to its parent.

Parameters
xX coordinate of surface.
yY coordinate of surface.

◆ get_scale_factor()

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.

◆ get_state()

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.

◆ get_support_multidevice()

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.

◆ get_surface_type()

Type Gdk::Surface::get_surface_type ( ) const

Gets the type of the surface.

See Gdk::Surface::Type.

Returns
Type of surface.

◆ get_type()

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

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

◆ get_type_hint()

TypeHint Gdk::Surface::get_type_hint ( )

This function returns the type hint set for a surface.

Returns
The type hint set for surface.

◆ get_width()

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.

◆ gobj() [1/2]

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

Provides access to the underlying C GObject.

◆ gobj() [2/2]

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

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ hide()

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

◆ input_shape_combine_region()

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

Apply the region to the surface for the purpose of 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_regionRegion of surface to be non-transparent.
offset_xX position of shape_region in surface coordinates.
offset_yY position of shape_region in surface coordinates.

◆ is_viewable()

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.

◆ is_visible()

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.

◆ lower()

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

◆ maximize()

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.

◆ minimize()

void Gdk::Surface::minimize ( )

Asks to minimize the surface.

The windowing system may choose to ignore the request.

You can track the result of this request by using the Gdk::Surface::property_state() property.

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

◆ move_to_rect()

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
rectThe destination Gdk::Rectangle to align surface with.
rect_anchorThe point on rect to align with surface's anchor point.
surface_anchorThe point on surface to align with rect's anchor point.
anchor_hintsPositioning hints to use when limited on space.
rect_anchor_dxHorizontal offset to shift surface, i.e. rect's anchor point.
rect_anchor_dyVertical offset to shift surface, i.e. rect's anchor point.

◆ operator=()

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

◆ property_autohide()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Surface::property_autohide ( ) const

Whether to dismiss the surface on outside clicks.

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.

◆ property_cursor() [1/2]

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.

◆ property_cursor() [2/2]

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.

◆ property_display()

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.

◆ property_frame_clock()

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.

◆ property_mapped()

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.

◆ property_parent()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Surface> > Gdk::Surface::property_parent ( ) const

Parent surface.

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

◆ property_state()

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.

◆ property_surface_type()

Glib::PropertyProxy_ReadOnly< Type > Gdk::Surface::property_surface_type ( ) const

Surface type.

Default value: Gdk::Surface::Type::TOPLEVEL

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

◆ queue_expose()

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.

◆ raise()

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.

◆ register_dnd()

void Gdk::Surface::register_dnd ( )

Registers a surface as a potential drop destination.

◆ resize()

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.

Parameters
widthNew width of the surface.
heightNew height of the surface.

◆ resize_drag()

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
edgeThe edge or corner from which the drag is started.
deviceThe device used for the operation.
buttonThe button being used to drag, or 0 for a keyboard-initiated drag.
root_xSurface X coordinate of mouse click that began the drag.
root_ySurface Y coordinate of mouse click that began the drag.
timestampTimestamp of mouse click that began the drag (use Gdk::Event::get_time()).

◆ restack() [1/2]

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
aboveWhether to raise or lower the surface.
Since gtkmm 2.18:

◆ restack() [2/2]

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
siblingA Gdk::Surface that is a sibling of surface, or nullptr.
aboveA boolean.

◆ set_accept_focus()

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_focustrue if the surface should receive input focus.

◆ set_cursor() [1/2]

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.

◆ set_cursor() [2/2]

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
cursorA cursor.

◆ set_decorations()

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
decorationsDecoration hint mask.

◆ set_device_cursor()

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
deviceA master, pointer Gdk::Device.
cursorA Gdk::Cursor.

◆ set_focus_on_map()

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_maptrue if the surface should receive input focus when mapped.

◆ set_fullscreen_mode()

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
modeFullscreen mode.

◆ set_functions()

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
functionsBitmask of operations to allow on surface.

◆ set_geometry_hints()

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

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
geometryGeometry hints.
geom_maskBitmask indicating fields of geometry to pay attention to.

◆ set_icon_list()

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
texturesA list of image surfaces, of different sizes.

◆ set_icon_name()

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
nameName of surface while iconified (minimized).

◆ set_keep_above()

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
settingWhether to keep surface above other surfaces.

◆ set_keep_below()

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
settingWhether to keep surface below other surfaces.

◆ set_modal_hint()

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
modaltrue if the surface is modal, false otherwise.

◆ set_opacity()

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

◆ set_opaque_region()

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::property_css_changed() handler.

Parameters
regionA region, or nullptr.

◆ set_shadow_width()

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
leftThe left extent.
rightThe right extent.
topThe top extent.
bottomThe bottom extent.

◆ set_startup_id()

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_idA string with startup-notification identifier.

◆ set_support_multidevice()

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_multidevicetrue to enable multidevice support in surface.

◆ set_title()

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
titleTitle of surface.

◆ set_transient_for()

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

◆ set_type_hint()

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
hintA hint of the function this surface will have.

◆ show()

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.

◆ show_unraised()

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

◆ show_window_menu()

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
eventA Gdk::Event to show the menu for.
Returns
true if the window menu was shown and false otherwise.

◆ signal_event()

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
eventAn input event.
Returns
true to indicate that the event has been handled.

◆ signal_moved_to_rect()

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_rectThe position of surface after any possible flipping or nullptr if the backend can't obtain it.
final_rectThe final position of surface or nullptr if the backend can't obtain it.
flipped_xtrue if the anchors were flipped horizontally.
flipped_ytrue if the anchors were flipped vertically.

◆ signal_render()

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_regionThe region that needs to be redrawn.
Returns
true to indicate that the signal has been handled.

◆ signal_size_changed()

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
widthThe new width.
heightThe new height.

◆ stick()

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.

◆ thaw_updates()

void Gdk::Surface::thaw_updates ( )

Thaws a surface frozen with freeze_updates().

Note that this will not necessarily schedule updates if the surface freeze count reaches zero.

◆ unfullscreen()

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.

◆ unmaximize()

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.

◆ unminimize()

void Gdk::Surface::unminimize ( )

Asks to unminimize the surface.

The windowing system may choose to ignore the request.

You can track the result of this request by using the Gdk::Surface::property_state() property.

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

◆ unset_icon()

void Gdk::Surface::unset_icon ( )

◆ unstick()

void Gdk::Surface::unstick ( )

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

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::Surface > wrap ( GdkSurface *  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.