* key.c (get_event): Treat all negative values of gpm_fd in the

same way.  Add one more check that gpm is alive.
This commit is contained in:
Dmitry Alexeyev 2003-12-24 07:21:34 +00:00
parent 81fec8e3ba
commit 6147cf303e
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2003-12-24 Dmitry Alexeyev <dmi_a@qnx.org.ru>
* key.c (get_event): Treat all negative values of gpm_fd in the
same way. Add one more check that gpm is alive.
2003-12-24 Pavel Roskin <proski@gnu.org> 2003-12-24 Pavel Roskin <proski@gnu.org>
* layout.c (rotate_dash): Set color before printing the dash. * layout.c (rotate_dash): Set color before printing the dash.

View File

@ -897,7 +897,7 @@ static int getch_with_delay (void)
/* Returns EV_MOUSE if it is a mouse event */ /* Returns EV_MOUSE if it is a mouse event */
/* Returns EV_NONE if non-blocking or interrupt set and nothing was done */ /* Returns EV_NONE if non-blocking or interrupt set and nothing was done */
int int
get_event (struct Gpm_Event * event, int redo_event, int block) get_event (struct Gpm_Event *event, int redo_event, int block)
{ {
int c; int c;
static int flag; /* Return value from select */ static int flag; /* Return value from select */
@ -938,14 +938,15 @@ get_event (struct Gpm_Event * event, int redo_event, int block)
#ifdef HAVE_LIBGPM #ifdef HAVE_LIBGPM
if (use_mouse_p == MOUSE_GPM) { if (use_mouse_p == MOUSE_GPM) {
if (gpm_fd == -1) { if (gpm_fd < 0) {
/* Connection to gpm broken, possibly gpm has died */ /* Connection to gpm broken, possibly gpm has died */
mouse_enabled = 0; mouse_enabled = 0;
use_mouse_p = MOUSE_NONE; use_mouse_p = MOUSE_NONE;
break; break;
} else {
FD_SET (gpm_fd, &select_set);
maxfdp = max (maxfdp, gpm_fd);
} }
FD_SET (gpm_fd, &select_set);
maxfdp = max (maxfdp, gpm_fd);
} }
#endif #endif
@ -999,7 +1000,8 @@ get_event (struct Gpm_Event * event, int redo_event, int block)
if (FD_ISSET (input_fd, &select_set)) if (FD_ISSET (input_fd, &select_set))
break; break;
#ifdef HAVE_LIBGPM #ifdef HAVE_LIBGPM
if (use_mouse_p == MOUSE_GPM && FD_ISSET (gpm_fd, &select_set)) { if (use_mouse_p == MOUSE_GPM && gpm_fd > 0
&& FD_ISSET (gpm_fd, &select_set)) {
Gpm_GetEvent (&ev); Gpm_GetEvent (&ev);
Gpm_FitEvent (&ev); Gpm_FitEvent (&ev);
*event = ev; *event = ev;
@ -1166,7 +1168,7 @@ is_idle (void)
FD_SET (input_fd, &select_set); FD_SET (input_fd, &select_set);
maxfdp = input_fd; maxfdp = input_fd;
#ifdef HAVE_LIBGPM #ifdef HAVE_LIBGPM
if (use_mouse_p == MOUSE_GPM && mouse_enabled && gpm_fd != -1) { if (use_mouse_p == MOUSE_GPM && mouse_enabled && gpm_fd > 0) {
FD_SET (gpm_fd, &select_set); FD_SET (gpm_fd, &select_set);
maxfdp = max (maxfdp, gpm_fd); maxfdp = max (maxfdp, gpm_fd);
} }