openbsd-ports/misc/screen/patches/shmpatch-window_c
2003-11-22 00:56:58 +00:00

64 lines
1.7 KiB
Plaintext

$OpenBSD: shmpatch-window_c,v 1.1 2003/11/22 00:56:58 espie Exp $
--- window.c.orig 2003-09-08 16:27:21.000000000 +0200
+++ window.c 2003-11-17 23:37:54.000000000 +0100
@@ -1993,6 +1993,59 @@ char *data;
}
}
+
+#ifdef IPC_EXPORT_IMAGE
+
+void
+CopyWinImage( p, dest )
+struct win *p;
+char *dest;
+{
+ register char *s, *d = dest, *m;
+ register int x, y;
+ struct display *display = p->w_pdisplay;
+ int st = (display) ? D_status : 0;
+
+ if( p && p->w_mlines )
+ {
+ *d++ = p->w_width; /* scrdim x */
+ *d++ = p->w_height; /* scrdim y */
+ *d++ = (st) ? D_status_len : p->w_x; /* csrpos x */
+ *d++ = (st) ? STATLINE : p->w_y; /* csrpos y */
+ /* copy window image to buffer */
+ for( y = 0; y < p->w_height; y++ )
+ {
+ s = p->w_mlines[y].image;
+ x = p->w_width;
+ if( st && y == STATLINE )
+ for( m = D_status_lastmsg; *m && x; *d++ = *m++, s++, x-- );
+ for( ; x; *d++ = *s++, x-- );
+ }
+ /* copy attributes from window image to buffer */
+ for( y = 0; y < p->w_height; y++ )
+ {
+ s = p->w_mlines[y].attr;
+ x = p->w_width;
+ if( st && y == STATLINE )
+ for( ; x; *d++ = 0, s++, x-- );
+ for( ; x; *d++ = *s++, x-- );
+ }
+ }
+ else
+ {
+ /* no window pointer */
+ *d++ = 80; /* scrdim x */
+ *d++ = 1; /* scrdim y */
+ *d++ = 0; /* csrpos x */
+ *d++ = 0; /* csrpos y */
+ strcpy( d, "*** screen: no window pointer ***" );
+ memset( d+strlen(d), ' ', 80);
+ }
+}
+
+#endif /* IPC_EXPORT_IMAGE */
+
+
#ifdef ZMODEM
static int