[gtk+] x11: Get rid of default Atom converters



commit 920259c25070986b13675fd86f3def1b805dc00d
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 14 13:02:50 2017 +0100

    x11: Get rid of default Atom converters
    
    No, using the default Wayland display is not okay to query Atoms.

 docs/reference/gdk/gdk4-sections.txt |    4 --
 gdk/x11/gdkdevicemanager-xi2.c       |    2 +-
 gdk/x11/gdkproperty-x11.c            |   66 ----------------------------------
 gdk/x11/gdkx11property.h             |    8 ----
 gtk/gtkmountoperation-x11.c          |    6 ++--
 5 files changed, 4 insertions(+), 82 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index bf84d33..7475598 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -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
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 676ed97..e6908de 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -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;
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
index dc3ca81..be26586 100644
--- a/gdk/x11/gdkproperty-x11.c
+++ b/gdk/x11/gdkproperty-x11.c
@@ -145,21 +145,6 @@ _gdk_x11_precache_atoms (GdkDisplay          *display,
 }
 
 /**
- * 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
  * @xatom: an X atom 
@@ -217,21 +202,6 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
 }
 
 /**
- * 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
  * @atom_name: a string
@@ -273,23 +243,6 @@ _gdk_x11_get_xatom_for_display_printf (GdkDisplay    *display,
 }
 
 /**
- * gdk_x11_get_xatom_by_name:
- * @atom_name: a string
- * 
- * Returns the X atom for GDK’s 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 GDK’s 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
  * @xatom: an X atom 
@@ -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 GDK’s default display
- * 
- * Returns the name of an X atom for GDK’s default display. This
- * function is meant mainly for debugging, so for convenience, unlike
- * XAtomName() and the result 
- * doesn’t 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 shouldn’t be modifed or freed. 
- **/
-const gchar *
-gdk_x11_get_xatom_name (Atom xatom)
-{
-  return (const char *)gdk_x11_xatom_to_atom (xatom);
-}
-
diff --git a/gdk/x11/gdkx11property.h b/gdk/x11/gdkx11property.h
index 55d4fba..9b3e694 100644
--- a/gdk/x11/gdkx11property.h
+++ b/gdk/x11/gdkx11property.h
@@ -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
 
diff --git a/gtk/gtkmountoperation-x11.c b/gtk/gtkmountoperation-x11.c
index 562fa8d..345570c 100644
--- a/gtk/gtkmountoperation-x11.c
+++ b/gtk/gtkmountoperation-x11.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]