summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-11-11 19:25:46 -0500
committerPatrick Griffis <tingping@tingping.se>2016-11-11 19:27:57 -0500
commit241dd69b081779a77718763561a779cdffcaf11f (patch)
treec9ee1ac451506f8b17efbf1b5b98cd97fe19aee5 /src/fe-gtk
parent539949973c484f14d40f1886d67ec09df057315c (diff)
Further tab color improvements
- Combine the three properties into a single one
- Finally fully fix the handling with plugins handling events

TODO: Look into lastact handling of these, seems wrong
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/fe-gtk.c10
-rw-r--r--src/fe-gtk/maingui.c44
2 files changed, 19 insertions, 35 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index ef9f3ab3..0f23f7f7 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -664,14 +664,10 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
 		return;
 
 	if (sess == current_tab)
-	{
-		sess->nick_said = FALSE;
-		sess->msg_said = FALSE;
-		sess->new_data = FALSE;
-	}
-	else if (sess->nick_said)
+		fe_set_tab_color (sess, 0);
+	else if (sess->tab_state & TAB_STATE_NEW_HILIGHT)
 		fe_set_tab_color (sess, 3);
-	else if (sess->msg_said)
+	else if (sess->tab_state & TAB_STATE_NEW_MSG)
 		fe_set_tab_color (sess, 2);
 	else
 		fe_set_tab_color (sess, 1);
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 572f30e4..20edf1ba 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -178,62 +178,50 @@ fe_set_tab_color (struct session *sess, int col)
 		switch (col)
 		{
 		case 0:	/* no particular color (theme default) */
-			sess->new_data = FALSE;
-			sess->msg_said = FALSE;
-			sess->nick_said = FALSE;
+			sess->tab_state = TAB_STATE_NONE;
 			chan_set_color (sess->res->tab, plain_list);
 			break;
 		case 1:	/* new data has been displayed (dark red) */
-			sess->new_data = TRUE;
-			sess->msg_said = FALSE;
-			sess->nick_said = FALSE;
+			sess->tab_state = TAB_STATE_NEW_DATA;
 			chan_set_color (sess->res->tab, newdata_list);
 
 			if (chan_is_collapsed (sess->res->tab)
-				&& !(server_sess->msg_said || server_sess->nick_said)
+				&& !((server_sess->tab_state & TAB_STATE_NEW_MSG)
+					 || (server_sess->tab_state & TAB_STATE_NEW_HILIGHT))
 				&& !(server_sess == current_tab))
 			{
-				server_sess->new_data = TRUE;
-				server_sess->msg_said = FALSE;
-				server_sess->nick_said = FALSE;
+				server_sess->tab_state = TAB_STATE_NEW_DATA;
 				chan_set_color (chan_get_parent (sess->res->tab), newdata_list);
 			}
-				
+
 			break;
 		case 2:	/* new message arrived in channel (light red) */
-			sess->new_data = FALSE;
-			sess->msg_said = TRUE;
-			sess->nick_said = FALSE;
+			sess->tab_state = TAB_STATE_NEW_MSG;
 			chan_set_color (sess->res->tab, newmsg_list);
-			
-			if (chan_is_collapsed (sess->res->tab) 
-				&& !server_sess->nick_said
+
+			if (chan_is_collapsed (sess->res->tab)
+				&& !(server_sess->tab_state & TAB_STATE_NEW_HILIGHT)
 				&& !(server_sess == current_tab))
 			{
-				server_sess->new_data = FALSE;
-				server_sess->msg_said = TRUE;
-				server_sess->nick_said = FALSE;
+				server_sess->tab_state = TAB_STATE_NEW_MSG;
 				chan_set_color (chan_get_parent (sess->res->tab), newmsg_list);
 			}
-			
+
 			break;
 		case 3:	/* your nick has been seen (blue) */
-			sess->new_data = FALSE;
-			sess->msg_said = FALSE;
-			sess->nick_said = TRUE;
+			sess->tab_state = TAB_STATE_NEW_HILIGHT;
 			chan_set_color (sess->res->tab, nickseen_list);
 
 			if (chan_is_collapsed (sess->res->tab) && !(server_sess == current_tab))
 			{
-				server_sess->new_data = FALSE;
-				server_sess->msg_said = FALSE;
-				server_sess->nick_said = TRUE;
+				server_sess->tab_state = TAB_STATE_NEW_MSG;
 				chan_set_color (chan_get_parent (sess->res->tab), nickseen_list);
 			}
-				
+
 			break;
 		}
 		lastact_update (sess);
+		sess->last_tab_state = sess->tab_state; /* For plugins handling future prints */
 	}
 }