]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/lib_tracemse.c
ncurses 4.1
[ncurses.git] / ncurses / lib_tracemse.c
1
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21
22
23
24 /*
25  *      lib_tracemse.c - Tracing/Debugging routines (mouse events)
26  */
27
28 #ifndef TRACE
29 #define TRACE                   /* turn on internal defs for this module */
30 #endif
31
32 #include <curses.priv.h>
33
34 MODULE_ID("$Id: lib_tracemse.c,v 1.4 1996/12/21 14:24:06 tom Exp $")
35
36 char *_tracemouse(MEVENT const *ep)
37 {
38         static char buf[80];
39
40         (void) sprintf(buf, "id %2d  at (%2d, %2d, %2d) state %4lx = {",
41                        ep->id, ep->x, ep->y, ep->z, ep->bstate);
42
43 #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");}
44         SHOW(BUTTON1_RELEASED,          "release-1")
45         SHOW(BUTTON1_PRESSED,           "press-1")
46         SHOW(BUTTON1_CLICKED,           "click-1")
47         SHOW(BUTTON1_DOUBLE_CLICKED,    "doubleclick-1")
48         SHOW(BUTTON1_TRIPLE_CLICKED,    "tripleclick-1")
49         SHOW(BUTTON1_RESERVED_EVENT,    "reserved-1")
50         SHOW(BUTTON2_RELEASED,          "release-2")
51         SHOW(BUTTON2_PRESSED,           "press-2")
52         SHOW(BUTTON2_CLICKED,           "click-2")
53         SHOW(BUTTON2_DOUBLE_CLICKED,    "doubleclick-2")
54         SHOW(BUTTON2_TRIPLE_CLICKED,    "tripleclick-2")
55         SHOW(BUTTON2_RESERVED_EVENT,    "reserved-2")
56         SHOW(BUTTON3_RELEASED,          "release-3")
57         SHOW(BUTTON3_PRESSED,           "press-3")
58         SHOW(BUTTON3_CLICKED,           "click-3")
59         SHOW(BUTTON3_DOUBLE_CLICKED,    "doubleclick-3")
60         SHOW(BUTTON3_TRIPLE_CLICKED,    "tripleclick-3")
61         SHOW(BUTTON3_RESERVED_EVENT,    "reserved-3")
62         SHOW(BUTTON4_RELEASED,          "release-4")
63         SHOW(BUTTON4_PRESSED,           "press-4")
64         SHOW(BUTTON4_CLICKED,           "click-4")
65         SHOW(BUTTON4_DOUBLE_CLICKED,    "doubleclick-4")
66         SHOW(BUTTON4_TRIPLE_CLICKED,    "tripleclick-4")
67         SHOW(BUTTON4_RESERVED_EVENT,    "reserved-4")
68         SHOW(BUTTON_CTRL,               "ctrl")
69         SHOW(BUTTON_SHIFT,              "shift")
70         SHOW(BUTTON_ALT,                "alt")
71         SHOW(ALL_MOUSE_EVENTS,          "all-events")
72         SHOW(REPORT_MOUSE_POSITION,     "position")
73 #undef SHOW
74
75         if (buf[strlen(buf)-1] == ' ')
76                 buf[strlen(buf)-2] = '\0';
77         (void) strcat(buf, "}");
78         return(buf);
79 }
80
81
82