/** * gdk_utf8_to_string_target: * @str: a UTF-8 string * * 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. * * Returns: (nullable): 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.) **/ gchar * gdk_utf8_to_string_target (const gchar *str) { GdkDisplay *display = gdk_display_get_default (); return GDK_DISPLAY_GET_CLASS (display)->utf8_to_string_target (display, str); }
/** * gdk_cursor_new_from_name: * @display: the #GdkDisplay for which the cursor will be created * @name: the name of the cursor * * Creates a new cursor by looking up @name in the current cursor * theme. * * Returns: a new #GdkCursor, or %NULL if there is no cursor with * the given name * * Since: 2.8 */ GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display, const gchar *name) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_name (display, name); }
/** * gdk_cursor_new_for_display: * @display: the #GdkDisplay for which the cursor will be created * @cursor_type: cursor to create * * Creates a new cursor from the set of builtin cursors. * Some useful ones are: * - ![](right_ptr.png) #GDK_RIGHT_PTR (right-facing arrow) * - ![](crosshair.png) #GDK_CROSSHAIR (crosshair) * - ![](xterm.png) #GDK_XTERM (I-beam) * - ![](watch.png) #GDK_WATCH (busy) * - ![](fleur.png) #GDK_FLEUR (for moving objects) * - ![](hand1.png) #GDK_HAND1 (a right-pointing hand) * - ![](hand2.png) #GDK_HAND2 (a left-pointing hand) * - ![](left_side.png) #GDK_LEFT_SIDE (resize left side) * - ![](right_side.png) #GDK_RIGHT_SIDE (resize right side) * - ![](top_left_corner.png) #GDK_TOP_LEFT_CORNER (resize northwest corner) * - ![](top_right_corner.png) #GDK_TOP_RIGHT_CORNER (resize northeast corner) * - ![](bottom_left_corner.png) #GDK_BOTTOM_LEFT_CORNER (resize southwest corner) * - ![](bottom_right_corner.png) #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner) * - ![](top_side.png) #GDK_TOP_SIDE (resize top side) * - ![](bottom_side.png) #GDK_BOTTOM_SIDE (resize bottom side) * - ![](sb_h_double_arrow.png) #GDK_SB_H_DOUBLE_ARROW (move vertical splitter) * - ![](sb_v_double_arrow.png) #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter) * - #GDK_BLANK_CURSOR (Blank cursor). Since 2.16 * * Returns: a new #GdkCursor * * Since: 2.2 **/ GdkCursor* gdk_cursor_new_for_display (GdkDisplay *display, GdkCursorType cursor_type) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_type (display, cursor_type); }
/** * gdk_selection_owner_get_for_display: * @display: a #GdkDisplay * @selection: 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. * * Returns: (nullable) (transfer none): 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. * * Since: 2.2 */ GdkWindow * gdk_selection_owner_get_for_display (GdkDisplay *display, GdkAtom selection) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (selection != GDK_NONE, NULL); return GDK_DISPLAY_GET_CLASS (display)->get_selection_owner (display, selection); }
/** * gdk_display_manager_set_default_display: * @manager: a #GdkDisplayManager * @display: a #GdkDisplay * * Sets @display as the default display. * * Since: 2.2 **/ void gdk_display_manager_set_default_display (GdkDisplayManager *manager, GdkDisplay *display) { manager->default_display = display; if (display) GDK_DISPLAY_GET_CLASS (display)->make_default (display); g_object_notify (G_OBJECT (manager), "default-display"); }
/** * gdk_screen_get_default: * * Gets the default screen for the default display. (See * gdk_display_get_default ()). * * Returns: (nullable) (transfer none): a #GdkScreen, or %NULL if * there is no default display. * * Since: 2.2 */ GdkScreen * gdk_screen_get_default (void) { GdkDisplay *display; display = gdk_display_get_default (); if (display) return GDK_DISPLAY_GET_CLASS (display)->get_default_screen (display); else return NULL; }
/** * gdk_selection_send_notify_for_display: * @display: the #GdkDisplay where @requestor is realized * @requestor: window to which to deliver response * @selection: selection that was requested * @target: target that was selected * @property: property in which the selection owner stored the data, * or %GDK_NONE to indicate that the request was rejected * @time_: timestamp * * Send a response to SelectionRequest event. * * Since: 2.2 */ void gdk_selection_send_notify_for_display (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time_) { g_return_if_fail (GDK_IS_DISPLAY (display)); GDK_DISPLAY_GET_CLASS (display) ->send_selection_notify (display, requestor, selection,target, property, time_); }
/** * gdk_selection_owner_set_for_display: * @display: the #GdkDisplay * @owner: (nullable): a #GdkWindow or %NULL to indicate that the owner for * the given should be unset * @selection: an atom identifying a selection * @time_: 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 * @send_event: 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. * * Returns: %TRUE if the selection owner was successfully changed to owner, * otherwise %FALSE. * * Since: 2.2 */ gboolean gdk_selection_owner_set_for_display (GdkDisplay *display, GdkWindow *owner, GdkAtom selection, guint32 time, gboolean send_event) { g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); g_return_val_if_fail (selection != GDK_NONE, FALSE); return GDK_DISPLAY_GET_CLASS (display) ->set_selection_owner (display, owner, selection, time, send_event); }
/** * gdk_text_property_to_utf8_list_for_display: * @display: a #GdkDisplay * @encoding: an atom representing the encoding of the text * @format: the format of the property * @text: (array length=length): the text to convert * @length: the length of @text, in bytes * @list: (out) (array zero-terminated=1): location to store the list * of strings or %NULL. The list should be freed with * g_strfreev(). * * Converts a text property in the given encoding to * a list of UTF-8 strings. * * Returns: the number of strings in the resulting list * * Since: 2.2 */ gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, GdkAtom encoding, gint format, const guchar *text, gint length, gchar ***list) { g_return_val_if_fail (text != NULL, 0); g_return_val_if_fail (length >= 0, 0); g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); return GDK_DISPLAY_GET_CLASS (display) ->text_property_to_utf8_list (display, encoding, format, text, length, list); }
void gdk_selection_convert (GdkWindow *requestor, GdkAtom selection, GdkAtom target, guint32 time) { GdkDisplay *display; g_return_if_fail (selection != GDK_NONE); display = gdk_window_get_display (requestor); GDK_DISPLAY_GET_CLASS (display) ->convert_selection (display, requestor, selection, target, time); }
/** * gdk_selection_property_get: (skip) * @requestor: the window on which the data is stored * @data: 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 * @prop_type: location to store the type of the property * @prop_format: location to store the format of the property * * 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. * * Returns: the length of the retrieved data. */ gint gdk_selection_property_get (GdkWindow *requestor, guchar **data, GdkAtom *ret_type, gint *ret_format) { GdkDisplay *display; g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0); display = gdk_window_get_display (requestor); return GDK_DISPLAY_GET_CLASS (display) ->get_selection_property (display, requestor, data, ret_type, ret_format); }
/** * gdk_cursor_new_from_surface: * @display: the #GdkDisplay for which the cursor will be created * @surface: the cairo image surface containing the cursor pixel data * @x: the horizontal offset of the “hotspot” of the cursor * @y: 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. * * Returns: a new #GdkCursor. * * Since: 3.10 */ GdkCursor * gdk_cursor_new_from_surface (GdkDisplay *display, cairo_surface_t *surface, gdouble x, gdouble y) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (surface != NULL, NULL); g_return_val_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL); g_return_val_if_fail (0 <= x && x < cairo_image_surface_get_width (surface), NULL); g_return_val_if_fail (0 <= y && y < cairo_image_surface_get_height (surface), NULL); return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y); }
/** * gdk_cursor_new_from_pixbuf: * @display: the #GdkDisplay for which the cursor will be created * @pixbuf: the #GdkPixbuf containing the cursor image * @x: the horizontal offset of the “hotspot” of the cursor. * @y: the vertical offset of the “hotspot” 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. * * Returns: a new #GdkCursor. * * Since: 2.4 */ GdkCursor * gdk_cursor_new_from_pixbuf (GdkDisplay *display, GdkPixbuf *pixbuf, gint x, gint y) { cairo_surface_t *surface; const char *option; char *end; gint64 value; GdkCursor *cursor; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot"))) { errno = 0; end = NULL; value = g_ascii_strtoll (option, &end, 10); if (errno == 0 && end != option && value >= 0 && value < G_MAXINT) x = (gint) value; } if (y == -1 && (option = gdk_pixbuf_get_option (pixbuf, "y_hot"))) { errno = 0; end = NULL; value = g_ascii_strtoll (option, &end, 10); if (errno == 0 && end != option && value >= 0 && value < G_MAXINT) y = (gint) value; } surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL); cursor = GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y); cairo_surface_destroy (surface); return cursor; }