Added Shell::HasActiveProcesses() and TermView::IsShellBusy() (which calls
the former) to tell if some process launched from the terminal is still running. Some style fix in Shell.h, made a parameter const. Added basic TermWindow::QuitRequested() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
50f1e6269d
commit
d9fdb4f6cd
@ -214,7 +214,7 @@ Shell::GetAttr(struct termios &attr) const
|
||||
|
||||
|
||||
status_t
|
||||
Shell::SetAttr(struct termios &attr)
|
||||
Shell::SetAttr(const struct termios &attr)
|
||||
{
|
||||
if (tcsetattr(fFd, TCSANOW, &attr) < 0)
|
||||
return errno;
|
||||
@ -229,6 +229,17 @@ Shell::FD() const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Shell::HasActiveProcesses() const
|
||||
{
|
||||
pid_t running = tcgetpgrp(fFd);
|
||||
if (running == fProcessID || running == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Shell::AttachBuffer(TerminalBuffer *buffer)
|
||||
{
|
||||
|
@ -24,32 +24,36 @@ public:
|
||||
Shell();
|
||||
virtual ~Shell();
|
||||
|
||||
status_t Open(int row, int col, const char *encoding, int argc, const char **argv);
|
||||
status_t Open(int row, int col, const char* encoding,
|
||||
int argc, const char** argv);
|
||||
void Close();
|
||||
|
||||
const char * TTYName() const;
|
||||
const char* TTYName() const;
|
||||
|
||||
ssize_t Read(void *buffer, size_t numBytes) const;
|
||||
ssize_t Write(const void *buffer, size_t numBytes);
|
||||
ssize_t Read(void* buffer, size_t numBytes) const;
|
||||
ssize_t Write(const void* buffer, size_t numBytes);
|
||||
|
||||
status_t UpdateWindowSize(int row, int columns);
|
||||
|
||||
status_t GetAttr(struct termios &attr) const;
|
||||
status_t SetAttr(struct termios &attr);
|
||||
status_t GetAttr(struct termios& attr) const;
|
||||
status_t SetAttr(const struct termios& attr);
|
||||
|
||||
int FD() const;
|
||||
pid_t ProcessID() const { return fProcessID; }
|
||||
|
||||
bool HasActiveProcesses() const;
|
||||
|
||||
virtual status_t AttachBuffer(TerminalBuffer *buffer);
|
||||
virtual status_t AttachBuffer(TerminalBuffer* buffer);
|
||||
virtual void DetachBuffer();
|
||||
|
||||
private:
|
||||
int fFd;
|
||||
pid_t fProcessID;
|
||||
TermParse *fTermParse;
|
||||
TermParse* fTermParse;
|
||||
bool fAttached;
|
||||
|
||||
status_t _Spawn(int row, int col, const char *encoding, int argc, const char **argv);
|
||||
status_t _Spawn(int row, int col, const char* encoding,
|
||||
int argc, const char** argv);
|
||||
};
|
||||
|
||||
#endif // _SHELL_H
|
||||
|
@ -381,6 +381,13 @@ TermView::~TermView()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TermView::IsShellBusy() const
|
||||
{
|
||||
return fShell != NULL && fShell->HasActiveProcesses();
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
BArchivable *
|
||||
TermView::Instantiate(BMessage* data)
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
|
||||
bool IsShellBusy() const;
|
||||
|
||||
const char* TerminalName() const;
|
||||
|
||||
inline TerminalBuffer* TextBuffer() const { return fTextBuffer; }
|
||||
|
@ -230,6 +230,13 @@ TermWindow::_InitWindow()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TermWindow::QuitRequested()
|
||||
{
|
||||
return BWindow::QuitRequested();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::MenusBeginning()
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void SessionChanged();
|
||||
|
||||
protected:
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void WindowActivated(bool);
|
||||
virtual void MenusBeginning();
|
||||
|
Loading…
Reference in New Issue
Block a user