[PATCH 05/13] libXrandr: Panning support
Matthias Hopf
mhopf at suse.de
Fri Nov 28 08:26:43 PST 2008
---
include/X11/extensions/Xrandr.h | 28 +++++++++++
src/XrrCrtc.c | 97 +++++++++++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+), 0 deletions(-)
diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h
index 77a7d04..e9fa94e 100644
--- a/include/X11/extensions/Xrandr.h
+++ b/include/X11/extensions/Xrandr.h
@@ -378,6 +378,34 @@ XRRFreeGamma (XRRCrtcGamma *gamma);
*/
int XRRUpdateConfiguration(XEvent *event);
+typedef struct _XRRPanning {
+ Time timestamp;
+ unsigned int left;
+ unsigned int top;
+ unsigned int width;
+ unsigned int height;
+ unsigned int track_left;
+ unsigned int track_top;
+ unsigned int track_width;
+ unsigned int track_height;
+ int border_left;
+ int border_top;
+ int border_right;
+ int border_bottom;
+} XRRPanning;
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);
+
+void
+XRRFreePanning (XRRPanning *panning);
+
+Status
+XRRSetPanning (Display *dpy,
+ XRRScreenResources *resources,
+ RRCrtc crtc,
+ XRRPanning *panning);
+
_XFUNCPROTOEND
#endif /* _XRANDR_H_ */
diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c
index 5e5c813..f6fe4c0 100644
--- a/src/XrrCrtc.c
+++ b/src/XrrCrtc.c
@@ -270,3 +270,100 @@ XRRFreeGamma (XRRCrtcGamma *crtc_gamma)
{
Xfree (crtc_gamma);
}
+
+XRRPanning *
+XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc)
+{
+ XExtDisplayInfo *info = XRRFindDisplay(dpy);
+ xRRGetPanningReply rep;
+ xRRGetPanningReq *req;
+ XRRPanning *xp;
+
+ RRCheckExtension (dpy, info, 0);
+
+ LockDisplay (dpy);
+ GetReq (RRGetPanning, req);
+ req->reqType = info->codes->major_opcode;
+ req->randrReqType = X_RRGetPanning;
+ req->crtc = crtc;
+ req->configTimestamp = resources->configTimestamp;
+
+ if (!_XReply (dpy, (xReply *) &rep, 1, xFalse))
+ {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ if (! (xp = (XRRPanning *) Xmalloc(sizeof(XRRPanning))) ) {
+ _XEatData (dpy, sizeof(XRRPanning));
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+
+ xp->timestamp = rep.timestamp;
+ xp->left = rep.left;
+ xp->top = rep.top;
+ xp->width = rep.width;
+ xp->height = rep.height;
+ xp->track_left = rep.track_left;
+ xp->track_top = rep.track_top;
+ xp->track_width = rep.track_width;
+ xp->track_height = rep.track_height;
+ xp->border_left = rep.border_left;
+ xp->border_top = rep.border_top;
+ xp->border_right = rep.border_right;
+ xp->border_bottom = rep.border_bottom;
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return (XRRPanning *) xp;
+}
+
+void
+XRRFreePanning (XRRPanning *panning)
+{
+ Xfree (panning);
+}
+
+Status
+XRRSetPanning (Display *dpy,
+ XRRScreenResources *resources,
+ RRCrtc crtc,
+ XRRPanning *panning)
+{
+ XExtDisplayInfo *info = XRRFindDisplay(dpy);
+ xRRSetPanningReply rep;
+ xRRSetPanningReq *req;
+ int i;
+
+ RRCheckExtension (dpy, info, 0);
+
+ LockDisplay(dpy);
+ GetReq (RRSetPanning, req);
+ req->reqType = info->codes->major_opcode;
+ req->randrReqType = X_RRSetPanning;
+ req->crtc = crtc;
+ req->timestamp = panning->timestamp;
+ req->configTimestamp = resources->configTimestamp;
+ req->left = panning->left;
+ req->top = panning->top;
+ req->width = panning->width;
+ req->height = panning->height;
+ req->track_left = panning->track_left;
+ req->track_top = panning->track_top;
+ req->track_width = panning->track_width;
+ req->track_height = panning->track_height;
+ req->border_left = panning->border_left;
+ req->border_top = panning->border_top;
+ req->border_right = panning->border_right;
+ req->border_bottom = panning->border_bottom;
+
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+ rep.status = RRSetConfigFailed;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return rep.status;
+}
+
--
1.5.6
More information about the xorg
mailing list