[comp.sys.mac.programmer] Help! My program disables Finder double-clicking somehow.

ack@eleazar.dartmouth.edu (Andy J. Williams) (06/08/88)

In article <544@ritcv.UUCP> ark@ritcv.UUCP (Alan Kaminsky) writes:
>In the Finder I can double-click on my program's icon, and it launches, as
>expected.  My problem is this:  After my program quits and returns to the
>Finder, double-clicking no longer works!

I would think that you are not resetting the event masks after you quit
though, i believe the finder should take care of it.  Make sure you are
not setting up the mac to ignore second clicks by setting the event mask
in a bizarre way.

>Alan Kaminsky -- Rochester Institute of Technology -- Rochester, NY

hope this helps.

-ack


Andy J. Williams '90   |Ack Systems: ack@eleazar.dartmouth.edu|   _   /|
Software Development   +--------------------------------------+   \`o_O' ACK!
Kiewit Computation Ctr |Hello. Set $NAME='Iinigo Montoya' You |     ( )  /
Dartmouth College      |kill -9 my process.  Prepare to vi.   |      U

thecloud@pnet06.cts.com (Ken Mcleod) (06/08/88)

ark@ritcv.UUCP (Alan Kaminsky) writes:
>In the Finder I can double-click on my program's icon, and it launches, as
>expected.  My problem is this:  After my program quits and returns to the
>Finder, double-clicking no longer works!

Your program is disabling mouseUp events, which the Finder apparently
needs to recognize a double click. In all probability, you're calling
SetEventMask to mask out mouseUp events; just call SetEventMask(everyEvent)
and double-clicking should "return to normal."

There is a nice warning on p.70 of Inside Macintosh Vol. II about the use
of SetEventMask!
 
Disclaimer: This information represents my opinion only, and has not
            been cleared with an astrologer first.

Ken McLeod =========================     .......     ======================
UUCP: {crash uunet}!pnet06!thecloud     :.     .:    "Fear, surprise, and
ARPA: crash!pnet06!thecloud@nosc.mil   :::.. ..:::    ruthless efficiency.
INET: thecloud@pnet06.cts.com             ////       

atchison@hpindda.HP.COM (Lee Atchison) (06/09/88)

>/ hpindda:comp.sys.mac.programmer / ack@eleazar.dartmouth.edu (Andy J. Williams) /  6:38 pm  Jun  7, 1988 /
>In article <544@ritcv.UUCP> ark@ritcv.UUCP (Alan Kaminsky) writes:
>>In the Finder I can double-click on my program's icon, and it launches, as
>>expected.  My problem is this:  After my program quits and returns to the
>>Finder, double-clicking no longer works!
>
>I would think that you are not resetting the event masks after you quit
>though, i believe the finder should take care of it.  Make sure you are
>not setting up the mac to ignore second clicks by setting the event mask
>in a bizarre way.

In particular, check to see if you are disabling the "keyup" events.  This
event is necessary in order to recognize double-clicks (at least using the
"correct" algorithm to recognize double-clicks, according to Inside Mac
v1).

			-lee

----
Lee Atchison
Hewlett Packard, Business Networks Division
Cupertino, CA 95014
atchison%hpindda@hplabs.hp.com

guido@cwi.nl (Guido van Rossum) (06/09/88)

In article <...> atchison@hpindda.HP.COM (Lee Atchison) writes:
>In particular, check to see if you are disabling the "keyup" events.  This
>event is necessary in order to recognize double-clicks (at least using the
>"correct" algorithm to recognize double-clicks, according to Inside Mac
>v1).

I doubt this.  Standard recommended procedure is to disable keyup events
in all applications that don't need them (I think they are even off by
default).  Enabling key-up events halves the amount of type-ahead
possible, since the system event queue can only contain 20 events
(unless this limit has been upped since the 64K ROMs).

Besides, the Finder should be smart enough to reset its event mask.

My guess is that the low-memory global containing the double-click time
was reset to zero or something negligible small.
--
Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam
guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net

dorourke@polyslo.UUCP (David O'Rourke) (06/10/88)

In article <7390010@hpindda.HP.COM> atchison@hpindda.HP.COM (Lee Atchison) writes:
>In particular, check to see if you are disabling the "keyup" events.  This
             					       -----

   Do you mean mouseUp, or am I missing something, what do key events have to
do with double clicking?

-- 
David M. O'Rourke

Disclaimer: I don't represent the school.  All opinions are mine!

thecloud@pnet06.cts.com (Ken Mcleod) (06/12/88)

guido@cwi.nl (Guido van Rossum) writes:
> [more stuff in reply to question about loss of double-clicks]
>
>Besides, the Finder should be smart enough to reset its event mask.

 There is a ***GLOBAL*** system event mask which is set by SetEventMask().
This causes the OS Event Manager to only post certain types of events to
applications (and the Finder is an application). Most applications
rightfully do not mess with the global mask; instead, if they don't
want to receive certain types of events, they pass the appropriate mask
to GetNextEvent/WaitNextEvent/EventAvail. (Ref. IM V.1 p.254; V.2 p.70)
 I have disassembled several pd/shareware applications that I've come
across which cause the Finder to ignore double-clicks after they are run.
In each, the SysEvtMask global at $0144 was being messed with.
 
 So if your program is causing the Finder to ignore double-clicks after
you run it, and you're using SetEventMask(), DON'T. Alternately, you
could do a SetEventMask(everyEvent-keyUpMask) just before your program
exits...this resets the global mask to "factory specs."
 
 By the way, I assume the previous post by atchison@hpindda.HP.COM (Lee
Atchison) meant to say "mouseUp events" instead of "keyUp events"....

Disclaimer: I have 2MB RAM, and can run FWP *and* MF.

Ken McLeod =========================     .......     ======================
UUCP: {crash uunet}!pnet06!thecloud     :.     .:    "Fear, surprise, and
ARPA: crash!pnet06!thecloud@nosc.mil   :::.. ..:::    ruthless efficiency.
INET: thecloud@pnet06.cts.com             ////       

sho@tybalt.caltech.edu (Sho Kuwamoto) (06/13/88)

In article <361@piring.cwi.nl> guido@cwi.nl (Guido van Rossum) writes:
>
>Besides, the Finder should be smart enough to reset its event mask.
>
>My guess is that the low-memory global containing the double-click time
>was reset to zero or something negligible small.

I know for a fact that disabling mouseUp events wreaked havoc with double
clicks in the Finder even before MultiFinder came out.  Don't ask me why.

-Sho



 (sho@tybalt.caltech.edu, sho@caltech.bitnet, ...!cit-vax!tybalt!sho)

thomas@uvabick.UUCP (Thomas Fruin) (06/14/88)

 >> My problem is this:  After my program quits and returns to the
 >> Finder, double-clicking no longer works!

 > I would think that you are not resetting the event masks after you quit
 > though, i believe the finder should take care of it.  

This happened to me too, some time back.  The Finder perhaps _should_ take
care of it, but doesn't.  Interestingly, MultiFinder did take care of it!
(My problem was that I had set up my main event loop to ignore mouseUp
events, and forgot to reset the event mask before quitting.)

-- Thomas Fruin
 
   fruin@hlerul5.BITNET                  University of Leiden
   thomas@uvabick.UUCP                   University of Amsterdam
   dibs@well.UUCP
   hol0066.AppleLink
   2:512/114.FidoNet                     The Netherlands