+/* Return non-zero if DPYINFO is still valid. */
+static int
+dpyinfo_valid (struct x_display_info *dpyinfo)
+{
+ int found = 0;
+ if (dpyinfo != NULL)
+ {
+ struct x_display_info *d;
+ for (d = x_display_list; !found && d; d = d->next)
+ found = d == dpyinfo && d->display == dpyinfo->display;
+ }
+ return found;
+}
+
+/* Store a monospace font change event if the monospaced font changed. */
+
+#if defined HAVE_XFT && (defined HAVE_GSETTINGS || defined HAVE_GCONF)
+static void
+store_monospaced_changed (const char *newfont)
+{
+ if (current_mono_font != NULL && strcmp (newfont, current_mono_font) == 0)
+ return; /* No change. */
+
+ xfree (current_mono_font);
+ current_mono_font = xstrdup (newfont);
+
+ if (dpyinfo_valid (first_dpyinfo) && use_system_font)
+ {
+ store_config_changed_event (Qmonospace_font_name,
+ XCAR (first_dpyinfo->name_list_element));
+ }
+}
+#endif
+
+/* Store a font name change event if the font name changed. */
+
+#ifdef HAVE_XFT
+static void
+store_font_name_changed (const char *newfont)
+{
+ if (current_font != NULL && strcmp (newfont, current_font) == 0)
+ return; /* No change. */
+
+ xfree (current_font);
+ current_font = xstrdup (newfont);
+
+ if (dpyinfo_valid (first_dpyinfo))
+ {
+ store_config_changed_event (Qfont_name,
+ XCAR (first_dpyinfo->name_list_element));
+ }
+}
+#endif /* HAVE_XFT */
+
+/* Map TOOL_BAR_STYLE from a string to its corresponding Lisp value.
+ Return Qnil if TOOL_BAR_STYLE is not known. */
+
+static Lisp_Object
+map_tool_bar_style (const char *tool_bar_style)
+{
+ Lisp_Object style = Qnil;
+ if (tool_bar_style)
+ {
+ if (strcmp (tool_bar_style, "both") == 0)
+ style = Qboth;
+ else if (strcmp (tool_bar_style, "both-horiz") == 0)
+ style = Qboth_horiz;
+ else if (strcmp (tool_bar_style, "icons") == 0)
+ style = Qimage;
+ else if (strcmp (tool_bar_style, "text") == 0)
+ style = Qtext;
+ }
+
+ return style;
+}
+
+/* Store a tool bar style change event if the tool bar style changed. */
+
+static void
+store_tool_bar_style_changed (const char *newstyle,
+ struct x_display_info *dpyinfo)
+{
+ Lisp_Object style = map_tool_bar_style (newstyle);
+ if (EQ (current_tool_bar_style, style))
+ return; /* No change. */
+
+ current_tool_bar_style = style;
+ if (dpyinfo_valid (dpyinfo))
+ store_config_changed_event (Qtool_bar_style,
+ XCAR (dpyinfo->name_list_element));
+}
+
+