add backgroundHints for the panel View (disable/enable Effects and shadows for a Panel)
ClosedPublic

Authored by mvourlakos on Nov 6 2016, 4:38 PM.

Details

Summary

This patch adds a variable called "backgroundHints" which can be used with (NoBackground) through qml in order to enable/disable the KWin effects for a specific panel and the panel shadows in case the effects are disabled.

Currently these effects are (Blur and Background Contrast)

Test Plan

I tested it in Plasma Desktop by adding in views/Panel.qml the following code,

Binding {
    target: panel
    property: "backgroundHints"
    when: containment
    value: {
        if (!containment) {
            return;
        }
        
        return containment.backgroundHints; 
    }
}

when a panel has set its backgroundHints to NoBackground then Blur and Background Contrast are disabled for this Panel....

Diff Detail

Repository
R120 Plasma Workspace
Lint
Lint Skipped
Unit
Unit Tests Skipped
mvourlakos updated this revision to Diff 7943.Nov 6 2016, 4:38 PM
mvourlakos retitled this revision from to Disable / Enable Effects for a Panel.
mvourlakos updated this object.
mvourlakos edited the test plan for this revision. (Show Details)
mvourlakos added reviewers: Plasma, davidedmundson.
mvourlakos set the repository for this revision to R120 Plasma Workspace.
mvourlakos added a project: Plasma.
Restricted Application added a subscriber: plasma-devel. · View Herald TranscriptNov 6 2016, 4:38 PM

I just want to open the discussion if we can change things in panelview ...

I have in my mind also a variable to disable borders(shadows) when a panel has set NoBackground as backgroundHint

mvourlakos added a comment.EditedNov 6 2016, 4:58 PM

with that variable I can also disable the shadows for the panel by adding in panelview.cpp,

void PanelView::updateEnabledBorders()
{
    Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
    
    if (!m_effects) {
       borders = Plasma::FrameSvg::NoBorder;
    }
broulik added a subscriber: broulik.Nov 6 2016, 8:11 PM

I think NoBackground should just do this - this would also be consistent with Plasma Dialog where disabling the standard background turns off everything.

I think NoBackground should just do this - this would also be consistent with Plasma Dialog where disabling the standard background turns off everything.

do you know a way for panelview to access the containment.backgroundHints ? (from the AppletInterface in order to achieve what you are proposing)

davidedmundson edited edge metadata.Nov 7 2016, 9:25 AM

I think NoBackground should just do this - this would also be consistent with Plasma Dialog where disabling the standard background turns off everything.

I would 100% agree, but the difference between panel and dialog is that dialog draws the frame background, panel doesn't.

So "just doing it" still means changing two pieces of code in two repos to be in sync, at which point an explicit API (this patch) is probably the cleaner option.

mart added a subscriber: mart.Nov 7 2016, 1:36 PM

i prefer this to be based onto containment.backgroundhits as well, i don't like explicit api for this at all.
so not having a background would remove the frame background *and* disable the effects

so not having a background would remove the frame background *and* disable the effects

That is the proposal here also.

The difference is whether Panel.qml connects to AppletInterface *and* PanelView connects to AppletInterface.
Or Panel.qml connects to AppletInterface and then Panel.qml tells PanelView what effect to do
.
From a conusmer POV it'll be exactly the same.

Code wise, it's much more awkward to do the first one as it needs to go through the property(_graphicsObject)<AppletInterface>() malarky.

mart added a comment.Nov 7 2016, 1:52 PM

From a conusmer POV it'll be exactly the same.

Code wise, it's much more awkward to do the first one as it needs to go through the property(_graphicsObject)<AppletInterface>() malarky.

yeah, i kinda wish panelview painted its own framesvg like Dialog..

even if not changing anything about the architecture, I think if even if not 100% technically correct, the api would sound better with the effects property actually replaced with backgroundhits like the applet (or even a drawsownbackground bool, but would prefer actually using backgroundhits). The implmentation would stay as is

mvourlakos updated this revision to Diff 7976.EditedNov 7 2016, 2:41 PM
mvourlakos updated this object.
mvourlakos edited edge metadata.

clean up a bit and comment more...

  • even though on startup the shadows are shown correctly with disabled effects, when changing the plasma theme they are re-appearing,

commenting in function void PanelView::updateEnabledBorders() the line,

//if (m_enabledBorders != borders) {

fixes the isssue but needs investigation why this happens

a transparent Now Dock panel with Blur Effect enabled for Plasma

In D3282#61326, @mart wrote:

even if not changing anything about the architecture, I think if even if not 100% technically correct, the api would sound better with the effects property actually replaced with backgroundhits like the applet (or even a drawsownbackground bool, but would prefer actually using backgroundhits). The implmentation would stay as is

I will wait for the discussion to conclude in this...
I suppose there are three ideas:

  1. keep "effects variable
  2. replace "effects" variable with backgroundHints one of type Plasma::Applet::BackgroundHint
  3. rename "effects" variable to drawsownbackground

I could try (2) but I will wait first for your confirmation....
In the qml part there would be then a "panel.backgroundHints" variable to use instead of "panel.effects"...

mvourlakos updated this revision to Diff 8045.Nov 9 2016, 5:17 PM
mvourlakos retitled this revision from Disable / Enable Effects for a Panel to add backgroundHints for the panel View (disable/enable Effects and shadows for a Panel).
mvourlakos updated this object.
mvourlakos edited the test plan for this revision. (Show Details)

according to the previous discussion I dropped the effects variable and I used the backgroundHints in order to disable effects and shadows

mvourlakos updated this revision to Diff 8046.Nov 9 2016, 5:22 PM

removed whitespaces...

davidedmundson accepted this revision.Nov 11 2016, 4:28 PM
davidedmundson edited edge metadata.
This revision is now accepted and ready to land.Nov 11 2016, 4:28 PM

Thank u!!!

Unfortunately I dont have commit access yet.. I am going to request a developer acount afterwards...
Is it possible for someone to commit this patch and D3283?

this has been commited !!!