Contributed by David Meleedy, this patch adds a '-windowid #' command- line option to xv, which was previously sorely lacking in command-line options. In any event, the practical upshot of all this is that you can use xv in conjunction with Plugger 3.2 to turn it into a Netscape plug-in. --- xv-3.10a.orig/xv.c +++ xv-3.10a/xv.c @@ -309,7 +309,11 @@ theScreen = DefaultScreen(theDisp); theCmap = DefaultColormap(theDisp, theScreen); - rootW = RootWindow(theDisp,theScreen); + if (spec_window) { + rootW = spec_window; + } else { + rootW = RootWindow(theDisp,theScreen); + } theGC = DefaultGC(theDisp,theScreen); theVisual = DefaultVisual(theDisp,theScreen); ncells = DisplayCells(theDisp, theScreen); @@ -950,7 +954,11 @@ dispDEEP = vinfo[best].depth; theScreen = vinfo[best].screen; - rootW = RootWindow(theDisp, theScreen); + if (spec_window) { + rootW = spec_window; + } else { + rootW = RootWindow(theDisp,theScreen); + } ncells = vinfo[best].colormap_size; theCmap = XCreateColormap(theDisp, rootW, theVisual, AllocNone); @@ -1184,6 +1192,14 @@ } } + else if (!argcmp(argv[i],"-windowid",3,0,&pm)) { + if (++i0 && data) XFree(data); + if (spec_window) { + i = XGetWindowProperty(theDisp, spec_window, resAtom, 0L, + (long) ((nleft+4+3)/4), + False, XA_STRING, &actType, &actFormat, + &nitems, &nleft, (unsigned char **) &data); + } else { i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L, (long) ((nleft+4+3)/4), False, XA_STRING, &actType, &actFormat, &nitems, &nleft, (unsigned char **) &data); + } if (i==Success && actType==XA_STRING && actFormat==8 && data) { def_resource = XrmGetStringDatabase((char *) data); XFree(data); --- xv-3.10a.orig/xv.h +++ xv-3.10a/xv.h @@ -563,7 +563,8 @@ #define RM_CBRICK 7 /* centered on a 'brick' bg */ #define RM_ECENTER 8 /* symmetrical tiled */ #define RM_ECMIRR 9 /* symmetrical mirror tiled */ -#define RM_MAX RM_ECMIRR +#define RM_UPLEFT 10 /* just in upper left corner */ +#define RM_MAX RM_UPLEFT /* values of colorMapMode */ @@ -613,7 +614,8 @@ #define RMB_CBRICK 8 #define RMB_ECENTER 9 #define RMB_ECMIRR 10 -#define RMB_MAX 11 +#define RMB_UPLEFT 11 +#define RMB_MAX 12 /* indicies into conv24MB */ @@ -935,7 +937,7 @@ WHERE unsigned int ncells, dispWIDE, dispHIGH, dispDEEP; WHERE unsigned int vrWIDE, vrHIGH, maxWIDE, maxHIGH; WHERE Colormap theCmap, LocalCmap; -WHERE Window rootW, mainW, vrootW; +WHERE Window spec_window, rootW, mainW, vrootW; WHERE GC theGC; WHERE u_long black, white, fg, bg, infofg, infobg; WHERE u_long hicol, locol; --- xv-3.10a.orig/xvctrl.c +++ xv-3.10a/xvctrl.c @@ -101,7 +101,8 @@ "Root: centered, warp", "Root: centered, brick", "Root: symmetrical tiled", - "Root: symmetrical mirrored" }; + "Root: symmetrical mirrored", + "Root: upper left corner" }; static char *conv24MList[] = { "8-bit mode\t\2448", "24-bit mode\t\2448", --- xv-3.10a.orig/xvroot.c +++ xv-3.10a/xvroot.c @@ -44,6 +44,7 @@ case RM_MIRROR: case RM_IMIRROR: rpixw = 2*eWIDE; rpixh = 2*eHIGH; break; case RM_CSOLID: + case RM_UPLEFT: case RM_CWARP: case RM_CBRICK: rpixw = dispWIDE; rpixh = dispHIGH; break; @@ -101,7 +102,7 @@ else if (rmode == RM_CENTER || rmode == RM_CENTILE || rmode == RM_CSOLID || - rmode == RM_CWARP || rmode == RM_CBRICK) { + rmode == RM_CWARP || rmode == RM_CBRICK || rmode == RM_UPLEFT) { /* do some stuff to set up the border around the picture */ if (rmode != RM_CENTILE) { @@ -138,6 +139,12 @@ else if (rmode == RM_CSOLID) { } + else if (rmode == RM_UPLEFT) { + + XPutImage(theDisp, tmpPix, theGC, theImage, 0,0, 0,0, + (u_int) eWIDE, (u_int) eHIGH); + } + else if (rmode == RM_CWARP) { /* warp effect */ XSetForeground(theDisp, theGC, rootfg); for (i=0; i<=dispWIDE; i+=8) @@ -157,7 +164,7 @@ /* draw the image centered on top of the background */ - if (rmode != RM_CENTILE) + if ((rmode != RM_CENTILE) && (rmode != RM_UPLEFT)) XPutImage(theDisp, tmpPix, theGC, theImage, 0,0, ((int) dispWIDE-eWIDE)/2, ((int) dispHIGH-eHIGH)/2, (u_int) eWIDE, (u_int) eHIGH);