mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:43:02 +01:00
fix bug where tab alert colours weren't being properly prioritized
This commit is contained in:
parent
bb85f31bb2
commit
e75cf4f3ad
24
src/notify.c
24
src/notify.c
@ -443,10 +443,10 @@ void m_notify_action(NotifyNotification *box, char *action, void* data)
|
||||
int sound_notify(ToxWindow* self, Notification notif, uint64_t flags, int* id_indicator)
|
||||
{
|
||||
/* Consider colored notify as primary */
|
||||
if (self && self->alert == WINDOW_ALERT_NONE) {
|
||||
if (self) {
|
||||
if (flags & NT_WNDALERT_0) self->alert = WINDOW_ALERT_0;
|
||||
else if (flags & NT_WNDALERT_1) self->alert = WINDOW_ALERT_1;
|
||||
else if (flags & NT_WNDALERT_2) self->alert = WINDOW_ALERT_2;
|
||||
else if ( (flags & NT_WNDALERT_1) && (!self->alert || self->alert > WINDOW_ALERT_0) ) self->alert = WINDOW_ALERT_1;
|
||||
else if ( (flags & NT_WNDALERT_2) && (!self->alert || self->alert > WINDOW_ALERT_1) ) self->alert = WINDOW_ALERT_2;
|
||||
}
|
||||
|
||||
if ((flags & NT_RESTOL && Control.cooldown > time(NULL)) ||
|
||||
@ -487,10 +487,10 @@ int sound_notify(ToxWindow* self, Notification notif, uint64_t flags, int* id_in
|
||||
int sound_notify2(ToxWindow* self, Notification notif, uint64_t flags, int id)
|
||||
{
|
||||
/* Consider colored notify as primary */
|
||||
if (self && self->alert == WINDOW_ALERT_NONE) {
|
||||
if (self) {
|
||||
if (flags & NT_WNDALERT_0) self->alert = WINDOW_ALERT_0;
|
||||
else if (flags & NT_WNDALERT_1) self->alert = WINDOW_ALERT_1;
|
||||
else if (flags & NT_WNDALERT_2) self->alert = WINDOW_ALERT_2;
|
||||
else if ( (flags & NT_WNDALERT_1) && (!self->alert || self->alert > WINDOW_ALERT_0) ) self->alert = WINDOW_ALERT_1;
|
||||
else if ( (flags & NT_WNDALERT_2) && (!self->alert || self->alert > WINDOW_ALERT_1) ) self->alert = WINDOW_ALERT_2;
|
||||
}
|
||||
|
||||
if ((flags & NT_RESTOL && Control.cooldown > time(NULL)) ||
|
||||
@ -636,10 +636,10 @@ int box_notify2(ToxWindow* self, Notification notif, uint64_t flags, int id, con
|
||||
int box_silent_notify(ToxWindow* self, uint64_t flags, int* id_indicator, const char* title, const char* format, ...)
|
||||
{
|
||||
/* Always do colored notify */
|
||||
if (self && self->alert == WINDOW_ALERT_NONE) {
|
||||
if (self) {
|
||||
if (flags & NT_WNDALERT_0) self->alert = WINDOW_ALERT_0;
|
||||
else if (flags & NT_WNDALERT_1) self->alert = WINDOW_ALERT_1;
|
||||
else if (flags & NT_WNDALERT_2) self->alert = WINDOW_ALERT_2;
|
||||
else if ( (flags & NT_WNDALERT_1) && (!self->alert || self->alert > WINDOW_ALERT_0) ) self->alert = WINDOW_ALERT_1;
|
||||
else if ( (flags & NT_WNDALERT_2) && (!self->alert || self->alert > WINDOW_ALERT_1) ) self->alert = WINDOW_ALERT_2;
|
||||
}
|
||||
|
||||
if ((flags & NT_RESTOL && Control.cooldown > time(NULL)) ||
|
||||
@ -692,10 +692,10 @@ int box_silent_notify(ToxWindow* self, uint64_t flags, int* id_indicator, const
|
||||
int box_silent_notify2(ToxWindow* self, uint64_t flags, int id, const char* format, ...)
|
||||
{
|
||||
/* Always do colored notify */
|
||||
if (self && self->alert == WINDOW_ALERT_NONE) {
|
||||
if (self) {
|
||||
if (flags & NT_WNDALERT_0) self->alert = WINDOW_ALERT_0;
|
||||
else if (flags & NT_WNDALERT_1) self->alert = WINDOW_ALERT_1;
|
||||
else if (flags & NT_WNDALERT_2) self->alert = WINDOW_ALERT_2;
|
||||
else if ( (flags & NT_WNDALERT_1) && (!self->alert || self->alert > WINDOW_ALERT_0) ) self->alert = WINDOW_ALERT_1;
|
||||
else if ( (flags & NT_WNDALERT_2) && (!self->alert || self->alert > WINDOW_ALERT_1) ) self->alert = WINDOW_ALERT_2;
|
||||
}
|
||||
|
||||
if ((flags & NT_RESTOL && Control.cooldown > time(NULL)) ||
|
||||
|
@ -368,13 +368,12 @@ void on_window_resize(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_window_tab(ToxWindow toxwin)
|
||||
static void draw_window_tab(ToxWindow *toxwin)
|
||||
{
|
||||
if (toxwin.alert) attron(COLOR_PAIR(toxwin.alert));
|
||||
if (toxwin->alert != WINDOW_ALERT_NONE) attron(COLOR_PAIR(toxwin->alert));
|
||||
clrtoeol();
|
||||
printw(" [%s]", toxwin.name);
|
||||
|
||||
if (toxwin.alert) attroff(COLOR_PAIR(toxwin.alert));
|
||||
printw(" [%s]", toxwin->name);
|
||||
if (toxwin->alert != WINDOW_ALERT_NONE) attroff(COLOR_PAIR(toxwin->alert));
|
||||
}
|
||||
|
||||
static void draw_bar(void)
|
||||
@ -404,7 +403,7 @@ static void draw_bar(void)
|
||||
|
||||
attron(A_BOLD);
|
||||
|
||||
draw_window_tab(windows[i]);
|
||||
draw_window_tab(&windows[i]);
|
||||
|
||||
if (windows + i == active_window)
|
||||
|
||||
|
@ -52,7 +52,7 @@ enum {
|
||||
BLACK,
|
||||
} C_COLOURS;
|
||||
|
||||
/* tab alert types: lower types take priority */
|
||||
/* tab alert types: lower types take priority (this relies on the order of C_COLOURS) */
|
||||
typedef enum {
|
||||
WINDOW_ALERT_NONE = 0,
|
||||
WINDOW_ALERT_0 = GREEN,
|
||||
|
Loading…
Reference in New Issue
Block a user