Changeset 25456

Show
Ignore:
Timestamp:
05/11/08 13:23:12 (6 days ago)
Author:
jackburton
Message:
We shoulnd't mess with the pulse rate of the window, since if we are a 
replicant, the window is not ours. Blinking the cursor is now done with 
a BMessageRunner.
Removed the dragger for the time being, since Terminal as a replicant 
has some issues.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • haiku/trunk/src/apps/terminal/TermView.cpp

    r25411 r25456  
    8585 
    8686const static uint32 kUpdateSigWinch = 'Rwin'; 
     87const static uint32 kBlinkCursor = 'BlCr'; 
    8788 
    8889const static rgb_color kBlackColor = { 0, 0, 0, 255 }; 
     
    9091 
    9192 
    92  
    9393TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize) 
    9494        : BView(frame, "termview", B_FOLLOW_ALL, 
    95                 B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED), 
     95                B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED), 
    9696        fShell(NULL), 
    9797        fWinchRunner(NULL), 
     98        fCursorBlinkRunner(NULL), 
    9899        fFontWidth(0), 
    99100        fFontHeight(0), 
     
    141142TermView::TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize) 
    142143        : BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL, 
    143                 B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED), 
     144                B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED), 
    144145        fShell(NULL), 
    145146        fWinchRunner(NULL), 
     147        fCursorBlinkRunner(NULL), 
    146148        fFontWidth(0), 
    147149        fFontHeight(0), 
     
    186188        SetTermSize(fTermRows, fTermColumns, true); 
    187189         
     190        // TODO: Don't show the dragger, since replicant capabilities 
     191        // don't work very well ATM. 
     192        /* 
    188193        BRect rect(0, 0, 16, 16); 
    189194        rect.OffsetTo(Bounds().right - rect.Width(), 
     
    192197        SetFlags(Flags() | B_DRAW_ON_CHILDREN | B_FOLLOW_ALL); 
    193198        AddChild(new BDragger(rect, this, 
    194                 B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW)); 
     199                B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW));*/ 
    195200} 
    196201 
     
    201206        fShell(NULL), 
    202207        fWinchRunner(NULL), 
     208        fCursorBlinkRunner(NULL), 
    203209        fFontWidth(0), 
    204210        fFontHeight(0), 
     
    13121318                fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); 
    13131319         
     1320        BMessenger thisMessenger(this); 
    13141321        BMessage message(kUpdateSigWinch); 
    1315         fWinchRunner = new (std::nothrow) BMessageRunner(BMessenger(this), &message, 500000); 
    1316  
    1317         // TODO: Since we can also be a replicant, messing 
    1318         // with the window, which is not ours, is not nice: 
    1319         // Switch to using a BMessageRunner for the 
    1320         // blinking caret too. 
    1321         Window()->SetPulseRate(1000000); 
     1322        fWinchRunner =  
     1323                new (std::nothrow) BMessageRunner(thisMessenger, 
     1324                                                                                        &message, 500000); 
     1325 
     1326        BMessage blinkMessage(kBlinkCursor); 
     1327        fCursorBlinkRunner =  
     1328                new (std::nothrow) BMessageRunner(thisMessenger, 
     1329                                                                                        &blinkMessage, 1000000); 
    13221330} 
    13231331 
     
    13281336        delete fWinchRunner; 
    13291337        fWinchRunner = NULL; 
    1330 
    1331  
    1332  
    1333 void 
    1334 TermView::Pulse() 
    1335 
    1336         //if (system_time() > fLastCursorTime + 1000000) 
    1337                 BlinkCursor(); 
     1338         
     1339        delete fCursorBlinkRunner; 
     1340        fCursorBlinkRunner = NULL; 
    13381341} 
    13391342 
     
    17631766    //  } 
    17641767   // } 
     1768                case kBlinkCursor: 
     1769                        _BlinkCursor(); 
     1770                        break; 
    17651771                case kUpdateSigWinch: 
    17661772                        _UpdateSIGWINCH(); 
  • haiku/trunk/src/apps/terminal/TermView.h

    r23913 r25456  
    124124        virtual void    AttachedToWindow(); 
    125125        virtual void    DetachedFromWindow(); 
    126         virtual void    Pulse(); 
    127126        virtual void    Draw(BRect updateRect); 
    128127        virtual void    WindowActivated(bool active); 
     
    195194 
    196195        BMessageRunner *fWinchRunner; 
     196        BMessageRunner *fCursorBlinkRunner; 
    197197 
    198198        // Font and Width