]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_mouse.c
ncurses 5.9 - patch 20140426
[ncurses.git] / ncurses / base / lib_mouse.c
index f4ad054d7ebef61af8c20b18f7bf49f2c7c52e56..08af6a6867b5d83f4cc50a69a12f51b5cf692d93 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -84,7 +84,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mouse.c,v 1.138 2012/02/29 10:38:46 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.143 2014/04/26 18:47:20 juergen Exp $")
 
 #include <tic.h>
 
@@ -112,7 +112,7 @@ make an error
 #undef buttons                 /* symbol conflict in consio.h */
 #undef mouse_info              /* symbol conflict in consio.h */
 #include <osreldate.h>
-#if (__FreeBSD_version >= 400017)
+#if defined(__DragonFly_version) || (defined(__FreeBSD__) && (__FreeBSD_version >= 400017))
 #include <sys/consio.h>
 #include <sys/fbio.h>
 #else
@@ -225,7 +225,7 @@ write_event(SCREEN *sp, int down, int button, int x, int y)
     char buf[6];
     unsigned long ignore;
 
-    strncpy(buf, key_mouse, 3);        /* should be "\033[M" */
+    strcpy(buf, "\033[M");     /* should be the same as key_mouse */
     buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
     buf[4] = ' ' + x - LEFT_COL + 1;
     buf[5] = ' ' + y - TOP_ROW + 1;
@@ -388,9 +388,7 @@ enable_xterm_mouse(SCREEN *sp, int enable)
 #if USE_EMX_MOUSE
     sp->_emxmouse_activated = enable;
 #else
-    NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-                              "xterm-mouse",
-                              TPARM_1(sp->_mouse_xtermcap, enable));
+    NCURSES_PUTP2("xterm-mouse", TPARM_1(sp->_mouse_xtermcap, enable));
 #endif
     sp->_mouse_active = enable;
 }
@@ -410,7 +408,7 @@ allow_gpm_mouse(SCREEN *sp)
     } else
 #endif
        /* GPM does printf's without checking if stdout is a terminal */
-    if (isatty(fileno(stdout))) {
+    if (NC_ISATTY(fileno(stdout))) {
        char *list = getenv("NCURSES_GPM_TERMS");
        char *env = getenv("TERM");
        if (list != 0) {
@@ -609,7 +607,7 @@ initialize_mousetype(SCREEN *sp)
        struct mouse_info the_mouse;
        char *the_device = 0;
 
-       if (isatty(sp->_ifd))
+       if (NC_ISATTY(sp->_ifd))
            the_device = ttyname(sp->_ifd);
        if (the_device == 0)
            the_device = "/dev/tty";
@@ -670,7 +668,7 @@ initialize_mousetype(SCREEN *sp)
 #endif /* USE_SYSMOUSE */
 
 #ifdef USE_TERM_DRIVER
-    CallDriver(sp, initmouse);
+    CallDriver(sp, td_initmouse);
 #else
     /* we know how to recognize mouse events under "xterm" */
     if (key_mouse != 0) {