1 /* gdkproperty-quartz.c
3 * Copyright (C) 2005 Imendio AB
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
23 #include "gdkproperty.h"
25 static GHashTable *names_to_atoms;
26 static GPtrArray *atoms_to_names;
28 static const gchar xatoms_string[] =
29 /* These are all the standard predefined X atoms */
81 "UNDERLINE_POSITION\0"
82 "UNDERLINE_THICKNESS\0"
101 static const gint xatoms_offset[] = {
102 0, 5, 13, 23, 27, 32, 39, 48, 57, 64, 76, 88,
103 100, 112, 124, 136, 148, 160, 169, 174, 182, 189, 195, 205,
104 222, 236, 249, 262, 278, 291, 305, 317, 324, 333, 340, 351,
105 360, 378, 391, 404, 412, 428, 442, 456, 466, 477, 487, 497,
106 511, 525, 537, 549, 568, 588, 605, 623, 636, 645, 656, 663,
107 674, 685, 695, 702, 712, 724, 734, 745, 754
110 #define N_CUSTOM_PREDEFINED 1
113 ensure_atom_tables (void)
120 names_to_atoms = g_hash_table_new (g_str_hash, g_str_equal);
121 atoms_to_names = g_ptr_array_sized_new (G_N_ELEMENTS (xatoms_offset));
123 for (i = 0; i < G_N_ELEMENTS (xatoms_offset); i++)
125 g_hash_table_insert(names_to_atoms, (gchar *)xatoms_string + xatoms_offset[i], GINT_TO_POINTER (i));
126 g_ptr_array_add(atoms_to_names, (gchar *)xatoms_string + xatoms_offset[i]);
131 intern_atom_internal (const gchar *atom_name, gboolean allocate)
135 g_return_val_if_fail (atom_name != NULL, GDK_NONE);
137 ensure_atom_tables ();
139 if (g_hash_table_lookup_extended (names_to_atoms, atom_name, NULL, &result))
142 result = GINT_TO_POINTER (atoms_to_names->len);
143 name = allocate ? g_strdup (atom_name) : (gchar *)atom_name;
144 g_hash_table_insert(names_to_atoms, name, result);
145 g_ptr_array_add(atoms_to_names, name);
151 gdk_atom_intern (const gchar *atom_name,
152 gboolean only_if_exists)
154 return intern_atom_internal (atom_name, TRUE);
158 gdk_atom_intern_static_string (const gchar *atom_name)
160 return intern_atom_internal (atom_name, FALSE);
165 gdk_atom_name (GdkAtom atom)
170 if (GPOINTER_TO_INT (atom) >= atoms_to_names->len)
173 return g_ptr_array_index (atoms_to_names, GPOINTER_TO_INT (atom));
177 gdk_property_delete (GdkWindow *window,
180 /* FIXME: Implement */
184 gdk_property_get (GdkWindow *window,
190 GdkAtom *actual_property_type,
191 gint *actual_format_type,
195 /* FIXME: Implement */
200 gdk_property_change (GdkWindow *window,
208 /* FIXME: Implement */