xkbbells.c revision 8c9fbc29
1/* $Xorg: xkbbells.c,v 1.3 2000/08/17 19:46:43 cpqbld Exp $ */ 2/************************************************************ 3 Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. 4 5 Permission to use, copy, modify, and distribute this 6 software and its documentation for any purpose and without 7 fee is hereby granted, provided that the above copyright 8 notice appear in all copies and that both that copyright 9 notice and this permission notice appear in supporting 10 documentation, and that the name of Silicon Graphics not be 11 used in advertising or publicity pertaining to distribution 12 of the software without specific prior written permission. 13 Silicon Graphics makes no representation about the suitability 14 of this software for any purpose. It is provided "as is" 15 without any express or implied warranty. 16 17 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 18 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 19 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 20 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 21 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 22 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 23 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 24 THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 26 ********************************************************/ 27/* $XFree86$ */ 28 29#ifdef HAVE_CONFIG_H 30#include <config.h> 31#endif 32#include <X11/Xlib.h> 33#include <X11/XKBlib.h> 34#include "XKBbells.h" 35 36static char *_xkbStdBellNames[XkbBI_NumBells] = { 37 "Info", 38 "Warning", 39 "MinorError", 40 "MajorError", 41 "BadValue", 42 "InvalidLocation", 43 "Question", 44 "Start", 45 "End", 46 "Success", 47 "Failure", 48 "Wait", 49 "Proceed", 50 "Ignore", 51 "Iconify", 52 "Deconify", 53 "Open", 54 "Close", 55 "TerminalBell", 56 "MarginBell", 57 "CursorStuck", 58 "NewMail", 59 "LaunchApp", 60 "AppDeath", 61 "ImAlive", 62 "ClockChimeHour", 63 "ClockChimeHalf", 64 "ClockChimeQuarter", 65 "RepeatingLastBell", 66 "ComposeFail", 67 "AX_FeatureOn", 68 "AX_FeatureOff", 69 "AX_FeatureChange", 70 "AX_IndicatorOn", 71 "AX_IndicatorOff", 72 "AX_IndicatorChange", 73 "AX_SlowKeysWarning", 74 "AX_SlowKeyPress", 75 "AX_SlowKeyAccept", 76 "AX_SlowKeyReject", 77 "AX_SlowKeyRelease", 78 "AX_BounceKeyReject", 79 "AX_StickyLatch", 80 "AX_StickyLock", 81 "AX_StickyUnlock" 82}; 83 84static Atom _xkbStdBellAtoms[XkbBI_NumBells]; 85 86Bool 87XkbStdBell(Display *dpy,Window win,int percent,int bellDef) 88{ 89 if ((bellDef<0)||(bellDef>=XkbBI_NumBells)) 90 bellDef= XkbBI_Info; 91 if (_xkbStdBellAtoms[bellDef]==None) 92 _xkbStdBellAtoms[bellDef]= XInternAtom(dpy,_xkbStdBellNames[bellDef],0); 93 return XkbBell(dpy,win,percent,_xkbStdBellAtoms[bellDef]); 94} 95 96Bool 97XkbStdBellEvent(Display *dpy,Window win,int percent,int bellDef) 98{ 99 if ((bellDef<0)||(bellDef>=XkbBI_NumBells)) 100 bellDef= XkbBI_Info; 101 if (_xkbStdBellAtoms[bellDef]==None) 102 _xkbStdBellAtoms[bellDef]= XInternAtom(dpy,_xkbStdBellNames[bellDef],0); 103 return XkbBellEvent(dpy,win,percent,_xkbStdBellAtoms[bellDef]); 104} 105