Bug#470882: /dev/gpmctl freezes acknowledge
Samuel Thibault
samuel.thibault at ens-lyon.org
Thu Nov 13 00:39:03 UTC 2008
clone 470882
retitle -1 pdmenu should check the value returned by Gpm_GetEvent()
reassign -1 pdmenu
thanks
Reading the documentation of Gpm_GetEvent:
« It returns 1 on success, -1 on failure, and 0 after closing the connection. »
pdmenu doesn't properly check that. It should. Patch attached.
Samuel
-------------- next part --------------
--- src/mouse.c.orig 2008-11-13 01:37:55.000000000 +0100
+++ src/mouse.c 2008-11-13 01:38:10.000000000 +0100
@@ -45,8 +45,11 @@
retval = select(gpm_fd+1, &rfds, NULL, NULL, &tv);
if (retval) { /* data available */
- if ((FD_ISSET(gpm_fd, &rfds)) && /* data is for mice */
- (Gpm_GetEvent(&event))) { /* can read something */
+ if (FD_ISSET(gpm_fd, &rfds)) {
+ /* data is for mice */
+ switch (Gpm_GetEvent(&event)) {
+ case 1:
+ /* can read something */
if ((event.type & GPM_DOWN) && (event.buttons & GPM_B_LEFT))
return(MOUSE_BUTTON_LEFT);
if ((event.type & GPM_DOWN) && (event.buttons & GPM_B_RIGHT))
@@ -55,6 +58,15 @@
return(MOUSE_DOWN);
if (event.dy < 0)
return(MOUSE_UP);
+ break;
+ case -1:
+ /* can read nothing */
+ break;
+ case 0:
+ /* disconnected */
+ gpm_ok = 0;
+ return(MOUSE_NOTHING);
+ } /* switch */
} else { /* data is for keyboard */
return(MOUSE_NOTHING);
} /* else */
More information about the pkg-gpm-devel
mailing list