+static void set_theme_bg_color()
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkRGBA bg_color;
+ GdkColor theme_color;
+ GtkStyleContext *style_context;
+ GList *work;
+ LayoutWindow *lw;
+
+ if (!options->image.use_custom_border_color)
+ {
+ work = layout_window_list;
+ lw = work->data;
+
+ style_context = gtk_widget_get_style_context(lw->window);
+ gtk_style_context_get_background_color(style_context, GTK_STATE_FLAG_NORMAL, &bg_color);
+
+ theme_color.red = bg_color.red * 65535;
+ theme_color.green = bg_color.green * 65535;
+ theme_color.blue = bg_color.blue * 65535;
+
+ while (work)
+ {
+ lw = work->data;
+ image_background_set_color(lw->image, &theme_color);
+ work = work->next;
+ }
+ }
+
+ view_window_colors_update();
+#endif
+}
+
+static gboolean theme_change_cb(GObject *gobject, GParamSpec *pspec, gpointer data)
+{
+ set_theme_bg_color();
+
+ return FALSE;
+}
+