+ * Manage window caption / taskbar flashing, if enabled.
+ * 0 = stop, 1 = maintain, 2 = start
+ */
+static void flash_window(int mode)
+{
+ static long last_flash = 0;
+ static int flashing = 0;
+ if ((mode == 0) || (cfg.beep_ind == B_IND_DISABLED)) {
+ /* stop */
+ if (flashing) {
+ FlashWindow(hwnd, FALSE);
+ flashing = 0;
+ }
+
+ } else if (mode == 2) {
+ /* start */
+ if (!flashing) {
+ last_flash = GetTickCount();
+ flashing = 1;
+ FlashWindow(hwnd, TRUE);
+ }
+
+ } else if ((mode == 1) && (cfg.beep_ind == B_IND_FLASH)) {
+ /* maintain */
+ if (flashing) {
+ long now = GetTickCount();
+ long fdiff = now - last_flash;
+ if (fdiff < 0 || fdiff > 450) {
+ last_flash = now;
+ FlashWindow(hwnd, TRUE); /* toggle */
+ }
+ }
+ }
+}
+
+/*