Back to index

tetex-bin  3.0
lib_tracemse.c
Go to the documentation of this file.
00001 /****************************************************************************
00002  * Copyright (c) 1998,2000,2001,2002 Free Software Foundation, Inc.         *
00003  *                                                                          *
00004  * Permission is hereby granted, free of charge, to any person obtaining a  *
00005  * copy of this software and associated documentation files (the            *
00006  * "Software"), to deal in the Software without restriction, including      *
00007  * without limitation the rights to use, copy, modify, merge, publish,      *
00008  * distribute, distribute with modifications, sublicense, and/or sell       *
00009  * copies of the Software, and to permit persons to whom the Software is    *
00010  * furnished to do so, subject to the following conditions:                 *
00011  *                                                                          *
00012  * The above copyright notice and this permission notice shall be included  *
00013  * in all copies or substantial portions of the Software.                   *
00014  *                                                                          *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
00018  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
00022  *                                                                          *
00023  * Except as contained in this notice, the name(s) of the above copyright   *
00024  * holders shall not be used in advertising or otherwise to promote the     *
00025  * sale, use or other dealings in this Software without prior written       *
00026  * authorization.                                                           *
00027  ****************************************************************************/
00028 
00029 /****************************************************************************
00030  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
00031  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
00032  ****************************************************************************/
00033 
00034 /*
00035  *     lib_tracemse.c - Tracing/Debugging routines (mouse events)
00036  */
00037 
00038 #include <curses.priv.h>
00039 
00040 MODULE_ID("$Id: lib_tracemse.c,v 1.10 2002/01/12 22:32:25 tom Exp $")
00041 
00042 #ifdef TRACE
00043 
00044 NCURSES_EXPORT(char *)
00045 _tracemouse(MEVENT const *ep)
00046 {
00047     static char buf[80];
00048 
00049     (void) sprintf(buf, "id %2d  at (%2d, %2d, %2d) state %4lx = {",
00050                  ep->id, ep->x, ep->y, ep->z, ep->bstate);
00051 
00052 #define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(buf, s), ", ")
00053     SHOW(BUTTON1_RELEASED, "release-1");
00054     SHOW(BUTTON1_PRESSED, "press-1");
00055     SHOW(BUTTON1_CLICKED, "click-1");
00056     SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1");
00057     SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1");
00058     SHOW(BUTTON1_RESERVED_EVENT, "reserved-1");
00059     SHOW(BUTTON2_RELEASED, "release-2");
00060     SHOW(BUTTON2_PRESSED, "press-2");
00061     SHOW(BUTTON2_CLICKED, "click-2");
00062     SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2");
00063     SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2");
00064     SHOW(BUTTON2_RESERVED_EVENT, "reserved-2");
00065     SHOW(BUTTON3_RELEASED, "release-3");
00066     SHOW(BUTTON3_PRESSED, "press-3");
00067     SHOW(BUTTON3_CLICKED, "click-3");
00068     SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3");
00069     SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3");
00070     SHOW(BUTTON3_RESERVED_EVENT, "reserved-3");
00071     SHOW(BUTTON4_RELEASED, "release-4");
00072     SHOW(BUTTON4_PRESSED, "press-4");
00073     SHOW(BUTTON4_CLICKED, "click-4");
00074     SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4");
00075     SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4");
00076     SHOW(BUTTON4_RESERVED_EVENT, "reserved-4");
00077     SHOW(BUTTON_CTRL, "ctrl");
00078     SHOW(BUTTON_SHIFT, "shift");
00079     SHOW(BUTTON_ALT, "alt");
00080     SHOW(ALL_MOUSE_EVENTS, "all-events");
00081     SHOW(REPORT_MOUSE_POSITION, "position");
00082 #undef SHOW
00083 
00084     if (buf[strlen(buf) - 1] == ' ')
00085        buf[strlen(buf) - 2] = '\0';
00086     (void) strcat(buf, "}");
00087     return (buf);
00088 }
00089 
00090 #else /* !TRACE */
00091 empty_module(_nc_lib_tracemouse)
00092 #endif