[comp.sys.atari.st] Summarize: evnt_button

hohr@cernvax.cern.ch (roger hoh) (02/09/91)

 Hi Atarians,

 I'll summerize. May be it has to be added at the faq.
 The right and most usefull answer (at least for me:-)) is:

#From jeroen@phil.ruu.nl Wed Feb  6 13:38:24 1991
 (stuff deleted)
#evnt_button(from memory) lets you specify three parameters:
#        - ev_bclicks, the number of clicks to fire on;
#        - ev_bmask, the mouse button mask (see below)
#        - ev_breturn, the return button mask (see below).
#
#The mouse mask determines the mouse keys to check: it is a coniunctive
#bit mask, that is, bit 1 = left button, bit 2 = right button.
#Example:        0       queries for NO mouse buttons
#                1       queries for LEFT mouse button;
#                2       queries for RIGHT mouse button;
#                3       queries for BOTH mouse buttons.
#
#The return mask is much the same, only this should be considered a template
#for the events to accept.
#Example:        0       accepts NO mouse buttons pressed;
#                1       accepts LEFT button pressed;
#                2       accepts RIGHT button pressed;
#                3       accepts BOTH buttons pressed.
#
#So if you want to wait until the user presses the right mouse button, you
#specify 1 click, button mask 2 and return mask 2.
#
#By the way, as you may have noticed you cannot inquire 'left OR right mouse
#button', only none, one of both or both together.
#But there is an undocumented way of doing this: (I got this from Claus Brod):
#add 256 to the desired value of mouse clicks, and the button and return masks
#are viewed as negated.
#So evnt_button(257,3,0,xptr,yptr,bptr,kptr) is interpreted as 'NOT (the left
# and the mouse button both released)', that is, 'left or right button
# pressed'.
Jeroen asked me to add in this summarize the 'xptr,yptr,bptr,kptr' values.
So, and as far as I know:
- xptr points to an int that holds the 'X' coordinate of the mouse pointer
- yptr: the same but for the 'Y' coordinate
- bptr points to an int that indicates the button state when the event occurs
- kptr points to an int that indicates the state of the Ctrl, Alt, Shift keys
  all ORed , in the following way:
	- 0x0 : all keys up
	- 0x1 : right shift key down
	- 0x2 : left   "     "    "
	- 0x4 : ctrl key down
	- 0x8 : alt key down
#
#By the way, I seem to recall return value of 0 is quite normal for the function:
#you get the return values from the pointers you supply.
#(That's the way it is in evnt_multi anyway...)
#
#If you still have any problem, why not mail me the fragment of the source
#containing the problem? I'll look at it and (hopefully) can help you.
#
#Greetings, J. (jeroen@phil.ruu.nl)

 It's OK for me now, Jeroen.

 Notice that the MWC manual doesn't say that ev_bmask and ev_breturn
are 'bit weighted'...

 Hope this helps other MWC owners.

 Regards and thanks at all the replyers.

 Roger           hohr@cernvax.cern.ch