diff --git a/ChangeLog b/ChangeLog index 0c8308b85..d5e3dd1c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Feb 27 14:52:50 2006 Tim Janik + + * gdkevents-x11.c: + * gdksettings.c: moved and renamed the gdk_settings_names and + gdk_settings_map. + + * gdk/x11/checksettings.c: test program for the gdk_settings_map array. + + * gdk/x11/Makefile.am: run checksettings as part of make check. + 2006-02-27 Matthias Clasen * gtk/gtkdnd.c (gtk_drag_get_cursor): Comment out some unused diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0c8308b85..d5e3dd1c5 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Mon Feb 27 14:52:50 2006 Tim Janik + + * gdkevents-x11.c: + * gdksettings.c: moved and renamed the gdk_settings_names and + gdk_settings_map. + + * gdk/x11/checksettings.c: test program for the gdk_settings_map array. + + * gdk/x11/Makefile.am: run checksettings as part of make check. + 2006-02-27 Matthias Clasen * gtk/gtkdnd.c (gtk_drag_get_cursor): Comment out some unused diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am index 59f8e5e0c..67aeafc38 100644 --- a/gdk/x11/Makefile.am +++ b/gdk/x11/Makefile.am @@ -68,6 +68,12 @@ endif libgdkinclude_HEADERS = \ gdkx.h + +noinst_PROGRAMS = checksettings +checksettings_LDADD = libgdk-x11.la $(GLIB_LIBS) $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la + +TESTS = checksettings + # We need to include all these C files here since the conditionals # don't seem to be correctly expanded for the dist files. EXTRA_DIST = \ diff --git a/gdk/x11/checksettings.c b/gdk/x11/checksettings.c new file mode 100644 index 000000000..ee47cab60 --- /dev/null +++ b/gdk/x11/checksettings.c @@ -0,0 +1,38 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2006 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include +#include "gdksettings.c" +int +main (int argc, + char *argv[]) +{ + guint i, accu = 0; + for (i = 0; i < GDK_SETTINGS_N_ELEMENTS(); i++) + { + if (gdk_settings_map[i].xsettings_offset != accu) + g_error ("settings_map[%u].xsettings_offset != %u\n", i, accu); + accu += strlen (gdk_settings_names + accu) + 1; + if (gdk_settings_map[i].gdk_offset != accu) + g_error ("settings_map[%u].gdk_offset != %u\n", i, accu); + accu += strlen (gdk_settings_names + accu) + 1; + // g_print ("%u) ok.\n", i); + } + g_print ("checksettings: all ok.\n"); + return 0; +} diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index f3445c21c..40bce56b3 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -2794,84 +2794,7 @@ gdk_net_wm_supports (GdkAtom property) return gdk_x11_screen_supports_net_wm_hint (gdk_screen_get_default (), property); } -static const char settings_names[] = - "Net/DoubleClickTime\0" "gtk-double-click-time\0" - "Net/DoubleClickDistance\0" "gtk-double-click-distance\0" - "Net/DndDragThreshold\0" "gtk-dnd-drag-threshold\0" - "Net/CursorBlink\0" "gtk-cursor-blink\0" - "Net/CursorBlinkTime\0" "gtk-cursor-blink-time\0" - "Net/ThemeName\0" "gtk-theme-name\0" - "Net/IconThemeName\0" "gtk-icon-theme-name\0" - "Gtk/CanChangeAccels\0" "gtk-can-change-accels\0" - "Gtk/ColorPalette\0" "gtk-color-palette\0" - "Gtk/FontName\0" "gtk-font-name\0" - "Gtk/IconSizes\0" "gtk-icon-sizes\0" - "Gtk/KeyThemeName\0" "gtk-key-theme-name\0" - "Gtk/ToolbarStyle\0" "gtk-toolbar-style\0" - "Gtk/ToolbarIconSize\0" "gtk-toolbar-icon-size\0" - "Gtk/IMPreeditStyle\0" "gtk-im-preedit-style\0" - "Gtk/IMStatusStyle\0" "gtk-im-status-style\0" - "Gtk/Modules\0" "gtk-modules\0" - "Gtk/FileChooserBackend\0" "gtk-file-chooser-backend\0" - "Gtk/ButtonImages\0" "gtk-button-images\0" - "Gtk/MenuImages\0" "gtk-menu-images\0" - "Gtk/MenuBarAccel\0" "gtk-menu-bar-accel\0" - "Gtk/CursorThemeName\0" "gtk-cursor-theme-name\0" - "Gtk/CursorThemeSize\0" "gtk-cursor-theme-size\0" - "Gtk/ShowInputMethodMenu\0" "gtk-show-input-method-menu\0" - "Gtk/ShowUnicodeMenu\0" "gtk-show-unicode-menu\0" - "Gtk/TimeoutInitial\0" "gtk-timeout-initial\0" - "Gtk/TimeoutRepeat\0" "gtk-timeout-repeat\0" - "Gtk/ColorScheme\0" "gtk-color-scheme\0" - "Gtk/EnableAnimations\0" "gtk-enable-animations\0" - "Xft/Antialias\0" "gtk-xft-antialias\0" - "Xft/Hinting\0" "gtk-xft-hinting\0" - "Xft/HintStyle\0" "gtk-xft-hintstyle\0" - "Xft/RGBA\0" "gtk-xft-rgba\0" - "Xft/DPI\0" "gtk-xft-dpi\0" - "Net/FallbackIconTheme\0" "gtk-fallback-icon-theme\0"; - -static const struct -{ - gint xsettings_offset; - gint gdk_offset; -} settings_map[] = { - { 0, 20 }, - { 42, 66 }, - { 92, 113 }, - { 136, 152 }, - { 169, 189 }, - { 211, 225 }, - { 240, 258 }, - { 278, 298 }, - { 320, 337 }, - { 355, 368 }, - { 382, 396 }, - { 411, 428 }, - { 447, 464 }, - { 482, 502 }, - { 524, 543 }, - { 564, 582 }, - { 602, 614 }, - { 626, 649 }, - { 674, 691 }, - { 709, 724 }, - { 740, 757 }, - { 776, 796 }, - { 818, 838 }, - { 860, 884 }, - { 911, 931 }, - { 953, 972 }, - { 992, 1010 }, - { 1029, 1045 }, - { 1062, 1083 }, - { 1105, 1119 }, - { 1137, 1149 }, - { 1165, 1179 }, - { 1197, 1206 }, - { 1219, 1227 }, - { 1239, 1261 } -}; +#include "gdksettings.c" static void gdk_xsettings_notify_cb (const char *name, @@ -2892,10 +2815,10 @@ gdk_xsettings_notify_cb (const char *name, new_event.setting.send_event = FALSE; new_event.setting.name = NULL; - for (i = 0; i < G_N_ELEMENTS (settings_map) ; i++) - if (strcmp (settings_names + settings_map[i].xsettings_offset, name) == 0) + for (i = 0; i < GDK_SETTINGS_N_ELEMENTS() ; i++) + if (strcmp (GDK_SETTINGS_X_NAME (i), name) == 0) { - new_event.setting.name = (char *)settings_names + settings_map[i].gdk_offset; + new_event.setting.name = (char*) GDK_SETTINGS_GDK_NAME (i); break; } @@ -2970,10 +2893,10 @@ gdk_screen_get_setting (GdkScreen *screen, screen_x11 = GDK_SCREEN_X11 (screen); - for (i = 0; i < G_N_ELEMENTS (settings_map) ; i++) - if (strcmp (settings_names + settings_map[i].gdk_offset, name) == 0) + for (i = 0; i < GDK_SETTINGS_N_ELEMENTS(); i++) + if (strcmp (GDK_SETTINGS_GDK_NAME (i), name) == 0) { - xsettings_name = settings_names + settings_map[i].xsettings_offset; + xsettings_name = GDK_SETTINGS_X_NAME (i); break; } diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c new file mode 100644 index 000000000..87bc2f44a --- /dev/null +++ b/gdk/x11/gdksettings.c @@ -0,0 +1,109 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + + +#define GDK_SETTINGS_N_ELEMENTS() G_N_ELEMENTS (gdk_settings_map) +#define GDK_SETTINGS_X_NAME(nth) (gdk_settings_names + gdk_settings_map[nth].xsettings_offset) +#define GDK_SETTINGS_GDK_NAME(nth) (gdk_settings_names + gdk_settings_map[nth].gdk_offset) + +static const char gdk_settings_names[] = + "Net/DoubleClickTime\0" "gtk-double-click-time\0" + "Net/DoubleClickDistance\0" "gtk-double-click-distance\0" + "Net/DndDragThreshold\0" "gtk-dnd-drag-threshold\0" + "Net/CursorBlink\0" "gtk-cursor-blink\0" + "Net/CursorBlinkTime\0" "gtk-cursor-blink-time\0" + "Net/ThemeName\0" "gtk-theme-name\0" + "Net/IconThemeName\0" "gtk-icon-theme-name\0" + "Gtk/CanChangeAccels\0" "gtk-can-change-accels\0" + "Gtk/ColorPalette\0" "gtk-color-palette\0" + "Gtk/FontName\0" "gtk-font-name\0" + "Gtk/IconSizes\0" "gtk-icon-sizes\0" + "Gtk/KeyThemeName\0" "gtk-key-theme-name\0" + "Gtk/ToolbarStyle\0" "gtk-toolbar-style\0" + "Gtk/ToolbarIconSize\0" "gtk-toolbar-icon-size\0" + "Gtk/IMPreeditStyle\0" "gtk-im-preedit-style\0" + "Gtk/IMStatusStyle\0" "gtk-im-status-style\0" + "Gtk/Modules\0" "gtk-modules\0" + "Gtk/FileChooserBackend\0" "gtk-file-chooser-backend\0" + "Gtk/ButtonImages\0" "gtk-button-images\0" + "Gtk/MenuImages\0" "gtk-menu-images\0" + "Gtk/MenuBarAccel\0" "gtk-menu-bar-accel\0" + "Gtk/CursorThemeName\0" "gtk-cursor-theme-name\0" + "Gtk/CursorThemeSize\0" "gtk-cursor-theme-size\0" + "Gtk/ShowInputMethodMenu\0" "gtk-show-input-method-menu\0" + "Gtk/ShowUnicodeMenu\0" "gtk-show-unicode-menu\0" + "Gtk/TimeoutInitial\0" "gtk-timeout-initial\0" + "Gtk/TimeoutRepeat\0" "gtk-timeout-repeat\0" + "Gtk/ColorScheme\0" "gtk-color-scheme\0" + "Gtk/EnableAnimations\0" "gtk-enable-animations\0" + "Xft/Antialias\0" "gtk-xft-antialias\0" + "Xft/Hinting\0" "gtk-xft-hinting\0" + "Xft/HintStyle\0" "gtk-xft-hintstyle\0" + "Xft/RGBA\0" "gtk-xft-rgba\0" + "Xft/DPI\0" "gtk-xft-dpi\0" + "Net/FallbackIconTheme\0" "gtk-fallback-icon-theme\0"; + +static const struct +{ + gint xsettings_offset; + gint gdk_offset; +} gdk_settings_map[] = { + { 0, 20 }, + { 42, 66 }, + { 92, 113 }, + { 136, 152 }, + { 169, 189 }, + { 211, 225 }, + { 240, 258 }, + { 278, 298 }, + { 320, 337 }, + { 355, 368 }, + { 382, 396 }, + { 411, 428 }, + { 447, 464 }, + { 482, 502 }, + { 524, 543 }, + { 564, 582 }, + { 602, 614 }, + { 626, 649 }, + { 674, 691 }, + { 709, 724 }, + { 740, 757 }, + { 776, 796 }, + { 818, 838 }, + { 860, 884 }, + { 911, 931 }, + { 953, 972 }, + { 992, 1010 }, + { 1029, 1045 }, + { 1062, 1083 }, + { 1105, 1119 }, + { 1137, 1149 }, + { 1165, 1179 }, + { 1197, 1206 }, + { 1219, 1227 }, + { 1239, 1261 } +};