limit tray icon blinking time (to save CPU/GPU power)

Development of XChat itself. Talk about code, patches and other technical stuff. No feature requests!
Formal bug reports should go to http://xchat.org/cvs/#bugs instead.
This forum is for developers writing xchat code, not end-user questions.

limit tray icon blinking time (to save CPU/GPU power)

Postby agapon » 21 Jun 2012 10:23

I would like to propose the following patch for 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.

Code: Select all
--- 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;
 }
 

agapon
 
Posts: 1
Joined: 21 Jun 2012 10:05

Re: limit tray icon blinking time (to save CPU/GPU power)

Postby nob0dy » 25 Jun 2012 12:22

interesting, i wasnt aware it significantly increases load though
nob0dy
 
Posts: 193
Joined: 06 Nov 2005 14:29


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest