mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Don't trigger activity on hidden lines by default
This is controlled by a new activity_hide_window_hidelevel setting.
This commit is contained in:
parent
7f14d4d744
commit
01f961cdf1
@ -286,6 +286,7 @@ themes.c:
|
|||||||
|
|
||||||
window-activity.c:
|
window-activity.c:
|
||||||
"window hilight", WINDOW_REC
|
"window hilight", WINDOW_REC
|
||||||
|
"window hilight check", TEXT_DEST_REC, char *msg, int *data_level, int *should_ignore
|
||||||
"window dehilight", WINDOW_REC
|
"window dehilight", WINDOW_REC
|
||||||
"window activity", WINDOW_REC, int old_level
|
"window activity", WINDOW_REC, int old_level
|
||||||
"window item hilight", WI_ITEM_REC
|
"window item hilight", WI_ITEM_REC
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "fe-common-core.h"
|
#include "fe-common-core.h"
|
||||||
|
|
||||||
static char **hide_targets;
|
static char **hide_targets;
|
||||||
static int hide_level, msg_level, hilight_level;
|
static int hide_level, msg_level, hilight_level, signal_window_hilight_check;
|
||||||
|
|
||||||
void window_activity(WINDOW_REC *window, int data_level,
|
void window_activity(WINDOW_REC *window, int data_level,
|
||||||
const char *hilight_color)
|
const char *hilight_color)
|
||||||
@ -74,6 +74,7 @@ static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
|
|||||||
{
|
{
|
||||||
WI_ITEM_REC *item;
|
WI_ITEM_REC *item;
|
||||||
int data_level;
|
int data_level;
|
||||||
|
int cb_ignore = 0;
|
||||||
|
|
||||||
if (dest->window == active_win || (dest->level & hide_level))
|
if (dest->window == active_win || (dest->level & hide_level))
|
||||||
return;
|
return;
|
||||||
@ -91,6 +92,12 @@ static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we should ask the text view if this line is hidden */
|
||||||
|
signal_emit_id(signal_window_hilight_check, 5, dest, msg, &data_level, &cb_ignore);
|
||||||
|
if (cb_ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dest->target != NULL) {
|
if (dest->target != NULL) {
|
||||||
item = window_item_find(dest->server, dest->target);
|
item = window_item_find(dest->server, dest->target);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
@ -125,7 +132,7 @@ static void read_settings(void)
|
|||||||
hide_targets = *targets == '\0' ? NULL :
|
hide_targets = *targets == '\0' ? NULL :
|
||||||
g_strsplit(targets, " ", -1);
|
g_strsplit(targets, " ", -1);
|
||||||
|
|
||||||
hide_level = MSGLEVEL_NEVER | MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN |
|
hide_level = MSGLEVEL_NEVER | MSGLEVEL_NO_ACT |
|
||||||
settings_get_level("activity_hide_level");
|
settings_get_level("activity_hide_level");
|
||||||
msg_level = settings_get_level("activity_msg_level");
|
msg_level = settings_get_level("activity_msg_level");
|
||||||
hilight_level = MSGLEVEL_HILIGHT |
|
hilight_level = MSGLEVEL_HILIGHT |
|
||||||
@ -138,6 +145,7 @@ void window_activity_init(void)
|
|||||||
settings_add_level("lookandfeel", "activity_hide_level", "");
|
settings_add_level("lookandfeel", "activity_hide_level", "");
|
||||||
settings_add_level("lookandfeel", "activity_msg_level", "PUBLIC");
|
settings_add_level("lookandfeel", "activity_msg_level", "PUBLIC");
|
||||||
settings_add_level("lookandfeel", "activity_hilight_level", "MSGS DCCMSGS");
|
settings_add_level("lookandfeel", "activity_hilight_level", "MSGS DCCMSGS");
|
||||||
|
signal_window_hilight_check = signal_get_uniq_id("window hilight check");
|
||||||
|
|
||||||
read_settings();
|
read_settings();
|
||||||
signal_add("print text", (SIGNAL_FUNC) sig_hilight_text);
|
signal_add("print text", (SIGNAL_FUNC) sig_hilight_text);
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "printtext.h"
|
#include "printtext.h"
|
||||||
#include "gui-windows.h"
|
#include "gui-windows.h"
|
||||||
|
|
||||||
|
static int activity_hide_window_hidelevel;
|
||||||
|
|
||||||
/* SYNTAX: CLEAR [-all] [<refnum>] */
|
/* SYNTAX: CLEAR [-all] [<refnum>] */
|
||||||
static void cmd_clear(const char *data)
|
static void cmd_clear(const char *data)
|
||||||
{
|
{
|
||||||
@ -373,8 +375,32 @@ static void sig_away_changed(SERVER_REC *server)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sig_window_hilight_check(TEXT_DEST_REC *dest, char *msg, int *data_level, int *ignore)
|
||||||
|
{
|
||||||
|
GUI_WINDOW_REC *gui;
|
||||||
|
|
||||||
|
g_return_if_fail(dest != NULL);
|
||||||
|
g_return_if_fail(ignore != NULL);
|
||||||
|
|
||||||
|
if (*ignore != 0 || !activity_hide_window_hidelevel || dest->window == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gui = WINDOW_GUI(dest->window);
|
||||||
|
|
||||||
|
if (dest->level & gui->view->hidden_level) {
|
||||||
|
*ignore = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void read_settings(void)
|
||||||
|
{
|
||||||
|
activity_hide_window_hidelevel = settings_get_bool("activity_hide_window_hidelevel");
|
||||||
|
}
|
||||||
|
|
||||||
void textbuffer_commands_init(void)
|
void textbuffer_commands_init(void)
|
||||||
{
|
{
|
||||||
|
settings_add_bool("lookandfeel", "activity_hide_window_hidelevel", TRUE);
|
||||||
|
|
||||||
command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear);
|
command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear);
|
||||||
command_bind("window scroll", NULL, (SIGNAL_FUNC) cmd_window_scroll);
|
command_bind("window scroll", NULL, (SIGNAL_FUNC) cmd_window_scroll);
|
||||||
command_bind("window hidelevel", NULL, (SIGNAL_FUNC) cmd_window_hidelevel);
|
command_bind("window hidelevel", NULL, (SIGNAL_FUNC) cmd_window_hidelevel);
|
||||||
@ -390,7 +416,10 @@ void textbuffer_commands_init(void)
|
|||||||
command_set_options("scrollback clear", "all");
|
command_set_options("scrollback clear", "all");
|
||||||
command_set_options("scrollback levelclear", "all -level");
|
command_set_options("scrollback levelclear", "all -level");
|
||||||
|
|
||||||
|
read_settings();
|
||||||
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed);
|
signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed);
|
||||||
|
signal_add("window hilight check", (SIGNAL_FUNC) sig_window_hilight_check);
|
||||||
}
|
}
|
||||||
|
|
||||||
void textbuffer_commands_deinit(void)
|
void textbuffer_commands_deinit(void)
|
||||||
@ -406,5 +435,7 @@ void textbuffer_commands_deinit(void)
|
|||||||
command_unbind("scrollback end", (SIGNAL_FUNC) cmd_scrollback_end);
|
command_unbind("scrollback end", (SIGNAL_FUNC) cmd_scrollback_end);
|
||||||
command_unbind("scrollback status", (SIGNAL_FUNC) cmd_scrollback_status);
|
command_unbind("scrollback status", (SIGNAL_FUNC) cmd_scrollback_status);
|
||||||
|
|
||||||
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed);
|
signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed);
|
||||||
|
signal_remove("window hilight check", (SIGNAL_FUNC) sig_window_hilight_check);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user