Surfaces

Surfaces — Onscreen display areas in the target window system

Functions

GdkSurface * gdk_surface_new_toplevel ()
GdkSurface * gdk_surface_new_popup ()
GdkSurface * gdk_surface_new_temp ()
GdkSurface * gdk_surface_new_child ()
void gdk_surface_destroy ()
GdkSurfaceType gdk_surface_get_surface_type ()
GdkDisplay * gdk_surface_get_display ()
void gdk_surface_show ()
void gdk_surface_show_unraised ()
void gdk_surface_hide ()
gboolean gdk_surface_is_destroyed ()
gboolean gdk_surface_is_visible ()
gboolean gdk_surface_is_viewable ()
gboolean gdk_surface_is_input_only ()
GdkSurfaceState gdk_surface_get_state ()
void gdk_surface_withdraw ()
void gdk_surface_iconify ()
void gdk_surface_deiconify ()
void gdk_surface_stick ()
void gdk_surface_unstick ()
void gdk_surface_maximize ()
void gdk_surface_unmaximize ()
void gdk_surface_fullscreen ()
void gdk_surface_fullscreen_on_monitor ()
void gdk_surface_unfullscreen ()
GdkFullscreenMode gdk_surface_get_fullscreen_mode ()
void gdk_surface_set_fullscreen_mode ()
void gdk_surface_set_keep_above ()
void gdk_surface_set_keep_below ()
void gdk_surface_set_opacity ()
void gdk_surface_set_pass_through ()
gboolean gdk_surface_get_pass_through ()
void gdk_surface_move ()
void gdk_surface_resize ()
void gdk_surface_move_resize ()
gboolean gdk_surface_has_native ()
void gdk_surface_raise ()
void gdk_surface_lower ()
void gdk_surface_restack ()
void gdk_surface_focus ()
void gdk_surface_register_dnd ()
void gdk_surface_begin_resize_drag ()
void gdk_surface_begin_resize_drag_for_device ()
void gdk_surface_begin_move_drag ()
void gdk_surface_begin_move_drag_for_device ()
gboolean gdk_surface_show_window_menu ()
void gdk_surface_constrain_size ()
void gdk_surface_beep ()
gint gdk_surface_get_scale_factor ()
void gdk_surface_set_opaque_region ()
GdkGLContext * gdk_surface_create_gl_context ()
GdkVulkanContext * gdk_surface_create_vulkan_context ()
void gdk_surface_invalidate_rect ()
void gdk_surface_invalidate_region ()
void gdk_surface_queue_expose ()
void gdk_surface_freeze_updates ()
void gdk_surface_thaw_updates ()
GdkFrameClock * gdk_surface_get_frame_clock ()
void gdk_surface_set_user_data ()
void gdk_surface_set_accept_focus ()
gboolean gdk_surface_get_accept_focus ()
void gdk_surface_set_focus_on_map ()
gboolean gdk_surface_get_focus_on_map ()
void gdk_surface_input_shape_combine_region ()
void gdk_surface_set_child_input_shapes ()
void gdk_surface_merge_child_input_shapes ()
void gdk_surface_set_title ()
void gdk_surface_set_cursor ()
GdkCursor * gdk_surface_get_cursor ()
void gdk_surface_get_user_data ()
void gdk_surface_get_geometry ()
void gdk_surface_set_geometry_hints ()
int gdk_surface_get_width ()
int gdk_surface_get_height ()
void gdk_surface_set_icon_list ()
void gdk_surface_set_modal_hint ()
gboolean gdk_surface_get_modal_hint ()
void gdk_surface_set_type_hint ()
GdkSurfaceTypeHint gdk_surface_get_type_hint ()
void gdk_surface_set_shadow_width ()
void gdk_surface_set_skip_taskbar_hint ()
void gdk_surface_set_skip_pager_hint ()
void gdk_surface_set_urgency_hint ()
void gdk_surface_get_position ()
void gdk_surface_get_root_origin ()
void gdk_surface_get_frame_extents ()
gint gdk_surface_get_origin ()
void gdk_surface_get_root_coords ()
GdkSurface * gdk_surface_get_device_position ()
GdkSurface * gdk_surface_get_device_position_double ()
GdkSurface * gdk_surface_get_parent ()
GdkSurface * gdk_surface_get_toplevel ()
GList * gdk_surface_get_children ()
GList * gdk_surface_get_children_with_user_data ()
GList * gdk_surface_peek_children ()
void gdk_surface_set_icon_name ()
void gdk_surface_set_transient_for ()
void gdk_surface_set_role ()
void gdk_surface_set_startup_id ()
void gdk_surface_set_group ()
GdkSurface * gdk_surface_get_group ()
void gdk_surface_set_decorations ()
gboolean gdk_surface_get_decorations ()
void gdk_surface_set_functions ()
gboolean gdk_surface_get_support_multidevice ()
void gdk_surface_set_support_multidevice ()
GdkCursor * gdk_surface_get_device_cursor ()
void gdk_surface_set_device_cursor ()
void gdk_surface_coords_from_parent ()
void gdk_surface_coords_to_parent ()

Properties

GdkCursor * cursor Read / Write
GdkDisplay * display Read / Write / Construct Only
GdkSurfaceState state Read

Signals

void moved-to-rect Run First

Object Hierarchy

    GObject
    ╰── GdkSurface

Includes

#include <gdk/gdk.h>

Description

A GdkSurface is a (usually) rectangular region on the screen. It’s a low-level object, used to implement high-level objects such as GtkWidget and GtkWindow on the GTK+ level. A GtkWindow is a toplevel surface, the thing a user might think of as a “window” with a titlebar and so on; a GtkWindow may contain many sub-GdkSurfaces.

Functions

gdk_surface_new_toplevel ()

GdkSurface *
gdk_surface_new_toplevel (GdkDisplay *display,
                          int width,
                          int height);

Creates a new toplevel surface. The surface will be managed by the surface manager.

[constructor]

Parameters

display

the display to create the surface on

 

width

width of new surface

 

height

height of new surface

 

Returns

the new GdkSurface.

[transfer full]


gdk_surface_new_popup ()

GdkSurface *
gdk_surface_new_popup (GdkDisplay *display,
                       const GdkRectangle *position);

Creates a new toplevel popup surface. The surface will bypass surface management.

[constructor]

Parameters

display

the display to create the surface on

 

position

position of the surface on screen

 

Returns

the new GdkSurface.

[transfer full]


gdk_surface_new_temp ()

GdkSurface *
gdk_surface_new_temp (GdkDisplay *display);

Creates a new toplevel temporary surface. The surface will be situated off-screen and not handle output.

You most likely do not want to use this function.

[constructor]

Parameters

display

the display to create the surface on

 

Returns

the new GdkSurface.

[transfer full]


gdk_surface_new_child ()

GdkSurface *
gdk_surface_new_child (GdkSurface *parent,
                       const GdkRectangle *position);

Creates a new client-side child surface.

[constructor]

Parameters

parent

the parent surface

 

position

placement of the surface inside parent

 

Returns

the new GdkSurface.

[transfer full]


gdk_surface_destroy ()

void
gdk_surface_destroy (GdkSurface *surface);

Destroys the window system resources associated with surface and decrements surface 's reference count. The window system resources for all children of surface are also destroyed, but the children’s reference counts are not decremented.

Note that a surface will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.

Parameters

surface

a GdkSurface

 

gdk_surface_get_surface_type ()

GdkSurfaceType
gdk_surface_get_surface_type (GdkSurface *surface);

Gets the type of the surface. See GdkSurfaceType.

