[comp.windows.open-look] problem with tty subwindows

turtle@sciences.sdsu.EDU (Andrew Scherpbier) (12/19/90)

I have Openwin 2.0 on a SPARCstation 1 running 4.0.3c (mono)

While trying to get some experience with tty subwindows, I tried the
following little program:

----------BEGIN CODE------------
#include <xview/xview.h>
#include <xview/tty.h>

Frame	frame;
Tty	tty;

main(ac, av)
int	ac;
char	*av;
{
	xv_init(XV_INIT_ARGC_PTR_ARGV, &ac, av, NULL);
	frame = (Frame)xv_create(NULL, FRAME, NULL);
	tty = (Tty)xv_create(frame, TTY,
		WIN_ROWS,		34,
		WIN_COLUMNS,		80,
		NULL);
	window_fit(frame);
	xv_main_loop(frame);
}
----------END CODE--------------

This compiles and runs fine until I run 'vi' in the window!
It will dump core when the terminal is set to sun-cmd and
vi is started.  When I change the terminal type to just 'sun'
everything is fine.
DBX reports the error to be in 'ttysw_ansi_escape'
Anyone else seen this problem?  Known solutions?


Andrew "Race Turtle" Scherpbier, SysMgr
College of Sciences
San Diego State University
INET: turtle@sciences.sdsu.edu
UUCP: ...!uunet!ucsd!sdsu!sciences!turtle

jmck@norge.Eng.Sun.COM (John McKernan) (12/19/90)

turtle@sciences.sdsu.EDU (Andrew Scherpbier) writes:
>This compiles and runs fine until I run 'vi' in the window!
>It will dump core when the terminal is set to sun-cmd and
>vi is started.  When I change the terminal type to just 'sun'
>everything is fine.
>DBX reports the error to be in 'ttysw_ansi_escape'

Patient: "Doc, it hurts when I do this."
Doctor:  "Okay, don't do that."

The terminal type sun-cmd is for the cmdtool program, which has a
scrollbar.  When sun's vi is run in a cmdtool, vi turns the scrollbar
off. In a ttysw with the terminal type set to sun-cmd vi appearently
attempts to turn off a non-existent scrollbar leading to a crash. The
moral of the story is to set the terminal type correctly. Alternatively
you could use a termsw instead of a ttysw.

John McKernan.                                                     
Windows and Graphics Software, Sun Microsystems.                  jmck@sun.com

jcb@frisbee.Eng.Sun.COM (Jim Becker) (12/19/90)

jmck@norge.Eng.Sun.COM (John McKernan) writes:

    turtle@sciences.sdsu.EDU (Andrew Scherpbier) writes:
    >This compiles and runs fine until I run 'vi' in the window!
    >It will dump core when the terminal is set to sun-cmd and
    >vi is started.  When I change the terminal type to just 'sun'
    >everything is fine.
    >DBX reports the error to be in 'ttysw_ansi_escape'

    Patient: "Doc, it hurts when I do this."
    Doctor:  "Okay, don't do that."

    The terminal type sun-cmd is for the cmdtool program, which has a
    scrollbar.  When sun's vi is run in a cmdtool, vi turns the scrollbar
    off. In a ttysw with the terminal type set to sun-cmd vi appearently
    attempts to turn off a non-existent scrollbar leading to a crash. The
    moral of the story is to set the terminal type correctly. Alternatively
    you could use a termsw instead of a ttysw.

    John McKernan.                                                     
    Windows and Graphics Software, Sun Microsystems.                  jmck@sun.com


The recommended workaround to the problem that you are experiencing is
to create a TERMSW and set the object to the tty mode with the call:

	ttysw = xv_create(base_frame, TERMSW,   WIN_IS_CLIENT_PANE,
		  TTY_ARGV,			argv,
		  TTY_QUIT_ON_CHILD_DEATH,	TRUE,
		  TTY_CONSOLE,			become_console,
		  0);

	xv_set(ttysw, TERMSW_MODE, TTYSW_MODE_TYPE, 0);


Although  the code you originally wrote should perform correctly, this
isn't  the  case.  Therefore, this workaround is used to make the code
function correctly. 

Bottom line, it's our problem and we know about  it.  Sorry  that  you
have to work around it.


-Jim Becker 
 XView Group

--
--    
	 Jim Becker / jcb%frisbee@sun.com  / Sun Microsystems