bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Texinfo Windows patch: Fix the visual bell on MS-Windows


From: Eli Zaretskii
Subject: Re: Texinfo Windows patch: Fix the visual bell on MS-Windows
Date: Thu, 25 Dec 2014 17:56:15 +0200

> Date: Fri, 07 Nov 2014 17:55:36 +1000
> From: Jason Hood <address@hidden>
> 
> * improves the visual bell;

This patch, which I reproduce below rebased to the current trunk,
corrects a real bug with the visual bell implementation in the current
code, and I recommend to commit it:

--- info/pcterm.c~0     2014-12-23 21:51:59 +0200
+++ info/pcterm.c       2014-12-24 16:11:06 +0200
@@ -249,11 +264,20 @@ ScreenVisualBell (void)
   DWORD nchars = screenwidth * screenheight;
   COORD start_pos;
   DWORD written;
+  PWORD attr;
+  DWORD i;
 
   start_pos.X = start_pos.Y = 0;
-  FillConsoleOutputAttribute (hscreen, inv_attr, nchars, start_pos, &written);
-  Sleep (20);
-  FillConsoleOutputAttribute (hscreen, norm_attr, nchars, start_pos, &written);
+  attr = xmalloc (nchars * sizeof (WORD));
+  ReadConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written);
+  for (i = 0; i < nchars; ++i)
+    attr[i] ^= norm_attr ^ inv_attr;
+  WriteConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written);
+  Sleep (50);
+  for (i = 0; i < nchars; ++i)
+    attr[i] ^= norm_attr ^ inv_attr;
+  WriteConsoleOutputAttribute (hscreen, attr, nchars, start_pos, &written);
+  free (attr);
 }
 
 int





reply via email to

[Prev in Thread] Current Thread [Next in Thread]