vcl/source/control/fixedhyper.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit a72acd89569fe1b7b54a1ffc1d03650d59262c4b
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Thu Jul 11 02:17:32 2019 +0000
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Thu Jul 11 16:37:59 2019 +0200

    Correctly position hyperlink focus
    
    Handle WB_RIGHT and WB_CENTER (the latter is used in About LO).
    
    Change-Id: Ib03b9f7234c573a05eda7b4c0026e3ca7bd34729
    Reviewed-on: https://gerrit.libreoffice.org/75414
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/vcl/source/control/fixedhyper.cxx 
b/vcl/source/control/fixedhyper.cxx
index fc4c5e3eb46a..e672e3ad30b4 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -105,9 +105,15 @@ void FixedHyperlink::RequestHelp( const HelpEvent& rHEvt )
 
 void FixedHyperlink::GetFocus()
 {
-    SetTextColor( COL_LIGHTRED );
-    Invalidate(tools::Rectangle(Point(), GetSizePixel()));
-    ShowFocus( tools::Rectangle( Point( 1, 1 ), Size( m_nTextLen + 4, 
GetSizePixel().Height() - 2 ) ) );
+    Size aSize = GetSizePixel();
+    tools::Rectangle aFocusRect(Point(1, 1), Size(m_nTextLen + 4, 
aSize.Height() - 2));
+    if (GetStyle() & WB_RIGHT)
+        aFocusRect.Move(aSize.Width() - aFocusRect.getWidth(), 0);
+    else if (GetStyle() & WB_CENTER)
+        aFocusRect.Move((aSize.Width() - aFocusRect.getWidth()) / 2, 0);
+
+    Invalidate(aFocusRect);
+    ShowFocus(aFocusRect);
 }
 
 void FixedHyperlink::LoseFocus()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to