summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail..com>2019-10-22 18:24:07 -0800
committerJim Raykowski <raykowj@gmail.com>2019-11-20 23:05:14 +0100
commit800b6f095f95ccfb8a7ba9755292332bf97f97ad (patch)
tree4e299e2414c2412840fe314698c90952006dd987
parentb8bbe9a3ca4758102ce6aa5d1e0fbb077eedbe64 (diff)
tdf#127552 Make toolbox highlighting behave as intended
This patch provides intended highlight behavior to my understanding of comments found in the toolbox source code. *only highlight when the focus is not inside a child window of a toolbox eg, in an edit control *do not highlight when focus is in a different toolbox *only clear highlight when focus is not in toolbar Change-Id: Ia18d35c4255ed0940bce5f0c6d9448ed2c85c6fe Reviewed-on: https://gerrit.libreoffice.org/81356 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--vcl/source/window/toolbox.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 7d0f56c9e804..3b0d6b5a5f7e 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3068,8 +3068,24 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
// eg, in an edit control
// and do not highlight when focus is in a different toolbox
bool bDrawHotSpot = true;
- vcl::Window *pWin = Application::GetFocusWindow();
- if( pWin && pWin->ImplGetWindowImpl()->mbToolBox && pWin != this )
+ vcl::Window *pFocusWin = Application::GetFocusWindow();
+
+ bool bFocusWindowIsAToolBoxChild = false;
+ if (pFocusWin)
+ {
+ vcl::Window *pWin = pFocusWin->GetParent();
+ while (pWin)
+ {
+ if(pWin->ImplGetWindowImpl()->mbToolBox)
+ {
+ bFocusWindowIsAToolBoxChild = true;
+ break;
+ }
+ pWin = pWin->GetParent();
+ }
+ }
+
+ if( bFocusWindowIsAToolBoxChild || (pFocusWin && pFocusWin->ImplGetWindowImpl()->mbToolBox && pFocusWin != this) )
bDrawHotSpot = false;
if ( mbSelection && bDrawHotSpot )
@@ -3204,7 +3220,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
// only clear highlight when focus is not in toolbar
bool bMenuButtonHit = mpData->maMenubuttonItem.maRect.IsInside( aMousePos ) && ImplHasClippedItems();
- if ( bClearHigh || bMenuButtonHit )
+ if ( !HasFocus() && (bClearHigh || bMenuButtonHit) )
{
if ( !bMenuButtonHit && mpData->mbMenubuttonSelected )
{