summaryrefslogtreecommitdiff
path: root/lib/xuma/xuma.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xuma/xuma.c')
-rw-r--r--lib/xuma/xuma.c120
1 files changed, 81 insertions, 39 deletions
diff --git a/lib/xuma/xuma.c b/lib/xuma/xuma.c
index a1438f7..28a3ca3 100644
--- a/lib/xuma/xuma.c
+++ b/lib/xuma/xuma.c
@@ -91,55 +91,39 @@ XEXT_GENERATE_FIND_DISPLAY(XumaFindDisplay, XumaExtInfo, XUMA_EXT_NAME,
/*
*
*/
-Bool
-XumaQueryExtension(Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = XumaFindDisplay(dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-/*
- *
- */
-Bool
-XumaQueryVersion(Display *dpy)
+int
+XumaQueryExtension(Display *dpy, unsigned int *Version, unsigned int *Release,
+ int *event_basep, int *error_basep)
{
XExtDisplayInfo *info = XumaFindDisplay(dpy);
- xumaVersionReq *req;
- xumaVersionReply reply;
- Bool ret;
+ xumaQueryExtensionReq *req;
+ xumaQueryExtensionReply reply;
+ int ret;
XumaCheckExtension(dpy, info, BadImplementation);
LockDisplay(dpy);
- XumaGetReq(Version, req);
+ XumaGetReq(QueryExtension, req);
- ret = _XReply(dpy, (xReply *)&reply, 0, xFalse);
- if (ret) {
- int Major, Minor, Patch;
+ if (_XReply(dpy, (xReply *)&reply, 0, xFalse)) {
+ *Version = reply.Version;
+ *Release = reply.Release;
- Major = (reply.Version >> 20) & 0x3FF;
- Minor = (reply.Version >> 10) & 0x3FF;
- Patch = reply.Version & 0x3FF;
- printf("Found %s Version %03d.%03d.%03d.\n", XUMA_EXT_NAME,
- Major, Minor, Patch);
-
- if ((Major != XUMA_VERSION_MAJOR) ||
- (Minor < XUMA_VERSION_MINOR)) {
+ if ((*Version != XUMA_VERSION) || (*Release < XUMA_RELEASE)) {
fprintf(stderr, "Incompatible %s version found.\n", XUMA_EXT_NAME);
- return FALSE;
+
+ ret = BadImplementation;
}
- } else
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+
+ ret = Success;
+ } else {
fprintf(stderr, "%s; Xreply failed.\n", __func__);
+ ret = BadAccess;
+ }
UnlockDisplay(dpy);
SyncHandle();
@@ -282,6 +266,64 @@ XumaGetCapabilities(Display *dpy, int port)
}
/*
+ *
+ */
+int
+XumaPutSubPicture(Display *dpy, int port, int IA44, unsigned short Width,
+ unsigned short Height, unsigned int Palette[16],
+ unsigned char *SubPicture)
+{
+ XExtDisplayInfo *info = XumaFindDisplay(dpy);
+ xumaPutSubPictureReq *req;
+ int len;
+
+ XumaCheckExtension(dpy, info, BadImplementation);
+
+ LockDisplay(dpy);
+
+ XumaGetReq(PutSubPicture, req);
+
+ req->Port = port;
+ req->Width = Width;
+ req->Height = Height;
+ req->IA44 = IA44 & 0xFF;
+
+ len = (64 + Width * Height + 3) >> 2;
+ SetReqLen(req, len, len);
+
+ Data(dpy, (char *) Palette, 64);
+ Data(dpy, (char *) SubPicture, Width * Height);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
+}
+
+/*
+ *
+ */
+int
+XumaStopSubPicture(Display *dpy, int port)
+{
+ XExtDisplayInfo *info = XumaFindDisplay(dpy);
+ xumaStopSubPictureReq *req;
+
+ XumaCheckExtension(dpy, info, BadImplementation);
+
+ LockDisplay(dpy);
+
+ XumaGetReq(StopSubPicture, req);
+
+ req->Port = port;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
+}
+
+/*
* Returns 0 if no buffer has been grabbed.
*/
unsigned char
@@ -343,7 +385,7 @@ XumaReleaseBuffer(Display *dpy, int port, unsigned char BufferID)
UnlockDisplay(dpy);
SyncHandle();
- return Success; /* Where do we see if an error occured? */
+ return Success;
}
/*
@@ -369,7 +411,7 @@ XumaPutQMatrix(Display *dpy, int port, int type, unsigned char Matrix[64])
UnlockDisplay(dpy);
SyncHandle();
- return Success; /* Where do we see if an error occured? */
+ return Success;
}
/*
@@ -441,5 +483,5 @@ XumaPutSlice(Display *dpy, XvPortID port, unsigned char BufferID, unsigned int S
UnlockDisplay(dpy);
SyncHandle();
- return Success; /* Where do we see if an error occured? */
+ return Success;
}