src/video/quartz/SDL_QuartzEvents.m
branchSDL-1.2
changeset 3952 e3c28caea46d
parent 3936 c5c3c772f5aa
child 4009 1146681dbb74
     1.1 --- a/src/video/quartz/SDL_QuartzEvents.m	Mon Jun 04 11:15:58 2007 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzEvents.m	Mon Jun 04 11:22:23 2007 +0000
     1.3 @@ -722,7 +722,6 @@
     1.4  {
     1.5      static Uint32 screensaverTicks = 0;
     1.6      Uint32 nowTicks;
     1.7 -    int firstMouseEvent;
     1.8      CGMouseDelta dx, dy;
     1.9  
    1.10      NSDate *distantPast;
    1.11 @@ -748,10 +747,7 @@
    1.12  
    1.13      winRect = NSMakeRect (0, 0, SDL_VideoSurface->w, SDL_VideoSurface->h);
    1.14      
    1.15 -    /* send the first mouse event in absolute coordinates */
    1.16 -    firstMouseEvent = 1;
    1.17 -    
    1.18 -    /* accumulate any additional mouse moved events into one SDL mouse event */
    1.19 +    /* while grabbed, accumulate all mouse moved events into one SDL mouse event */
    1.20      dx = 0;
    1.21      dy = 0;
    1.22      
    1.23 @@ -853,29 +849,22 @@
    1.24                          dx += dx1;
    1.25                          dy += dy1;
    1.26                      }
    1.27 -                    else if (firstMouseEvent) {
    1.28 +                    else {
    1.29                          
    1.30                          /*
    1.31 -                            Get the first mouse event in a possible
    1.32 -                            sequence of mouse moved events. Since we
    1.33 -                            use absolute coordinates, this serves to
    1.34 -                            compensate any inaccuracy in deltas, and
    1.35 -                            provides the first known mouse position,
    1.36 -                            since everything after this uses deltas
    1.37 +                            Get the absolute mouse location. This is not the
    1.38 +                            mouse location after the currently processed event,
    1.39 +                            but the *current* mouse location, i.e. after all
    1.40 +                            pending events. This means that if there are
    1.41 +                            multiple mouse moved events in the queue, we make
    1.42 +                            multiple identical calls to SDL_PrivateMouseMotion(),
    1.43 +                            but that's no problem since the latter only
    1.44 +                            generates SDL events for nonzero movements. In my
    1.45 +                            experience on PBG4/10.4.8, this rarely happens anyway.
    1.46                          */
    1.47                          NSPoint p;
    1.48                          QZ_GetMouseLocation (this, &p);
    1.49                          SDL_PrivateMouseMotion (0, 0, p.x, p.y);
    1.50 -                        firstMouseEvent = 0;
    1.51 -                   }
    1.52 -                    else {
    1.53 -                    
    1.54 -                        /*
    1.55 -                            Get the amount moved since the last drag or move event,
    1.56 -                            add it on for one big move event at the end.
    1.57 -                        */
    1.58 -                        dx += [ event deltaX ];
    1.59 -                        dy += [ event deltaY ];
    1.60                      }
    1.61                      
    1.62                      /*