[comp.sys.amiga] CON: and RAW: windows

kaz@cadovax.UUCP (Kerry Zimmerman) (03/09/87)

References:


[ OK line eater. Make my day! ]

I'm having trouble using console and raw windows.
By this I mean, if I open a console or raw window using
amigados Open, how can I find the pointer to the opened window?
What exactly does the file handle, returned by Open, point to for
a CON: or RAW: file open request?  Can I use the handle to find
my window pointer?

I know I could open a window myself and attach a console to it, but
I like the ease with which I can open a window and have a console (or raw)
device connected to it using amigados.  If I could get the window pointer,
then I could get the RastPort and be able to change the font, draw things,
or whatever in the console's window.

I obtained a copy of a program called "setfont2" which gets the window
pointer by passing a packet request.  I found that the window pointer
returned is for the original CLI window only, not my console window.

What is the difference between opening CON: vs opening RAW:?
These are both using the console device, aren't they, or is RAW:
a different device driver?  The amigados documentation make it seem
like the RAW: is a separate device, yet there is no mention of a
separate raw device in the RKM.  
I assumed that RAW: was just a console window
opened with raw events enabled.  Did I assume correctly?

Thanks in advance for any response.

Kerry Zimmerman
#  {ucbvax,ihnp4,decvax}!trwrb!cadovax!kaz
#  cadovax!kaz@ucla-locus.arpa

phillip@cbmvax.UUCP (03/11/87)

in article <1421@cadovax.UUCP>, kaz@cadovax.UUCP (Kerry Zimmerman) says:
> Keywords: CON: RAW: window
> Summary: obtaining window pointers from CON:
> References:
> 
> [ OK line eater. Make my day! ]
.....
> a CON: or RAW: file open request?  Can I use the handle to find
> my window pointer?
> 
>...... 
Yes. If you convert your file handle from the open'ed window into a mc ptr
and grab the process id for your window out of the file handle "type" field
and use that for your packet port. Then send the diskinfo packet to that
port. I guess you could hack the setfont code.

BPTR   myhand = Open("RAW:10/10/60/50/RawWindow",MODE_NEWFILE);
struct FileHandle *fh = (struct FileHandle *) BADDR(myhand);
struct MsgPort *processid = fh->fh_Type;

BTW, the file handle structure is a little mixed up in that fh_Port should
 be where fh_Type is and vice-versa.

> I obtained a copy of a program called "setfont2" which gets the window
> pointer by passing a packet request.  I found that the window pointer
> returned is for the original CLI window only, not my console window.

The program probably grabs the process id from the process structure: 
 pr_ConsoleTask. Which would be the default window.
> 
> What is the difference between opening CON: vs opening RAW:?

Bascially the way data is handled. In RAW mode data is "untouched" and
not buffered. In CON mode data is buffer until a EOF or <Return> are
detected and ansi sequences are ignored.
BTW, You can switch *any* window in and out of con/raw modes...By sending
a packet to the window handler process [as in setfont]. (See 1.2 release notes)
> Thanks in advance for any response.
> 
> Kerry Zimmerman
> #  {ucbvax,ihnp4,decvax}!trwrb!cadovax!kaz
> #  cadovax!kaz@ucla-locus.arpa
-phil
==============================================================================
  Phillip Lindsay - Commodore Business Machines - Amiga Technical Support
  UUCP: {ihnp4|seismo|caip}!cbmvax!phillip      - Phone: (215) 431-9180
  No warranty is implied or otherwise given in the form of suggestion or 
  example. Any opinions found here are of my making. 	/* eof */

kaz@cadovax.UUCP (03/13/87)

I want to thank everybody who responded to my question about getting
the window pointer from a CON: or RAW: file handle.
Phillip Lindsay's posting was exactly what was needed.  Thanks again.

I've seen other postings recently about difficulties with the 
'setfont' program, and I discovered a non-obvious trick that makes 
'setfont' work.  The last line of the program prints "escape c".
Well, this is a screen reset command.  What happens is that the
screen clears and the newly set font becomes active.  Without the
reset the new font is available for graphic text() outputs, but the
console doesn't know about the new font.  

Can anyone explain why the console doesn't use the font in the window's
rastport until after a reset?


Kerry Zimmerman
#  {ucbvax,ihnp4,decvax}!trwrb!cadovax!kaz
#  cadovax!kaz@ucla-locus.arpa

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner CATS) (03/16/87)

In article <1434@cadovax.UUCP> kaz@cadovax.UUCP (Kerry Zimmerman) writes:
>
>I've seen other postings recently about difficulties with the 
>'setfont' program, and I discovered a non-obvious trick that makes 
>'setfont' work.  The last line of the program prints "escape c".
>...
>Can anyone explain why the console doesn't use the font in the window's
>rastport until after a reset?

The RastPort attributes for a console.device are stored in its ConUnit
structure.  These values are initially (on OpenDevice) taken from the
window's RastPort.  After that, they are changed via control and CSI
keyboard sequences.  The CTRL/C forces the console.device to re-initialize
its ConUnit structure with the values in the window's RastPort.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=