Bug 193808 - Shading is not working when composite is enabled
Summary: Shading is not working when composite is enabled
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: VHI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 193853 193977 194260 194383 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-23 21:29 UTC by Rasmus Steinke
Modified: 2009-06-16 17:44 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rasmus Steinke 2009-05-23 21:29:54 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

When rightclicking a window titlebar -> shade, the window does not shade at all. Instead it gives some graphical glitch.

Without composite this works fine...
Comment 1 Martin Flöser 2009-05-23 21:54:25 UTC
actual shading is working, but the window content area is not repainted. You can take the shaded window and move it around to "clear" the area.
Comment 2 Thomas Lübking 2009-05-23 22:00:42 UTC
only hits opengl backend (dri or not) and opaque windows (i.e. ARGB and
translucent windows are not affected) so a hotfix was to check shade state on
Scene::Window::isOpaque() (Client* c = dynamic_cast< Client* >( toplevel ); ...
&& !c->isShade()) but i guess fixing clipping in scene_opengl.cpp would be
cleaner :-(
Comment 3 Martin Flöser 2009-05-23 22:11:22 UTC
Just used show paint plugin. When the window is shaded the content is painted again. So I don't get it...

Idea for a better workaround is to not paint content quads in SceneOpenGL::Window::performPaint() for shaded windows
Comment 4 Martin Flöser 2009-05-23 22:29:25 UTC
(In reply to comment #3)
> Idea for a better workaround is to not paint content quads in
> SceneOpenGL::Window::performPaint() for shaded windows
No that doesn't work. Somehow it looks like the window get's repainted before it is shaded.
Comment 5 Thomas Lübking 2009-05-23 22:40:40 UTC
did you notice that
:1445 "if ( ! ((mask & PAINT_DECORATION_ONLY) || client && client->isShaded()) )"

break the lower decoration of shaded windows at your side as well? (they seem transparent, shadows are as expected...)
Comment 6 Thomas Lübking 2009-05-23 22:45:24 UTC
the window area btw remains broken - it never gets cleaned or the window is assumed to be present and the area gets "cleaned" w/ a transparent texture (that's why a translucent window does not show that effect)
Comment 7 Thomas Lübking 2009-05-23 23:34:57 UTC
d'ohh - error on my side:
the issue occurs with render as well (i guess i tested it with the config dialog which happens to be translucent...)

so i guess the problem is much rather somewhere in scene.cpp

sorry :-(
Comment 8 Thomas Lübking 2009-05-23 23:50:49 UTC
GOT YA!
scene.cpp:236 data.clip = w->isOpaque() ? QRegion(w->clientRect().translated( w->x(), w->y())) : QRegion();

clips away the deco from opaque windows to allow translucent decos, this breaks shading

scene.cpp:236 data.clip = w->isOpaque() ? QRegion(w->rect().translated( w->x(), w->y())) : QRegion();
fixes this but breaks translucent decos

as toplevel is protected in Scene::Window we need this class to pass the isShade info (i think) so the render chain can query this and handle them like translucent windows (to permit translucent "decos").

is there some freeze on that class or can we manipulate the api?
Comment 9 Martin Flöser 2009-05-24 11:12:53 UTC
*** Bug 193853 has been marked as a duplicate of this bug. ***
Comment 10 Thomas Lübking 2009-05-24 12:24:04 UTC
... or we just fix Client::clientSize() (i.e. set client_size in Client::setShade(), client.cpp ) or adjust Scene::Window::clientRect()

question is how critical it will be to adjust the client_size to a null rect in Client::setShade() (why isn't it updated and would updating it cause any other known issues?)
Comment 11 Martin Flöser 2009-05-24 22:01:39 UTC
I don't know if it is related, but windows with an own shape create artefacts as well. For example moving kscd creates artefacts or drag&drop a plasmoid from add widgets dialog. In case of kscd changing opacity fixes the issue, that's why I think it could be related.

This seems to be a problem since ARGB decos as well and I was able to reproduce in both XRender and OpenGL.
Comment 12 Thomas Lübking 2009-05-24 23:50:27 UTC
...kscd has a shaped window?
did i miss something? (it's not like i'd play CDDAs on a regular base, but i never saw kscd shaped...)

but i /can/ confirm it for XEyes...

the reason is that obviously a whole rect is assumed to be opaque (there there needed to be a ::clientRegion() or (not by deco) shaped windows need to be handled as ARGB/translucent ones in this function as well)

afaics clientRect is only used in the scene painting routine and it's base client_size seems to be set only a few times in geometry.cpp, so it should be safe to return a isNull() rect
(Client also provides shape() from Toplevel, so exporting /this/ by Scene::Window and handle them as ARGB should fix this (i'm actually not sure if it would be worth the effort to make a clientRegion() function - these windows tend to be small and handling a complex clipregion on the CPU will likely hurt more than some redundant pixels on the GPU)


oh and btw:
of course blurring fixes this ;-)
Comment 13 lucas 2009-05-25 06:10:15 UTC
*** Bug 193977 has been marked as a duplicate of this bug. ***
Comment 14 charly ghislain 2009-05-26 00:36:54 UTC
Sometimes the repaint issue occurs elsewhere :
- konsole background (set to translucent)
- desktop right click
- passive loading cursor
- ...

It occurs now on a new session, but i couldn't reproduce a while back on a session running for some times.
Comment 15 charly ghislain 2009-05-26 00:58:38 UTC
The cases i just reported fall into whats explained at #6. Sorry.
Comment 16 Martin Flöser 2009-05-27 09:55:41 UTC
*** Bug 194260 has been marked as a duplicate of this bug. ***
Comment 17 Fredrik Höglund 2009-05-27 18:05:03 UTC
SVN commit 973673 by fredrik:

Fix shaded and shaped windows not being clipped correctly.
BUG: 193808


 M  +9 -5      scene.cpp  
 M  +1 -1      scene.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=973673
Comment 18 lucas 2009-05-28 06:08:06 UTC
*** Bug 194383 has been marked as a duplicate of this bug. ***
Comment 19 Ben Boeckel 2009-06-16 17:44:55 UTC
This is fixed in 4.3b2, however it may have caused a new problem. Now when shading, any child dialogs are also hidden. This did not happen before.