[comp.sys.amiga.tech] Need help dealing with the clipboard

paulm@cbnewsj.ATT.COM (paul.j.maioriello) (01/03/90)

Hi Amigaoids;

I have been trying to write a program that monitors the Amiga clipboard.device.
This program will try to tell wehn a program has posted to the
default clipboard unit.  While I currently have the program working,
I know it is not working in the proper Amiga fashion.  Basically, it opens
the clipboard device sets up the iorequest structure and message ports and
calls SendIO. The problem is that SendIO return immediately, even if there
is nothing in the clip.  This means that the only way that I can monitor
things is by doing the SendIO in a loop.  I would like to be able to Wait()
until there is something in the clip.  I'm I on the right track here, or
what?

Also, it seems that the clipboard.device doesn't know about all the
commands that good exec devices are supposed to.
When I try to send it a CMD_CLEAR, DoIO returns a -3 which I believe indicates
an unimplemented instruction.  Several of the other "standard"
commands detailed on page 44 of the exec ROM Kernel manual also seem
to be unimplemented by the clipboard device.  Is this truly the case
or am I (once again) messing something up?




Thanks in advance to anyone who can help


Paul M
cbnewsj!paulm		Currently still "busy waiting" for the clipboard!!!

rosenber@ra.abo.fi (Robin Rosenberg INF) (01/03/90)

I don't think you can wait for a new clip. You would have to set up a
loop which periodically (say 5 times a second for quick response)
checks the clip-id (see the manual) and when the id changes there is a new
clip to fetch. Use the timer.device for the delay.

BTW! Remember to parse the clips correctly.

-------------
Robin Rosenberg

valentin@cbmvax.commodore.com (Valentin Pepelea) (01/04/90)

In article <3126@cbnewsj.ATT.COM> paulm@cbnewsj.ATT.COM (paul.j.maioriello) writes:
>
>I have been trying to write a program that monitors the Amiga clipboard.device.
>This program will try to tell wehn a program has posted to the
>default clipboard unit.  While I currently have the program working,
>I know it is not working in the proper Amiga fashion.  Basically, it opens
>the clipboard device sets up the iorequest structure and message ports and
>calls SendIO. The problem is that SendIO return immediately, even if there
>is nothing in the clip.  This means that the only way that I can monitor
>things is by doing the SendIO in a loop.  I would like to be able to Wait()
>until there is something in the clip.  I'm I on the right track here, or
>what?

The SendIO() function tells the device to start performing the IO and returns
immediately in order to allow you to take full advantage of multitasking. The
task which called SendIO() can now perform other operations while IO is being
performed.

If you wish to be blocked until the IO transfer is complete, use DoIO(), or the
sequence
		SendIO(foo);
		WaitIO(foo);

>Also, it seems that the clipboard.device doesn't know about all the
>commands that good exec devices are supposed to.
>When I try to send it a CMD_CLEAR, DoIO returns a -3 which I believe indicates
>an unimplemented instruction.  Several of the other "standard"
>commands detailed on page 44 of the exec ROM Kernel manual also seem
>to be unimplemented by the clipboard device.  Is this truly the case
>or am I (once again) messing something up?

The command CMD_CLEAR clears all internal buffers used by the device. Well, if
the device does not use any internal buffers, then this command should not do
anything, should it?

>Paul M
>cbnewsj!paulm		Currently still "busy waiting" for the clipboard!!!

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be