[comp.sys.atari.st] Event multi

ericco@stew.ssl.berkeley.edu (Eric C. Olson) (10/14/89)

Once again I'm trying to make GEM AES do something useful.  Its
now quite late, and the situation looks grim ...

Is it possible to check the state of EITHER mouse button using
event_multi?  Or any other (documented) routine?

I have found that specifying  0x3 for the bstate parameter and
0x3 for the bmask parameter only matchs button chords.  How do
I tell event_multi to wait for a left OR a right mouse click
(or both)?

Thanks in advance,
Eric



Eric
ericco@ssl.berkeley.edu

esp_05@jhunix.HCF.JHU.EDU (Stdnt 05) (10/15/89)

To sample the state of either mouse button, use the AES function
graf_mkstate.  As I don't have my GEM manual with me now, I
don't remember exactly how it works, but this function returns
the state of the two mouse buttons as well as the shift, alternate
and control keys.

Ciao... Eric Ruck

kloppen@gmdzi.UUCP (Jelske Kloppenburg) (10/15/89)

With graf_mkstate you can *sample* the state of the mouse buttons. But the
question is, how to wait with event_multi on either mouse button. I did not
solve the problem and I'm waiting too for contributions.

      kloppenburg@kmx.gmd.dbp.de
UUCP: kloppen@gmdzi
                                     In real life: Jelske Kloppenburg

poole@chx400.switch.ch (Simon Poole) (10/16/89)

In article <1329@gmdzi.UUCP> kloppen@gmdzi.UUCP (Jelske Kloppenburg) writes:
>
>With graf_mkstate you can *sample* the state of the mouse buttons. But the
>question is, how to wait with event_multi on either mouse button. I did not
>solve the problem and I'm waiting too for contributions.

[Sigh! This one turns up often enough to be included on a list of
commonly asked questions, did anybody ever do something about this?]

Your best bet is to install your own vdi mouse button handler, save
the "incoming" button mask in a variable and replace the original value
(if I remember correctly it's in d0) with the value for the left button.
After you've done that jump to the original button handler, the whole
thing needs just a couple of assembler instructions, so it's really
trivial. In your event loop just wait for a left button event and then
sample the stored value for the button that was really pressed.


-- 
------------------------------------------------------------------------
						Simon Poole
 poole@verw.switch.ch/poole@chx400.switch.ch/mcvax!cernvax!chx400!poole
------------------------------------------------------------------------

esp_05@jhunix.HCF.JHU.EDU (Stdnt 05) (10/17/89)

I have had success testing EITHER mouse key with evnt_multi, but it's
not a pretty method, and if you use it in conjunction with drop-down
menus it can do wierd things.  I used two calls to evnt_multi in a
loop, one checking for one mouse button, the other for the other,
while throwing in a timer event set at around half a millisecond (if I
remember correctly).  If evnt_multi with one button (and whatever
else) returns a timer event I run it with the other button, in a loop,
until I get something other than a timer event.  THe problem is, if
you set the timer event too quickly the menu bar does wierd things, or
doesn't work at all.  So if you really want to use evnt_multi, you
have to do what is the operative phrase with Atari--

   DEAL WITH IT.

Ciao... Eric

ericco@stew.ssl.berkeley.edu (Eric C. Olson) (10/17/89)

In article <1989Oct15.223739.9084@chx400.switch.ch> poole@chx400.switch.ch (Simon Poole) writes:
>[Sigh! This one turns up often enough to be included on a list of
>commonly asked questions, did anybody ever do something about this?]
>
>Your best bet is to install your own vdi mouse button handler, save
>the "incoming" button mask in a variable and replace the original value
>(if I remember correctly it's in d0) with the value for the left button.
>After you've done that jump to the original button handler, the whole
>thing needs just a couple of assembler instructions, so it's really
>trivial. In your event loop just wait for a left button event and then
>sample the stored value for the button that was really pressed.

I can always hack around the operating system.  I find that I almost
always have to hack around GEM for any non-trivial program.  But I'm truly
amazed that GEM can't even handle selecting the left button OR the right
button.

Because of this I'm always tempted to circumvent GEM completely.  Which
defeats the purpose of having something like GEM.

Enough said,
Eric


Eric
ericco@ssl.berkeley.edu

stephen@oahu.cs.ucla.edu (Stephen Whitney) (10/17/89)

Atari: I understand that it's not your fault that GEM is drain-bamaged and
can't detect _EITHER_ the right button _OR_ the left button in the same
evnt_multi call, but I have never yet seen a program which uses evnt_multi
to detect both buttons at the same time (Interlink uses this, but I'm sure
they've hacked their own VDI mouse handler or something.

How about _CHANGING_ evnt_multi so that if it sees a 3 in the button mask,
it returns if either button or both buttons are pressed.  Then the application
can check to see which it got.  Sound okay?  At least do this for TOS 1.6
so that TT software can use both buttons effectively without hacks! Pretty
please!!!

(While you're at it, the TT could probably do with a few more windows for
that nifty 1280x960 mode too.)

Just to be positive, I have Rainbow TOS, and I _LOVE_ it!!!  Wouldn't go
back for anything.  Fine job!

					--Steve Whitney