[fpc-devel] Quick patch for bug 3762

Thomas Schatzl tom_at_work at gmx.at
Thu Mar 31 12:39:31 CEST 2005


Sterling Bates schrieb:
> In response to Tomas Hajny:
>  
> I'd certainly be willing to give it a try.  Granted, I only
 > have Windows XP, but if I'm careful it should be a smooth
 > transition.  No promises on a timeline :)
>  
> Another problem with Windows (not sure about other OSs) is in 
 > bug 2084.  (Use the second example in the description.)  I was

This is Windows specific.

> My initial attempt to get around this is to tie KeyPressed 
 > to EventHandleThread as well.
> [...]
>  
> It's possible to fix it by wrapping the contents of 
 > ReadKey in a critical section, but that, to me,
 > is just more overhead.  I think there's a more
 > elegant solution waiting to be discovered :-)
> 

Yes, a quick fix can be made by replacing the ReadConsoleInput() in 
winevent.pp by a PeekConsoleInput() call and crt works again.

Maybe this was even intended by the original developer since there is a 
"read, but don't remove the event" comment in front of the offending 
line (although it uses the ReadConsoleInput() call which actually 
removes the event).

Already sent this patch to a developer a two days ago (or so).

But may have undesirable side effects if no one else is eating the 
console events (not sure if this is actually possible, that means a 
problem, in console programs).
The IDE does not seem to mind though from a short try afair.

Seems like we are working on the same things atm =)

Regards,
   Thomas





More information about the fpc-devel mailing list