summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-04-13 23:03:54 -0400
committerTingPing <tingping@tingping.se>2013-04-13 23:03:54 -0400
commite67371d269eab88bb684a7c5d5e37190cdf805dd (patch)
tree2d6bdb0f31a8d74a5d6bbeebfb1d2009a4aaec6f
parenta99654957759e39c3272c1b4fa7c0deb5d85c4e6 (diff)
Add option for omitting alerts while focused
-rw-r--r--src/common/cfgfiles.c1
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/fe-gtk/fe-gtk.c2
-rw-r--r--src/fe-gtk/plugin-tray.c11
-rw-r--r--src/fe-gtk/setup.c2
5 files changed, 8 insertions, 9 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index ac9120e1..d3c2046d 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -426,6 +426,7 @@ const struct prefs vars[] =
 	{"gui_dialog_left", P_OFFINT (hex_gui_dialog_left), TYPE_INT},
 	{"gui_dialog_top", P_OFFINT (hex_gui_dialog_top), TYPE_INT},
 	{"gui_dialog_width", P_OFFINT (hex_gui_dialog_width), TYPE_INT},
+	{"gui_focus_omitalerts", P_OFFINT (hex_gui_focus_omitalerts), TYPE_BOOL},
 	{"gui_hide_menu", P_OFFINT (hex_gui_hide_menu), TYPE_BOOL},
 	{"gui_input_icon", P_OFFINT (hex_gui_input_icon), TYPE_BOOL},
 	{"gui_input_nick", P_OFFINT (hex_gui_input_nick), TYPE_BOOL},
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index 06bd3d4d..3291d93a 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -150,6 +150,7 @@ struct hexchatprefs
 	unsigned int hex_gui_autoopen_recv;
 	unsigned int hex_gui_autoopen_send;
 	unsigned int hex_gui_compact;
+	unsigned int hex_gui_focus_omitalerts;
 	unsigned int hex_gui_hide_menu;
 	unsigned int hex_gui_input_icon;
 	unsigned int hex_gui_input_nick;
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index d87ccd4e..52d4a906 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -669,7 +669,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp)
 void
 fe_beep (session *sess)
 {
-	if (fe_gui_info (sess, 0) != 1)
+	if (!prefs.hex_gui_focus_omitalerts || !fe_gui_info (sess, 0) == 1)
 		gdk_beep ();
 }
 
diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c
index 7ea975da..365e6117 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -167,7 +167,8 @@ fe_tray_set_balloon (const char *title, const char *text)
 
 	/* no balloons if the window is focused */
 	ws = tray_get_window_status ();
-	if (ws == WS_FOCUSED)
+	if ((prefs.hex_away_omit_alerts && hexchat_get_info(ph, "away")) ||
+		(prefs.hex_gui_focus_omitalerts && ws == WS_FOCUSED))
 		return;
 
 	/* bit 1 of flags means "no balloons unless hidden/iconified" */
@@ -693,9 +694,6 @@ tray_hilight_cb (char *word[], void *userdata)
 	/*if (tray_status == TS_HIGHLIGHT)
 		return HEXCHAT_EAT_NONE;*/
 
-	if (prefs.hex_away_omit_alerts && hexchat_get_info(ph, "away"))
-		return HEXCHAT_EAT_NONE;
-
 	if (prefs.hex_input_tray_hilight)
 	{
 		tray_set_flash (ICON_HILIGHT);
@@ -723,9 +721,6 @@ tray_message_cb (char *word[], void *userdata)
 	if (/*tray_status == TS_MESSAGE ||*/ tray_status == TS_HIGHLIGHT)
 		return HEXCHAT_EAT_NONE;
 		
-	if (prefs.hex_away_omit_alerts && hexchat_get_info(ph, "away"))
-		return HEXCHAT_EAT_NONE;
-		
 	if (prefs.hex_input_tray_chans)
 	{
 		tray_set_flash (ICON_MSG);
@@ -778,7 +773,7 @@ tray_priv_cb (char *word[], void *userdata)
 	/*if (tray_status == TS_HIGHLIGHT)
 		return HEXCHAT_EAT_NONE;*/
 
-	if (prefs.hex_input_tray_priv && (!prefs.hex_away_omit_alerts || !hexchat_get_info(ph, "away")))
+	if (prefs.hex_input_tray_priv)
 		tray_priv (word[1], word[2]);
 
 	return HEXCHAT_EAT_NONE;
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 66fa16b8..abf05d13 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -431,6 +431,7 @@ static const setting alert_settings[] =
 	{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
 
 	{ST_TOGGLE,	N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
+	{ST_TOGGLE,	N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
 
 	{ST_HEADER,	N_("Tray Behavior"), 0, 0, 0},
 #ifdef WIN32
@@ -466,6 +467,7 @@ static const setting alert_settings_unity[] =
 	{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
 
 	{ST_TOGGLE,	N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
+	{ST_TOGGLE,	N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
 
 	{ST_HEADER,	N_("Highlighted Messages"),0,0,0},
 	{ST_LABEL,	N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},