From ffcedfaa29b8038395330dd4aa3032430464c99b Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sun, 3 May 2009 03:23:17 +0000 Subject: [PATCH] Small tweaks regarding the scrollbars of terminal when used in fullscreen mode : * if there is only one tab open, no functional change * when there is two or more tabs open, display the scroll bar in the _ActiveTermView It simply didn't make sense to not display the scrollbars in the _ActiveTermView since it was already shown in the other tabs. On the other hand, I can understand not showing the scrollbar when there is no tabview visible, as it mimic a real terminal. That fixes bug reported in ticket #3300. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30597 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermWindow.cpp | 23 +++++++++++++++++------ src/apps/terminal/TermWindow.h | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 7d92b00b8a..eab721a3aa 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -152,7 +152,8 @@ TermWindow::TermWindow(BRect frame, const char* title, Arguments *args) fFindSelection(false), fForwardSearch(false), fMatchCase(false), - fMatchWord(false) + fMatchWord(false), + fFullScreen(false) { _InitWindow(); _AddTab(args); @@ -473,7 +474,7 @@ TermWindow::MessageReceived(BMessage *message) case MSG_FULL_SIZE_CHANGED: { BFont font; - _GetPreferredFont(font); + _GetPreferredFont(font); _ActiveTermView()->SetTermFont(&font); _ResizeView(_ActiveTermView()); @@ -486,7 +487,9 @@ TermWindow::MessageReceived(BMessage *message) float mbHeight = fMenubar->Bounds().Height() + 1; fSavedFrame = Frame(); BScreen screen(this); - _ActiveTermView()->ScrollBar()->Hide(); + if (fTabView->CountTabs() == 1) + _ActiveTermView()->ScrollBar()->Hide(); + fMenubar->Hide(); fTabView->ResizeBy(0, mbHeight); fTabView->MoveBy(0, -mbHeight); @@ -495,6 +498,7 @@ TermWindow::MessageReceived(BMessage *message) SetLook(B_NO_BORDER_WINDOW_LOOK); ResizeTo(screen.Frame().Width()+1, screen.Frame().Height()+1); MoveTo(screen.Frame().left, screen.Frame().top); + fFullScreen = true; } else { // exit fullscreen _ActiveTermView()->DisableResizeView(); float mbHeight = fMenubar->Bounds().Height() + 1; @@ -506,6 +510,7 @@ TermWindow::MessageReceived(BMessage *message) fTabView->MoveBy(0, mbHeight); SetLook(fSavedLook); fSavedFrame = BRect(0,0,-1,-1); + fFullScreen = false; } break; @@ -565,8 +570,11 @@ TermWindow::MessageReceived(BMessage *message) } case kNewTab: - if (fTabView->CountTabs() < kMaxTabs) + if (fTabView->CountTabs() < kMaxTabs) { + if (fFullScreen) + _ActiveTermView()->ScrollBar()->Show(); _AddTab(NULL); + } break; case kCloseView: @@ -574,13 +582,14 @@ TermWindow::MessageReceived(BMessage *message) TermView* termView; if (message->FindPointer("termView", (void**)&termView) == B_OK) { int32 index = _IndexOfTermView(termView); - if (index >= 0) + if (index >= 0) { _RemoveTab(index); + } } break; } - case kIncreaseFontSize: + case kIncreaseFontSize: case kDecreaseFontSize: { message->PrintToStream(); @@ -783,6 +792,8 @@ TermWindow::_RemoveTab(int32 index) if (Session* session = (Session*)fSessions.RemoveItem(index)) { delete session; delete fTabView->RemoveTab(index); + if (fFullScreen) + _ActiveTermView()->ScrollBar()->Hide(); } } else PostMessage(B_QUIT_REQUESTED); diff --git a/src/apps/terminal/TermWindow.h b/src/apps/terminal/TermWindow.h index 24241d0cb1..a9ca9c0f3f 100644 --- a/src/apps/terminal/TermWindow.h +++ b/src/apps/terminal/TermWindow.h @@ -111,6 +111,8 @@ private: bool fForwardSearch; bool fMatchCase; bool fMatchWord; + + bool fFullScreen; }; #endif // __TERMWINDOW_H