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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25456 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -84,17 +84,18 @@ static property_info sPropList[] = {
|
|||||||
|
|
||||||
|
|
||||||
const static uint32 kUpdateSigWinch = 'Rwin';
|
const static uint32 kUpdateSigWinch = 'Rwin';
|
||||||
|
const static uint32 kBlinkCursor = 'BlCr';
|
||||||
|
|
||||||
const static rgb_color kBlackColor = { 0, 0, 0, 255 };
|
const static rgb_color kBlackColor = { 0, 0, 0, 255 };
|
||||||
const static rgb_color kWhiteColor = { 255, 255, 255, 255 };
|
const static rgb_color kWhiteColor = { 255, 255, 255, 255 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize)
|
TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize)
|
||||||
: BView(frame, "termview", B_FOLLOW_ALL,
|
: BView(frame, "termview", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED),
|
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||||
fShell(NULL),
|
fShell(NULL),
|
||||||
fWinchRunner(NULL),
|
fWinchRunner(NULL),
|
||||||
|
fCursorBlinkRunner(NULL),
|
||||||
fFontWidth(0),
|
fFontWidth(0),
|
||||||
fFontHeight(0),
|
fFontHeight(0),
|
||||||
fFontAscent(0),
|
fFontAscent(0),
|
||||||
@@ -140,9 +141,10 @@ TermView::TermView(BRect frame, int32 argc, const char **argv, int32 historySize
|
|||||||
|
|
||||||
TermView::TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize)
|
TermView::TermView(int rows, int columns, int32 argc, const char **argv, int32 historySize)
|
||||||
: BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL,
|
: BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED),
|
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
|
||||||
fShell(NULL),
|
fShell(NULL),
|
||||||
fWinchRunner(NULL),
|
fWinchRunner(NULL),
|
||||||
|
fCursorBlinkRunner(NULL),
|
||||||
fFontWidth(0),
|
fFontWidth(0),
|
||||||
fFontHeight(0),
|
fFontHeight(0),
|
||||||
fFontAscent(0),
|
fFontAscent(0),
|
||||||
@@ -185,13 +187,16 @@ TermView::TermView(int rows, int columns, int32 argc, const char **argv, int32 h
|
|||||||
_InitObject(argc, argv);
|
_InitObject(argc, argv);
|
||||||
SetTermSize(fTermRows, fTermColumns, true);
|
SetTermSize(fTermRows, fTermColumns, true);
|
||||||
|
|
||||||
|
// TODO: Don't show the dragger, since replicant capabilities
|
||||||
|
// don't work very well ATM.
|
||||||
|
/*
|
||||||
BRect rect(0, 0, 16, 16);
|
BRect rect(0, 0, 16, 16);
|
||||||
rect.OffsetTo(Bounds().right - rect.Width(),
|
rect.OffsetTo(Bounds().right - rect.Width(),
|
||||||
Bounds().bottom - rect.Height());
|
Bounds().bottom - rect.Height());
|
||||||
|
|
||||||
SetFlags(Flags() | B_DRAW_ON_CHILDREN | B_FOLLOW_ALL);
|
SetFlags(Flags() | B_DRAW_ON_CHILDREN | B_FOLLOW_ALL);
|
||||||
AddChild(new BDragger(rect, this,
|
AddChild(new BDragger(rect, this,
|
||||||
B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW));
|
B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,6 +205,7 @@ TermView::TermView(BMessage *archive)
|
|||||||
BView(archive),
|
BView(archive),
|
||||||
fShell(NULL),
|
fShell(NULL),
|
||||||
fWinchRunner(NULL),
|
fWinchRunner(NULL),
|
||||||
|
fCursorBlinkRunner(NULL),
|
||||||
fFontWidth(0),
|
fFontWidth(0),
|
||||||
fFontHeight(0),
|
fFontHeight(0),
|
||||||
fFontAscent(0),
|
fFontAscent(0),
|
||||||
@@ -1311,14 +1317,16 @@ TermView::AttachedToWindow()
|
|||||||
if (fScrollBar)
|
if (fScrollBar)
|
||||||
fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows);
|
fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows);
|
||||||
|
|
||||||
|
BMessenger thisMessenger(this);
|
||||||
BMessage message(kUpdateSigWinch);
|
BMessage message(kUpdateSigWinch);
|
||||||
fWinchRunner = new (std::nothrow) BMessageRunner(BMessenger(this), &message, 500000);
|
fWinchRunner =
|
||||||
|
new (std::nothrow) BMessageRunner(thisMessenger,
|
||||||
|
&message, 500000);
|
||||||
|
|
||||||
// TODO: Since we can also be a replicant, messing
|
BMessage blinkMessage(kBlinkCursor);
|
||||||
// with the window, which is not ours, is not nice:
|
fCursorBlinkRunner =
|
||||||
// Switch to using a BMessageRunner for the
|
new (std::nothrow) BMessageRunner(thisMessenger,
|
||||||
// blinking caret too.
|
&blinkMessage, 1000000);
|
||||||
Window()->SetPulseRate(1000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1327,14 +1335,9 @@ TermView::DetachedFromWindow()
|
|||||||
{
|
{
|
||||||
delete fWinchRunner;
|
delete fWinchRunner;
|
||||||
fWinchRunner = NULL;
|
fWinchRunner = NULL;
|
||||||
}
|
|
||||||
|
delete fCursorBlinkRunner;
|
||||||
|
fCursorBlinkRunner = NULL;
|
||||||
void
|
|
||||||
TermView::Pulse()
|
|
||||||
{
|
|
||||||
//if (system_time() > fLastCursorTime + 1000000)
|
|
||||||
BlinkCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1762,6 +1765,9 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
case kBlinkCursor:
|
||||||
|
_BlinkCursor();
|
||||||
|
break;
|
||||||
case kUpdateSigWinch:
|
case kUpdateSigWinch:
|
||||||
_UpdateSIGWINCH();
|
_UpdateSIGWINCH();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void Pulse();
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
virtual void KeyDown(const char*, int32);
|
virtual void KeyDown(const char*, int32);
|
||||||
@@ -194,6 +193,7 @@ private:
|
|||||||
Shell *fShell;
|
Shell *fShell;
|
||||||
|
|
||||||
BMessageRunner *fWinchRunner;
|
BMessageRunner *fWinchRunner;
|
||||||
|
BMessageRunner *fCursorBlinkRunner;
|
||||||
|
|
||||||
// Font and Width
|
// Font and Width
|
||||||
BFont fHalfFont;
|
BFont fHalfFont;
|
||||||
|
|||||||
Reference in New Issue
Block a user