summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2000-09-28 17:45:43 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2000-09-28 17:45:43 +0000
commite995b18569ce73a7a310008dd827fbacb0506cb6 (patch)
treefc7020d3ebcece3911853ad9a805ef5e5240daa6 /sys/arch
parent53df278e27858755c165de3675a19e0b149a0c7d (diff)
Make mouse support friendly with non-25line mode. Thanks mickey@ for reporting
the problems.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_drv.c4
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_hdr.h4
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_out.c10
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_sup.c30
4 files changed, 40 insertions, 8 deletions
diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c
index 14ae52ecdc4..12beb84f7c1 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_drv.c,v 1.33 2000/09/28 15:44:50 aaron Exp $ */
+/* $OpenBSD: pcvt_drv.c,v 1.34 2000/09/28 17:45:42 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
@@ -296,7 +296,7 @@ pcclose(Dev_t dev, int flag, int mode, struct proc *p)
/* remove the selection at logout */
if (Copybuffer)
- bzero(Copybuffer, (vs[0].maxcol + 1) * vs[0].screen_rows);
+ bzero(Copybuffer, Copybuffer_size);
Paste_avail = 0;
return(0);
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
index f35f3b1b361..4f1f16f5f66 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_hdr.h,v 1.39 2000/09/22 17:39:05 aaron Exp $ */
+/* $OpenBSD: pcvt_hdr.h,v 1.40 2000/09/28 17:45:42 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -1012,6 +1012,7 @@ void set_2ndcharset ( void );
void set_charset ( struct video_state *svsp, int curvgacs );
void set_screen_size ( struct video_state *svsp, int size );
void reallocate_scrollbuffer ( struct video_state *svsp, int pages );
+void reallocate_copybuffer ( struct video_state *svsp );
u_char *sgetc ( int noblock );
void sixel_vga ( struct sixels *charsixel, u_char *charvga );
void sput ( u_char *s, U_char attrib, int len, int page );
@@ -1134,6 +1135,7 @@ static __inline void vt_selattr(struct video_state *svsp)
/* mouse console support prototype */
char *Copybuffer; /* buffer that contains mouse selections */
+unsigned int Copybuffer_size;
uid_t Copyowner; /* uid of the owner of the selection, useful for verifying
permissions on it
*/
diff --git a/sys/arch/i386/isa/pcvt/pcvt_out.c b/sys/arch/i386/isa/pcvt/pcvt_out.c
index 50ed63d20a8..c832d3d4bcc 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_out.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_out.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_out.c,v 1.26 2000/09/01 05:46:02 aaron Exp $ */
+/* $OpenBSD: pcvt_out.c,v 1.27 2000/09/28 17:45:42 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -1274,11 +1274,12 @@ vt_coldmalloc(void)
* need to write '\r' characters in the buffer (carriage return
*/
- if ((Copybuffer = (char *)malloc((vs[0].maxcol + 1) *
- vs[0].screen_rows, M_DEVBUF,
- M_WAITOK)) == NULL)
+ Copybuffer_size = (vs[0].maxcol + 1) * vs[0].screen_rows;
+ if ((Copybuffer = (char *)malloc(Copybuffer_size, M_DEVBUF, M_WAITOK))
+ == NULL)
{
printf("pcvt: copy memory malloc failed\n");
+ Copybuffer_size = 0;
}
for(nscr = 0; nscr < PCVT_NSCREENS; nscr++)
@@ -1408,6 +1409,7 @@ vt_col(struct video_state *svsp, int cols)
}
reallocate_scrollbuffer(svsp, scrollback_pages);
+ reallocate_copybuffer(svsp);
return(1);
}
diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c
index de0a56364d7..5c94032a94a 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_sup.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_sup.c,v 1.16 2000/02/27 20:34:36 aaron Exp $ */
+/* $OpenBSD: pcvt_sup.c,v 1.17 2000/09/28 17:45:42 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -713,6 +713,7 @@ set_screen_size(struct video_state *svsp, int size)
#endif /* PCVT_SIGWINCH */
reallocate_scrollbuffer(svsp, scrollback_pages);
+ reallocate_copybuffer(svsp);
break;
}
}
@@ -754,6 +755,33 @@ reallocate_scrollbuffer(struct video_state *svsp, int pages)
}
/*---------------------------------------------------------------------------*
+ * resize the copy buffer to accomodate largest current cols * rows
+ *---------------------------------------------------------------------------*/
+void
+reallocate_copybuffer(struct video_state *svsp)
+{
+ int newsize, s;
+
+ s = splhigh();
+
+ newsize = (svsp->maxcol + 1) * svsp->screen_rows;
+ if (newsize <= Copybuffer_size)
+ goto out;
+
+ if (Copybuffer)
+ free(Copybuffer, M_DEVBUF);
+
+ if ((Copybuffer = (char *)malloc(newsize, M_DEVBUF, M_NOWAIT)) == NULL){
+ printf("pcvt: copybuffer memory malloc failed\n");
+ Copybuffer_size = 0;
+ }
+
+ Copybuffer_size = newsize;
+out:
+ splx(s);
+}
+
+/*---------------------------------------------------------------------------*
* VGA ioctl - read DAC palette entry
*---------------------------------------------------------------------------*/
static void