vcl/inc/svdata.hxx | 1 vcl/source/window/dockingarea.cxx | 2 - vcl/source/window/menu.cxx | 18 ++++++++++--- vcl/source/window/menubarwindow.cxx | 16 ++++++++++-- vcl/source/window/status.cxx | 3 +- vcl/unx/kde4/KDEData.cxx | 2 + vcl/unx/kde4/KDESalFrame.cxx | 21 +++++++--------- vcl/unx/kde4/KDESalGraphics.cxx | 47 ++++++++++++++++++++++++++++-------- 8 files changed, 81 insertions(+), 29 deletions(-)
New commits: commit c6fc963c534bc9069ef975246e5d619777b9f570 Author: Jan-Marek Glogowski <[email protected]> Date: Thu Sep 22 18:35:38 2016 +0200 KDE4 enable and handle rollover menubar Change-Id: Ice2657c8e8ecccb67d1b14292514a42ff37caa39 diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx index 71267a0..1caf6e8 100644 --- a/vcl/unx/kde4/KDEData.cxx +++ b/vcl/unx/kde4/KDEData.cxx @@ -46,6 +46,8 @@ void KDEData::initNWF() pSVData->maNWFData.mbDockingAreaSeparateTB = true; // no borders for menu, theming does that pSVData->maNWFData.mbFlatMenu = true; + // Qt theme engines may support a rollover menubar + pSVData->maNWFData.mbRolloverMenubar = true; // Styled menus need additional space QStyle *style = QApplication::style(); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index a1086ba..23a7805 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -208,6 +208,10 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) } } + // Menu + std::unique_ptr<KMenuBar> pMenuBar = std::unique_ptr<KMenuBar>( new KMenuBar() ); + QPalette qMenuCG = pMenuBar->palette(); + Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) ); Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) ); Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) ); @@ -215,6 +219,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) ); Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) ); Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) ); + Color aHighText = toColor( pal.color( QPalette::Active, QPalette::HighlightedText ) ); + + style.SetSkipDisabledInMenus( TRUE ); // Foreground style.SetRadioCheckTextColor( aFore ); @@ -257,7 +264,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // Selection style.SetHighlightColor( aHigh ); - style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) ); + style.SetHighlightTextColor( aHighText ); // Tooltip style.SetHelpColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipBase ))); @@ -269,7 +276,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetAppFont( aFont ); style.SetMenuFont( aFont ); // will be changed according to pMenuBar - //style.SetToolFont( aFont ); //already set above style.SetLabelFont( aFont ); style.SetInfoFont( aFont ); style.SetRadioCheckFont( aFont ); @@ -291,13 +297,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) int flash_time = QApplication::cursorFlashTime(); style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - // Menu - style.SetSkipDisabledInMenus( TRUE ); - std::unique_ptr<KMenuBar> pMenuBar = std::unique_ptr<KMenuBar>( new KMenuBar() ); - - // Color - QPalette qMenuCG = pMenuBar->palette(); - // Menu text and background color, theme specific Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) ); Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) ); @@ -307,7 +306,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetMenuColor( aMenuBack ); style.SetMenuBarColor( aMenuBack ); style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) ); - style.SetMenuHighlightTextColor( aMenuFore ); + style.SetMenuHighlightTextColor( toColor ( qMenuCG.color( QPalette::HighlightedText ) ) ); // set special menubar higlight text color if ( QApplication::style()->inherits( "HighContrastStyle" ) ) commit 843b9d5dba5098c2676491dda66bed31e57f4329 Author: Jan-Marek Glogowski <[email protected]> Date: Thu Sep 22 18:27:49 2016 +0200 VCL add support for rollover menubars KDE theme engines can explicitly support rollover menubars via styleHint( QStyle::SH_MenuBar_MouseTracking ). So this adds support for this feature to the vcl::Menu. Change-Id: Ica923ff2d06cfd54e548ba858b3d90f70d9c255a diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index a1a76a1..128cebf 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -278,6 +278,7 @@ struct ImplSVNWFData bool mbDDListBoxNoTextArea:1; bool mbEnableAccel:1; // whether or not accelerators are shown bool mbAutoAccel:1; // whether accelerators are only shown when Alt is held down + bool mbRolloverMenubar:1; // theming engine supports rollover in menubar }; struct BlendFrameCache diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b185a16..579e993 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1804,11 +1804,21 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, { if (IsMenuBar()) { - if (bRollover) - rRenderContext.SetTextColor(rSettings.GetMenuBarRolloverTextColor()); - else if (bHighlighted) - rRenderContext.SetTextColor(rSettings.GetMenuBarHighlightTextColor()); + if (!ImplGetSVData()->maNWFData.mbRolloverMenubar) + { + if (bRollover) + rRenderContext.SetTextColor(rSettings.GetMenuBarRolloverTextColor()); + else if (bHighlighted) + rRenderContext.SetTextColor(rSettings.GetMenuBarHighlightTextColor()); + } else + { + if (bHighlighted) + rRenderContext.SetTextColor(rSettings.GetMenuBarHighlightTextColor()); + else if (bRollover) + rRenderContext.SetTextColor(rSettings.GetMenuBarRolloverTextColor()); + } + if (!bRollover && !bHighlighted) rRenderContext.SetTextColor(rSettings.GetMenuBarTextColor()); } else if (bHighlighted) diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 812fff4..6ab3f8b 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -592,7 +592,17 @@ void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 Rectangle aRect = Rectangle(Point(nX, 1), Size(pData->aSz.Width(), GetOutputSizePixel().Height() - 2)); rRenderContext.Push(PushFlags::CLIPREGION); rRenderContext.IntersectClipRegion(aRect); - bool bRollover = nPos != nHighlightedItem; + bool bRollover, bHighlight; + if (!ImplGetSVData()->maNWFData.mbRolloverMenubar) + { + bHighlight = true; + bRollover = nPos != nHighlightedItem; + } + else + { + bRollover = nPos == nRolloveredItem; + bHighlight = nPos == nHighlightedItem; + } if (rRenderContext.IsNativeControlSupported(ControlType::Menubar, ControlPart::MenuItem) && rRenderContext.IsNativeControlSupported(ControlType::Menubar, ControlPart::Entire)) { @@ -630,7 +640,7 @@ void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 rRenderContext.DrawRect(aRect); } rRenderContext.Pop(); - pMenu->ImplPaint(rRenderContext, 0, 0, pData, true/*bHighlight*/, false, bRollover); + pMenu->ImplPaint(rRenderContext, 0, 0, pData, bHighlight, false, bRollover); } return; } @@ -875,6 +885,8 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) pMenu->ImplPaint(rRenderContext, 0); if (nHighlightedItem != ITEMPOS_INVALID) HighlightItem(rRenderContext, nHighlightedItem); + else if (ImplGetSVData()->maNWFData.mbRolloverMenubar && nRolloveredItem != ITEMPOS_INVALID) + HighlightItem(rRenderContext, nRolloveredItem); // in high contrast mode draw a separating line on the lower edge if (!rRenderContext.IsNativeControlSupported( ControlType::Menubar, ControlPart::Entire) && commit 0de3368e4d82d579b8e2550391e142607cbb6aa8 Author: Jan-Marek Glogowski <[email protected]> Date: Thu Sep 22 17:42:01 2016 +0200 tdf#97721 KDE4 no PRESSED state for checkboxes Selecting radio and check boxes is handled via QStyleOptionMenuItem::checked. Actually forwarding the QStyle::State_Sunken creates strange artifacts in all menus. Change-Id: Ia0b0864b9bec5961023b4f25315a8acf1fae4683 diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 9cdd627..cd02e38 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -343,7 +343,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(), widgetRect.size().expandedTo( menuItemRect.size())); draw( QStyle::CE_MenuItem, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value), rect ); + vclStateValue2StateFlag(nControlState & ~ControlState::PRESSED, value), rect ); } else if( part == ControlPart::Entire ) { commit c04ce0acbb68f9770e29c2e25fb74c2eb7aa2e11 Author: Jan-Marek Glogowski <[email protected]> Date: Mon Sep 19 22:47:37 2016 +0200 KDE4 no more progress bar flickering This will always redraw the progress bar over the last one. It stops the flickering at least in KDE4 from re-painting the background, but obvously will break any transparent or alaiasing effect, if it was used. There is actually a mbProgressNeedsErase in the global settings, so actually use it when setting a new progress value. Change-Id: Ic62784da4f6d08bf0e03a9e04848a5cc687ee236 diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 0035714..70778b0 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1352,7 +1352,8 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent ) && IsReallyVisible() && (!mnPercent || (mnPercent != nNewPercent)) ) { - Invalidate(maPrgsFrameRect); + bool bNeedErase = ImplGetSVData()->maNWFData.mbProgressNeedsErase; + Invalidate(maPrgsFrameRect, bNeedErase ? InvalidateFlags::NONE : InvalidateFlags::NoErase); Flush(); } mnPercent = nNewPercent; commit 78b944747e374c9245173072cf78e67118344d10 Author: Jan-Marek Glogowski <[email protected]> Date: Mon Sep 19 22:31:17 2016 +0200 tdf#94172 KDE4 fix gradient toolbars Bug introduced by commit 4f5fe008a3d5f0b5ddfa656299306cff9d57d802. The code was moved from ImplInitSettings to ApplySettings and somehow a not (!) got lost. Change-Id: Ie3fa4fb99d030d106aab712cd6bdafada8c6d423 diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 1806519..a1de6bc 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -149,7 +149,7 @@ void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext) rRenderContext.SetBackground(aWallpaper); } - else if (rRenderContext.IsNativeControlSupported(ControlType::Toolbar, ControlPart::Entire)) + else if (!rRenderContext.IsNativeControlSupported(ControlType::Toolbar, ControlPart::Entire)) { Wallpaper aWallpaper; aWallpaper.SetStyle(WallpaperStyle::ApplicationGradient); commit 987a4a994edf1512aaa7a92721c4b6e829806b62 Author: Jan-Marek Glogowski <[email protected]> Date: Mon Sep 19 22:24:12 2016 +0200 tdf#94112 KDE4 use disabled WindowText color Libre office just has a general disabled color. Instead of the general QPalette::Mid, use the color QPalette::WindowText of the palette QPalette::Disabled. Change-Id: Ie6943b455d3e6545289b241ee4ab85128f4fd7ab diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 9edeb11..a1086ba 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -243,7 +243,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetTabHighlightTextColor( aButn ); // Disable color - style.SetDisableColor( aMid ); + style.SetDisableColor( toColor( pal.color( QPalette::Disabled, QPalette::WindowText ) ) ); // Workspace style.SetWorkspaceColor( aMid ); commit 3c923db82a649ecec83f6231f97a847d0b8e19ce Author: Jan-Marek Glogowski <[email protected]> Date: Wed Oct 29 15:54:29 2014 +0100 KDE4 Switch default image color to transparent... ... and just fill the painted image once at the beginning. Also adapt background based on the control information from Qt4. Change-Id: I39c03b2ca779381920e2597b4bea7973fea6ae2a diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 76f8a58..9cdd627 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -220,13 +220,46 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, { m_image.reset(new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32 ) ); } - m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); + + // Default image color - just once + switch (type) + { + case ControlType::MenuPopup: + if( part == ControlPart::MenuItemCheckMark || part == ControlPart::MenuItemRadioMark ) + { + // it is necessary to fill the background transparently first, as this + // is painted after menuitem highlight, otherwise there would be a grey area + m_image->fill( Qt::transparent ); + break; + } + SAL_FALLTHROUGH; // QPalette::Window + case ControlType::Menubar: + case ControlType::WindowBackground: + m_image->fill( KApplication::palette().color(QPalette::Window).rgb() ); + break; + case ControlType::Tooltip: + m_image->fill(KApplication::palette().color(QPalette::ToolTipBase).rgb()); + break; + case ControlType::Pushbutton: + m_image->fill(KApplication::palette().color(QPalette::Button).rgb()); + break; + case ControlType::Scrollbar: + if ((part == ControlPart::DrawBackgroundVert) + || (part == ControlPart::DrawBackgroundHorz)) + { + m_image->fill( KApplication::palette().color(QPalette::Window).rgb() ); + break; + } + SAL_FALLTHROUGH; // Qt::transparent + default: + m_image->fill( Qt::transparent ); + break; + } QRegion* localClipRegion = nullptr; if (type == ControlType::Pushbutton) { - m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_PushButton, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); @@ -309,7 +342,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, QRect menuItemRect( region2QRect( menuVal->maItemRect )); QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(), widgetRect.size().expandedTo( menuItemRect.size())); - m_image->fill( Qt::transparent ); draw( QStyle::CE_MenuItem, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value), rect ); } @@ -328,7 +360,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if ( (type == ControlType::Toolbar) && (part == ControlPart::Button) ) { - m_image->fill( Qt::transparent ); QStyleOptionToolButton option; option.arrowType = Qt::NoArrow; @@ -396,7 +427,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, vclStateValue2StateFlag(nControlState, value) ); break; case ControlPart::ButtonDown: - m_image->fill( Qt::transparent ); option.subControls = QStyle::SC_ComboBoxArrow; draw( QStyle::CC_ComboBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); @@ -407,7 +437,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == ControlType::ListNode) { - m_image->fill( Qt::transparent ); QStyleOption option; option.state = QStyle::State_Item | QStyle::State_Children; @@ -419,7 +448,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == ControlType::Checkbox) { - m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_CheckBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); @@ -482,7 +510,6 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == ControlType::Radiobutton) { - m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_RadioButton, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); @@ -504,7 +531,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == ControlType::WindowBackground) { - m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); + // Nothing to do - see "Default image color" switch ^^ } else if (type == ControlType::Fixedline) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
