2 * $Xorg: XLbx.c,v 1.3 2000/08/17 19:45:51 cpqbld Exp $
4 * Copyright 1992 Network Computing Devices
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of NCD. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. NCD. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Keith Packard, Network Computing Devices
25 /* $XFree86: xc/lib/Xext/XLbx.c,v 1.4 2002/10/16 00:37:27 dawes Exp $ */
33 #include <X11/Xlibint.h>
34 #include <X11/extensions/XLbx.h>
35 #include <X11/extensions/lbxstr.h>
36 #include <X11/extensions/Xext.h>
37 #include <X11/extensions/extutil.h>
39 static XExtensionInfo _lbx_info_data
;
40 static XExtensionInfo
*lbx_info
= &_lbx_info_data
;
41 static /* const */ char *lbx_extension_name
= LBXNAME
;
43 #define LbxCheckExtension(dpy,i,val) \
44 XextCheckExtension (dpy, i, lbx_extension_name, val)
46 static int close_display(Display
*dpy
, XExtCodes
*codes
);
47 static char *error_string(Display
*dpy
, int code
, XExtCodes
*codes
,
49 static /* const */ XExtensionHooks lbx_extension_hooks
= {
54 NULL
, /* create_font */
56 close_display
, /* close_display */
57 NULL
, /* wire_to_event */
58 NULL
, /* event_to_wire */
60 error_string
, /* error_string */
63 static /* const */ char *lbx_error_list
[] = {
64 "BadLbxClient", /* BadLbxClient */
67 static XEXT_GENERATE_FIND_DISPLAY (find_display
, lbx_info
, lbx_extension_name
,
68 &lbx_extension_hooks
, LbxNumberEvents
, NULL
)
70 static XEXT_GENERATE_CLOSE_DISPLAY (close_display
, lbx_info
)
72 static XEXT_GENERATE_ERROR_STRING (error_string
, lbx_extension_name
,
73 LbxNumberErrors
, lbx_error_list
)
76 Bool
XLbxQueryExtension (
78 int *requestp
, int *event_basep
, int *error_basep
)
80 XExtDisplayInfo
*info
= find_display (dpy
);
82 if (XextHasExtension(info
)) {
83 *requestp
= info
->codes
->major_opcode
;
84 *event_basep
= info
->codes
->first_event
;
85 *error_basep
= info
->codes
->first_error
;
93 int XLbxGetEventBase(Display
*dpy
)
95 XExtDisplayInfo
*info
= find_display (dpy
);
97 if (XextHasExtension(info
)) {
98 return info
->codes
->first_event
;
105 Bool
XLbxQueryVersion(Display
*dpy
, int *majorVersion
, int *minorVersion
)
107 XExtDisplayInfo
*info
= find_display (dpy
);
108 xLbxQueryVersionReply rep
;
109 register xLbxQueryVersionReq
*req
;
111 LbxCheckExtension (dpy
, info
, False
);
114 GetReq(LbxQueryVersion
, req
);
115 req
->reqType
= info
->codes
->major_opcode
;
116 req
->lbxReqType
= X_LbxQueryVersion
;
117 if (!_XReply(dpy
, (xReply
*)&rep
, 0, xFalse
)) {
122 *majorVersion
= rep
.majorVersion
;
123 *minorVersion
= rep
.minorVersion
;
129 /* all other requests will run after Xlib has lost the wire ... */