| 1 |
/* gdkproperty-quartz.c |
| 2 |
* |
| 3 |
* Copyright (C) 2005 Imendio AB |
| 4 |
* |
| 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. |
| 9 |
* |
| 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. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
|
| 21 |
#include "gdkproperty.h" |
| 22 |
|
| 23 |
static GHashTable *names_to_atoms; |
| 24 |
static GPtrArray *atoms_to_names; |
| 25 |
|
| 26 |
static const gchar xatoms_string[] = |
| 27 |
/* These are all the standard predefined X atoms */ |
| 28 |
"NONE\0" |
| 29 |
"PRIMARY\0" |
| 30 |
"SECONDARY\0" |
| 31 |
"ARC\0" |
| 32 |
"ATOM\0" |
| 33 |
"BITMAP\0" |
| 34 |
"CARDINAL\0" |
| 35 |
"COLORMAP\0" |
| 36 |
"CURSOR\0" |
| 37 |
"CUT_BUFFER0\0" |
| 38 |
"CUT_BUFFER1\0" |
| 39 |
"CUT_BUFFER2\0" |
| 40 |
"CUT_BUFFER3\0" |
| 41 |
"CUT_BUFFER4\0" |
| 42 |
"CUT_BUFFER5\0" |
| 43 |
"CUT_BUFFER6\0" |
| 44 |
"CUT_BUFFER7\0" |
| 45 |
"DRAWABLE\0" |
| 46 |
"FONT\0" |
| 47 |
"INTEGER\0" |
| 48 |
"PIXMAP\0" |
| 49 |
"POINT\0" |
| 50 |
"RECTANGLE\0" |
| 51 |
"RESOURCE_MANAGER\0" |
| 52 |
"RGB_COLOR_MAP\0" |
| 53 |
"RGB_BEST_MAP\0" |
| 54 |
"RGB_BLUE_MAP\0" |
| 55 |
"RGB_DEFAULT_MAP\0" |
| 56 |
"RGB_GRAY_MAP\0" |
| 57 |
"RGB_GREEN_MAP\0" |
| 58 |
"RGB_RED_MAP\0" |
| 59 |
"STRING\0" |
| 60 |
"VISUALID\0" |
| 61 |
"WINDOW\0" |
| 62 |
"WM_COMMAND\0" |
| 63 |
"WM_HINTS\0" |
| 64 |
"WM_CLIENT_MACHINE\0" |
| 65 |
"WM_ICON_NAME\0" |
| 66 |
"WM_ICON_SIZE\0" |
| 67 |
"WM_NAME\0" |
| 68 |
"WM_NORMAL_HINTS\0" |
| 69 |
"WM_SIZE_HINTS\0" |
| 70 |
"WM_ZOOM_HINTS\0" |
| 71 |
"MIN_SPACE\0" |
| 72 |
"NORM_SPACE\0" |
| 73 |
"MAX_SPACE\0" |
| 74 |
"END_SPACE\0" |
| 75 |
"SUPERSCRIPT_X\0" |
| 76 |
"SUPERSCRIPT_Y\0" |
| 77 |
"SUBSCRIPT_X\0" |
| 78 |
"SUBSCRIPT_Y\0" |
| 79 |
"UNDERLINE_POSITION\0" |
| 80 |
"UNDERLINE_THICKNESS\0" |
| 81 |
"STRIKEOUT_ASCENT\0" |
| 82 |
"STRIKEOUT_DESCENT\0" |
| 83 |
"ITALIC_ANGLE\0" |
| 84 |
"X_HEIGHT\0" |
| 85 |
"QUAD_WIDTH\0" |
| 86 |
"WEIGHT\0" |
| 87 |
"POINT_SIZE\0" |
| 88 |
"RESOLUTION\0" |
| 89 |
"COPYRIGHT\0" |
| 90 |
"NOTICE\0" |
| 91 |
"FONT_NAME\0" |
| 92 |
"FAMILY_NAME\0" |
| 93 |
"FULL_NAME\0" |
| 94 |
"CAP_HEIGHT\0" |
| 95 |
"WM_CLASS\0" |
| 96 |
"WM_TRANSIENT_FOR\0" |
| 97 |
/* Below here, these are our additions. Increment N_CUSTOM_PREDEFINED |
| 98 |
* if you add any. |
| 99 |
*/ |
| 100 |
"CLIPBOARD\0" /* = 69 */; |
| 101 |
|
| 102 |
static const gint xatoms_offset[] = { |
| 103 |
0, 5, 13, 23, 27, 32, 39, 48, 57, 64, 76, 88, |
| 104 |
100, 112, 124, 136, 148, 160, 169, 174, 182, 189, 195, 205, |
| 105 |
222, 236, 249, 262, 278, 291, 305, 317, 324, 333, 340, 351, |
| 106 |
360, 378, 391, 404, 412, 428, 442, 456, 466, 477, 487, 497, |
| 107 |
511, 525, 537, 549, 568, 588, 605, 623, 636, 645, 656, 663, |
| 108 |
674, 685, 695, 702, 712, 724, 734, 745, 754, 771 |
| 109 |
}; |
| 110 |
|
| 111 |
#define N_CUSTOM_PREDEFINED 1 |
| 112 |
|
| 113 |
static void |
| 114 |
ensure_atom_tables (void) |
| 115 |
{ |
| 116 |
int i; |
| 117 |
|
| 118 |
if (names_to_atoms) |
| 119 |
return; |
| 120 |
|
| 121 |
names_to_atoms = g_hash_table_new (g_str_hash, g_str_equal); |
| 122 |
atoms_to_names = g_ptr_array_sized_new (G_N_ELEMENTS (xatoms_offset)); |
| 123 |
|
| 124 |
for (i = 0; i < G_N_ELEMENTS (xatoms_offset); i++) |
| 125 |
{ |
| 126 |
g_hash_table_insert(names_to_atoms, (gchar *)xatoms_string + xatoms_offset[i], GINT_TO_POINTER (i)); |
| 127 |
g_ptr_array_add(atoms_to_names, (gchar *)xatoms_string + xatoms_offset[i]); |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
void |
| 132 |
_gdk_quartz_window_delete_property (GdkWindow *window, |
| 133 |
GdkAtom property) |
| 134 |
{ |
| 135 |
/* FIXME: Implement */ |
| 136 |
} |
| 137 |
|
| 138 |
gint |
| 139 |
_gdk_quartz_window_get_property (GdkWindow *window, |
| 140 |
GdkAtom property, |
| 141 |
GdkAtom type, |
| 142 |
gulong offset, |
| 143 |
gulong length, |
| 144 |
gint pdelete, |
| 145 |
GdkAtom *actual_property_type, |
| 146 |
gint *actual_format_type, |
| 147 |
gint *actual_length, |
| 148 |
guchar **data) |
| 149 |
{ |
| 150 |
/* FIXME: Implement */ |
| 151 |
return 0; |
| 152 |
} |
| 153 |
|
| 154 |
void |
| 155 |
_gdk_quartz_window_change_property (GdkWindow *window, |
| 156 |
GdkAtom property, |
| 157 |
GdkAtom type, |
| 158 |
gint format, |
| 159 |
GdkPropMode mode, |
| 160 |
const guchar *data, |
| 161 |
gint nelements) |
| 162 |
{ |
| 163 |
/* FIXME: Implement */ |
| 164 |
} |