GdkScreen * gdk_display_get_screen (GdkDisplay *display, gint screen_num) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (screen_num == 0, NULL); return _gdk_screen; }
GdkWindow * gdk_display_get_default_group (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_warning ("gdk_display_get_default_group not yet implemented"); return NULL; }
void _gdk_broadway_display_send_selection_notify (GdkDisplay *display, GdkWindow *requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time) { g_return_if_fail (GDK_IS_DISPLAY (display)); }
gboolean _gdk_x11_gl_query_version_for_display (GdkDisplay *display, int *major, int *minor) { g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); return glXQueryVersion (GDK_DISPLAY_XDISPLAY (display), major, minor); }
static void gdk_wayland_display_sync (GdkDisplay *display) { GdkWaylandDisplay *display_wayland; g_return_if_fail (GDK_IS_DISPLAY (display)); display_wayland = GDK_WAYLAND_DISPLAY (display); wl_display_roundtrip (display_wayland->wl_display); }
gboolean gdk_display_supports_input_shapes (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); /* Not yet implemented. See comment in * gdk_window_input_shape_combine_mask(). */ return FALSE; }
/** * 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); }
static GdkKeymap * gdk_wayland_display_get_keymap (GdkDisplay *display) { GdkDisplayWayland *display_wayland; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); display_wayland = GDK_DISPLAY_WAYLAND (display); if (!display_wayland->keymap) display_wayland->keymap = _gdk_wayland_keymap_new (display); return display_wayland->keymap; }
void _gdk_xid_table_remove (GdkDisplay *display, XID xid) { GdkDisplayX11 *display_x11; g_return_if_fail (GDK_IS_DISPLAY (display)); display_x11 = GDK_DISPLAY_X11 (display); if (display_x11->xid_ht) g_hash_table_remove (display_x11->xid_ht, &xid); }
void _gdk_x11_display_remove_window (GdkDisplay *display, XID xid) { GdkX11Display *display_x11; g_return_if_fail (GDK_IS_DISPLAY (display)); display_x11 = GDK_X11_DISPLAY (display); if (display_x11->xid_ht) g_hash_table_remove (display_x11->xid_ht, &xid); }
/** * 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_); }
gint _gdk_broadway_display_text_property_to_utf8_list (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 0; }
static void gdk_wayland_display_beep (GdkDisplay *display) { GdkWaylandDisplay *display_wayland; g_return_if_fail (GDK_IS_DISPLAY (display)); display_wayland = GDK_WAYLAND_DISPLAY (display); if (!display_wayland->gtk_shell) return; gtk_shell1_system_bell (display_wayland->gtk_shell, NULL); }
XfceRandr * xfce_randr_new (GdkDisplay *display, GError **error) { XfceRandr *randr; Display *xdisplay; GdkWindow *root_window; gint major, minor; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* get the x display */ xdisplay = gdk_x11_display_get_xdisplay (display); /* check if the randr extension is available */ if (XRRQueryVersion (xdisplay, &major, &minor) == FALSE) { g_set_error (error, 0, 0, _("Unable to query the version of the RandR extension being used")); return NULL; } /* we need atleast randr 1.2, 2.0 will probably break the api */ if (major < 1 || (major == 1 && minor < 2)) { /* 1.2 is required */ g_set_error (error, 0, 0, _("This system is using RandR %d.%d. For the display settings to work " "version 1.2 is required at least"), major, minor); return NULL; } /* allocate the structure */ randr = g_slice_new0 (XfceRandr); randr->priv = g_slice_new0 (XfceRandrPrivate); randr->priv->has_1_3 = (major > 1 || (major == 1 && minor >= 3)); /* set display */ randr->priv->display = display; /* get the root window */ root_window = gdk_get_default_root_window (); /* get the screen resource */ randr->priv->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window)); xfce_randr_populate (randr, xdisplay, root_window); return randr; }
static void gdk_wayland_display_sync (GdkDisplay *display) { GdkDisplayWayland *display_wayland; gboolean done; g_return_if_fail (GDK_IS_DISPLAY (display)); display_wayland = GDK_DISPLAY_WAYLAND (display); wl_display_sync_callback(display_wayland->wl_display, sync_callback, &done); wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_WRITABLE); while (!done) wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_READABLE); }
GimpDeviceInfo * gimp_device_info_new (Gimp *gimp, GdkDevice *device, GdkDisplay *display) { g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); return g_object_new (GIMP_TYPE_DEVICE_INFO, "gimp", gimp, "device", device, "display", display, NULL); }
/** * 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_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); }
/** * gdk_x11_window_lookup_for_display: * @display: (type GdkX11Display): the #GdkDisplay corresponding to the * window handle * @window: an Xlib Window * * Looks up the #GdkWindow that wraps the given native window handle. * * Returns: (transfer none) (type GdkX11Window): the #GdkWindow wrapper for the native * window, or %NULL if there is none. * * Since: 2.24 */ GdkWindow * gdk_x11_window_lookup_for_display (GdkDisplay *display, Window window) { GdkX11Display *display_x11; GdkWindow *data = NULL; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); display_x11 = GDK_X11_DISPLAY (display); if (display_x11->xid_ht) data = g_hash_table_lookup (display_x11->xid_ht, &window); return data; }
/** * gdk_xid_table_lookup_for_display: * @display: the #GdkDisplay. * @xid: an X id. * * Returns the GDK object associated with the given X id. * * Returns: a GDK object associated with the given X id. * * Since: 2.2 */ gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display, XID xid) { GdkDisplayX11 *display_x11; gpointer data = NULL; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); display_x11 = GDK_DISPLAY_X11 (display); if (display_x11->xid_ht) data = g_hash_table_lookup (display_x11->xid_ht, &xid); return data; }
/** * gdk_app_launch_context_set_display: * @context: a #GdkAppLaunchContext * @display: a #GdkDisplay * * Sets the display on which applications will be launched when * using this context. See also gdk_app_launch_context_set_screen(). * * Since: 2.14 */ void gdk_app_launch_context_set_display (GdkAppLaunchContext *context, GdkDisplay *display) { g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context)); g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display)); if (context->priv->display) { g_object_unref (context->priv->display); context->priv->display = NULL; } if (display) context->priv->display = g_object_ref (display); }
/** * gdk_x11_xatom_to_atom_for_display: * @display: A #GdkDisplay * @xatom: an X atom * * Convert from an X atom for a #GdkDisplay to the corresponding * #GdkAtom. * * Return value: the corresponding #GdkAtom. * * Since: 2.2 **/ GdkAtom gdk_x11_xatom_to_atom_for_display (GdkDisplay *display, Atom xatom) { GdkDisplayX11 *display_x11; GdkAtom virtual_atom = GDK_NONE; g_return_val_if_fail (GDK_IS_DISPLAY (display), GDK_NONE); if (xatom == None) return GDK_NONE; if (display->closed) return GDK_NONE; display_x11 = GDK_DISPLAY_X11 (display); if (xatom < G_N_ELEMENTS (xatoms_offset) - N_CUSTOM_PREDEFINED) return INDEX_TO_ATOM (xatom); if (display_x11->atom_to_virtual) virtual_atom = GDK_POINTER_TO_ATOM (g_hash_table_lookup (display_x11->atom_to_virtual, GUINT_TO_POINTER (xatom))); if (!virtual_atom) { /* If this atom doesn't exist, we'll die with an X error unless * we take precautions */ char *name; gdk_error_trap_push (); name = XGetAtomName (GDK_DISPLAY_XDISPLAY (display), xatom); if (gdk_error_trap_pop ()) { g_warning (G_STRLOC " invalid X atom: %ld", xatom); } else { virtual_atom = gdk_atom_intern (name, FALSE); XFree (name); insert_atom_pair (display, virtual_atom, xatom); } } return virtual_atom; }
/** * 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; }
void _gdk_xid_table_insert (GdkDisplay *display, XID *xid, gpointer data) { GdkDisplayX11 *display_x11; g_return_if_fail (xid != NULL); g_return_if_fail (GDK_IS_DISPLAY (display)); display_x11 = GDK_DISPLAY_X11 (display); if (!display_x11->xid_ht) display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash, (GEqualFunc) gdk_xid_equal); g_hash_table_insert (display_x11->xid_ht, xid, data); }
static Display * egg_tray_icon_get_x_display(EggTrayIcon *icon) { Display *xdisplay = NULL; #if GTK_CHECK_VERSION(2,1,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (icon)); if (!GDK_IS_DISPLAY (display)) display = gdk_display_get_default (); xdisplay = GDK_DISPLAY_XDISPLAY (display); } #else xdisplay = gdk_display; #endif return xdisplay; }
/** * gdk_gl_font_use_pango_font_for_display: * @display: a #GdkDisplay. * @font_desc: a #PangoFontDescription describing the font to use. * @first: the index of the first glyph to be taken. * @count: the number of glyphs to be taken. * @list_base: the index of the first display list to be generated. * * Creates bitmap display lists from a #PangoFont. * * Return value: the #PangoFont used, or NULL if no font matched. **/ PangoFont * gdk_gl_font_use_pango_font_for_display (GdkDisplay *display, const PangoFontDescription *font_desc, int first, int count, int list_base) { PangoFontMap *font_map; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (font_desc != NULL, NULL); GDK_GL_NOTE_FUNC (); font_map = pango_x_font_map_for_display (GDK_DISPLAY_XDISPLAY (display)); return gdk_gl_font_use_pango_font_common (font_map, font_desc, first, count, list_base); }
void _gdk_x11_display_add_window (GdkDisplay *display, XID *xid, GdkWindow *data) { GdkX11Display *display_x11; g_return_if_fail (xid != NULL); g_return_if_fail (GDK_IS_DISPLAY (display)); display_x11 = GDK_X11_DISPLAY (display); if (!display_x11->xid_ht) display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash, (GEqualFunc) gdk_xid_equal); if (g_hash_table_lookup (display_x11->xid_ht, xid)) g_warning ("XID collision, trouble ahead"); g_hash_table_insert (display_x11->xid_ht, xid, data); }
static void gdk_broadway_display_beep (GdkDisplay *display) { g_return_if_fail (GDK_IS_DISPLAY (display)); }
gboolean xfce_xsettings_helper_register (XfceXSettingsHelper *helper, GdkDisplay *gdkdisplay, gboolean force_replace) { Display *xdisplay; Window root_window; Window window; gchar atom_name[64]; Atom selection_atom; gint n_screens, n; XfceXSettingsScreen *screen; Time timestamp; XClientMessageEvent xev; gboolean succeed; g_return_val_if_fail (GDK_IS_DISPLAY (gdkdisplay), FALSE); g_return_val_if_fail (XFCE_IS_XSETTINGS_HELPER (helper), FALSE); g_return_val_if_fail (helper->screens == NULL, FALSE); xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay); helper->xsettings_atom = XInternAtom (xdisplay, "_XSETTINGS_SETTINGS", False); gdk_error_trap_push (); n_screens = gdk_display_get_n_screens (gdkdisplay); for (n = 0; n < n_screens; n++) { g_snprintf (atom_name, sizeof (atom_name), "_XSETTINGS_S%d", n); selection_atom = XInternAtom (xdisplay, atom_name, False); if (!force_replace && XGetSelectionOwner (xdisplay, selection_atom) != None) { g_message ("Skipping screen %d, it already has an xsettings manager...", n); continue; } succeed = FALSE; /* create new window */ root_window = RootWindow (xdisplay, n); window = XCreateSimpleWindow (xdisplay, root_window, -1, -1, 1, 1, 0, 0, 0); g_assert (window != 0); XSelectInput (xdisplay, window, PropertyChangeMask); /* get the current xserver timestamp */ timestamp = xfce_xsettings_get_server_time (xdisplay, window); /* request ownership of the xsettings selection on this screen */ XSetSelectionOwner (xdisplay, selection_atom, window, timestamp); /* check if the have the selection */ if (G_LIKELY (XGetSelectionOwner (xdisplay, selection_atom) == window)) { /* register this xsettings window for this screen */ xev.type = ClientMessage; xev.window = root_window; xev.message_type = XInternAtom (xdisplay, "MANAGER", True); xev.format = 32; xev.data.l[0] = timestamp; xev.data.l[1] = selection_atom; xev.data.l[2] = window; xev.data.l[3] = 0; /* manager specific data */ xev.data.l[4] = 0; /* manager specific data */ if (XSendEvent (xdisplay, root_window, False, StructureNotifyMask, (XEvent *)&xev) != 0) { /* the window was successfully registered as the new * xsettings window for this screen */ succeed = TRUE; } else { g_warning ("Failed to register the xsettings window for screen %d", n); } } else { g_warning ("Unable to get the xsettings selection for screen %d", n); } if (G_LIKELY (succeed)) { /* add the window to the internal list */ screen = g_slice_new0 (XfceXSettingsScreen); screen->window = window; screen->selection_atom = selection_atom; screen->xdisplay = xdisplay; screen->screen_num = n; xfsettings_dbg (XFSD_DEBUG_XSETTINGS, "%s registered on screen %d", atom_name, n); helper->screens = g_slist_prepend (helper->screens, screen); } else { XDestroyWindow (xdisplay, window); } } if (gdk_error_trap_pop () != 0) g_critical ("Failed to initialize screens"); if (helper->screens != NULL) { /* watch for selection changes */ gdk_window_add_filter (NULL, xfce_xsettings_helper_event_filter, helper); /* send notifications */ xfce_xsettings_helper_notify (helper); xfce_xsettings_helper_notify_xft (helper); /* startup fontconfig monitoring */ helper->fc_init_id = g_idle_add (xfce_xsettings_helper_fc_init, helper); return TRUE; } return FALSE; }
GdkWindow *gdk_display_get_default_group (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); return _gdk_parent_root; }