? Makefile ? t.tmp ? xscope ? xscope-support-shape-extension.patch ? xscope.1x-html ? xscope._man Index: Imakefile =================================================================== RCS file: /local/src/CVS/xscope/Imakefile,v retrieving revision 1.3 diff -u -p -r1.3 Imakefile --- Imakefile 1 Jan 2002 07:51:45 -0000 1.3 +++ Imakefile 3 Aug 2005 07:48:30 -0000 @@ -37,13 +37,13 @@ decode_lbx.c print_lbx.c printnas.c decodenas.c \ decode_wcp.c print_wcp.c decode_render.c print_render.c \ decode_randr.c print_randr.c decode_shm.c print_shm.c \ - decode_bigreq.c print_bigreq.c $(PEX_SRC) + decode_bigreq.c print_bigreq.c decode_shape.c print_shape.c $(PEX_SRC) OBJS = scope.o common.o fd.o server.o decode11.o \ table11.o print11.o prtype.o audio.o \ decode_lbx.o print_lbx.o printnas.o decodenas.o \ decode_wcp.o print_wcp.o decode_render.o print_render.o \ decode_randr.o print_randr.o decode_shm.o print_shm.o \ - decode_bigreq.o print_bigreq.o $(PEX_OBJ) + decode_bigreq.o print_bigreq.o decode_shape.o print_shape.o $(PEX_OBJ) ComplexProgramTarget(xscope) SpecialObjectRule(common.o,$(_NOOP_),$(SIGNAL_DEFINES)) Index: decode11.c =================================================================== RCS file: /local/src/CVS/xscope/decode11.c,v retrieving revision 1.3 diff -u -p -r1.3 decode11.c --- decode11.c 1 Jan 2002 07:51:45 -0000 1.3 +++ decode11.c 3 Aug 2005 07:48:31 -0000 @@ -315,6 +315,10 @@ extern unsigned char MITSHMEvent; extern unsigned char LookForBIGREQFlag; extern unsigned char BIGREQRequest; +extern unsigned char LookForSHAPEFlag; +extern unsigned char SHAPERequest; +extern unsigned char SHAPEEvent; + DecodeRequest(fd, buf, n) FD fd; unsigned char *buf; @@ -372,6 +376,8 @@ DecodeRequest(fd, buf, n) mitshm_decode_req(fd,buf); } else if (Request == BIGREQRequest) { bigreq_decode_req(fd,buf); + } else if (Request == SHAPERequest) { + shape_decode_req(fd,buf); } else { ExtendedRequest(fd, buf); @@ -726,6 +732,9 @@ DecodeRequest(fd, buf, n) if (strncmp ("BIG-REQUESTS",(char *)&buf[8],12) == 0) LookForBIGREQFlag=1; + if (strncmp ("SHAPE",(char *)&buf[8],5) == 0) + LookForSHAPEFlag=1; + ReplyExpected(fd, Request); break; case 99: @@ -853,6 +862,8 @@ DecodeReply(fd, buf, n) mitshm_decode_reply(fd, buf, RequestMinor); else if (Request == BIGREQRequest) bigreq_decode_reply(fd, buf, RequestMinor); + else if (Request == SHAPERequest) + shape_decode_reply(fd, buf, RequestMinor); else if (Request < 0 || 127 < Request) warn("Extended reply opcode"); else switch (Request) @@ -1115,6 +1126,8 @@ DecodeEvent(fd, buf, n) randr_decode_event (fd, buf); else if (Event == MITSHMEvent) mitshm_decode_event (fd, buf); + else if (Event == SHAPEEvent) + shape_decode_event (fd, buf); else if (Event < 2 || Event > 34) warn("Extended Event code"); else switch (Event) Index: decode_shape.c =================================================================== RCS file: decode_shape.c diff -N decode_shape.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ decode_shape.c 3 Aug 2005 07:48:31 -0000 @@ -0,0 +1,118 @@ +/* + * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Keith Packard and Red Hat not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Keith Packard and Red Hat make + * no representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD AND RED HAT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD OR RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + +#include +#include +#include +#include "scope.h" +#include "x11.h" +#include "shapescope.h" + +unsigned char LookForSHAPEFlag; + +unsigned char SHAPERequest, SHAPEError, SHAPEEvent; + +void +shape_decode_req(FD fd, unsigned char *buf) +{ + short Major = IByte (&buf[0]); + short Minor = IByte (&buf[1]); + + switch (Minor) { + case 0: ShapeQueryVersion (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 1: ShapeRectangles (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 2: ShapeMask (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 3: ShapeCombine (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 4: ShapeOffset (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 5: ShapeQueryExtents (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 6: ShapeSelectInput (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 7: ShapeInputSelected (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 8: ShapeGetRectangles (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + default: + break; + } +} + +void +shape_decode_reply(FD fd, unsigned char *buf, short RequestMinor) +{ + switch (RequestMinor) { + case 0: ShapeQueryVersionReply (fd, buf); break; + case 5: ShapeQueryExtentsReply (fd, buf); break; + case 7: ShapeInputSelectedReply (fd, buf); break; + case 8: ShapeGetRectanglesReply (fd, buf); break; + default: + break; + } +} + +void +shape_decode_event (FD fd, unsigned char *buf) +{ + ShapeShapeNotifyEvent (buf); +} + +void +InitializeSHAPE(unsigned char *buf) +{ + TYPE p, DefineType (); + + SHAPERequest = (unsigned char)(buf[9]); + SHAPEEvent = (unsigned char)(buf[10]); + SHAPEError = (unsigned char)(buf[11]); + LookForSHAPEFlag = 0; + + DefineEValue (&TD[REQUEST], (unsigned long) SHAPERequest, "ShapeRequest"); + DefineEValue (&TD[REPLY], (unsigned long) SHAPERequest, "ShapeReply"); + DefineEValue (&TD[EVENT], (unsigned long) SHAPEEvent, "ShapeNotify"); + + p = DefineType(SHAPEREQUEST, ENUMERATED, "SHAPEREQUEST", PrintENUMERATED); + DefineEValue(p, 0L, "ShapeQueryVersion"); + DefineEValue(p, 1L, "ShapeRectangles"); + DefineEValue(p, 2L, "ShapeMask"); + DefineEValue(p, 3L, "ShapeCombine"); + DefineEValue(p, 4L, "ShapeOffset"); + DefineEValue(p, 5L, "ShapeQueryExtents"); + DefineEValue(p, 6L, "ShapeSelectInput"); + DefineEValue(p, 7L, "ShapeInputSelected"); + DefineEValue(p, 8L, "ShapeGetRectangles"); + + p = DefineType(SHAPEREPLY, ENUMERATED, "SHAPEREPLY", PrintENUMERATED); + DefineEValue (p, 0L, "ShapeQueryVersion"); + DefineEValue (p, 5L, "ShapeQueryExtents"); + DefineEValue (p, 7L, "ShapeInputSelected"); + DefineEValue (p, 8L, "ShapeGetRectangles"); + + p = DefineType(SHAPEOP, ENUMERATED, "SHAPEOP", PrintENUMERATED); + DefineEValue (p, 0L, "Set"); + DefineEValue (p, 1L, "Union"); + DefineEValue (p, 2L, "Intersect"); + DefineEValue (p, 3L, "Subtract"); + DefineEValue (p, 4L, "Invert"); + + p = DefineType(SHAPEKIND, ENUMERATED, "SHAPEKIND", PrintENUMERATED); + DefineEValue (p, 0L, "Bounding"); + DefineEValue (p, 1L, "Clip"); + DefineEValue (p, 2L, "Input"); +} Index: print11.c =================================================================== RCS file: /local/src/CVS/xscope/print11.c,v retrieving revision 1.3 diff -u -p -r1.3 print11.c --- print11.c 1 Jan 2002 07:51:45 -0000 1.3 +++ print11.c 3 Aug 2005 07:48:32 -0000 @@ -3288,6 +3288,7 @@ QueryExtensionReply(buf) extern unsigned char LookForRANDRFlag; extern unsigned char LookForMITSHMFlag; extern unsigned char LookForBIGREQFlag; + extern unsigned char LookForSHAPEFlag; #ifdef PEX extern unsigned char LookForPEXFlag; extern unsigned char PEXCode; @@ -3317,6 +3318,9 @@ QueryExtensionReply(buf) if (LookForBIGREQFlag) { InitializeBIGREQ(buf); } + if (LookForSHAPEFlag) { + InitializeSHAPE(buf); + } PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* QueryExtension */ ; if (Verbose < 1) return; Index: print_shape.c =================================================================== RCS file: print_shape.c diff -N print_shape.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ print_shape.c 3 Aug 2005 07:48:32 -0000 @@ -0,0 +1,297 @@ +/* + * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Keith Packard and Red Hat not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Keith Packard and Red Hat make + * no representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD AND RED HAT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD OR RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "scope.h" +#include "x11.h" +#include "shapescope.h" + +void +ShapeQueryVersion (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField(SBf, 0, 4, CARD32, "sequence number"); + + printfield(buf, 2, 2, CONST2(2), "request length"); +} + +void +ShapeQueryVersionReply (FD fd, unsigned char *buf) +{ + PrintField (RBf, 0, 1, REPLY, REPLYHEADER); + PrintField (RBf, 1, 1, SHAPEREPLY, SHAPEREPLYHEADER); + + if (Verbose < 1) + return; + + printfield (buf, 2, 2, CARD16, "sequence number"); + printfield (buf, 4, 4, DVALUE4(0), "reply length"); + PrintField (buf, 8, 2, CARD16, "major version"); + PrintField (buf, 10, 2, CARD16, "minor version"); +} + +void +ShapeRectangles (FD fd, unsigned char *buf) +{ + short n; + + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, DVALUE2(4 + 2*n), "request length"); + + PrintField (buf, 4, 1, SHAPEOP, "shape op"); + PrintField (buf, 5, 1, SHAPEKIND, "dest kind"); + PrintField (buf, 6, 1, RECTORDER, "ordering"); + PrintField (buf, 8, 4, WINDOW, "dest window"); + PrintField (buf, 12, 2, INT16, "x offset"); + PrintField (buf, 14, 2, INT16, "y offset"); + + n = (IShort (&buf[2]) - 4) / 2; + PrintList (&buf[16], n, RECTANGLE, "rectangles"); +} + +void +ShapeMask (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(5), "request length"); + + PrintField (buf, 4, 1, SHAPEOP, "shape op"); + PrintField (buf, 5, 1, SHAPEKIND, "dest kind"); + PrintField (buf, 8, 4, WINDOW, "dest window"); + PrintField (buf, 12, 2, INT16, "x offset"); + PrintField (buf, 14, 2, INT16, "y offset"); + PrintField (buf, 16, 4, PIXMAP, "source bitmap"); +} + +void +ShapeCombine (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField(SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(5), "request length"); + + PrintField (buf, 4, 1, SHAPEOP, "operation"); + PrintField (buf, 5, 1, SHAPEKIND, "dest kind"); + PrintField (buf, 8, 4, WINDOW, "dest window"); + PrintField (buf, 12, 2, INT16, "x offset"); + PrintField (buf, 14, 2, INT16, "y offset"); + PrintField (buf, 16, 4, WINDOW, "source window"); +} + +void +ShapeOffset (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(4), "request length"); + + PrintField (buf, 4, 1, SHAPEKIND, "dest kind"); + PrintField (buf, 8, 4, WINDOW, "dest window"); + PrintField (buf, 12, 2, INT16, "x offset"); + PrintField (buf, 14, 2, INT16, "y offset"); +} + +void +ShapeQueryExtents (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(2), "request length"); + + PrintField (buf, 4, 4, WINDOW, "dest window"); +} + +void +ShapeQueryExtentsReply (FD fd, unsigned char *buf) +{ + PrintField (RBf, 0, 1, REPLY, REPLYHEADER); + PrintField (RBf, 1, 1, SHAPEREPLY, SHAPEREPLYHEADER); + + if (Verbose < 1) + return; + + printfield (buf, 2, 2, CARD16, "sequence number"); + printfield (buf, 4, 4, DVALUE4(0), "reply length"); + + PrintField (buf, 8, 1, BOOL, "bounding shaped"); + PrintField (buf, 9, 1, BOOL, "clip shaped"); + PrintField (buf, 12, 2, INT16, "bounding shape extents x"); + PrintField (buf, 14, 2, INT16, "bounding shape extents y"); + PrintField (buf, 16, 2, CARD16, "bounding shape extents width"); + PrintField (buf, 18, 2, CARD16, "bounding shape extents height"); + PrintField (buf, 20, 2, INT16, "clip shape extents x"); + PrintField (buf, 22, 2, INT16, "clip shape extents y"); + PrintField (buf, 24, 2, CARD16, "clip shape extents width"); + PrintField (buf, 26, 2, CARD16, "clip shape extents height"); +} + +void +ShapeSelectInput (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 3, CONST2(2), "request length"); + + PrintField (buf, 4, 4, WINDOW, "dest window"); + PrintField (buf, 8, 1, BOOL, "enable"); +} + +void +ShapeInputSelected (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(2), "request length"); + + PrintField (buf, 4, 4, WINDOW, "dest window"); +} + +void +ShapeInputSelectedReply (FD fd, unsigned char *buf) +{ + PrintField (RBf, 0, 1, REPLY, REPLYHEADER); + PrintField (RBf, 1, 1, SHAPEREPLY, SHAPEREPLYHEADER); + + if (Verbose < 1) + return; + + PrintField (buf, 1, 1, BOOL, "enabled"); + + printfield (buf, 2, 2, CARD16, "sequence number"); + printfield (buf, 4, 4, DVALUE4(0), "reply length"); +} + +void +ShapeGetRectangles (FD fd, unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER); + PrintField (buf, 1, 1, SHAPEREQUEST, SHAPEREQUESTHEADER); + + if (Verbose < 1) + return; + + if (Verbose > 1) + PrintField (SBf, 0, 4, CARD32, "sequence number"); + + printfield (buf, 2, 2, CONST2(3), "request length"); + + PrintField (buf, 4, 4, WINDOW, "window"); + PrintField (buf, 8, 1, SHAPEKIND, "shape kind"); +} + +void +ShapeGetRectanglesReply (FD fd, unsigned char *buf) +{ + long n; + + PrintField (RBf, 0, 1, REPLY, REPLYHEADER); + PrintField (RBf, 1, 1, SHAPEREPLY, SHAPEREPLYHEADER); + + if (Verbose < 1) + return; + + PrintField (buf, 1, 1, RECTORDER, "ordering"); + + printfield (buf, 2, 2, CARD16, "sequence number"); + printfield (buf, 4, 4, DVALUE4(2*n), "reply length"); + + n = ILong (&buf[8]); + PrintList (&buf[32], n, RECTANGLE, "rectangles"); +} + +void +ShapeShapeNotifyEvent (unsigned char *buf) +{ + PrintField (buf, 0, 1, EVENT, EVENTHEADER); + + if (Verbose < 1) + return; + + PrintField (buf, 1, 1, SHAPEKIND, "shape kind"); + + printfield (buf, 2, 2, CARD16, "sequence number"); + + PrintField (buf, 4, 4, WINDOW, "window"); + PrintField (buf, 8, 2, INT16, "extents x"); + PrintField (buf, 10, 2, INT16, "extents y"); + PrintField (buf, 12, 2, CARD16, "extents width"); + PrintField (buf, 14, 2, CARD16, "extents height"); + PrintField (buf, 16, 4, TIMESTAMP, "timestamp"); + PrintField (buf, 20, 1, BOOL, "shaped"); +} Index: shapescope.h =================================================================== RCS file: shapescope.h diff -N shapescope.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ shapescope.h 3 Aug 2005 07:48:32 -0000 @@ -0,0 +1,39 @@ +/* + * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Keith Packard and Red Hat not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Keith Packard and Red Hat make + * no representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD AND RED HAT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD OR RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _SHAPESCOPE_H_ +#define _SHAPESCOPE_H_ + +#define SHAPEREQUESTHEADER "SHAPEREQUEST" +#define SHAPEREPLYHEADER "SHAPEREPLY" +#define SHAPEEVENTHEADER "SHAPEEVENT" + +/* + To aid in making the choice between level 1 and level 2, we + define the following define, which does not print relatively + unimportant fields. +*/ + +#define printfield(a,b,c,d,e) if (Verbose > 1) PrintField(a,b,c,d,e) + +#endif Index: x11.h =================================================================== RCS file: /local/src/CVS/xscope/x11.h,v retrieving revision 1.3 diff -u -p -r1.3 x11.h --- x11.h 15 May 2002 05:26:19 -0000 1.3 +++ x11.h 3 Aug 2005 07:48:35 -0000 @@ -211,6 +211,11 @@ #define BIGREQREQUEST 157 #define BIGREQREPLY 158 +#define SHAPEREQUEST 159 +#define SHAPEREPLY 160 +#define SHAPEOP 161 +#define SHAPEKIND 162 + #define MaxTypes 256 extern char ScopeEnabled;