]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/tinfo_driver.c
ncurses 5.7 - patch 20100410
[ncurses.git] / ncurses / tinfo / tinfo_driver.c
index 8c16bf906e9071df58d571d483efe2a66bd3e82a..d45ef0b6d7a279d5975878a2a8c706551573b7f9 100644 (file)
@@ -50,7 +50,7 @@
 # endif
 #endif
 
-MODULE_ID("$Id: tinfo_driver.c,v 1.8 2010/04/03 14:10:56 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.9 2010/04/10 16:11:17 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -876,6 +876,39 @@ drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
     }
 }
 
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+    int rc = 0;
+    SCREEN *sp;
+
+    AssertTCB();
+    SetSP();
+
+#if USE_SYSMOUSE
+    if ((sp->_mouse_type == M_SYSMOUSE)
+       && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+       rc = TW_MOUSE;
+    } else
+#endif
+    {
+       rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+                                  TWAIT_MASK,
+                                  delay,
+                                  (int *) 0
+                                  EVENTLIST_2nd(evl));
+#if USE_SYSMOUSE
+       if ((sp->_mouse_type == M_SYSMOUSE)
+           && (sp->_sysmouse_head < sp->_sysmouse_tail)
+           && (rc == 0)
+           && (errno == EINTR)) {
+           rc |= TW_MOUSE;
+       }
+#endif
+    }
+    return rc;
+}
+
 static int
 drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew)
 {
@@ -1308,6 +1341,7 @@ NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_TINFO_DRIVER = {
        drv_initcolor,          /* initcolor */
        drv_do_color,           /* docolor */
        drv_initmouse,          /* initmouse */
+       drv_testmouse,          /* testmouse */
        drv_setfilter,          /* setfilter */
        drv_hwlabel,            /* hwlabel */
        drv_hwlabelOnOff,       /* hwlabelOnOff */