diff src/event-Xt.c @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 538048ae2ab8
children 43dd3413c7c7
line wrap: on
line diff
--- a/src/event-Xt.c	Mon Aug 13 09:37:21 2007 +0200
+++ b/src/event-Xt.c	Mon Aug 13 09:38:25 2007 +0200
@@ -1729,6 +1729,9 @@
 {
   Lisp_Object console = Qnil;
   int infd;
+#ifdef HAVE_GPM
+  int mousefd;
+#endif
 
   if (CONSOLE_X_P (con))
     return; /* X consoles are automatically selected for when we
@@ -1736,6 +1739,15 @@
   infd = event_stream_unixoid_select_console (con);
   XSETCONSOLE (console, con);
   select_filedesc (infd, console);
+#ifdef HAVE_GPM
+  /* On a stream device (ie: noninteractive), bad things can happen. */
+  if (EQ (CONSOLE_TYPE (con), Qtty)) {
+    mousefd = CONSOLE_TTY_MOUSE_FD (con);
+    if (mousefd >= 0) {
+      select_filedesc (mousefd, console);
+    }
+  }
+#endif
 }
 
 static void
@@ -1743,6 +1755,9 @@
 {
   Lisp_Object console = Qnil;
   int infd;
+#ifdef HAVE_GPM
+  int mousefd;
+#endif
 
   if (CONSOLE_X_P (con))
     return; /* X consoles are automatically selected for when we
@@ -1750,6 +1765,15 @@
   infd = event_stream_unixoid_unselect_console (con);
   XSETCONSOLE (console, con);
   unselect_filedesc (infd);
+#ifdef HAVE_GPM
+  /* On a stream device (ie: noninteractive), bad things can happen. */
+  if (EQ (CONSOLE_TYPE (con), Qtty)) {
+    mousefd = CONSOLE_TTY_MOUSE_FD (con);
+    if (mousefd >= 0) {
+      unselect_filedesc (mousefd);
+    }
+  }
+#endif
 }
 
 /* read an event from a tty, if one is available.  Returns non-zero