Ticket #7937: time_clock_21082011.patch

File time_clock_21082011.patch, 2.6 KB (added by hamish, 13 years ago)

Fixes clock draw delay #7937

  • src/preferences/time/AnalogClock.h

     
    2727    virtual void            MouseUp(BPoint point);
    2828    virtual void            MouseMoved(BPoint point, uint32 transit,
    2929                                const BMessage* message);
    30     virtual void            FrameResized(float, float);
    31    
     30    virtual void            DoLayout();
     31
    3232    virtual BSize           MaxSize();
    3333    virtual BSize           MinSize();
    3434    virtual BSize           PreferredSize();
     
    6060            int32           fMinutes;
    6161            int32           fSeconds;
    6262            bool            fDirty;
    63            
     63
    6464            float           fCenterX;
    6565            float           fCenterY;
    6666            float           fRadius;
     
    7070            bool            fDrawSecondHand;
    7171            bool            fInteractive;
    7272
    73             bool            fTimeChangeIsOngoing;   
     73            bool            fTimeChangeIsOngoing;
    7474};
    7575
    7676
  • src/preferences/time/AnalogClock.cpp

     
    9898        BView::MouseDown(point);
    9999        return;
    100100    }
    101    
     101
    102102    if (InMinuteHand(point)) {
    103103        fMinuteDragging = true;
    104104        fDirty = true;
     
    124124        BView::MouseUp(point);
    125125        return;
    126126    }
    127    
     127
    128128    if (fHourDragging || fMinuteDragging) {
    129129        int32 hour, minute, second;
    130130        GetTime(&hour, &minute, &second);
     
    160160
    161161
    162162void
    163 TAnalogClock::FrameResized(float, float)
     163TAnalogClock::DoLayout()
    164164{
    165165    BRect bounds = Bounds();
    166166
     
    168168    // (important when drawing with B_SUBPIXEL_PRECISE)
    169169    fCenterX = floorf((bounds.left + bounds.right) / 2 + 0.5) + 0.5;
    170170    fCenterY = floorf((bounds.top + bounds.bottom) / 2 + 0.5) + 0.5;
    171     fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 2.5;
    172     fRadius -= 3;
     171    fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 5.5;
    173172}
    174173
    175174
     
    202201    // don't set the time if the hands are in a drag action
    203202    if (fHourDragging || fMinuteDragging || fTimeChangeIsOngoing)
    204203        return;
    205    
     204
    206205    if (fHours == hour && fMinutes == minute && fSeconds == second)
    207206        return;
    208207
     
    254253    rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
    255254    SetHighColor(background);
    256255    FillRect(bounds);
    257    
     256
    258257    bounds.Set(fCenterX - fRadius, fCenterY - fRadius,
    259258        fCenterX + fRadius, fCenterY + fRadius);
    260259
     
    459458        offsetY = (radius * 0.95) * cosf((fSeconds * M_PI) / 30.0);
    460459        StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY));
    461460    }
    462    
     461
    463462    // draw the center knob
    464463    SetHighColor(knobColor);
    465464    FillEllipse(BPoint(x, y), radius * 0.06, radius * 0.06);