gdk: move GdkAtom boxed type registration to common code

This commit is contained in:
Daemonratte 2026-06-09 12:19:39 +02:00
commit 8811f9398a
3 changed files with 31 additions and 26 deletions

View file

@ -817,6 +817,31 @@ gdk_threads_add_timeout_seconds (guint interval,
}
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;
}
const char *
gdk_get_program_class (void)
{

View file

@ -185,8 +185,13 @@ gdk_utf8_to_compound_text
#endif
#if IN_HEADER(__GDK_PROPERTY_H__)
#if IN_FILE(__GDK_PROPERTY_X11_C__)
#if IN_FILE(__GDK_C__)
gdk_atom_get_type G_GNUC_CONST
#endif
#endif
#if IN_HEADER(__GDK_PROPERTY_H__)
#if IN_FILE(__GDK_PROPERTY_X11_C__)
gdk_atom_intern
gdk_atom_intern_static_string
gdk_atom_name

View file

@ -393,31 +393,6 @@ 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)