When Emulate3Button is active, do not set select() timeout in states when

it is not needed. No need to kick CPU every 20ms without a purpose.

Reviewed by:	philip@
This commit is contained in:
Alexander Motin 2010-06-15 19:19:04 +00:00
parent 42040ff081
commit ce304e0820

View File

@ -1090,7 +1090,8 @@ moused(void)
FD_SET(rodent.mremcfd, &fds);
c = select(FD_SETSIZE, &fds, NULL, NULL,
(rodent.flags & Emulate3Button) ? &timeout : NULL);
((rodent.flags & Emulate3Button) &&
S_DELAYED(mouse_button_state)) ? &timeout : NULL);
if (c < 0) { /* error */
logwarn("failed to read from mouse");
continue;