Merge lp:~agateau/unity-2d/no-frame-around-disabled-menubar-items into lp:unity-2d/3.0

Proposed by Aurélien Gâteau
Status: Merged
Approved by: Florian Boucault
Approved revision: 485
Merged at revision: 493
Proposed branch: lp:~agateau/unity-2d/no-frame-around-disabled-menubar-items
Merge into: lp:unity-2d/3.0
Diff against target: 20 lines (+8/-2)
1 file modified
panel/app/unity2dstyle.cpp (+8/-2)
To merge this branch: bzr merge lp:~agateau/unity-2d/no-frame-around-disabled-menubar-items
Reviewer Review Type Date Requested Status
Florian Boucault Pending
Review via email: mp+55138@code.launchpad.net

Commit message

[panel] Do not draw a sunken border behind disabled menubar items

Description of the change

Do not draw a sunken border behind disabled menubar items

Apps such as Deluge should be fixed: it is against the GNOME HIG to have disabled items in a menubar. Nevertheless, let's not look ugly because of broken apps.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/app/unity2dstyle.cpp'
2--- panel/app/unity2dstyle.cpp 2011-02-02 16:57:00 +0000
3+++ panel/app/unity2dstyle.cpp 2011-03-28 12:33:33 +0000
4@@ -43,8 +43,14 @@
5 void Unity2dStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
6 {
7 if (element == QStyle::CE_MenuBarItem && widget) {
8- // Avoid solid gray background behind the menubar items
9- QProxyStyle::drawControl(element, option, painter, 0);
10+ QStyleOptionMenuItem opt = *qstyleoption_cast<const QStyleOptionMenuItem*>(option);
11+ if (!(opt.state & QStyle::State_Enabled) && (opt.state & QStyle::State_Sunken)) {
12+ // Reset State_Sunken flag to avoid drawing a frame on a disabled menu item
13+ // See https://bugs.launchpad.net/unity-2d/+bug/717744
14+ opt.state ^= QStyle::State_Sunken;
15+ }
16+ // Skip "widget" parameter to avoid solid gray background behind the menubar items
17+ QProxyStyle::drawControl(element, &opt, painter, 0);
18 } else if (element == QStyle::CE_MenuBarEmptyArea) {
19 // Avoid gray borders around the menubar items
20 } else {

Subscribers

People subscribed via source and target branches