Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jun 2012 23:23:56 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        gnome@FreeBSD.org
Subject:   irc/xchat: limit icon blinking time
Message-ID:  <4FE2315C.50706@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

I would like to propose the following patch for irc/xchat.
It should limit the time that xchat tray icon blinks/flashes upon a configured
event.  It seems that such blinking puts non-negligible load on a system (via X
server).  At the end of blinking the icon should freeze in "alerted" state.

--- src/fe-gtk/plugin-tray.c.orig	2012-06-20 08:17:03.960745335 +0300
+++ src/fe-gtk/plugin-tray.c	2012-06-20 08:50:21.961136476 +0300
@@ -42,9 +42,11 @@ typedef GdkPixbuf* TrayIcon;
 #define ICON_HILIGHT pix_tray_hilight
 #define ICON_FILE pix_tray_file
 #define TIMEOUT 500
+#define FLASH_COUNT 252

 static GtkStatusIcon *sticon;
 static gint flash_tag;
+static gint flash_count;
 static TrayStatus tray_status;
 static xchat_plugin *ph;

@@ -317,6 +319,7 @@ tray_stop_flash (void)
 	}

 	tray_status = TS_NONE;
+	flash_count = 0;
 }

 static void
@@ -352,6 +355,11 @@ tray_timeout_cb (TrayIcon icon)
 		else
 			gtk_status_icon_set_from_pixbuf (sticon, ICON_NORMAL);
 	}
+
+	flash_count++;
+	if (flash_count == FLASH_COUNT)
+		return 0;
+
 	return 1;
 }


-- 
Andriy Gapon




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FE2315C.50706>