Path: utzoo!utgpu!jarvis.csri.toronto.edu!utcsri!me!radio!cks From: cks@radio.toronto.edu (Chris Siebenmann) Newsgroups: comp.sys.amiga Subject: Re: Shell 2.07 title bar hack Message-ID: <924@radio.toronto.edu> Date: 18 Jan 88 03:25:57 GMT Article-I.D.: radio.924 Posted: Sun Jan 17 22:25:57 1988 References: <1988Jan14.225923.6337@sq.uucp> Reply-To: cks@radio.toronto.edu (Chris Siebenmann) Organization: Newsaholics Anonymous Lines: 62 Keywords: D.I.Y. In article <1988Jan14.225923.6337@sq.uucp> hobie@sq.com (Hobie Orris) writes: ... > I couldn't find an elegant way for a task to find the address of the >CLI window it's running in, so this is sort of ugly. First of all, thanks for actually finding out what to do and where; having the current directory in the title bar is really nice. However, there's a better way to find the address of the CON:/RAW: window the shell is running in; documented very scantily in the AmigaDOS manuals is the fact that if you send a DiskInfo packet to your console handler, the id_VolumeNode field in the InfoData structure holds the desired window address (this has also been mentioned on the net a couple of times). So here's the needed code to do it in the proper way. [This goes in main.c, just before init()] #include #include #include extern struct Library *OpenLibrary(); struct Library *IntuitionBase; struct Window *wb_window; [This goes where Hobie's code did, right at the end of init()] wb_window = NULL; #if RAW_CONSOLE if ((IntuitionBase = OpenLibrary("intuition.library", 0L)) != NULL) { BPTR iLock; struct FileHandle *conF; struct InfoData *infTemp; extern long dos_packet(); iLock = (BPTR) Input(); conF = (struct FileHandle *) BADDR(iLock); infTemp = (struct InfoData *) malloc(sizeof(struct InfoData)); if (infTemp == 0) return; /* * Send the packet. */ if (!dos_packet(conF->fh_Type, ACTION_DISK_INFO, ((ULONG) infTemp) >> 2)) { free((void *) infTemp); return; } wb_window = (struct Window *) infTemp->id_VolumeNode; } #endif Hobie's other code stays the same, and works fine. People who wish to be thorough should probably check to make sure that Input() is interactive; I didn't bother because I was feeling lazy when I wrote the code. -- "Don't worry... Won't insult legendary underworld solidarity by suggesting you surrender name without torture." Chris Siebenmann {allegra,mnetor,decvax,pyramid}!utgpu!radio!cks cks@radio.toronto.edu or ...!utgpu!{chp!hak!ziebmef,ontmoh}!cks