vcl/unx/kde/salnativewidgets-kde.cxx | 18 ++++++++++++------ vcl/unx/kde4/KDESalFrame.cxx | 15 +++++++++------ vcl/unx/kde4/KDESalGraphics.cxx | 3 ++- 3 files changed, 23 insertions(+), 13 deletions(-)
New commits: commit 8645239c91dbd7d56691ccdc91118d24eb7df1bc Author: Isamu Mogi <saturda...@gmail.com> Date: Fri May 24 09:47:20 2013 +0900 vcl: Check SH_MenuBar_MouseTracking when menubar is drawn on KDE If QStyle::SH_MenuBar_MouseTracking is 0, it makes a mouse rollover effect minimize. By this, a menubar item of CDE and Motif styles becomes closer to standard behavior. Change-Id: I87dccbd30bf7b9f0d82d1a6e67355c1b25d22dc8 Reviewed-on: https://gerrit.libreoffice.org/4018 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 85b9a14..e1923ac 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -777,7 +777,8 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget, int nMenuItem = ( nStyle & QStyle::Style_Enabled )? m_nMenuBarEnabledItem: m_nMenuBarDisabledItem; QMenuItem *pMenuItem = static_cast<QMenuBar*>( pWidget )->findItem( nMenuItem ); - if ( nStyle & QStyle::Style_MouseOver ) + if ( ( nStyle & QStyle::Style_MouseOver ) + && kapp->style().styleHint( QStyle::SH_MenuBar_MouseTracking ) ) nStyle |= QStyle::Style_Active; if ( nStyle & QStyle::Style_Selected ) @@ -1984,9 +1985,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetMenuBarTextColor( aMenuFore ); aStyleSettings.SetMenuColor( aMenuBack ); aStyleSettings.SetMenuBarColor( aMenuBack ); - aStyleSettings.SetMenuHighlightColor( toColor ( qMenuCG.highlight() ) ); - aStyleSettings.SetMenuBarRolloverColor( toColor ( qMenuCG.highlight() ) ); // Menu items higlight text color, theme specific if ( kapp->style().inherits( "HighContrastStyle" ) || @@ -2002,15 +2001,22 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // set special menubar higlight text color if ( kapp->style().inherits( "HighContrastStyle" ) ) - { ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.highlightedText() ); - aStyleSettings.SetMenuBarRolloverTextColor( toColor( qMenuCG.highlightedText() ) ); + else + ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore; + + // set menubar rollover color + if ( kapp->style().styleHint( QStyle::SH_MenuBar_MouseTracking ) ) + { + aStyleSettings.SetMenuBarRolloverColor( toColor ( qMenuCG.highlight() ) ); + aStyleSettings.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor ); } else { - ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore; + aStyleSettings.SetMenuBarRolloverColor( aMenuBack ); aStyleSettings.SetMenuBarRolloverTextColor( aMenuFore ); } + // Font aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() ); aStyleSettings.SetMenuFont( aFont ); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index fee3ff1..be1fb61 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -301,21 +301,24 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetMenuBarTextColor( aMenuFore ); style.SetMenuColor( aMenuBack ); style.SetMenuBarColor( aMenuBack ); - style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); - style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); - style.SetMenuHighlightTextColor( aMenuFore ); // set special menubar higlight text color if ( kapp->style()->inherits( "HighContrastStyle" ) ) - { ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) ); - style.SetMenuBarRolloverTextColor( toColor( qMenuCG.color( QPalette::HighlightedText ) ) ); + else + ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore; + + // set menubar rollover color + if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) ) + { + style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); + style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor ); } else { - ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore; + style.SetMenuBarRolloverColor( aMenuBack ); style.SetMenuBarRolloverTextColor( aMenuFore ); } diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 5434e7c..9caeae9 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -297,7 +297,8 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if (part == PART_MENU_ITEM) { QStyleOptionMenuItem option; - if ( nControlState & CTRL_STATE_ROLLOVER ) + if ( ( nControlState & CTRL_STATE_ROLLOVER ) + && kapp->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) ) option.state |= QStyle::State_Selected; if ( nControlState & CTRL_STATE_SELECTED ) // Passing State_Sunken is currently not documented. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits