1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25static const struct {
26 const char *xname, *gdkname;
27} gdk_settings_map[] = {
28 {"Net/DoubleClickTime", "gtk-double-click-time"},
29 {"Net/DoubleClickDistance", "gtk-double-click-distance"},
30 {"Net/DndDragThreshold", "gtk-dnd-drag-threshold"},
31 {"Net/CursorBlink", "gtk-cursor-blink"},
32 {"Net/CursorBlinkTime", "gtk-cursor-blink-time"},
33 {"Net/ThemeName", "gtk-theme-name"},
34 {"Net/IconThemeName", "gtk-icon-theme-name"},
35 {"Gtk/ColorPalette", "gtk-color-palette"},
36 {"Gtk/FontName", "gtk-font-name"},
37 {"Gtk/KeyThemeName", "gtk-key-theme-name"},
38 {"Gtk/CursorThemeName", "gtk-cursor-theme-name"},
39 {"Gtk/CursorThemeSize", "gtk-cursor-theme-size"},
40 {"Gtk/ColorScheme", "gtk-color-scheme"},
41 {"Gtk/EnableAnimations", "gtk-enable-animations"},
42 {"Xft/Antialias", "gtk-xft-antialias"},
43 {"Xft/Hinting", "gtk-xft-hinting"},
44 {"Xft/HintStyle", "gtk-xft-hintstyle"},
45 {"Xft/RGBA", "gtk-xft-rgba"},
46 {"Xft/DPI", "gtk-xft-dpi"},
47 {"Gtk/EnableAccels", "gtk-enable-accels"},
48 {"Gtk/ScrolledWindowPlacement", "gtk-scrolled-window-placement"},
49 {"Gtk/IMModule", "gtk-im-module"},
50 {"Fontconfig/Timestamp", "gtk-fontconfig-timestamp"},
51 {"Net/SoundThemeName", "gtk-sound-theme-name"},
52 {"Net/EnableInputFeedbackSounds", "gtk-enable-input-feedback-sounds"},
53 {"Net/EnableEventSounds", "gtk-enable-event-sounds"},
54 {"Gtk/CursorBlinkTimeout", "gtk-cursor-blink-timeout"},
55 {"Gtk/ShellShowsAppMenu", "gtk-shell-shows-app-menu"},
56 {"Gtk/ShellShowsMenubar", "gtk-shell-shows-menubar"},
57 {"Gtk/ShellShowsDesktop", "gtk-shell-shows-desktop"},
58 {"Gtk/SessionBusId", "gtk-session-bus-id"},
59 {"Gtk/DecorationLayout", "gtk-decoration-layout"},
60 {"Gtk/TitlebarDoubleClick", "gtk-titlebar-double-click"},
61 {"Gtk/TitlebarMiddleClick", "gtk-titlebar-middle-click"},
62 {"Gtk/TitlebarRightClick", "gtk-titlebar-right-click"},
63 {"Gtk/DialogsUseHeader", "gtk-dialogs-use-header"},
64 {"Gtk/EnablePrimaryPaste", "gtk-enable-primary-paste"},
65 {"Gtk/PrimaryButtonWarpsSlider", "gtk-primary-button-warps-slider"},
66 {"Gtk/RecentFilesMaxAge", "gtk-recent-files-max-age"},
67 {"Gtk/RecentFilesEnabled", "gtk-recent-files-enabled"},
68 {"Gtk/KeynavUseCaret", "gtk-keynav-use-caret"},
69 {"Gtk/OverlayScrolling", "gtk-overlay-scrolling"},
70
71 /* These are here in order to be recognized, but are not sent to
72 gtk as they are handled internally by gdk: */
73 {"Gdk/WindowScalingFactor", "gdk-window-scaling-factor"},
74 {"Gdk/UnscaledDPI", "gdk-unscaled-dpi"}
75};
76
77static const char *
78gdk_from_xsettings_name (const char *xname)
79{
80 static GHashTable *hash = NULL;
81 guint i;
82
83 if (G_UNLIKELY (hash == NULL))
84 {
85 hash = g_hash_table_new (hash_func: g_str_hash, key_equal_func: g_str_equal);
86
87 for (i = 0; i < G_N_ELEMENTS (gdk_settings_map); i++)
88 g_hash_table_insert (hash_table: hash, key: (gpointer)gdk_settings_map[i].xname,
89 value: (gpointer)gdk_settings_map[i].gdkname);
90 }
91
92 return g_hash_table_lookup (hash_table: hash, key: xname);
93}
94
95

source code of gtk/gdk/x11/gdksettings.c