[MPlayer-dev-eng] [PATCH] Fix bad key response on svgalib
Mikulas Patocka
mikulas at artax.karlin.mff.cuni.cz
Mon Aug 2 16:57:02 CEST 2004
Hi
Mplayer has a bug in responding to keyboard on svgalib. When you hold the
key (for example seeking arrow or brightness/contrast change) too long and
release it, not all key presses are processed. When you press another key,
the reminding keypresses of the previois key are processed.
The bug is caused by the fact that getch2 is called only when handle 0 is
readable. However, getch2 does its own internal buffering. So when getch2
buffer contains keypresses, but handle 0 is not readable, keypresses are
not processed and delayed until another key is pressed.
The patch fixes it so that getch2 is always called (it checks for
readability of handle 0 on its own).
It also fixes one possible overflow caused by a missing cast.
Mikulas
-------------- next part --------------
--- input/input.c_ 2004-06-30 02:04:43.000000000 +0100
+++ input/input.c 2004-06-30 02:25:50.000000000 +0100
@@ -656,7 +656,7 @@
unsigned int l;
l = 0;
while(l < sizeof(int)) {
- r = read(fd,(&code)+l,sizeof(int)-l);
+ r = read(fd,((char *)&code)+l,sizeof(int)-l);
if(r <= 0)
break;
l +=r;
@@ -902,7 +902,7 @@
}
#ifndef HAVE_NO_POSIX_SELECT
// No input from this fd
- if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds))
+ if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds) && key_fds[i].fd != 0)
continue;
#endif
if(key_fds[i].fd == 0) { // stdin is handled by getch2
More information about the MPlayer-dev-eng
mailing list