gdk: register GdkAtom as boxed type

This commit is contained in:
Daemonratte 2026-05-10 13:11:14 +02:00
commit 2bb67cb1db
4 changed files with 29 additions and 0 deletions

View file

@ -186,6 +186,7 @@ gdk_utf8_to_compound_text
#if IN_HEADER(__GDK_PROPERTY_H__)
#if IN_FILE(__GDK_PROPERTY_X11_C__)
gdk_atom_get_type G_GNUC_CONST
gdk_atom_intern
gdk_atom_intern_static_string
gdk_atom_name

View file

@ -42,6 +42,7 @@ typedef enum
GDK_PROP_MODE_APPEND
} GdkPropMode;
GType gdk_atom_get_type (void) G_GNUC_CONST;
GdkAtom gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists);
GdkAtom gdk_atom_intern_static_string (const gchar *atom_name);

View file

@ -77,6 +77,8 @@ typedef struct _GdkSpan GdkSpan;
*/
typedef guint32 GdkWChar;
#define GDK_TYPE_ATOM (gdk_atom_get_type ())
typedef struct _GdkAtom *GdkAtom;
#define GDK_ATOM_TO_POINTER(atom) (atom)

View file

@ -393,6 +393,31 @@ intern_atom (const gchar *atom_name,
return result;
}
static gpointer
gdk_atom_copy (gpointer atom)
{
return atom;
}
static void
gdk_atom_free (gpointer atom)
{
/* GdkAtom values are interned and must not be freed. */
}
GType
gdk_atom_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkAtom"),
(GBoxedCopyFunc) gdk_atom_copy,
(GBoxedFreeFunc) gdk_atom_free);
return our_type;
}
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists)