[comp.sys.amiga] User vs Background-Task, Round 1

rap@dana.UUCP (Rob Peck) (12/23/87)

In article <685@ur-tut.UUCP>, dpvc@ur-tut.UUCP (Davide P. Cervone) writes:
> In article <1213@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes:
> >In article <209@dalcsug.UUCP>, peter@dalcsug.UUCP (Peter Philip) writes:
> >> Can anyone tell me where I could find an example of detecting which keys
> >> are being held down? ... 
> 
> One caution about using this method in a multi-window, multi-tasking 
> environment:  you may miss some key presses or key-up events.  For instance,

Shortly after leaving Amiga, I had looked into porting THUNDER! by Batteries
Included to the Amiga.  For those of you who are not familiar with it,
THUNDER is a workalike to Borland's Lightning!, which is a keystroke
by keystroke spelling-error-detector.  After thinking about it for a while,
I found it difficult to resolve what to do if the user switched from
one active window to another, perhaps in the middle of a word
(or even, as has been suggested here about key-downs, in the middle
of a keystroke).  

I had written an input handler to intercept the keyboard so that THUNDER
could watch everything that crossed the keyboard that way.  But if
the input was being directed to several different windows, it would
be difficult to decide when to beep so to speak.

It would seem that not only would I have had to spell check on the
fly for each word, but also check as each character was typed to see
if it was still going to the same window as before, and continue
from there.

Aha, another alternative perhaps, rewrite all of the source code to
be fully reentrant, and as a library.  Limit the availability of the
product to things that could be started from the CLI so that the CLI
itself could be affected,  naah, that wouldnt work, most programs
open their own windows anyway and get input who knows how.

Anyone who has "thought this out" already for a multitasking multiwindow
environment, I'd be interested in hearing what you believe to be the
real solution.  I am not about to propose to EA (BI's new owners)
to do the port (got plenty more to do than that), but the topic
itself still interests me.

Rob Peck			...ihnp4!hplabs!dana!rap

haitex@pnet01.cts.com (Wade Bickel) (12/25/87)

        Hi Rob,

        I think I have kind of run into another aspect of the same 
      problem.  If I understand you correctly, the problem is that
      there is no way to specify code to tidy up an active task about
      to go inactive (ie: switching from one window to another).

        My problem is not related to intuition, rather, I would like to
      disable an interrupt server when my task does not have the console.
      Perhaps I have missed the solution to this problem.  I have looked
      through the documentation some, and have concluded that this was
      left open by C=.

        If this is so, then what it seems to me is needed is a pointer,
      within the task's node structure, to a programmers routine which would
      do a bit of clean up.  Perhaps there is a better way, but I think
      this would work.  In your case, I would assume that on a task 
      switch you could do some pointer manips in "THUNDER" to fix your
      problem.

        Of course, this does require a pretty heavy mod to the OS so???


                                                Good Luck and Merry Christmas,


        [PS: would you please send me an E/mail response so I can send
                you private mail.  I tried to send this via E/mail but
                it was returned.]
                                                                    Wade.


UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
ARPA: crash!pnet01!haitex@nosc.mil
INET: haitex@pnet01.CTS.COM