dillon@CORY.BERKELEY.EDU (Matt Dillon) (01/27/88)
You are doing exactly the right thing. It is quite kosher to use Forbid()/Permit() for short periods of time as you are doing. In this particular case, the compiler probably gets it down to one instruction anyway (but of course you can't *assume* that from the C code). Forbid()/Permit() simply disable task switching. The really voltile calls are Disable()/Enable() which disable interrupts (and thus task switching as well). Disable()/Enable() is used mainly by the OS to, for instance, make message handling calls atomic. -Matt Your message: :if (k==0) { : Forbid(); :wdw->flags &= RMBTRAP; :Permit(); :} : :My question is: : :can I use any other way to get the same thing done? I hear that :forbid/permit are not quite "kosher" on the amiga... : :What I am trying to do in the above code is make the right mouse button :trapped only under a certain situation on the screen, and then be able :to turn off or on the trapping as needed. wdw is a pointer to my window, :and the flags are currently set to other codes. I do not want to disturb :the other flags. : :Hans Bechtel
msl5864@ritcv.UUCP (Michael S. Leibow) (02/02/88)
.... BLAH BLAH BLAH >>What I am trying to do in the above code is make the right mouse button >>trapped only under a certain situation on the screen, and then be able >>to turn off or on the trapping as needed. wdw is a pointer to my window, >>and the flags are currently set to other codes. I do not want to disturb >>the other flags. > >That's what Dpaint II does, too. > >-- Marco And why doesn't anyone use MENUVERIFY? WIth menuverify, you don't have to mess with the flags. When you get the MENUVERIFY from intuition, you check the mouse coordinate to see if it is where you want it. If you want the menu functions to continue you just reply to the message. If you want to cancel the menu and use just pretend you got a right button, you fill one of the fields of the reply with a cancel command, and then reply. --Mike ... I would have been more precise but I don't have my manuals around... -- Michael S. Leibow UUCP: {allegra,seismo}!rochester!ritcv!msl5864 CSNET: msl5864%rit@csnet-relay.ARPA