Parameters

surface

a GdkSurface

 

Returns

type of surface


gdk_surface_get_display ()

GdkDisplay *
gdk_surface_get_display (GdkSurface *surface);

Gets the GdkDisplay associated with a GdkSurface.

Parameters

surface

a GdkSurface

 

Returns

the GdkDisplay associated with surface .

[transfer none]


gdk_surface_show ()

void
gdk_surface_show (GdkSurface *surface);

Like gdk_surface_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 gdk_surface_hide().

When implementing a GtkWidget, you should call this function on the widget's GdkSurface as part of the “map” method.

Parameters

surface

a GdkSurface

 

gdk_surface_show_unraised ()

void
gdk_surface_show_unraised (GdkSurface *surface);

Shows a GdkSurface onscreen, but does not modify its stacking order. In contrast, gdk_surface_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).

Parameters

surface

a GdkSurface

 

gdk_surface_hide ()

void
gdk_surface_hide (GdkSurface *surface);

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

Parameters

surface

a GdkSurface

 

gdk_surface_is_destroyed ()

gboolean
gdk_surface_is_destroyed (GdkSurface *surface);

Check to see if a surface is destroyed..

Parameters

surface

a GdkSurface

 

Returns

TRUE if the surface is destroyed


gdk_surface_is_visible ()

gboolean
gdk_surface_is_visible (GdkSurface *surface);

Checks whether the surface has been mapped (with gdk_surface_show() or gdk_surface_show_unraised()).

Parameters

surface

a GdkSurface

 

Returns

TRUE if the surface is mapped


gdk_surface_is_viewable ()

gboolean
gdk_surface_is_viewable (GdkSurface *surface);

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

Parameters

surface

a GdkSurface

 

Returns

TRUE if the surface is viewable


gdk_surface_is_input_only ()

gboolean
gdk_surface_is_input_only (GdkSurface *surface);

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

Parameters

surface

a toplevel GdkSurface

 

Returns

TRUE if surface is input only


gdk_surface_get_state ()

GdkSurfaceState
gdk_surface_get_state (GdkSurface *surface);

Gets the bitwise OR of the currently active surface state flags, from the GdkSurfaceState enumeration.

Parameters

surface

a GdkSurface

 

Returns

surface state bitfield


gdk_surface_withdraw ()

void
gdk_surface_withdraw (GdkSurface *surface);

Withdraws a surface (unmaps it and asks the surface manager to forget about it). This function is not really useful as gdk_surface_hide() automatically withdraws toplevel surfaces before hiding them.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_iconify ()

void
gdk_surface_iconify (GdkSurface *surface);

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 GtkWindow widget.

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

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_deiconify ()

void
gdk_surface_deiconify (GdkSurface *surface);

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 GdkSurface variant. Or better yet, you probably want to use gtk_window_present(), which raises the surface, focuses it, unminimizes it, and puts it on the current desktop.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_stick ()

void
gdk_surface_stick (GdkSurface *surface);

“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 GtkWindow, gtk_window_stick() may be more useful.)

On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the surface. For window managers that don’t support this operation, there’s nothing you can do to force it to happen.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_unstick ()

void
gdk_surface_unstick (GdkSurface *surface);

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

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_maximize ()

void
gdk_surface_maximize (GdkSurface *surface);

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.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_unmaximize ()

void
gdk_surface_unmaximize (GdkSurface *surface);

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.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_fullscreen ()

void
gdk_surface_fullscreen (GdkSurface *surface);

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.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_fullscreen_on_monitor ()

