2 * Copyright 1992 Network Computing Devices
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of NCD. not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. NCD. makes no representations about the
11 * suitability of this software for any purpose. It is provided "as is"
12 * without express or implied warranty.
14 * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
16 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Author: Keith Packard, Network Computing Devices
28 #include <X11/Xlibint.h>
29 #include <X11/extensions/XLbx.h>
30 #include <X11/extensions/lbxproto.h>
31 #include <X11/extensions/Xext.h>
32 #include <X11/extensions/extutil.h>
34 static XExtensionInfo _lbx_info_data;
35 static XExtensionInfo *lbx_info = &_lbx_info_data;
36 static const char *lbx_extension_name = LBXNAME;
38 #define LbxCheckExtension(dpy,i,val) \
39 XextCheckExtension (dpy, i, lbx_extension_name, val)
41 static int close_display(Display *dpy, XExtCodes *codes);
42 static char *error_string(Display *dpy, int code, XExtCodes *codes,
44 static /* const */ XExtensionHooks lbx_extension_hooks = {
49 NULL, /* create_font */
51 close_display, /* close_display */
52 NULL, /* wire_to_event */
53 NULL, /* event_to_wire */
55 error_string, /* error_string */
58 static const char *lbx_error_list[] = {
59 "BadLbxClient", /* BadLbxClient */
62 static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name,
63 &lbx_extension_hooks, LbxNumberEvents, NULL)
65 static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info)
67 static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name,
68 LbxNumberErrors, lbx_error_list)
71 Bool XLbxQueryExtension (
73 int *requestp, int *event_basep, int *error_basep)
75 XExtDisplayInfo *info = find_display (dpy);
77 if (XextHasExtension(info)) {
78 *requestp = info->codes->major_opcode;
79 *event_basep = info->codes->first_event;
80 *error_basep = info->codes->first_error;
88 int XLbxGetEventBase(Display *dpy)
90 XExtDisplayInfo *info = find_display (dpy);
92 if (XextHasExtension(info)) {
93 return info->codes->first_event;
100 Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
102 XExtDisplayInfo *info = find_display (dpy);
103 xLbxQueryVersionReply rep;
104 register xLbxQueryVersionReq *req;
106 LbxCheckExtension (dpy, info, False);
109 GetReq(LbxQueryVersion, req);
110 req->reqType = info->codes->major_opcode;
111 req->lbxReqType = X_LbxQueryVersion;
112 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
117 *majorVersion = rep.majorVersion;
118 *minorVersion = rep.minorVersion;
124 /* all other requests will run after Xlib has lost the wire ... */