3 #include <X11/Xlibint.h>
5 #include <X11/extensions/Xext.h>
10 #if !defined(XTRHEADS)
11 #warning XTRHEADS not defined -- this libXNVCtrl.a will not be thread safe!
18 #define XNVCTRLCheckExtension(dpy,i,val) \
19 XextCheckExtension (dpy, i, nvctrl_extension_name, val)
20 #define XNVCTRLSimpleCheckExtension(dpy,i) \
21 XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
23 static int close_display();
24 static Bool wire_to_event();
40 nvctrl_extension_name,
41 &nvctrl_extension_hooks,
54 if (event_basep) *event_basep = info->
codes->first_event;
55 if (error_basep) *error_basep = info->
codes->first_error;
78 GetReq (nvCtrlQueryExtension, req);
81 if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
86 if (major) *major = rep.major;
87 if (minor) *minor = rep.minor;
109 GetReq (nvCtrlIsNv, req);
112 req->screen = screen;
113 if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
128 unsigned int display_mask,
129 unsigned int attribute,
138 GetReq (nvCtrlSetAttribute, req);
141 req->screen = screen;
142 req->display_mask = display_mask;
143 req->attribute = attribute;
153 unsigned int display_mask,
154 unsigned int attribute,
168 GetReq (nvCtrlQueryAttribute, req);
171 req->screen = screen;
172 req->display_mask = display_mask;
173 req->attribute = attribute;
174 if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
179 if (value) *value = rep.value;
190 unsigned int display_mask,
191 unsigned int attribute,
198 int length, numbytes, slop;
200 if (!ptr)
return False;
208 GetReq (nvCtrlQueryStringAttribute, req);
211 req->screen = screen;
212 req->display_mask = display_mask;
213 req->attribute = attribute;
214 if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
222 *ptr = (
char *) Xmalloc(numbytes);
224 _XEatData(dpy, length);
229 _XRead(dpy, (
char *) *ptr, numbytes);
230 if (slop) _XEatData(dpy, 4-slop);
241 unsigned int display_mask,
242 unsigned int attribute,
250 if (!values)
return False;
258 GetReq (nvCtrlQueryValidAttributeValues, req);
261 req->screen = screen;
262 req->display_mask = display_mask;
263 req->attribute = attribute;
264 if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
270 values->
type = rep.attr_type;
272 values->
u.
range.min = rep.min;
273 values->
u.
range.max = rep.max;
276 values->
u.
bits.ints = rep.bits;
299 GetReq (nvCtrlSelectNotify, req);
302 req->screen = screen;
303 req->notifyType =
type;
311 static Bool wire_to_event (Display *
dpy, XEvent *host, xEvent *wire)
319 switch ((event->u.u.type & 0x7F) - info->
codes->first_event) {
323 _XSetLastRequestRead(dpy, (xGenericReply*) event);
329 event->u.attribute_changed.display_mask;
XNVCtrlAttributeChangedEvent attribute_changed
GLboolean GLenum GLenum GLvoid * values
GLsizei const GLfloat * value
#define X_nvCtrlQueryStringAttribute
#define ATTRIBUTE_TYPE_RANGE
Bool XNVCTRLQueryStringAttribute(Display *dpy, int screen, unsigned int display_mask, unsigned int attribute, char **ptr)
GLuint GLuint GLsizei GLenum type
#define X_nvCtrlQueryAttribute
static nvctrl_ext_info Bool XNVCTRLQueryExtension(Display *dpy, int *event_basep, int *error_basep)
#define X_nvCtrlQueryValidAttributeValues
Bool XNVCTRLQueryValidAttributeValues(Display *dpy, int screen, unsigned int display_mask, unsigned int attribute, NVCTRLAttributeValidValuesRec *values)
#define X_nvCtrlSelectNotify
struct _NVCTRLAttributeValidValues::@100::@101 range
#define NV_CONTROL_EVENTS
#define XEXT_GENERATE_FIND_DISPLAY(proc, extinfo, extname, hooks, nev, data)
#define ATTRIBUTE_CHANGED_EVENT
#define ATTRIBUTE_TYPE_INT_BITS
#define XNVCTRLSimpleCheckExtension(dpy, i)
#define X_nvCtrlQueryExtension
#define X_nvCtrlSetAttribute
union _NVCTRLAttributeValidValues::@100 u
struct _NVCTRLAttributeValidValues::@100::@102 bits
void XNVCTRLSetAttribute(Display *dpy, int screen, unsigned int display_mask, unsigned int attribute, int value)
unsigned int display_mask
Bool XNVCTRLQueryVersion(Display *dpy, int *major, int *minor)
#define XextHasExtension(i)
Bool XNVCTRLQueryAttribute(Display *dpy, int screen, unsigned int display_mask, unsigned int attribute, int *value)
GLsizei const GLcharARB const GLint * length
#define XEXT_GENERATE_CLOSE_DISPLAY(proc, extinfo)
Bool XNVCTRLIsNvScreen(Display *dpy, int screen)
Bool XNVCtrlSelectNotify(Display *dpy, int screen, int type, Bool onoff)
#define XNVCTRLCheckExtension(dpy, i, val)