home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / XKBBell.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  7KB  |  245 lines

  1. /* $XConsortium: XKBBell.c /main/4 1996/01/01 11:25:48 kaleb $ */
  2. /************************************************************
  3. Copyright (c) 1993 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.  
  28. #include <stdio.h>
  29. #define NEED_REPLIES
  30. #define NEED_EVENTS
  31. #include "Xlib_private.h"
  32. #include <X11/extensions/XKBproto.h>
  33. #include "XKBlibint.h"
  34.  
  35. #if 0
  36. Bool
  37. #if NeedFunctionPrototypes
  38. XkbDeviceBell(    Display *    dpy,
  39.         Window         window,
  40.         int         deviceID,
  41.         int         bellClass,
  42.         int         bellID, 
  43.         int         percent,
  44.         Atom         name)
  45. #else
  46. XkbDeviceBell(dpy,window,deviceID,bellClass,bellID,percent,name)
  47.     Display *dpy;
  48.     Window window;
  49.     int deviceID;
  50.     int bellClass;
  51.     int bellID;
  52.     int percent;
  53.     Atom name;
  54. #endif
  55. {
  56.     DBUG_ENTER("XkbDeviceBell")
  57.     register xkbBellReq *req;
  58.     XkbInfoPtr xkbi;
  59.  
  60.     if ((dpy->flags & XlibDisplayNoXkb) ||
  61.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
  62.     DBUG_RETURN(False);
  63.     LockDisplay(dpy);
  64.     xkbi = dpy->xkb_info;
  65.     GetReq(kbBell,req);
  66.     req->reqType = xkbi->codes->major_opcode;
  67.     req->xkbReqType = X_kbBell;
  68.     req->deviceSpec = deviceID;
  69.     req->window = (CARD32)window;
  70.     req->bellClass = (CARD16)bellClass;
  71.     req->bellID = (CARD16)bellID;
  72.     req->percent = percent;
  73.     req->forceSound = False;
  74.     req->eventOnly = False;
  75.     req->pitch = 0;
  76.     req->duration = 0;
  77.     req->name = (CARD32)name;
  78.     req->pad1= 0; req->pad2= 0;
  79.     UnlockDisplay(dpy);
  80.     SyncHandle();
  81.     DBUG_RETURN(True);
  82. }
  83.  
  84. Bool
  85. #if NeedFunctionPrototypes
  86. XkbForceDeviceBell(    Display *    dpy,
  87.             int         deviceID,
  88.             int         bellClass,
  89.             int         bellID,
  90.             int         percent)
  91. #else
  92. XkbForceDeviceBell(dpy,deviceID,bellClass,bellID,percent)
  93.     Display *dpy;
  94.     int    deviceID;
  95.     int    bellClass;
  96.     int    bellID;
  97.     int    percent;
  98. #endif
  99. {
  100.     DBUG_ENTER("XkbForceDeviceBell")
  101.     register xkbBellReq *req;
  102.     XkbInfoPtr xkbi;
  103.  
  104.     if ((dpy->flags & XlibDisplayNoXkb) ||
  105.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
  106.     DBUG_RETURN(False);
  107.     LockDisplay(dpy);
  108.     xkbi = dpy->xkb_info;
  109.     GetReq(kbBell,req);
  110.     req->reqType = xkbi->codes->major_opcode;
  111.     req->xkbReqType = X_kbBell;
  112.     req->deviceSpec = deviceID;
  113.     req->window = (CARD32)None;
  114.     req->bellClass = (CARD16)bellClass;
  115.     req->bellID = (CARD16)bellID;
  116.     req->percent = percent;
  117.     req->forceSound = True;
  118.     req->eventOnly = False;
  119.     req->pitch = 0;
  120.     req->duration = 0;
  121.     req->name = None;
  122.     req->pad1= 0; req->pad2= 0;
  123.     UnlockDisplay(dpy);
  124.     SyncHandle();
  125.     DBUG_RETURN(True);
  126. }
  127.  
  128. Bool
  129. #if NeedFunctionPrototypes
  130. XkbDeviceBellEvent(    Display *    dpy,
  131.             Window         window,
  132.             int        deviceID,
  133.             int        bellClass,
  134.             int        bellID,
  135.             int        percent,
  136.             Atom         name)
  137. #else
  138. XkbDeviceBellEvent(dpy,window,deviceID,bellClass,bellID,percent,name)
  139.     Display *dpy;
  140.     Window window;
  141.     int    deviceID;
  142.     int    bellClass;
  143.     int    bellID;
  144.     int    percent;
  145.     Atom name;
  146. #endif
  147. {
  148.     DBUG_ENTER("XkbDeviceBellEvent")
  149.     register xkbBellReq *req;
  150.     XkbInfoPtr xkbi;
  151.  
  152.     if ((dpy->flags & XlibDisplayNoXkb) ||
  153.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
  154.     DBUG_RETURN(False);
  155.     LockDisplay(dpy);
  156.     xkbi = dpy->xkb_info;
  157.     GetReq(kbBell,req);
  158.     req->reqType = xkbi->codes->major_opcode;
  159.     req->xkbReqType = X_kbBell;
  160.     req->deviceSpec = deviceID;
  161.     req->window = (CARD32)window;
  162.     req->bellClass = (CARD16)bellClass;
  163.     req->bellID = (CARD16)bellID;
  164.     req->percent = percent;
  165.     req->forceSound = False;
  166.     req->eventOnly = True;
  167.     req->pitch = 0;
  168.     req->duration = 0;
  169.     req->name = (CARD32)name;
  170.     req->pad1= 0; req->pad2= 0;
  171.     UnlockDisplay(dpy);
  172.     SyncHandle();
  173.     DBUG_RETURN(True);
  174. }
  175. #endif
  176.  
  177. Bool
  178. #if NeedFunctionPrototypes
  179. XkbBell(Display *dpy,Window window,int percent,Atom name)
  180. #else
  181. XkbBell(dpy,window,percent,name)
  182.     Display *dpy;
  183.     Window   window;
  184.     int percent;
  185.     Atom name;
  186. #endif
  187. {
  188.     DBUG_ENTER("XkbBell")
  189.     Bool result;
  190.     if ((dpy->flags & XlibDisplayNoXkb) ||
  191.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
  192.     XBell(dpy,percent);
  193.     DBUG_RETURN(False);
  194.     }
  195.     result = XkbDeviceBell(dpy,window,XkbUseCoreKbd,XkbDfltXIClass,XkbDfltXIId,
  196.                                 percent,name);
  197.     DBUG_RETURN(result);
  198. }
  199.  
  200. Bool
  201. #if NeedFunctionPrototypes
  202. XkbForceBell(Display *dpy,int percent)
  203. #else
  204. XkbForceBell(dpy,percent)
  205.     Display *    dpy;
  206.     int          percent;
  207. #endif
  208. {
  209.     DBUG_ENTER("XkbForceBell")
  210.     Bool result;
  211.     if ((dpy->flags & XlibDisplayNoXkb) ||
  212.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
  213.     XBell(dpy,percent);
  214.     DBUG_RETURN(False);
  215.     }
  216.     result = XkbForceDeviceBell(dpy,XkbUseCoreKbd,XkbDfltXIClass,XkbDfltXIId,
  217.                                 percent);
  218.     DBUG_RETURN(result);
  219. }
  220.  
  221. Bool
  222. #if NeedFunctionPrototypes
  223. XkbBellEvent(Display *dpy,Window window,int percent,Atom name)
  224. #else
  225. XkbBellEvent(dpy,window,percent,name)
  226.     Display *dpy;
  227.     Window   window;
  228.     int percent;
  229.     Atom name;
  230. #endif
  231. {
  232.     DBUG_ENTER("XkbBellEvent")
  233.     Bool result;
  234.     if ((dpy->flags & XlibDisplayNoXkb) ||
  235.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
  236.     DBUG_RETURN(False);
  237.     }
  238.     /* class 0 = KbdFeedbackClass (X Input Extension) */
  239.     result = XkbDeviceBellEvent(dpy,window,XkbUseCoreKbd,
  240.                     XkbDfltXIClass,XkbDfltXIId,
  241.                     percent,name);
  242.     DBUG_RETURN(result);
  243. }
  244.  
  245.