Used to represent native events (XEvents for the X11
backend, MSGs for Win32).
Converts a #GdkAtom into a pointer type.
a #GdkAtom.
Positioning hints for aligning a window relative to a rectangle.
These hints determine how the window should be positioned in the case that
the window 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 window extends beyond the left
or right edges of the monitor.
If %GDK_ANCHOR_SLIDE_X is set, the window can be shifted horizontally to fit
on-screen. If %GDK_ANCHOR_RESIZE_X is set, the window 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.
allow flipping anchors horizontally
allow flipping anchors vertically
allow sliding window horizontally
allow sliding window vertically
allow resizing window horizontally
allow resizing window vertically
allow flipping anchors on both axes
allow sliding window on both axes
allow resizing window on both axes
GdkAppLaunchContext is an implementation of #GAppLaunchContext that
handles launching an application in a graphical context. It provides
startup notification and allows to launch applications on a specific
screen or workspace.
## Launching an application
|[<!-- language="C" -->
GdkAppLaunchContext *context;
context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (screen);
gdk_app_launch_context_set_timestamp (event->time);
if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
g_warning ("Launching failed: %s\n", error->message);
g_object_unref (context);
]|
Creates a new #GdkAppLaunchContext.
Use gdk_display_get_app_launch_context() instead
a new #GdkAppLaunchContext
Sets the workspace on which applications will be launched when
using this context when running under a window manager that
supports multiple workspaces, as described in the
[Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
When the workspace is not specified or @desktop is set to -1,
it is up to the window manager to pick one, typically it will
be the current workspace.
a #GdkAppLaunchContext
the number of a workspace, or -1
Sets the display on which applications will be launched when
using this context. See also gdk_app_launch_context_set_screen().
Use gdk_display_get_app_launch_context() instead
a #GdkAppLaunchContext
a #GdkDisplay
Sets the icon for applications that are launched with this
context.
Window Managers can use this information when displaying startup
notification.
See also gdk_app_launch_context_set_icon_name().
a #GdkAppLaunchContext
a #GIcon, or %NULL
Sets the icon for applications that are launched with this context.
The @icon_name will be interpreted in the same way as the Icon field
in desktop files. See also gdk_app_launch_context_set_icon().
If both @icon and @icon_name are set, the @icon_name takes priority.
If neither @icon or @icon_name is set, the icon is taken from either
the file that is passed to launched application or from the #GAppInfo
for the launched application itself.
a #GdkAppLaunchContext
an icon name, or %NULL
Sets the screen on which applications will be launched when
using this context. See also gdk_app_launch_context_set_display().
Note that, typically, a #GdkScreen represents a logical screen,
not a physical monitor.
If both @screen and @display are set, the @screen takes priority.
If neither @screen or @display are set, the default screen and
display are used.
a #GdkAppLaunchContext
a #GdkScreen
Sets the timestamp of @context. The timestamp should ideally
be taken from the event that triggered the launch.
Window managers can use this information to avoid moving the
focus to the newly launched application when the user is busy
typing in another window. This is also known as 'focus stealing
prevention'.
a #GdkAppLaunchContext
a timestamp
An opaque type representing a string as an index into a table
of strings on the X server.
Determines the string corresponding to an atom.
a newly-allocated string containing the string
corresponding to @atom. When you are done with the
return value, you should free it using g_free().
a #GdkAtom.
Finds or creates an atom corresponding to a given string.
the atom corresponding to @atom_name.
a string.
if %TRUE, GDK is allowed to not create a new atom, but
just return %GDK_NONE if the requested atom doesn’t already
exists. Currently, the flag is ignored, since checking the
existance of an atom is as expensive as creating it.
Finds or creates an atom corresponding to a given string.
Note that this function is identical to gdk_atom_intern() except
that if a new #GdkAtom is created the string itself is used rather
than a copy. This saves memory, but can only be used if the string
will always exist. It can be used with statically
allocated strings in the main program, but not with statically
allocated memory in dynamically loaded modules, if you expect to
ever unload the module again (e.g. do not use this function in
GTK+ theme engines).
the atom corresponding to @atom_name
a static string
Flags describing the current capabilities of a device/tool.
X axis is present
Y axis is present
Pressure axis is present
X tilt axis is present
Y tilt axis is present
Wheel axis is present
Distance axis is present
Z-axis rotation is present
Slider axis is present
An enumeration describing the way in which a device
axis (valuator) maps onto the predefined valuator
types that GTK+ understands.
Note that the X and Y axes are not really needed; pointer devices
report their location via the x/y members of events regardless. Whether
X and Y are present as axes depends on the GDK backend.
the axis is ignored.
the axis is used as the x axis.
the axis is used as the y axis.
the axis is used for pressure information.
the axis is used for x tilt information.
the axis is used for y tilt information.
the axis is used for wheel information.
the axis is used for pen/tablet distance information. (Since: 3.22)
the axis is used for pen rotation information. (Since: 3.22)
the axis is used for pen slider information. (Since: 3.22)
a constant equal to the numerically highest axis value.
The middle button.
The primary button. This is typically the left mouse button, or the
right button in a left-handed setup.
The secondary button. This is typically the right mouse button, or the
left button in a left-handed setup.
A set of values describing the possible byte-orders
for storing pixel values in memory.
The values are stored with the least-significant byte
first. For instance, the 32-bit value 0xffeecc would be stored
in memory as 0xcc, 0xee, 0xff, 0x00.
The values are stored with the most-significant byte
first. For instance, the 32-bit value 0xffeecc would be stored
in memory as 0x00, 0xff, 0xee, 0xcc.
Represents the current time, and can be used anywhere a time is expected.
A #GdkColor is used to describe a color,
similar to the XColor struct used in the X11 drawing API.
Use #GdkRGBA
For allocated colors, the pixel value used to
draw this color on the screen. Not used anymore.
The red component of the color. This is
a value between 0 and 65535, with 65535 indicating
full intensity
The green component of the color
The blue component of the color
Makes a copy of a #GdkColor.
The result must be freed using gdk_color_free().
Use #GdkRGBA
a copy of @color
a #GdkColor
Compares two colors.
Use #GdkRGBA
%TRUE if the two colors compare equal
a #GdkColor
another #GdkColor
Frees a #GdkColor created with gdk_color_copy().
Use #GdkRGBA
a #GdkColor
A hash function suitable for using for a hash
table that stores #GdkColors.
Use #GdkRGBA
The hash function applied to @color
a #GdkColor
Returns a textual specification of @color in the hexadecimal
form “\#rrrrggggbbbb” where “r”, “g” and “b” are hex digits
representing the red, green and blue components respectively.
The returned string can be parsed by gdk_color_parse().
Use #GdkRGBA
a newly-allocated text string
a #GdkColor
Parses a textual specification of a color and fill in the
@red, @green, and @blue fields of a #GdkColor.
The string can either one of a large set of standard names
(taken from the X11 `rgb.txt` file), or it can be a hexadecimal
value in the form “\#rgb” “\#rrggbb”, “\#rrrgggbbb” or
“\#rrrrggggbbbb” where “r”, “g” and “b” are hex digits of
the red, green, and blue components of the color, respectively.
(White in the four forms is “\#fff”, “\#ffffff”, “\#fffffffff”
and “\#ffffffffffff”).
Use #GdkRGBA
%TRUE if the parsing succeeded
the string specifying the color
the #GdkColor to fill in
Specifies the crossing mode for #GdkEventCrossing.
crossing because of pointer motion.
crossing because a grab is activated.
crossing because a grab is deactivated.
crossing because a GTK+ grab is activated.
crossing because a GTK+ grab is deactivated.
crossing because a GTK+ widget changed
state (e.g. sensitivity).
crossing because a touch sequence has begun,
this event is synthetic as the pointer might have not left the window.
crossing because a touch sequence has ended,
this event is synthetic as the pointer might have not left the window.
crossing because of a device switch (i.e.
a mouse taking control of the pointer after a touch device), this event
is synthetic as the pointer didn’t leave the window.
A #GdkCursor represents a cursor. Its contents are private.
Creates a new cursor from the set of builtin cursors for the default display.
See gdk_cursor_new_for_display().
To make the cursor invisible, use %GDK_BLANK_CURSOR.
Use gdk_cursor_new_for_display() instead.
a new #GdkCursor
cursor to create
Creates a new cursor from the set of builtin cursors.
a new #GdkCursor, or %NULL on failure
the #GdkDisplay for which the cursor will be created
cursor to create
Creates a new cursor by looking up @name in the current cursor
theme.
A recommended set of cursor names that will work across different
platforms can be found in the CSS specification:
- "none"
- ![](default_cursor.png) "default"
- ![](help_cursor.png) "help"
- ![](pointer_cursor.png) "pointer"
- ![](context_menu_cursor.png) "context-menu"
- ![](progress_cursor.png) "progress"
- ![](wait_cursor.png) "wait"
- ![](cell_cursor.png) "cell"
- ![](crosshair_cursor.png) "crosshair"
- ![](text_cursor.png) "text"
- ![](vertical_text_cursor.png) "vertical-text"
- ![](alias_cursor.png) "alias"
- ![](copy_cursor.png) "copy"
- ![](no_drop_cursor.png) "no-drop"
- ![](move_cursor.png) "move"
- ![](not_allowed_cursor.png) "not-allowed"
- ![](grab_cursor.png) "grab"
- ![](grabbing_cursor.png) "grabbing"
- ![](all_scroll_cursor.png) "all-scroll"
- ![](col_resize_cursor.png) "col-resize"
- ![](row_resize_cursor.png) "row-resize"
- ![](n_resize_cursor.png) "n-resize"
- ![](e_resize_cursor.png) "e-resize"
- ![](s_resize_cursor.png) "s-resize"
- ![](w_resize_cursor.png) "w-resize"
- ![](ne_resize_cursor.png) "ne-resize"
- ![](nw_resize_cursor.png) "nw-resize"
- ![](sw_resize_cursor.png) "sw-resize"
- ![](se_resize_cursor.png) "se-resize"
- ![](ew_resize_cursor.png) "ew-resize"
- ![](ns_resize_cursor.png) "ns-resize"
- ![](nesw_resize_cursor.png) "nesw-resize"
- ![](nwse_resize_cursor.png) "nwse-resize"
- ![](zoom_in_cursor.png) "zoom-in"
- ![](zoom_out_cursor.png) "zoom-out"
a new #GdkCursor, or %NULL if there is no
cursor with the given name
the #GdkDisplay for which the cursor will be created
the name of the cursor
Creates a new cursor from a pixbuf.
Not all GDK backends support RGBA cursors. If they are not
supported, a monochrome approximation will be displayed.
The functions gdk_display_supports_cursor_alpha() and
gdk_display_supports_cursor_color() can be used to determine
whether RGBA cursors are supported;
gdk_display_get_default_cursor_size() and
gdk_display_get_maximal_cursor_size() give information about
cursor sizes.
If @x or @y are `-1`, the pixbuf must have
options named “x_hot” and “y_hot”, resp., containing
integer values between `0` and the width resp. height of
the pixbuf. (Since: 3.0)
On the X backend, support for RGBA cursors requires a
sufficently new version of the X Render extension.
a new #GdkCursor.
the #GdkDisplay for which the cursor will be created
the #GdkPixbuf containing the cursor image
the horizontal offset of the “hotspot” of the cursor.
the vertical offset of the “hotspot” of the cursor.
Creates a new cursor from a cairo image surface.
Not all GDK backends support RGBA cursors. If they are not
supported, a monochrome approximation will be displayed.
The functions gdk_display_supports_cursor_alpha() and
gdk_display_supports_cursor_color() can be used to determine
whether RGBA cursors are supported;
gdk_display_get_default_cursor_size() and
gdk_display_get_maximal_cursor_size() give information about
cursor sizes.
On the X backend, support for RGBA cursors requires a
sufficently new version of the X Render extension.
a new #GdkCursor.
the #GdkDisplay for which the cursor will be created
the cairo image surface containing the cursor pixel data
the horizontal offset of the “hotspot” of the cursor
the vertical offset of the “hotspot” of the cursor
Returns the cursor type for this cursor.
a #GdkCursorType
a #GdkCursor
Returns the display on which the #GdkCursor is defined.
the #GdkDisplay associated to @cursor
a #GdkCursor.
Returns a #GdkPixbuf with the image used to display the cursor.
Note that depending on the capabilities of the windowing system and
on the cursor, GDK may not be able to obtain the image data. In this
case, %NULL is returned.
a #GdkPixbuf representing
@cursor, or %NULL
a #GdkCursor
Returns a cairo image surface with the image used to display the cursor.
Note that depending on the capabilities of the windowing system and
on the cursor, GDK may not be able to obtain the image data. In this
case, %NULL is returned.
a #cairo_surface_t
representing @cursor, or %NULL
a #GdkCursor
Location to store the hotspot x position,
or %NULL
Location to store the hotspot y position,
or %NULL
Adds a reference to @cursor.
Use g_object_ref() instead
Same @cursor that was passed in
a #GdkCursor
Removes a reference from @cursor, deallocating the cursor
if no references remain.
Use g_object_unref() instead
a #GdkCursor
Predefined cursors.
Note that these IDs are directly taken from the X cursor font, and many
of these cursors are either not useful, or are not available on other platforms.
The recommended way to create cursors is to use gdk_cursor_new_from_name().
![](X_cursor.png)
![](arrow.png)
![](based_arrow_down.png)
![](based_arrow_up.png)
![](boat.png)
![](bogosity.png)
![](bottom_left_corner.png)
![](bottom_right_corner.png)
![](bottom_side.png)
![](bottom_tee.png)
![](box_spiral.png)
![](center_ptr.png)
![](circle.png)
![](clock.png)
![](coffee_mug.png)
![](cross.png)
![](cross_reverse.png)
![](crosshair.png)
![](diamond_cross.png)
![](dot.png)
![](dotbox.png)
![](double_arrow.png)
![](draft_large.png)
![](draft_small.png)
![](draped_box.png)
![](exchange.png)
![](fleur.png)
![](gobbler.png)
![](gumby.png)
![](hand1.png)
![](hand2.png)
![](heart.png)
![](icon.png)
![](iron_cross.png)
![](left_ptr.png)
![](left_side.png)
![](left_tee.png)
![](leftbutton.png)
![](ll_angle.png)
![](lr_angle.png)
![](man.png)
![](middlebutton.png)
![](mouse.png)
![](pencil.png)
![](pirate.png)
![](plus.png)
![](question_arrow.png)
![](right_ptr.png)
![](right_side.png)
![](right_tee.png)
![](rightbutton.png)
![](rtl_logo.png)
![](sailboat.png)
![](sb_down_arrow.png)
![](sb_h_double_arrow.png)
![](sb_left_arrow.png)
![](sb_right_arrow.png)
![](sb_up_arrow.png)
![](sb_v_double_arrow.png)
![](shuttle.png)
![](sizing.png)
![](spider.png)
![](spraycan.png)
![](star.png)
![](target.png)
![](tcross.png)
![](top_left_arrow.png)
![](top_left_corner.png)
![](top_right_corner.png)
![](top_side.png)
![](top_tee.png)
![](trek.png)
![](ul_angle.png)
![](umbrella.png)
![](ur_angle.png)
![](watch.png)
![](xterm.png)
last cursor type
Blank cursor. Since 2.16
type of cursors constructed with
gdk_cursor_new_from_pixbuf()
The #GdkDevice object represents a single input device, such
as a keyboard, a mouse, a touchpad, etc.
See the #GdkDeviceManager documentation for more information
about the various kinds of master and slave devices, and their
relationships.
Frees an array of #GdkTimeCoord that was returned by gdk_device_get_history().
an array of #GdkTimeCoord.
the length of the array.
Determines information about the current keyboard grab.
This is not public API and must not be used by applications.
The symbol was never meant to be used outside
of GTK+
%TRUE if this application currently has the
keyboard grabbed.
the display for which to get the grab information
device to get the grab information from
location to store current grab window
location to store boolean indicating whether
the @owner_events flag to gdk_keyboard_grab() or
gdk_pointer_grab() was %TRUE.
Returns the associated device to @device, if @device is of type
%GDK_DEVICE_TYPE_MASTER, it will return the paired pointer or
keyboard.
If @device is of type %GDK_DEVICE_TYPE_SLAVE, it will return
the master device to which @device is attached to.
If @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
returned, as there is no associated device.
The associated device, or
%NULL
a #GdkDevice
Returns the axes currently available on the device.
a #GdkDevice
Interprets an array of double as axis values for a given device,
and locates the value in the array for a given axis use.
%TRUE if the given axis use was found, otherwise %FALSE
a #GdkDevice
pointer to an array of axes
the use to look for
location to store the found value.
Returns the axis use for @index_.
a #GdkAxisUse specifying how the axis is used.
a pointer #GdkDevice.
the index of the axis.
Interprets an array of double as axis values for a given device,
and locates the value in the array for a given axis label, as returned
by gdk_device_list_axes()
%TRUE if the given axis use was found, otherwise %FALSE.
a pointer #GdkDevice.
pointer to an array of axes
#GdkAtom with the axis label.
location to store the found value.
Returns the device type for @device.
the #GdkDeviceType for @device.
a #GdkDevice
Returns the #GdkDisplay to which @device pertains.
a #GdkDisplay. This memory is owned
by GTK+, and must not be freed or unreffed.
a #GdkDevice
Determines whether the pointer follows device motion.
This is not meaningful for keyboard devices, which don't have a pointer.
%TRUE if the pointer follows device motion
a #GdkDevice
Obtains the motion history for a pointer device; given a starting and
ending timestamp, return all events in the motion history for
the device in the given range of time. Some windowing systems
do not support motion history, in which case, %FALSE will
be returned. (This is not distinguishable from the case where
motion history is supported and no events were found.)
Note that there is also gdk_window_set_event_compression() to get
more motion events delivered directly, independent of the windowing
system.
%TRUE if the windowing system supports motion history and
at least one event was found.
a #GdkDevice
the window with respect to which which the event coordinates will be reported
starting timestamp for range of events to return
ending timestamp for the range of events to return
location to store a newly-allocated array of #GdkTimeCoord, or
%NULL
location to store the length of
@events, or %NULL
If @index_ has a valid keyval, this function will return %TRUE
and fill in @keyval and @modifiers with the keyval settings.
%TRUE if keyval is set for @index.
a #GdkDevice.
the index of the macro button to get.
return value for the keyval.
return value for modifiers.
Gets information about which window the given pointer device is in, based on events
that have been received so far from the display server. If another application
has a pointer grab, or this application has a grab with owner_events = %FALSE,
%NULL may be returned even if the pointer is physically over one of this
application's windows.
the last window the device
a #GdkDevice, with a source other than %GDK_SOURCE_KEYBOARD
Determines the mode of the device.
a #GdkInputSource
a #GdkDevice
Returns the number of axes the device currently has.
the number of axes.
a pointer #GdkDevice
Returns the number of keys the device currently has.
the number of keys.
a #GdkDevice
Determines the name of the device.
a name
a #GdkDevice
Gets the current location of @device. As a slave device
coordinates are those of its master pointer, This function
may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
unless there is an ongoing grab on them, see gdk_device_grab().
pointer device to query status about.
location to store the #GdkScreen
the @device is on, or %NULL.
location to store root window X coordinate of @device, or %NULL.
location to store root window Y coordinate of @device, or %NULL.
Gets the current location of @device in double precision. As a slave device's
coordinates are those of its master pointer, this function
may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
unless there is an ongoing grab on them. See gdk_device_grab().
pointer device to query status about.
location to store the #GdkScreen
the @device is on, or %NULL.
location to store root window X coordinate of @device, or %NULL.
location to store root window Y coordinate of @device, or %NULL.
Returns the product ID of this device, or %NULL if this information couldn't
be obtained. This ID is retrieved from the device, and is thus constant for
it. See gdk_device_get_vendor_id() for more information.
the product ID, or %NULL
a slave #GdkDevice
Returns the #GdkSeat the device belongs to.
A #GdkSeat. This memory is owned by GTK+ and
must not be freed.
A #GdkDevice
Determines the type of the device.
a #GdkInputSource
a #GdkDevice
Gets the current state of a pointer device relative to @window. As a slave
device’s coordinates are those of its master pointer, this
function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
unless there is an ongoing grab on them. See gdk_device_grab().
a #GdkDevice.
a #GdkWindow.
an array of doubles to store the values of
the axes of @device in, or %NULL.
location to store the modifiers, or %NULL.
Returns the vendor ID of this device, or %NULL if this information couldn't
be obtained. This ID is retrieved from the device, and is thus constant for
it.
This function, together with gdk_device_get_product_id(), can be used to eg.
compose #GSettings paths to store settings for this device.
|[<!-- language="C" -->
static GSettings *
get_device_settings (GdkDevice *device)
{
const gchar *vendor, *product;
GSettings *settings;
GdkDevice *device;
gchar *path;
vendor = gdk_device_get_vendor_id (device);
product = gdk_device_get_product_id (device);
path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
g_free (path);
return settings;
}
]|
the vendor ID, or %NULL
a slave #GdkDevice
Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
%NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
As a slave device coordinates are those of its master pointer, This
function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
unless there is an ongoing grab on them, see gdk_device_grab().
the #GdkWindow under the
device position, or %NULL.
pointer #GdkDevice to query info to.
return location for the X coordinate of the device location,
relative to the window origin, or %NULL.
return location for the Y coordinate of the device location,
relative to the window origin, or %NULL.
Obtains the window underneath @device, returning the location of the device in @win_x and @win_y in
double precision. Returns %NULL if the window tree under @device is not known to GDK (for example,
belongs to another application).
As a slave device coordinates are those of its master pointer, This
function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
unless there is an ongoing grab on them, see gdk_device_grab().
the #GdkWindow under the
device position, or %NULL.
pointer #GdkDevice to query info to.
return location for the X coordinate of the device location,
relative to the window origin, or %NULL.
return location for the Y coordinate of the device location,
relative to the window origin, or %NULL.
Grabs the device so that all events coming from this device are passed to
this application until the device is ungrabbed with gdk_device_ungrab(),
or the window becomes unviewable. This overrides any previous grab on the device
by this client.
Note that @device and @window need to be on the same display.
Device grabs are used for operations which need complete control over the
given device events (either pointer or keyboard). For example in GTK+ this
is used for Drag and Drop operations, popup menus and such.
Note that if the event mask of an X window has selected both button press
and button release events, then a button press event will cause an automatic
pointer grab until the button is released. X does this automatically since
most applications expect to receive button press and release events in pairs.
It is equivalent to a pointer grab on the window with @owner_events set to
%TRUE.
If you set up anything at the time you take the grab that needs to be
cleaned up when the grab ends, you should handle the #GdkEventGrabBroken
events that are emitted when the grab ends unvoluntarily.
Use gdk_seat_grab() instead.
%GDK_GRAB_SUCCESS if the grab was successful.
a #GdkDevice. To get the device you can use gtk_get_current_event_device()
or gdk_event_get_device() if the grab is in reaction to an event. Also, you can use
gdk_device_manager_get_client_pointer() but only in code that isn’t triggered by a
#GdkEvent and there aren’t other means to get a meaningful #GdkDevice to operate on.
the #GdkWindow which will own the grab (the grab window)
specifies the grab ownership.
if %FALSE then all device events are reported with respect to
@window and are only reported if selected by @event_mask. If
%TRUE then pointer events for this application are reported
as normal, but pointer events outside this application are
reported with respect to @window and only if selected by
@event_mask. In either mode, unreported events are discarded.
specifies the event mask, which is used in accordance with
@owner_events.
the cursor to display while the grab is active if the device is
a pointer. If this is %NULL then the normal cursors are used for
@window and its descendants, and the cursor for @window is used
elsewhere.
the timestamp of the event which led to this pointer grab. This
usually comes from the #GdkEvent struct, though %GDK_CURRENT_TIME
can be used if the time isn’t known.
Returns a #GList of #GdkAtoms, containing the labels for
the axes that @device currently has.
A #GList of #GdkAtoms, free with g_list_free().
a pointer #GdkDevice
If the device if of type %GDK_DEVICE_TYPE_MASTER, it will return
the list of slave devices attached to it, otherwise it will return
%NULL
the list of slave devices, or %NULL. The list must be
freed with g_list_free(), the contents of the list are
owned by GTK+ and should not be freed.
a #GdkDevice
Specifies how an axis of a device is used.
a pointer #GdkDevice
the index of the axis
specifies how the axis is used
Specifies the X key event to generate when a macro button of a device
is pressed.
a #GdkDevice
the index of the macro button to set
the keyval to generate
the modifiers to set
Sets a the mode of an input device. The mode controls if the
device is active and whether the device’s range is mapped to the
entire screen or to a single window.
Note: This is only meaningful for floating devices, master devices (and
slaves connected to these) drive the pointer cursor, which is not limited
by the input mode.
%TRUE if the mode was successfully changed.
a #GdkDevice.
the input mode.
Release any grab on @device.
Use gdk_seat_ungrab() instead.
a #GdkDevice
a timestap (e.g. %GDK_CURRENT_TIME).
Warps @device in @display to the point @x,@y on
the screen @screen, unless the device is confined
to a window by a grab, in which case it will be moved
as far as allowed by the grab. Warping the pointer
creates events as if the user had moved the mouse
instantaneously to the destination.
Note that the pointer should normally be under the
control of the user. This function was added to cover
some rare use cases like keyboard navigation support
for the color picker in the #GtkColorSelectionDialog.
the device to warp.
the screen to warp @device to.
the X coordinate of the destination.
the Y coordinate of the destination.
Associated pointer or keyboard with this device, if any. Devices of type #GDK_DEVICE_TYPE_MASTER
always come in keyboard/pointer pairs. Other device types will have a %NULL associated device.
The axes currently available for this device.
The #GdkDeviceManager the #GdkDevice pertains to.
The #GdkDisplay the #GdkDevice pertains to.
Whether the device is represented by a cursor on the screen. Devices of type
%GDK_DEVICE_TYPE_MASTER will have %TRUE here.
Source type for the device.
Number of axes in the device.
The device name.
The maximal number of concurrent touches on a touch device.
Will be 0 if the device is not a touch device or if the number
of touches is unknown.
Product ID of this device, see gdk_device_get_product_id().
#GdkSeat of this device.
Device role in the device manager.
Vendor ID of this device, see gdk_device_get_vendor_id().
The ::changed signal is emitted either when the #GdkDevice
has changed the number of either axes or keys. For example
In X this will normally happen when the slave device routing
events through the master device changes (for example, user
switches from the USB mouse to a tablet), in that case the
master device will change to reflect the new slave device
axes and keys.
The ::tool-changed signal is emitted on pen/eraser
#GdkDevices whenever tools enter or leave proximity.
The new current tool
In addition to a single pointer and keyboard for user interface input,
GDK contains support for a variety of input devices, including graphics
tablets, touchscreens and multiple pointers/keyboards interacting
simultaneously with the user interface. Such input devices often have
additional features, such as sub-pixel positioning information and
additional device-dependent information.
In order to query the device hierarchy and be aware of changes in the
device hierarchy (such as virtual devices being created or removed, or
physical devices being plugged or unplugged), GDK provides
#GdkDeviceManager.
By default, and if the platform supports it, GDK is aware of multiple
keyboard/pointer pairs and multitouch devices. This behavior can be
changed by calling gdk_disable_multidevice() before gdk_display_open().
There should rarely be a need to do that though, since GDK defaults
to a compatibility mode in which it will emit just one enter/leave
event pair for all devices on a window. To enable per-device
enter/leave events and other multi-pointer interaction features,
gdk_window_set_support_multidevice() must be called on
#GdkWindows (or gtk_widget_set_support_multidevice() on widgets).
window. See the gdk_window_set_support_multidevice() documentation
for more information.
On X11, multi-device support is implemented through XInput 2.
Unless gdk_disable_multidevice() is called, the XInput 2
#GdkDeviceManager implementation will be used as the input source.
Otherwise either the core or XInput 1 implementations will be used.
For simple applications that don’t have any special interest in
input devices, the so-called “client pointer”
provides a reasonable approximation to a simple setup with a single
pointer and keyboard. The device that has been set as the client
pointer can be accessed via gdk_device_manager_get_client_pointer().
Conceptually, in multidevice mode there are 2 device types. Virtual
devices (or master devices) are represented by the pointer cursors
and keyboard foci that are seen on the screen. Physical devices (or
slave devices) represent the hardware that is controlling the virtual
devices, and thus have no visible cursor on the screen.
Virtual devices are always paired, so there is a keyboard device for every
pointer device. Associations between devices may be inspected through
gdk_device_get_associated_device().
There may be several virtual devices, and several physical devices could
be controlling each of these virtual devices. Physical devices may also
be “floating”, which means they are not attached to any virtual device.
# Master and slave devices
|[
carlos@sacarino:~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Finger touch id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen eraser id=16 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Integrated Camera id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=15 [slave keyboard (3)]
]|
By default, GDK will automatically listen for events coming from all
master devices, setting the #GdkDevice for all events coming from input
devices. Events containing device information are #GDK_MOTION_NOTIFY,
#GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS, #GDK_3BUTTON_PRESS,
#GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE,
#GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE,
#GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT, #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE,
#GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED
and #GDK_GRAB_BROKEN. When dealing with an event on a master device,
it is possible to get the source (slave) device that the event originated
from via gdk_event_get_source_device().
On a standard session, all physical devices are connected by default to
the "Virtual Core Pointer/Keyboard" master devices, hence routing all events
through these. This behavior is only modified by device grabs, where the
slave device is temporarily detached for as long as the grab is held, and
more permanently by user modifications to the device hierarchy.
On certain application specific setups, it may make sense
to detach a physical device from its master pointer, and mapping it to
an specific window. This can be achieved by the combination of
gdk_device_grab() and gdk_device_set_mode().
In order to listen for events coming from devices
other than a virtual device, gdk_window_set_device_events() must be
called. Generally, this function can be used to modify the event mask
for any given device.
Input devices may also provide additional information besides X/Y.
For example, graphics tablets may also provide pressure and X/Y tilt
information. This information is device-dependent, and may be
queried through gdk_device_get_axis(). In multidevice mode, virtual
devices will change axes in order to always represent the physical
device that is routing events through it. Whenever the physical device
changes, the #GdkDevice:n-axes property will be notified, and
gdk_device_list_axes() will return the new device axes.
Devices may also have associated “keys” or
macro buttons. Such keys can be globally set to map into normal X
keyboard events. The mapping is set using gdk_device_set_key().
In GTK+ 3.20, a new #GdkSeat object has been introduced that
supersedes #GdkDeviceManager and should be preferred in newly
written code.
Returns the client pointer, that is, the master pointer that acts as the core pointer
for this application. In X11, window managers may change this depending on the interaction
pattern under the presence of several pointers.
You should use this function seldomly, only in code that isn’t triggered by a #GdkEvent
and there aren’t other means to get a meaningful #GdkDevice to operate on.
Use gdk_seat_get_pointer() instead.
The client pointer. This memory is
owned by GDK and must not be freed or unreferenced.
a #GdkDeviceManager
Gets the #GdkDisplay associated to @device_manager.
the #GdkDisplay to which
@device_manager is associated to, or %NULL. This memory is
owned by GDK and must not be freed or unreferenced.
a #GdkDeviceManager
Returns the list of devices of type @type currently attached to
@device_manager.
, use gdk_seat_get_pointer(), gdk_seat_get_keyboard()
and gdk_seat_get_slaves() instead.
a list of
#GdkDevices. The returned list must be
freed with g_list_free (). The list elements are owned by
GTK+ and must not be freed or unreffed.
a #GdkDeviceManager
device type to get.
The ::device-added signal is emitted either when a new master
pointer is created, or when a slave (Hardware) input device
is plugged in.
the newly added #GdkDevice.
The ::device-changed signal is emitted whenever a device
has changed in the hierarchy, either slave devices being
disconnected from their master device or connected to
another one, or master devices being added or removed
a slave device.
If a slave device is detached from all master devices
(gdk_device_get_associated_device() returns %NULL), its
#GdkDeviceType will change to %GDK_DEVICE_TYPE_FLOATING,
if it's attached, it will change to %GDK_DEVICE_TYPE_SLAVE.
the #GdkDevice that changed.
The ::device-removed signal is emitted either when a master
pointer is removed, or when a slave (Hardware) input device
is unplugged.
the just removed #GdkDevice.
#GdkDevicePad is an interface implemented by devices of type
%GDK_SOURCE_TABLET_PAD, it allows querying the features provided
by the pad device.
Tablet pads may contain one or more groups, each containing a subset
of the buttons/rings/strips available. gdk_device_pad_get_n_groups()
can be used to obtain the number of groups, gdk_device_pad_get_n_features()
and gdk_device_pad_get_feature_group() can be combined to find out the
number of buttons/rings/strips the device has, and how are they grouped.
Each of those groups have different modes, which may be used to map
each individual pad feature to multiple actions. Only one mode is
effective (current) for each given group, different groups may have
different current modes. The number of available modes in a group can
be found out through gdk_device_pad_get_group_n_modes(), and the current
mode for a given group will be notified through the #GdkEventPadGroupMode
event.
Returns the group the given @feature and @idx belong to,
or -1 if feature/index do not exist in @pad.
The group number of the queried pad feature.
a #GdkDevicePad
the feature type to get the group from
the index of the feature to get the group from
Returns the number of modes that @group may have.
The number of modes available in @group.
a #GdkDevicePad
group to get the number of available modes from
Returns the number of features a tablet pad has.
The amount of elements of type @feature that this pad has.
a #GdkDevicePad
a pad feature
Returns the number of groups this pad device has. Pads have
at least one group. A pad group is a subcollection of
buttons/strip/rings that is affected collectively by a same
current mode.
The number of button/ring/strip groups in the pad.
a #GdkDevicePad
A pad feature.
a button
a ring-shaped interactive area
a straight interactive area
Gets the hardware ID of this tool, or 0 if it's not known. When
non-zero, the identificator is unique for the given tool model,
meaning that two identical tools will share the same @hardware_id,
but will have different serial numbers (see gdk_device_tool_get_serial()).
This is a more concrete (and device specific) method to identify
a #GdkDeviceTool than gdk_device_tool_get_tool_type(), as a tablet
may support multiple devices with the same #GdkDeviceToolType,
but having different hardware identificators.
The hardware identificator of this tool.
a #GdkDeviceTool
Gets the serial of this tool, this value can be used to identify a
physical tool (eg. a tablet pen) across program executions.
The serial ID for this tool
a #GdkDeviceTool
Gets the #GdkDeviceToolType of the tool.
The physical type for this tool. This can be used to figure out what
sort of pen is being used, such as an airbrush or a pencil.
a #GdkDeviceTool
Indicates the specific type of tool being used being a tablet. Such as an
airbrush, pencil, etc.
Tool is of an unknown type.
Tool is a standard tablet stylus.
Tool is standard tablet eraser.
Tool is a brush stylus.
Tool is a pencil stylus.
Tool is an airbrush stylus.
Tool is a mouse.
Tool is a lens cursor.
Indicates the device type. See [above][GdkDeviceManager.description]
for more information about the meaning of these device types.
Device is a master (or virtual) device. There will
be an associated focus indicator on the screen.
Device is a slave (or physical) device.
Device is a physical device, currently not attached to
any virtual device.
#GdkDisplay objects purpose are two fold:
- To manage and provide information about input devices (pointers and keyboards)
- To manage and provide information about the available #GdkScreens
GdkDisplay objects are the GDK representation of an X Display,
which can be described as a workstation consisting of
a keyboard, a pointing device (such as a mouse) and one or more
screens.
It is used to open and keep track of various GdkScreen objects
currently instantiated by the application. It is also used to
access the keyboard(s) and mouse pointer(s) of the display.
Most of the input device handling has been factored out into
the separate #GdkDeviceManager object. Every display has a
device manager, which you can obtain using
gdk_display_get_device_manager().
Gets the default #GdkDisplay. This is a convenience
function for:
`gdk_display_manager_get_default_display (gdk_display_manager_get ())`.
a #GdkDisplay, or %NULL if
there is no default display.
Opens a display.
a #GdkDisplay, or %NULL if the
display could not be opened
the name of the display to open
Opens the default display specified by command line arguments or
environment variables, sets it as the default display, and returns
it. gdk_parse_args() must have been called first. If the default
display has previously been set, simply returns that. An internal
function that should not be used by applications.
This symbol was never meant to be used outside
of GTK+
the default display, if it
could be opened, otherwise %NULL.
Emits a short beep on @display
a #GdkDisplay
Closes the connection to the windowing system for the given display,
and cleans up associated resources.
a #GdkDisplay
Returns %TRUE if there is an ongoing grab on @device for @display.
%TRUE if there is a grab in effect for @device.
a #GdkDisplay
a #GdkDevice
Flushes any requests queued for the windowing system; this happens automatically
when the main loop blocks waiting for new events, but if your application
is drawing without returning control to the main loop, you may need
to call this function explicitly. A common case where this function
needs to be called is when an application is executing drawing commands
from a thread other than the thread where the main loop is running.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing.
a #GdkDisplay
Returns a #GdkAppLaunchContext suitable for launching
applications on the given display.
a new #GdkAppLaunchContext for @display.
Free with g_object_unref() when done
a #GdkDisplay
Returns the default size to use for cursors on @display.
the default cursor size.
a #GdkDisplay
Returns the default group leader window for all toplevel windows
on @display. This window is implicitly created by GDK.
See gdk_window_set_group().
The default group leader window
for @display
a #GdkDisplay
Get the default #GdkScreen for @display.
the default #GdkScreen object for @display
a #GdkDisplay
Returns the default #GdkSeat for this display.
the default seat.
a #GdkDisplay
Returns the #GdkDeviceManager associated to @display.
Use gdk_display_get_default_seat() and #GdkSeat operations.
A #GdkDeviceManager, or
%NULL. This memory is owned by GDK and must not be freed
or unreferenced.
a #GdkDisplay.
Gets the next #GdkEvent to be processed for @display, fetching events from the
windowing system if necessary.
the next #GdkEvent to be processed, or %NULL
if no events are pending. The returned #GdkEvent should be freed
with gdk_event_free().
a #GdkDisplay
Gets the maximal size to use for cursors on @display.
a #GdkDisplay
the return location for the maximal cursor width
the return location for the maximal cursor height
Gets a monitor associated with this display.
the #GdkMonitor, or %NULL if
@monitor_num is not a valid monitor number
a #GdkDisplay
number of the monitor
Gets the monitor in which the point (@x, @y) is located,
or a nearby monitor if the point is not in any monitor.
the monitor containing the point
a #GdkDisplay
the x coordinate of the point
the y coordinate of the point
Gets the monitor in which the largest area of @window
resides, or a monitor close to @window if it is outside
of all monitors.
the monitor with the largest overlap with @window
a #GdkDisplay
a #GdkWindow
Gets the number of monitors that belong to @display.
The returned number is valid until the next emission of the
#GdkDisplay::monitor-added or #GdkDisplay::monitor-removed signal.
the number of monitors
a #GdkDisplay
Gets the number of screen managed by the @display.
The number of screens is always 1.
number of screens.
a #GdkDisplay
Gets the name of the display.
a string representing the display name. This string is owned
by GDK and should not be modified or freed.
a #GdkDisplay
Gets the current location of the pointer and the current modifier
mask for a given display.
Use gdk_device_get_position() instead.
a #GdkDisplay
location to store the screen that the
cursor is on, or %NULL.
location to store root window X coordinate of pointer, or %NULL.
location to store root window Y coordinate of pointer, or %NULL.
location to store current modifier mask, or %NULL
Gets the primary monitor for the display.
The primary monitor is considered the monitor where the “main desktop”
lives. While normal application windows typically allow the window
manager to place the windows, specialized desktop applications
such as panels should place themselves on the primary monitor.
the primary monitor, or %NULL if no primary
monitor is configured by the user
a #GdkDisplay
Returns a screen object for one of the screens of the display.
There is only one screen; use gdk_display_get_default_screen() to get it.
the #GdkScreen object
a #GdkDisplay
the screen number
Obtains the window underneath the mouse pointer, returning the location
of the pointer in that window in @win_x, @win_y for @screen. Returns %NULL
if the window under the mouse pointer is not known to GDK (for example,
belongs to another application).
Use gdk_device_get_window_at_position() instead.
the window under the mouse
pointer, or %NULL
a #GdkDisplay
return location for x coordinate of the pointer location relative
to the window origin, or %NULL
return location for y coordinate of the pointer location relative
& to the window origin, or %NULL
Returns whether the display has events that are waiting
to be processed.
%TRUE if there are events ready to be processed.
a #GdkDisplay
Finds out if the display has been closed.
%TRUE if the display is closed.
a #GdkDisplay
Release any keyboard grab
Use gdk_device_ungrab(), together with gdk_device_grab()
instead.
a #GdkDisplay.
a timestap (e.g #GDK_CURRENT_TIME).
Returns the list of available input devices attached to @display.
The list is statically allocated and should not be freed.
Use gdk_device_manager_list_devices() instead.
a list of #GdkDevice
a #GdkDisplay
Returns the list of seats known to @display.
the
list of seats known to the #GdkDisplay
a #GdkDisplay
Indicates to the GUI environment that the application has
finished loading, using a given identifier.
GTK+ will call this function automatically for #GtkWindow
with custom startup-notification identifier unless
gtk_window_set_auto_startup_notification() is called to
disable that feature.
a #GdkDisplay
a startup-notification identifier, for which
notification process should be completed
Gets a copy of the first #GdkEvent in the @display’s event queue, without
removing the event from the queue. (Note that this function will
not get more events from the windowing system. It only checks the events
that have already been moved to the GDK event queue.)
a copy of the first #GdkEvent on the event
queue, or %NULL if no events are in the queue. The returned
#GdkEvent should be freed with gdk_event_free().
a #GdkDisplay
Test if the pointer is grabbed.
Use gdk_display_device_is_grabbed() instead.
%TRUE if an active X pointer grab is in effect
a #GdkDisplay
Release any pointer grab.
Use gdk_device_ungrab(), together with gdk_device_grab()
instead.
a #GdkDisplay.
a timestap (e.g. %GDK_CURRENT_TIME).
Appends a copy of the given event onto the front of the event
queue for @display.
a #GdkDisplay
a #GdkEvent.
Request #GdkEventOwnerChange events for ownership changes
of the selection named by the given atom.
whether #GdkEventOwnerChange events will
be sent.
a #GdkDisplay
the #GdkAtom naming the selection for which
ownership change notification is requested
Sets the double click distance (two clicks within this distance
count as a double click and result in a #GDK_2BUTTON_PRESS event).
See also gdk_display_set_double_click_time().
Applications should not set this, it is a global
user-configured setting.
a #GdkDisplay
distance in pixels
Sets the double click time (two clicks within this time interval
count as a double click and result in a #GDK_2BUTTON_PRESS event).
Applications should not set this, it is a global
user-configured setting.
a #GdkDisplay
double click time in milliseconds (thousandths of a second)
Issues a request to the clipboard manager to store the
clipboard data. On X11, this is a special program that works
according to the
[FreeDesktop Clipboard Specification](http://www.freedesktop.org/Standards/clipboard-manager-spec).
a #GdkDisplay
a #GdkWindow belonging to the clipboard owner
a timestamp
an array of targets
that should be saved, or %NULL
if all available targets should be saved.
length of the @targets array
Returns whether the speicifed display supports clipboard
persistance; i.e. if it’s possible to store the clipboard data after an
application has quit. On X11 this checks if a clipboard daemon is
running.
%TRUE if the display supports clipboard persistance.
a #GdkDisplay
Returns %TRUE if gdk_window_set_composited() can be used
to redirect drawing on the window using compositing.
Currently this only works on X11 with XComposite and
XDamage extensions available.
Compositing is an outdated technology that
only ever worked on X11.
%TRUE if windows may be composited.
a #GdkDisplay
Returns %TRUE if cursors can use an 8bit alpha channel
on @display. Otherwise, cursors are restricted to bilevel
alpha (i.e. a mask).
whether cursors can have alpha channels.
a #GdkDisplay
Returns %TRUE if multicolored cursors are supported
on @display. Otherwise, cursors have only a forground
and a background color.
whether cursors can have multiple colors.
a #GdkDisplay
Returns %TRUE if gdk_window_input_shape_combine_mask() can
be used to modify the input shape of windows on @display.
%TRUE if windows with modified input shape are supported
a #GdkDisplay
Returns whether #GdkEventOwnerChange events will be
sent when the owner of a selection changes.
whether #GdkEventOwnerChange events will
be sent.
a #GdkDisplay
Returns %TRUE if gdk_window_shape_combine_mask() can
be used to create shaped windows on @display.
%TRUE if shaped windows are supported
a #GdkDisplay
Flushes any requests queued for the windowing system and waits until all
requests have been handled. This is often used for making sure that the
display is synchronized with the current state of the program. Calling
gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
generated from earlier requests are handled before the error trap is
removed.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing.
a #GdkDisplay
Warps the pointer of @display to the point @x,@y on
the screen @screen, unless the pointer is confined
to a window by a grab, in which case it will be moved
as far as allowed by the grab. Warping the pointer
creates events as if the user had moved the mouse
instantaneously to the destination.
Note that the pointer should normally be under the
control of the user. This function was added to cover
some rare use cases like keyboard navigation support
for the color picker in the #GtkColorSelectionDialog.
Use gdk_device_warp() instead.
a #GdkDisplay
the screen of @display to warp the pointer to
the x coordinate of the destination
the y coordinate of the destination
The ::closed signal is emitted when the connection to the windowing
system for @display is closed.
%TRUE if the display was closed due to an error
The ::monitor-added signal is emitted whenever a monitor is
added.
the monitor that was just added
The ::monitor-removed signal is emitted whenever a monitor is
removed.
the monitor that was just removed
The ::opened signal is emitted when the connection to the windowing
system for @display is opened.
The ::seat-added signal is emitted whenever a new seat is made
known to the windowing system.
the seat that was just added
The ::seat-removed signal is emitted whenever a seat is removed
by the windowing system.
the seat that was just removed
The purpose of the #GdkDisplayManager singleton object is to offer
notification when displays appear or disappear or the default display
changes.
You can use gdk_display_manager_get() to obtain the #GdkDisplayManager
singleton, but that should be rarely necessary. Typically, initializing
GTK+ opens a display that you can work with without ever accessing the
#GdkDisplayManager.
The GDK library can be built with support for multiple backends.
The #GdkDisplayManager object determines which backend is used
at runtime.
When writing backend-specific code that is supposed to work with
multiple GDK backends, you have to consider both compile time and
runtime. At compile time, use the #GDK_WINDOWING_X11, #GDK_WINDOWING_WIN32
macros, etc. to find out which backends are present in the GDK library
you are building your application against. At runtime, use type-check
macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
## Backend-specific code ## {#backend-specific}
|[<!-- language="C" -->
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
{
// make X11-specific calls here
}
else
#endif
#ifdef GDK_WINDOWING_QUARTZ
if (GDK_IS_QUARTZ_DISPLAY (display))
{
// make Quartz-specific calls here
}
else
#endif
g_error ("Unsupported GDK backend");
]|
Gets the singleton #GdkDisplayManager object.
When called for the first time, this function consults the
`GDK_BACKEND` environment variable to find out which
of the supported GDK backends to use (in case GDK has been compiled
with multiple backends). Applications can use gdk_set_allowed_backends()
to limit what backends can be used.
The global #GdkDisplayManager singleton;
gdk_parse_args(), gdk_init(), or gdk_init_check() must have
been called first.
Gets the default #GdkDisplay.
a #GdkDisplay, or %NULL if
there is no default display.
a #GdkDisplayManager
List all currently open displays.
a newly
allocated #GSList of #GdkDisplay objects. Free with g_slist_free()
when you are done with it.
a #GdkDisplayManager
Opens a display.
a #GdkDisplay, or %NULL if the
display could not be opened
a #GdkDisplayManager
the name of the display to open
Sets @display as the default display.
a #GdkDisplayManager
a #GdkDisplay
The ::display-opened signal is emitted when a display is opened.
the opened display
Used in #GdkDragContext to indicate what the destination
should do with the dropped data.
Means nothing, and should not be used.
Copy the data.
Move the data, i.e. first copy it, then delete
it from the source using the DELETE target of the X selection protocol.
Add a link to the data. Note that this is only
useful if source and destination agree on what it means.
Special action which tells the source that the
destination will do something that the source doesn’t understand.
Ask the user what to do with the data.
Used in #GdkDragContext to the reason of a cancelled DND operation.
There is no suitable drop target.
Drag cancelled by the user
Unspecified error.
Determines the bitmask of actions proposed by the source if
gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
the #GdkDragAction flags
a #GdkDragContext
Returns the destination window for the DND operation.
a #GdkWindow
a #GdkDragContext
Returns the #GdkDevice associated to the drag context.
The #GdkDevice associated to @context.
a #GdkDragContext
Returns the window on which the drag icon should be rendered
during the drag operation. Note that the window may not be
available until the drag operation has begun. GDK will move
the window in accordance with the ongoing drag operation.
The window is owned by @context and will be destroyed when
the drag operation is over.
the drag window, or %NULL
a #GdkDragContext
Returns the drag protocol that is used by this context.
the drag protocol
a #GdkDragContext
Determines the action chosen by the drag destination.
a #GdkDragAction value
a #GdkDragContext
Returns the #GdkWindow where the DND operation started.
a #GdkWindow
a #GdkDragContext
Determines the suggested drag action of the context.
a #GdkDragAction value
a #GdkDragContext
Retrieves the list of targets of the context.
a #GList of targets
a #GdkDragContext
Requests the drag and drop operation to be managed by @context.
When a drag and drop operation becomes managed, the #GdkDragContext
will internally handle all input and source-side #GdkEventDND events
as required by the windowing system.
Once the drag and drop operation is managed, the drag context will
emit the following signals:
- The #GdkDragContext::action-changed signal whenever the final action
to be performed by the drag and drop operation changes.
- The #GdkDragContext::drop-performed signal after the user performs
the drag and drop gesture (typically by releasing the mouse button).
- The #GdkDragContext::dnd-finished signal after the drag and drop
operation concludes (after all #GdkSelection transfers happen).
- The #GdkDragContext::cancel signal if the drag and drop operation is
finished but doesn't happen over an accepting destination, or is
cancelled through other means.
#TRUE if the drag and drop operation is managed.
a #GdkDragContext
Window to use for IPC messaging/events
the actions supported by the drag source
Associates a #GdkDevice to @context, so all Drag and Drop events
for @context are emitted as if they came from this device.
a #GdkDragContext
a #GdkDevice
Sets the position of the drag window that will be kept
under the cursor hotspot. Initially, the hotspot is at the
top left corner of the drag window.
a #GdkDragContext
x coordinate of the drag window hotspot
y coordinate of the drag window hotspot
A new action is being chosen for the drag and drop operation.
This signal will only be emitted if the #GdkDragContext manages
the drag and drop operation. See gdk_drag_context_manage_dnd()
for more information.
The action currently chosen
The drag and drop operation was cancelled.
This signal will only be emitted if the #GdkDragContext manages
the drag and drop operation. See gdk_drag_context_manage_dnd()
for more information.
The reason the context was cancelled
The drag and drop operation was finished, the drag destination
finished reading all data. The drag source can now free all
miscellaneous data.
This signal will only be emitted if the #GdkDragContext manages
the drag and drop operation. See gdk_drag_context_manage_dnd()
for more information.
The drag and drop operation was performed on an accepting client.
This signal will only be emitted if the #GdkDragContext manages
the drag and drop operation. See gdk_drag_context_manage_dnd()
for more information.
the time at which the drop happened.
Used in #GdkDragContext to indicate the protocol according to
which DND is done.
no protocol.
The Motif DND protocol. No longer supported
The Xdnd protocol.
An extension to the Xdnd protocol for
unclaimed root window drops.
The simple WM_DROPFILES protocol.
The complex OLE2 DND protocol (not implemented).
Intra-application DND.
Wayland DND protocol.
#GdkDrawingContext is an object that represents the current drawing
state of a #GdkWindow.
It's possible to use a #GdkDrawingContext to draw on a #GdkWindow
via rendering API like Cairo or OpenGL.
A #GdkDrawingContext can only be created by calling gdk_window_begin_draw_frame()
and will be valid until a call to gdk_window_end_draw_frame().
#GdkDrawingContext is available since GDK 3.22
Retrieves a Cairo context to be used to draw on the #GdkWindow
that created the #GdkDrawingContext.
The returned context is guaranteed to be valid as long as the
#GdkDrawingContext is valid, that is between a call to
gdk_window_begin_draw_frame() and gdk_window_end_draw_frame().
a Cairo context to be used to draw
the contents of the #GdkWindow. The context is owned by the
#GdkDrawingContext and should not be destroyed
Retrieves a copy of the clip region used when creating the @context.
a Cairo region
a #GdkDrawingContext
Retrieves the window that created the drawing @context.
a #GdkWindow
a #GdkDrawingContext
Checks whether the given #GdkDrawingContext is valid.
%TRUE if the context is valid
a #GdkDrawingContext
The clip region applied to the drawing context.
The #GdkWindow that created the drawing context.
Use this macro as the return value for continuing the propagation of
an event handler.
Use this macro as the return value for stopping the propagation of
an event handler.
A #GdkEvent contains a union of all of the event types,
and allows access to the data fields in a number of ways.
The event type is always the first field in all of the event types, and
can always be accessed with the following code, no matter what type of
event it is:
|[<!-- language="C" -->
GdkEvent *event;
GdkEventType type;
type = event->type;
]|
To access other fields of the event, the pointer to the event
can be cast to the appropriate event type, or the union member
name can be used. For example if the event type is %GDK_BUTTON_PRESS
then the x coordinate of the button press can be accessed with:
|[<!-- language="C" -->
GdkEvent *event;
gdouble x;
x = ((GdkEventButton*)event)->x;
]|
or:
|[<!-- language="C" -->
GdkEvent *event;
gdouble x;
x = event->button.x;
]|
the #GdkEventType
a #GdkEventAny
a #GdkEventExpose
a #GdkEventVisibility
a #GdkEventMotion
a #GdkEventButton
a #GdkEventTouch
a #GdkEventScroll
a #GdkEventKey
a #GdkEventCrossing
a #GdkEventFocus
a #GdkEventConfigure
a #GdkEventProperty
a #GdkEventSelection
a #GdkEventOwnerChange
a #GdkEventProximity
a #GdkEventDND
a #GdkEventWindowState
a #GdkEventSetting
a #GdkEventGrabBroken
a #GdkEventTouchpadSwipe
a #GdkEventTouchpadPinch
a #GdkEventPadButton
a #GdkEventPadAxis
a #GdkEventPadGroupMode
Creates a new event of the given type. All fields are set to 0.
a newly-allocated #GdkEvent. The returned #GdkEvent
should be freed with gdk_event_free().
a #GdkEventType
If both events contain X/Y information, this function will return %TRUE
and return in @angle the relative angle from @event1 to @event2. The rotation
direction for positive angles is from the positive X axis towards the positive
Y axis.
%TRUE if the angle could be calculated.
first #GdkEvent
second #GdkEvent
return location for the relative angle between both events
If both events contain X/Y information, the center of both coordinates
will be returned in @x and @y.
%TRUE if the center could be calculated.
first #GdkEvent
second #GdkEvent
return location for the X coordinate of the center
return location for the Y coordinate of the center
If both events have X/Y information, the distance between both coordinates
(as in a straight line going from @event1 to @event2) will be returned.
%TRUE if the distance could be calculated.
first #GdkEvent
second #GdkEvent
return location for the distance
Copies a #GdkEvent, copying or incrementing the reference count of the
resources associated with it (e.g. #GdkWindow’s and strings).
a copy of @event. The returned #GdkEvent should be freed with
gdk_event_free().
a #GdkEvent
Frees a #GdkEvent, freeing or decrementing any resources associated with it.
Note that this function should only be called with events returned from
functions such as gdk_event_peek(), gdk_event_get(), gdk_event_copy()
and gdk_event_new().
a #GdkEvent.
Extract the axis value for a particular axis use from
an event structure.
%TRUE if the specified axis was found, otherwise %FALSE
a #GdkEvent
the axis use to look for
location to store the value found
Extract the button number from an event.
%TRUE if the event delivered a button number
a #GdkEvent
location to store mouse button number
Extracts the click count from an event.
%TRUE if the event delivered a click count
a #GdkEvent
location to store click count
Extract the event window relative x/y coordinates from an event.
%TRUE if the event delivered event window coordinates
a #GdkEvent
location to put event window x coordinate
location to put event window y coordinate
If the event contains a “device” field, this function will return
it, else it will return %NULL.
a #GdkDevice, or %NULL.
a #GdkEvent.
If the event was generated by a device that supports
different tools (eg. a tablet), this function will
return a #GdkDeviceTool representing the tool that
caused the event. Otherwise, %NULL will be returned.
Note: the #GdkDeviceTool<!-- -->s will be constant during
the application lifetime, if settings must be stored
persistently across runs, see gdk_device_tool_get_serial()
The current device tool, or %NULL
a #GdkEvent
If @event if of type %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
%GDK_TOUCH_END or %GDK_TOUCH_CANCEL, returns the #GdkEventSequence
to which the event belongs. Otherwise, return %NULL.
the event sequence that the event belongs to
a #GdkEvent
Retrieves the type of the event.
a #GdkEventType
a #GdkEvent
Extracts the hardware keycode from an event.
Also see gdk_event_get_scancode().
%TRUE if the event delivered a hardware keycode
a #GdkEvent
location to store the keycode
Extracts the keyval from an event.
%TRUE if the event delivered a key symbol
a #GdkEvent
location to store the keyval
#event: a #GdkEvent
Returns whether this event is an 'emulated' pointer event (typically
from a touch event), as opposed to a real one.
%TRUE if this event is emulated
Extract the root window relative x/y coordinates from an event.
%TRUE if the event delivered root window coordinates
a #GdkEvent
location to put root window x coordinate
location to put root window y coordinate
Gets the keyboard low-level scancode of a key event.
This is usually hardware_keycode. On Windows this is the high
word of WM_KEY{DOWN,UP} lParam which contains the scancode and
some extended flags.
The associated keyboard scancode or 0
a #GdkEvent
Returns the screen for the event. The screen is
typically the screen for `event->any.window`, but
for events such as mouse events, it is the screen
where the pointer was when the event occurs -
that is, the screen which has the root window
to which `event->motion.x_root` and
`event->motion.y_root` are relative.
the screen for the event
a #GdkEvent
Retrieves the scroll deltas from a #GdkEvent
See also: gdk_event_get_scroll_direction()
%TRUE if the event contains smooth scroll information
and %FALSE otherwise
a #GdkEvent
return location for X delta
return location for Y delta
Extracts the scroll direction from an event.
If @event is not of type %GDK_SCROLL, the contents of @direction
are undefined.
If you wish to handle both discrete and smooth scrolling, you
should check the return value of this function, or of
gdk_event_get_scroll_deltas(); for instance:
|[<!-- language="C" -->
GdkScrollDirection direction;
double vscroll_factor = 0.0;
double x_scroll, y_scroll;
if (gdk_event_get_scroll_direction (event, &direction))
{
// Handle discrete scrolling with a known constant delta;
const double delta = 12.0;
switch (direction)
{
case GDK_SCROLL_UP:
vscroll_factor = -delta;
break;
case GDK_SCROLL_DOWN:
vscroll_factor = delta;
break;
default:
// no scrolling
break;
}
}
else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
{
// Handle smooth scrolling directly
vscroll_factor = y_scroll;
}
]|
%TRUE if the event delivered a scroll direction
and %FALSE otherwise
a #GdkEvent
location to store the scroll direction
Returns the #GdkSeat this event was generated for.
The #GdkSeat of this event
a #GdkEvent
This function returns the hardware (slave) #GdkDevice that has
triggered the event, falling back to the virtual (master) device
(as in gdk_event_get_device()) if the event wasn’t caused by
interaction with a hardware device. This may happen for example
in synthesized crossing events after a #GdkWindow updates its
geometry or a grab is acquired/released.
If the event does not contain a device field, this function will
return %NULL.
a #GdkDevice, or %NULL.
a #GdkEvent
If the event contains a “state” field, puts that field in @state. Otherwise
stores an empty state (0). Returns %TRUE if there was a state field
in the event. @event may be %NULL, in which case it’s treated
as if the event had no state field.
%TRUE if there was a state field in the event
a #GdkEvent or %NULL
return location for state
Returns the time stamp from @event, if there is one; otherwise
returns #GDK_CURRENT_TIME. If @event is %NULL, returns #GDK_CURRENT_TIME.
time stamp field from @event
a #GdkEvent
Extracts the #GdkWindow associated with an event.
The #GdkWindow associated with the event
a #GdkEvent
Check whether a scroll event is a stop scroll event. Scroll sequences
with smooth scroll information may provide a stop scroll event once the
interaction with the device finishes, e.g. by lifting a finger. This
stop scroll event is the signal that a widget may trigger kinetic
scrolling based on the current velocity.
Stop scroll events always have a a delta of 0/0.
%TRUE if the event is a scroll stop event
a #GdkEvent
Appends a copy of the given event onto the front of the event
queue for event->any.window’s display, or the default event
queue if event->any.window is %NULL. See gdk_display_put_event().
a #GdkEvent.
Sets the device for @event to @device. The event must
have been allocated by GTK+, for instance, by
gdk_event_copy().
a #GdkEvent
a #GdkDevice
Sets the device tool for this event, should be rarely used.
a #GdkEvent
tool to set on the event, or %NULL
Sets the screen for @event to @screen. The event must
have been allocated by GTK+, for instance, by
gdk_event_copy().
a #GdkEvent
a #GdkScreen
Sets the slave device for @event to @device.
The event must have been allocated by GTK+,
for instance by gdk_event_copy().
a #GdkEvent
a #GdkDevice
This function returns whether a #GdkEventButton should trigger a
context menu, according to platform conventions. The right mouse
button always triggers context menus. Additionally, if
gdk_keymap_get_modifier_mask() returns a non-0 mask for
%GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
also trigger a context menu if this modifier is pressed.
This function should always be used instead of simply checking for
event->button == %GDK_BUTTON_SECONDARY.
%TRUE if the event should trigger a context menu.
a #GdkEvent, currently only button events are meaningful values
Checks all open displays for a #GdkEvent to process,to be processed
on, fetching events from the windowing system if necessary.
See gdk_display_get_event().
the next #GdkEvent to be processed, or %NULL
if no events are pending. The returned #GdkEvent should be freed
with gdk_event_free().
Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is
usually not useful for GTK+ applications. (Although an application
can call this function then call gtk_main_do_event() to pass
events to GTK+.)
the function to call to handle events from GDK.
user data to pass to the function.
the function to call when the handler function is removed, i.e. when
gdk_event_handler_set() is called with another event handler.
If there is an event waiting in the event queue of some open
display, returns a copy of it. See gdk_display_peek_event().
a copy of the first #GdkEvent on some event
queue, or %NULL if no events are in any queues. The returned
#GdkEvent should be freed with gdk_event_free().
Request more motion notifies if @event is a motion notify hint event.
This function should be used instead of gdk_window_get_pointer() to
request further motion notifies, because it also works for extension
events where motion notifies are provided for devices other than the
core pointer. Coordinate extraction, processing and requesting more
motion events from a %GDK_MOTION_NOTIFY event usually works like this:
|[<!-- language="C" -->
{
// motion_event handler
x = motion_event->x;
y = motion_event->y;
// handle (x,y) motion
gdk_event_request_motions (motion_event); // handles is_hint events
}
]|
a valid #GdkEvent
Contains the fields which are common to all event structs.
Any event pointer can safely be cast to a pointer to a #GdkEventAny to
access these fields.
the type of the event.
the window which received the event.
%TRUE if the event was sent explicitly.
Used for button press and button release events. The
@type field will be one of %GDK_BUTTON_PRESS,
%GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
Double and triple-clicks result in a sequence of events being received.
For double-clicks the order of events will be:
- %GDK_BUTTON_PRESS
- %GDK_BUTTON_RELEASE
- %GDK_BUTTON_PRESS
- %GDK_2BUTTON_PRESS
- %GDK_BUTTON_RELEASE
Note that the first click is received just like a normal
button press, while the second click results in a %GDK_2BUTTON_PRESS
being received just after the %GDK_BUTTON_PRESS.
Triple-clicks are very similar to double-clicks, except that
%GDK_3BUTTON_PRESS is inserted after the third click. The order of the
events is:
- %GDK_BUTTON_PRESS
- %GDK_BUTTON_RELEASE
- %GDK_BUTTON_PRESS
- %GDK_2BUTTON_PRESS
- %GDK_BUTTON_RELEASE
- %GDK_BUTTON_PRESS
- %GDK_3BUTTON_PRESS
- %GDK_BUTTON_RELEASE
For a double click to occur, the second button press must occur within
1/4 of a second of the first. For a triple click to occur, the third
button press must also occur within 1/2 second of the first button press.
the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
%GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the window.
the y coordinate of the pointer relative to the window.
@x, @y translated to the axes of @device, or %NULL if @device is
the mouse.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
the button which was pressed or released, numbered from 1 to 5.
Normally button 1 is the left mouse button, 2 is the middle button,
and 3 is the right button. On 2-button mice, the middle button can
often be simulated by pressing both mouse buttons together.
the master device that the event originated from. Use
gdk_event_get_source_device() to get the slave device.
the x coordinate of the pointer relative to the root of the
screen.
the y coordinate of the pointer relative to the root of the
screen.
Generated when a window size or position has changed.
the type of the event (%GDK_CONFIGURE).
the window which received the event.
%TRUE if the event was sent explicitly.
the new x coordinate of the window, relative to its parent.
the new y coordinate of the window, relative to its parent.
the new width of the window.
the new height of the window.
Generated when the pointer enters or leaves a window.
the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
the window which received the event.
%TRUE if the event was sent explicitly.
the window that was entered or left.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the window.
the y coordinate of the pointer relative to the window.
the x coordinate of the pointer relative to the root of the screen.
the y coordinate of the pointer relative to the root of the screen.
the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
%GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
%GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
never native.
the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
%GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
%GDK_NOTIFY_NONLINEAR_VIRTUAL).
%TRUE if @window is the focus window or an inferior.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
Generated during DND operations.
the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
%GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
%GDK_DROP_FINISHED).
the window which received the event.
%TRUE if the event was sent explicitly.
the #GdkDragContext for the current DND operation.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the root of the
screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
the y coordinate of the pointer relative to the root of the
screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
Generated when all or part of a window becomes visible and needs to be
redrawn.
the type of the event (%GDK_EXPOSE or %GDK_DAMAGE).
the window which received the event.
%TRUE if the event was sent explicitly.
bounding box of @region.
the region that needs to be redrawn.
the number of contiguous %GDK_EXPOSE events following this one.
The only use for this is “exposure compression”, i.e. handling all
contiguous %GDK_EXPOSE events in one go, though GDK performs some
exposure compression so this is not normally needed.
Describes a change of keyboard focus.
the type of the event (%GDK_FOCUS_CHANGE).
the window which received the event.
%TRUE if the event was sent explicitly.
%TRUE if the window has gained the keyboard focus, %FALSE if
it has lost the focus.
Specifies the type of function passed to gdk_event_handler_set() to
handle all GDK events.
the #GdkEvent to process.
user data set when the event handler was installed with
gdk_event_handler_set().
Generated when a pointer or keyboard grab is broken. On X11, this happens
when the grab window becomes unviewable (i.e. it or one of its ancestors
is unmapped), or if the same application grabs the pointer or keyboard
again. Note that implicit grabs (which are initiated by button presses)
can also cause #GdkEventGrabBroken events.
the type of the event (%GDK_GRAB_BROKEN)
the window which received the event, i.e. the window
that previously owned the grab
%TRUE if the event was sent explicitly.
%TRUE if a keyboard grab was broken, %FALSE if a pointer
grab was broken
%TRUE if the broken grab was implicit
If this event is caused by another grab in the same
application, @grab_window contains the new grab window. Otherwise
@grab_window is %NULL.
Describes a key press or key release event.
the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
the key that was pressed or released. See the
`gdk/gdkkeysyms.h` header file for a
complete list of GDK key codes.
the length of @string.
a string containing an approximation of the text that
would result from this keypress. The only correct way to handle text
input of text is using input methods (see #GtkIMContext), so this
field is deprecated and should never be used.
(gdk_unicode_to_keyval() provides a non-deprecated way of getting
an approximate translation for a key.) The string is encoded in the
encoding of the current locale (Note: this for backwards compatibility:
strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
In some cases, the translation of the key code will be a single
NUL byte, in which case looking at @length is necessary to distinguish
it from the an empty translation.
the raw code of the key that was pressed or released.
the keyboard group.
a flag that indicates if @hardware_keycode is mapped to a
modifier. Since 2.10
A set of bit-flags to indicate which events a window is to receive.
Most of these masks map onto one or more of the #GdkEventType event types
above.
See the [input handling overview][chap-input-handling] for details of
[event masks][event-masks] and [event propagation][event-propagation].
%GDK_POINTER_MOTION_HINT_MASK is deprecated. It is a special mask
to reduce the number of %GDK_MOTION_NOTIFY events received. When using
%GDK_POINTER_MOTION_HINT_MASK, fewer %GDK_MOTION_NOTIFY events will
be sent, some of which are marked as a hint (the is_hint member is
%TRUE). To receive more motion events after a motion hint event,
the application needs to asks for more, by calling
gdk_event_request_motions().
Since GTK 3.8, motion events are already compressed by default, independent
of this mechanism. This compression can be disabled with
gdk_window_set_event_compression(). See the documentation of that function
for details.
If %GDK_TOUCH_MASK is enabled, the window will receive touch events
from touch-enabled devices. Those will come as sequences of #GdkEventTouch
with type %GDK_TOUCH_UPDATE, enclosed by two events with
type %GDK_TOUCH_BEGIN and %GDK_TOUCH_END (or %GDK_TOUCH_CANCEL).
gdk_event_get_event_sequence() returns the event sequence for these
events, so different sequences may be distinguished.
receive expose events
receive all pointer motion events
deprecated. see the explanation above
receive pointer motion events while any button is pressed
receive pointer motion events while 1 button is pressed
receive pointer motion events while 2 button is pressed
receive pointer motion events while 3 button is pressed
receive button press events
receive button release events
receive key press events
receive key release events
receive window enter events
receive window leave events
receive focus change events
receive events about window configuration change
receive property change events
receive visibility change events
receive proximity in events
receive proximity out events
receive events about window configuration changes of
child windows
receive scroll events
receive touch events. Since 3.4
receive smooth scrolling events. Since 3.4
receive touchpad gesture events. Since 3.18
receive tablet pad events. Since 3.22
the combination of all the above event masks.
Generated when the pointer moves.
the type of the event.
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the window.
the y coordinate of the pointer relative to the window.
@x, @y translated to the axes of @device, or %NULL if @device is
the mouse.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
set to 1 if this event is just a hint, see the
%GDK_POINTER_MOTION_HINT_MASK value of #GdkEventMask.
the master device that the event originated from. Use
gdk_event_get_source_device() to get the slave device.
the x coordinate of the pointer relative to the root of the
screen.
the y coordinate of the pointer relative to the root of the
screen.
Generated when the owner of a selection changes. On X11, this
information is only available if the X server supports the XFIXES
extension.
the type of the event (%GDK_OWNER_CHANGE).
the window which received the event
%TRUE if the event was sent explicitly.
the new owner of the selection, or %NULL if there is none
the reason for the ownership change as a #GdkOwnerChange value
the atom identifying the selection
the timestamp of the event
the time at which the selection ownership was taken
over
Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
the type of the event (%GDK_PAD_RING or %GDK_PAD_STRIP).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the pad group the ring/strip belongs to. A %GDK_SOURCE_TABLET_PAD
device may have one or more groups containing a set of buttons/rings/strips
each.
number of strip/ring that was interacted. This number is 0-indexed.
The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
device may have different current modes.
The current value for the given axis.
Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_BUTTON_RELEASE).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the pad group the button belongs to. A %GDK_SOURCE_TABLET_PAD device
may have one or more groups containing a set of buttons/rings/strips each.
The pad button that was pressed.
The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
device may have different current modes.
Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
the type of the event (%GDK_PAD_GROUP_MODE).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the pad group that is switching mode. A %GDK_SOURCE_TABLET_PAD
device may have one or more groups containing a set of buttons/rings/strips
each.
The new mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
device may have different current modes.
Describes a property change on a window.
the type of the event (%GDK_PROPERTY_NOTIFY).
the window which received the event.
%TRUE if the event was sent explicitly.
the property that was changed.
the time of the event in milliseconds.
whether the property was changed
(%GDK_PROPERTY_NEW_VALUE) or deleted (%GDK_PROPERTY_DELETE).
Proximity events are generated when using GDK’s wrapper for the
XInput extension. The XInput extension is an add-on for standard X
that allows you to use nonstandard devices such as graphics tablets.
A proximity event indicates that the stylus has moved in or out of
contact with the tablet, or perhaps that the user’s finger has moved
in or out of contact with a touch screen.
This event type will be used pretty rarely. It only is important for
XInput aware programs that are drawing their own cursor.
the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the master device that the event originated from. Use
gdk_event_get_source_device() to get the slave device.
Generated from button presses for the buttons 4 to 7. Wheel mice are
usually configured to generate button press events for buttons 4 and 5
when the wheel is turned.
Some GDK backends can also generate “smooth” scroll events, which
can be recognized by the %GDK_SCROLL_SMOOTH scroll direction. For
these, the scroll deltas can be obtained with
gdk_event_get_scroll_deltas().
the type of the event (%GDK_SCROLL).
the window which received the event.
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the window.
the y coordinate of the pointer relative to the window.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
the direction to scroll to (one of %GDK_SCROLL_UP,
%GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
%GDK_SCROLL_SMOOTH).
the master device that the event originated from. Use
gdk_event_get_source_device() to get the slave device.
the x coordinate of the pointer relative to the root of the
screen.
the y coordinate of the pointer relative to the root of the
screen.
the x coordinate of the scroll delta
the y coordinate of the scroll delta
Generated when a selection is requested or ownership of a selection
is taken over by another client application.
the type of the event (%GDK_SELECTION_CLEAR,
%GDK_SELECTION_NOTIFY or %GDK_SELECTION_REQUEST).
the window which received the event.
%TRUE if the event was sent explicitly.
the selection.
the target to which the selection should be converted.
the property in which to place the result of the conversion.
the time of the event in milliseconds.
the window on which to place @property or %NULL if none.
Generated when a setting is modified.
the type of the event (%GDK_SETTING).
the window which received the event.
%TRUE if the event was sent explicitly.
what happened to the setting (%GDK_SETTING_ACTION_NEW,
%GDK_SETTING_ACTION_CHANGED or %GDK_SETTING_ACTION_DELETED).
the name of the setting.
Used for touch events.
@type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
%GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
Touch events are grouped into sequences by means of the @sequence
field, which can also be obtained with gdk_event_get_event_sequence().
Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
(or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
several active sequences at the same time.
the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
%GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
the window which received the event
%TRUE if the event was sent explicitly.
the time of the event in milliseconds.
the x coordinate of the pointer relative to the window
the y coordinate of the pointer relative to the window
@x, @y translated to the axes of @device, or %NULL if @device is
the mouse
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType
the event sequence that the event belongs to
whether the event should be used for emulating
pointer event
the master device that the event originated from. Use
gdk_event_get_source_device() to get the slave device.
the x coordinate of the pointer relative to the root of the
screen
the y coordinate of the pointer relative to the root of the
screen
Generated during touchpad swipe gestures.
the type of the event (%GDK_TOUCHPAD_PINCH)
the window which received the event
%TRUE if the event was sent explicitly
the current phase of the gesture
The number of fingers triggering the pinch
the time of the event in milliseconds
The X coordinate of the pointer
The Y coordinate of the pointer
Movement delta in the X axis of the swipe focal point
Movement delta in the Y axis of the swipe focal point
The angle change in radians, negative angles
denote counter-clockwise movements
The current scale, relative to that at the time of
the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event
The X coordinate of the pointer, relative to the
root of the screen.
The Y coordinate of the pointer, relative to the
root of the screen.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
Generated during touchpad swipe gestures.
the type of the event (%GDK_TOUCHPAD_SWIPE)
the window which received the event
%TRUE if the event was sent explicitly
the current phase of the gesture
The number of fingers triggering the swipe
the time of the event in milliseconds
The X coordinate of the pointer
The Y coordinate of the pointer
Movement delta in the X axis of the swipe focal point
Movement delta in the Y axis of the swipe focal point
The X coordinate of the pointer, relative to the
root of the screen.
The Y coordinate of the pointer, relative to the
root of the screen.
a bit-mask representing the state of
the modifier keys (e.g. Control, Shift and Alt) and the pointer
buttons. See #GdkModifierType.
Specifies the type of the event.
Do not confuse these events with the signals that GTK+ widgets emit.
Although many of these events result in corresponding signals being emitted,
the events are often transformed or filtered along the way.
In some language bindings, the values %GDK_2BUTTON_PRESS and
%GDK_3BUTTON_PRESS would translate into something syntactically
invalid (eg `Gdk.EventType.2ButtonPress`, where a
symbol is not allowed to start with a number). In that case, the
aliases %GDK_DOUBLE_BUTTON_PRESS and %GDK_TRIPLE_BUTTON_PRESS can
be used instead.
a special code to indicate a null event.
the window manager has requested that the toplevel window be
hidden or destroyed, usually when the user clicks on a special icon in the
title bar.
the window has been destroyed.
all or part of the window has become visible and needs to be
redrawn.
the pointer (usually a mouse) has moved.
a mouse button has been pressed.
a mouse button has been double-clicked (clicked twice
within a short period of time). Note that each click also generates a
%GDK_BUTTON_PRESS event.
alias for %GDK_2BUTTON_PRESS, added in 3.6.
a mouse button has been clicked 3 times in a short period
of time. Note that each click also generates a %GDK_BUTTON_PRESS event.
alias for %GDK_3BUTTON_PRESS, added in 3.6.
a mouse button has been released.
a key has been pressed.
a key has been released.
the pointer has entered the window.
the pointer has left the window.
the keyboard focus has entered or left the window.
the size, position or stacking order of the window has changed.
Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows.
the window has been mapped.
the window has been unmapped.
a property on the window has been changed or deleted.
the application has lost ownership of a selection.
another application has requested a selection.
a selection has been received.
an input device has moved into contact with a sensing
surface (e.g. a touchscreen or graphics tablet).
an input device has moved out of contact with a sensing
surface.
the mouse has entered the window while a drag is in progress.
the mouse has left the window while a drag is in progress.
the mouse has moved in the window while a drag is in
progress.
the status of the drag operation initiated by the window
has changed.
a drop operation onto the window has started.
the drop operation initiated by the window has completed.
a message has been received from another application.
the window visibility status has changed.
the scroll wheel was turned
the state of a window has changed. See #GdkWindowState
for the possible window states
a setting has been modified.
the owner of a selection has changed. This event type
was added in 2.6
a pointer or keyboard grab was broken. This event type
was added in 2.8.
the content of the window has been changed. This event type
was added in 2.14.
A new touch event sequence has just started. This event
type was added in 3.4.
A touch event sequence has been updated. This event type
was added in 3.4.
A touch event sequence has finished. This event type
was added in 3.4.
A touch event sequence has been canceled. This event type
was added in 3.4.
A touchpad swipe gesture event, the current state
is determined by its phase field. This event type was added in 3.18.
A touchpad pinch gesture event, the current state
is determined by its phase field. This event type was added in 3.18.
A tablet pad button press event. This event type
was added in 3.22.
A tablet pad button release event. This event type
was added in 3.22.
A tablet pad axis event from a "ring". This event type was
added in 3.22.
A tablet pad axis event from a "strip". This event type was
added in 3.22.
A tablet pad group mode change. This event type was
added in 3.22.
marks the end of the GdkEventType enumeration. Added in 2.18
Generated when the window visibility status has changed.
Modern composited windowing systems with pervasive
transparency make it impossible to track the visibility of a window
reliably, so this event can not be guaranteed to provide useful
information.
the type of the event (%GDK_VISIBILITY_NOTIFY).
the window which received the event.
%TRUE if the event was sent explicitly.
the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
%GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
Generated when the state of a toplevel window changes.
the type of the event (%GDK_WINDOW_STATE).
the window which received the event.
%TRUE if the event was sent explicitly.
mask specifying what flags have changed.
the new window state, a combination of
#GdkWindowState bits.
Specifies the type of function used to filter native events before they are
converted to GDK events.
When a filter is called, @event is unpopulated, except for
`event->window`. The filter may translate the native
event to a GDK event and store the result in @event, or handle it without
translation. If the filter translates the event and processing should
continue, it should return %GDK_FILTER_TRANSLATE.
a #GdkFilterReturn value.
the native event to filter.
the GDK event to which the X event will be translated.
user data set when the filter was installed.
Specifies the result of applying a #GdkFilterFunc to a native event.
event not handled, continue processing.
native event translated into a GDK event and stored
in the `event` structure that was passed in.
event handled, terminate processing.
A #GdkFrameClock tells the application when to update and repaint a
window. This may be synced to the vertical refresh rate of the
monitor, for example. Even when the frame clock uses a simple timer
rather than a hardware-based vertical sync, the frame clock helps
because it ensures everything paints at the same time (reducing the
total number of frames). The frame clock can also automatically
stop painting when it knows the frames will not be visible, or
scale back animation framerates.
#GdkFrameClock is designed to be compatible with an OpenGL-based
implementation or with mozRequestAnimationFrame in Firefox,
for example.
A frame clock is idle until someone requests a frame with
gdk_frame_clock_request_phase(). At some later point that makes
sense for the synchronization being implemented, the clock will
process a frame and emit signals for each phase that has been
requested. (See the signals of the #GdkFrameClock class for
documentation of the phases. %GDK_FRAME_CLOCK_PHASE_UPDATE and the
#GdkFrameClock::update signal are most interesting for application
writers, and are used to update the animations, using the frame time
given by gdk_frame_clock_get_frame_time().
The frame time is reported in microseconds and generally in the same
timescale as g_get_monotonic_time(), however, it is not the same
as g_get_monotonic_time(). The frame time does not advance during
the time a frame is being painted, and outside of a frame, an attempt
is made so that all calls to gdk_frame_clock_get_frame_time() that
are called at a “similar” time get the same value. This means that
if different animations are timed by looking at the difference in
time between an initial value from gdk_frame_clock_get_frame_time()
and the value inside the #GdkFrameClock::update signal of the clock,
they will stay exactly synchronized.
Starts updates for an animation. Until a matching call to
gdk_frame_clock_end_updating() is made, the frame clock will continually
request a new frame with the %GDK_FRAME_CLOCK_PHASE_UPDATE phase.
This function may be called multiple times and frames will be
requested until gdk_frame_clock_end_updating() is called the same
number of times.
a #GdkFrameClock
Stops updates for an animation. See the documentation for
gdk_frame_clock_begin_updating().
a #GdkFrameClock
Gets the frame timings for the current frame.
the #GdkFrameTimings for the
frame currently being processed, or even no frame is being
processed, for the previous frame. Before any frames have been
processed, returns %NULL.
a #GdkFrameClock
A #GdkFrameClock maintains a 64-bit counter that increments for
each frame drawn.
inside frame processing, the value of the frame counter
for the current frame. Outside of frame processing, the frame
counter for the last frame.
a #GdkFrameClock
Gets the time that should currently be used for animations. Inside
the processing of a frame, it’s the time used to compute the
animation position of everything in a frame. Outside of a frame, it's
the time of the conceptual “previous frame,” which may be either
the actual previous frame time, or if that’s too old, an updated
time.
a timestamp in microseconds, in the timescale of
of g_get_monotonic_time().
a #GdkFrameClock
#GdkFrameClock internally keeps a history of #GdkFrameTimings
objects for recent frames that can be retrieved with
gdk_frame_clock_get_timings(). The set of stored frames
is the set from the counter values given by
gdk_frame_clock_get_history_start() and
gdk_frame_clock_get_frame_counter(), inclusive.
the frame counter value for the oldest frame
that is available in the internal frame history of the
#GdkFrameClock.
a #GdkFrameClock
Using the frame history stored in the frame clock, finds the last
known presentation time and refresh interval, and assuming that
presentation times are separated by the refresh interval,
predicts a presentation time that is a multiple of the refresh
interval after the last presentation time, and later than @base_time.
a #GdkFrameClock
base time for determining a presentaton time
a location to store the
determined refresh interval, or %NULL. A default refresh interval of
1/60th of a second will be stored if no history is present.
a location to store the next
candidate presentation time after the given base time.
0 will be will be stored if no history is present.
Retrieves a #GdkFrameTimings object holding timing information
for the current frame or a recent frame. The #GdkFrameTimings
object may not yet be complete: see gdk_frame_timings_get_complete().
the #GdkFrameTimings object for
the specified frame, or %NULL if it is not available. See
gdk_frame_clock_get_history_start().
a #GdkFrameClock
the frame counter value identifying the frame to
be received.
Asks the frame clock to run a particular phase. The signal
corresponding the requested phase will be emitted the next
time the frame clock processes. Multiple calls to
gdk_frame_clock_request_phase() will be combined together
and only one frame processed. If you are displaying animated
content and want to continually request the
%GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time,
you should use gdk_frame_clock_begin_updating() instead, since
this allows GTK+ to adjust system parameters to get maximally
smooth animations.
a #GdkFrameClock
the phase that is requested
This signal ends processing of the frame. Applications
should generally not handle this signal.
This signal begins processing of the frame. Applications
should generally not handle this signal.
This signal is used to flush pending motion events that
are being batched up and compressed together. Applications
should not handle this signal.
This signal is emitted as the second step of toolkit and
application processing of the frame. Any work to update
sizes and positions of application elements should be
performed. GTK+ normally handles this internally.
This signal is emitted as the third step of toolkit and
application processing of the frame. The frame is
repainted. GDK normally handles this internally and
produces expose events, which are turned into GTK+
#GtkWidget::draw signals.
This signal is emitted after processing of the frame is
finished, and is handled internally by GTK+ to resume normal
event processing. Applications should not handle this signal.
This signal is emitted as the first step of toolkit and
application processing of the frame. Animations should
be updated using gdk_frame_clock_get_frame_time().
Applications can connect directly to this signal, or
use gtk_widget_add_tick_callback() as a more convenient
interface.
#GdkFrameClockPhase is used to represent the different paint clock
phases that can be requested. The elements of the enumeration
correspond to the signals of #GdkFrameClock.
no phase
corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
corresponds to GdkFrameClock::update.
corresponds to GdkFrameClock::layout.
corresponds to GdkFrameClock::paint.
corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
A #GdkFrameTimings object holds timing information for a single frame
of the application’s displays. To retrieve #GdkFrameTimings objects,
use gdk_frame_clock_get_timings() or gdk_frame_clock_get_current_timings().
The information in #GdkFrameTimings is useful for precise synchronization
of video with the event or audio streams, and for measuring
quality metrics for the application’s display, such as latency and jitter.
The timing information in a #GdkFrameTimings is filled in
incrementally as the frame as drawn and passed off to the
window system for processing and display to the user. The
accessor functions for #GdkFrameTimings can return 0 to
indicate an unavailable value for two reasons: either because
the information is not yet available, or because it isn't
available at all. Once gdk_frame_timings_get_complete() returns
%TRUE for a frame, you can be certain that no further values
will become available and be stored in the #GdkFrameTimings.
%TRUE if all information that will be available
for the frame has been filled in.
a #GdkFrameTimings
Gets the frame counter value of the #GdkFrameClock when this
this frame was drawn.
the frame counter value for this frame
a #GdkFrameTimings
Returns the frame time for the frame. This is the time value
that is typically used to time animations for the frame. See
gdk_frame_clock_get_frame_time().
the frame time for the frame, in the timescale
of g_get_monotonic_time()
A #GdkFrameTimings
Gets the predicted time at which this frame will be displayed. Although
no predicted time may be available, if one is available, it will
be available while the frame is being generated, in contrast to
gdk_frame_timings_get_presentation_time(), which is only available
after the frame has been presented. In general, if you are simply
animating, you should use gdk_frame_clock_get_frame_time() rather
than this function, but this function is useful for applications
that want exact control over latency. For example, a movie player
may want this information for Audio/Video synchronization.
The predicted time at which the frame will be presented,
in the timescale of g_get_monotonic_time(), or 0 if no predicted
presentation time is available.
a #GdkFrameTimings
Reurns the presentation time. This is the time at which the frame
became visible to the user.
the time the frame was displayed to the user, in the
timescale of g_get_monotonic_time(), or 0 if no presentation
time is available. See gdk_frame_timings_get_complete()
a #GdkFrameTimings
Gets the natural interval between presentation times for
the display that this frame was displayed on. Frame presentation
usually happens during the “vertical blanking interval”.
the refresh interval of the display, in microseconds,
or 0 if the refresh interval is not available.
See gdk_frame_timings_get_complete().
a #GdkFrameTimings
Increases the reference count of @timings.
@timings
a #GdkFrameTimings
Decreases the reference count of @timings. If @timings
is no longer referenced, it will be freed.
a #GdkFrameTimings
Indicates which monitor (in a multi-head setup) a window should span over
when in fullscreen mode.
Fullscreen on current monitor only.
Span across all monitors when fullscreen.
#GdkGLContext is an object representing the platform-specific
OpenGL drawing context.
#GdkGLContexts are created for a #GdkWindow using
gdk_window_create_gl_context(), and the context will match
the #GdkVisual of the window.
A #GdkGLContext is not tied to any particular normal framebuffer.
For instance, it cannot draw to the #GdkWindow back buffer. The GDK
repaint system is in full control of the painting to that. Instead,
you can create render buffers or textures and use gdk_cairo_draw_from_gl()
in the draw function of your widget to draw them. Then GDK will handle
the integration of your rendering with that of other widgets.
Support for #GdkGLContext is platform-specific, context creation
can fail, returning %NULL context.
A #GdkGLContext has to be made "current" in order to start using
it, otherwise any OpenGL call will be ignored.
## Creating a new OpenGL context ##
In order to create a new #GdkGLContext instance you need a
#GdkWindow, which you typically get during the realize call
of a widget.
A #GdkGLContext is not realized until either gdk_gl_context_make_current(),
or until it is realized using gdk_gl_context_realize(). It is possible to
specify details of the GL context like the OpenGL version to be used, or
whether the GL context should have extra state validation enabled after
calling gdk_window_create_gl_context() by calling gdk_gl_context_realize().
If the realization fails you have the option to change the settings of the
#GdkGLContext and try again.
## Using a GdkGLContext ##
You will need to make the #GdkGLContext the current context
before issuing OpenGL calls; the system sends OpenGL commands to
whichever context is current. It is possible to have multiple
contexts, so you always need to ensure that the one which you
want to draw with is the current one before issuing commands:
|[<!-- language="C" -->
gdk_gl_context_make_current (context);
]|
You can now perform your drawing using OpenGL commands.
You can check which #GdkGLContext is the current one by using
gdk_gl_context_get_current(); you can also unset any #GdkGLContext
that is currently set by calling gdk_gl_context_clear_current().
Clears the current #GdkGLContext.
Any OpenGL call after this function returns will be ignored
until gdk_gl_context_make_current() is called.
Retrieves the current #GdkGLContext.
the current #GdkGLContext, or %NULL
Retrieves the value set using gdk_gl_context_set_debug_enabled().
%TRUE if debugging is enabled
a #GdkGLContext
Retrieves the #GdkDisplay the @context is created for
a #GdkDisplay or %NULL
a #GdkGLContext
Retrieves the value set using gdk_gl_context_set_forward_compatible().
%TRUE if the context should be forward compatible
a #GdkGLContext
Retrieves the major and minor version requested by calling
gdk_gl_context_set_required_version().
a #GdkGLContext
return location for the major version to request
return location for the minor version to request
Retrieves the #GdkGLContext that this @context share data with.
a #GdkGLContext or %NULL
a #GdkGLContext
Checks whether the @context is using an OpenGL or OpenGL ES profile.
%TRUE if the #GdkGLContext is using an OpenGL ES profile
a #GdkGLContext
Retrieves the OpenGL version of the @context.
The @context must be realized prior to calling this function.
a #GdkGLContext
return location for the major version
return location for the minor version
Retrieves the #GdkWindow used by the @context.
a #GdkWindow or %NULL
a #GdkGLContext
Whether the #GdkGLContext is in legacy mode or not.
The #GdkGLContext must be realized before calling this function.
When realizing a GL context, GDK will try to use the OpenGL 3.2 core
profile; this profile removes all the OpenGL API that was deprecated
prior to the 3.2 version of the specification. If the realization is
successful, this function will return %FALSE.
If the underlying OpenGL implementation does not support core profiles,
GDK will fall back to a pre-3.2 compatibility profile, and this function
will return %TRUE.
You can use the value returned by this function to decide which kind
of OpenGL API to use, or whether to do extension discovery, or what
kind of shader programs to load.
%TRUE if the GL context is in legacy mode
a #GdkGLContext
Makes the @context the current one.
a #GdkGLContext
Realizes the given #GdkGLContext.
It is safe to call this function on a realized #GdkGLContext.
%TRUE if the context is realized
a #GdkGLContext
Sets whether the #GdkGLContext should perform extra validations and
run time checking. This is useful during development, but has
additional overhead.
The #GdkGLContext must not be realized or made current prior to
calling this function.
a #GdkGLContext
whether to enable debugging in the context
Sets whether the #GdkGLContext should be forward compatible.
Forward compatibile contexts must not support OpenGL functionality that
has been marked as deprecated in the requested version; non-forward
compatible contexts, on the other hand, must support both deprecated and
non deprecated functionality.
The #GdkGLContext must not be realized or made current prior to calling
this function.
a #GdkGLContext
whether the context should be forward compatible
Sets the major and minor version of OpenGL to request.
Setting @major and @minor to zero will use the default values.
The #GdkGLContext must not be realized or made current prior to calling
this function.
a #GdkGLContext
the major version to request
the minor version to request
Requests that GDK create a OpenGL ES context instead of an OpenGL one,
if the platform and windowing system allows it.
The @context must not have been realized.
By default, GDK will attempt to automatically detect whether the
underlying GL implementation is OpenGL or OpenGL ES once the @context
is realized.
You should check the return value of gdk_gl_context_get_use_es() after
calling gdk_gl_context_realize() to decide whether to use the OpenGL or
OpenGL ES API, extensions, or shaders.
a #GdkGLContext:
whether the context should use OpenGL ES instead of OpenGL,
or -1 to allow auto-detection
The #GdkDisplay used to create the #GdkGLContext.
The #GdkGLContext that this context is sharing data with, or %NULL
The #GdkWindow the gl context is bound to.
Error enumeration for #GdkGLContext.
OpenGL support is not available
The requested visual format is not supported
The requested profile is not supported
The #GdkGeometry struct gives the window manager information about
a window’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 #GdkWindow it creates.
gdk_window_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 window 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 window. 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”:
|[<!-- language="C" -->
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.
minimum width of window (or -1 to use requisition, with
#GtkWindow only)
minimum height of window (or -1 to use requisition, with
#GtkWindow only)
maximum width of window (or -1 to use requisition, with
#GtkWindow only)
maximum height of window (or -1 to use requisition, with
#GtkWindow only)
allowed window widths are @base_width + @width_inc * N where N
is any integer (-1 allowed with #GtkWindow)
allowed window widths are @base_height + @height_inc * N where
N is any integer (-1 allowed with #GtkWindow)
width resize increment
height resize increment
minimum width/height ratio
maximum width/height ratio
window gravity, see gtk_window_set_gravity()
Defines how device grabs interact with other devices.
All other devices’ events are allowed.
Other devices’ events are blocked for the grab window.
Other devices’ events are blocked for the whole application.
Returned by gdk_device_grab(), gdk_pointer_grab() and gdk_keyboard_grab() to
indicate success or the reason for the failure of the grab attempt.
the resource was successfully grabbed.
the resource is actively grabbed by another client.
the resource was grabbed more recently than the
specified time.
the grab window or the @confine_to window are not
viewable.
the resource is frozen by an active grab of another client.
the grab failed for some other reason. Since 3.16
Defines the reference point of a window 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](http://www.freedesktop.org/Standards/wm-spec)
specification for more details.
the reference point is at the top left corner.
the reference point is in the middle of the top edge.
the reference point is at the top right corner.
the reference point is at the middle of the left edge.
the reference point is at the center of the window.
the reference point is at the middle of the right edge.
the reference point is at the lower left corner.
the reference point is at the middle of the lower edge.
the reference point is at the lower right corner.
the reference point is at the top left corner of the
window itself, ignoring window manager decorations.
An enumeration that describes the mode of an input device.
the device is disabled and will not report any events.
the device is enabled. The device’s coordinate space
maps to the entire screen.
the device is enabled. The device’s coordinate space
is mapped to a single window. The manner in which this window
is chosen is undefined, but it will typically be the same
way in which the focus window for key events is determined.
An enumeration describing the type of an input device in general terms.
the device is a mouse. (This will be reported for the core
pointer, even if it is something else, such as a trackball.)
the device is a stylus of a graphics tablet or similar device.
the device is an eraser. Typically, this would be the other end
of a stylus on a graphics tablet.
the device is a graphics tablet “puck” or similar device.
the device is a keyboard.
the device is a direct-input touch device, such
as a touchscreen or tablet. This device type has been added in 3.4.
the device is an indirect touch device, such
as a touchpad. This device type has been added in 3.4.
the device is a trackpoint. This device type has been
added in 3.22
the device is a "pad", a collection of buttons,
rings and strips found in drawing tablets. This device type has been
added in 3.22.
A #GdkKeymap defines the translation from keyboard state
(including a hardware key, a modifier mask, and active keyboard group)
to a keyval. This translation has two phases. The first phase is
to determine the effective keyboard group and level for the keyboard
state; the second phase is to look up the keycode/group/level triplet
in the keymap and see what keyval it corresponds to.
Returns the #GdkKeymap attached to the default display.
Use gdk_keymap_get_for_display() instead
the #GdkKeymap attached to the default display.
Returns the #GdkKeymap attached to @display.
the #GdkKeymap attached to @display.
the #GdkDisplay.
Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
set the corresponding bits in @state.
GDK already does this before delivering key events, but for
compatibility reasons, it only sets the first virtual modifier
it finds, whereas this function sets all matching virtual modifiers.
This function is useful when matching key events against
accelerators.
a #GdkKeymap
pointer to the modifier mask to change
Returns whether the Caps Lock modifer is locked.
%TRUE if Caps Lock is on
a #GdkKeymap
Returns the direction of effective layout of the keymap.
%PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL
if it can determine the direction. %PANGO_DIRECTION_NEUTRAL
otherwise.
a #GdkKeymap
Returns the keyvals bound to @hardware_keycode.
The Nth #GdkKeymapKey in @keys is bound to the Nth
keyval in @keyvals. Free the returned arrays with g_free().
When a keycode is pressed by the user, the keyval from
this list of entries is selected by considering the effective
keyboard group and level. See gdk_keymap_translate_keyboard_state().
%TRUE if there were any entries
a #GdkKeymap
a keycode
return
location for array of #GdkKeymapKey, or %NULL
return
location for array of keyvals, or %NULL
length of @keys and @keyvals
Obtains a list of keycode/group/level combinations that will
generate @keyval. Groups and levels are two kinds of keyboard mode;
in general, the level determines whether the top or bottom symbol
on a key is used, and the group determines whether the left or
right symbol is used. On US keyboards, the shift key changes the
keyboard level, and there are no groups. A group switch key might
convert a keyboard between Hebrew to English modes, for example.
#GdkEventKey contains a %group field that indicates the active
keyboard group. The level is computed from the modifier mask.
The returned array should be freed
with g_free().
%TRUE if keys were found and returned
a #GdkKeymap
a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
return location
for an array of #GdkKeymapKey
return location for number of elements in returned array
Returns the modifier mask the @keymap’s windowing system backend
uses for a particular purpose.
Note that this function always returns real hardware modifiers, not
virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
#GDK_META_MASK if the backend maps MOD1 to META), so there are use
cases where the return value of this function has to be transformed
by gdk_keymap_add_virtual_modifiers() in order to contain the
expected result.
the modifier mask used for @intent.
a #GdkKeymap
the use case for the modifier mask
Returns the current modifier state.
the current modifier state.
a #GdkKeymap
Returns whether the Num Lock modifer is locked.
%TRUE if Num Lock is on
a #GdkKeymap
Returns whether the Scroll Lock modifer is locked.
%TRUE if Scroll Lock is on
a #GdkKeymap
Determines if keyboard layouts for both right-to-left and left-to-right
languages are in use.
%TRUE if there are layouts in both directions, %FALSE otherwise
a #GdkKeymap
Looks up the keyval mapped to a keycode/group/level triplet.
If no keyval is bound to @key, returns 0. For normal user input,
you want to use gdk_keymap_translate_keyboard_state() instead of
this function, since the effective group/level may not be
the same as the current keyboard state.
a keyval, or 0 if none was mapped to the given @key
a #GdkKeymap
a #GdkKeymapKey with keycode, group, and level initialized
Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
are set in @state to their non-virtual counterparts (i.e. Mod2,
Mod3,...) and set the corresponding bits in @state.
This function is useful when matching key events against
accelerators.
%FALSE if two virtual modifiers were mapped to the
same non-virtual modifier. Note that %FALSE is also returned
if a virtual modifier is mapped to a non-virtual modifier that
was already set in @state.
a #GdkKeymap
pointer to the modifier state to map
Translates the contents of a #GdkEventKey into a keyval, effective
group, and level. Modifiers that affected the translation and
are thus unavailable for application use are returned in
@consumed_modifiers.
See [Groups][key-group-explanation] for an explanation of
groups and levels. The @effective_group is the group that was
actually used for the translation; some keys such as Enter are not
affected by the active keyboard group. The @level is derived from
@state. For convenience, #GdkEventKey already contains the translated
keyval, so this function isn’t as useful as you might think.
@consumed_modifiers gives modifiers that should be masked outfrom @state
when comparing this key press to a hot key. For instance, on a US keyboard,
the `plus` symbol is shifted, so when comparing a key press to a
`<Control>plus` accelerator `<Shift>` should be masked out.
|[<!-- language="C" -->
// We want to ignore irrelevant modifiers like ScrollLock
#define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
event->state, event->group,
&keyval, NULL, NULL, &consumed);
if (keyval == GDK_PLUS &&
(event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
// Control was pressed
]|
An older interpretation @consumed_modifiers was that it contained
all modifiers that might affect the translation of the key;
this allowed accelerators to be stored with irrelevant consumed
modifiers, by doing:
|[<!-- language="C" -->
// XXX Don’t do this XXX
if (keyval == accel_keyval &&
(event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
// Accelerator was pressed
]|
However, this did not work if multi-modifier combinations were
used in the keymap, since, for instance, `<Control>` would be
masked out even if only `<Control><Alt>` was used in the keymap.
To support this usage as well as well as possible, all single
modifier combinations that could affect the key for any combination
of modifiers will be returned in @consumed_modifiers; multi-modifier
combinations are returned only when actually found in @state. When
you store accelerators, you should always store them with consumed
modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`,
%TRUE if there was a keyval bound to the keycode/state/group
a #GdkKeymap
a keycode
a modifier state
active keyboard group
return location for keyval, or %NULL
return location for effective
group, or %NULL
return location for level, or %NULL
return location for modifiers
that were used to determine the group or level, or %NULL
The ::direction-changed signal gets emitted when the direction of
the keymap changes.
The ::keys-changed signal is emitted when the mapping represented by
@keymap changes.
The ::state-changed signal is emitted when the state of the
keyboard changes, e.g when Caps Lock is turned on or off.
See gdk_keymap_get_caps_lock_state().
A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
the hardware keycode. This is an identifying number for a
physical key.
indicates movement in a horizontal direction. Usually groups are used
for two different languages. In group 0, a key might have two English
characters, and in group 1 it might have two Hebrew characters. The Hebrew
characters will be printed on the key next to the English characters.
indicates which symbol on the key will be used, in a vertical direction.
So on a standard US keyboard, the key with the number “1” on it also has the
exclamation point ("!") character on it. The level indicates whether to use
the “1” or the “!” symbol. The letter keys are considered to have a lowercase
letter at level 0, and an uppercase letter at level 1, though only the
uppercase letter is printed.
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).
the primary modifier used to invoke
menu accelerators.
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.
the modifier used to extend selections
using `modifier`-click or `modifier`-cursor-key
the modifier used to modify selections,
which in most cases means toggling the clicked item into or out of the selection.
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.
the modifier that switches between keyboard
groups (AltGr on X11/Windows and Option/Alt on OS X).
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.
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.
Since 2.10, 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.
the Shift key.
a Lock key (depending on the modifier mapping of the
X server this may either be CapsLock or ShiftLock).
the Control key.
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).
the fifth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this modifier).
the sixth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this modifier).
the seventh modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this modifier).
the eighth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this modifier).
the first mouse button.
the second mouse button.
the third mouse button.
the fourth mouse button.
the fifth mouse button.
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
A reserved bit flag; do not use in your own code
the Super modifier. Since 2.10
the Hyper modifier. Since 2.10
the Meta modifier. Since 2.10
A reserved bit flag; do not use in your own code
not used in GDK itself. GTK+ uses it to differentiate
between (keyval, modifiers) pairs from key press and release events.
a mask covering all modifier types.
GdkMonitor objects represent the individual outputs that are
associated with a #GdkDisplay. GdkDisplay has APIs to enumerate
monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and
to find particular monitors with gdk_display_get_primary_monitor() or
gdk_display_get_monitor_at_window().
GdkMonitor was introduced in GTK+ 3.22 and supersedes earlier
APIs in GdkScreen to obtain monitor-related information.
Gets the display that this monitor belongs to.
the display
a #GdkMonitor
Retrieves the size and position of an individual monitor within the
display coordinate space. The returned geometry is in ”application pixels”,
not in ”device pixels” (see gdk_monitor_get_scale_factor()).
a #GdkMonitor
a #GdkRectangle to be filled with the monitor geometry
Gets the height in millimeters of the monitor.
the physical height of the monitor
a #GdkMonitor
Gets the name or PNP ID of the monitor's manufacturer, if available.
Note that this value might also vary depending on actual
display backend.
PNP ID registry is located at https://uefi.org/pnp_id_list
the name of the manufacturer, or %NULL
a #GdkMonitor
Gets the a string identifying the monitor model, if available.
the monitor model, or %NULL
a #GdkMonitor
Gets the refresh rate of the monitor, if available.
The value is in milli-Hertz, so a refresh rate of 60Hz
is returned as 60000.
the refresh rate in milli-Hertz, or 0
a #GdkMonitor
Gets the internal scale factor that maps from monitor coordinates
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).
This can be used if you want to create pixel based data for a
particular monitor, but most of the time you’re drawing to a window
where it is better to use gdk_window_get_scale_factor() instead.
the scale factor
a #GdkMonitor
Gets information about the layout of red, green and blue
primaries for each pixel in this monitor, if available.
the subpixel layout
a #GdkMonitor
Gets the width in millimeters of the monitor.
the physical width of the monitor
a #GdkMonitor
Retrieves the size and position of the “work area” on a monitor
within the display coordinate space. The returned geometry is in
”application pixels”, not in ”device pixels” (see
gdk_monitor_get_scale_factor()).
The work area should be considered when positioning menus and
similar popups, to avoid placing them below panels, docks or other
desktop components.
Note that not all backends may have a concept of workarea. This
function will return the monitor geometry if a workarea is not
available, or does not apply.
a #GdkMonitor
a #GdkRectangle to be filled with
the monitor workarea
Gets whether this monitor should be considered primary
(see gdk_display_get_primary_monitor()).
%TRUE if @monitor is primary
a #GdkMonitor
Specifies the kind of crossing for #GdkEventCrossing.
See the X11 protocol specification of LeaveNotify for
full details of crossing event generation.
the window is entered from an ancestor or
left towards an ancestor.
the pointer moves between an ancestor and an
inferior of the window.
the window is entered from an inferior or
left towards an inferior.
the window is entered from or left towards
a window which is neither an ancestor nor an inferior.
the pointer moves between two windows
which are not ancestors of each other and the window is part of
the ancestor chain between one of these windows and their least
common ancestor.
an unknown type of enter/leave event occurred.
Specifies why a selection ownership was changed.
some other app claimed the ownership
the window was destroyed
the client was closed
A special value, indicating that the background
for a window should be inherited from the parent window.
Extracts a #GdkAtom from a pointer. The #GdkAtom must have been
stored in the pointer with GDK_ATOM_TO_POINTER().
a pointer containing a #GdkAtom.
This is the priority that the idle handler processing window updates
is given in the
[GLib Main Loop][glib-The-Main-Event-Loop].
Defines the x and y coordinates of a point.
the x coordinate of the point.
the y coordinate of the point.
Describes how existing data is combined with new data when
using gdk_property_change().
the new data replaces the existing data.
the new data is prepended to the existing data.
the new data is appended to the existing data.
Specifies the type of a property change for a #GdkEventProperty.
the property value was changed.
the property was deleted.
A #GdkRGBA is used to represent a (possibly translucent)
color, in a way that is compatible with cairo’s notion of color.
The intensity of the red channel from 0.0 to 1.0 inclusive
The intensity of the green channel from 0.0 to 1.0 inclusive
The intensity of the blue channel from 0.0 to 1.0 inclusive
The opacity of the color from 0.0 for completely translucent to
1.0 for opaque
Makes a copy of a #GdkRGBA.
The result must be freed through gdk_rgba_free().
A newly allocated #GdkRGBA, with the same contents as @rgba
a #GdkRGBA
Compares two RGBA colors.
%TRUE if the two colors compare equal
a #GdkRGBA pointer
another #GdkRGBA pointer
Frees a #GdkRGBA created with gdk_rgba_copy()
a #GdkRGBA
A hash function suitable for using for a hash
table that stores #GdkRGBAs.
The hash value for @p
a #GdkRGBA pointer
Parses a textual representation of a color, filling in
the @red, @green, @blue and @alpha fields of the @rgba #GdkRGBA.
The string can be either one of:
- A standard name (Taken from the X11 rgb.txt file).
- A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
“\#rrrgggbbb” or ”\#rrrrggggbbbb”
- A RGB color in the form “rgb(r,g,b)” (In this case the color will
have full opacity)
- A RGBA color in the form “rgba(r,g,b,a)”
Where “r”, “g”, “b” and “a” are respectively the red, green, blue and
alpha color values. In the last two cases, “r”, “g”, and “b” are either integers
in the range 0 to 255 or percentage values in the range 0% to 100%, and
a is a floating point value in the range 0 to 1.
%TRUE if the parsing succeeded
the #GdkRGBA to fill in
the string specifying the color
Returns a textual specification of @rgba in the form
`rgb(r,g,b)` or
`rgba(r g,b,a)`,
where “r”, “g”, “b” and “a” represent the red, green,
blue and alpha values respectively. “r”, “g”, and “b” are
represented as integers in the range 0 to 255, and “a”
is represented as a floating point value in the range 0 to 1.
These string forms are string forms that are supported by
the CSS3 colors module, and can be parsed by gdk_rgba_parse().
Note that this string representation may lose some
precision, since “r”, “g” and “b” are represented as 8-bit
integers. If this is a concern, you should use a
different representation.
A newly allocated text string
a #GdkRGBA
Defines the position and size of a rectangle. It is identical to
#cairo_rectangle_int_t.
Checks if the two given rectangles are equal.
%TRUE if the rectangles are equal.
a #GdkRectangle
a #GdkRectangle
Calculates the intersection of two rectangles. It is allowed for
@dest to be the same as either @src1 or @src2. If the rectangles
do not intersect, @dest’s width and height is set to 0 and its x
and y values are undefined. If you are only interested in whether
the rectangles intersect, but not in the intersecting area itself,
pass %NULL for @dest.
%TRUE if the rectangles intersect.
a #GdkRectangle
a #GdkRectangle
return location for the
intersection of @src1 and @src2, or %NULL
Calculates the union of two rectangles.
The union of rectangles @src1 and @src2 is the smallest rectangle which
includes both @src1 and @src2 within it.
It is allowed for @dest to be the same as either @src1 or @src2.
Note that this function does not ignore 'empty' rectangles (ie. with
zero width or height).
a #GdkRectangle
a #GdkRectangle
return location for the union of @src1 and @src2
#GdkScreen objects are the GDK representation of the screen on
which windows can be displayed and on which the pointer moves.
X originally identified screens with physical screens, but
nowadays it is more common to have a single #GdkScreen which
combines several physical monitors (see gdk_screen_get_n_monitors()).
GdkScreen is used throughout GDK and GTK+ to specify which screen
the top level windows are to be displayed on. it is also used to
query the screen specification and default settings such as
the default visual (gdk_screen_get_system_visual()), the dimensions
of the physical monitors (gdk_screen_get_monitor_geometry()), etc.
Gets the default screen for the default display. (See
gdk_display_get_default ()).
a #GdkScreen, or %NULL if
there is no default display.
Gets the height of the default screen in pixels. The returned
size is in ”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
Use per-monitor information
the height of the default screen in pixels.
Returns the height of the default screen in millimeters.
Note that on many X servers this value will not be correct.
Use per-monitor information
the height of the default screen in millimeters,
though it is not always correct.
Gets the width of the default screen in pixels. The returned
size is in ”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
Use per-monitor information
the width of the default screen in pixels.
Returns the width of the default screen in millimeters.
Note that on many X servers this value will not be correct.
Use per-monitor information
the width of the default screen in millimeters,
though it is not always correct.
Returns the screen’s currently active window.
On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property
on the root window, as described in the
[Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
If there is no currently currently active
window, or the window manager does not support the
_NET_ACTIVE_WINDOW hint, this function returns %NULL.
On other platforms, this function may return %NULL, depending on whether
it is implementable on that platform.
The returned window should be unrefed using g_object_unref() when
no longer needed.
the currently active window,
or %NULL.
a #GdkScreen
Gets the display to which the @screen belongs.
the display to which @screen belongs
a #GdkScreen
Gets any options previously set with gdk_screen_set_font_options().
the current font options, or %NULL if no
default font options have been set.
a #GdkScreen
Gets the height of @screen in pixels. The returned size is in
”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
Use per-monitor information instead
the height of @screen in pixels.
a #GdkScreen
Returns the height of @screen in millimeters.
Note that this value is somewhat ill-defined when the screen
has multiple monitors of different resolution. It is recommended
to use the monitor dimensions instead.
Use per-monitor information instead
the heigth of @screen in millimeters.
a #GdkScreen
Returns the monitor number in which the point (@x,@y) is located.
Use gdk_display_get_monitor_at_point() instead
the monitor number in which the point (@x,@y) lies, or
a monitor close to (@x,@y) if the point is not in any monitor.
a #GdkScreen.
the x coordinate in the virtual screen.
the y coordinate in the virtual screen.
Returns the number of the monitor in which the largest area of the
bounding rectangle of @window resides.
Use gdk_display_get_monitor_at_window() instead
the monitor number in which most of @window is located,
or if @window does not intersect any monitors, a monitor,
close to @window.
a #GdkScreen.
a #GdkWindow
Retrieves the #GdkRectangle representing the size and position of
the individual monitor within the entire screen area. The returned
geometry is in ”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
Monitor numbers start at 0. To obtain the number of monitors of
@screen, use gdk_screen_get_n_monitors().
Note that the size of the entire screen area can be retrieved via
gdk_screen_get_width() and gdk_screen_get_height().
Use gdk_monitor_get_geometry() instead
a #GdkScreen
the monitor number
a #GdkRectangle to be filled with
the monitor geometry
Gets the height in millimeters of the specified monitor.
Use gdk_monitor_get_height_mm() instead
the height of the monitor, or -1 if not available
a #GdkScreen
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
Returns the output name of the specified monitor.
Usually something like VGA, DVI, or TV, not the actual
product name of the display device.
Use gdk_monitor_get_model() instead
a newly-allocated string containing the name
of the monitor, or %NULL if the name cannot be determined
a #GdkScreen
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
Returns the internal scale factor that maps from monitor coordinates
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).
This can be used if you want to create pixel based data for a
particular monitor, but most of the time you’re drawing to a window
where it is better to use gdk_window_get_scale_factor() instead.
Use gdk_monitor_get_scale_factor() instead
the scale factor
screen to get scale factor for
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
Gets the width in millimeters of the specified monitor, if available.
Use gdk_monitor_get_width_mm() instead
the width of the monitor, or -1 if not available
a #GdkScreen
number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
Retrieves the #GdkRectangle representing the size and position of
the “work area” on a monitor within the entire screen area. The returned
geometry is in ”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
The work area should be considered when positioning menus and
similar popups, to avoid placing them below panels, docks or other
desktop components.
Note that not all backends may have a concept of workarea. This
function will return the monitor geometry if a workarea is not
available, or does not apply.
Monitor numbers start at 0. To obtain the number of monitors of
@screen, use gdk_screen_get_n_monitors().
Use gdk_monitor_get_workarea() instead
a #GdkScreen
the monitor number
a #GdkRectangle to be filled with
the monitor workarea
Returns the number of monitors which @screen consists of.
Use gdk_display_get_n_monitors() instead
number of monitors which @screen consists of
a #GdkScreen
Gets the index of @screen among the screens in the display
to which it belongs. (See gdk_screen_get_display())
the index
a #GdkScreen
Gets the primary monitor for @screen. The primary monitor
is considered the monitor where the “main desktop” lives.
While normal application windows typically allow the window
manager to place the windows, specialized desktop applications
such as panels should place themselves on the primary monitor.
If no primary monitor is configured by the user, the return value
will be 0, defaulting to the first monitor.
Use gdk_display_get_primary_monitor() instead
An integer index for the primary monitor, or 0 if none is configured.
a #GdkScreen.
Gets the resolution for font handling on the screen; see
gdk_screen_set_resolution() for full details.
the current resolution, or -1 if no resolution
has been set.
a #GdkScreen
Gets a visual to use for creating windows with an alpha channel.
The windowing system on which GTK+ is running
may not support this capability, in which case %NULL will
be returned. Even if a non-%NULL value is returned, its
possible that the window’s alpha channel won’t be honored
when displaying the window on the screen: in particular, for
X an appropriate windowing manager and compositing manager
must be running to provide appropriate display.
This functionality is not implemented in the Windows backend.
For setting an overall opacity for a top-level window, see
gdk_window_set_opacity().
a visual to use for windows
with an alpha channel or %NULL if the capability is not
available.
a #GdkScreen
Gets the root window of @screen.
the root window
a #GdkScreen
Retrieves a desktop-wide setting such as double-click time
for the #GdkScreen @screen.
FIXME needs a list of valid settings here, or a link to
more information.
%TRUE if the setting existed and a value was stored
in @value, %FALSE otherwise.
the #GdkScreen where the setting is located
the name of the setting
location to store the value of the setting
Get the system’s default visual for @screen.
This is the visual for the root window of the display.
The return value should not be freed.
the system visual
a #GdkScreen.
Obtains a list of all toplevel windows known to GDK on the screen @screen.
A toplevel window is a child of the root window (see
gdk_get_default_root_window()).
The returned list should be freed with g_list_free(), but
its elements need not be freed.
list of toplevel windows, free with g_list_free()
The #GdkScreen where the toplevels are located.
Gets the width of @screen in pixels. The returned size is in
”application pixels”, not in ”device pixels” (see
gdk_screen_get_monitor_scale_factor()).
Use per-monitor information instead
the width of @screen in pixels.
a #GdkScreen
Gets the width of @screen in millimeters.
Note that this value is somewhat ill-defined when the screen
has multiple monitors of different resolution. It is recommended
to use the monitor dimensions instead.
Use per-monitor information instead
the width of @screen in millimeters.
a #GdkScreen
Returns a #GList of #GdkWindows representing the current
window stack.
On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING
property on the root window, as described in the
[Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
If the window manager does not support the
_NET_CLIENT_LIST_STACKING hint, this function returns %NULL.
On other platforms, this function may return %NULL, depending on whether
it is implementable on that platform.
The returned list is newly allocated and owns references to the
windows it contains, so it should be freed using g_list_free() and
its windows unrefed using g_object_unref() when no longer needed.
a
list of #GdkWindows for the current window stack, or %NULL.
a #GdkScreen
Returns whether windows with an RGBA visual can reasonably
be expected to have their alpha channel drawn correctly on
the screen.
On X11 this function returns whether a compositing manager is
compositing @screen.
Whether windows with RGBA visuals can reasonably be
expected to have their alpha channels drawn correctly on the screen.
a #GdkScreen
Lists the available visuals for the specified @screen.
A visual describes a hardware image data format.
For example, a visual might support 24-bit color, or 8-bit color,
and might expect pixels to be in a certain format.
Call g_list_free() on the return value when you’re finished with it.
a list of visuals; the list must be freed, but not its contents
the relevant #GdkScreen.
Determines the name to pass to gdk_display_open() to get
a #GdkDisplay with this screen as the default screen.
a newly allocated string, free with g_free()
a #GdkScreen
Sets the default font options for the screen. These
options will be set on any #PangoContext’s newly created
with gdk_pango_context_get_for_screen(). Changing the
default set of font options does not affect contexts that
have already been created.
a #GdkScreen
a #cairo_font_options_t, or %NULL to unset any
previously set default font options.
Sets the resolution for font handling on the screen. This is a
scale factor between points specified in a #PangoFontDescription
and cairo units. The default value is 96, meaning that a 10 point
font will be 13 units high. (10 * 96. / 72. = 13.3).
a #GdkScreen
the resolution in “dots per inch”. (Physical inches aren’t actually
involved; the terminology is conventional.)
The ::composited-changed signal is emitted when the composited
status of the screen changes
The ::monitors-changed signal is emitted when the number, size
or position of the monitors attached to the screen change.
Only for X11 and OS X for now. A future implementation for Win32
may be a possibility.
The ::size-changed signal is emitted when the pixel width or
height of a screen changes.
Specifies the direction for #GdkEventScroll.
the window is scrolled up.
the window is scrolled down.
the window is scrolled to the left.
the window is scrolled to the right.
the scrolling is determined by the delta values
in #GdkEventScroll. See gdk_event_get_scroll_deltas(). Since: 3.4
The #GdkSeat object represents a collection of input devices
that belong to a user.
Returns the capabilities this #GdkSeat currently has.
the seat capabilities
a #GdkSeat
Returns the #GdkDisplay this seat belongs to.
a #GdkDisplay. This object is owned by GTK+
and must not be freed.
a #GdkSeat
Returns the master device that routes keyboard events.
a master #GdkDevice with keyboard
capabilities. This object is owned by GTK+ and must not be freed.
a #GdkSeat
Returns the master device that routes pointer events.
a master #GdkDevice with pointer
capabilities. This object is owned by GTK+ and must not be freed.
a #GdkSeat
Returns the slave devices that match the given capabilities.
A list of #GdkDevices.
The list must be freed with g_list_free(), the elements are owned
by GDK and must not be freed.
a #GdkSeat
capabilities to get devices for
Grabs the seat so that all events corresponding to the given @capabilities
are passed to this application until the seat is ungrabbed with gdk_seat_ungrab(),
or the window becomes hidden. This overrides any previous grab on the
seat by this client.
As a rule of thumb, if a grab is desired over %GDK_SEAT_CAPABILITY_POINTER,
all other "pointing" capabilities (eg. %GDK_SEAT_CAPABILITY_TOUCH) should
be grabbed too, so the user is able to interact with all of those while
the grab holds, you should thus use %GDK_SEAT_CAPABILITY_ALL_POINTING most
commonly.
Grabs are used for operations which need complete control over the
events corresponding to the given capabilities. For example in GTK+ this
is used for Drag and Drop operations, popup menus and such.
Note that if the event mask of a #GdkWindow has selected both button press
and button release events, or touch begin and touch end, then a press event
will cause an automatic grab until the button is released, equivalent to a
grab on the window with @owner_events set to %TRUE. This is done because most
applications expect to receive paired press and release events.
If you set up anything at the time you take the grab that needs to be
cleaned up when the grab ends, you should handle the #GdkEventGrabBroken
events that are emitted when the grab ends unvoluntarily.
%GDK_GRAB_SUCCESS if the grab was successful.
a #GdkSeat
the #GdkWindow which will own the grab
capabilities that will be grabbed
if %FALSE then all device events are reported with respect to
@window and are only reported if selected by @event_mask. If
%TRUE then pointer events for this application are reported
as normal, but pointer events outside this application are
reported with respect to @window and only if selected by
@event_mask. In either mode, unreported events are discarded.
the cursor to display while the grab is active. If
this is %NULL then the normal cursors are used for
@window and its descendants, and the cursor for @window is used
elsewhere.
the event that is triggering the grab, or %NULL if none
is available.
function to
prepare the window to be grabbed, it can be %NULL if @window is
visible before this call.
user data to pass to @prepare_func
Releases a grab added through gdk_seat_grab().
a #GdkSeat
#GdkDisplay of this seat.
The ::device-added signal is emitted when a new input
device is related to this seat.
the newly added #GdkDevice.
The ::device-removed signal is emitted when an
input device is removed (e.g. unplugged).
the just removed #GdkDevice.
The ::tool-added signal is emitted whenever a new tool
is made known to the seat. The tool may later be assigned
to a device (i.e. on proximity with a tablet). The device
will emit the #GdkDevice::tool-changed signal accordingly.
A same tool may be used by several devices.
the new #GdkDeviceTool known to the seat
This signal is emitted whenever a tool is no longer known
to this @seat.
the just removed #GdkDeviceTool
Flags describing the seat capabilities.
No input capabilities
The seat has a pointer (e.g. mouse)
The seat has touchscreen(s) attached
The seat has drawing tablet(s) attached
The seat has keyboard(s) attached
The union of all pointing capabilities
The union of all capabilities
Type of the callback used to set up @window so it can be
grabbed. A typical action would be ensuring the window is
visible, although there's room for other initialization
actions.
the #GdkSeat being grabbed
the #GdkWindow being grabbed
user data passed in gdk_seat_grab()
Specifies the kind of modification applied to a setting in a
#GdkEventSetting.
a setting was added.
a setting was changed.
a setting was deleted.
This enumeration describes how the red, green and blue components
of physical pixels on an output device are laid out.
The layout is not known
Not organized in this way
The layout is horizontal, the order is RGB
The layout is horizontal, the order is BGR
The layout is vertical, the order is RGB
The layout is vertical, the order is BGR
This macro marks the beginning of a critical section in which GDK and
GTK+ functions can be called safely and without causing race
conditions. Only one thread at a time can be in such a critial
section. The macro expands to a no-op if #G_THREADS_ENABLED has not
been defined. Typically gdk_threads_enter() should be used instead of
this macro.
Use g_main_context_invoke(), g_idle_add() and related
functions if you need to schedule GTK+ calls from other threads.
This macro marks the end of a critical section
begun with #GDK_THREADS_ENTER.
Deprecated in 3.6.
A #GdkTimeCoord stores a single event in a motion history.
The timestamp for this event.
the values of the device’s axes.
Specifies the current state of a touchpad gesture. All gestures are
guaranteed to begin with an event with phase %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
followed by 0 or several events with phase %GDK_TOUCHPAD_GESTURE_PHASE_UPDATE.
A finished gesture may have 2 possible outcomes, an event with phase
%GDK_TOUCHPAD_GESTURE_PHASE_END will be emitted when the gesture is
considered successful, this should be used as the hint to perform any
permanent changes.
Cancelled gestures may be so for a variety of reasons, due to hardware
or the compositor, or due to the gesture recognition layers hinting the
gesture did not finish resolutely (eg. a 3rd finger being added during
a pinch gesture). In these cases, the last event will report the phase
%GDK_TOUCHPAD_GESTURE_PHASE_CANCEL, this should be used as a hint
to undo any visible/permanent changes that were done throughout the
progress of the gesture.
See also #GdkEventTouchpadSwipe and #GdkEventTouchpadPinch.
The gesture has begun.
The gesture has been updated.
The gesture was finished, changes
should be permanently applied.
The gesture was cancelled, all
changes should be undone.
Specifies the visiblity status of a window for a #GdkEventVisibility.
the window is completely visible.
the window is partially visible.
the window is not visible at all.
A #GdkVisual contains information about
a particular visual.
Get the visual with the most available colors for the default
GDK screen. The return value should not be freed.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best visual
Get the best available depth for the default GDK screen. “Best”
means “largest,” i.e. 32 preferred over 24 preferred over 8 bits
per pixel.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best available depth
Return the best available visual type for the default GDK screen.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best visual type
Combines gdk_visual_get_best_with_depth() and
gdk_visual_get_best_with_type().
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best visual with both @depth
and @visual_type, or %NULL if none
a bit depth
a visual type
Get the best visual with depth @depth for the default GDK screen.
Color visuals and visuals with mutable colormaps are preferred
over grayscale or fixed-colormap visuals. The return value should
not be freed. %NULL may be returned if no visual supports @depth.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best visual for the given depth
a bit depth
Get the best visual of the given @visual_type for the default GDK screen.
Visuals with higher color depths are considered better. The return value
should not be freed. %NULL may be returned if no visual has type
@visual_type.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
best visual of the given type
a visual type
Get the system’s default visual for the default GDK screen.
This is the visual for the root window of the display.
The return value should not be freed.
Use gdk_screen_get_system_visual (gdk_screen_get_default ()).
system visual
Returns the number of significant bits per red, green and blue value.
Not all GDK backend provide a meaningful value for this function.
Use gdk_visual_get_red_pixel_details() and its variants to
learn about the pixel layout of TrueColor and DirectColor visuals
The number of significant bits per color value for @visual.
a #GdkVisual
Obtains values that are needed to calculate blue pixel values in TrueColor
and DirectColor. The “mask” is the significant bits within the pixel.
The “shift” is the number of bits left we must shift a primary for it
to be in position (according to the "mask"). Finally, "precision" refers
to how much precision the pixel value contains for a particular primary.
a #GdkVisual
A pointer to a #guint32 to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
Returns the byte order of this visual.
The information returned by this function is only relevant
when working with XImages, and not all backends return
meaningful information for this.
This information is not useful
A #GdkByteOrder stating the byte order of @visual.
A #GdkVisual.
Returns the size of a colormap for this visual.
You have to use platform-specific APIs to manipulate colormaps.
This information is not useful, since GDK does not
provide APIs to operate on colormaps.
The size of a colormap that is suitable for @visual.
A #GdkVisual.
Returns the bit depth of this visual.
The bit depth of this visual.
A #GdkVisual.
Obtains values that are needed to calculate green pixel values in TrueColor
and DirectColor. The “mask” is the significant bits within the pixel.
The “shift” is the number of bits left we must shift a primary for it
to be in position (according to the "mask"). Finally, "precision" refers
to how much precision the pixel value contains for a particular primary.
a #GdkVisual
A pointer to a #guint32 to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
Obtains values that are needed to calculate red pixel values in TrueColor
and DirectColor. The “mask” is the significant bits within the pixel.
The “shift” is the number of bits left we must shift a primary for it
to be in position (according to the "mask"). Finally, "precision" refers
to how much precision the pixel value contains for a particular primary.
A #GdkVisual
A pointer to a #guint32 to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
A pointer to a #gint to be filled in, or %NULL
Gets the screen to which this visual belongs
the screen to which this visual belongs.
a #GdkVisual
Returns the type of visual this is (PseudoColor, TrueColor, etc).
A #GdkVisualType stating the type of @visual.
A #GdkVisual.
A set of values that describe the manner in which the pixel values
for a visual are converted into RGB values for display.
Each pixel value indexes a grayscale value
directly.
Each pixel is an index into a color map that
maps pixel values into grayscale values. The color map can be
changed by an application.
Each pixel value is an index into a predefined,
unmodifiable color map that maps pixel values into RGB values.
Each pixel is an index into a color map that
maps pixel values into rgb values. The color map can be changed by
an application.
Each pixel value directly contains red, green,
and blue components. Use gdk_visual_get_red_pixel_details(), etc,
to obtain information about how the components are assembled into
a pixel value.
Each pixel value contains red, green, and blue
components as for %GDK_VISUAL_TRUE_COLOR, but the components are
mapped via a color table into the final output table instead of
being converted directly.
These are hints originally defined by the Motif toolkit.
The window manager can use them when determining how to decorate
the window. The hint must be set before mapping the window.
all decorations should be applied.
a frame should be drawn around the window.
the frame should have resize handles.
a titlebar should be placed above the window.
a button for opening a menu should be included.
a minimize button should be included.
a maximize button should be included.
These are hints originally defined by the Motif toolkit. The window manager
can use them when determining the functions to offer for the window. The
hint must be set before mapping the window.
all functions should be offered.
the window should be resizable.
the window should be movable.
the window should be minimizable.
the window should be maximizable.
the window should be closable.
Creates a new #GdkWindow using the attributes from
@attributes. See #GdkWindowAttr and #GdkWindowAttributesType for
more details. Note: to use this on displays other than the default
display, @parent must be specified.
the new #GdkWindow
a #GdkWindow, or %NULL to create the window as a child of
the default root window for the default display.
attributes of the new window
mask indicating which
fields in @attributes are valid
Obtains the window underneath the mouse pointer, returning the
location of that window in @win_x, @win_y. Returns %NULL if the
window under the mouse pointer is not known to GDK (if the window
belongs to another application and a #GdkWindow hasn’t been created
for it with gdk_window_foreign_new())
NOTE: For multihead-aware widgets or applications use
gdk_display_get_window_at_pointer() instead.
Use gdk_device_get_window_at_position() instead.
window under the mouse pointer
return location for origin of the window under the pointer
return location for origin of the window under the pointer
Constrains a desired width and height according to a
set of geometry hints (such as minimum and maximum size).
a #GdkGeometry structure
a mask indicating what portions of @geometry are set
desired width of window
desired height of the window
location to store resulting width
location to store resulting height
Calls gdk_window_process_updates() for all windows (see #GdkWindow)
in the application.
With update debugging enabled, calls to
gdk_window_invalidate_region() clear the invalidated region of the
screen to a noticeable color, and GDK pauses for a short time
before sending exposes to windows during
gdk_window_process_updates(). The net effect is that you can see
the invalid region for each window and watch redraws as they
occur. This allows you to diagnose inefficiencies in your application.
In essence, because the GDK rendering model prevents all flicker,
if you are redrawing the same region 400 times you may never
notice, aside from noticing a speed problem. Enabling update
debugging causes GTK to flicker slowly and noticeably, so you can
see exactly what’s being redrawn when, in what order.
The --gtk-debug=updates command line option passed to GTK+ programs
enables this debug option at application startup time. That's
usually more useful than calling gdk_window_set_debug_updates()
yourself, though you might want to use this function to enable
updates sometime after application startup time.
%TRUE to turn on update debugging
Adds an event filter to @window, allowing you to intercept events
before they reach GDK. This is a low-level operation and makes it
easy to break GDK and/or GTK+, so you have to know what you're
doing. Pass %NULL for @window to get all events for all windows,
instead of events for a specific window.
If you are interested in X GenericEvents, bear in mind that
XGetEventData() has been already called on the event, and
XFreeEventData() must not be called within @function.
a #GdkWindow
filter callback
data to pass to filter callback
Emits a short beep associated to @window in the appropriate
display, if supported. Otherwise, emits a short beep on
the display just as gdk_display_beep().
a toplevel #GdkWindow
Indicates that you are beginning the process of redrawing @region
on @window, and provides you with a #GdkDrawingContext.
If @window is a top level #GdkWindow, backed by a native window
implementation, a backing store (offscreen buffer) large enough to
contain @region will be created. The backing store will be initialized
with the background color or background surface for @window. Then, all
drawing operations performed on @window will be diverted to the
backing store. When you call gdk_window_end_frame(), the contents of
the backing store will be copied to @window, making it visible
on screen. Only the part of @window contained in @region will be
modified; that is, drawing operations are clipped to @region.
The net result of all this is to remove flicker, because the user
sees the finished product appear all at once when you call
gdk_window_end_draw_frame(). If you draw to @window directly without
calling gdk_window_begin_draw_frame(), the user may see flicker
as individual drawing operations are performed in sequence.
When using GTK+, the widget system automatically places calls to
gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() around
emissions of the `GtkWidget::draw` signal. That is, if you’re
drawing the contents of the widget yourself, you can assume that the
widget has a cleared background, is already set as the clip region,
and already has a backing store. Therefore in most cases, application
code in GTK does not need to call gdk_window_begin_draw_frame()
explicitly.
a #GdkDrawingContext context that should be
used to draw the contents of the window; the returned context is owned
by GDK.
a #GdkWindow
a Cairo region
Begins a window move operation (for a toplevel window).
This function assumes that the drag is controlled by the
client pointer device, use gdk_window_begin_move_drag_for_device()
to begin a drag with a different device.
a toplevel #GdkWindow
the button being used to drag, or 0 for a keyboard-initiated drag
root window X coordinate of mouse click that began the drag
root window Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag
Begins a window move operation (for a toplevel window).
You might use this function to implement a “window move grip,” for
example. The function works best with window managers that support the
[Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec)
but has a fallback implementation for other window managers.
a toplevel #GdkWindow
the device used for the operation
the button being used to drag, or 0 for a keyboard-initiated drag
root window X coordinate of mouse click that began the drag
root window Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag
A convenience wrapper around gdk_window_begin_paint_region() which
creates a rectangular region for you. See
gdk_window_begin_paint_region() for details.
Use gdk_window_begin_draw_frame() instead
a #GdkWindow
rectangle you intend to draw to
Indicates that you are beginning the process of redrawing @region.
A backing store (offscreen buffer) large enough to contain @region
will be created. The backing store will be initialized with the
background color or background surface for @window. Then, all
drawing operations performed on @window will be diverted to the
backing store. When you call gdk_window_end_paint(), the backing
store will be copied to @window, making it visible onscreen. Only
the part of @window contained in @region will be modified; that is,
drawing operations are clipped to @region.
The net result of all this is to remove flicker, because the user
sees the finished product appear all at once when you call
gdk_window_end_paint(). If you draw to @window directly without
calling gdk_window_begin_paint_region(), the user may see flicker
as individual drawing operations are performed in sequence. The
clipping and background-initializing features of
gdk_window_begin_paint_region() are conveniences for the
programmer, so you can avoid doing that work yourself.
When using GTK+, the widget system automatically places calls to
gdk_window_begin_paint_region() and gdk_window_end_paint() around
emissions of the expose_event signal. That is, if you’re writing an
expose event handler, you can assume that the exposed area in
#GdkEventExpose has already been cleared to the window background,
is already set as the clip region, and already has a backing store.
Therefore in most cases, application code need not call
gdk_window_begin_paint_region(). (You can disable the automatic
calls around expose events on a widget-by-widget basis by calling
gtk_widget_set_double_buffered().)
If you call this function multiple times before calling the
matching gdk_window_end_paint(), the backing stores are pushed onto
a stack. gdk_window_end_paint() copies the topmost backing store
onscreen, subtracts the topmost region from all other regions in
the stack, and pops the stack. All drawing operations affect only
the topmost backing store in the stack. One matching call to
gdk_window_end_paint() is required for each call to
gdk_window_begin_paint_region().
Use gdk_window_begin_draw_frame() instead
a #GdkWindow
region you intend to draw to
Begins a window resize operation (for a toplevel window).
This function assumes that the drag is controlled by the
client pointer device, use gdk_window_begin_resize_drag_for_device()
to begin a drag with a different device.
a toplevel #GdkWindow
the edge or corner from which the drag is started
the button being used to drag, or 0 for a keyboard-initiated drag
root window X coordinate of mouse click that began the drag
root window Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag (use gdk_event_get_time())
Begins a window resize operation (for a toplevel window).
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](http://www.freedesktop.org/Standards/wm-spec)
but has a fallback implementation for other window managers.
a toplevel #GdkWindow
the edge or corner from which the drag is started
the device used for the operation
the button being used to drag, or 0 for a keyboard-initiated drag
root window X coordinate of mouse click that began the drag
root window Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag (use gdk_event_get_time())
Does nothing, present only for compatiblity.
this function is no longer needed
a toplevel #GdkWindow
Transforms window coordinates from a parent window to a child
window, where the parent window is the normal parent as returned by
gdk_window_get_parent() for normal windows, and the window's
embedder as returned by gdk_offscreen_window_get_embedder() for
offscreen windows.
For normal windows, calling this function is equivalent to subtracting
the return values of gdk_window_get_position() from the parent coordinates.
For offscreen windows however (which can be arbitrarily transformed),
this function calls the GdkWindow::from-embedder: signal to translate
the coordinates.
You should always use this function when writing generic code that
walks down a window hierarchy.
See also: gdk_window_coords_to_parent()
a child window
X coordinate in parent’s coordinate system
Y coordinate in parent’s coordinate system
return location for X coordinate in child’s coordinate system
return location for Y coordinate in child’s coordinate system
Transforms window coordinates from a child window to its parent
window, where the parent window is the normal parent as returned by
gdk_window_get_parent() for normal windows, and the window's
embedder as returned by gdk_offscreen_window_get_embedder() for
offscreen windows.
For normal windows, calling this function is equivalent to adding
the return values of gdk_window_get_position() to the child coordinates.
For offscreen windows however (which can be arbitrarily transformed),
this function calls the GdkWindow::to-embedder: signal to translate
the coordinates.
You should always use this function when writing generic code that
walks up a window hierarchy.
See also: gdk_window_coords_from_parent()
a child window
X coordinate in child’s coordinate system
Y coordinate in child’s coordinate system
return location for X coordinate
in parent’s coordinate system, or %NULL
return location for Y coordinate
in parent’s coordinate system, or %NULL
Creates a new #GdkGLContext matching the
framebuffer format to the visual of the #GdkWindow. The context
is disconnected from any particular window 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().
the newly created #GdkGLContext, or
%NULL on error
a #GdkWindow
Create a new image surface that is efficient to draw on the
given @window.
Initially the surface contents are all 0 (transparent if contents
have transparency, black otherwise.)
The @width and @height of the new surface are not affected by
the scaling factor of the @window, or by the @scale argument; they
are the size of the surface in device pixels. If you wish to create
an image surface capable of holding the contents of @window you can
use:
|[<!-- language="C" -->
int scale = gdk_window_get_scale_factor (window);
int width = gdk_window_get_width (window) * scale;
int height = gdk_window_get_height (window) * scale;
// format is set elsewhere
cairo_surface_t *surface =
gdk_window_create_similar_image_surface (window,
format,
width, height,
scale);
]|
Note that unlike cairo_surface_create_similar_image(), the new
surface's device scale is set to @scale, or to the scale factor of
@window if @scale is 0.
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.
window to make new surface similar to, or
%NULL if none
the format for the new surface
width of the new surface
height of the new surface
the scale of the new surface, or 0 to use same as @window
Create a new surface that is as compatible as possible with the
given @window. For example the new surface will have the same
fallback resolution and font options as @window. Generally, the new
surface will also use the same backend as @window, unless that is
not possible for some reason. The type of the returned surface may
be examined with cairo_surface_get_type().
Initially the surface contents are all 0 (transparent if contents
have transparency, black otherwise.)
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.
window to make new surface similar to
the content for the new surface
width of the new surface
height of the new surface
Attempt to deiconify (unminimize) @window. On X11 the window manager may
choose to ignore the request to deiconify. When using GTK+,
use gtk_window_deiconify() instead of the #GdkWindow variant. Or better yet,
you probably want to use gtk_window_present_with_time(), which raises the window, focuses it,
unminimizes it, and puts it on the current desktop.
a toplevel #GdkWindow
Destroys the window system resources associated with @window and decrements @window's
reference count. The window system resources for all children of @window are also
destroyed, but the children’s reference counts are not decremented.
Note that a window will not be destroyed automatically when its reference count
reaches zero. You must call this function yourself before that happens.
a #GdkWindow
Does nothing, present only for compatiblity.
this function is no longer needed
a toplevel #GdkWindow
Indicates that the drawing of the contents of @window started with
gdk_window_begin_frame() has been completed.
This function will take care of destroying the #GdkDrawingContext.
It is an error to call this function without a matching
gdk_window_begin_frame() first.
a #GdkWindow
the #GdkDrawingContext created by gdk_window_begin_draw_frame()
Indicates that the backing store created by the most recent call
to gdk_window_begin_paint_region() should be copied onscreen and
deleted, leaving the next-most-recent backing store or no backing
store at all as the active paint region. See
gdk_window_begin_paint_region() for full details.
It is an error to call this function without a matching
gdk_window_begin_paint_region() first.
a #GdkWindow
Tries to ensure that there is a window-system native window for this
GdkWindow. This may fail in some situations, returning %FALSE.
Offscreen window and children of them can never have native windows.
Some backends may not support native child windows.
%TRUE if the window has a native window, %FALSE otherwise
a #GdkWindow
This function does nothing.
a #GdkWindow
Sets keyboard focus to @window. In most cases, gtk_window_present_with_time()
should be used on a #GtkWindow, rather than calling this function.
a #GdkWindow
timestamp of the event triggering the window focus
Temporarily freezes a window and all its descendants such that it won't
receive expose events. The window will begin receiving expose events
again when gdk_window_thaw_toplevel_updates_libgtk_only() is called. If
gdk_window_freeze_toplevel_updates_libgtk_only()
has been called more than once,
gdk_window_thaw_toplevel_updates_libgtk_only() must be called
an equal number of times to begin processing exposes.
This function is not part of the GDK public API and is only
for use by GTK+.
This symbol was never meant to be used outside of GTK+
a #GdkWindow
Temporarily freezes a window such that it won’t receive expose
events. The window will begin receiving expose events again when
gdk_window_thaw_updates() is called. If gdk_window_freeze_updates()
has been called more than once, gdk_window_thaw_updates() must be called
an equal number of times to begin processing exposes.
a #GdkWindow
Moves the window into fullscreen mode. This means the
window covers the entire screen and is above any panels
or task bars.
If the window was already fullscreen, then this function does nothing.
On X11, asks the window manager to put @window in a fullscreen
state, if the window manager supports this operation. Not all
window managers support this, and some deliberately ignore it or
don’t have a concept of “fullscreen”; so you can’t rely on the
fullscreenification actually happening. But it will happen with
most standard window managers, and GDK makes a best effort to get
it to happen.
a toplevel #GdkWindow
Moves the window into fullscreen mode on the given monitor. This means
the window covers the entire screen and is above any panels or task bars.
If the window was already fullscreen, then this function does nothing.
UNRELEASED
a toplevel #GdkWindow
Which monitor to display fullscreen on.
This function informs GDK that the geometry of an embedded
offscreen window has changed. This is necessary for GDK to keep
track of which offscreen window the pointer is in.
an embedded offscreen #GdkWindow
Determines whether or not the desktop environment shuld be hinted that
the window does not want to receive input focus.
whether or not the window should receive input focus.
a toplevel #GdkWindow.
Gets the pattern used to clear the background on @window.
Don't use this function
The pattern to use for the
background or %NULL if there is no background.
a window
Gets the list of children of @window known to GDK.
This function only returns children created via GDK,
so for example it’s useless when used with the root window;
it only returns windows an application created itself.
The returned list must be freed, but the elements in the
list need not be.
list of child windows inside @window
a #GdkWindow
Gets the list of children of @window 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 window is first.
list of child windows inside @window
a #GdkWindow
user data to look for
Computes the region of a window that potentially can be written
to by drawing primitives. This region may not take into account
other factors such as if the window is obscured by other windows,
but no area outside of this region will be affected by drawing
primitives.
a #cairo_region_t. This must be freed with cairo_region_destroy()
when you are done.
a #GdkWindow
Determines whether @window is composited.
See gdk_window_set_composited().
Compositing is an outdated technology that
only ever worked on X11.
%TRUE if the window is composited.
a #GdkWindow
Retrieves a #GdkCursor pointer for the cursor currently set on the
specified #GdkWindow, or %NULL. If the return value is %NULL then
there is no custom cursor set on the specified window, and it is
using the cursor for its parent window.
a #GdkCursor, or %NULL. The
returned object is owned by the #GdkWindow and should not be
unreferenced directly. Use gdk_window_set_cursor() to unset the
cursor of the window
a #GdkWindow
Returns the decorations set on the GdkWindow with
gdk_window_set_decorations().
%TRUE if the window has decorations set, %FALSE otherwise.
The toplevel #GdkWindow to get the decorations from
The window decorations will be written here
Retrieves a #GdkCursor pointer for the @device currently set on the
specified #GdkWindow, or %NULL. If the return value is %NULL then
there is no custom cursor set on the specified window, and it is
using the cursor for its parent window.
a #GdkCursor, or %NULL. The
returned object is owned by the #GdkWindow and should not be
unreferenced directly. Use gdk_window_set_cursor() to unset the
cursor of the window
a #GdkWindow.
a master, pointer #GdkDevice.
Returns the event mask for @window corresponding to an specific device.
device event mask for @window
a #GdkWindow.
a #GdkDevice.
Obtains the current device position and modifier state.
The position is given in coordinates relative to the upper left
corner of @window.
Use gdk_window_get_device_position_double() if you need subpixel precision.
The window underneath @device
(as with gdk_device_get_window_at_position()), or %NULL if the
window is not known to GDK.
a #GdkWindow.
pointer #GdkDevice to query to.
return location for the X coordinate of @device, or %NULL.
return location for the Y coordinate of @device, or %NULL.
return location for the modifier mask, or %NULL.
Obtains the current device position in doubles and modifier state.
The position is given in coordinates relative to the upper left
corner of @window.
The window underneath @device
(as with gdk_device_get_window_at_position()), or %NULL if the
window is not known to GDK.
a #GdkWindow.
pointer #GdkDevice to query to.
return location for the X coordinate of @device, or %NULL.
return location for the Y coordinate of @device, or %NULL.
return location for the modifier mask, or %NULL.
Gets the #GdkDisplay associated with a #GdkWindow.
the #GdkDisplay associated with @window
a #GdkWindow
Finds out the DND protocol supported by a window.
the supported DND protocol.
the destination window
location of the window
where the drop should happen. This may be @window or a proxy window,
or %NULL if @window does not support Drag and Drop.
Obtains the parent of @window, as known to GDK. Works like
gdk_window_get_parent() for normal windows, but returns the
window’s embedder for offscreen windows.
See also: gdk_offscreen_window_get_embedder()
effective parent of @window
a #GdkWindow
Gets the toplevel window that’s an ancestor of @window.
Works like gdk_window_get_toplevel(), but treats an offscreen window's
embedder as its parent, using gdk_window_get_effective_parent().
See also: gdk_offscreen_window_get_embedder()
the effective toplevel window containing @window
a #GdkWindow
Get the current event compression setting for this window.
%TRUE if motion events will be compressed
a #GdkWindow
Gets the event mask for @window for all master input devices. See
gdk_window_set_events().
event mask for @window
a #GdkWindow
Determines whether or not the desktop environment should be hinted that the
window does not want to receive input focus when it is mapped.
whether or not the window wants to receive input focus when
it is mapped.
a toplevel #GdkWindow.
Gets the frame clock for the window. The frame clock for a window
never changes unless the window is reparented to a new toplevel
window.
the frame clock
window to get frame clock for
Obtains the bounding box of the window, including window manager
titlebar/borders if any. The frame position is given in root window
coordinates. To get the position of the window itself (rather than
the frame) in root window coordinates, use gdk_window_get_origin().
a toplevel #GdkWindow
rectangle to fill with bounding box of the window frame
Obtains the #GdkFullscreenMode of the @window.
The #GdkFullscreenMode applied to the window when fullscreen.
a toplevel #GdkWindow
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 window
of @window, which for toplevels usually means relative to the
window decorations (titlebar, etc.) rather than relative to the
root window (screen-size background window).
On the X11 platform, the geometry is obtained from the X server,
so reflects the latest position of @window; this may be out-of-sync
with the position of @window delivered in the most-recently-processed
#GdkEventConfigure. gdk_window_get_position() in contrast gets the
position from the most recent configure event.
Note: If @window is not a toplevel, it is much better
to call gdk_window_get_position(), gdk_window_get_width() and
gdk_window_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_window_get_geometry() is restricted to
the 16-bit coordinates of X11.
a #GdkWindow
return location for X coordinate of window (relative to its parent)
return location for Y coordinate of window (relative to its parent)
return location for width of window
return location for height of window
Returns the group leader window for @window. See gdk_window_set_group().
the group leader window for @window
a toplevel #GdkWindow
Returns the height of the given @window.
On the X11 platform the returned size is the size reported in the
most-recently-processed configure event, rather than the current
size on the X server.
The height of @window
a #GdkWindow
Determines whether or not the window manager is hinted that @window
has modal behaviour.
whether or not the window has the modal hint set.
A toplevel #GdkWindow.
Obtains the position of a window in root window coordinates.
(Compare with gdk_window_get_position() and
gdk_window_get_geometry() which return the position of a window
relative to its parent window.)
not meaningful, ignore
a #GdkWindow
return location for X coordinate
return location for Y coordinate
Obtains the parent of @window, as known to GDK. Does not query the
X server; thus this returns the parent as passed to gdk_window_new(),
not the actual parent. This should never matter unless you’re using
Xlib calls mixed with GDK calls on the X11 platform. It may also
matter for toplevel windows, because the window manager may choose
to reparent them.
Note that you should use gdk_window_get_effective_parent() when
writing generic code that walks up a window hierarchy, because
gdk_window_get_parent() will most likely not do what you expect if
there are offscreen windows in the hierarchy.
parent of @window
a #GdkWindow
Returns whether input to the window is passed through to the window
below.
See gdk_window_set_pass_through() for details
a #GdkWindow
Obtains the current pointer position and modifier state.
The position is given in coordinates relative to the upper left
corner of @window.
Use gdk_window_get_device_position() instead.
the window containing the
pointer (as with gdk_window_at_pointer()), or %NULL if the window
containing the pointer isn’t known to GDK
a #GdkWindow
return location for X coordinate of pointer or %NULL to not
return the X coordinate
return location for Y coordinate of pointer or %NULL to not
return the Y coordinate
return location for modifier mask or %NULL to not return the
modifier mask
Obtains the position of the window as reported in the
most-recently-processed #GdkEventConfigure. Contrast with
gdk_window_get_geometry() which queries the X server for the
current window position, regardless of which events have been
received or processed.
The position coordinates are relative to the window’s parent window.
a #GdkWindow
X coordinate of window
Y coordinate of window
Obtains the position of a window position in root
window coordinates. This is similar to
gdk_window_get_origin() but allows you to pass
in any position in the window, not just the origin.
a #GdkWindow
X coordinate in window
Y coordinate in window
return location for X coordinate
return location for Y coordinate
Obtains the top-left corner of the window manager frame in root
window coordinates.
a toplevel #GdkWindow
return location for X position of window frame
return location for Y position of window frame
Returns the internal scale factor that maps from window coordiantes
to the actual device pixels. On traditional systems this is 1, but
on very high density outputs this can be a higher value (often 2).
A higher value means that drawing is automatically scaled up to
a higher resolution, so any code doing drawing will automatically look
nicer. However, if you are supplying pixel-based data the scale
value can be used to determine whether to use a pixel resource
with higher resolution data.
The scale of a window may change during runtime, if this happens
a configure event will be sent to the toplevel window.
the scale factor
window to get scale factor for
Gets the #GdkScreen associated with a #GdkWindow.
the #GdkScreen associated with @window
a #GdkWindow
Returns the event mask for @window corresponding to the device class specified
by @source.
source event mask for @window
a #GdkWindow
a #GdkInputSource to define the source class.
Gets the bitwise OR of the currently active window state flags,
from the #GdkWindowState enumeration.
window state bitfield
a #GdkWindow
Returns %TRUE if the window is aware of the existence of multiple
devices.
%TRUE if the window handles multidevice features.
a #GdkWindow.
Gets the toplevel window that’s an ancestor of @window.
Any window type but %GDK_WINDOW_CHILD is considered a
toplevel window, as is a %GDK_WINDOW_CHILD window that
has a root window as parent.
Note that you should use gdk_window_get_effective_toplevel() when
you want to get to a window’s toplevel as seen on screen, because
gdk_window_get_toplevel() will most likely not do what you expect
if there are offscreen windows in the hierarchy.
the toplevel window containing @window
a #GdkWindow
This function returns the type hint set for a window.
The type hint set for @window
A toplevel #GdkWindow
Transfers ownership of the update area from @window to the caller
of the function. That is, after calling this function, @window will
no longer have an invalid/dirty region; the update area is removed
from @window and handed to you. If a window has no update area,
gdk_window_get_update_area() returns %NULL. You are responsible for
calling cairo_region_destroy() on the returned region if it’s non-%NULL.
the update area for @window
a #GdkWindow
Retrieves the user data for @window, which is normally the widget
that @window belongs to. See gdk_window_set_user_data().
a #GdkWindow
return location for user data
Computes the region of the @window that is potentially visible.
This does not necessarily take into account if the window is
obscured by other windows, but no area outside of this region
is visible.
a #cairo_region_t. This must be freed with cairo_region_destroy()
when you are done.
a #GdkWindow
Gets the #GdkVisual describing the pixel format of @window.
a #GdkVisual
a #GdkWindow
Returns the width of the given @window.
On the X11 platform the returned size is the size reported in the
most-recently-processed configure event, rather than the current
size on the X server.
The width of @window
a #GdkWindow
Gets the type of the window. See #GdkWindowType.
type of window
a #GdkWindow
Checks whether the window has a native window or not. Note that
you can use gdk_window_ensure_native() if a native window is needed.
%TRUE if the @window has a native window, %FALSE otherwise.
a #GdkWindow
For toplevel windows, withdraws them, so they will no longer be
known to the window manager; for all windows, unmaps them, so
they won’t be displayed. Normally done automatically as
part of gtk_widget_hide().
a #GdkWindow
Asks to iconify (minimize) @window. The window manager may choose
to ignore the request, but normally will honor it. Using
gtk_window_iconify() is preferred, if you have a #GtkWindow widget.
This function only makes sense when @window is a toplevel window.
a toplevel #GdkWindow
Like gdk_window_shape_combine_region(), but the shape applies
only to event handling. Mouse events which happen while
the pointer position corresponds to an unset bit in the
mask will be passed on the window below @window.
An input shape is typically used with RGBA windows.
The alpha channel of the window defines which pixels are
invisible and allows for nicely antialiased borders,
and the input shape controls where the window is
“clickable”.
On the X11 platform, this requires version 1.1 of the
shape extension.
On the Win32 platform, this functionality is not present and the
function does nothing.
a #GdkWindow
region of window to be non-transparent
X position of @shape_region in @window coordinates
Y position of @shape_region in @window coordinates
Adds @region to the update area for @window. The update area is the
region that needs to be redrawn, or “dirty region.” The call
gdk_window_process_updates() sends one or more expose events to the
window, which together cover the entire update area. An
application would normally redraw the contents of @window in
response to those expose events.
GDK will call gdk_window_process_all_updates() on your behalf
whenever your program returns to the main loop and becomes idle, so
normally there’s no need to do that manually, you just need to
invalidate regions that you know should be redrawn.
The @child_func parameter controls whether the region of
each child window that intersects @region will also be invalidated.
Only children for which @child_func returns #TRUE will have the area
invalidated.
a #GdkWindow
a #cairo_region_t
function to use to decide if to
recurse to a child, %NULL means never recurse.
data passed to @child_func
A convenience wrapper around gdk_window_invalidate_region() which
invalidates a rectangular region. See
gdk_window_invalidate_region() for details.
a #GdkWindow
rectangle to invalidate or %NULL to invalidate the whole
window
whether to also invalidate child windows
Adds @region to the update area for @window. The update area is the
region that needs to be redrawn, or “dirty region.” The call
gdk_window_process_updates() sends one or more expose events to the
window, which together cover the entire update area. An
application would normally redraw the contents of @window in
response to those expose events.
GDK will call gdk_window_process_all_updates() on your behalf
whenever your program returns to the main loop and becomes idle, so
normally there’s no need to do that manually, you just need to
invalidate regions that you know should be redrawn.
The @invalidate_children parameter controls whether the region of
each child window that intersects @region will also be invalidated.
If %FALSE, then the update area for child windows will remain
unaffected. See gdk_window_invalidate_maybe_recurse if you need
fine grained control over which children are invalidated.
a #GdkWindow
a #cairo_region_t
%TRUE to also invalidate child windows
Check to see if a window is destroyed..
%TRUE if the window is destroyed
a #GdkWindow
Determines whether or not the window is an input only window.
%TRUE if @window is input only
a toplevel #GdkWindow
Determines whether or not the window is shaped.
%TRUE if @window is shaped
a toplevel #GdkWindow
Check if the window and all ancestors of the window are
mapped. (This is not necessarily "viewable" in the X sense, since
we only check as far as we have GDK window parents, not to the root
window.)
%TRUE if the window is viewable
a #GdkWindow
Checks whether the window has been mapped (with gdk_window_show() or
gdk_window_show_unraised()).
%TRUE if the window is mapped
a #GdkWindow
Lowers @window to the bottom of the Z-order (stacking order), so that
other windows with the same parent window appear above @window.
This is true whether or not the other windows are visible.
If @window is a toplevel, the window manager may choose to deny the
request to move the window in the Z-order, gdk_window_lower() only
requests the restack, does not guarantee it.
Note that gdk_window_show() raises the window again, so don’t call this
function before gdk_window_show(). (Try gdk_window_show_unraised().)
a #GdkWindow
If you call this during a paint (e.g. between gdk_window_begin_paint_region()
and gdk_window_end_paint() then GDK will mark the current clip region of the
window as being drawn. This is required when mixing GL rendering via
gdk_cairo_draw_from_gl() and cairo rendering, as otherwise GDK has no way
of knowing when something paints over the GL-drawn regions.
This is typically called automatically by GTK+ and you don't need
to care about this.
a #GdkWindow
a #cairo_t
Maximizes the window. If the window was already maximized, then
this function does nothing.
On X11, asks the window manager to maximize @window, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don’t have a concept of
“maximized”; so you can’t rely on the maximization actually
happening. But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
On Windows, reliably maximizes the window.
a toplevel #GdkWindow
Merges the input shape masks for any child windows into the
input shape mask for @window. i.e. the union of all input masks
for @window and its children will become the new input mask
for @window. See gdk_window_input_shape_combine_region().
This function is distinct from gdk_window_set_child_input_shapes()
because it includes @window’s input shape mask in the set of
shapes to be merged.
a #GdkWindow
Merges the shape masks for any child windows into the
shape mask for @window. i.e. the union of all masks
for @window and its children will become the new mask
for @window. See gdk_window_shape_combine_region().
This function is distinct from gdk_window_set_child_shapes()
because it includes @window’s shape mask in the set of shapes to
be merged.
a #GdkWindow
Repositions a window relative to its parent window.
For toplevel windows, window managers may ignore or modify the move;
you should probably use gtk_window_move() on a #GtkWindow widget
anyway, instead of using GDK functions. For child windows,
the move will reliably succeed.
If you’re also planning to resize the window, use gdk_window_move_resize()
to both move and resize simultaneously, for a nicer visual effect.
a #GdkWindow
X coordinate relative to window’s parent
Y coordinate relative to window’s parent
Move the part of @window indicated by @region by @dy pixels in the Y
direction and @dx pixels in the X direction. The portions of @region
that not covered by the new position of @region are invalidated.
Child windows are not moved.
a #GdkWindow
The #cairo_region_t to move
Amount to move in the X direction
Amount to move in the Y direction
Equivalent to calling gdk_window_move() and gdk_window_resize(),
except that both operations are performed at once, avoiding strange
visual effects. (i.e. the user may be able to see the window first
move, then resize, if you don’t use gdk_window_move_resize().)
a #GdkWindow
new X position relative to window’s parent
new Y position relative to window’s parent
new width
new height
Moves @window to @rect, aligning their anchor points.
@rect is relative to the top-left corner of the window that @window is
transient for. @rect_anchor and @window_anchor determine anchor points on
@rect and @window 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 @window.
@anchor_hints determines how @window will be moved if the anchor points cause
it to move off-screen. For example, %GDK_ANCHOR_FLIP_X will replace
%GDK_GRAVITY_NORTH_WEST with %GDK_GRAVITY_NORTH_EAST and vice versa if
@window extends beyond the left or right edges of the monitor.
Connect to the #GdkWindow::moved-to-rect signal to find out how it was
actually positioned.
the #GdkWindow to move
the destination #GdkRectangle to align @window with
the point on @rect to align with @window's anchor point
the point on @window to align with @rect's anchor point
positioning hints to use when limited on space
horizontal offset to shift @window, i.e. @rect's anchor
point
vertical offset to shift @window, i.e. @rect's anchor point
Like gdk_window_get_children(), but does not copy the list of
children, so the list does not need to be freed.
a reference to the list of child windows in @window
a #GdkWindow
Sends one or more expose events to @window. The areas in each
expose event will cover the entire update area for the window (see
gdk_window_invalidate_region() for details). Normally GDK calls
gdk_window_process_all_updates() on your behalf, so there’s no
need to call this function unless you want to force expose events
to be delivered immediately and synchronously (vs. the usual
case, where GDK delivers them in an idle handler). Occasionally
this is useful to produce nicer scrolling behavior, for example.
a #GdkWindow
whether to also process updates for child windows
Raises @window to the top of the Z-order (stacking order), so that
other windows with the same parent window appear below @window.
This is true whether or not the windows are visible.
If @window is a toplevel, the window manager may choose to deny the
request to move the window in the Z-order, gdk_window_raise() only
requests the restack, does not guarantee it.
a #GdkWindow
Registers a window as a potential drop destination.
a #GdkWindow.
Remove a filter previously added with gdk_window_add_filter().
a #GdkWindow
previously-added filter function
user data for previously-added filter function
Reparents @window into the given @new_parent. The window being
reparented will be unmapped as a side effect.
a #GdkWindow
new parent to move @window into
X location inside the new parent
Y location inside the new parent
Resizes @window; for toplevel windows, asks the window manager to resize
the window. The window manager may not allow the resize. When using GTK+,
use gtk_window_resize() instead of this low-level GDK function.
Windows may not be resized below 1x1.
If you’re also planning to move the window, use gdk_window_move_resize()
to both move and resize simultaneously, for a nicer visual effect.
a #GdkWindow
new width of the window
new height of the window
Changes the position of @window in the Z-order (stacking order), so that
it is above @sibling (if @above is %TRUE) or below @sibling (if @above is
%FALSE).
If @sibling is %NULL, then this either raises (if @above is %TRUE) or
lowers the window.
If @window is a toplevel, the window manager may choose to deny the
request to move the window in the Z-order, gdk_window_restack() only
requests the restack, does not guarantee it.
a #GdkWindow
a #GdkWindow that is a sibling of @window, or %NULL
a boolean
Scroll the contents of @window, both pixels and children, by the
given amount. @window itself does not move. Portions of the window
that the scroll operation brings in from offscreen areas are
invalidated. The invalidated region may be bigger than what would
strictly be necessary.
For X11, a minimum area will be invalidated if the window has no
subwindows, or if the edges of the window’s parent do not extend
beyond the edges of the window. In other cases, a multi-step process
is used to scroll the window which may produce temporary visual
artifacts and unnecessary invalidations.
a #GdkWindow
Amount to scroll in the X direction
Amount to scroll in the Y direction
Setting @accept_focus to %FALSE hints the desktop environment that the
window doesn’t want to receive input focus.
On X, it is the responsibility of the window manager to interpret this
hint. ICCCM-compliant window manager usually respect it.
a toplevel #GdkWindow
%TRUE if the window should receive input focus
Sets the background color of @window.
However, when using GTK+, influence the background of a widget
using a style class or CSS — if you’re an application — or with
gtk_style_context_set_background() — if you're implementing a
custom widget.
Don't use this function
a #GdkWindow
a #GdkColor
Sets the background of @window.
A background of %NULL means that the window won't have any background. On the
X11 backend it's also possible to inherit the background from the parent
window using gdk_x11_get_parent_relative_pattern().
The windowing system will normally fill a window with its background
when the window is obscured then exposed.
Don't use this function
a #GdkWindow
a pattern to use, or %NULL
Sets the background color of @window.
See also gdk_window_set_background_pattern().
Don't use this function
a #GdkWindow
a #GdkRGBA color
Sets the input shape mask of @window to the union of input shape masks
for all children of @window, ignoring the input shape mask of @window
itself. Contrast with gdk_window_merge_child_input_shapes() which includes
the input shape mask of @window in the masks to be merged.
a #GdkWindow
Sets the shape mask of @window to the union of shape masks
for all children of @window, ignoring the shape mask of @window
itself. Contrast with gdk_window_merge_child_shapes() which includes
the shape mask of @window in the masks to be merged.
a #GdkWindow
Sets a #GdkWindow as composited, or unsets it. Composited
windows do not automatically have their contents drawn to
the screen. Drawing is redirected to an offscreen buffer
and an expose event is emitted on the parent of the composited
window. It is the responsibility of the parent’s expose handler
to manually merge the off-screen content onto the screen in
whatever way it sees fit.
It only makes sense for child windows to be composited; see
gdk_window_set_opacity() if you need translucent toplevel
windows.
An additional effect of this call is that the area of this
window is no longer clipped from regions marked for
invalidation on its parent. Draws done on the parent
window are also no longer clipped by the child.
This call is only supported on some systems (currently,
only X11 with new enough Xcomposite and Xdamage extensions).
You must call gdk_display_supports_composite() to check if
setting a window as composited is supported before
attempting to do so.
Compositing is an outdated technology that
only ever worked on X11.
a #GdkWindow
%TRUE to set the window as composited
Sets the default mouse pointer for a #GdkWindow.
Note that @cursor must be for the same display as @window.
Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to
create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
Passing %NULL for the @cursor argument to gdk_window_set_cursor() means
that @window will use the cursor of its parent window. Most windows
should use this default.
a #GdkWindow
a cursor
“Decorations” are the features the window manager adds to a toplevel #GdkWindow.
This function sets the traditional Motif window manager hints that tell the
window manager which decorations you would like your window to have.
Usually you should use gtk_window_set_decorated() on a #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.
a toplevel #GdkWindow
decoration hint mask
Sets a specific #GdkCursor for a given device when it gets inside @window.
Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to create
the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing
%NULL for the @cursor argument to gdk_window_set_cursor() means that
@window will use the cursor of its parent window. Most windows should
use this default.
a #GdkWindow
a master, pointer #GdkDevice
a #GdkCursor
Sets the event mask for a given device (Normally a floating device, not
attached to any visible pointer) to @window. For example, an event mask
including #GDK_BUTTON_PRESS_MASK means the window should report button
press events. The event mask is the bitwise OR of values from the
#GdkEventMask enumeration.
See the [input handling overview][event-masks] for details.
a #GdkWindow
#GdkDevice to enable events for.
event mask for @window
Determines whether or not extra unprocessed motion events in
the event queue can be discarded. If %TRUE only the most recent
event will be delivered.
Some types of applications, e.g. paint programs, need to see all
motion events and will benefit from turning off event compression.
By default, event compression is enabled.
a #GdkWindow
%TRUE if motion events should be compressed
The event mask for a window determines which events will be reported
for that window from all master input devices. For example, an event mask
including #GDK_BUTTON_PRESS_MASK means the window should report button
press events. The event mask is the bitwise OR of values from the
#GdkEventMask enumeration.
See the [input handling overview][event-masks] for details.
a #GdkWindow
event mask for @window
Setting @focus_on_map to %FALSE hints the desktop environment that the
window doesn’t want to receive input focus when it is mapped.
focus_on_map should be turned off for windows that aren’t triggered
interactively (such as popups from network activity).
On X, it is the responsibility of the window manager to interpret
this hint. Window managers following the freedesktop.org window
manager extension specification should respect it.
a toplevel #GdkWindow
%TRUE if the window should receive input focus when mapped
Specifies whether the @window should span over all monitors (in a multi-head
setup) or only the current monitor when in fullscreen mode.
The @mode argument is from the #GdkFullscreenMode enumeration.
If #GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen @window will
span over all monitors from the #GdkScreen.
On X11, searches through the list of monitors from the #GdkScreen the ones
which delimit the 4 edges of the entire #GdkScreen and will ask the window
manager to span the @window over these monitors.
If the XINERAMA extension is not available or not usable, this function
has no effect.
Not all window managers support this, so you can’t rely on the fullscreen
window to span over the multiple monitors when #GDK_FULLSCREEN_ON_ALL_MONITORS
is specified.
a toplevel #GdkWindow
fullscreen mode
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.
a toplevel #GdkWindow
bitmask of operations to allow on @window
Sets the geometry hints for @window. Hints flagged in @geom_mask
are set, hints not flagged in @geom_mask are unset.
To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL.
This function provides hints to the windowing system about
acceptable sizes for a toplevel window. The purpose of
this is to constrain user resizing, but the windowing system
will typically (but is not required to) also constrain the
current size of the window to the provided values and
constrain programatic resizing via gdk_window_resize() or
gdk_window_move_resize().
Note that on X11, this effect has no effect on windows
of type %GDK_WINDOW_TEMP or windows where override redirect
has been turned on via gdk_window_set_override_redirect()
since these windows are not resizable by the user.
Since you can’t count on the windowing system doing the
constraints for programmatic resizes, you should generally
call gdk_window_constrain_size() yourself to determine
appropriate sizes.
a toplevel #GdkWindow
geometry hints
bitmask indicating fields of @geometry to pay attention to
Sets the group leader window for @window. By default,
GDK sets the group leader for all toplevel windows
to a global window implicitly created by GDK. With this function
you can override this default.
The group leader window allows the window manager to distinguish
all windows that belong to a single application. It may for example
allow users to minimize/unminimize all windows belonging to an
application at once. You should only set a non-default group window
if your application pretends to be multiple applications.
a toplevel #GdkWindow
group leader window, or %NULL to restore the default group leader window
Sets a list of icons for the window. One of these will be used
to represent the window when it has been iconified. The icon is
usually shown in an icon box or some sort of task bar. Which icon
size is shown depends on the window manager. The window manager
can scale the icon but setting several size icons can give better
image quality since the window manager may only need to scale the
icon by a small amount or not at all.
Note that some platforms don't support window icons.
The #GdkWindow toplevel window to set the icon of.
A list of pixbufs, of different sizes.
Windows may have a name used while minimized, distinct from the
name they display in their titlebar. Most of the time this is a bad
idea from a user interface standpoint. But you can set such a name
with this function, if you like.
After calling this with a non-%NULL @name, calls to gdk_window_set_title()
will not update the icon title.
Using %NULL for @name unsets the icon title; further calls to
gdk_window_set_title() will again update the icon title as well.
Note that some platforms don't support window icons.
a toplevel #GdkWindow
name of window while iconified (minimized)
Registers an invalidate handler for a specific window. This
will get called whenever a region in the window or its children
is invalidated.
This can be used to record the invalidated region, which is
useful if you are keeping an offscreen copy of some region
and want to keep it up to date. You can also modify the
invalidated region in case you’re doing some effect where
e.g. a child widget appears in multiple places.
a #GdkWindow
a #GdkWindowInvalidateHandlerFunc callback function
Set if @window must be kept above other windows. If the
window was already above, then this function does nothing.
On X11, asks the window manager to keep @window above, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don’t have a concept of
“keep above”; so you can’t rely on the window being kept above.
But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
a toplevel #GdkWindow
whether to keep @window above other windows
Set if @window must be kept below other windows. If the
window was already below, then this function does nothing.
On X11, asks the window manager to keep @window below, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don’t have a concept of
“keep below”; so you can’t rely on the window being kept below.
But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
a toplevel #GdkWindow
whether to keep @window below other windows
The application can use this hint to tell the window manager
that a certain window has modal behaviour. The window manager
can use this information to handle modal windows in a special
way.
You should only use this on windows for which you have
previously called gdk_window_set_transient_for()
A toplevel #GdkWindow
%TRUE if the window is modal, %FALSE otherwise.
Set @window to render as partially transparent,
with opacity 0 being fully transparent and 1 fully opaque. (Values
of the opacity parameter are clamped to the [0,1] range.)
For toplevel windows this depends on support from the windowing system
that may not always be there. For instance, On X11, this works only on
X screens with a compositing manager running. On Wayland, there is no
per-window opacity value that the compositor would apply. Instead, use
`gdk_window_set_opaque_region (window, NULL)` to tell the compositor
that the entire window is (potentially) non-opaque, and draw your content
with alpha, or use gtk_widget_set_opacity() to set an overall opacity
for your widgets.
For child windows this function only works for non-native windows.
For setting up per-pixel alpha topelevels, see gdk_screen_get_rgba_visual(),
and for non-toplevels, see gdk_window_set_composited().
Support for non-toplevel windows was added in 3.8.
a top-level or non-native #GdkWindow
opacity
For optimisation purposes, compositing window managers may
like to not draw obscured regions of windows, or turn off blending
during for these regions. With RGB windows with no transparency,
this is just the shape of the window, but with ARGB32 windows, the
compositor does not know what regions of the window are transparent
or not.
This function only works for toplevel windows.
GTK+ will update this property automatically if
the @window background is opaque, as we know where the opaque regions
are. If your window background is not opaque, please update this
property in your #GtkWidget::style-updated handler.
a top-level or non-native #GdkWindow
a region, or %NULL
An override redirect window is not under the control of the window manager.
This means it won’t have a titlebar, won’t be minimizable, etc. - it will
be entirely under the control of the application. The window manager
can’t see the override redirect window at all.
Override redirect should only be used for short-lived temporary
windows, such as popup menus. #GtkMenu uses an override redirect
window in its implementation, for example.
a toplevel #GdkWindow
%TRUE if window should be override redirect
Sets whether input to the window is passed through to the window
below.
The default value of this is %FALSE, which means that pointer
events that happen inside the window are send first to the window,
but if the event is not selected by the event mask then the event
is sent to the parent window, and so on up the hierarchy.
If @pass_through is %TRUE then such pointer events happen as if the
window wasn't there at all, and thus will be sent first to any
windows below @window. This is useful if the window is used in a
transparent fashion. In the terminology of the web this would be called
"pointer-events: none".
Note that a window with @pass_through %TRUE can still have a subwindow
without pass through, so you can get events on a subset of a window. And in
that cases you would get the in-between related events such as the pointer
enter/leave events on its way to the destination window.
a #GdkWindow
a boolean
When using GTK+, typically you should use gtk_window_set_role() instead
of this low-level function.
The window manager and session manager use a window’s role to
distinguish it from other kinds of window in the same application.
When an application is restarted after being saved in a previous
session, all windows with the same title and role are treated as
interchangeable. So if you have two windows with the same title
that should be distinguished for session management purposes, you
should set the role on those windows. It doesn’t matter what string
you use for the role, as long as you have a different role for each
non-interchangeable kind of window.
a toplevel #GdkWindow
a string indicating its role
Newer GTK+ windows using client-side decorations use extra geometry
around their frames for effects like shadows and invisible borders.
Window managers that want to maximize windows or snap to edges need
to know where the extents of the actual frame lie, so that users
don’t feel like windows are snapping against random invisible edges.
Note that this property is automatically updated by GTK+, so this
function should only be used by applications which do not use GTK+
to create toplevel windows.
a #GdkWindow
The left extent
The right extent
The top extent
The bottom extent
Toggles whether a window should appear in a pager (workspace
switcher, or other desktop utility program that displays a small
thumbnail representation of the windows on the desktop). If a
window’s semantic type as specified with gdk_window_set_type_hint()
already fully describes the window, this function should
not be called in addition, instead you should
allow the window to be treated according to standard policy for
its semantic type.
a toplevel #GdkWindow
%TRUE to skip the pager
Toggles whether a window should appear in a task list or window
list. If a window’s semantic type as specified with
gdk_window_set_type_hint() already fully describes the window, this
function should not be called in addition,
instead you should allow the window to be treated according to
standard policy for its semantic type.
a toplevel #GdkWindow
%TRUE to skip the taskbar
Sets the event mask for any floating device (i.e. not attached to any
visible pointer) that has the source defined as @source. This event
mask will be applied both to currently existing, newly added devices
after this call, and devices being attached/detached.
a #GdkWindow
a #GdkInputSource to define the source class.
event mask for @window
When using GTK+, typically you should use gtk_window_set_startup_id()
instead of this low-level function.
a toplevel #GdkWindow
a string with startup-notification identifier
Used to set the bit gravity of the given window to static, and flag
it so all children get static subwindow gravity. This is used if you
are implementing scary features that involve deep knowledge of the
windowing system. Don’t worry about it.
static gravities haven't worked on anything but X11
for a long time.
%FALSE
a #GdkWindow
%TRUE to turn on static gravity
This function will enable multidevice features in @window.
Multidevice aware windows will need to handle properly multiple,
per device enter/leave events, device grabs and grab ownerships.
a #GdkWindow.
%TRUE to enable multidevice support in @window.
Sets the title of a toplevel window, to be displayed in the titlebar.
If you haven’t explicitly set the icon name for the window
(using gdk_window_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.
a toplevel #GdkWindow
title of @window
Indicates to the window manager that @window is a transient dialog
associated with the application window @parent. This allows the
window manager to do things like center @window on @parent and
keep @window above @parent.
See gtk_window_set_transient_for() if you’re using #GtkWindow or
#GtkDialog.
a toplevel #GdkWindow
another toplevel #GdkWindow
The application can use this call to provide a hint to the window
manager about the functionality of a window. The window manager
can use this information when determining the decoration and behaviour
of the window.
The hint must be set before the window is mapped.
A toplevel #GdkWindow
A hint of the function this window will have
Toggles whether a window needs the user's
urgent attention.
a toplevel #GdkWindow
%TRUE if the window is urgent
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 #GdkWindow as user data on the
#GdkWindow. So, custom widget implementations should use
this function for that. If GTK+ receives an event for a #GdkWindow,
and the user data for the window is non-%NULL, GTK+ will assume the
user data is a #GtkWidget, and forward the event to that widget.
a #GdkWindow
user data
Makes pixels in @window outside @shape_region be transparent,
so that the window may be nonrectangular.
If @shape_region is %NULL, the shape will be unset, so the whole
window will be opaque again. @offset_x and @offset_y are ignored
if @shape_region is %NULL.
On the X11 platform, this uses an X server extension which is
widely available on most common platforms, but not available on
very old X servers, and occasionally the implementation will be
buggy. On servers without the shape extension, this function
will do nothing.
This function works on both toplevel and child windows.
a #GdkWindow
region of window to be non-transparent
X position of @shape_region in @window coordinates
Y position of @shape_region in @window coordinates
Like gdk_window_show_unraised(), but also raises the window to the
top of the window stack (moves the window to the front of the
Z-order).
This function maps a window so it’s visible onscreen. Its opposite
is gdk_window_hide().
When implementing a #GtkWidget, you should call this function on the widget's
#GdkWindow as part of the “map” method.
a #GdkWindow
Shows a #GdkWindow onscreen, but does not modify its stacking
order. In contrast, gdk_window_show() will raise the window
to the top of the window stack.
On the X11 platform, in Xlib terms, this function calls
XMapWindow() (it also updates some internal GDK state, which means
that you can’t really use XMapWindow() directly on a GDK window).
a #GdkWindow
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.
%TRUE if the window menu was shown and %FALSE otherwise.
a #GdkWindow
a #GdkEvent to show the menu for
“Pins” a window such that it’s on all workspaces and does not scroll
with viewports, for window managers that have scrollable viewports.
(When using #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 window. For window managers that don’t support this operation,
there’s nothing you can do to force it to happen.
a toplevel #GdkWindow
Thaws a window frozen with
gdk_window_freeze_toplevel_updates_libgtk_only().
This function is not part of the GDK public API and is only
for use by GTK+.
This symbol was never meant to be used outside of GTK+
a #GdkWindow
Thaws a window frozen with gdk_window_freeze_updates().
a #GdkWindow
Moves the window out of fullscreen mode. If the window was not
fullscreen, does nothing.
On X11, asks the window manager to move @window out of the fullscreen
state, if the window manager supports this operation. Not all
window managers support this, and some deliberately ignore it or
don’t have a concept of “fullscreen”; so you can’t rely on the
unfullscreenification actually happening. But it will happen with
most standard window managers, and GDK makes a best effort to get
it to happen.
a toplevel #GdkWindow
Unmaximizes the window. If the window wasn’t maximized, then this
function does nothing.
On X11, asks the window manager to unmaximize @window, if the
window manager supports this operation. Not all window managers
support this, and some deliberately ignore it or don’t have a
concept of “maximized”; so you can’t rely on the unmaximization
actually happening. But it will happen with most standard window
managers, and GDK makes a best effort to get it to happen.
On Windows, reliably unmaximizes the window.
a toplevel #GdkWindow
Reverse operation for gdk_window_stick(); see gdk_window_stick(),
and gtk_window_unstick().
a toplevel #GdkWindow
Withdraws a window (unmaps it and asks the window manager to forget about it).
This function is not really useful as gdk_window_hide() automatically
withdraws toplevel windows before hiding them.
a toplevel #GdkWindow
The mouse pointer for a #GdkWindow. See gdk_window_set_cursor() and
gdk_window_get_cursor() for details.
The ::create-surface signal is emitted when an offscreen window
needs its surface (re)created, which happens either when the
window is first drawn to, or when the window is being
resized. The first signal handler that returns a non-%NULL
surface will stop any further signal emission, and its surface
will be used.
Note that it is not possible to access the window's previous
surface from within any callback of this signal. Calling
gdk_offscreen_window_get_surface() will lead to a crash.
the newly created #cairo_surface_t for the offscreen window
the width of the offscreen surface to create
the height of the offscreen surface to create
The ::from-embedder signal is emitted to translate coordinates
in the embedder of an offscreen window to the offscreen window.
See also #GdkWindow::to-embedder.
x coordinate in the embedder window
y coordinate in the embedder window
return location for the x
coordinate in the offscreen window
return location for the y
coordinate in the offscreen window
Emitted when the position of @window is finalized after being moved to a
destination rectangle.
@window 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 @window 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 @window on-screen.
the position of @window after any possible
flipping or %NULL if the backend can't obtain it
the final position of @window or %NULL if the
backend can't obtain it
%TRUE if the anchors were flipped horizontally
%TRUE if the anchors were flipped vertically
The ::pick-embedded-child signal is emitted to find an embedded
child at the given position.
the #GdkWindow of the
embedded child at @x, @y, or %NULL
x coordinate in the window
y coordinate in the window
The ::to-embedder signal is emitted to translate coordinates
in an offscreen window to its embedder.
See also #GdkWindow::from-embedder.
x coordinate in the offscreen window
y coordinate in the offscreen window
return location for the x
coordinate in the embedder window
return location for the y
coordinate in the embedder window
Attributes to use for a newly-created window.
title of the window (for toplevel windows)
event mask (see gdk_window_set_events())
X coordinate relative to parent window (see gdk_window_move())
Y coordinate relative to parent window (see gdk_window_move())
width of window
height of window
#GDK_INPUT_OUTPUT (normal window) or #GDK_INPUT_ONLY (invisible
window that receives events)
#GdkVisual for window
type of window
cursor for the window (see gdk_window_set_cursor())
don’t use (see gtk_window_set_wmclass())
don’t use (see gtk_window_set_wmclass())
%TRUE to bypass the window manager
a hint of the function of the window
Used to indicate which fields in the #GdkWindowAttr struct should be honored.
For example, if you filled in the “cursor” and “x” fields of #GdkWindowAttr,
pass “@GDK_WA_X | @GDK_WA_CURSOR” to gdk_window_new(). Fields in
#GdkWindowAttr not covered by a bit in this enum are required; for example,
the @width/@height, @wclass, and @window_type fields are required, they have
no corresponding flag in #GdkWindowAttributesType.
Honor the title field
Honor the X coordinate field
Honor the Y coordinate field
Honor the cursor field
Honor the visual field
Honor the wmclass_class and wmclass_name fields
Honor the override_redirect field
Honor the type_hint field
A function of this type is passed to gdk_window_invalidate_maybe_recurse().
It gets called for each child of the window to determine whether to
recursively invalidate it or now.
%TRUE to invalidate @window recursively
a #GdkWindow
user data
Determines a window edge or corner.
the top left corner.
the top edge.
the top right corner.
the left edge.
the right edge.
the lower left corner.
the lower edge.
the lower right corner.
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.
indicates that the program has positioned the window
min size fields are set
max size fields are set
base size fields are set
aspect ratio fields are set
resize increment fields are set
window gravity field is set
indicates that the window’s position was explicitly set
by the user
indicates that the window’s size was explicitly set by
the user
Whenever some area of the window is invalidated (directly in the
window or in a child window) this gets called with @region in
the coordinate space of @window. You can use @region to just
keep track of the dirty region, or you can actually change
@region in case you are doing display tricks like showing
a child in multiple places.
a #GdkWindow
a #cairo_region_t
Specifies the state of a toplevel window.
the window is not shown.
the window is minimized.
the window is maximized.
the window is sticky.
the window is maximized without
decorations.
the window is kept above other windows.
the window is kept below other windows.
the window is presented as focused (with active decorations).
the window is in a tiled state, Since 3.10. Since 3.22.23, this
is deprecated in favor of per-edge information.
whether the top edge is tiled, Since 3.22.23
whether the top edge is resizable, Since 3.22.23
whether the right edge is tiled, Since 3.22.23
whether the right edge is resizable, Since 3.22.23
whether the bottom edge is tiled, Since 3.22.23
whether the bottom edge is resizable, Since 3.22.23
whether the left edge is tiled, Since 3.22.23
whether the left edge is resizable, Since 3.22.23
Describes the kind of window.
root window; this window has no parent, covers the entire
screen, and is created by the window system
toplevel window (used to implement #GtkWindow)
child window (used to implement e.g. #GtkEntry)
override redirect temporary window (used to implement
#GtkMenu)
foreign window (see gdk_window_foreign_new())
offscreen window (see
[Offscreen Windows][OFFSCREEN-WINDOWS]). Since 2.18
subsurface-based window; This window is visually
tied to a toplevel, and is moved/stacked with it. Currently this window
type is only implemented in Wayland. Since 3.14
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](http://www.freedesktop.org/Standards/wm-spec)
specification for more details about window types.
Normal toplevel window.
Dialog window.
Window used to implement a menu; GTK+ uses
this hint only for torn-off menus, see #GtkTearoffMenuItem.
Window used to implement toolbars.
Window used to display a splash
screen during application startup.
Utility windows which are not detached
toolbars or dialogs.
Used for creating dock or panel windows.
Used for creating the desktop background
window.
A menu that belongs to a menubar.
A menu that does not belong to a menubar,
e.g. a context menu.
A tooltip.
A notification - typically a “bubble”
that belongs to a status icon.
A popup from a combo box.
A window that is used to implement a DND cursor.
@GDK_INPUT_OUTPUT windows are the standard kind of window you might expect.
Such windows receive events and are also displayed on screen.
@GDK_INPUT_ONLY windows are invisible; they are usually placed above other
windows in order to trap or filter the events. You can’t draw on
@GDK_INPUT_ONLY windows.
window for graphics and events
window for events only
Appends gdk option entries to the passed in option group. This is
not public API and must not be used by applications.
This symbol was never meant to be used outside
of GTK+
An option group.
Finds or creates an atom corresponding to a given string.
the atom corresponding to @atom_name.
a string.
if %TRUE, GDK is allowed to not create a new atom, but
just return %GDK_NONE if the requested atom doesn’t already
exists. Currently, the flag is ignored, since checking the
existance of an atom is as expensive as creating it.
Finds or creates an atom corresponding to a given string.
Note that this function is identical to gdk_atom_intern() except
that if a new #GdkAtom is created the string itself is used rather
than a copy. This saves memory, but can only be used if the string
will always exist. It can be used with statically
allocated strings in the main program, but not with statically
allocated memory in dynamically loaded modules, if you expect to
ever unload the module again (e.g. do not use this function in
GTK+ theme engines).
the atom corresponding to @atom_name
a static string
Emits a short beep on the default display.
Creates a Cairo context for drawing to @window.
Note that calling cairo_reset_clip() on the resulting #cairo_t will
produce undefined results, so avoid it at all costs.
Typically, this function is used to draw on a #GdkWindow out of the paint
cycle of the toolkit; this should be avoided, as it breaks various assumptions
and optimizations.
If you are drawing on a native #GdkWindow in response to a %GDK_EXPOSE event
you should use gdk_window_begin_draw_frame() and gdk_drawing_context_get_cairo_context()
instead. GTK will automatically do this for you when drawing a widget.
Use gdk_window_begin_draw_frame() and
gdk_drawing_context_get_cairo_context() instead
A newly created Cairo context. Free with
cairo_destroy() when you are done drawing.
a #GdkWindow
This is the main way to draw GL content in GTK+. It takes a render buffer ID
(@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
and draws it onto @cr with an OVER operation, respecting the current clip.
The top left corner of the rectangle specified by @x, @y, @width and @height
will be drawn at the current (0,0) position of the cairo_t.
This will work for *all* cairo_t, as long as @window is realized, but the
fallback implementation that reads back the pixels from the buffer may be
used in the general case. In the case of direct drawing to a window with
no special effects applied to @cr it will however use a more efficient
approach.
For #GL_RENDERBUFFER the code will always fall back to software for buffers
with alpha components, so make sure you use #GL_TEXTURE if using alpha.
Calling this may change the current GL context.
a cairo context
The window we're rendering for (not necessarily into)
The GL ID of the source buffer
The type of the @source
The scale-factor that the @source buffer is allocated for
The source x position in @source to start copying from in GL coordinates
The source y position in @source to start copying from in GL coordinates
The width of the region to draw
The height of the region to draw
This is a convenience function around cairo_clip_extents().
It rounds the clip extents to integer coordinates and returns
a boolean indicating if a clip area exists.
%TRUE if a clip rectangle exists, %FALSE if all of @cr is
clipped and all drawing can be skipped
a cairo context
return location for the clip, or %NULL
Retrieves the #GdkDrawingContext that created the Cairo
context @cr.
a #GdkDrawingContext, if any is set
a Cairo context
[Cairo](http://cairographics.org) is a graphics
library that supports vector graphics and image compositing that
can be used with GDK. GTK+ does all of its drawing using cairo.
GDK does not wrap the cairo API, instead it allows to create cairo
contexts which can be used to draw on #GdkWindows. Additional
functions allow use #GdkRectangles with cairo and to use #GdkColors,
#GdkRGBAs, #GdkPixbufs and #GdkWindows as sources for drawing
operations.
Adds the given rectangle to the current path of @cr.
a cairo context
a #GdkRectangle
Adds the given region to the current path of @cr.
a cairo context
a #cairo_region_t
Creates region that describes covers the area where the given
@surface is more than 50% opaque.
This function takes into account device offsets that might be
set with cairo_surface_set_device_offset().
A #cairo_region_t; must be freed with cairo_region_destroy()
a cairo surface
Sets the specified #GdkColor as the source color of @cr.
Use gdk_cairo_set_source_rgba() instead
a cairo context
a #GdkColor
Sets the given pixbuf as the source pattern for @cr.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y.
a cairo context
a #GdkPixbuf
X coordinate of location to place upper left corner of @pixbuf
Y coordinate of location to place upper left corner of @pixbuf
Sets the specified #GdkRGBA as the source color of @cr.
a cairo context
a #GdkRGBA
Sets the given window as the source pattern for @cr.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of @window is @x, @y. The window contains all its
subwindows when rendering.
Note that the contents of @window are undefined outside of the
visible part of @window, so use this function with care.
a cairo context
a #GdkWindow
X coordinate of location to place upper left corner of @window
Y coordinate of location to place upper left corner of @window
Creates an image surface with the same contents as
the pixbuf.
a new cairo surface, must be freed with cairo_surface_destroy()
a #GdkPixbuf
the scale of the new surface, or 0 to use same as @window
The window this will be drawn to, or %NULL
Parses a textual specification of a color and fill in the
@red, @green, and @blue fields of a #GdkColor.
The string can either one of a large set of standard names
(taken from the X11 `rgb.txt` file), or it can be a hexadecimal
value in the form “\#rgb” “\#rrggbb”, “\#rrrgggbbb” or
“\#rrrrggggbbbb” where “r”, “g” and “b” are hex digits of
the red, green, and blue components of the color, respectively.
(White in the four forms is “\#fff”, “\#ffffff”, “\#fffffffff”
and “\#ffffffffffff”).
Use #GdkRGBA
%TRUE if the parsing succeeded
the string specifying the color
the #GdkColor to fill in
A #GdkColor represents a color.
When working with cairo, it is often more convenient
to use a #GdkRGBA instead, and #GdkColor has been
deprecated in favor of #GdkRGBA.
These functions are used to create and destroy cursors.
There is a number of standard cursors, but it is also
possible to construct new cursors from pixbufs. There
may be limitations as to what kinds of cursors can be
constructed on a given display, see
gdk_display_supports_cursor_alpha(),
gdk_display_supports_cursor_color(),
gdk_display_get_default_cursor_size() and
gdk_display_get_maximal_cursor_size().
Cursors by themselves are not very interesting, they must be be
bound to a window for users to see them. This is done with
gdk_window_set_cursor() or by setting the cursor member of the
#GdkWindowAttr passed to gdk_window_new().
Disables multidevice support in GDK. This call must happen prior
to gdk_display_open(), gtk_init(), gtk_init_with_args() or
gtk_init_check() in order to take effect.
Most common GTK+ applications won’t ever need to call this. Only
applications that do mixed GDK/Xlib calls could want to disable
multidevice support if such Xlib code deals with input devices in
any way and doesn’t observe the presence of XInput 2.
These functions provide a low level interface for drag and drop.
The X backend of GDK supports both the Xdnd and Motif drag and drop
protocols transparently, the Win32 backend supports the WM_DROPFILES
protocol.
GTK+ provides a higher level abstraction based on top of these functions,
and so they are not normally needed in GTK+ applications.
See the [Drag and Drop][gtk3-Drag-and-Drop] section of
the GTK+ documentation for more information.
Aborts a drag without dropping.
This function is called by the drag source.
This function does not need to be called in managed drag and drop
operations. See gdk_drag_context_manage_dnd() for more information.
a #GdkDragContext
the timestamp for this operation
Starts a drag and creates a new drag context for it.
This function assumes that the drag is controlled by the
client pointer device, use gdk_drag_begin_for_device() to
begin a drag with a different device.
This function is called by the drag source.
a newly created #GdkDragContext
the source window for this drag.
the offered targets,
as list of #GdkAtoms
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
a newly created #GdkDragContext
the source window for this drag
the device that controls this drag
the offered targets,
as list of #GdkAtoms
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
a newly created #GdkDragContext
the source window for this drag
the device that controls this drag
the offered targets,
as list of #GdkAtoms
the x coordinate where the drag nominally started
the y coordinate where the drag nominally started
Drops on the current destination.
This function is called by the drag source.
This function does not need to be called in managed drag and drop
operations. See gdk_drag_context_manage_dnd() for more information.
a #GdkDragContext
the timestamp for this operation
Inform GDK if the drop ended successfully. Passing %FALSE
for @success may trigger a drag cancellation animation.
This function is called by the drag source, and should
be the last call before dropping the reference to the
@context.
The #GdkDragContext will only take the first gdk_drag_drop_done()
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
a #GdkDragContext
whether the drag was ultimatively successful
Returns whether the dropped data has been successfully
transferred. This function is intended to be used while
handling a %GDK_DROP_FINISHED event, its return value is
meaningless at other times.
%TRUE if the drop was successful.
a #GdkDragContext
Finds the destination window and DND protocol to use at the
given pointer position.
This function is called by the drag source to obtain the
@dest_window and @protocol parameters for gdk_drag_motion().
a #GdkDragContext
a window which may be at the pointer position, but
should be ignored, since it is put up by the drag source as an icon
the screen where the destination window is sought
the x position of the pointer in root coordinates
the y position of the pointer in root coordinates
location to store the destination window in
location to store the DND protocol in
Returns the selection atom for the current source window.
the selection atom, or %GDK_NONE
a #GdkDragContext.
Updates the drag context when the pointer moves or the
set of actions changes.
This function is called by the drag source.
This function does not need to be called in managed drag and drop
operations. See gdk_drag_context_manage_dnd() for more information.
a #GdkDragContext
the new destination window, obtained by
gdk_drag_find_window()
the DND protocol in use, obtained by gdk_drag_find_window()
the x position of the pointer in root coordinates
the y position of the pointer in root coordinates
the suggested action
the possible actions
the timestamp for this operation
Selects one of the actions offered by the drag source.
This function is called by the drag destination in response to
gdk_drag_motion() called by the drag source.
a #GdkDragContext
the selected action which will be taken when a drop happens,
or 0 to indicate that a drop will not be accepted
the timestamp for this operation
Ends the drag operation after a drop.
This function is called by the drag destination.
a #GdkDragContext
%TRUE if the data was successfully received
the timestamp for this operation
Accepts or rejects a drop.
This function is called by the drag destination in response
to a drop initiated by the drag source.
a #GdkDragContext
%TRUE if the drop is accepted
the timestamp for this operation
Removes an error trap pushed with gdk_error_trap_push().
May block until an error has been definitively received
or not received from the X server. gdk_error_trap_pop_ignored()
is preferred if you don’t need to know whether an error
occurred, because it never has to block. If you don't
need the return value of gdk_error_trap_pop(), use
gdk_error_trap_pop_ignored().
Prior to GDK 3.0, this function would not automatically
sync for you, so you had to gdk_flush() if your last
call to Xlib was not a blocking round trip.
X error code or 0 on success
Removes an error trap pushed with gdk_error_trap_push(), but
without bothering to wait and see whether an error occurred. If an
error arrives later asynchronously that was triggered while the
trap was pushed, that error will be ignored.
This function allows X errors to be trapped instead of the normal
behavior of exiting the application. It should only be used if it
is not possible to avoid the X error in any other way. Errors are
ignored on all #GdkDisplay currently known to the
#GdkDisplayManager. If you don’t care which error happens and just
want to ignore everything, pop with gdk_error_trap_pop_ignored().
If you need the error code, use gdk_error_trap_pop() which may have
to block and wait for the error to arrive from the X server.
This API exists on all platforms but only does anything on X.
You can use gdk_x11_display_error_trap_push() to ignore errors
on only a single display.
## Trapping an X error
|[<!-- language="C" -->
gdk_error_trap_push ();
// ... Call the X function which may cause an error here ...
if (gdk_error_trap_pop ())
{
// ... Handle the error here ...
}
]|
Checks all open displays for a #GdkEvent to process,to be processed
on, fetching events from the windowing system if necessary.
See gdk_display_get_event().
the next #GdkEvent to be processed, or %NULL
if no events are pending. The returned #GdkEvent should be freed
with gdk_event_free().
Sets the function to call to handle all events from GDK.
Note that GTK+ uses this to install its own event handler, so it is
usually not useful for GTK+ applications. (Although an application
can call this function then call gtk_main_do_event() to pass
events to GTK+.)
the function to call to handle events from GDK.
user data to pass to the function.
the function to call when the handler function is removed, i.e. when
gdk_event_handler_set() is called with another event handler.
If there is an event waiting in the event queue of some open
display, returns a copy of it. See gdk_display_peek_event().
a copy of the first #GdkEvent on some event
queue, or %NULL if no events are in any queues. The returned
#GdkEvent should be freed with gdk_event_free().
Request more motion notifies if @event is a motion notify hint event.
This function should be used instead of gdk_window_get_pointer() to
request further motion notifies, because it also works for extension
events where motion notifies are provided for devices other than the
core pointer. Coordinate extraction, processing and requesting more
motion events from a %GDK_MOTION_NOTIFY event usually works like this:
|[<!-- language="C" -->
{
// motion_event handler
x = motion_event->x;
y = motion_event->y;
// handle (x,y) motion
gdk_event_request_motions (motion_event); // handles is_hint events
}
]|
a valid #GdkEvent
The event structures contain data specific to each type of event in GDK.
> A common mistake is to forget to set the event mask of a widget so that
> the required events are received. See gtk_widget_set_events().
This section describes functions dealing with events from the window
system.
In GTK+ applications the events are handled automatically in
gtk_main_do_event() and passed on to the appropriate widgets, so these
functions are rarely needed. Though some of the fields in the
[Event Structures][gdk3-Event-Structures] are useful.
If both events contain X/Y information, this function will return %TRUE
and return in @angle the relative angle from @event1 to @event2. The rotation
direction for positive angles is from the positive X axis towards the positive
Y axis.
%TRUE if the angle could be calculated.
first #GdkEvent
second #GdkEvent
return location for the relative angle between both events
If both events contain X/Y information, the center of both coordinates
will be returned in @x and @y.
%TRUE if the center could be calculated.
first #GdkEvent
second #GdkEvent
return location for the X coordinate of the center
return location for the Y coordinate of the center
If both events have X/Y information, the distance between both coordinates
(as in a straight line going from @event1 to @event2) will be returned.
%TRUE if the distance could be calculated.
first #GdkEvent
second #GdkEvent
return location for the distance
Checks if any events are ready to be processed for any display.
%TRUE if any events are pending.
Flushes the output buffers of all display connections and waits
until all requests have been processed.
This is rarely needed by applications.
The functions in this section are intended to be used in test programs.
They allow to simulate some user input.
This section describes the GDK initialization functions and miscellaneous
utility functions, as well as deprecation facilities.
The GDK and GTK+ headers annotate deprecated APIs in a way that produces
compiler warnings if these deprecated APIs are used. The warnings
can be turned off by defining the macro %GDK_DISABLE_DEPRECATION_WARNINGS
before including the glib.h header.
GDK and GTK+ also provide support for building applications against
defined subsets of deprecated or new APIs. Define the macro
%GDK_VERSION_MIN_REQUIRED to specify up to what version
you want to receive warnings about deprecated APIs. Define the
macro %GDK_VERSION_MAX_ALLOWED to specify the newest version
whose API you want to use.
Obtains the root window (parent all other windows are inside)
for the default display and screen.
the default root window
Gets the name of the display, which usually comes from the
`DISPLAY` environment variable or the
`--display` command line option.
Call gdk_display_get_name (gdk_display_get_default ()))
instead.
the name of the display.
Gets the display name specified in the command line arguments passed
to gdk_init() or gdk_parse_args(), if any.
the display name, if specified explicitly,
otherwise %NULL this string is owned by GTK+ and must not be
modified or freed.
Gets the program class. Unless the program class has explicitly
been set with gdk_set_program_class() or with the `--class`
commandline option, the default value is the program name (determined
with g_get_prgname()) with the first character converted to uppercase.
the program class.
Gets whether event debugging output is enabled.
%TRUE if event debugging output is enabled.
Initializes the GDK library and connects to the windowing system.
If initialization fails, a warning message is output and the application
terminates with a call to `exit(1)`.
Any arguments used by GDK are removed from the array and @argc and @argv
are updated accordingly.
GTK+ initializes GDK in gtk_init() and so this function is not usually
needed by GTK+ applications.
the number of command line arguments.
the array of command line arguments.
Initializes the GDK library and connects to the windowing system,
returning %TRUE on success.
Any arguments used by GDK are removed from the array and @argc and @argv
are updated accordingly.
GTK+ initializes GDK in gtk_init() and so this function is not usually
needed by GTK+ applications.
%TRUE if initialization succeeded.
the number of command line arguments.
the array of command line arguments.
Grabs the keyboard so that all events are passed to this
application until the keyboard is ungrabbed with gdk_keyboard_ungrab().
This overrides any previous keyboard grab by this client.
If you set up anything at the time you take the grab that needs to be cleaned
up when the grab ends, you should handle the #GdkEventGrabBroken events that
are emitted when the grab ends unvoluntarily.
Use gdk_device_grab() instead.
%GDK_GRAB_SUCCESS if the grab was successful.
the #GdkWindow which will own the grab (the grab window).
if %FALSE then all keyboard events are reported with respect to
@window. If %TRUE then keyboard events for this application are
reported as normal, but keyboard events outside this application
are reported with respect to @window. Both key press and key
release events are always reported, independant of the event mask
set by the application.
a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is
available.
Ungrabs the keyboard on the default display, if it is grabbed by this
application.
Use gdk_device_ungrab(), together with gdk_device_grab()
instead.
a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
timestamp is available.
Key values are the codes which are sent whenever a key is pressed or released.
They appear in the #GdkEventKey.keyval field of the
#GdkEventKey structure, which is passed to signal handlers for the
#GtkWidget::key-press-event and #GtkWidget::key-release-event signals.
The complete list of key values can be found in the
`gdk/gdkkeysyms.h` header file.
Key values are regularly updated from the upstream X.org X11 implementation,
so new values are added regularly. They will be prefixed with GDK_KEY_ rather
than XF86XK_ or XK_ (for older symbols).
Key values can be converted into a string representation using
gdk_keyval_name(). The reverse function, converting a string to a key value,
is provided by gdk_keyval_from_name().
The case of key values can be determined using gdk_keyval_is_upper() and
gdk_keyval_is_lower(). Key values can be converted to upper or lower case
using gdk_keyval_to_upper() and gdk_keyval_to_lower().
When it makes sense, key values can be converted to and from
Unicode characters with gdk_keyval_to_unicode() and gdk_unicode_to_keyval().
# Groups # {#key-group-explanation}
One #GdkKeymap object exists for each user display. gdk_keymap_get_default()
returns the #GdkKeymap for the default display; to obtain keymaps for other
displays, use gdk_keymap_get_for_display(). A keymap
is a mapping from #GdkKeymapKey to key values. You can think of a #GdkKeymapKey
as a representation of a symbol printed on a physical keyboard key. That is, it
contains three pieces of information. First, it contains the hardware keycode;
this is an identifying number for a physical key. Second, it contains the
“level” of the key. The level indicates which symbol on the
key will be used, in a vertical direction. So on a standard US keyboard, the key
with the number “1“ on it also has the exclamation point (”!”) character on
it. The level indicates whether to use the “1” or the “!” symbol. The letter
keys are considered to have a lowercase letter at level 0, and an uppercase
letter at level 1, though only the uppercase letter is printed. Third, the
#GdkKeymapKey contains a group; groups are not used on standard US keyboards,
but are used in many other countries. On a keyboard with groups, there can be 3
or 4 symbols printed on a single key. The group indicates movement in a
horizontal direction. Usually groups are used for two different languages. In
group 0, a key might have two English characters, and in group 1 it might have
two Hebrew characters. The Hebrew characters will be printed on the key next to
the English characters.
In order to use a keymap to interpret a key event, it’s necessary to first
convert the keyboard state into an effective group and level. This is done via a
set of rules that varies widely according to type of keyboard and user
configuration. The function gdk_keymap_translate_keyboard_state() accepts a
keyboard state -- consisting of hardware keycode pressed, active modifiers, and
active group -- applies the appropriate rules, and returns the group/level to be
used to index the keymap, along with the modifiers which did not affect the
group and level. i.e. it returns “unconsumed modifiers.” The keyboard group may
differ from the effective group used for keymap lookups because some keys don't
have multiple groups - e.g. the Enter key is always in group 0 regardless of
keyboard state.
Note that gdk_keymap_translate_keyboard_state() also returns the keyval, i.e. it
goes ahead and performs the keymap lookup in addition to telling you which
effective group/level values were used for the lookup. #GdkEventKey already
contains this keyval, however, so you don’t normally need to call
gdk_keymap_translate_keyboard_state() just to get the keyval.
Obtains the upper- and lower-case versions of the keyval @symbol.
Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
a keyval
return location for lowercase version of @symbol
return location for uppercase version of @symbol
Converts a key name to a key value.
The names are the same as those in the
`gdk/gdkkeysyms.h` header file
but without the leading “GDK_KEY_”.
the corresponding key value, or %GDK_KEY_VoidSymbol
if the key name is not a valid key
a key name
Returns %TRUE if the given key value is in lower case.
%TRUE if @keyval is in lower case, or if @keyval is not
subject to case conversion.
a key value.
Returns %TRUE if the given key value is in upper case.
%TRUE if @keyval is in upper case, or if @keyval is not subject to
case conversion.
a key value.
Converts a key value into a symbolic name.
The names are the same as those in the
`gdk/gdkkeysyms.h` header file
but without the leading “GDK_KEY_”.
a string containing the name
of the key, or %NULL if @keyval is not a valid key. The string
should not be modified.
a key value
Converts a key value to lower case, if applicable.
the lower case form of @keyval, or @keyval itself if it is already
in lower case or it is not subject to case conversion.
a key value.
Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
character.
the corresponding unicode character, or 0 if there
is no corresponding character.
a GDK key symbol
Converts a key value to upper case, if applicable.
the upper case form of @keyval, or @keyval itself if it is already
in upper case or it is not subject to case conversion.
a key value.
Lists the available visuals for the default screen.
(See gdk_screen_list_visuals())
A visual describes a hardware image data format.
For example, a visual might support 24-bit color, or 8-bit color,
and might expect pixels to be in a certain format.
Call g_list_free() on the return value when you’re finished with it.
Use gdk_screen_list_visuals (gdk_screen_get_default ()).
a list of visuals; the list must be freed, but not its contents
Indicates to the GUI environment that the application has finished
loading. If the applications opens windows, this function is
normally called after opening the application’s initial set of
windows.
GTK+ will call this function automatically after opening the first
#GtkWindow unless gtk_window_set_auto_startup_notification() is called
to disable that feature.
Indicates to the GUI environment that the application has
finished loading, using a given identifier.
GTK+ will call this function automatically for #GtkWindow
with custom startup-notification identifier unless
gtk_window_set_auto_startup_notification() is called to
disable that feature.
a startup-notification identifier, for which
notification process should be completed
Gets the window that @window is embedded in.
the embedding #GdkWindow, or
%NULL if @window is not an mbedded offscreen window
a #GdkWindow
Gets the offscreen surface that an offscreen window renders into.
If you need to keep this around over window resizes, you need to
add a reference to it.
The offscreen surface, or
%NULL if not offscreen
a #GdkWindow
Sets @window to be embedded in @embedder.
To fully embed an offscreen window, in addition to calling this
function, it is also necessary to handle the #GdkWindow::pick-embedded-child
signal on the @embedder and the #GdkWindow::to-embedder and
#GdkWindow::from-embedder signals on @window.
a #GdkWindow
the #GdkWindow that @window gets embedded in
Creates a #PangoContext for the default GDK screen.
The context must be freed when you’re finished with it.
When using GTK+, normally you should use gtk_widget_get_pango_context()
instead of this function, to get the appropriate context for
the widget you intend to render text onto.
The newly created context will have the default font options (see
#cairo_font_options_t) for the default screen; if these options
change it will not be updated. Using gtk_widget_get_pango_context()
is more convenient if you want to keep a context around and track
changes to the screen’s font rendering settings.
a new #PangoContext for the default display
Creates a #PangoContext for @display.
The context must be freed when you’re finished with it.
When using GTK+, normally you should use gtk_widget_get_pango_context()
instead of this function, to get the appropriate context for
the widget you intend to render text onto.
The newly created context will have the default font options
(see #cairo_font_options_t) for the display; if these options
change it will not be updated. Using gtk_widget_get_pango_context()
is more convenient if you want to keep a context around and track
changes to the font rendering settings.
a new #PangoContext for @display
the #GdkDisplay for which the context is to be created
Creates a #PangoContext for @screen.
The context must be freed when you’re finished with it.
When using GTK+, normally you should use gtk_widget_get_pango_context()
instead of this function, to get the appropriate context for
the widget you intend to render text onto.
The newly created context will have the default font options
(see #cairo_font_options_t) for the screen; if these options
change it will not be updated. Using gtk_widget_get_pango_context()
is more convenient if you want to keep a context around and track
changes to the screen’s font rendering settings.
a new #PangoContext for @screen
the #GdkScreen for which the context is to be created.
Pango is the text layout system used by GDK and GTK+. The functions
and types in this section are used to obtain clip regions for
#PangoLayouts, and to get #PangoContexts that can be used with
GDK.
Creating a #PangoLayout object is the first step in rendering text,
and requires getting a handle to a #PangoContext. For GTK+ programs,
you’ll usually want to use gtk_widget_get_pango_context(), or
gtk_widget_create_pango_layout(), rather than using the lowlevel
gdk_pango_context_get_for_screen(). Once you have a #PangoLayout, you
can set the text and attributes of it with Pango functions like
pango_layout_set_text() and get its size with pango_layout_get_size().
(Note that Pango uses a fixed point system internally, so converting
between Pango units and pixels using [PANGO_SCALE][PANGO-SCALE-CAPS]
or the PANGO_PIXELS() macro.)
Rendering a Pango layout is done most simply with pango_cairo_show_layout();
you can also draw pieces of the layout with pango_cairo_show_layout_line().
## Draw transformed text with Pango and cairo ## {#rotated-example}
|[<!-- language="C" -->
#define RADIUS 100
#define N_WORDS 10
#define FONT "Sans Bold 18"
PangoContext *context;
PangoLayout *layout;
PangoFontDescription *desc;
double radius;
int width, height;
int i;
// Set up a transformation matrix so that the user space coordinates for
// where we are drawing are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
// We first center, then change the scale
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
radius = MIN (width, height) / 2.;
cairo_translate (cr,
radius + (width - 2 * radius) / 2,
radius + (height - 2 * radius) / 2);
cairo_scale (cr, radius / RADIUS, radius / RADIUS);
// Create a PangoLayout, set the font and text
context = gdk_pango_context_get_for_screen (screen);
layout = pango_layout_new (context);
pango_layout_set_text (layout, "Text", -1);
desc = pango_font_description_from_string (FONT);
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
// Draw the layout N_WORDS times in a circle
for (i = 0; i < N_WORDS; i++)
{
double red, green, blue;
double angle = 2 * G_PI * i / n_words;
cairo_save (cr);
// Gradient from red at angle == 60 to blue at angle == 300
red = (1 + cos (angle - 60)) / 2;
green = 0;
blue = 1 - red;
cairo_set_source_rgb (cr, red, green, blue);
cairo_rotate (cr, angle);
// Inform Pango to re-layout the text with the new transformation matrix
pango_cairo_update_layout (cr, layout);
pango_layout_get_size (layout, &width, &height);
cairo_move_to (cr, - width / 2 / PANGO_SCALE, - DEFAULT_TEXT_RADIUS);
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
}
g_object_unref (layout);
g_object_unref (context);
]|
## Output of the [example][rotated-example] above.
![](rotated-text.png)
Obtains a clip region which contains the areas where the given ranges
of text would be drawn. @x_origin and @y_origin are the top left point
to center the layout. @index_ranges should contain
ranges of bytes in the layout’s text.
Note that the regions returned correspond to logical extents of the text
ranges, not ink extents. So the drawn layout may in fact touch areas out of
the clip region. The clip region is mainly useful for highlightling parts
of text, such as when text is selected.
a clip region containing the given ranges
a #PangoLayout
X pixel where you intend to draw the layout with this clip
Y pixel where you intend to draw the layout with this clip
array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes
number of ranges in @index_ranges, i.e. half the size of @index_ranges
Obtains a clip region which contains the areas where the given
ranges of text would be drawn. @x_origin and @y_origin are the top left
position of the layout. @index_ranges
should contain ranges of bytes in the layout’s text. The clip
region will include space to the left or right of the line (to the
layout bounding box) if you have indexes above or below the indexes
contained inside the line. This is to draw the selection all the way
to the side of the layout. However, the clip region is in line coordinates,
not layout coordinates.
Note that the regions returned correspond to logical extents of the text
ranges, not ink extents. So the drawn line may in fact touch areas out of
the clip region. The clip region is mainly useful for highlightling parts
of text, such as when text is selected.
a clip region containing the given ranges
a #PangoLayoutLine
X pixel where you intend to draw the layout line with this clip
baseline pixel where you intend to draw the layout line with this clip
array of byte indexes into the layout,
where even members of array are start indexes and odd elements
are end indexes
number of ranges in @index_ranges, i.e. half the size of @index_ranges
Parse command line arguments, and store for future
use by calls to gdk_display_open().
Any arguments used by GDK are removed from the array and @argc and @argv are
updated accordingly.
You shouldn’t call this function explicitly if you are using
gtk_init(), gtk_init_check(), gdk_init(), or gdk_init_check().
the number of command line arguments.
the array of command line arguments.
Transfers image data from a #cairo_surface_t and converts it to an RGB(A)
representation inside a #GdkPixbuf. This allows you to efficiently read
individual pixels from cairo surfaces. For #GdkWindows, use
gdk_pixbuf_get_from_window() instead.
This function will create an RGB pixbuf with 8 bits per channel.
The pixbuf will contain an alpha channel if the @surface contains one.
A newly-created pixbuf with a
reference count of 1, or %NULL on error
surface to copy from
Source X coordinate within @surface
Source Y coordinate within @surface
Width in pixels of region to get
Height in pixels of region to get
Transfers image data from a #GdkWindow and converts it to an RGB(A)
representation inside a #GdkPixbuf.
In other words, copies image data from a server-side drawable to a
client-side RGB(A) buffer. This allows you to efficiently read
individual pixels on the client side.
This function will create an RGB pixbuf with 8 bits per channel with
the size specified by the @width and @height arguments scaled by the
scale factor of @window. The pixbuf will contain an alpha channel if
the @window contains one.
If the window is off the screen, then there is no image data in the
obscured/offscreen regions to be placed in the pixbuf. The contents of
portions of the pixbuf corresponding to the offscreen region are
undefined.
If the window you’re obtaining data from is partially obscured by
other windows, then the contents of the pixbuf areas corresponding
to the obscured regions are undefined.
If the window is not mapped (typically because it’s iconified/minimized
or not on the current workspace), then %NULL will be returned.
If memory can’t be allocated for the return value, %NULL will be returned
instead.
In short, there are several ways this function can fail, and if it fails
it returns %NULL; so check the return value.
You should rarely, if ever, need to call this function.
A newly-created pixbuf with a
reference count of 1, or %NULL on error
Source window
Source X coordinate within @window
Source Y coordinate within @window
Width in pixels of region to get
Height in pixels of region to get
Pixbufs are client-side images. For details on how to create
and manipulate pixbufs, see the #GdkPixbuf API documentation.
The functions described here allow to obtain pixbufs from
#GdkWindows and cairo surfaces.
Grabs the pointer (usually a mouse) so that all events are passed to this
application until the pointer is ungrabbed with gdk_pointer_ungrab(), or
the grab window becomes unviewable.
This overrides any previous pointer grab by this client.
Pointer grabs are used for operations which need complete control over mouse
events, even if the mouse leaves the application.
For example in GTK+ it is used for Drag and Drop, for dragging the handle in
the #GtkHPaned and #GtkVPaned widgets.
Note that if the event mask of an X window has selected both button press and
button release events, then a button press event will cause an automatic
pointer grab until the button is released.
X does this automatically since most applications expect to receive button
press and release events in pairs.
It is equivalent to a pointer grab on the window with @owner_events set to
%TRUE.
If you set up anything at the time you take the grab that needs to be cleaned
up when the grab ends, you should handle the #GdkEventGrabBroken events that
are emitted when the grab ends unvoluntarily.
Use gdk_device_grab() instead.
%GDK_GRAB_SUCCESS if the grab was successful.
the #GdkWindow which will own the grab (the grab window).
if %FALSE then all pointer events are reported with respect to
@window and are only reported if selected by @event_mask. If %TRUE then pointer
events for this application are reported as normal, but pointer events outside
this application are reported with respect to @window and only if selected by
@event_mask. In either mode, unreported events are discarded.
specifies the event mask, which is used in accordance with
@owner_events. Note that only pointer events (i.e. button and motion events)
may be selected.
If non-%NULL, the pointer will be confined to this
window during the grab. If the pointer is outside @confine_to, it will
automatically be moved to the closest edge of @confine_to and enter
and leave events will be generated as necessary.
the cursor to display while the grab is active. If this is %NULL then
the normal cursors are used for @window and its descendants, and the cursor
for @window is used for all other windows.
the timestamp of the event which led to this pointer grab. This usually
comes from a #GdkEventButton struct, though %GDK_CURRENT_TIME can be used if
the time isn’t known.
Returns %TRUE if the pointer on the default display is currently
grabbed by this application.
Note that this does not take the inmplicit pointer grab on button
presses into account.
Use gdk_display_device_is_grabbed() instead.
%TRUE if the pointer is currently grabbed by this application.
Ungrabs the pointer on the default display, if it is grabbed by this
application.
Use gdk_device_ungrab(), together with gdk_device_grab()
instead.
a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
timestamp is available.
Prepare for parsing command line arguments for GDK. This is not
public API and should not be used in application code.
This symbol was never meant to be used outside
of GTK+
Each window under X can have any number of associated
“properties” attached to it.
Properties are arbitrary chunks of data identified by
“atom”s. (An “atom”
is a numeric index into a string table on the X server. They are used
to transfer strings efficiently between clients without
having to transfer the entire string.) A property
has an associated type, which is also identified
using an atom.
A property has an associated “format”,
an integer describing how many bits are in each unit
of data inside the property. It must be 8, 16, or 32.
When data is transferred between the server and client,
if they are of different endianesses it will be byteswapped
as necessary according to the format of the property.
Note that on the client side, properties of format 32
will be stored with one unit per long,
even if a long integer has more than 32 bits on the platform.
(This decision was apparently made for Xlib to maintain
compatibility with programs that assumed longs were 32
bits, at the expense of programs that knew better.)
The functions in this section are used to add, remove
and change properties on windows, to convert atoms
to and from strings and to manipulate some types of
data commonly stored in X window properties.
Changes the contents of a property on a window.
a #GdkWindow
the property to change
the new type for the property. If @mode is
%GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this
must match the existing type or an error will occur.
the new format for the property. If @mode is
%GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this
must match the existing format or an error will occur.
a value describing how the new data is to be combined
with the current data.
the data (a `guchar *`
`gushort *`, or `gulong *`,
depending on @format), cast to a `guchar *`.
the number of elements of size determined by the format,
contained in @data.
Deletes a property from a window.
a #GdkWindow
the property to delete
Retrieves a portion of the contents of a property. If the
property does not exist, then the function returns %FALSE,
and %GDK_NONE will be stored in @actual_property_type.
The XGetWindowProperty() function that gdk_property_get()
uses has a very confusing and complicated set of semantics.
Unfortunately, gdk_property_get() makes the situation
worse instead of better (the semantics should be considered
undefined), and also prints warnings to stderr in cases where it
should return a useful error to the program. You are advised to use
XGetWindowProperty() directly until a replacement function for
gdk_property_get() is provided.
%TRUE if data was successfully received and stored
in @data, otherwise %FALSE.
a #GdkWindow
the property to retrieve
the desired property type, or %GDK_NONE, if any type of data
is acceptable. If this does not match the actual
type, then @actual_format and @actual_length will
be filled in, a warning will be printed to stderr
and no data will be returned.
the offset into the property at which to begin
retrieving data, in 4 byte units.
the length of the data to retrieve in bytes. Data is
considered to be retrieved in 4 byte chunks, so @length
will be rounded up to the next highest 4 byte boundary
(so be careful not to pass a value that might overflow
when rounded up).
if %TRUE, delete the property after retrieving the
data.
location to store the
actual type of the property.
location to store the actual return format of the
data; either 8, 16 or 32 bits.
location to store the length of the retrieved data, in
bytes. Data returned in the 32 bit format is stored
in a long variable, so the actual number of 32 bit
elements should be be calculated via
@actual_length / sizeof(glong) to ensure portability to
64 bit systems.
location
to store a pointer to the data. The retrieved data should be
freed with g_free() when you are finished using it.
This function returns the available bit depths for the default
screen. It’s equivalent to listing the visuals
(gdk_list_visuals()) and then looking at the depth field in each
visual, removing duplicates.
The array returned by this function should not be freed.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
return
location for available depths
return location for number of available depths
This function returns the available visual types for the default
screen. It’s equivalent to listing the visuals
(gdk_list_visuals()) and then looking at the type field in each
visual, removing duplicates.
The array returned by this function should not be freed.
Visual selection should be done using
gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
return
location for the available visual types
return location for the number of available visual types
GDK provides the #GdkPoint and #GdkRectangle data types for representing pixels
and sets of pixels on the screen. Together with Cairo’s #cairo_region_t data
type, they make up the central types for representing graphical data.
A #GdkPoint represents an x and y coordinate of a point.
A #GdkRectangle represents the position and size of a rectangle.
The intersection of two rectangles can be computed with
gdk_rectangle_intersect(). To find the union of two rectangles use
gdk_rectangle_union().
#cairo_region_t is usually used for managing clipping of graphical operations.
#GdkRGBA is a convenient way to pass rgba colors around.
It’s based on cairo’s way to deal with colors and mirrors its behavior.
All values are in the range from 0.0 to 1.0 inclusive. So the color
(0.0, 0.0, 0.0, 0.0) represents transparent black and
(1.0, 1.0, 1.0, 1.0) is opaque white. Other values will be clamped
to this range when drawing.
Retrieves the contents of a selection in a given
form.
a #GdkWindow.
an atom identifying the selection to get the
contents of.
the form in which to retrieve the selection.
the timestamp to use when retrieving the
selection. The selection owner may refuse the
request if it did not own the selection at
the time indicated by the timestamp.
Determines the owner of the given selection.
if there is a selection owner
for this window, and it is a window known to the current process,
the #GdkWindow that owns the selection, otherwise %NULL. Note
that the return value may be owned by a different process if a
foreign window was previously created for that window, but a new
foreign window will never be created by this call.
an atom indentifying a selection.
Determine the owner of the given selection.
Note that the return value may be owned by a different
process if a foreign window was previously created for that
window, but a new foreign window will never be created by this call.
if there is a selection owner
for this window, and it is a window known to the current
process, the #GdkWindow that owns the selection, otherwise
%NULL.
a #GdkDisplay
an atom indentifying a selection
Sets the owner of the given selection.
%TRUE if the selection owner was successfully
changed to @owner, otherwise %FALSE.
a #GdkWindow or %NULL to indicate that the
the owner for the given should be unset.
an atom identifying a selection.
timestamp to use when setting the selection.
If this is older than the timestamp given last
time the owner was set for the given selection, the
request will be ignored.
if %TRUE, and the new owner is different
from the current owner, the current owner
will be sent a SelectionClear event.
Sets the #GdkWindow @owner as the current owner of the selection @selection.
%TRUE if the selection owner was successfully changed to owner,
otherwise %FALSE.
the #GdkDisplay
a #GdkWindow or %NULL to indicate that the owner for
the given should be unset
an atom identifying a selection
timestamp to use when setting the selection
If this is older than the timestamp given last time the owner was
set for the given selection, the request will be ignored
if %TRUE, and the new owner is different from the current
owner, the current owner will be sent a SelectionClear event
Retrieves selection data that was stored by the selection
data in response to a call to gdk_selection_convert(). This function
will not be used by applications, who should use the #GtkClipboard
API instead.
the length of the retrieved data.
the window on which the data is stored
location to store a pointer to the retrieved data.
If the retrieval failed, %NULL we be stored here, otherwise, it
will be non-%NULL and the returned data should be freed with g_free()
when you are finished using it. The length of the
allocated memory is one more than the length
of the returned data, and the final byte will always
be zero, to ensure nul-termination of strings
location to store the type of the property
location to store the format of the property
Sends a response to SelectionRequest event.
window to which to deliver response.
selection that was requested.
target that was selected.
property in which the selection owner stored the
data, or %GDK_NONE to indicate that the request
was rejected.
timestamp.
Send a response to SelectionRequest event.
the #GdkDisplay where @requestor is realized
window to which to deliver response
selection that was requested
target that was selected
property in which the selection owner stored the data,
or %GDK_NONE to indicate that the request was rejected
timestamp
GDK’s selection functions, based on the [X selection mechanism](
https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html),
provide a way to transfer arbitrary chunks of
data between programs. A “selection” is a essentially
a named clipboard, identified by a string interned as a #GdkAtom. By
claiming ownership of a selection, an application indicates that it will
be responsible for supplying its contents. The most common selections are
`PRIMARY` and `CLIPBOARD`.
The contents of a selection can be represented in a number of formats,
called “targets”. Each target is identified by an atom.
A list of all possible targets supported by the selection owner can be
retrieved by requesting the special target `TARGETS`. When
a selection is retrieved, the data is accompanied by a type (an atom), and
a format (an integer, representing the number of bits per item).
See [Properties and Atoms][gdk3-Properties-and-Atoms]
for more information.
The functions in this section only contain the lowlevel parts of the
selection protocol. A considerably more complicated implementation is needed
on top of this. GTK+ contains such an implementation in the functions in
`gtkselection.h` and programmers should use those functions
instead of the ones presented here. If you plan to implement selection
handling directly on top of the functions here, you should refer to the
[X Inter-Client Communication Conventions Manual (ICCCM)](
https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html).
Note that although much of the selection API design is based on that of X,
it will work on other GDK backends too.
Sets a list of backends that GDK should try to use.
This can be be useful if your application does not
work with certain GDK backends.
By default, GDK tries all included backends.
For example,
|[<!-- language="C" -->
gdk_set_allowed_backends ("wayland,quartz,*");
]|
instructs GDK to try the Wayland backend first,
followed by the Quartz backend, and then all
others.
If the `GDK_BACKEND` environment variable
is set, it determines what backends are tried in what
order, while still respecting the set of allowed backends
that are specified by this function.
The possible backend names are x11, win32, quartz,
broadway, wayland. You can also include a * in the
list to try all remaining backends.
This call must happen prior to gdk_display_open(),
gtk_init(), gtk_init_with_args() or gtk_init_check()
in order to take effect.
a comma-separated list of backends
Set the double click time for the default display. See
gdk_display_set_double_click_time().
See also gdk_display_set_double_click_distance().
Applications should not set this, it is a
global user-configured setting.
double click time in milliseconds (thousandths of a second)
Sets the program class. The X11 backend uses the program class to set
the class name part of the `WM_CLASS` property on
toplevel windows; see the ICCCM.
The program class can still be overridden with the --class command
line option.
a string.
Sets whether a trace of received events is output.
Note that GTK+ must be compiled with debugging (that is,
configured using the `--enable-debug` option)
to use this option.
%TRUE to output event debugging information.
Obtains a desktop-wide setting, such as the double-click time,
for the default screen. See gdk_screen_get_setting().
%TRUE if the setting existed and a value was stored
in @value, %FALSE otherwise.
the name of the setting.
location to store the value of the setting.
Retrieves a pixel from @window to force the windowing
system to carry out any pending rendering commands.
This function is intended to be used to synchronize with rendering
pipelines, to benchmark windowing system rendering operations.
a mapped #GdkWindow
This function is intended to be used in GTK+ test programs.
It will warp the mouse pointer to the given (@x,@y) coordinates
within @window and simulate a button press or release event.
Because the mouse pointer needs to be warped to the target
location, use of this function outside of test programs that
run in their own virtual windowing system (e.g. Xvfb) is not
recommended.
Also, gdk_test_simulate_button() is a fairly low level function,
for most testing purposes, gtk_test_widget_click() is the right
function to call which will generate a button press event followed
by its accompanying button release event.
whether all actions necessary for a button event simulation
were carried out successfully
a #GdkWindow to simulate a button event for
x coordinate within @window for the button event
y coordinate within @window for the button event
Number of the pointer button for the event, usually 1, 2 or 3
Keyboard modifiers the event is setup with
either %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE
This function is intended to be used in GTK+ test programs.
If (@x,@y) are > (-1,-1), it will warp the mouse pointer to
the given (@x,@y) coordinates within @window and simulate a
key press or release event.
When the mouse pointer is warped to the target location, use
of this function outside of test programs that run in their
own virtual windowing system (e.g. Xvfb) is not recommended.
If (@x,@y) are passed as (-1,-1), the mouse pointer will not
be warped and @window origin will be used as mouse pointer
location for the event.
Also, gdk_test_simulate_key() is a fairly low level function,
for most testing purposes, gtk_test_widget_send_key() is the
right function to call which will generate a key press event
followed by its accompanying key release event.
whether all actions necessary for a key event simulation
were carried out successfully
a #GdkWindow to simulate a key event for
x coordinate within @window for the key event
y coordinate within @window for the key event
A GDK keyboard value
Keyboard modifiers the event is setup with
either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
Converts a text property in the given encoding to
a list of UTF-8 strings.
the number of strings in the resulting list
a #GdkDisplay
an atom representing the encoding of the text
the format of the property
the text to convert
the length of @text, in bytes
location to store the list
of strings or %NULL. The list should be freed with
g_strfreev().
For thread safety, GDK relies on the thread primitives in GLib,
and on the thread-safe GLib main loop.
GLib is completely thread safe (all global data is automatically
locked), but individual data structure instances are not automatically
locked for performance reasons. So e.g. you must coordinate
accesses to the same #GHashTable from multiple threads.
GTK+, however, is not thread safe. You should only use GTK+ and GDK
from the thread gtk_init() and gtk_main() were called on.
This is usually referred to as the “main thread”.
Signals on GTK+ and GDK types, as well as non-signal callbacks, are
emitted in the main thread.
You can schedule work in the main thread safely from other threads
by using gdk_threads_add_idle() and gdk_threads_add_timeout():
|[<!-- language="C" -->
static void
worker_thread (void)
{
ExpensiveData *expensive_data = do_expensive_computation ();
gdk_threads_add_idle (got_value, expensive_data);
}
static gboolean
got_value (gpointer user_data)
{
ExpensiveData *expensive_data = user_data;
my_app->expensive_data = expensive_data;
gtk_button_set_sensitive (my_app->button, TRUE);
gtk_button_set_label (my_app->button, expensive_data->result_label);
return G_SOURCE_REMOVE;
}
]|
You should use gdk_threads_add_idle() and gdk_threads_add_timeout()
instead of g_idle_add() and g_timeout_add() since libraries not under
your control might be using the deprecated GDK locking mechanism.
If you are sure that none of the code in your application and libraries
use the deprecated gdk_threads_enter() or gdk_threads_leave() methods,
then you can safely use g_idle_add() and g_timeout_add().
For more information on this "worker thread" pattern, you should
also look at #GTask, which gives you high-level tools to perform
expensive tasks from worker threads, and will handle thread
management for you.
A wrapper for the common usage of gdk_threads_add_idle_full()
assigning the default priority, #G_PRIORITY_DEFAULT_IDLE.
See gdk_threads_add_idle_full().
the ID (greater than 0) of the event source.
function to call
data to pass to @function
Adds a function to be called whenever there are no higher priority
events pending. If the function returns %FALSE it is automatically
removed from the list of event sources and will not be called again.
This variant of g_idle_add_full() calls @function with the GDK lock
held. It can be thought of a MT-safe version for GTK+ widgets for the
following use case, where you have to worry about idle_callback()
running in thread A and accessing @self after it has been finalized
in thread B:
|[<!-- language="C" -->
static gboolean
idle_callback (gpointer data)
{
// gdk_threads_enter(); would be needed for g_idle_add()
SomeWidget *self = data;
// do stuff with self
self->idle_id = 0;
// gdk_threads_leave(); would be needed for g_idle_add()
return FALSE;
}
static void
some_widget_do_stuff_later (SomeWidget *self)
{
self->idle_id = gdk_threads_add_idle (idle_callback, self)
// using g_idle_add() here would require thread protection in the callback
}
static void
some_widget_finalize (GObject *object)
{
SomeWidget *self = SOME_WIDGET (object);
if (self->idle_id)
g_source_remove (self->idle_id);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
]|
the ID (greater than 0) of the event source.
the priority of the idle source. Typically this will be in the
range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE
function to call
data to pass to @function
function to call when the idle is removed, or %NULL
A wrapper for the common usage of gdk_threads_add_timeout_full()
assigning the default priority, #G_PRIORITY_DEFAULT.
See gdk_threads_add_timeout_full().
the ID (greater than 0) of the event source.
the time between calls to the function, in milliseconds
(1/1000ths of a second)
function to call
data to pass to @function
Sets a function to be called at regular intervals holding the GDK lock,
with the given priority. The function is called repeatedly until it
returns %FALSE, at which point the timeout is automatically destroyed
and the function will not be called again. The @notify function is
called when the timeout is destroyed. The first call to the
function will be at the end of the first @interval.
Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given interval
(it does not try to “catch up” time lost in delays).
This variant of g_timeout_add_full() can be thought of a MT-safe version
for GTK+ widgets for the following use case:
|[<!-- language="C" -->
static gboolean timeout_callback (gpointer data)
{
SomeWidget *self = data;
// do stuff with self
self->timeout_id = 0;
return G_SOURCE_REMOVE;
}
static void some_widget_do_stuff_later (SomeWidget *self)
{
self->timeout_id = g_timeout_add (timeout_callback, self)
}
static void some_widget_finalize (GObject *object)
{
SomeWidget *self = SOME_WIDGET (object);
if (self->timeout_id)
g_source_remove (self->timeout_id);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
]|
the ID (greater than 0) of the event source.
the priority of the timeout source. Typically this will be in the
range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
the time between calls to the function, in milliseconds
(1/1000ths of a second)
function to call
data to pass to @function
function to call when the timeout is removed, or %NULL
A wrapper for the common usage of gdk_threads_add_timeout_seconds_full()
assigning the default priority, #G_PRIORITY_DEFAULT.
For details, see gdk_threads_add_timeout_full().
the ID (greater than 0) of the event source.
the time between calls to the function, in seconds
function to call
data to pass to @function
A variant of gdk_threads_add_timeout_full() with second-granularity.
See g_timeout_add_seconds_full() for a discussion of why it is
a good idea to use this function if you don’t need finer granularity.
the ID (greater than 0) of the event source.
the priority of the timeout source. Typically this will be in the
range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
the time between calls to the function, in seconds
function to call
data to pass to @function
function to call when the timeout is removed, or %NULL
This function marks the beginning of a critical section in which
GDK and GTK+ functions can be called safely and without causing race
conditions. Only one thread at a time can be in such a critial
section.
All GDK and GTK+ calls should be made from the main
thread
Initializes GDK so that it can be used from multiple threads
in conjunction with gdk_threads_enter() and gdk_threads_leave().
This call must be made before any use of the main loop from
GTK+; to be safe, call it before gtk_init().
All GDK and GTK+ calls should be made from the main
thread
Leaves a critical region begun with gdk_threads_enter().
All GDK and GTK+ calls should be made from the main
thread
Allows the application to replace the standard method that
GDK uses to protect its data structures. Normally, GDK
creates a single #GMutex that is locked by gdk_threads_enter(),
and released by gdk_threads_leave(); using this function an
application provides, instead, a function @enter_fn that is
called by gdk_threads_enter() and a function @leave_fn that is
called by gdk_threads_leave().
The functions must provide at least same locking functionality
as the default implementation, but can also do extra application
specific processing.
As an example, consider an application that has its own recursive
lock that when held, holds the GTK+ lock as well. When GTK+ unlocks
the GTK+ lock when entering a recursive main loop, the application
must temporarily release its lock as well.
Most threaded GTK+ apps won’t need to use this method.
This method must be called before gdk_threads_init(), and cannot
be called multiple times.
All GDK and GTK+ calls should be made from the main
thread
function called to guard GDK
function called to release the guard
Convert from a ISO10646 character to a key symbol.
the corresponding GDK key symbol, if one exists.
or, if there is no corresponding symbol,
wc | 0x01000000
a ISO10646 encoded character
Converts an UTF-8 string into the best possible representation
as a STRING. The representation of characters not in STRING
is not specified; it may be as pseudo-escape sequences
\x{ABCD}, or it may be in some other form of approximation.
the newly-allocated string, or %NULL if the
conversion failed. (It should not fail for any properly
formed UTF-8 string unless system limits like memory or
file descriptors are exceeded.)
a UTF-8 string
A #GdkVisual describes a particular video hardware display format.
It includes information about the number of bits used for each color,
the way the bits are translated into an RGB value for display, and
the way the bits are stored in memory. For example, a piece of display
hardware might support 24-bit color, 16-bit color, or 8-bit color;
meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can
be in different formats; for example the “red” element of an RGB pixel
may be in the top 8 bits of the pixel, or may be in the lower 4 bits.
There are several standard visuals. The visual returned by
gdk_screen_get_system_visual() is the system’s default visual, and
the visual returned by gdk_screen_get_rgba_visual() should be used for
creating windows with an alpha channel.
A number of functions are provided for determining the “best” available
visual. For the purposes of making this determination, higher bit depths
are considered better, and for visuals of the same bit depth,
%GDK_VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual
types are ranked in the order of(highest to lowest)
%GDK_VISUAL_DIRECT_COLOR, %GDK_VISUAL_TRUE_COLOR,
%GDK_VISUAL_PSEUDO_COLOR, %GDK_VISUAL_STATIC_COLOR,
%GDK_VISUAL_GRAYSCALE, then %GDK_VISUAL_STATIC_GRAY.
A #GdkWindow 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
window, the thing a user might think of as a “window” with a titlebar
and so on; a #GtkWindow may contain many #GdkWindows. For example,
each #GtkButton has a #GdkWindow associated with it.
# Composited Windows # {#COMPOSITED-WINDOWS}
Normally, the windowing system takes care of rendering the contents
of a child window onto its parent window. This mechanism can be
intercepted by calling gdk_window_set_composited() on the child
window. For a “composited” window it is the
responsibility of the application to render the window contents at
the right spot.
# Offscreen Windows # {#OFFSCREEN-WINDOWS}
Offscreen windows are more general than composited windows, since
they allow not only to modify the rendering of the child window onto
its parent, but also to apply coordinate transformations.
To integrate an offscreen window into a window hierarchy, one has
to call gdk_offscreen_window_set_embedder() and handle a number of
signals. The #GdkWindow::pick-embedded-child signal on the embedder
window is used to select an offscreen child at given coordinates,
and the #GdkWindow::to-embedder and #GdkWindow::from-embedder signals
on the offscreen window are used to translate coordinates between
the embedder and the offscreen window.
For rendering an offscreen window onto its embedder, the contents
of the offscreen window are available as a surface, via
gdk_offscreen_window_get_surface().