x11: Get rid of default Atom converters

No, using the default Wayland display is not okay to query Atoms.
This commit is contained in:
Benjamin Otte 2017-12-14 13:02:50 +01:00
parent 52b1a46549
commit 920259c250
5 changed files with 4 additions and 82 deletions

View File

@ -889,13 +889,9 @@ gdk_x11_window_set_frame_sync_enabled
gdk_x11_keymap_get_group_for_state
gdk_x11_keymap_key_is_modifier
gdk_x11_visual_get_xvisual
gdk_x11_atom_to_xatom
gdk_x11_atom_to_xatom_for_display
gdk_x11_xatom_to_atom
gdk_x11_xatom_to_atom_for_display
gdk_x11_get_xatom_by_name
gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name
gdk_x11_get_xatom_name_for_display
gdk_x11_set_sm_client_id
gdk_x11_display_text_property_to_text_list

View File

@ -990,7 +990,7 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (ev->deviceid));
if (ev->property == gdk_x11_get_xatom_by_name ("Wacom Serial IDs"))
if (ev->property == gdk_x11_get_xatom_by_name_for_display (gdk_device_get_display (device), "Wacom Serial IDs"))
{
GdkDeviceTool *tool = NULL;
guint serial_id = 0, tool_id = 0;

View File

@ -144,21 +144,6 @@ _gdk_x11_precache_atoms (GdkDisplay *display,
g_free (atoms);
}
/**
* gdk_x11_atom_to_xatom:
* @atom: A #GdkAtom
*
* Converts from a #GdkAtom to the X atom for the default GDK display
* with the same string value.
*
* Returns: the X atom corresponding to @atom.
**/
Atom
gdk_x11_atom_to_xatom (GdkAtom atom)
{
return gdk_x11_atom_to_xatom_for_display (gdk_display_get_default (), atom);
}
/**
* gdk_x11_xatom_to_atom_for_display:
* @display: (type GdkX11Display): A #GdkDisplay
@ -216,21 +201,6 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
return virtual_atom;
}
/**
* gdk_x11_xatom_to_atom:
* @xatom: an X atom for the default GDK display
*
* Convert from an X atom for the default display to the corresponding
* #GdkAtom.
*
* Returns: (transfer none): the corresponding G#dkAtom.
**/
GdkAtom
gdk_x11_xatom_to_atom (Atom xatom)
{
return gdk_x11_xatom_to_atom_for_display (gdk_display_get_default (), xatom);
}
/**
* gdk_x11_get_xatom_by_name_for_display:
* @display: (type GdkX11Display): a #GdkDisplay
@ -272,23 +242,6 @@ _gdk_x11_get_xatom_for_display_printf (GdkDisplay *display,
return atom;
}
/**
* gdk_x11_get_xatom_by_name:
* @atom_name: a string
*
* Returns the X atom for GDKs default display corresponding to @atom_name.
* This function caches the result, so if called repeatedly it is much
* faster than XInternAtom(), which is a round trip to the server each time.
*
* Returns: a X atom for GDKs default display.
**/
Atom
gdk_x11_get_xatom_by_name (const gchar *atom_name)
{
return gdk_x11_get_xatom_by_name_for_display (gdk_display_get_default (),
atom_name);
}
/**
* gdk_x11_get_xatom_name_for_display:
* @display: (type GdkX11Display): the #GdkDisplay where @xatom is defined
@ -313,22 +266,3 @@ gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
return (const char *)gdk_x11_xatom_to_atom_for_display (display, xatom);
}
/**
* gdk_x11_get_xatom_name:
* @xatom: an X atom for GDKs default display
*
* Returns the name of an X atom for GDKs default display. This
* function is meant mainly for debugging, so for convenience, unlike
* XAtomName() and the result
* doesnt need to be freed. Also, this function will never return %NULL,
* even if @xatom is invalid.
*
* Returns: name of the X atom; this string is owned by GTK+,
* so it shouldnt be modifed or freed.
**/
const gchar *
gdk_x11_get_xatom_name (Atom xatom)
{
return (const char *)gdk_x11_xatom_to_atom (xatom);
}

View File

@ -49,14 +49,6 @@ Atom gdk_x11_get_xatom_by_name_for_display (GdkDisplay *displa
GDK_AVAILABLE_IN_ALL
const gchar * gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
Atom xatom);
GDK_AVAILABLE_IN_ALL
Atom gdk_x11_atom_to_xatom (GdkAtom atom);
GDK_AVAILABLE_IN_ALL
GdkAtom gdk_x11_xatom_to_atom (Atom xatom);
GDK_AVAILABLE_IN_ALL
Atom gdk_x11_get_xatom_by_name (const gchar *atom_name);
GDK_AVAILABLE_IN_ALL
const gchar * gdk_x11_get_xatom_name (Atom xatom);
G_END_DECLS

View File

@ -136,7 +136,7 @@ get_utf8_property (GdkDisplay *display,
char *retval;
Atom utf8_string;
utf8_string = gdk_x11_get_xatom_by_name ("UTF8_STRING");
utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
gdk_x11_display_error_trap_push (display);
type = None;
@ -167,7 +167,7 @@ get_utf8_property (GdkDisplay *display,
if (!g_utf8_validate (val, nitems, NULL))
{
g_warning ("Property %s contained invalid UTF-8",
gdk_x11_get_xatom_name (atom));
gdk_x11_get_xatom_name_for_display (display, atom));
XFree (val);
return NULL;
}
@ -365,7 +365,7 @@ read_rgb_icon (GdkDisplay *display,
data = NULL;
result = XGetWindowProperty (xdisplay,
xwindow,
gdk_x11_get_xatom_by_name ("_NET_WM_ICON"),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON"),
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (void*)&data);