At 11:17 am +0100 12/06/02, I wrote to MacPerl-Toolbox:
>The following script demonstrates the phenomenon:
>
>       #!perl
>       # exit via Cmd+period
>
>       use Mac::Events;
>       use Mac::Events qw(@Event);
>
>       $Event[mouseDown] = sub { while (WaitMouseUp()) {} };
>
>       WaitNextEvent while 1;
>
>
>About two seconds after mouse-down MacPerl switches to the 
>spin-cursor and remains that way until mouse-up.
>
>IMO this behaviour is highly undesirable since it spoils any 
>application involving a 'WaitMouseUp' event, such as 
>button-tracking, auto-scrolling and similar regular GUI functions.

The attached patch appears to provide a solution. So far as I can 
determine the normal functions of MacPerl are unaffected by this 
change.

However I am a long long way from fully understanding the inner 
workings of MacPerl in relation to the spin cursor, so the proposal 
needs the scrutiny of wiser heads than mine -- to say the least.

Alan Fry

-----------

--- 
Millgate:Programming:BuildMacPerl:macperl_src:macperl:MPMain.c.orig 
        Mon Jan  7 14:36:34 2002
+++ Millgate:Programming:BuildMacPerl:macperl_src:macperl:MPMain.c 
        Tue Jun 11 16:54:12 2002
@@ -1182,6 +1182,7 @@
        long            now;
        EventRecord myEvent;
        Point           mouse;
+       char            up;

        if (!gSacrificialGoat)          /* Memory trouble */
                if (gRunningPerl)                       /* This 
script has gone too far */
@@ -1191,6 +1192,7 @@
                                exit(0);                /* Save our 
sorry ass. Shouldn't happen */

        now = LMGetTicks();
+       up  = LMGetMouseButtonState();
        if (spinning = busy) {
                if (now - lastNonBusy < (gInBackground ? 
BACK_BUSY_WAIT : FRONT_BUSY_WAIT))
                        spinning = false;
@@ -1201,6 +1203,9 @@
                events = activMask | updateMask | highLevelEventMask | osMask;
                spinning = false;
        }
+
+       if (!up)
+               spinning = false;

        MaintainMenuBar();

-------------

Reply via email to