From 9821c5c4e1f00af18c088b2a556dd50683484c35 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 30 Jul 2007 12:19:20 +0000 Subject: [PATCH] on MouseDown(), TermView becomes the focus view (like BTextView does). Now input works also with a replicanted Terminal, although I have to click on it twice(!?!?). Don't call exit_thread() anymore in TermParse::PtyReader(). Hope this is correct. (feel free to beat me on this). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21747 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermParse.cpp | 7 +++++-- src/apps/terminal/TermView.cpp | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index 131ae022fd..0c7de3324b 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -149,8 +149,11 @@ TermParse::PtyReader() uchar buf[READ_BUF_SIZE]; int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition)); if (nread <= 0) { - fView->NotifyQuit(errno); - exit_thread(errno); + fView->NotifyQuit(errno); + // on the next iteration, fQuitting will probably be true, + // or the semaphore acquisition will fail, so this thread will + // be killed anyway. + continue; } // Copy read string to PtyBuffer. diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 0e34f3fa2f..3ff7dc2337 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -213,8 +213,11 @@ TermView::TermView(BMessage *archive) if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK) fTermRows = 25; - // TODO: Retrieve command, colors, history size, etc. from archive - _InitObject(NULL); + const char *command = NULL; + archive->FindString("command", &command); + + // TODO: Retrieve colors, history size, etc. from archive + _InitObject(command); } @@ -1882,6 +1885,11 @@ TermView::_WritePTY(const uchar *text, int numBytes) void TermView::MouseDown(BPoint where) { + // TODO: Get rid of the extra thread for mouse tracking, + // and implement it using something like BTextView uses. + if (!IsFocus()) + MakeFocus(); + int32 buttons; Window()->CurrentMessage()->FindInt32("buttons", &buttons);