Add -NOOVERRIDE flag to GUI COLOR. (#2644)
This commit is contained in:
parent
aabe3438fa
commit
9039a5d75b
@ -69,7 +69,16 @@ int fe_input_add (int sok, int flags, void *func, void *data);
|
|||||||
void fe_input_remove (int tag);
|
void fe_input_remove (int tag);
|
||||||
void fe_idle_add (void *func, void *data);
|
void fe_idle_add (void *func, void *data);
|
||||||
void fe_set_topic (struct session *sess, char *topic, char *stripped_topic);
|
void fe_set_topic (struct session *sess, char *topic, char *stripped_topic);
|
||||||
void fe_set_tab_color (struct session *sess, int col);
|
typedef enum
|
||||||
|
{
|
||||||
|
FE_COLOR_NONE = 0,
|
||||||
|
FE_COLOR_NEW_DATA = 1,
|
||||||
|
FE_COLOR_NEW_MSG = 2,
|
||||||
|
FE_COLOR_NEW_HILIGHT = 3,
|
||||||
|
FE_COLOR_FLAG_NOOVERRIDE = 8,
|
||||||
|
} tabcolor;
|
||||||
|
#define FE_COLOR_ALLFLAGS (FE_COLOR_FLAG_NOOVERRIDE)
|
||||||
|
void fe_set_tab_color (struct session *sess, tabcolor col);
|
||||||
void fe_flash_window (struct session *sess);
|
void fe_flash_window (struct session *sess);
|
||||||
void fe_update_mode_buttons (struct session *sess, char mode, char sign);
|
void fe_update_mode_buttons (struct session *sess, char mode, char sign);
|
||||||
void fe_update_channel_key (struct session *sess);
|
void fe_update_channel_key (struct session *sess);
|
||||||
|
@ -2152,7 +2152,6 @@ cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
|||||||
{
|
{
|
||||||
case 0x058b836e: fe_ctrl_gui (sess, 8, 0); break; /* APPLY */
|
case 0x058b836e: fe_ctrl_gui (sess, 8, 0); break; /* APPLY */
|
||||||
case 0xac1eee45: fe_ctrl_gui (sess, 7, 2); break; /* ATTACH */
|
case 0xac1eee45: fe_ctrl_gui (sess, 7, 2); break; /* ATTACH */
|
||||||
case 0x05a72f63: fe_ctrl_gui (sess, 4, atoi (word[3])); break; /* COLOR */
|
|
||||||
case 0xb06a1793: fe_ctrl_gui (sess, 7, 1); break; /* DETACH */
|
case 0xb06a1793: fe_ctrl_gui (sess, 7, 1); break; /* DETACH */
|
||||||
case 0x05cfeff0: fe_ctrl_gui (sess, 3, 0); break; /* FLASH */
|
case 0x05cfeff0: fe_ctrl_gui (sess, 3, 0); break; /* FLASH */
|
||||||
case 0x05d154d8: fe_ctrl_gui (sess, 2, 0); break; /* FOCUS */
|
case 0x05d154d8: fe_ctrl_gui (sess, 2, 0); break; /* FOCUS */
|
||||||
@ -2166,6 +2165,12 @@ cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
|||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
case 0x05a72f63: /* COLOR */
|
||||||
|
if (!g_ascii_strcasecmp (word[4], "-NOOVERRIDE"))
|
||||||
|
fe_ctrl_gui (sess, 4, FE_COLOR_FLAG_NOOVERRIDE | atoi (word[3]));
|
||||||
|
else
|
||||||
|
fe_ctrl_gui (sess, 4, atoi (word[3]));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -4015,8 +4020,9 @@ const struct commands xc_cmds[] = {
|
|||||||
{"GETINT", cmd_getint, 0, 0, 1, "GETINT <default> <command> <prompt>"},
|
{"GETINT", cmd_getint, 0, 0, 1, "GETINT <default> <command> <prompt>"},
|
||||||
{"GETSTR", cmd_getstr, 0, 0, 1, "GETSTR <default> <command> <prompt>"},
|
{"GETSTR", cmd_getstr, 0, 0, 1, "GETSTR <default> <command> <prompt>"},
|
||||||
{"GHOST", cmd_ghost, 1, 0, 1, N_("GHOST <nick> [password], Kills a ghosted nickname")},
|
{"GHOST", cmd_ghost, 1, 0, 1, N_("GHOST <nick> [password], Kills a ghosted nickname")},
|
||||||
{"GUI", cmd_gui, 0, 0, 1, "GUI [APPLY|ATTACH|DETACH|SHOW|HIDE|FOCUS|FLASH|ICONIFY|COLOR <n>]\n"
|
{"GUI", cmd_gui, 0, 0, 1, "GUI [APPLY|ATTACH|DETACH|SHOW|HIDE|FOCUS|FLASH|ICONIFY]\n"
|
||||||
" GUI [MSGBOX <text>|MENU TOGGLE]"},
|
" GUI [MSGBOX <text>|MENU TOGGLE]\n"
|
||||||
|
" GUI COLOR <n> [-NOOVERRIDE]"},
|
||||||
{"HELP", cmd_help, 0, 0, 1, 0},
|
{"HELP", cmd_help, 0, 0, 1, 0},
|
||||||
{"HOP", cmd_hop, 1, 1, 1,
|
{"HOP", cmd_hop, 1, 1, 1,
|
||||||
N_("HOP <nick>, gives chanhalf-op status to the nick (needs chanop)")},
|
N_("HOP <nick>, gives chanhalf-op status to the nick (needs chanop)")},
|
||||||
|
@ -664,13 +664,13 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (sess == current_tab)
|
if (sess == current_tab)
|
||||||
fe_set_tab_color (sess, 0);
|
fe_set_tab_color (sess, FE_COLOR_NONE);
|
||||||
else if (sess->tab_state & TAB_STATE_NEW_HILIGHT)
|
else if (sess->tab_state & TAB_STATE_NEW_HILIGHT)
|
||||||
fe_set_tab_color (sess, 3);
|
fe_set_tab_color (sess, FE_COLOR_NEW_HILIGHT);
|
||||||
else if (sess->tab_state & TAB_STATE_NEW_MSG)
|
else if (sess->tab_state & TAB_STATE_NEW_MSG)
|
||||||
fe_set_tab_color (sess, 2);
|
fe_set_tab_color (sess, FE_COLOR_NEW_MSG);
|
||||||
else
|
else
|
||||||
fe_set_tab_color (sess, 1);
|
fe_set_tab_color (sess, FE_COLOR_NEW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -175,20 +175,26 @@ fe_flash_window (session *sess)
|
|||||||
/* set a tab plain, red, light-red, or blue */
|
/* set a tab plain, red, light-red, or blue */
|
||||||
|
|
||||||
void
|
void
|
||||||
fe_set_tab_color (struct session *sess, int col)
|
fe_set_tab_color (struct session *sess, tabcolor col)
|
||||||
{
|
{
|
||||||
struct session *server_sess = sess->server->server_session;
|
struct session *server_sess = sess->server->server_session;
|
||||||
|
int col_noflags = (col & ~FE_COLOR_ALLFLAGS);
|
||||||
|
int col_shouldoverride = !(col & FE_COLOR_FLAG_NOOVERRIDE);
|
||||||
|
|
||||||
if (sess->res->tab && sess->gui->is_tab && (col == 0 || sess != current_tab))
|
if (sess->res->tab && sess->gui->is_tab && (col == 0 || sess != current_tab))
|
||||||
{
|
{
|
||||||
switch (col)
|
switch (col_noflags)
|
||||||
{
|
{
|
||||||
case 0: /* no particular color (theme default) */
|
case 0: /* no particular color (theme default) */
|
||||||
sess->tab_state = TAB_STATE_NONE;
|
sess->tab_state = TAB_STATE_NONE;
|
||||||
chan_set_color (sess->res->tab, plain_list);
|
chan_set_color (sess->res->tab, plain_list);
|
||||||
break;
|
break;
|
||||||
case 1: /* new data has been displayed (dark red) */
|
case 1: /* new data has been displayed (dark red) */
|
||||||
sess->tab_state = TAB_STATE_NEW_DATA;
|
if (col_shouldoverride || !((sess->tab_state & TAB_STATE_NEW_MSG)
|
||||||
chan_set_color (sess->res->tab, newdata_list);
|
|| (sess->tab_state & TAB_STATE_NEW_HILIGHT))) {
|
||||||
|
sess->tab_state = TAB_STATE_NEW_DATA;
|
||||||
|
chan_set_color (sess->res->tab, newdata_list);
|
||||||
|
}
|
||||||
|
|
||||||
if (chan_is_collapsed (sess->res->tab)
|
if (chan_is_collapsed (sess->res->tab)
|
||||||
&& !((server_sess->tab_state & TAB_STATE_NEW_MSG)
|
&& !((server_sess->tab_state & TAB_STATE_NEW_MSG)
|
||||||
@ -201,8 +207,10 @@ fe_set_tab_color (struct session *sess, int col)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 2: /* new message arrived in channel (light red) */
|
case 2: /* new message arrived in channel (light red) */
|
||||||
sess->tab_state = TAB_STATE_NEW_MSG;
|
if (col_shouldoverride || !(sess->tab_state & TAB_STATE_NEW_HILIGHT)) {
|
||||||
chan_set_color (sess->res->tab, newmsg_list);
|
sess->tab_state = TAB_STATE_NEW_MSG;
|
||||||
|
chan_set_color (sess->res->tab, newmsg_list);
|
||||||
|
}
|
||||||
|
|
||||||
if (chan_is_collapsed (sess->res->tab)
|
if (chan_is_collapsed (sess->res->tab)
|
||||||
&& !(server_sess->tab_state & TAB_STATE_NEW_HILIGHT)
|
&& !(server_sess->tab_state & TAB_STATE_NEW_HILIGHT)
|
||||||
@ -540,7 +548,7 @@ mg_focus (session *sess)
|
|||||||
/* when called via mg_changui_new, is_tab might be true, but
|
/* when called via mg_changui_new, is_tab might be true, but
|
||||||
sess->res->tab is still NULL. */
|
sess->res->tab is still NULL. */
|
||||||
if (sess->res->tab)
|
if (sess->res->tab)
|
||||||
fe_set_tab_color (sess, 0);
|
fe_set_tab_color (sess, FE_COLOR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -623,7 +623,7 @@ fe_cleanup (void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
fe_set_tab_color (struct session *sess, int col)
|
fe_set_tab_color (struct session *sess, tabcolor col)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user