Allow unsetting the listener. With multiple tabs there's only one
terminal view that is attached to the window and can receive messages at all. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25964 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
91f7786bc3
commit
ecd79a2cc1
@ -17,7 +17,8 @@
|
||||
TerminalBuffer::TerminalBuffer()
|
||||
:
|
||||
BLocker("terminal buffer"),
|
||||
fEncoding(M_UTF8)
|
||||
fEncoding(M_UTF8),
|
||||
fListenerValid(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -41,6 +42,14 @@ void
|
||||
TerminalBuffer::SetListener(BMessenger listener)
|
||||
{
|
||||
fListener = listener;
|
||||
fListenerValid = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TerminalBuffer::UnsetListener()
|
||||
{
|
||||
fListenerValid = false;
|
||||
}
|
||||
|
||||
|
||||
@ -61,23 +70,28 @@ TerminalBuffer::SetEncoding(int encoding)
|
||||
void
|
||||
TerminalBuffer::SetTitle(const char* title)
|
||||
{
|
||||
BMessage message(MSG_SET_TERMNAL_TITLE);
|
||||
message.AddString("title", title);
|
||||
fListener.SendMessage(&message);
|
||||
if (fListenerValid) {
|
||||
BMessage message(MSG_SET_TERMNAL_TITLE);
|
||||
message.AddString("title", title);
|
||||
fListener.SendMessage(&message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TerminalBuffer::NotifyQuit(int32 reason)
|
||||
{
|
||||
BMessage message(MSG_QUIT_TERMNAL);
|
||||
message.AddInt32("reason", reason);
|
||||
fListener.SendMessage(&message);
|
||||
if (fListenerValid) {
|
||||
BMessage message(MSG_QUIT_TERMNAL);
|
||||
message.AddInt32("reason", reason);
|
||||
fListener.SendMessage(&message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TerminalBuffer::NotifyListener()
|
||||
{
|
||||
fListener.SendMessage(MSG_TERMINAL_BUFFER_CHANGED);
|
||||
if (fListenerValid)
|
||||
fListener.SendMessage(MSG_TERMINAL_BUFFER_CHANGED);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
int32 historySize);
|
||||
|
||||
void SetListener(BMessenger listener);
|
||||
void UnsetListener();
|
||||
|
||||
int Encoding() const;
|
||||
void SetEncoding(int encoding);
|
||||
@ -35,6 +36,7 @@ private:
|
||||
|
||||
// listener/dirty region management
|
||||
BMessenger fListener;
|
||||
bool fListenerValid;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user