# HG changeset patch # User Mikael Berthe # Date 1298826927 -3600 # Node ID 3e39a336a992ee26f8be73b249d098898e27d5a6 # Parent 2256d0626730570d93a976c3f1441a6ed585d778 Use guards for colors (Myhailo Danylenko) Merge patch from isbear's mcabber-experimental repository. diff -r 2256d0626730 -r 3e39a336a992 mcabber/mcabber/screen.c --- a/mcabber/mcabber/screen.c Sun Feb 27 17:42:27 2011 +0100 +++ b/mcabber/mcabber/screen.c Sun Feb 27 18:15:27 2011 +0100 @@ -72,6 +72,7 @@ static unsigned short int Log_Win_Height; static unsigned short int Roster_Width; +static gboolean colors_stalled = FALSE; // Default attention sign trigger levels static guint ui_attn_sign_prio_level_muc = ROSTER_UI_PRIO_MUC_HL_MESSAGE; @@ -560,6 +561,8 @@ (*nickcols)->color_attrib = A_NORMAL; } } + + colors_stalled = FALSE; } static void init_keycodes(void) @@ -752,6 +755,13 @@ return Curses; } +static gchar *scr_color_guard(const gchar *key, const gchar *new_value) +{ + if (g_strcmp0(settings_opt_get(key), new_value)) + colors_stalled = TRUE; + return g_strdup(new_value); +} + void scr_init_curses(void) { /* Key sequences initialization */ @@ -779,6 +789,20 @@ parse_colors(); + settings_set_guard("color_background", scr_color_guard); + settings_set_guard("color_general", scr_color_guard); + settings_set_guard("color_info", scr_color_guard); + settings_set_guard("color_msgin", scr_color_guard); + settings_set_guard("color_msgout", scr_color_guard); + settings_set_guard("color_msghl", scr_color_guard); + settings_set_guard("color_bgstatus", scr_color_guard); + settings_set_guard("color_status", scr_color_guard); + settings_set_guard("color_roster", scr_color_guard); + settings_set_guard("color_bgrostersel", scr_color_guard); + settings_set_guard("color_rostersel", scr_color_guard); + settings_set_guard("color_rosterselmsg", scr_color_guard); + settings_set_guard("color_rosternewmsg", scr_color_guard); + getmaxyx(stdscr, maxY, maxX); Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; // Note scr_draw_main_window() should be called early after scr_init_curses() @@ -3970,6 +3994,8 @@ void scr_do_update(void) { + if (colors_stalled) + parse_colors(); doupdate(); }