| 1 |
/* GDK - The GIMP Drawing Kit |
| 2 |
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 3 |
* Copyright (C) 1998-2002 Tor Lillqvist |
| 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, write to the |
| 17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 |
* Boston, MA 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 23 |
* file for a list of people on the GTK+ Team. See the ChangeLog |
| 24 |
* files for a list of changes. These files are distributed with |
| 25 |
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 26 |
*/ |
| 27 |
|
| 28 |
#include "config.h" |
| 29 |
#include <string.h> |
| 30 |
#include <stdlib.h> |
| 31 |
#include <glib/gprintf.h> |
| 32 |
|
| 33 |
#include "gdkscreen.h" |
| 34 |
#include "gdkproperty.h" |
| 35 |
#include "gdkselection.h" |
| 36 |
#include "gdkprivate-win32.h" |
| 37 |
|
| 38 |
GdkAtom |
| 39 |
gdk_atom_intern (const gchar *atom_name, |
| 40 |
gint only_if_exists) |
| 41 |
{ |
| 42 |
ATOM win32_atom; |
| 43 |
GdkAtom retval; |
| 44 |
static GHashTable *atom_hash = NULL; |
| 45 |
|
| 46 |
if (!atom_hash) |
| 47 |
atom_hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 48 |
|
| 49 |
retval = g_hash_table_lookup (atom_hash, atom_name); |
| 50 |
if (!retval) |
| 51 |
{ |
| 52 |
if (strcmp (atom_name, "PRIMARY") == 0) |
| 53 |
retval = GDK_SELECTION_PRIMARY; |
| 54 |
else if (strcmp (atom_name, "SECONDARY") == 0) |
| 55 |
retval = GDK_SELECTION_SECONDARY; |
| 56 |
else if (strcmp (atom_name, "CLIPBOARD") == 0) |
| 57 |
retval = GDK_SELECTION_CLIPBOARD; |
| 58 |
else if (strcmp (atom_name, "ATOM") == 0) |
| 59 |
retval = GDK_SELECTION_TYPE_ATOM; |
| 60 |
else if (strcmp (atom_name, "BITMAP") == 0) |
| 61 |
retval = GDK_SELECTION_TYPE_BITMAP; |
| 62 |
else if (strcmp (atom_name, "COLORMAP") == 0) |
| 63 |
retval = GDK_SELECTION_TYPE_COLORMAP; |
| 64 |
else if (strcmp (atom_name, "DRAWABLE") == 0) |
| 65 |
retval = GDK_SELECTION_TYPE_DRAWABLE; |
| 66 |
else if (strcmp (atom_name, "INTEGER") == 0) |
| 67 |
retval = GDK_SELECTION_TYPE_INTEGER; |
| 68 |
else if (strcmp (atom_name, "PIXMAP") == 0) |
| 69 |
retval = GDK_SELECTION_TYPE_PIXMAP; |
| 70 |
else if (strcmp (atom_name, "WINDOW") == 0) |
| 71 |
retval = GDK_SELECTION_TYPE_WINDOW; |
| 72 |
else if (strcmp (atom_name, "STRING") == 0) |
| 73 |
retval = GDK_SELECTION_TYPE_STRING; |
| 74 |
else |
| 75 |
{ |
| 76 |
win32_atom = GlobalAddAtom (atom_name); |
| 77 |
retval = GUINT_TO_POINTER ((guint) win32_atom); |
| 78 |
} |
| 79 |
g_hash_table_insert (atom_hash, |
| 80 |
g_strdup (atom_name), |
| 81 |
retval); |
| 82 |
} |
| 83 |
|
| 84 |
return retval; |
| 85 |
} |
| 86 |
|
| 87 |
GdkAtom |
| 88 |
gdk_atom_intern_static_string (const gchar *atom_name) |
| 89 |
{ |
| 90 |
/* on X11 this is supposed to save memory. On win32 there seems to be |
| 91 |
* no way to make a difference ? |
| 92 |
*/ |
| 93 |
return gdk_atom_intern (atom_name, FALSE); |
| 94 |
} |
| 95 |
|
| 96 |
gchar * |
| 97 |
gdk_atom_name (GdkAtom atom) |
| 98 |
{ |
| 99 |
ATOM win32_atom; |
| 100 |
gchar name[256]; |
| 101 |
|
| 102 |
if (GDK_NONE == atom) return g_strdup ("<none>"); |
| 103 |
else if (GDK_SELECTION_PRIMARY == atom) return g_strdup ("PRIMARY"); |
| 104 |
else if (GDK_SELECTION_SECONDARY == atom) return g_strdup ("SECONDARY"); |
| 105 |
else if (GDK_SELECTION_CLIPBOARD == atom) return g_strdup ("CLIPBOARD"); |
| 106 |
else if (GDK_SELECTION_TYPE_ATOM == atom) return g_strdup ("ATOM"); |
| 107 |
else if (GDK_SELECTION_TYPE_BITMAP == atom) return g_strdup ("BITMAP"); |
| 108 |
else if (GDK_SELECTION_TYPE_COLORMAP == atom) return g_strdup ("COLORMAP"); |
| 109 |
else if (GDK_SELECTION_TYPE_DRAWABLE == atom) return g_strdup ("DRAWABLE"); |
| 110 |
else if (GDK_SELECTION_TYPE_INTEGER == atom) return g_strdup ("INTEGER"); |
| 111 |
else if (GDK_SELECTION_TYPE_PIXMAP == atom) return g_strdup ("PIXMAP"); |
| 112 |
else if (GDK_SELECTION_TYPE_WINDOW == atom) return g_strdup ("WINDOW"); |
| 113 |
else if (GDK_SELECTION_TYPE_STRING == atom) return g_strdup ("STRING"); |
| 114 |
|
| 115 |
win32_atom = GPOINTER_TO_UINT (atom); |
| 116 |
|
| 117 |
if (win32_atom < 0xC000) |
| 118 |
return g_strdup_printf ("#%p", atom); |
| 119 |
else if (GlobalGetAtomName (win32_atom, name, sizeof (name)) == 0) |
| 120 |
return NULL; |
| 121 |
return g_strdup (name); |
| 122 |
} |
| 123 |
|
| 124 |
gint |
| 125 |
gdk_property_get (GdkWindow *window, |
| 126 |
GdkAtom property, |
| 127 |
GdkAtom type, |
| 128 |
gulong offset, |
| 129 |
gulong length, |
| 130 |
gint pdelete, |
| 131 |
GdkAtom *actual_property_type, |
| 132 |
gint *actual_format_type, |
| 133 |
gint *actual_length, |
| 134 |
guchar **data) |
| 135 |
{ |
| 136 |
g_return_val_if_fail (window != NULL, FALSE); |
| 137 |
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); |
| 138 |
|
| 139 |
if (GDK_WINDOW_DESTROYED (window)) |
| 140 |
return FALSE; |
| 141 |
|
| 142 |
g_warning ("gdk_property_get: Not implemented"); |
| 143 |
|
| 144 |
return FALSE; |
| 145 |
} |
| 146 |
|
| 147 |
void |
| 148 |
gdk_property_change (GdkWindow *window, |
| 149 |
GdkAtom property, |
| 150 |
GdkAtom type, |
| 151 |
gint format, |
| 152 |
GdkPropMode mode, |
| 153 |
const guchar *data, |
| 154 |
gint nelements) |
| 155 |
{ |
| 156 |
HGLOBAL hdata; |
| 157 |
gint i, size; |
| 158 |
guchar *ucptr; |
| 159 |
wchar_t *wcptr, *p; |
| 160 |
glong wclen; |
| 161 |
GError *err = NULL; |
| 162 |
|
| 163 |
g_return_if_fail (window != NULL); |
| 164 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 165 |
|
| 166 |
if (GDK_WINDOW_DESTROYED (window)) |
| 167 |
return; |
| 168 |
|
| 169 |
GDK_NOTE (DND, { |
| 170 |
gchar *prop_name = gdk_atom_name (property); |
| 171 |
gchar *type_name = gdk_atom_name (type); |
| 172 |
|
| 173 |
g_print ("gdk_property_change: %p %s %s %s %d*%d bits: %s\n", |
| 174 |
GDK_WINDOW_HWND (window), |
| 175 |
prop_name, |
| 176 |
type_name, |
| 177 |
(mode == GDK_PROP_MODE_REPLACE ? "REPLACE" : |
| 178 |
(mode == GDK_PROP_MODE_PREPEND ? "PREPEND" : |
| 179 |
(mode == GDK_PROP_MODE_APPEND ? "APPEND" : |
| 180 |
"???"))), |
| 181 |
format, nelements, |
| 182 |
_gdk_win32_data_to_string (data, MIN (10, format*nelements/8))); |
| 183 |
g_free (prop_name); |
| 184 |
g_free (type_name); |
| 185 |
}); |
| 186 |
|
| 187 |
/* We should never come here for these types */ |
| 188 |
g_return_if_fail (type != GDK_TARGET_STRING); |
| 189 |
g_return_if_fail (type != _text); |
| 190 |
g_return_if_fail (type != _compound_text); |
| 191 |
g_return_if_fail (type != _save_targets); |
| 192 |
|
| 193 |
if (property == _gdk_selection && |
| 194 |
format == 8 && |
| 195 |
mode == GDK_PROP_MODE_REPLACE) |
| 196 |
{ |
| 197 |
if (type == _image_bmp && nelements < sizeof (BITMAPFILEHEADER)) |
| 198 |
{ |
| 199 |
g_warning ("Clipboard contains invalid bitmap data"); |
| 200 |
return; |
| 201 |
} |
| 202 |
|
| 203 |
if (type == _utf8_string) |
| 204 |
{ |
| 205 |
if (!OpenClipboard (GDK_WINDOW_HWND (window))) |
| 206 |
{ |
| 207 |
WIN32_API_FAILED ("OpenClipboard"); |
| 208 |
return; |
| 209 |
} |
| 210 |
|
| 211 |
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, &err); |
| 212 |
if (err != NULL) |
| 213 |
{ |
| 214 |
g_warning ("Failed to convert utf8: %s", err->message); |
| 215 |
g_clear_error (&err); |
| 216 |
return; |
| 217 |
} |
| 218 |
|
| 219 |
wclen++; /* Terminating 0 */ |
| 220 |
size = wclen * 2; |
| 221 |
for (i = 0; i < wclen; i++) |
| 222 |
if (wcptr[i] == '\n' && (i == 0 || wcptr[i - 1] != '\r')) |
| 223 |
size += 2; |
| 224 |
|
| 225 |
if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, size))) |
| 226 |
{ |
| 227 |
WIN32_API_FAILED ("GlobalAlloc"); |
| 228 |
if (!CloseClipboard ()) |
| 229 |
WIN32_API_FAILED ("CloseClipboard"); |
| 230 |
g_free (wcptr); |
| 231 |
return; |
| 232 |
} |
| 233 |
|
| 234 |
ucptr = GlobalLock (hdata); |
| 235 |
|
| 236 |
p = (wchar_t *) ucptr; |
| 237 |
for (i = 0; i < wclen; i++) |
| 238 |
{ |
| 239 |
if (wcptr[i] == '\n' && (i == 0 || wcptr[i - 1] != '\r')) |
| 240 |
*p++ = '\r'; |
| 241 |
*p++ = wcptr[i]; |
| 242 |
} |
| 243 |
g_free (wcptr); |
| 244 |
|
| 245 |
GlobalUnlock (hdata); |
| 246 |
GDK_NOTE (DND, g_print ("... SetClipboardData(CF_UNICODETEXT,%p)\n", |
| 247 |
hdata)); |
| 248 |
if (!SetClipboardData (CF_UNICODETEXT, hdata)) |
| 249 |
WIN32_API_FAILED ("SetClipboardData"); |
| 250 |
|
| 251 |
if (!CloseClipboard ()) |
| 252 |
WIN32_API_FAILED ("CloseClipboard"); |
| 253 |
} |
| 254 |
else |
| 255 |
{ |
| 256 |
/* We use delayed rendering for everything else than |
| 257 |
* text. We can't assign hdata to the clipboard here as type |
| 258 |
* may be "image/png", "image/jpg", etc. In this case |
| 259 |
* there's a further conversion afterwards. |
| 260 |
*/ |
| 261 |
GDK_NOTE (DND, g_print ("... delayed rendering\n")); |
| 262 |
_delayed_rendering_data = NULL; |
| 263 |
if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, nelements > 0 ? nelements : 1))) |
| 264 |
{ |
| 265 |
WIN32_API_FAILED ("GlobalAlloc"); |
| 266 |
return; |
| 267 |
} |
| 268 |
ucptr = GlobalLock (hdata); |
| 269 |
memcpy (ucptr, data, nelements); |
| 270 |
GlobalUnlock (hdata); |
| 271 |
_delayed_rendering_data = hdata; |
| 272 |
} |
| 273 |
} |
| 274 |
else if (property == _gdk_ole2_dnd) |
| 275 |
{ |
| 276 |
/* Will happen only if gdkdnd-win32.c has OLE2 dnd support compiled in */ |
| 277 |
_gdk_win32_ole2_dnd_property_change (type, format, data, nelements); |
| 278 |
} |
| 279 |
else |
| 280 |
g_warning ("gdk_property_change: General case not implemented"); |
| 281 |
} |
| 282 |
|
| 283 |
void |
| 284 |
gdk_property_delete (GdkWindow *window, |
| 285 |
GdkAtom property) |
| 286 |
{ |
| 287 |
gchar *prop_name; |
| 288 |
|
| 289 |
g_return_if_fail (window != NULL); |
| 290 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 291 |
|
| 292 |
GDK_NOTE (DND, { |
| 293 |
prop_name = gdk_atom_name (property); |
| 294 |
|
| 295 |
g_print ("gdk_property_delete: %p %s\n", |
| 296 |
GDK_WINDOW_HWND (window), |
| 297 |
prop_name); |
| 298 |
g_free (prop_name); |
| 299 |
}); |
| 300 |
|
| 301 |
if (property == _gdk_selection) |
| 302 |
_gdk_selection_property_delete (window); |
| 303 |
else if (property == _wm_transient_for) |
| 304 |
gdk_window_set_transient_for (window, _gdk_root); |
| 305 |
else |
| 306 |
{ |
| 307 |
prop_name = gdk_atom_name (property); |
| 308 |
g_warning ("gdk_property_delete: General case (%s) not implemented", |
| 309 |
prop_name); |
| 310 |
g_free (prop_name); |
| 311 |
} |
| 312 |
} |
| 313 |
|
| 314 |
/* |
| 315 |
For reference, from gdk/x11/gdksettings.c: |
| 316 |
|
| 317 |
"Net/DoubleClickTime\0" "gtk-double-click-time\0" |
| 318 |
"Net/DoubleClickDistance\0" "gtk-double-click-distance\0" |
| 319 |
"Net/DndDragThreshold\0" "gtk-dnd-drag-threshold\0" |
| 320 |
"Net/CursorBlink\0" "gtk-cursor-blink\0" |
| 321 |
"Net/CursorBlinkTime\0" "gtk-cursor-blink-time\0" |
| 322 |
"Net/ThemeName\0" "gtk-theme-name\0" |
| 323 |
"Net/IconThemeName\0" "gtk-icon-theme-name\0" |
| 324 |
"Gtk/CanChangeAccels\0" "gtk-can-change-accels\0" |
| 325 |
"Gtk/ColorPalette\0" "gtk-color-palette\0" |
| 326 |
"Gtk/FontName\0" "gtk-font-name\0" |
| 327 |
"Gtk/IconSizes\0" "gtk-icon-sizes\0" |
| 328 |
"Gtk/KeyThemeName\0" "gtk-key-theme-name\0" |
| 329 |
"Gtk/ToolbarStyle\0" "gtk-toolbar-style\0" |
| 330 |
"Gtk/ToolbarIconSize\0" "gtk-toolbar-icon-size\0" |
| 331 |
"Gtk/IMPreeditStyle\0" "gtk-im-preedit-style\0" |
| 332 |
"Gtk/IMStatusStyle\0" "gtk-im-status-style\0" |
| 333 |
"Gtk/Modules\0" "gtk-modules\0" |
| 334 |
"Gtk/FileChooserBackend\0" "gtk-file-chooser-backend\0" |
| 335 |
"Gtk/ButtonImages\0" "gtk-button-images\0" |
| 336 |
"Gtk/MenuImages\0" "gtk-menu-images\0" |
| 337 |
"Gtk/MenuBarAccel\0" "gtk-menu-bar-accel\0" |
| 338 |
"Gtk/CursorBlinkTimeout\0" "gtk-cursor-blink-timeout\0" |
| 339 |
"Gtk/CursorThemeName\0" "gtk-cursor-theme-name\0" |
| 340 |
"Gtk/CursorThemeSize\0" "gtk-cursor-theme-size\0" |
| 341 |
"Gtk/ShowInputMethodMenu\0" "gtk-show-input-method-menu\0" |
| 342 |
"Gtk/ShowUnicodeMenu\0" "gtk-show-unicode-menu\0" |
| 343 |
"Gtk/TimeoutInitial\0" "gtk-timeout-initial\0" |
| 344 |
"Gtk/TimeoutRepeat\0" "gtk-timeout-repeat\0" |
| 345 |
"Gtk/ColorScheme\0" "gtk-color-scheme\0" |
| 346 |
"Gtk/EnableAnimations\0" "gtk-enable-animations\0" |
| 347 |
"Xft/Antialias\0" "gtk-xft-antialias\0" |
| 348 |
"Xft/Hinting\0" "gtk-xft-hinting\0" |
| 349 |
"Xft/HintStyle\0" "gtk-xft-hintstyle\0" |
| 350 |
"Xft/RGBA\0" "gtk-xft-rgba\0" |
| 351 |
"Xft/DPI\0" "gtk-xft-dpi\0" |
| 352 |
"Net/FallbackIconTheme\0" "gtk-fallback-icon-theme\0" |
| 353 |
"Gtk/TouchscreenMode\0" "gtk-touchscreen-mode\0" |
| 354 |
"Gtk/EnableAccels\0" "gtk-enable-accels\0" |
| 355 |
"Gtk/EnableMnemonics\0" "gtk-enable-mnemonics\0" |
| 356 |
"Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0" |
| 357 |
"Gtk/IMModule\0" "gtk-im-module\0" |
| 358 |
"Fontconfig/Timestamp\0" "gtk-fontconfig-timestamp\0" |
| 359 |
"Net/SoundThemeName\0" "gtk-sound-theme-name\0" |
| 360 |
"Net/EnableInputFeedbackSounds\0" "gtk-enable-input-feedback-sounds\0" |
| 361 |
"Net/EnableEventSounds\0" "gtk-enable-event-sounds\0"; |
| 362 |
|
| 363 |
More, from various places in gtk sources: |
| 364 |
|
| 365 |
gtk-entry-select-on-focus |
| 366 |
gtk-split-cursor |
| 367 |
|
| 368 |
*/ |
| 369 |
gboolean |
| 370 |
gdk_screen_get_setting (GdkScreen *screen, |
| 371 |
const gchar *name, |
| 372 |
GValue *value) |
| 373 |
{ |
| 374 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); |
| 375 |
|
| 376 |
/* |
| 377 |
* XXX : if these values get changed through the Windoze UI the |
| 378 |
* respective gdk_events are not generated yet. |
| 379 |
*/ |
| 380 |
if (strcmp ("gtk-theme-name", name) == 0) |
| 381 |
{ |
| 382 |
g_value_set_string (value, "ms-windows"); |
| 383 |
} |
| 384 |
else if (strcmp ("gtk-double-click-time", name) == 0) |
| 385 |
{ |
| 386 |
gint i = GetDoubleClickTime (); |
| 387 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i)); |
| 388 |
g_value_set_int (value, i); |
| 389 |
return TRUE; |
| 390 |
} |
| 391 |
else if (strcmp ("gtk-double-click-distance", name) == 0) |
| 392 |
{ |
| 393 |
gint i = MAX(GetSystemMetrics (SM_CXDOUBLECLK), GetSystemMetrics (SM_CYDOUBLECLK)); |
| 394 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i)); |
| 395 |
g_value_set_int (value, i); |
| 396 |
return TRUE; |
| 397 |
} |
| 398 |
else if (strcmp ("gtk-dnd-drag-threshold", name) == 0) |
| 399 |
{ |
| 400 |
gint i = MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG)); |
| 401 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i)); |
| 402 |
g_value_set_int (value, i); |
| 403 |
return TRUE; |
| 404 |
} |
| 405 |
else if (strcmp ("gtk-split-cursor", name) == 0) |
| 406 |
{ |
| 407 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : FALSE\n", name)); |
| 408 |
g_value_set_boolean (value, FALSE); |
| 409 |
return TRUE; |
| 410 |
} |
| 411 |
else if (strcmp ("gtk-alternative-button-order", name) == 0) |
| 412 |
{ |
| 413 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name)); |
| 414 |
g_value_set_boolean (value, TRUE); |
| 415 |
return TRUE; |
| 416 |
} |
| 417 |
else if (strcmp ("gtk-alternative-sort-arrows", name) == 0) |
| 418 |
{ |
| 419 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name)); |
| 420 |
g_value_set_boolean (value, TRUE); |
| 421 |
return TRUE; |
| 422 |
} |
| 423 |
#if 0 |
| 424 |
/* |
| 425 |
* With 'MS Sans Serif' as windows menu font (default on win98se) you'll get a |
| 426 |
* bunch of : |
| 427 |
* WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8" |
| 428 |
* at least with testfilechooser (regardless of the bitmap check below) |
| 429 |
* so just disabling this code seems to be the best we can do --hb |
| 430 |
*/ |
| 431 |
else if (strcmp ("gtk-font-name", name) == 0) |
| 432 |
{ |
| 433 |
NONCLIENTMETRICS ncm; |
| 434 |
ncm.cbSize = sizeof(NONCLIENTMETRICS); |
| 435 |
if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE)) |
| 436 |
{ |
| 437 |
/* Pango finally uses GetDeviceCaps to scale, we use simple |
| 438 |
* approximation here. |
| 439 |
*/ |
| 440 |
int nHeight = (0 > ncm.lfMenuFont.lfHeight ? -3*ncm.lfMenuFont.lfHeight/4 : 10); |
| 441 |
if (OUT_STRING_PRECIS == ncm.lfMenuFont.lfOutPrecision) |
| 442 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : ignoring bitmap font '%s'\n", |
| 443 |
name, ncm.lfMenuFont.lfFaceName)); |
| 444 |
else if (ncm.lfMenuFont.lfFaceName && strlen(ncm.lfMenuFont.lfFaceName) > 0 && |
| 445 |
/* Avoid issues like those described in bug #135098 */ |
| 446 |
g_utf8_validate (ncm.lfMenuFont.lfFaceName, -1, NULL)) |
| 447 |
{ |
| 448 |
char* s = g_strdup_printf ("%s %d", ncm.lfMenuFont.lfFaceName, nHeight); |
| 449 |
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : %s\n", name, s)); |
| 450 |
g_value_set_string (value, s); |
| 451 |
|
| 452 |
g_free(s); |
| 453 |
return TRUE; |
| 454 |
} |
| 455 |
} |
| 456 |
} |
| 457 |
#endif |
| 458 |
|
| 459 |
return FALSE; |
| 460 |
} |