home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!sun-barr!newstop!exodus!appserv!grip.cis.upenn.edu
- From: bradley@grip.cis.upenn.edu (John Bradley)
- Newsgroups: comp.sources.x
- Subject: v10i089: xv - display and manipulate images, Patch3, Part01/01
- Message-ID: <332@appserv.Eng.Sun.COM>
- Date: 1 Dec 90 08:21:21 GMT
- References: <csx-10i089:xv@uunet.UU.NET>
- Sender: news@exodus.Eng.Sun.COM
- Lines: 511
- Approved: argv@sun.com
-
- Submitted-by: bradley@grip.cis.upenn.edu (John Bradley)
- Posting-number: Volume 10, Issue 89
- Archive-name: xv/patch3
- Patch-To: xv: Volume 10, Issue 79-88
-
- The following takes XV from patchlevel 2 to patchlevel 3. Apply with
- 'patch -p <patch3'.
-
- Please reread the README file after applying this patch.
-
- Changes since patchlevel 2:
- ---------------------------
- Changed 'CCOPTIONS' to 'DEFINES' in Imakefile
-
- Fixes for use with virtual root window managers (ie, tvtwm)
- (only cares about virtual root when using '-root' option,
- negative geometry's correctly handled.)
- (Andreas Stolcke (stolcke@ICSI.Berkeley.EDU))
-
- Modifications for Sequent machines (no 'mem*() routines)
- (Daniel Pommert (daniel@ux1.cso.uiuc.edu))
-
- Modifications to avoid bug in certain optimizers, most notably the default
- optimization (-O) in Sun's C compiler. (Incorrectly handles lines of the
- sort "*p = array[*p]")
-
- Modification to get around 'when I shift my arrow keys (to adjust the
- cropping rectangle), my keyboard generates numbers instead' problem
- (Mark Horstman (mh2620@sarek.sbc.com)
-
- Modification to allow 'xsetroot' and 'xloadimage' to cleanup any
- xv-displayed images in the root window, and vice-versa.
- (suggestion from Richard Bingle (bingle@cs.purdue.edu))
- --------------------------
-
- John Bradley - GRASP Lab - University of Pennsylvania
-
- --------------------(cut here)---------------------
- *** ../xv.dist2/Imakefile Mon Nov 26 18:47:35 1990
- --- ./Imakefile Thu Nov 29 14:27:51 1990
- ***************
- *** 26,31 ****
- --- 26,35 ----
- */
- /* BROKECOLS = -DBROKEFREECOLS */
-
- + /* If your machine doesn't have the 'strchr', 'memset' and 'memcpy'
- + * functions, but does have 'bcopy', uncomment the following line:
- + */
- + /* USEMEM= -DNEED_MEMROUTINES */
-
- /* IF YOUR MACHINE DOESN'T HAVE 'vprintf()' OR 'vsprintf()'
- *
- ***************
- *** 77,83 ****
- SYS_LIBRARIES= $(XLIB) -lm
- #endif
-
- ! CCOPTIONS= $(UNIX) $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT)
-
- SYS_LIBRARIES= -lX11 -lm
-
- --- 81,88 ----
- SYS_LIBRARIES= $(XLIB) -lm
- #endif
-
- ! DEFINES= $(DEFINES) $(UNIX) $(NEED_DIRENT) $(BROKECOLS) \
- ! $(VPRINTF) $(TIMERS) $(ATT) $(USEMEM)
-
- SYS_LIBRARIES= -lX11 -lm
-
-
- *** ../xv.dist2/Makefile Mon Nov 26 19:34:33 1990
- --- ./Makefile Thu Nov 29 13:07:07 1990
- ***************
- *** 31,36 ****
- --- 31,40 ----
- #
- #BROKECOLS = -DBROKEFREECOLS
-
- + # If your machine doesn't have the 'strchr', 'memset' and 'memcpy' functions,
- + # but does have 'bcopy', uncomment the following line:
- + #
- + #USEMEM = -DNEED_MEMROUTINES
-
- # IF YOUR MACHINE DOESN'T HAVE 'vprintf()' OR 'vsprintf()'
- #
- ***************
- *** 87,94 ****
- #
-
-
- ! CFLAGS = -O2 $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT) $(SCO) \
- ! $(UNIX)
-
- LIBS = -lX11 -lm
-
- --- 91,98 ----
- #
-
-
- ! CFLAGS = -O $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT) $(SCO) \
- ! $(UNIX) $(USEMEM)
-
- LIBS = -lX11 -lm
-
-
-
- *** ../xv.dist2/Makefile.std Mon Nov 26 18:47:54 1990
- --- ./Makefile.std Thu Nov 29 13:06:53 1990
- ***************
- *** 31,36 ****
- --- 31,40 ----
- #
- #BROKECOLS = -DBROKEFREECOLS
-
- + # If your machine doesn't have the 'strchr', 'memset' and 'memcpy' functions,
- + # but does have 'bcopy', uncomment the following line:
- + #
- + #USEMEM = -DNEED_MEMROUTINES
-
- # IF YOUR MACHINE DOESN'T HAVE 'vprintf()' OR 'vsprintf()'
- #
- ***************
- *** 88,94 ****
-
-
- CFLAGS = -O $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT) $(SCO) \
- ! $(UNIX)
-
- LIBS = -lX11 -lm
-
- --- 92,98 ----
-
-
- CFLAGS = -O $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT) $(SCO) \
- ! $(UNIX) $(USEMEM)
-
- LIBS = -lX11 -lm
-
-
- *** ../xv.dist2/PATCHLEVEL Mon Nov 26 18:55:42 1990
- --- ./PATCHLEVEL Thu Nov 29 13:48:36 1990
- ***************
- *** 1,4 ****
- ! Current patchlevel: 2
-
- Rev: 10/9/90 (patchlevel 0 - initial release)
-
- --- 1,4 ----
- ! Current patchlevel: 3
-
- Rev: 10/9/90 (patchlevel 0 - initial release)
-
- ***************
- *** 33,39 ****
-
- fixed problem with using '-max' and '-fixed' at same time
- (Greg Spencer greg@longs.lance.colostate.edu)
- -
- modification to work with Virtual Root Windows (ala swm and tvtwm)
- (Bill Kucharski kucharsk@solbourne.com)
-
- --- 33,38 ----
- ***************
- *** 56,58 ****
- --- 55,84 ----
- AutoCrop command added: (Crops out solid borders.)
-
- Potential support for 32-bit displays. (Hasn't been tested. Don't have one.)
- +
- +
- + Rev: 11/29/90 (patchlevel 3)
- + -----------------------------
- +
- + Changed 'CCOPTIONS' to 'DEFINES' in Imakefile
- +
- + Fixes for use with virtual root window managers (ie, tvtwm)
- + (only cares about virtual root when using '-root' option,
- + negative geometry's correctly handled.)
- + (Andreas Stolcke (stolcke@ICSI.Berkeley.EDU))
- +
- + Modifications for Sequent machines (no 'mem*() routines)
- + (Daniel Pommert (daniel@ux1.cso.uiuc.edu))
- +
- + Modifications to avoid bug in certain optimizers, most notably the default
- + optimization (-O) in Sun's C compiler. (Incorrectly handles lines of the
- + sort "*p = array[*p]")
- +
- + Modification to get around 'when I shift my arrow keys (to adjust the
- + cropping rectangle), my keyboard generates numbers instead' problem
- + (Mark Horstman (mh2620@sarek.sbc.com)
- +
- + Modification to allow 'xsetroot' and 'xloadimage' to cleanup any
- + xv-displayed images in the root window, and vice-versa.
- + (Richard Bingle (bingle@cs.purdue.edu))
- +
-
-
-
- *** ../xv.dist2/README Mon Nov 26 18:47:45 1990
- --- ./README Thu Nov 29 13:46:00 1990
- ***************
- *** 13,18 ****
- --- 13,24 ----
- Otherwise, check the Imakefile, and make the program however you normally
- would. Be sure to 'make depend' before building the program.
-
- + NOTE: If you like the program and decide to use it, *please* send me a short
- + email message to that effect. Be sure to mention the full name of your
- + organization. When our sponsors ask us 'what have you been doing', it would
- + be most handy to be able to come up with a nice long list of organizations
- + that are using code developed in the GRASP Lab. Brownie points, as it were.
- +
- Caveats
- -------
-
-
-
- *** ../xv.dist2/vprintf.c Mon Nov 26 18:48:11 1990
- --- ./vprintf.c Thu Nov 29 12:57:53 1990
- ***************
- *** 1,7 ****
- - #ifdef NEED_VPRINTF
- -
- #include <stdio.h>
-
- /* Portable vsprintf by Robert A. Larson <blarson@skat.usc.edu> */
- /* Portable vfprintf by Robert A. Larson <blarson@skat.usc.edu> */
-
- --- 1,6 ----
- #include <stdio.h>
-
- + #ifdef NEED_VPRINTF
- /* Portable vsprintf by Robert A. Larson <blarson@skat.usc.edu> */
- /* Portable vfprintf by Robert A. Larson <blarson@skat.usc.edu> */
-
- ***************
- *** 304,306 ****
- --- 303,346 ----
- }
-
- #endif
- +
- +
- +
- +
- +
- +
- +
- + #ifdef NEED_MEMROUTINES
- +
- + #include <sys/types.h>
- +
- + char *strchr(s1,c)
- + char *s1;
- + int c;
- + {
- + char *p;
- +
- + p=s1;
- + while(*p)
- + if(*(p++) == c)
- + return p-1;
- +
- + return NULL;
- + }
- +
- +
- + void *memset(s,c,n)
- + char *s;
- + int c;
- + size_t n;
- + {
- + char *p;
- +
- + for (p=s; n--;)
- + *(p++) = c;
- +
- + return;
- + }
- +
- + #endif /* NEED_MEMROUTINES */
- +
-
-
-
- *** ../xv.dist2/xv.c Mon Nov 26 19:35:12 1990
- --- ./xv.c Thu Nov 29 13:44:53 1990
- ***************
- *** 445,473 ****
- dispDEEP = DisplayPlanes(theDisp,theScreen);
-
-
- ! /* go look for a virtual root */
- ! __SWM_VROOT = XInternAtom(theDisp, "__SWM_VROOT", False);
- ! XQueryTree(theDisp, rootW, &rootReturn, &parentReturn, &children,
- ! &numChildren);
- ! for (i = 0; i < numChildren; i++) {
- ! Atom actual_type;
- ! int actual_format;
- ! unsigned long nitems, bytesafter;
- ! Window *newRoot = NULL;
- ! XWindowAttributes xwa;
- ! if (XGetWindowProperty (theDisp, children[i], __SWM_VROOT, 0, 1,
- False, XA_WINDOW, &actual_type, &actual_format, &nitems,
- &bytesafter, (unsigned char **) &newRoot) == Success && newRoot) {
- ! rootW = *newRoot;
- ! XGetWindowAttributes(theDisp, rootW, &xwa);
- ! dispWIDE = xwa.width; dispHIGH = xwa.height;
- ! dispDEEP = xwa.depth;
- ! break;
- }
- - }
-
- /* have enough info to do a '-clear' now */
- - if (clrroot || useroot) {
- KillOldRootInfo();
- XSetWindowBackgroundPixmap(theDisp, rootW, None);
- XClearWindow(theDisp, rootW);
- --- 445,473 ----
- dispDEEP = DisplayPlanes(theDisp,theScreen);
-
-
- ! if (clrroot || useroot) {
- ! /* go look for a virtual root */
- ! __SWM_VROOT = XInternAtom(theDisp, "__SWM_VROOT", False);
- ! XQueryTree(theDisp, rootW, &rootReturn, &parentReturn, &children,
- ! &numChildren);
- ! for (i = 0; i < numChildren; i++) {
- ! Atom actual_type;
- ! int actual_format;
- ! unsigned long nitems, bytesafter;
- ! Window *newRoot = NULL;
- ! XWindowAttributes xwa;
- ! if (XGetWindowProperty (theDisp, children[i], __SWM_VROOT, 0, 1,
- False, XA_WINDOW, &actual_type, &actual_format, &nitems,
- &bytesafter, (unsigned char **) &newRoot) == Success && newRoot) {
- ! rootW = *newRoot;
- ! XGetWindowAttributes(theDisp, rootW, &xwa);
- ! dispWIDE = xwa.width; dispHIGH = xwa.height;
- ! dispDEEP = xwa.depth;
- ! break;
- ! }
- }
-
- /* have enough info to do a '-clear' now */
- KillOldRootInfo();
- XSetWindowBackgroundPixmap(theDisp, rootW, None);
- XClearWindow(theDisp, rootW);
- ***************
- *** 1306,1315 ****
- stlen = XLookupString(key_event,buf,128,&ks,&status);
-
- /* do non-character processing (arrow-keys, that is) */
- ! if (ks==XK_Left) CropKey(-1, 0, key_event->state & ShiftMask);
- ! else if (ks==XK_Right) CropKey( 1, 0, key_event->state & ShiftMask);
- ! else if (ks==XK_Up) CropKey( 0,-1, key_event->state & ShiftMask);
- ! else if (ks==XK_Down) CropKey( 0, 1, key_event->state & ShiftMask);
-
- if (!stlen) break;
-
- --- 1306,1319 ----
- stlen = XLookupString(key_event,buf,128,&ks,&status);
-
- /* do non-character processing (arrow-keys, that is) */
- ! if (ks==XK_Left || ks==XK_KP_4)
- ! { stlen = 0; CropKey(-1, 0, key_event->state & ShiftMask); }
- ! else if (ks==XK_Right || ks==XK_KP_6)
- ! { stlen = 0; CropKey( 1, 0, key_event->state & ShiftMask); }
- ! else if (ks==XK_Up || ks==XK_KP_8)
- ! { stlen = 0; CropKey( 0,-1, key_event->state & ShiftMask); }
- ! else if (ks==XK_Down || ks==XK_KP_2)
- ! { stlen = 0; CropKey( 0, 1, key_event->state & ShiftMask); }
-
- if (!stlen) break;
-
- ***************
- *** 2147,2154 ****
- riPix = XCreatePixmap(theDisp, rootW, 1, 1, 1);
- if (!riPix) return; /* unable to save. thankfully, unlikely to happen */
-
- ! prop = XInternAtom(theDisp, "_XV_PIXMAP", False);
- ! if (!prop) FatalError("couldn't create _XV_PIXMAP atom");
-
- XChangeProperty(theDisp, rootW, prop, XA_PIXMAP, 32, PropModeReplace,
- (unsigned char *) &riPix, 1);
- --- 2151,2158 ----
- riPix = XCreatePixmap(theDisp, rootW, 1, 1, 1);
- if (!riPix) return; /* unable to save. thankfully, unlikely to happen */
-
- ! prop = XInternAtom(theDisp, "_XSETROOT_ID", False);
- ! if (!prop) FatalError("couldn't create _XSETROOT_ID atom");
-
- XChangeProperty(theDisp, rootW, prop, XA_PIXMAP, 32, PropModeReplace,
- (unsigned char *) &riPix, 1);
- ***************
- *** 2160,2166 ****
- /***********************************/
- static void KillOldRootInfo()
- {
- ! /* get the pixmap ID from the _XV_PIXMAP property, and kill it */
-
- Atom prop, type;
- int format;
- --- 2164,2170 ----
- /***********************************/
- static void KillOldRootInfo()
- {
- ! /* get the pixmap ID from the _XSETROOT_ID property, and kill it */
-
- Atom prop, type;
- int format;
- ***************
- *** 2167,2173 ****
- unsigned long length, after;
- unsigned char *data;
-
- ! prop = XInternAtom(theDisp, "_XV_PIXMAP", True);
- if (!prop) return; /* no old pixmap to kill */
-
- if (XGetWindowProperty(theDisp, rootW, prop, 0L, 1L, True, AnyPropertyType,
- --- 2171,2177 ----
- unsigned long length, after;
- unsigned char *data;
-
- ! prop = XInternAtom(theDisp, "_XSETROOT_ID", True);
- if (!prop) return; /* no old pixmap to kill */
-
- if (XGetWindowProperty(theDisp, rootW, prop, 0L, 1L, True, AnyPropertyType,
-
-
-
- *** ../xv.dist2/xv.h Mon Nov 26 19:16:26 1990
- --- ./xv.h Thu Nov 29 13:45:35 1990
- ***************
- *** 16,22 ****
- * This software is provided "as is" without any express or implied warranty.
- */
-
- ! #define REVDATE "Rev: 11/26/90 (Patchlevel 2)"
-
- #ifdef SVR4 /* SysV release 4 uses dirent */
- #ifndef sgi /* but Silicon Graphics doesn't */
- --- 16,22 ----
- * This software is provided "as is" without any express or implied warranty.
- */
-
- ! #define REVDATE "Rev: 11/29/90 (Patchlevel 3)"
-
- #ifdef SVR4 /* SysV release 4 uses dirent */
- #ifndef sgi /* but Silicon Graphics doesn't */
- ***************
- *** 45,50 ****
- --- 45,55 ----
- #else
- #include <malloc.h>
- #endif
- + #endif
- +
- +
- + #if defined(NEED_MEMROUTINES)
- + #define memcpy(d,s,l) bcopy(s,d,l)
- #endif
-
-
- *** ../xv.dist2/xvmisc.c Mon Nov 26 19:12:52 1990
- --- ./xvmisc.c Thu Nov 29 13:53:22 1990
- ***************
- *** 76,83 ****
-
- hints.flags |= USSize;
-
- ! if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
- ! if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
-
- hints.x = x; hints.y = y;
- hints.width = w; hints.height = h;
- --- 76,85 ----
-
- hints.flags |= USSize;
-
- ! if (i&XValue && i&XNegative)
- ! x = DisplayWidth(theDisp,theScreen) - w - abs(x);
- ! if (i&YValue && i&YNegative)
- ! y = DisplayHeight(theDisp,theScreen) - h - abs(y);
-
- hints.x = x; hints.y = y;
- hints.width = w; hints.height = h;
- ***************
- *** 297,303 ****
- for (i=0; i<numcols; i++) trans[ c1[i].oldindex ] = i;
-
- /* modify 'pic' to reflect the new colormap */
- ! for (i=pWIDE*pHIGH, p=pic; i; i--, p++) *p = trans[*p];
-
- /* and copy the new colormap into *the* colormap */
- for (i=0; i<numcols; i++) {
- --- 299,305 ----
- for (i=0; i<numcols; i++) trans[ c1[i].oldindex ] = i;
-
- /* modify 'pic' to reflect the new colormap */
- ! for (i=pWIDE*pHIGH, p=pic; i; i--, p++) { j = trans[*p]; *p = j; }
-
- /* and copy the new colormap into *the* colormap */
- for (i=0; i<numcols; i++) {
-
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
- --
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-