Path: utzoo!utgpu!watserv1!watmath!att!news.cs.indiana.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: 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 /* Portable vsprintf by Robert A. Larson */ /* Portable vfprintf by Robert A. Larson */ --- 1,6 ---- #include + #ifdef NEED_VPRINTF /* Portable vsprintf by Robert A. Larson */ /* Portable vfprintf by Robert A. Larson */ *************** *** 304,306 **** --- 303,346 ---- } #endif + + + + + + + + #ifdef NEED_MEMROUTINES + + #include + + 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 #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