void
gdk_surface_fullscreen_on_monitor (GdkSurface *surface,
                                   GdkMonitor *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

surface

a toplevel GdkSurface

 

monitor

Which monitor to display fullscreen on.

 

gdk_surface_unfullscreen ()

void
gdk_surface_unfullscreen (GdkSurface *surface);

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.

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_get_fullscreen_mode ()

GdkFullscreenMode
gdk_surface_get_fullscreen_mode (GdkSurface *surface);

Obtains the GdkFullscreenMode of the surface .

Parameters

surface

a toplevel GdkSurface

 

Returns

The GdkFullscreenMode applied to the surface when fullscreen.


gdk_surface_set_fullscreen_mode ()

void
gdk_surface_set_fullscreen_mode (GdkSurface *surface,
                                 GdkFullscreenMode 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 GdkFullscreenMode enumeration. If GDK_FULLSCREEN_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_FULLSCREEN_ON_ALL_MONITORS is specified.

Parameters

surface

a toplevel GdkSurface

 

mode

fullscreen mode

 

gdk_surface_set_keep_above ()

void
gdk_surface_set_keep_above (GdkSurface *surface,
                            gboolean setting);

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

surface

a toplevel GdkSurface

 

setting

whether to keep surface above other surfaces

 

gdk_surface_set_keep_below ()

void
gdk_surface_set_keep_below (GdkSurface *surface,
                            gboolean setting);

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

surface

a toplevel GdkSurface

 

setting

whether to keep surface below other surfaces

 

gdk_surface_set_opacity ()

void
gdk_surface_set_opacity (GdkSurface *surface,
                         gdouble 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, NULL) 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

surface

a top-level or non-native GdkSurface

 

opacity

opacity

 

gdk_surface_set_pass_through ()

void
gdk_surface_set_pass_through (GdkSurface *surface,
                              gboolean pass_through);

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

surface

a GdkSurface

 

pass_through

a boolean

 

gdk_surface_get_pass_through ()

gboolean
gdk_surface_get_pass_through (GdkSurface *surface);

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

See gdk_surface_set_pass_through() for details

Parameters

surface

a GdkSurface

 

gdk_surface_move ()

void
gdk_surface_move (GdkSurface *surface,
                  gint x,
                  gint 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 GtkWindow 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 gdk_surface_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters

surface

a GdkSurface

 

x

X coordinate relative to surface’s parent

 

y

Y coordinate relative to surface’s parent

 

gdk_surface_resize ()

void
gdk_surface_resize (GdkSurface *surface,
                    gint width,
                    gint 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 gdk_surface_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters

surface

a GdkSurface

 

width

new width of the surface

 

height

new height of the surface

 

gdk_surface_move_resize ()

void
gdk_surface_move_resize (GdkSurface *surface,
                         gint x,
                         gint y,
                         gint width,
                         gint height);

Equivalent to calling gdk_surface_move() and gdk_surface_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 gdk_surface_move_resize().)

Parameters

surface

a GdkSurface

 

x

new X position relative to surface’s parent

 

y

new Y position relative to surface’s parent

 

width

new width

 

height

new height

 

gdk_surface_has_native ()

gboolean
gdk_surface_has_native (GdkSurface *surface);

Checks whether the surface has a native surface or not.

Parameters

surface

a GdkSurface

 

Returns

TRUE if the surface has a native surface, FALSE otherwise.


gdk_surface_raise ()

void
gdk_surface_raise (GdkSurface *surface);

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 surface manager may choose to deny the request to move the surface in the Z-order, gdk_surface_raise() only requests the restack, does not guarantee it.

Parameters

surface

a GdkSurface

 

gdk_surface_lower ()

void
gdk_surface_lower (GdkSurface *surface);

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, gdk_surface_lower() only requests the restack, does not guarantee it.

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

Parameters

surface

a GdkSurface

 

gdk_surface_restack ()

void
gdk_surface_restack (GdkSurface *surface,
                     GdkSurface *sibling,
                     gboolean 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 NULL, 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, gdk_surface_restack() only requests the restack, does not guarantee it.

Parameters

surface

a GdkSurface

 

sibling

a GdkSurface that is a sibling of surface , or NULL.

[allow-none]

above

a boolean

 

gdk_surface_focus ()

void
gdk_surface_focus (GdkSurface *surface,
                   guint32 timestamp);

Sets keyboard focus to surface . In most cases, gtk_window_present() should be used on a GtkWindow, rather than calling this function.

Parameters

surface

a GdkSurface

 

timestamp

timestamp of the event triggering the surface focus

 

gdk_surface_register_dnd ()

void
gdk_surface_register_dnd (GdkSurface *surface);

Registers a surface as a potential drop destination.

Parameters

surface

a GdkSurface.

 

gdk_surface_begin_resize_drag ()

void
gdk_surface_begin_resize_drag (GdkSurface *surface,
                               GdkSurfaceEdge edge,
                               gint button,
                               gint root_x,
                               gint 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 gdk_surface_begin_resize_drag_for_device() to begin a drag with a different device.

Parameters

surface

a toplevel GdkSurface

 

edge

the edge or corner from which the drag is started

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

 

gdk_surface_begin_resize_drag_for_device ()

void
gdk_surface_begin_resize_drag_for_device
                               (GdkSurface *surface,
                                GdkSurfaceEdge edge,
                                GdkDevice *device,
                                gint button,
                                gint root_x,
                                gint root_y,
                                guint32 timestamp);

Begins a surface resize operation (for a toplevel surface). You might use this function to implement a “window resize grip,” for example; in fact GtkStatusbar uses it. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

Parameters

surface

a toplevel GdkSurface

 

edge

the edge or corner from which the drag is started

 

device

the device used for the operation

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

 

gdk_surface_begin_move_drag ()

void
gdk_surface_begin_move_drag (GdkSurface *surface,
                             gint button,
                             gint root_x,
                             gint 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 gdk_surface_begin_move_drag_for_device() to begin a drag with a different device.

Parameters

surface

a toplevel GdkSurface

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag

 

gdk_surface_begin_move_drag_for_device ()

void
gdk_surface_begin_move_drag_for_device
                               (GdkSurface *surface,
                                GdkDevice *device,
                                gint button,
                                gint root_x,
                                gint root_y,
                                guint32 timestamp);

Begins a surface move operation (for a toplevel surface). You might use this function to implement a “window move grip,” for example. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

Parameters

surface

a toplevel GdkSurface

 

device

the device used for the operation

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag

 

gdk_surface_show_window_menu ()

gboolean
gdk_surface_show_window_menu (GdkSurface *surface,
                              GdkEvent *event);

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

Parameters

surface

a GdkSurface

 

event

a GdkEvent to show the menu for

 

Returns

TRUE if the window menu was shown and FALSE otherwise.


gdk_surface_constrain_size ()

void
gdk_surface_constrain_size (GdkGeometry *geometry,
                            GdkSurfaceHints flags,
                            gint width,
                            gint height,
                            gint *new_width,
                            gint *new_height);

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

Parameters

geometry

a GdkGeometry 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.

[out]

new_height

location to store resulting height.

[out]

gdk_surface_beep ()

void
gdk_surface_beep (GdkSurface *surface);

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

Parameters

surface

a toplevel GdkSurface

 

gdk_surface_get_scale_factor ()

gint
gdk_surface_get_scale_factor (GdkSurface *surface);

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.

Parameters

surface

surface to get scale factor for

 

Returns

the scale factor


gdk_surface_set_opaque_region ()

void
gdk_surface_set_opaque_region (GdkSurface *surface,
                               cairo_region_t *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 “style-updated” handler.

Parameters

surface

a top-level or non-native GdkSurface

 

region

a region, or NULL.

[allow-none]

gdk_surface_create_gl_context ()

GdkGLContext *
gdk_surface_create_gl_context (GdkSurface *surface,
                               GError **error);

Creates a new GdkGLContext matching the framebuffer format to the visual of the GdkSurface. The context is disconnected from any particular surface or surface.

If the creation of the GdkGLContext failed, error will be set.

Before using the returned GdkGLContext, you will need to call gdk_gl_context_make_current() or gdk_gl_context_realize().

Parameters

surface

a GdkSurface

 

error

return location for an error

 

Returns

the newly created GdkGLContext, or NULL on error.

[transfer full]


gdk_surface_create_vulkan_context ()

GdkVulkanContext *
gdk_surface_create_vulkan_context (GdkSurface *surface,
                                   GError **error);

Creates a new GdkVulkanContext for rendering on surface .

If the creation of the GdkVulkanContext failed, error will be set.

Parameters

surface

a GdkSurface

 

error

return location for an error

 

Returns

the newly created GdkVulkanContext, or NULL on error.

[transfer full]


gdk_surface_invalidate_rect ()

void
gdk_surface_invalidate_rect (GdkSurface *surface,
                             const GdkRectangle *rect);

A convenience wrapper around gdk_surface_invalidate_region() which invalidates a rectangular region. See gdk_surface_invalidate_region() for details.

Parameters

surface

a GdkSurface

 

rect

rectangle to invalidate or NULL to invalidate the whole surface.

[allow-none]

gdk_surface_invalidate_region ()

void
gdk_surface_invalidate_region (GdkSurface *surface,
                               const cairo_region_t *region);

Adds region to the update area for surface . The update area is the region that needs to be redrawn, or “dirty region.”

GDK will process all updates whenever the frame clock schedules a redraw, so there’s no need to do forces redraws manually, you just need to invalidate regions that you know should be redrawn.

The invalidate_children parameter controls whether the region of each child surface that intersects region will also be invalidated. If FALSE, then the update area for child surfaces will remain unaffected.

Parameters

surface

a GdkSurface

 

region

a cairo_region_t

 

gdk_surface_queue_expose ()

void
gdk_surface_queue_expose (GdkSurface *surface);

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.

Parameters

surface

a GdkSurface

 

gdk_surface_freeze_updates ()

void
gdk_surface_freeze_updates (GdkSurface *surface);

Temporarily freezes a surface such that it won’t receive expose events. The surface will begin receiving expose events again when gdk_surface_thaw_updates() is called. If gdk_surface_freeze_updates() has been called more than once, gdk_surface_thaw_updates() must be called an equal number of times to begin processing exposes.

Parameters

surface

a GdkSurface

 

gdk_surface_thaw_updates ()

void
gdk_surface_thaw_updates (GdkSurface *surface);

Thaws a surface frozen with gdk_surface_freeze_updates().

Parameters

surface

a GdkSurface

 

gdk_surface_get_frame_clock ()

GdkFrameClock *
gdk_surface_get_frame_clock (GdkSurface *surface);

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.

Parameters

surface

surface to get frame clock for

 

Returns

the frame clock.

[transfer none]


gdk_surface_set_user_data ()

void
gdk_surface_set_user_data (GdkSurface *surface,
                           gpointer user_data);

For most purposes this function is deprecated in favor of g_object_set_data(). However, for historical reasons GTK+ stores the GtkWidget that owns a GdkSurface as user data on the GdkSurface. So, custom widget implementations should use this function for that. If GTK+ receives an event for a GdkSurface, and the user data for the surface is non-NULL, GTK+ will assume the user data is a GtkWidget, and forward the event to that widget.

Parameters

surface

a GdkSurface

 

user_data

user data.

[allow-none][type GObject.Object]

gdk_surface_set_accept_focus ()

void
gdk_surface_set_accept_focus (GdkSurface *surface,
                              gboolean accept_focus);

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

surface

a toplevel GdkSurface

 

accept_focus

TRUE if the surface should receive input focus

 

gdk_surface_get_accept_focus ()

gboolean
gdk_surface_get_accept_focus (GdkSurface *surface);

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

Parameters

surface

a toplevel GdkSurface.

 

Returns

whether or not the surface should receive input focus.


gdk_surface_set_focus_on_map ()

void
gdk_surface_set_focus_on_map (GdkSurface *surface,
                              gboolean 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

surface

a toplevel GdkSurface

 

focus_on_map

TRUE if the surface should receive input focus when mapped

 

gdk_surface_get_focus_on_map ()

gboolean
gdk_surface_get_focus_on_map (GdkSurface *surface);

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

Parameters

surface

a toplevel GdkSurface.

 

Returns

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


gdk_surface_input_shape_combine_region ()

void
gdk_surface_input_shape_combine_region
                               (GdkSurface *surface,
                                const cairo_region_t *shape_region,
                                gint offset_x,
                                gint 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

surface

a GdkSurface

 

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

 

gdk_surface_set_child_input_shapes ()

void
gdk_surface_set_child_input_shapes (GdkSurface *surface);

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 gdk_surface_merge_child_input_shapes() which includes the input shape mask of surface in the masks to be merged.

Parameters

surface

a GdkSurface

 

gdk_surface_merge_child_input_shapes ()

void
gdk_surface_merge_child_input_shapes (GdkSurface *surface);

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

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

Parameters

surface

a GdkSurface

 

gdk_surface_set_title ()

void
gdk_surface_set_title (GdkSurface *surface,
                       const gchar *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 gdk_surface_set_icon_name()), the icon name will be set to title as well. title must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). title may not be NULL.

Parameters

surface

a toplevel GdkSurface

 

title

title of surface

 

gdk_surface_set_cursor ()

void
gdk_surface_set_cursor (GdkSurface *surface,
                        GdkCursor *cursor);

Sets the default mouse pointer for a GdkSurface.

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

Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR. Passing NULL for the cursor argument to gdk_surface_set_cursor() means that surface will use the cursor of its parent surface. Most surfaces should use this default.

Parameters

surface

a GdkSurface

 

cursor

a cursor.

[allow-none]

gdk_surface_get_cursor ()

GdkCursor *
gdk_surface_get_cursor (GdkSurface *surface);

Retrieves a GdkCursor pointer for the cursor currently set on the specified GdkSurface, or NULL. If the return value is NULL then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface.

Parameters

surface

a GdkSurface

 

Returns

a GdkCursor, or NULL. The returned object is owned by the GdkSurface and should not be unreferenced directly. Use gdk_surface_set_cursor() to unset the cursor of the surface.

[nullable][transfer none]


gdk_surface_get_user_data ()

void
gdk_surface_get_user_data (GdkSurface *surface,
                           gpointer *data);

Retrieves the user data for surface , which is normally the widget that surface belongs to. See gdk_surface_set_user_data().

Parameters

surface

a GdkSurface

 

data

return location for user data.

[out]

gdk_surface_get_geometry ()

void
gdk_surface_get_geometry (GdkSurface *surface,
                          gint *x,
                          gint *y,
                          gint *width,
                          gint *height);

Any of the return location arguments to this function may be NULL, 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 GdkEventConfigure. gdk_surface_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 gdk_surface_get_position(), gdk_surface_get_width() and gdk_surface_get_height() instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit coordinate space, whereas gdk_surface_get_geometry() is restricted to the 16-bit coordinates of X11.

Parameters

surface

a GdkSurface

 

x

return location for X coordinate of surface (relative to its parent).

[out][allow-none]

y

return location for Y coordinate of surface (relative to its parent).

[out][allow-none]

width

return location for width of surface.

[out][allow-none]

height

return location for height of surface.

[out][allow-none]

gdk_surface_set_geometry_hints ()

void
gdk_surface_set_geometry_hints (GdkSurface *surface,
                                const GdkGeometry *geometry,
                                GdkSurfaceHints 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 NULL.

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 gdk_surface_resize() or gdk_surface_move_resize().

Note that on X11, this effect has no effect on surfaces of type GDK_SURFACE_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 gdk_surface_constrain_size() yourself to determine appropriate sizes.

Parameters

surface

a toplevel GdkSurface

 

geometry

geometry hints

 

geom_mask

bitmask indicating fields of geometry to pay attention to

 

gdk_surface_get_width ()

int
gdk_surface_get_width (GdkSurface *surface);

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.

Parameters

surface

a GdkSurface

 

Returns

The width of surface


gdk_surface_get_height ()

int
gdk_surface_get_height (GdkSurface *surface);

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.

Parameters

surface

a GdkSurface

 

Returns

The height of surface


gdk_surface_set_icon_list ()

void
gdk_surface_set_icon_list (GdkSurface *surface,
                           GList *surfaces);

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

surface

The GdkSurface toplevel surface to set the icon of.

 

surfaces

A list of image surfaces, of different sizes.

[transfer none][element-type GdkTexture]

gdk_surface_set_modal_hint ()

void
gdk_surface_set_modal_hint (GdkSurface *surface,
                            gboolean modal);

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

Parameters

surface

A toplevel GdkSurface

 

modal

TRUE if the surface is modal, FALSE otherwise.

 

gdk_surface_get_modal_hint ()

gboolean
gdk_surface_get_modal_hint (GdkSurface *surface);

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

Parameters

surface

A toplevel GdkSurface.

 

Returns

whether or not the surface has the modal hint set.


gdk_surface_set_type_hint ()

void
gdk_surface_set_type_hint (GdkSurface *surface,
                           GdkSurfaceTypeHint 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

surface

A toplevel GdkSurface

 

hint

A hint of the function this surface will have

 

gdk_surface_get_type_hint ()

GdkSurfaceTypeHint
gdk_surface_get_type_hint (GdkSurface *surface);

This function returns the type hint set for a surface.

Parameters

surface

A toplevel GdkSurface

 

Returns

The type hint set for surface


gdk_surface_set_shadow_width ()

void
gdk_surface_set_shadow_width (GdkSurface *surface,
                              gint left,
                              gint right,
                              gint top,
                              gint 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

surface

a GdkSurface

 

left

The left extent

 

right

The right extent

 

top

The top extent

 

bottom

The bottom extent

 

gdk_surface_set_skip_taskbar_hint ()

void
gdk_surface_set_skip_taskbar_hint (GdkSurface *surface,
                                   gboolean skips_taskbar);

Toggles whether a surface should appear in a task list or surface list. If a surface’s semantic type as specified with gdk_surface_set_type_hint() already fully describes the surface, this function should not be called in addition, instead you should allow the surface to be treated according to standard policy for its semantic type.

Parameters

surface

a toplevel GdkSurface

 

skips_taskbar

TRUE to skip the taskbar

 

gdk_surface_set_skip_pager_hint ()

void
gdk_surface_set_skip_pager_hint (GdkSurface *surface,
                                 gboolean skips_pager);

Toggles whether a surface should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the surfaces on the desktop). If a surface’s semantic type as specified with gdk_surface_set_type_hint() already fully describes the surface, this function should not be called in addition, instead you should allow the surface to be treated according to standard policy for its semantic type.

Parameters

surface

a toplevel GdkSurface

 

skips_pager

TRUE to skip the pager

 

gdk_surface_set_urgency_hint ()

void
gdk_surface_set_urgency_hint (GdkSurface *surface,
                              gboolean urgent);

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

Parameters

surface

a toplevel GdkSurface

 

urgent

TRUE if the surface is urgent

 

gdk_surface_get_position ()

void
gdk_surface_get_position (GdkSurface *surface,
                          gint *x,
                          gint *y);

Obtains the position of the surface as reported in the most-recently-processed GdkEventConfigure. Contrast with gdk_surface_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

surface

a GdkSurface

 

x

X coordinate of surface.

[out][allow-none]

y

Y coordinate of surface.

[out][allow-none]

gdk_surface_get_root_origin ()

void
gdk_surface_get_root_origin (GdkSurface *surface,
                             gint *x,
                             gint *y);

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

Parameters

surface

a toplevel GdkSurface

 

x

return location for X position of surface frame.

[out]

y

return location for Y position of surface frame.

[out]

gdk_surface_get_frame_extents ()

void
gdk_surface_get_frame_extents (GdkSurface *surface,
                               GdkRectangle *rect);

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

Parameters

surface

a toplevel GdkSurface

 

rect

rectangle to fill with bounding box of the surface frame.

[out]

gdk_surface_get_origin ()

gint
gdk_surface_get_origin (GdkSurface *surface,
                        gint *x,
                        gint *y);

Obtains the position of a surface in root window coordinates. (Compare with gdk_surface_get_position() and gdk_surface_get_geometry() which return the position of a surface relative to its parent surface.)

Parameters

surface

a GdkSurface

 

x

return location for X coordinate.

[out][allow-none]

y

return location for Y coordinate.

[out][allow-none]

Returns

not meaningful, ignore


gdk_surface_get_root_coords ()

void
gdk_surface_get_root_coords (GdkSurface *surface,
                             gint x,
                             gint y,
                             gint *root_x,
                             gint *root_y);

Obtains the position of a surface position in root window coordinates. This is similar to gdk_surface_get_origin() but allows you to pass in any position in the surface, not just the origin.

Parameters

surface

a GdkSurface

 

x

X coordinate in surface

 

y

Y coordinate in surface

 

root_x

return location for X coordinate.

[out]

root_y

return location for Y coordinate.

[out]

gdk_surface_get_device_position ()

GdkSurface *
gdk_surface_get_device_position (GdkSurface *surface,
                                 GdkDevice *device,
                                 gint *x,
                                 gint *y,
                                 GdkModifierType *mask);

Obtains the current device position and modifier state. The position is given in coordinates relative to the upper left corner of surface .

Use gdk_surface_get_device_position_double() if you need subpixel precision.

Parameters

surface

a GdkSurface.

 

device

pointer GdkDevice to query to.

 

x

return location for the X coordinate of device , or NULL.

[out][allow-none]

y

return location for the Y coordinate of device , or NULL.

[out][allow-none]

mask

return location for the modifier mask, or NULL.

[out][allow-none]

Returns

The surface underneath device (as with gdk_device_get_surface_at_position()), or NULL if the surface is not known to GDK.

[nullable][transfer none]


gdk_surface_get_device_position_double ()

GdkSurface *
gdk_surface_get_device_position_double
                               (GdkSurface *surface,
                                GdkDevice *device,
                                gdouble *x,
                                gdouble *y,
                                GdkModifierType *mask);

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

surface

a GdkSurface.

 

device

pointer GdkDevice to query to.

 

x

return location for the X coordinate of device , or NULL.

[out][allow-none]

y

return location for the Y coordinate of device , or NULL.

[out][allow-none]

mask

return location for the modifier mask, or NULL.

[out][allow-none]

Returns

The surface underneath device (as with gdk_device_get_surface_at_position()), or NULL if the surface is not known to GDK.

[nullable][transfer none]


gdk_surface_get_parent ()

GdkSurface *
gdk_surface_get_parent (GdkSurface *surface);

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.

Parameters

surface

a GdkSurface

 

Returns

parent of surface .

[transfer none]


gdk_surface_get_toplevel ()

GdkSurface *
gdk_surface_get_toplevel (GdkSurface *surface);

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

Any surface type but GDK_SURFACE_CHILD is considered a toplevel surface, as is a GDK_SURFACE_CHILD surface that has a root surface as parent.

Parameters

surface

a GdkSurface

 

Returns

the toplevel surface containing surface .

[transfer none]


gdk_surface_get_children ()

GList *
gdk_surface_get_children (GdkSurface *surface);

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.

Parameters

surface

a GdkSurface

 

Returns

list of child surfaces inside surface .

[transfer container][element-type GdkSurface]


gdk_surface_get_children_with_user_data ()

GList *
gdk_surface_get_children_with_user_data
                               (GdkSurface *surface,
                                gpointer user_data);

Gets the list of children of surface known to GDK with a particular user_data set on it.

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

The list is returned in (relative) stacking order, i.e. the lowest surface is first.

Parameters

surface

a GdkSurface

 

user_data

user data to look for

 

Returns

list of child surfaces inside surface .

[transfer container][element-type GdkSurface]


gdk_surface_peek_children ()

GList *
gdk_surface_peek_children (GdkSurface *surface);

Like gdk_surface_get_children(), but does not copy the list of children, so the list does not need to be freed.

Parameters

surface

a GdkSurface

 

Returns

a reference to the list of child surfaces in surface .

[transfer none][element-type GdkSurface]


gdk_surface_set_icon_name ()

void
gdk_surface_set_icon_name (GdkSurface *surface,
                           const gchar *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-NULL name , calls to gdk_surface_set_title() will not update the icon title.

Using NULL for name unsets the icon title; further calls to gdk_surface_set_title() will again update the icon title as well.

Note that some platforms don't support surface icons.

Parameters

surface

a toplevel GdkSurface

 

name

name of surface while iconified (minimized).

[allow-none]

gdk_surface_set_transient_for ()

void
gdk_surface_set_transient_for (GdkSurface *surface,
                               GdkSurface *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 GtkWindow or GtkDialog.

Parameters

surface

a toplevel GdkSurface

 

parent

another toplevel GdkSurface

 

gdk_surface_set_role ()

void
gdk_surface_set_role (GdkSurface *surface,
                      const gchar *role);

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

The window manager and session manager use a surface’s role to distinguish it from other kinds of surface in the same application. When an application is restarted after being saved in a previous session, all surfaces with the same title and role are treated as interchangeable. So if you have two surfaces with the same title that should be distinguished for session management purposes, you should set the role on those surfaces. It doesn’t matter what string you use for the role, as long as you have a different role for each non-interchangeable kind of surface.

Parameters

surface

a toplevel GdkSurface

 

role

a string indicating its role

 

gdk_surface_set_startup_id ()

void
gdk_surface_set_startup_id (GdkSurface *surface,
                            const gchar *startup_id);

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

Parameters

surface

a toplevel GdkSurface

 

startup_id

a string with startup-notification identifier

 

gdk_surface_set_group ()

void
gdk_surface_set_group (GdkSurface *surface,
                       GdkSurface *leader);

Sets the group leader surface for surface . By default, GDK sets the group leader for all toplevel surfaces to a global surface implicitly created by GDK. With this function you can override this default.

The group leader surface allows the window manager to distinguish all surfaces that belong to a single application. It may for example allow users to minimize/unminimize all surfaces belonging to an application at once. You should only set a non-default group surface if your application pretends to be multiple applications.

Parameters

surface

a toplevel GdkSurface

 

leader

group leader surface, or NULL to restore the default group leader surface.

[allow-none]

gdk_surface_get_group ()

GdkSurface *
gdk_surface_get_group (GdkSurface *surface);

Returns the group leader surface for surface . See gdk_surface_set_group().

Parameters

surface

a toplevel GdkSurface

 

Returns

the group leader surface for surface .

[transfer none]


gdk_surface_set_decorations ()

void
gdk_surface_set_decorations (GdkSurface *surface,
                             GdkWMDecoration decorations);

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

The decorations argument is the logical OR of the fields in the GdkWMDecoration enumeration. If GDK_DECOR_ALL is included in the mask, the other bits indicate which decorations should be turned off. If GDK_DECOR_ALL is not included, then the other bits indicate which decorations should be turned on.

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

Parameters

surface

a toplevel GdkSurface

 

decorations

decoration hint mask

 

gdk_surface_get_decorations ()

gboolean
gdk_surface_get_decorations (GdkSurface *surface,
                             GdkWMDecoration *decorations);

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

Parameters

surface

The toplevel GdkSurface to get the decorations from

 

decorations

The surface decorations will be written here.

[out]

Returns

TRUE if the surface has decorations set, FALSE otherwise.


gdk_surface_set_functions ()

void
gdk_surface_set_functions (GdkSurface *surface,
                           GdkWMFunction 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 GdkWMFunction enumeration. If the bitmask includes GDK_FUNC_ALL, then the other bits indicate which functions to disable; if it doesn’t include GDK_FUNC_ALL, it indicates which functions to enable.

Parameters

surface

a toplevel GdkSurface

 

functions

bitmask of operations to allow on surface

 

gdk_surface_get_support_multidevice ()

gboolean
gdk_surface_get_support_multidevice (GdkSurface *surface);

Returns TRUE if the surface is aware of the existence of multiple devices.

Parameters

surface

a GdkSurface.

 

Returns

TRUE if the surface handles multidevice features.


gdk_surface_set_support_multidevice ()

void
gdk_surface_set_support_multidevice (GdkSurface *surface,
                                     gboolean support_multidevice);

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

surface

a GdkSurface.

 

support_multidevice

TRUE to enable multidevice support in surface .

 

gdk_surface_get_device_cursor ()

GdkCursor *
gdk_surface_get_device_cursor (GdkSurface *surface,
                               GdkDevice *device);

Retrieves a GdkCursor pointer for the device currently set on the specified GdkSurface, or NULL. If the return value is NULL then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface.

Parameters

surface

a GdkSurface.

 

device

a master, pointer GdkDevice.

 

Returns

a GdkCursor, or NULL. The returned object is owned by the GdkSurface and should not be unreferenced directly. Use gdk_surface_set_cursor() to unset the cursor of the surface.

[nullable][transfer none]


gdk_surface_set_device_cursor ()

void
gdk_surface_set_device_cursor (GdkSurface *surface,
                               GdkDevice *device,
                               GdkCursor *cursor);

Sets a specific GdkCursor for a given device when it gets inside surface . Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR. Passing NULL for the cursor argument to gdk_surface_set_cursor() means that surface will use the cursor of its parent surface. Most surfaces should use this default.

Parameters

surface

a GdkSurface

 

device

a master, pointer GdkDevice

 

cursor

a GdkCursor

 

gdk_surface_coords_from_parent ()

void
gdk_surface_coords_from_parent (GdkSurface *surface,
                                gdouble parent_x,
                                gdouble parent_y,
                                gdouble *x,
                                gdouble *y);

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

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

See also: gdk_surface_coords_to_parent()

Parameters

surface

a child surface

 

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.

[out][allow-none]

y

return location for Y coordinate in child’s coordinate system.

[out][allow-none]

gdk_surface_coords_to_parent ()

void
gdk_surface_coords_to_parent (GdkSurface *surface,
                              gdouble x,
                              gdouble y,
                              gdouble *parent_x,
                              gdouble *parent_y);

Transforms surface coordinates from a child surface to its parent surface. Calling this function is equivalent to adding the return values of gdk_surface_get_position() to the child coordinates.

See also: gdk_surface_coords_from_parent()

Parameters

surface

a child surface

 

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

[out][allow-none]

parent_y

return location for Y coordinate in parent’s coordinate system, or NULL.

[out][allow-none]

Types and Values

GdkSurface

typedef struct _GdkSurface GdkSurface;

The GdkSurface struct contains only private fields and should not be accessed directly.


enum GdkSurfaceType

Describes the kind of surface.

Members

GDK_SURFACE_TOPLEVEL

toplevel window (used to implement GtkWindow)

 

GDK_SURFACE_CHILD

child surface (used to implement e.g. GtkEntry)

 

GDK_SURFACE_TEMP

override redirect temporary surface (used to implement GtkMenu)

 

GDK_SURFACE_SUBSURFACE

subsurface; This surface is visually tied to a toplevel, and is moved/stacked with it. Currently this window type is only implemented in Wayland

 

enum GdkSurfaceHints

Used to indicate which fields of a GdkGeometry struct should be paid attention to. Also, the presence/absence of GDK_HINT_POS , GDK_HINT_USER_POS , and GDK_HINT_USER_SIZE is significant, though they don't directly refer to GdkGeometry fields. GDK_HINT_USER_POS will be set automatically by GtkWindow if you call gtk_window_move(). GDK_HINT_USER_POS and GDK_HINT_USER_SIZE should be set if the user specified a size/position using a --geometry command-line argument; gtk_window_parse_geometry() automatically sets these flags.

Members

GDK_HINT_POS

indicates that the program has positioned the surface

 

GDK_HINT_MIN_SIZE

min size fields are set

 

GDK_HINT_MAX_SIZE

max size fields are set

 

GDK_HINT_BASE_SIZE

base size fields are set

 

GDK_HINT_ASPECT

aspect ratio fields are set

 

GDK_HINT_RESIZE_INC

resize increment fields are set

 

GDK_HINT_WIN_GRAVITY

surface gravity field is set

 

GDK_HINT_USER_POS

indicates that the surface’s position was explicitly set by the user

 

GDK_HINT_USER_SIZE

indicates that the surface’s size was explicitly set by the user

 

struct GdkGeometry

struct GdkGeometry {
  gint min_width;
  gint min_height;
  gint max_width;
  gint max_height;
  gint base_width;
  gint base_height;
  gint width_inc;
  gint height_inc;
  gdouble min_aspect;
  gdouble max_aspect;
  GdkGravity win_gravity;
};

The GdkGeometry struct gives the window manager information about a surface’s geometry constraints. Normally you would set these on the GTK+ level using gtk_window_set_geometry_hints(). GtkWindow then sets the hints on the GdkSurface it creates.

gdk_surface_set_geometry_hints() expects the hints to be fully valid already and simply passes them to the window manager; in contrast, gtk_window_set_geometry_hints() performs some interpretation. For example, GtkWindow will apply the hints to the geometry widget instead of the toplevel window, if you set a geometry widget. Also, the min_width /min_height /max_width /max_height fields may be set to -1, and GtkWindow will substitute the size request of the surface or geometry widget. If the minimum size hint is not provided, GtkWindow will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, GtkWindow will take the minimum size as the minimum size of the geometry widget rather than the entire surface. The base size is treated similarly.

The canonical use-case for gtk_window_set_geometry_hints() is to get a terminal widget to resize properly. Here, the terminal text area should be the geometry widget; GtkWindow will then automatically set the base size to the size of other widgets in the terminal window, such as the menubar and scrollbar. Then, the width_inc and height_inc fields should be set to the size of one character in the terminal. Finally, the base size should be set to the size of one character. The net effect is that the minimum size of the terminal will have a 1x1 character terminal area, and only terminal sizes on the “character grid” will be allowed.

Here’s an example of how the terminal example would be implemented, assuming a terminal area widget called “terminal” and a toplevel window “toplevel”:

	GdkGeometry hints;

	hints.base_width = terminal->char_width;
        hints.base_height = terminal->char_height;
        hints.min_width = terminal->char_width;
        hints.min_height = terminal->char_height;
        hints.width_inc = terminal->char_width;
        hints.height_inc = terminal->char_height;

 gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
                                GTK_WIDGET (terminal),
                                &hints,
                                GDK_HINT_RESIZE_INC |
                                GDK_HINT_MIN_SIZE |
                                GDK_HINT_BASE_SIZE);

The other useful fields are the min_aspect and max_aspect fields; these contain a width/height ratio as a floating point number. If a geometry widget is set, the aspect applies to the geometry widget rather than the entire window. The most common use of these hints is probably to set min_aspect and max_aspect to the same value, thus forcing the window to keep a constant aspect ratio.

Members

gint min_width;

minimum width of surface (or -1 to use requisition, with GtkWindow only)

 

gint min_height;

minimum height of surface (or -1 to use requisition, with GtkWindow only)

 

gint max_width;

maximum width of surface (or -1 to use requisition, with GtkWindow only)

 

gint max_height;

maximum height of surface (or -1 to use requisition, with GtkWindow only)

 

gint base_width;

allowed surface widths are base_width + width_inc * N where N is any integer (-1 allowed with GtkWindow)

 

gint base_height;

allowed surface widths are base_height + height_inc * N where N is any integer (-1 allowed with GtkWindow)

 

gint width_inc;

width resize increment

 

gint height_inc;

height resize increment

 

gdouble min_aspect;

minimum width/height ratio

 

gdouble max_aspect;

maximum width/height ratio

 

GdkGravity win_gravity;

surface gravity, see gtk_window_set_gravity()

 

enum GdkGravity

Defines the reference point of a surface and the meaning of coordinates passed to gtk_window_move(). See gtk_window_move() and the "implementation notes" section of the Extended Window Manager Hints specification for more details.

Members

GDK_GRAVITY_NORTH_WEST

the reference point is at the top left corner.

 

GDK_GRAVITY_NORTH

the reference point is in the middle of the top edge.

 

GDK_GRAVITY_NORTH_EAST

the reference point is at the top right corner.

 

GDK_GRAVITY_WEST

the reference point is at the middle of the left edge.

 

GDK_GRAVITY_CENTER

the reference point is at the center of the surface.

 

GDK_GRAVITY_EAST

the reference point is at the middle of the right edge.

 

GDK_GRAVITY_SOUTH_WEST

the reference point is at the lower left corner.

 

GDK_GRAVITY_SOUTH

the reference point is at the middle of the lower edge.

 

GDK_GRAVITY_SOUTH_EAST

the reference point is at the lower right corner.

 

GDK_GRAVITY_STATIC

the reference point is at the top left corner of the surface itself, ignoring window manager decorations.

 

enum GdkAnchorHints

Positioning hints for aligning a surface relative to a rectangle.

These hints determine how the surface should be positioned in the case that the surface would fall off-screen if placed in its ideal position.

For example, GDK_ANCHOR_FLIP_X will replace GDK_GRAVITY_NORTH_WEST with GDK_GRAVITY_NORTH_EAST and vice versa if the surface extends beyond the left or right edges of the monitor.

If GDK_ANCHOR_SLIDE_X is set, the surface can be shifted horizontally to fit on-screen. If GDK_ANCHOR_RESIZE_X is set, the surface can be shrunken horizontally to fit.

In general, when multiple flags are set, flipping should take precedence over sliding, which should take precedence over resizing.

Members

GDK_ANCHOR_FLIP_X

allow flipping anchors horizontally

 

GDK_ANCHOR_FLIP_Y

allow flipping anchors vertically

 

GDK_ANCHOR_SLIDE_X

allow sliding surface horizontally

 

GDK_ANCHOR_SLIDE_Y

allow sliding surface vertically

 

GDK_ANCHOR_RESIZE_X

allow resizing surface horizontally

 

GDK_ANCHOR_RESIZE_Y

allow resizing surface vertically

 

GDK_ANCHOR_FLIP

allow flipping anchors on both axes

 

GDK_ANCHOR_SLIDE

allow sliding surface on both axes

 

GDK_ANCHOR_RESIZE

allow resizing surface on both axes

 

enum GdkSurfaceEdge

Determines a surface edge or corner.

Members

GDK_SURFACE_EDGE_NORTH_WEST

the top left corner.

 

GDK_SURFACE_EDGE_NORTH

the top edge.

 

GDK_SURFACE_EDGE_NORTH_EAST

the top right corner.

 

GDK_SURFACE_EDGE_WEST

the left edge.

 

GDK_SURFACE_EDGE_EAST

the right edge.

 

GDK_SURFACE_EDGE_SOUTH_WEST

the lower left corner.

 

GDK_SURFACE_EDGE_SOUTH

the lower edge.

 

GDK_SURFACE_EDGE_SOUTH_EAST

the lower right corner.

 

enum GdkSurfaceTypeHint

These are hints for the window manager that indicate what type of function the window has. The window manager can use this when determining decoration and behaviour of the window. The hint must be set before mapping the window.

See the Extended Window Manager Hints specification for more details about window types.

Members

GDK_SURFACE_TYPE_HINT_NORMAL

Normal toplevel window.

 

GDK_SURFACE_TYPE_HINT_DIALOG

Dialog window.

 

GDK_SURFACE_TYPE_HINT_MENU

Window used to implement a menu; GTK+ uses this hint only for torn-off menus, see GtkTearoffMenuItem.

 

GDK_SURFACE_TYPE_HINT_TOOLBAR

Window used to implement toolbars.

 

GDK_SURFACE_TYPE_HINT_SPLASHSCREEN

Window used to display a splash screen during application startup.

 

GDK_SURFACE_TYPE_HINT_UTILITY

Utility windows which are not detached toolbars or dialogs.

 

GDK_SURFACE_TYPE_HINT_DOCK

Used for creating dock or panel windows.

 

GDK_SURFACE_TYPE_HINT_DESKTOP

Used for creating the desktop background window.

 

GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU

A menu that belongs to a menubar.

 

GDK_SURFACE_TYPE_HINT_POPUP_MENU

A menu that does not belong to a menubar, e.g. a context menu.

 

GDK_SURFACE_TYPE_HINT_TOOLTIP

A tooltip.

 

GDK_SURFACE_TYPE_HINT_NOTIFICATION

A notification - typically a “bubble” that belongs to a status icon.

 

GDK_SURFACE_TYPE_HINT_COMBO

A popup from a combo box.

 

GDK_SURFACE_TYPE_HINT_DND

A window that is used to implement a DND cursor.

 

enum GdkSurfaceState

Specifies the state of a toplevel surface.

Members

GDK_SURFACE_STATE_WITHDRAWN

the surface is not shown.

 

GDK_SURFACE_STATE_ICONIFIED

the surface is minimized.

 

GDK_SURFACE_STATE_MAXIMIZED

the surface is maximized.

 

GDK_SURFACE_STATE_STICKY

the surface is sticky.

 

GDK_SURFACE_STATE_FULLSCREEN

the surface is maximized without decorations.

 

GDK_SURFACE_STATE_ABOVE

the surface is kept above other surfaces.

 

GDK_SURFACE_STATE_BELOW

the surface is kept below other surfaces.

 

GDK_SURFACE_STATE_FOCUSED

the surface is presented as focused (with active decorations).

 

GDK_SURFACE_STATE_TILED

the surface is in a tiled state. Deprecated

 

GDK_SURFACE_STATE_TOP_TILED

whether the top edge is tiled

 

GDK_SURFACE_STATE_TOP_RESIZABLE

whether the top edge is resizable

 

GDK_SURFACE_STATE_RIGHT_TILED

whether the right edge is tiled

 

GDK_SURFACE_STATE_RIGHT_RESIZABLE

whether the right edge is resizable

 

GDK_SURFACE_STATE_BOTTOM_TILED

whether the bottom edge is tiled

 

GDK_SURFACE_STATE_BOTTOM_RESIZABLE

whether the bottom edge is resizable

 

GDK_SURFACE_STATE_LEFT_TILED

whether the left edge is tiled

 

GDK_SURFACE_STATE_LEFT_RESIZABLE

whether the left edge is resizable

 

enum GdkFullscreenMode

Indicates which monitor (in a multi-head setup) a surface should span over when in fullscreen mode.

Members

GDK_FULLSCREEN_ON_CURRENT_MONITOR

Fullscreen on current monitor only.

 

GDK_FULLSCREEN_ON_ALL_MONITORS

Span across all monitors when fullscreen.

 

GDK_PARENT_RELATIVE

#define GDK_PARENT_RELATIVE  1L

A special value, indicating that the background for a surface should be inherited from the parent surface.


enum GdkModifierType

A set of bit-flags to indicate the state of modifier keys and mouse buttons in various event types. Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.

Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.

GDK recognizes which of the Meta, Super or Hyper keys are mapped to Mod2 - Mod5, and indicates this by setting GDK_SUPER_MASK, GDK_HYPER_MASK or GDK_META_MASK in the state field of key events.

Note that GDK may add internal values to events which include reserved values such as GDK_MODIFIER_RESERVED_13_MASK. Your code should preserve and ignore them. You can use GDK_MODIFIER_MASK to remove all reserved values.

Also note that the GDK X backend interprets button press events for button 4-7 as scroll events, so GDK_BUTTON4_MASK and GDK_BUTTON5_MASK will never be set.

Members

GDK_SHIFT_MASK

the Shift key.

 

GDK_LOCK_MASK

a Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock).

 

GDK_CONTROL_MASK

the Control key.

 

GDK_MOD1_MASK

the fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key).

 

GDK_MOD2_MASK

the fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

GDK_MOD3_MASK

the sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

GDK_MOD4_MASK

the seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

GDK_MOD5_MASK

the eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

GDK_BUTTON1_MASK

the first mouse button.

 

GDK_BUTTON2_MASK

the second mouse button.

 

GDK_BUTTON3_MASK

the third mouse button.

 

GDK_BUTTON4_MASK

the fourth mouse button.

 

GDK_BUTTON5_MASK

the fifth mouse button.

 

GDK_MODIFIER_RESERVED_13_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_14_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_15_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_16_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_17_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_18_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_19_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_20_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_21_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_22_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_23_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_24_MASK

A reserved bit flag; do not use in your own code

 

GDK_MODIFIER_RESERVED_25_MASK

A reserved bit flag; do not use in your own code

 

GDK_SUPER_MASK

the Super modifier

 

GDK_HYPER_MASK

the Hyper modifier

 

GDK_META_MASK

the Meta modifier

 

GDK_MODIFIER_RESERVED_29_MASK

A reserved bit flag; do not use in your own code

 

GDK_RELEASE_MASK

not used in GDK itself. GTK+ uses it to differentiate between (keyval, modifiers) pairs from key press and release events.

 

GDK_MODIFIER_MASK

a mask covering all modifier types.

 

enum GdkModifierIntent

This enum is used with gdk_keymap_get_modifier_mask() in order to determine what modifiers the currently used windowing system backend uses for particular purposes. For example, on X11/Windows, the Control key is used for invoking menu shortcuts (accelerators), whereas on Apple computers it’s the Command key (which correspond to GDK_CONTROL_MASK and GDK_MOD2_MASK, respectively).

Members

GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR

the primary modifier used to invoke menu accelerators.

 

GDK_MODIFIER_INTENT_CONTEXT_MENU

the modifier used to invoke context menus. Note that mouse button 3 always triggers context menus. When this modifier is not 0, it additionally triggers context menus when used with mouse button 1.

 

GDK_MODIFIER_INTENT_EXTEND_SELECTION

the modifier used to extend selections using modifier-click or modifier-cursor-key

 

GDK_MODIFIER_INTENT_MODIFY_SELECTION

the modifier used to modify selections, which in most cases means toggling the clicked item into or out of the selection.

 

GDK_MODIFIER_INTENT_NO_TEXT_INPUT

when any of these modifiers is pressed, the key event cannot produce a symbol directly. This is meant to be used for input methods, and for use cases like typeahead search.

 

GDK_MODIFIER_INTENT_SHIFT_GROUP

the modifier that switches between keyboard groups (AltGr on X11/Windows and Option/Alt on OS X).

 

GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK

The set of modifier masks accepted as modifiers in accelerators. Needed because Command is mapped to MOD2 on OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a mod key is problematic at best. Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.

 

enum GdkWMDecoration

These are hints originally defined by the Motif toolkit. The window manager can use them when determining how to decorate the surface. The hint must be set before mapping the surface.

Members

GDK_DECOR_ALL

all decorations should be applied.

 

GDK_DECOR_BORDER

a frame should be drawn around the surface.

 

GDK_DECOR_RESIZEH

the frame should have resize handles.

 

GDK_DECOR_TITLE

a titlebar should be placed above the surface.

 

GDK_DECOR_MENU

a button for opening a menu should be included.

 

GDK_DECOR_MINIMIZE

a minimize button should be included.

 

GDK_DECOR_MAXIMIZE

a maximize button should be included.

 

enum GdkWMFunction

These are hints originally defined by the Motif toolkit. The window manager can use them when determining the functions to offer for the surface. The hint must be set before mapping the surface.

Members

GDK_FUNC_ALL

all functions should be offered.

 

GDK_FUNC_RESIZE

the surface should be resizable.

 

GDK_FUNC_MOVE

the surface should be movable.

 

GDK_FUNC_MINIMIZE

the surface should be minimizable.

 

GDK_FUNC_MAXIMIZE

the surface should be maximizable.

 

GDK_FUNC_CLOSE

the surface should be closable.

 

Property Details

The “cursor” property

  “cursor”                   GdkCursor *

The mouse pointer for a GdkSurface. See gdk_surface_set_cursor() and gdk_surface_get_cursor() for details.

Flags: Read / Write


The “display” property

  “display”                  GdkDisplay *

The GdkDisplay connection of the surface. See gdk_surface_get_display() for details.

Flags: Read / Write / Construct Only


The “state” property

  “state”                    GdkSurfaceState

State.

Flags: Read

Default value: GDK_SURFACE_STATE_WITHDRAWN

Signal Details

The “moved-to-rect” signal

void
user_function (GdkSurface *surface,
               gpointer    flipped_rect,
               gpointer    final_rect,
               gboolean    flipped_x,
               gboolean    flipped_y,
               gpointer    user_data)

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.

Parameters

surface

the GdkSurface that moved

 

flipped_rect

the position of surface after any possible flipping or NULL if the backend can't obtain it.

[nullable]

final_rect

the final position of surface or NULL if the backend can't obtain it.

[nullable]

flipped_x

TRUE if the anchors were flipped horizontally

 

flipped_y

TRUE if the anchors were flipped vertically

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Stability Level: Private