From 4429c2c8917b2434bc23069f5d05ad1fdea61deb Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 16 Jun 2019 11:13:02 +0200 Subject: [PATCH] Terminal: remove fullscreen tooltip Whenever using Terminal in fullscreen mode, there is a permanently on tooltip with the shortcut to exit fullscreen mode wherever you leave your mouse. This is super annoying and as a result I find myself rarely using fullscreen mode. Remove the tooltip, and instead add a button to the right of the tab bar to exit fullscreen mode, as done in WonderBrush and WebPositive. Change-Id: If42f038da3d644970de6214a31195882d4fc7eee Reviewed-on: https://review.haiku-os.org/c/1507 Reviewed-by: waddlesplash --- src/apps/terminal/Jamfile | 2 +- src/apps/terminal/SmartTabView.cpp | 19 +++++++++++ src/apps/terminal/SmartTabView.h | 2 ++ src/apps/terminal/TermWindow.cpp | 10 ------ src/apps/terminal/WindowIcon.h | 54 ++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 src/apps/terminal/WindowIcon.h diff --git a/src/apps/terminal/Jamfile b/src/apps/terminal/Jamfile index 13a5e886e4..fcd89343a9 100644 --- a/src/apps/terminal/Jamfile +++ b/src/apps/terminal/Jamfile @@ -38,7 +38,7 @@ Application Terminal : TitlePlaceholderMapper.cpp VTKeyTbl.c VTPrsTbl.c - : be localestub tracker textencoding + : be localestub shared tracker translation textencoding [ TargetLibsupc++ ] [ TargetLibstdc++ ] : Terminal.rdef XColors.rdef ; diff --git a/src/apps/terminal/SmartTabView.cpp b/src/apps/terminal/SmartTabView.cpp index b7aad69a3f..f09f1084a0 100644 --- a/src/apps/terminal/SmartTabView.cpp +++ b/src/apps/terminal/SmartTabView.cpp @@ -19,6 +19,8 @@ #include +#include +#include #include #include #include @@ -27,6 +29,9 @@ #include #include +#include "TermConst.h" +#include "WindowIcon.h" + // #pragma mark - SmartTabView @@ -45,6 +50,18 @@ SmartTabView::SmartTabView(BRect frame, const char* name, button_width width, frame.OffsetTo(B_ORIGIN); ContainerView()->MoveTo(frame.LeftTop()); ContainerView()->ResizeTo(frame.Width(), frame.Height()); + + BRect buttonRect(frame); + buttonRect.left = frame.right - B_V_SCROLL_BAR_WIDTH + 1; + buttonRect.bottom = frame.top + TabHeight() - 1; + fFullScreenButton = new BBitmapButton(kWindowIconBits, kWindowIconWidth, + kWindowIconHeight, kWindowIconFormat, new BMessage(FULLSCREEN)); + fFullScreenButton->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_RIGHT); + fFullScreenButton->MoveTo(buttonRect.LeftTop()); + fFullScreenButton->ResizeTo(buttonRect.Width(), buttonRect.Height()); + fFullScreenButton->Hide(); + + AddChild(fFullScreenButton); } @@ -143,6 +160,7 @@ SmartTabView::AddTab(BView* target, BTab* tab) // to tabbed mode ContainerView()->ResizeBy(0, -TabHeight()); ContainerView()->MoveBy(0, TabHeight()); + fFullScreenButton->Show(); // Make sure the content size stays the same, but take special care // of full screen mode @@ -202,6 +220,7 @@ SmartTabView::RemoveTab(int32 index) ContainerView()->MoveBy(0, -TabHeight()); ContainerView()->ResizeBy(0, TabHeight()); + fFullScreenButton->Hide(); } return BTabView::RemoveTab(index); diff --git a/src/apps/terminal/SmartTabView.h b/src/apps/terminal/SmartTabView.h index cc6e49c7e0..894e8ac33f 100644 --- a/src/apps/terminal/SmartTabView.h +++ b/src/apps/terminal/SmartTabView.h @@ -13,6 +13,7 @@ #include +class BButton; class BPopUpMenu; class BScrollView; @@ -64,6 +65,7 @@ private: BRect fInsets; BScrollView* fScrollView; Listener* fListener; + BButton* fFullScreenButton; }; diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index cf9cc8119e..056ad77faf 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -1826,16 +1826,6 @@ TermWindow::_UpdateSessionTitle(int32 index) fTitle.title = windowTitle; SetTitle(fTitle.title); } - - // If fullscreen, add a tooltip with the title and a keyboard shortcut hint - if (fFullScreen) { - BString toolTip(fTitle.title); - toolTip += "\n("; - toolTip += B_TRANSLATE("Full screen"); - toolTip += " (ALT " UTF8_ENTER "))"; - termView->SetToolTip(toolTip.String()); - } else - termView->SetToolTip((const char *)NULL); } diff --git a/src/apps/terminal/WindowIcon.h b/src/apps/terminal/WindowIcon.h new file mode 100644 index 0000000000..30d1622058 --- /dev/null +++ b/src/apps/terminal/WindowIcon.h @@ -0,0 +1,54 @@ + +const uint32 kWindowIconWidth = 13; +const uint32 kWindowIconHeight = 14; +const color_space kWindowIconFormat = B_RGBA32; + +const unsigned char kWindowIconBits[] = { + 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, + 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, + 0x78, 0x78, 0x78, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0xff, 0x66, 0xff, 0xff, 0xff, 0x66, 0xff, 0xff, 0xff, + 0x66, 0xff, 0xff, 0xff, 0x66, 0xff, 0xff, 0xff, 0x66, 0xff, 0xff, 0xff, 0x66, 0xff, 0xff, 0xff, + 0x66, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0xff, 0x13, 0xaf, 0xff, 0xff, + 0x13, 0xaf, 0xff, 0xff, 0x13, 0xaf, 0xff, 0xff, 0x13, 0xaf, 0xff, 0xff, 0x13, 0xaf, 0xff, 0xff, + 0x13, 0xaf, 0xff, 0xff, 0x13, 0xaf, 0xff, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, + 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, 0x78, 0x78, 0x78, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, 0x78, 0x78, 0x78, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x78, 0x78, 0x78, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, 0xc8, 0xc8, 0xc8, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff +}; +