#include <curses.priv.h>
-MODULE_ID("$Id: lib_mouse.c,v 1.103 2008/11/23 00:11:46 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.104 2008/11/30 01:37:27 tom Exp $")
#include <term.h>
#include <tic.h>
#if USE_GPM_SUPPORT
case M_GPM:
- {
+ if (sp->_mouse_fd >= 0) {
/* query server for event, return TRUE if we find one */
Gpm_Event ev;
- if (my_Gpm_GetEvent(&ev) == 1) {
+ switch (my_Gpm_GetEvent(&ev)) {
+ case 0:
+ /* Connection closed, drop the mouse. */
+ sp->_mouse_fd = -1;
+ break;
+ case 1:
/* there's only one mouse... */
eventp->id = NORMAL_EVENT;
/* bump the next-free pointer into the circular list */
sp->_mouse_eventp = eventp = NEXT(eventp);
result = TRUE;
+ break;
}
}
break;