lib_tracemse.c revision 76726
1/**************************************************************************** 2 * Copyright (c) 1998,2000 Free Software Foundation, Inc. * 3 * * 4 * Permission is hereby granted, free of charge, to any person obtaining a * 5 * copy of this software and associated documentation files (the * 6 * "Software"), to deal in the Software without restriction, including * 7 * without limitation the rights to use, copy, modify, merge, publish, * 8 * distribute, distribute with modifications, sublicense, and/or sell * 9 * copies of the Software, and to permit persons to whom the Software is * 10 * furnished to do so, subject to the following conditions: * 11 * * 12 * The above copyright notice and this permission notice shall be included * 13 * in all copies or substantial portions of the Software. * 14 * * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 22 * * 23 * Except as contained in this notice, the name(s) of the above copyright * 24 * holders shall not be used in advertising or otherwise to promote the * 25 * sale, use or other dealings in this Software without prior written * 26 * authorization. * 27 ****************************************************************************/ 28 29/**************************************************************************** 30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * 31 * and: Eric S. Raymond <esr@snark.thyrsus.com> * 32 ****************************************************************************/ 33 34/* 35 * lib_tracemse.c - Tracing/Debugging routines (mouse events) 36 */ 37 38#include <curses.priv.h> 39 40MODULE_ID("$Id: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $") 41 42#ifdef TRACE 43 44NCURSES_EXPORT(char *) 45_tracemouse(MEVENT const *ep) 46{ 47 static char buf[80]; 48 49 (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", 50 ep->id, ep->x, ep->y, ep->z, ep->bstate); 51 52#define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} 53 SHOW(BUTTON1_RELEASED, "release-1") 54 SHOW(BUTTON1_PRESSED, "press-1") 55 SHOW(BUTTON1_CLICKED, "click-1") 56 SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") 57 SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") 58 SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") 59 SHOW(BUTTON2_RELEASED, "release-2") 60 SHOW(BUTTON2_PRESSED, "press-2") 61 SHOW(BUTTON2_CLICKED, "click-2") 62 SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") 63 SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") 64 SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") 65 SHOW(BUTTON3_RELEASED, "release-3") 66 SHOW(BUTTON3_PRESSED, "press-3") 67 SHOW(BUTTON3_CLICKED, "click-3") 68 SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") 69 SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") 70 SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") 71 SHOW(BUTTON4_RELEASED, "release-4") 72 SHOW(BUTTON4_PRESSED, "press-4") 73 SHOW(BUTTON4_CLICKED, "click-4") 74 SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") 75 SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") 76 SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") 77 SHOW(BUTTON_CTRL, "ctrl") 78 SHOW(BUTTON_SHIFT, "shift") 79 SHOW(BUTTON_ALT, "alt") 80 SHOW(ALL_MOUSE_EVENTS, "all-events") 81 SHOW(REPORT_MOUSE_POSITION, "position") 82#undef SHOW 83 84 if (buf[strlen(buf) - 1] == ' ') 85 buf[strlen(buf) - 2] = '\0'; 86 (void) strcat(buf, "}"); 87 return (buf); 88} 89 90#else /* !TRACE */ 91/* don't make empty module */ 92NCURSES_EXPORT(void) 93_nc_lib_tracemouse(void); 94NCURSES_EXPORT(void) 95_nc_lib_tracemouse(void) 96{ 97} 98#endif 99