Fix bar colors for some theme engines

Apply the patch proposed in bug 1889 by Brian J. Tarricone.
master
Florian Rivoal 2010-10-15 20:27:09 +09:00
parent 0f806d5a5a
commit 5454e32347
1 changed files with 18 additions and 35 deletions

View File

@ -257,7 +257,6 @@ static void run_update (t_global_monitor *global)
static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation orientation, static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation orientation,
t_global_monitor *global) t_global_monitor *global)
{ {
GtkRcStyle *rc;
gint i; gint i;
if (global->timeout_id) if (global->timeout_id)
@ -316,19 +315,16 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori
for (i = 0; i < SUM; i++) for (i = 0; i < SUM; i++)
{ {
rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); gtk_widget_modify_bg(GTK_WIDGET(global->monitor->status[i]),
if (!rc) GTK_STATE_PRELIGHT,
{ &global->monitor->options.color[i]);
rc = gtk_rc_style_new(); gtk_widget_modify_bg(GTK_WIDGET(global->monitor->status[i]),
} GTK_STATE_SELECTED,
else &global->monitor->options.color[i]);
{ gtk_widget_modify_base(GTK_WIDGET(global->monitor->status[i]),
rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; GTK_STATE_SELECTED,
rc->bg[GTK_STATE_PRELIGHT] = &global->monitor->options.color[i]);
global->monitor->options.color[i];
}
gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc);
gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); gtk_widget_show(GTK_WIDGET(global->monitor->status[i]));
gtk_box_pack_start(GTK_BOX(global->monitor->box), gtk_box_pack_start(GTK_BOX(global->monitor->box),
@ -413,7 +409,6 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin)
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */
static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) static void setup_monitor(t_global_monitor *global, gboolean supress_warnings)
{ {
GtkRcStyle *rc;
gint i; gint i;
gtk_widget_hide(GTK_WIDGET(global->monitor->box)); gtk_widget_hide(GTK_WIDGET(global->monitor->box));
@ -423,27 +418,15 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings)
for (i = 0; i < SUM; i++) for (i = 0; i < SUM; i++)
{ {
gtk_widget_hide(GTK_WIDGET(global->monitor->status[i])); gtk_widget_modify_bg(GTK_WIDGET(global->monitor->status[i]),
rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); GTK_STATE_PRELIGHT,
&global->monitor->options.color[i]);
if (!rc) { gtk_widget_modify_bg(GTK_WIDGET(global->monitor->status[i]),
rc = gtk_rc_style_new(); GTK_STATE_SELECTED,
} else { &global->monitor->options.color[i]);
/* to free the style safely in any case */ gtk_widget_modify_base(GTK_WIDGET(global->monitor->status[i]),
gtk_rc_style_ref(rc); GTK_STATE_SELECTED,
} &global->monitor->options.color[i]);
if (rc) {
rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG;
rc->color_flags[GTK_STATE_SELECTED] |= GTK_RC_BASE;
rc->bg[GTK_STATE_PRELIGHT] = global->monitor->options.color[i];
rc->base[GTK_STATE_SELECTED] = global->monitor->options.color[i];
gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc);
gtk_rc_style_unref(rc);
}
gtk_widget_show(GTK_WIDGET(global->monitor->status[i]));
/* Maximum */ /* Maximum */
if( global->monitor->options.auto_max ) if( global->monitor->options.auto_max )