Merge lp:~smspillaz/unity/unity.less-paint-insanity into lp:unity

Proposed by Sam Spilsbury
Status: Work in progress
Proposed branch: lp:~smspillaz/unity/unity.less-paint-insanity
Merge into: lp:unity
Diff against target: 1599 lines (+765/-158)
21 files modified
plugins/unityshell/src/ScreenEffectFramebufferObject.cpp (+0/-2)
plugins/unityshell/src/compizminimizedwindowhandler.h (+2/-0)
plugins/unityshell/src/comptransientfor.cpp (+3/-0)
plugins/unityshell/src/comptransientfor.h (+3/-0)
plugins/unityshell/src/inputremover.cpp (+3/-0)
plugins/unityshell/src/inputremover.h (+2/-0)
plugins/unityshell/src/minimizedwindowhandler.cpp (+3/-0)
plugins/unityshell/src/minimizedwindowhandler.h (+3/-0)
plugins/unityshell/src/transientfor.cpp (+4/-0)
plugins/unityshell/src/transientfor.h (+3/-0)
plugins/unityshell/src/unityshell.cpp (+175/-119)
plugins/unityshell/src/unityshell.h (+36/-14)
tests/CMakeLists.txt (+2/-0)
tests/test-input-remover/test-input-remover.cpp (+2/-0)
tests/test-minimize-window-handler/test-minimize-handler.cpp (+2/-0)
tests/test_shell_paint_schedule.cpp (+271/-0)
tests/test_showdesktop_handler.cpp (+30/-23)
tests/x11-window-read-transients.cpp (+2/-0)
unity-shared/CMakeLists.txt (+1/-0)
unity-shared/ShellPaintSchedule.cpp (+93/-0)
unity-shared/ShellPaintSchedule.h (+125/-0)
To merge this branch: bzr merge lp:~smspillaz/unity/unity.less-paint-insanity
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) Abstain
jenkins (community) continuous-integration Approve
Tim Penhey Pending
Daniel van Vugt Pending
Jason Smith Pending
Marco Trevisan (Treviño) Pending
Review via email: mp+112045@code.launchpad.net

This proposal supersedes a proposal from 2012-06-24.

Description of the change

== Problem ==

The old implementation of ensuring that unity gets painted in the right place and the nux base windows aren't painted was to hook getWindowPaintList and remove nux windows from the list every single time compiz draws a frame.

That resulted in lots of list copying.

In addition, every time we painted a window, we needed to check if it was actually above a nux window by scanning the paint list down, and the complexity of that grew by o(logN) for every new window added.

== Solution ==

Just hook glPaint, skip the wrap chain to core (eg every single plugin skipped) and tell core not to do anything with the window by returning false

== Errata ==

I have no idea why there is a bunch of logic about whether or not to paint the panel in glDraw (that was moved to glPaint). Someone enlighten me?

Blocked by: https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1012956/+merge/110268

== Test ==

Unit tests included, code refactored to get under test

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Bump?

I'd like to see this go in, because it should reduce lots of list copying within unity and also lots of unecessary list traversal, which should represent a nice speed boost. In addition, its far simpler in its implementation and far less bug prone.

I'm sure testing is probably an issue. I'll have another quick look at the code and see if I can think of a way to get it under test.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Works for me. Though there are some indentation/tab mismatches around line 107. Looks like your tabs are not 8 characters wide like they should be?

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

indentation fixed ... will add tests when I have time.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Manual testing -> Works well.

This branch also appears to solve the problem of my missing panel shadow when running dev builds of Unity. But that's just a bonus.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Whoops. It turns out this branch is tricking the decor plugin into painting (proper) shadows for the panel and launcher. It looks awesome so I hope we can keep it. But it's probably a mistake.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> Whoops. It turns out this branch is tricking the decor plugin into painting
> (proper) shadows for the panel and launcher. It looks awesome so I hope we can
> keep it. But it's probably a mistake.

It probably is, thanks for catching that.

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Back, with tests.

The decor plugin is going to try and draw shadows now on the launcher and panel. That's a bug in the decor plugin. See https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1012956/+merge/110268

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Hmm, I was happy with the old proposal. It was so nice and simple. Now I'm seeing lots more green than red, which is not ideal.

I think the implementation is too abstract for its own good. Words like "Requestor", "Interface", "BindingQuery" and "dispatch" confuse what was once simpler code, making maintenance more difficult. Rewriting code to produce something that's harder to understand is much worse than no test cases.

Maybe another day I'll feel more optimistic and test and review it again properly.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

The code is abstract so we can get it under test. More classes with single responsibilities is not a bad thing.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

It shouldn't be a choice between readability and testability. It is possible to write readable code that is testable too.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

The code is readable.

The whole point of coding to interfaces is so that you can clearly label the intent of each particular process that is going on.

For example, I know just from looking at the class names that:

The paint dispatch is responsible for queuing paint requests to the painter
The painter queries whether an fbo was bound to perform a particular operation
Paint Requestors fufill the role of requesting a repaint

That's so much more clear than the voodoocode of how it used to work with stuff like

421 - if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ())
... PaintDisplay ()

In UnityWindow::glDraw and in UnityWindow::glPaintOutput

If another person comes along and reads that, they now need to figure out what forcePaintOnTop represents, where doShellRepaint is set and unset, why the code is there twice in two different "paint" functions. They also need to figure out where allowWindowPaint is set, why it is set, what it represents, etc.

In addition, there are no tests that the maintainer can go to to see how all the bits fit together. And there is no way for the maintainer to know if they've broken that code.

More Diff Size != Less Maintainability.

Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

Sam,

This code isn't really that readable. The code it is replacing
wasn't really readable either to anyone who doesn't deeply
understand the internals of the compiz drawing machinary.

I do agree that "more diff size != less maintainability", however
in this case, the class names and method names do not express
intent. I am not able to clearly follow what is supposed to be
happening here.

As an example, we have "FBOBindingQueryInterface", which has a
single pure virtual function called "WasBound". However this
method reflects the internal state of some object. It does not
describe the intent, or why a bound FBO is an important thing.

There is no documentation in the header files for any of these
classes compounding their confusion.

I'd suggest that we put all the methods and headers here into a
nested namespace inside unity, as it is directly related to
compiz painting. So unity::compiz or unity::plugin. Givin there
is a ::compiz namespace, it probably makes sense to have it in
namespace unity::plugin.

The constants inside ShellPaintRequestorInterface should really
be an enum. Also it isn't specified that the paint requestors
are supposed to be masks, or that the values will be used as
masks. Also, if we have a nested namespace with an enum, the
enum could be moved outside the class itself.

The fact that I had to do many searchs in the diff to work out
who called what with which parameters is an indicator of how hard
this code is to follow.

On matters of style, this code should follow the unity style
guidelines, not compiz, so * and & next to type not variable
names, no spaces before ().

Also unity has a strong preference for sigc::slot definitions for
functions, not boost::functions.

The fundamental objection I have to this is that the new code and
interfaces don't sufficiently describe the intent, but instead
leak implementation details into the class and method names.

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

(cant reply inline)

On "not being able to follow what is happening here" : can you clarify?

On FBOBindingQueryInterface: I will see if this can be removed ... I think it may not be necessary

On namespaces: ack

On enums: I will change the constants to enums if they can be used as masks

On searching the diff: please clarify

On leaking implementation: please clarify (Apart from the fbo query, which I agree is an ugly leak)

Sent from Samsung Mobile

 Tim Penhey <email address hidden> wrote:

Review: Needs Fixing

Sam,

This code isn't really that readable.  The code it is replacing
wasn't really readable either to anyone who doesn't deeply
understand the internals of the compiz drawing machinary.

I do agree that "more diff size != less maintainability", however
in this case, the class names and method names do not express
intent.  I am not able to clearly follow what is supposed to be
happening here.

As an example, we have "FBOBindingQueryInterface", which has a
single pure virtual function called "WasBound".  However this
method reflects the internal state of some object.  It does not
describe the intent, or why a bound FBO is an important thing.

There is no documentation in the header files for any of these
classes compounding their confusion.

I'd suggest that we put all the methods and headers here into a
nested namespace inside unity, as it is directly related to
compiz painting.  So unity::compiz or unity::plugin.  Givin there
is a ::compiz namespace, it probably makes sense to have it in
namespace unity::plugin.

The constants inside ShellPaintRequestorInterface should really
be an enum.  Also it isn't specified that the paint requestors
are supposed to be masks, or that the values will be used as
masks.  Also, if we have a nested namespace with an enum, the
enum could be moved outside the class itself.

The fact that I had to do many searchs in the diff to work out
who called what with which parameters is an indicator of how hard
this code is to follow.

On matters of style, this code should follow the unity style
guidelines, not compiz, so * and & next to type not variable
names, no spaces before ().

Also unity has a strong preference for sigc::slot definitions for
functions, not boost::functions.

The fundamental objection I have to this is that the new code and
interfaces don't sufficiently describe the intent, but instead
leak implementation details into the class and method names.

--
https://code.launchpad.net/~smspillaz/unity/unity.less-paint-insanity/+merge/110267
You are the owner of lp:~smspillaz/unity/unity.less-paint-insanity.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Leaving this open for now so I can get some more suggestions as to the desired design before I go back in and refactor it.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Nuked FBOBindingQueryInterface, changed the masks to enum and moved stuff into unity::compiz. Unfortunately that caused ambiguity in namespace lookup so I moved the other stuff in compiz to unity::compiz

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I'm resubmitting this so that it goes to the top again.

I expect this to be marked needs fixing again, but I need some more detailed feedback as to where the design can be improved. I won't merge this fix in without tests.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

As per my previous comments, I think there are a few poor naming decisions here. That coupled with the increase in complexity makes the code much less maintainable than it already is. Despite the test cases.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> As per my previous comments, I think there are a few poor naming decisions
> here. That coupled with the increase in complexity makes the code much less
> maintainable than it already is. Despite the test cases.

Thanks Daniel, but I need more detailed feedback than that. Preferably some concrete ideas on how I can make the existing code better while still keeping the tests.

Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2404
http://s-jenkins:8080/job/unity-ci/3/

review: Disapprove (continuous-integration)
Revision history for this message
Martin Mrazik (mrazik) wrote : Posted in a previous version of this proposal

The failure above is because of this:
[...]
/home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbuilder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp: In member function ‘bool unity::UnityScreen::WasBound()’:
/home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbuilder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp:741:16: error: ‘class unity::ScreenEffectFramebufferObject’ has no member named ‘NewContentsValid’
/home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbuilder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp:745:1: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: all warnings being treated as errors

It this a problem on jenkins side (build dependencies not 100% up to date)?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> The failure above is because of this:
> [...]
> /home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbui
> lder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp: In member
> function ‘bool unity::UnityScreen::WasBound()’:
> /home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbui
> lder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp:741:16: error:
> ‘class unity::ScreenEffectFramebufferObject’ has no member named
> ‘NewContentsValid’
> /home/ubuntu/jenkins/workspace/unity-ci/distribution/precise/flavor/amd64/pbui
> lder_setup/work/trunk/plugins/unityshell/src/unityshell.cpp:745:1: error:
> control reaches end of non-void function [-Werror=return-type]
> cc1plus: all warnings being treated as errors
>
> It this a problem on jenkins side (build dependencies not 100% up to date)?

Likely not, probably a typo somewhere. Fixing.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

BTW, Jenkins should put "needs fixing" rather than "disapprove". Disapprove means that you disagree with the whole concept, if it fails CI, it just needs work.

Revision history for this message
Martin Mrazik (mrazik) wrote : Posted in a previous version of this proposal

> BTW, Jenkins should put "needs fixing" rather than "disapprove". Disapprove
> means that you disagree with the whole concept, if it fails CI, it just needs
> work.

Good point. I'll fix it.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

(Resubmitting again for some detailed feedback after fixing the CI quirk)

Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:2405
http://s-jenkins:8080/job/unity-ci/19/

review: Approve (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :

PASSED: Continuous integration, rev:2405
http://s-jenkins:8080/job/unity-ci/20/

review: Approve (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Abstain
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I am marking this Work in Progress for now.

Now that regionalDamage is merged in, there are going to be quite massive conflicts, all of which need to be cleaned up. Because regionalDamage has to use the same technique this branch is using, this branch will be re-purposed towards getting all of the paint optimization and stack placement code under test, since it is now going to be incredibly easy to break.

Unmerged revisions

2405. By Sam Spilsbury

Remove unused method and rename methods to make more sense

2404. By Sam Spilsbury

Merge lp:unity

2403. By Sam Spilsbury

Basic documentation, not really a substitute for better code ...

2402. By Sam Spilsbury

Nuke FBOBindingQueryInterface

2401. By Sam Spilsbury

unsigned int -> enum && move namespace compiz {} to namespace unity::compiz

2400. By Sam Spilsbury

Change namespace to unity::compiz

2399. By Sam Spilsbury

Merge lp:unity

2398. By Sam Spilsbury

Merge lp:unity

2397. By Sam Spilsbury

Test prohibited paint requestor retreival

2396. By Sam Spilsbury

Tests for RepaintPending value

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/ScreenEffectFramebufferObject.cpp'
--- plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-05-28 03:19:35 +0000
+++ plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-06-26 09:53:58 +0000
@@ -76,7 +76,6 @@
76 mScreenSize = screenSize;76 mScreenSize = screenSize;
77}77}
7878
79
80void unity::ScreenEffectFramebufferObject::unbind ()79void unity::ScreenEffectFramebufferObject::unbind ()
81{80{
82 if (!mBoundCnt)81 if (!mBoundCnt)
@@ -212,7 +211,6 @@
212 mBoundCnt++;211 mBoundCnt++;
213}212}
214213
215
216unity::ScreenEffectFramebufferObject::ScreenEffectFramebufferObject (GLXGetProcAddressProc p, const nux::Geometry &geom)214unity::ScreenEffectFramebufferObject::ScreenEffectFramebufferObject (GLXGetProcAddressProc p, const nux::Geometry &geom)
217 : getProcAddressGLX (p)215 : getProcAddressGLX (p)
218 , mFboStatus (false)216 , mFboStatus (false)
219217
=== modified file 'plugins/unityshell/src/compizminimizedwindowhandler.h'
--- plugins/unityshell/src/compizminimizedwindowhandler.h 2012-05-31 09:28:02 +0000
+++ plugins/unityshell/src/compizminimizedwindowhandler.h 2012-06-26 09:53:58 +0000
@@ -29,6 +29,7 @@
29#include <memory>29#include <memory>
3030
31// Will be merged back into compiz31// Will be merged back into compiz
32namespace unity {
32namespace compiz {33namespace compiz {
3334
34class PrivateCompizMinimizedWindowHandler35class PrivateCompizMinimizedWindowHandler
@@ -357,5 +358,6 @@
357 Window::get (w)->window->minimize();358 Window::get (w)->window->minimize();
358 }359 }
359}360}
361}
360362
361#endif363#endif
362364
=== modified file 'plugins/unityshell/src/comptransientfor.cpp'
--- plugins/unityshell/src/comptransientfor.cpp 2012-03-14 06:24:18 +0000
+++ plugins/unityshell/src/comptransientfor.cpp 2012-06-26 09:53:58 +0000
@@ -21,6 +21,8 @@
2121
22#include "comptransientfor.h"22#include "comptransientfor.h"
2323
24namespace unity
25{
24namespace compiz26namespace compiz
25{27{
26class PrivateCompTransientForReader28class PrivateCompTransientForReader
@@ -84,3 +86,4 @@
8486
85 return false;87 return false;
86}88}
89}
8790
=== modified file 'plugins/unityshell/src/comptransientfor.h'
--- plugins/unityshell/src/comptransientfor.h 2012-05-31 09:28:02 +0000
+++ plugins/unityshell/src/comptransientfor.h 2012-06-26 09:53:58 +0000
@@ -28,6 +28,8 @@
28#include "transientfor.h"28#include "transientfor.h"
2929
30// Will be merged back into compiz30// Will be merged back into compiz
31namespace unity
32{
31namespace compiz33namespace compiz
32{34{
33class PrivateCompTransientForReader;35class PrivateCompTransientForReader;
@@ -51,5 +53,6 @@
51 PrivateCompTransientForReader *priv;53 PrivateCompTransientForReader *priv;
52};54};
53}55}
56}
5457
55#endif58#endif
5659
=== modified file 'plugins/unityshell/src/inputremover.cpp'
--- plugins/unityshell/src/inputremover.cpp 2012-03-24 02:57:48 +0000
+++ plugins/unityshell/src/inputremover.cpp 2012-06-26 09:53:58 +0000
@@ -24,6 +24,8 @@
24#include <cstdio>24#include <cstdio>
25#include <cstring>25#include <cstring>
2626
27namespace unity {
28
27compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface ()29compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface ()
28{30{
29}31}
@@ -348,3 +350,4 @@
348350
349 return true;351 return true;
350}352}
353}
351354
=== modified file 'plugins/unityshell/src/inputremover.h'
--- plugins/unityshell/src/inputremover.h 2012-04-23 12:25:44 +0000
+++ plugins/unityshell/src/inputremover.h 2012-06-26 09:53:58 +0000
@@ -28,6 +28,7 @@
28#include <X11/extensions/shape.h>28#include <X11/extensions/shape.h>
2929
30// Will be merged back into compiz30// Will be merged back into compiz
31namespace unity {
31namespace compiz {32namespace compiz {
3233
33class WindowInputRemoverInterface34class WindowInputRemoverInterface
@@ -127,5 +128,6 @@
127};128};
128129
129}130}
131}
130132
131#endif133#endif
132134
=== modified file 'plugins/unityshell/src/minimizedwindowhandler.cpp'
--- plugins/unityshell/src/minimizedwindowhandler.cpp 2012-04-23 12:25:44 +0000
+++ plugins/unityshell/src/minimizedwindowhandler.cpp 2012-06-26 09:53:58 +0000
@@ -23,6 +23,8 @@
23#include "inputremover.h"23#include "inputremover.h"
24#include <cstring>24#include <cstring>
2525
26namespace unity
27{
26namespace compiz28namespace compiz
27{29{
28class PrivateMinimizedWindowHandler30class PrivateMinimizedWindowHandler
@@ -273,3 +275,4 @@
273{275{
274 delete priv;276 delete priv;
275}277}
278}
276279
=== modified file 'plugins/unityshell/src/minimizedwindowhandler.h'
--- plugins/unityshell/src/minimizedwindowhandler.h 2012-04-18 09:19:44 +0000
+++ plugins/unityshell/src/minimizedwindowhandler.h 2012-06-26 09:53:58 +0000
@@ -30,6 +30,8 @@
30#include <boost/bind.hpp>30#include <boost/bind.hpp>
3131
32// Will be merged back into compiz32// Will be merged back into compiz
33namespace unity
34{
33namespace compiz35namespace compiz
34{36{
35class PrivateMinimizedWindowHandler;37class PrivateMinimizedWindowHandler;
@@ -58,5 +60,6 @@
58 PrivateMinimizedWindowHandler *priv;60 PrivateMinimizedWindowHandler *priv;
59};61};
60}62}
63}
6164
62#endif65#endif
6366
=== modified file 'plugins/unityshell/src/transientfor.cpp'
--- plugins/unityshell/src/transientfor.cpp 2012-03-14 06:24:18 +0000
+++ plugins/unityshell/src/transientfor.cpp 2012-06-26 09:53:58 +0000
@@ -21,6 +21,9 @@
2121
22#include "transientfor.h"22#include "transientfor.h"
2323
24namespace unity
25{
26
24Atom compiz::X11TransientForReader::wmTransientFor = None;27Atom compiz::X11TransientForReader::wmTransientFor = None;
25Atom compiz::X11TransientForReader::wmClientLeader = None;28Atom compiz::X11TransientForReader::wmClientLeader = None;
2629
@@ -216,3 +219,4 @@
216{219{
217 delete priv;220 delete priv;
218}221}
222}
219223
=== modified file 'plugins/unityshell/src/transientfor.h'
--- plugins/unityshell/src/transientfor.h 2012-05-31 09:28:02 +0000
+++ plugins/unityshell/src/transientfor.h 2012-06-26 09:53:58 +0000
@@ -29,6 +29,8 @@
29#include <string>29#include <string>
3030
31// Will be merged back into compiz31// Will be merged back into compiz
32namespace unity
33{
32namespace compiz34namespace compiz
33{35{
34class PrivateX11TransientForReader;36class PrivateX11TransientForReader;
@@ -57,5 +59,6 @@
57 PrivateX11TransientForReader *priv;59 PrivateX11TransientForReader *priv;
58};60};
59}61}
62}
6063
61#endif64#endif
6265
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-06-25 21:37:57 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-06-26 09:53:58 +0000
@@ -110,6 +110,8 @@
110 , screen(screen)110 , screen(screen)
111 , cScreen(CompositeScreen::get(screen))111 , cScreen(CompositeScreen::get(screen))
112 , gScreen(GLScreen::get(screen))112 , gScreen(GLScreen::get(screen))
113 , paint_dispatch_ (this,
114 boost::bind (&UnityScreen::GetProhibitedPaintMasks, this))
113 , debugger_(this)115 , debugger_(this)
114 , enable_shortcut_overlay_(true)116 , enable_shortcut_overlay_(true)
115 , gesture_engine_(screen)117 , gesture_engine_(screen)
@@ -117,8 +119,6 @@
117 , _in_paint(false)119 , _in_paint(false)
118 , super_keypressed_(false)120 , super_keypressed_(false)
119 , newFocusedWindow(nullptr)121 , newFocusedWindow(nullptr)
120 , doShellRepaint(false)
121 , allowWindowPaint(false)
122 , damaged(false)122 , damaged(false)
123 , _key_nav_mode_requested(false)123 , _key_nav_mode_requested(false)
124 , _last_output(nullptr)124 , _last_output(nullptr)
@@ -263,8 +263,8 @@
263 if (GL::fbo)263 if (GL::fbo)
264 {264 {
265 nux::Geometry geometry (0, 0, screen->width (), screen->height ());265 nux::Geometry geometry (0, 0, screen->width (), screen->height ());
266 uScreen->_fbo = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry));266 uScreen->fbo_ = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry));
267 uScreen->_fbo->onScreenSizeChanged (geometry);267 uScreen->fbo_->onScreenSizeChanged (geometry);
268 }268 }
269#endif269#endif
270270
@@ -740,16 +740,41 @@
740 panel_texture_has_changed_ = true;740 panel_texture_has_changed_ = true;
741}741}
742742
743#ifdef USE_MODERN_COMPIZ_GL743compiz::ShellPaintRequestorInterface::PaintRequestorType
744void UnityScreen::paintDisplay()744UnityScreen::GetPaintRequestorType ()
745#else745{
746void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask)746 return compiz::ShellPaintRequestorInterface::PaintRequestorType::Screen;
747}
748
749bool UnityScreen::PaintBackingFBO (CompOutput *output)
750{
751#ifndef USE_MODERN_COMPIZ_GL
752 bool was_bound = fbo_->bound ();
753 if (was_bound)
754 {
755 fbo_->unbind ();
756 GLMatrix sTransform;
757 sTransform.toScreenSpace (&screen->fullscreenOutput (), -DEFAULT_Z_CAMERA);
758 glPushMatrix ();
759 glLoadMatrixf (sTransform.getMatrix ());
760 fbo_->paint (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
761 glPopMatrix ();
762 }
763
764 return was_bound;
747#endif765#endif
766 return false;
767}
768
769void UnityScreen::PaintDisplay ()
748{770{
749 CompOutput *output = _last_output;771 CompOutput *output = _last_output;
750772
751#ifndef USE_MODERN_COMPIZ_GL773#ifndef USE_MODERN_COMPIZ_GL
752 bool was_bound = _fbo->bound ();774 bool was_bound = PaintBackingFBO (output);
775#else
776 bool was_bound = true;
777#endif
753778
754 if (nux::GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath())779 if (nux::GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath())
755 {780 {
@@ -785,28 +810,18 @@
785 }810 }
786 }811 }
787812
788 _fbo->unbind ();
789
790 /* Draw the bit of the relevant framebuffer for each output */813 /* Draw the bit of the relevant framebuffer for each output */
791814
792 if (was_bound)815 GLuint fbo_texture_name = 0;
793 {816#ifndef USE_MODERN_COMPIZ_GL
794 GLMatrix sTransform;817 fbo_texture_name = fbo_->texture();
795 sTransform.toScreenSpace (&screen->fullscreenOutput (), -DEFAULT_Z_CAMERA);818#else
796 glPushMatrix ();819 fbo_texture_name = gScreen->fbo ()->tex ()->name ();
797 glLoadMatrixf (sTransform.getMatrix ());820#endif
798 _fbo->paint (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
799 glPopMatrix ();
800 }
801821
802 nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture =822 nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture =
803 nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(_fbo->texture(),823 nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(fbo_texture_name,
804 screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8);824 screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8);
805#else
806 nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture =
807 nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (),
808 output->width(), output->height(), 1, nux::BITFMT_R8G8B8A8);
809#endif
810825
811 nux::GetGraphicsDisplay()->GetGpuDevice()->backup_texture0_ = device_texture;826 nux::GetGraphicsDisplay()->GetGpuDevice()->backup_texture0_ = device_texture;
812827
@@ -829,7 +844,7 @@
829844
830 for (Window tray_xid : panel_controller_->GetTrayXids())845 for (Window tray_xid : panel_controller_->GetTrayXids())
831 {846 {
832 if (tray_xid && !allowWindowPaint)847 if (tray_xid && (no_paint_allowed_mask_ == ShellPaintRequestorInterface::PaintRequestorType::Window))
833 {848 {
834 CompWindow *tray = screen->findWindow (tray_xid);849 CompWindow *tray = screen->findWindow (tray_xid);
835850
@@ -907,15 +922,53 @@
907 }922 }
908 }923 }
909924
910 doShellRepaint = false;
911 damaged = false;925 damaged = false;
912}926}
913927
914bool UnityScreen::forcePaintOnTop ()928compiz::ShellPaintRequestorInterface::PaintRequestorType UnityScreen::GetProhibitedPaintMasks()
915{929{
916 return !allowWindowPaint ||930 bool unity_force_overlay = switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen();
917 ((switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen())931 bool no_screen_grabs = !(screen->grabbed () && !screen->otherGrabExist (NULL));
918 && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL))));932 bool fullscreen_windows = !fullscreen_windows_.empty ();
933
934 compiz::ShellPaintRequestorInterface::PaintRequestorType pmask = no_paint_allowed_mask_;
935
936 if (unity_force_overlay &&
937 fullscreen_windows &&
938 no_screen_grabs)
939 pmask = compiz::ShellPaintRequestorInterface::PaintRequestorType::Window;
940
941 return pmask;
942}
943
944bool UnityScreen::RequestShellRepaint (compiz::ShellPaintRequestorInterface *r)
945{
946 return paint_dispatch_.RequestShellRepaint (r);
947}
948
949bool UnityScreen::EnforcePaintByRequestor (compiz::ShellPaintRequestorInterface *r)
950{
951 return paint_dispatch_.EnforcePaintByRequestor (r);
952}
953
954void UnityScreen::AllowPaintByAnyRequestor ()
955{
956 paint_dispatch_.AllowPaintByAnyRequestor ();
957}
958
959compiz::ShellPaintRequestorInterface::PaintRequestorType UnityScreen::ProhibitedPaintRequestors()
960{
961 return paint_dispatch_.ProhibitedPaintRequestors ();
962}
963
964void UnityScreen::RequireShellRepaint ()
965{
966 paint_dispatch_.RequireShellRepaint ();
967}
968
969bool UnityScreen::RepaintPending ()
970{
971 return paint_dispatch_.RepaintPending ();
919}972}
920973
921void UnityWindow::paintThumbnail (nux::Geometry const& bounding, float alpha)974void UnityWindow::paintThumbnail (nux::Geometry const& bounding, float alpha)
@@ -1210,8 +1263,9 @@
1210{1263{
1211 bool ret;1264 bool ret;
12121265
1213 doShellRepaint = true;1266 AllowPaintByAnyRequestor ();
1214 allowWindowPaint = true;1267 RequireShellRepaint ();
1268 no_paint_allowed_mask_ = compiz::ShellPaintRequestorInterface::PaintRequestorType::Nil;
1215 _last_output = output;1269 _last_output = output;
1216 paint_panel_ = false;1270 paint_panel_ = false;
12171271
@@ -1226,16 +1280,13 @@
1226 * attempts to bind it will only increment1280 * attempts to bind it will only increment
1227 * its bind reference so make sure that1281 * its bind reference so make sure that
1228 * you always unbind as much as you bind */1282 * you always unbind as much as you bind */
1229 _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));1283 fbo_->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ()));
1230#endif1284#endif
12311285
1232 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */1286 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
1233 ret = gScreen->glPaintOutput(attrib, transform, region, output, mask);1287 ret = gScreen->glPaintOutput(attrib, transform, region, output, mask);
12341288
1235#ifndef USE_MODERN_COMPIZ_GL1289 RequestShellRepaint (this);
1236 if (doShellRepaint)
1237 paintDisplay(region, transform, mask);
1238#endif
12391290
1240 return ret;1291 return ret;
1241}1292}
@@ -1247,7 +1298,7 @@
1247{1298{
1248 bool useFbo = false;1299 bool useFbo = false;
12491300
1250 if (doShellRepaint)1301 if (RepaintPending ())
1251 {1302 {
1252 oldFbo = fbo->bind ();1303 oldFbo = fbo->bind ();
1253 useFbo = fbo->checkStatus () && fbo->tex ();1304 useFbo = fbo->checkStatus () && fbo->tex ();
@@ -1256,7 +1307,7 @@
1256 ::GLFramebufferObject::rebind (oldFbo);1307 ::GLFramebufferObject::rebind (oldFbo);
1257 return;1308 return;
1258 }1309 }
1259 paintDisplay();1310 RequestShellRepaint (this);
1260 ::GLFramebufferObject::rebind (oldFbo);1311 ::GLFramebufferObject::rebind (oldFbo);
1261 }1312 }
12621313
@@ -1273,7 +1324,7 @@
1273 CompOutput* output,1324 CompOutput* output,
1274 unsigned int mask)1325 unsigned int mask)
1275{1326{
1276 allowWindowPaint = false;1327 no_paint_allowed_mask_ = compiz::ShellPaintRequestorInterface::PaintRequestorType::Window;
1277 gScreen->glPaintTransformedOutput(attrib, transform, region, output, mask);1328 gScreen->glPaintTransformedOutput(attrib, transform, region, output, mask);
12781329
1279}1330}
@@ -2132,31 +2183,6 @@
2132 return "Unity";2183 return "Unity";
2133}2184}
21342185
2135bool isNuxWindow (CompWindow* value)
2136{
2137 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
2138 auto id = value->id();
2139
2140 // iterate loop by hand rather than use std::find as this is considerably faster
2141 // we care about performance here becuase of the high frequency in which this function is
2142 // called (nearly every frame)
2143 unsigned int size = xwns.size();
2144 for (unsigned int i = 0; i < size; ++i)
2145 {
2146 if (xwns[i] == id)
2147 return true;
2148 }
2149 return false;
2150}
2151
2152const CompWindowList& UnityScreen::getWindowPaintList()
2153{
2154 CompWindowList& pl = _withRemovedNuxWindows = cScreen->getWindowPaintList();
2155 pl.remove_if(isNuxWindow);
2156
2157 return pl;
2158}
2159
2160void UnityScreen::RaiseInputWindows()2186void UnityScreen::RaiseInputWindows()
2161{2187{
2162 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();2188 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
@@ -2169,13 +2195,11 @@
2169 }2195 }
2170}2196}
21712197
2172/* detect occlusions2198/* we want to paint underneath other windows here,
2173 *2199 * so we need to find if this window is actually
2174 * core passes down the PAINT_WINDOW_OCCLUSION_DETECTION2200 * stacked on top of one of the nux input windows
2175 * mask when it is doing occlusion detection, so use that2201 * and if so paint nux and stop us from painting
2176 * order to fill our occlusion buffer which we'll flip2202 * other windows or on top of the whole screen */
2177 * to nux later
2178 */
2179bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib,2203bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib,
2180 const GLMatrix& matrix,2204 const GLMatrix& matrix,
2181 const CompRegion& region,2205 const CompRegion& region,
@@ -2195,7 +2219,7 @@
21952219
2196 std::vector<Window> const& tray_xids = uScreen->panel_controller_->GetTrayXids();2220 std::vector<Window> const& tray_xids = uScreen->panel_controller_->GetTrayXids();
2197 if (std::find(tray_xids.begin(), tray_xids.end(), window->id()) != tray_xids.end() &&2221 if (std::find(tray_xids.begin(), tray_xids.end(), window->id()) != tray_xids.end() &&
2198 !uScreen->allowWindowPaint)2222 (uScreen->ProhibitedPaintRequestors () == compiz::ShellPaintRequestorInterface::PaintRequestorType::Window))
2199 {2223 {
2200 if (!uScreen->painting_tray_)2224 if (!uScreen->painting_tray_)
2201 {2225 {
@@ -2204,26 +2228,7 @@
2204 }2228 }
2205 }2229 }
22062230
2207 return gWindow->glPaint(wAttrib, matrix, region, mask);2231 if (uScreen->RepaintPending () && !uScreen->paint_panel_ && window->type() == CompWindowTypeNormalMask)
2208}
2209
2210/* handle window painting in an opengl context
2211 *
2212 * we want to paint underneath other windows here,
2213 * so we need to find if this window is actually
2214 * stacked on top of one of the nux input windows
2215 * and if so paint nux and stop us from painting
2216 * other windows or on top of the whole screen */
2217bool UnityWindow::glDraw(const GLMatrix& matrix,
2218#ifndef USE_MODERN_COMPIZ_GL
2219 GLFragment::Attrib& attrib,
2220#else
2221 const GLWindowPaintAttrib& attrib,
2222#endif
2223 const CompRegion& region,
2224 unsigned int mask)
2225{
2226 if (uScreen->doShellRepaint && !uScreen->paint_panel_ && window->type() == CompWindowTypeNormalMask)
2227 {2232 {
2228 guint32 id = window->id();2233 guint32 id = window->id();
2229 bool maximized = WindowManager::Default()->IsWindowMaximized(id);2234 bool maximized = WindowManager::Default()->IsWindowMaximized(id);
@@ -2239,29 +2244,63 @@
2239 }2244 }
2240 }2245 }
22412246
2242 if (uScreen->doShellRepaint && !uScreen->forcePaintOnTop ())2247 if (IsNuxWindow ())
2243 {2248 {
2244 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();2249 /* Windows are painted in top-to-bottom order
2245 unsigned int size = xwns.size();2250 * with occlusion detection on, so we can
22462251 * find out the top most nux window and paint
2247 for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev)2252 * there */
2248 {2253 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
2249 auto id = w->id();2254 {
22502255 GLWindowPaintAttrib noAlphaAttrib;
2251 for (unsigned int i = 0; i < size; ++i)2256
2252 {2257 noAlphaAttrib.opacity = OPAQUE;
2253 if (xwns[i] == id)2258 noAlphaAttrib.brightness = BRIGHT;
2254 {2259 noAlphaAttrib.saturation = COLOR;
2255#ifdef USE_MODERN_COMPIZ_GL2260
2256 uScreen->paintDisplay();2261 bool status = gWindow->glPaint (noAlphaAttrib,
2262 matrix,
2263 region,
2264 PAINT_WINDOW_OCCLUSION_DETECTION_MASK);
2265
2266 if (status)
2267 uScreen->EnforcePaintByRequestor (this);
2268
2269 /* We don't want core to take this window
2270 * into account when doing occlusion detection
2271 * however */
2272 return false;
2273 }
2274 /* Don't care about "fake" paints */
2275 else if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
2276 {
2277 return false;
2278 }
2279 else
2280 {
2281 uScreen->RequestShellRepaint (this);
2282
2283 /* Don't paint nux windows on the real paint pass */
2284 return false;
2285 }
2286 }
2287
2288 return gWindow->glPaint(wAttrib, matrix, region, mask);
2289}
2290
2291/* handle window painting in an opengl context
2292 */
2293bool UnityWindow::glDraw(const GLMatrix& matrix,
2294#ifndef USE_MODERN_COMPIZ_GL
2295 GLFragment::Attrib& attrib,
2257#else2296#else
2258 uScreen->paintDisplay(region, matrix, mask);2297 const GLWindowPaintAttrib& attrib,
2259#endif2298#endif
2260 break;2299 const CompRegion& region,
2261 }2300 unsigned int mask)
2262 }2301{
2263 }2302 if (IsNuxWindow ())
2264 }2303 return false;
22652304
2266 if (window->type() == CompWindowTypeDesktopMask)2305 if (window->type() == CompWindowTypeDesktopMask)
2267 uScreen->setPanelShadowMatrix(matrix);2306 uScreen->setPanelShadowMatrix(matrix);
@@ -2280,7 +2319,6 @@
2280 uScreen->paintPanelShadow(matrix);2319 uScreen->paintPanelShadow(matrix);
2281 }2320 }
22822321
2283
2284 return ret;2322 return ret;
2285}2323}
22862324
@@ -2755,8 +2793,8 @@
2755#ifndef USE_MODERN_COMPIZ_GL2793#ifndef USE_MODERN_COMPIZ_GL
2756 if (GL::fbo)2794 if (GL::fbo)
2757 {2795 {
2758 uScreen->_fbo = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry));2796 uScreen->fbo_ = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry));
2759 uScreen->_fbo->onScreenSizeChanged (geometry);2797 uScreen->fbo_->onScreenSizeChanged (geometry);
2760 }2798 }
2761#endif2799#endif
27622800
@@ -2922,6 +2960,18 @@
2922 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), _("Resize window."), shortcut::COMPIZ_MOUSE_OPTION, "resize", "initiate_button"));2960 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), _("Resize window."), shortcut::COMPIZ_MOUSE_OPTION, "resize", "initiate_button"));
2923}2961}
29242962
2963bool
2964UnityWindow::IsNuxWindow ()
2965{
2966 return is_nux_window_;
2967}
2968
2969compiz::ShellPaintRequestorInterface::PaintRequestorType
2970UnityWindow::GetPaintRequestorType ()
2971{
2972 return compiz::ShellPaintRequestorInterface::PaintRequestorType::Window;
2973}
2974
2925/* Window init */2975/* Window init */
2926UnityWindow::UnityWindow(CompWindow* window)2976UnityWindow::UnityWindow(CompWindow* window)
2927 : BaseSwitchWindow (dynamic_cast<BaseSwitchScreen *> (UnityScreen::get (screen)), window)2977 : BaseSwitchWindow (dynamic_cast<BaseSwitchScreen *> (UnityScreen::get (screen)), window)
@@ -2930,10 +2980,16 @@
2930 , gWindow(GLWindow::get(window))2980 , gWindow(GLWindow::get(window))
2931 , mMinimizeHandler()2981 , mMinimizeHandler()
2932 , mShowdesktopHandler(nullptr)2982 , mShowdesktopHandler(nullptr)
2983 , is_nux_window_ (false)
2933{2984{
2934 WindowInterface::setHandler(window);2985 WindowInterface::setHandler(window);
2935 GLWindowInterface::setHandler(gWindow);2986 GLWindowInterface::setHandler(gWindow);
29362987
2988 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
2989 for (unsigned int i = 0; i < xwns.size(); i++)
2990 if (xwns[i] == window->id ())
2991 is_nux_window_ = true;
2992
2937 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&2993 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
2938 window->mapNum ())2994 window->mapNum ())
2939 {2995 {
29402996
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-06-23 01:54:48 +0000
+++ plugins/unityshell/src/unityshell.h 2012-06-26 09:53:58 +0000
@@ -52,6 +52,7 @@
52#include "UBusWrapper.h"52#include "UBusWrapper.h"
53#include "UnityshellPrivate.h"53#include "UnityshellPrivate.h"
54#include "UnityShowdesktopHandler.h"54#include "UnityShowdesktopHandler.h"
55#include "ShellPaintSchedule.h"
55#ifndef USE_MODERN_COMPIZ_GL56#ifndef USE_MODERN_COMPIZ_GL
56#include "ScreenEffectFramebufferObject.h"57#include "ScreenEffectFramebufferObject.h"
57#endif58#endif
@@ -68,6 +69,9 @@
6869
69/* base screen class */70/* base screen class */
70class UnityScreen :71class UnityScreen :
72 public compiz::ShellPaintDispatchInterface,
73 public compiz::ShellPaintRequestorInterface,
74 public compiz::ShellPaintInterface,
71 public unity::debug::Introspectable,75 public unity::debug::Introspectable,
72 public sigc::trackable,76 public sigc::trackable,
73 public ScreenInterface,77 public ScreenInterface,
@@ -92,11 +96,8 @@
92 void nuxEpilogue();96 void nuxEpilogue();
9397
94 /* nux draw wrapper */98 /* nux draw wrapper */
95#ifdef USE_MODERN_COMPIZ_GL99 bool PaintBackingFBO (CompOutput *output);
96 void paintDisplay();100 void PaintDisplay ();
97#else
98 void paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask);
99#endif
100 void paintPanelShadow(const GLMatrix& matrix);101 void paintPanelShadow(const GLMatrix& matrix);
101 void setPanelShadowMatrix(const GLMatrix& matrix);102 void setPanelShadowMatrix(const GLMatrix& matrix);
102103
@@ -133,9 +134,6 @@
133 CompOutput*,134 CompOutput*,
134 unsigned int);135 unsigned int);
135136
136 /* Pop our InputOutput windows from the paint list */
137 const CompWindowList& getWindowPaintList();
138
139 /* handle X11 events */137 /* handle X11 events */
140 void handleEvent(XEvent*);138 void handleEvent(XEvent*);
141139
@@ -189,8 +187,6 @@
189 void NeedsRelayout();187 void NeedsRelayout();
190 void ScheduleRelayout(guint timeout);188 void ScheduleRelayout(guint timeout);
191189
192 bool forcePaintOnTop ();
193
194protected:190protected:
195 std::string GetName() const;191 std::string GetName() const;
196 void AddProperties(GVariantBuilder* builder);192 void AddProperties(GVariantBuilder* builder);
@@ -237,6 +233,18 @@
237233
238 void OnPanelStyleChanged();234 void OnPanelStyleChanged();
239235
236 compiz::ShellPaintRequestorInterface::PaintRequestorType GetPaintRequestorType ();
237 compiz::ShellPaintRequestorInterface::PaintRequestorType GetProhibitedPaintMasks ();
238
239 bool RequestShellRepaint (compiz::ShellPaintRequestorInterface *);
240 bool EnforcePaintByRequestor (compiz::ShellPaintRequestorInterface *);
241 void AllowPaintByAnyRequestor ();
242 ShellPaintRequestorInterface::PaintRequestorType ProhibitedPaintRequestors ();
243 void RequireShellRepaint ();
244 bool RepaintPending ();
245
246 compiz::ShellPaintDispatch paint_dispatch_;
247
240 Settings dash_settings_;248 Settings dash_settings_;
241 dash::Style dash_style_;249 dash::Style dash_style_;
242 panel::Style panel_style_;250 panel::Style panel_style_;
@@ -276,12 +284,9 @@
276 GLTexture::List _shadow_texture;284 GLTexture::List _shadow_texture;
277285
278 /* handle paint order */286 /* handle paint order */
279 bool doShellRepaint;
280 bool allowWindowPaint;
281 bool damaged;287 bool damaged;
282 bool _key_nav_mode_requested;288 bool _key_nav_mode_requested;
283 CompOutput* _last_output;289 CompOutput* _last_output;
284 CompWindowList _withRemovedNuxWindows;
285290
286 nux::Property<nux::Geometry> primary_monitor_;291 nux::Property<nux::Geometry> primary_monitor_;
287292
@@ -290,7 +295,7 @@
290#ifdef USE_MODERN_COMPIZ_GL295#ifdef USE_MODERN_COMPIZ_GL
291 ::GLFramebufferObject *oldFbo;296 ::GLFramebufferObject *oldFbo;
292#else297#else
293 ScreenEffectFramebufferObject::Ptr _fbo;298 ScreenEffectFramebufferObject::Ptr fbo_;
294 GLuint _active_fbo;299 GLuint _active_fbo;
295#endif300#endif
296301
@@ -317,15 +322,27 @@
317322
318 UBusManager ubus_manager_;323 UBusManager ubus_manager_;
319 glib::SourceManager sources_;324 glib::SourceManager sources_;
325 compiz::ShellPaintRequestorInterface::PaintRequestorType no_paint_allowed_mask_;
320326
321 friend class UnityWindow;327 friend class UnityWindow;
322};328};
323329
330class NuxBridgeWindowInterface
331{
332public:
333
334 virtual ~NuxBridgeWindowInterface () {};
335
336 virtual bool IsNuxWindow () = 0;
337};
338
324class UnityWindow :339class UnityWindow :
325 public WindowInterface,340 public WindowInterface,
326 public GLWindowInterface,341 public GLWindowInterface,
327 public ShowdesktopHandlerWindowInterface,342 public ShowdesktopHandlerWindowInterface,
328 public compiz::WindowInputRemoverLockAcquireInterface,343 public compiz::WindowInputRemoverLockAcquireInterface,
344 public NuxBridgeWindowInterface,
345 public compiz::ShellPaintRequestorInterface,
329 public BaseSwitchWindow,346 public BaseSwitchWindow,
330 public PluginClassHandler <UnityWindow, CompWindow>347 public PluginClassHandler <UnityWindow, CompWindow>
331{348{
@@ -423,7 +440,12 @@
423440
424 compiz::WindowInputRemoverLock::Ptr GetInputRemover ();441 compiz::WindowInputRemoverLock::Ptr GetInputRemover ();
425442
443 bool IsNuxWindow ();
444 compiz::ShellPaintRequestorInterface::PaintRequestorType GetPaintRequestorType ();
445
426 compiz::WindowInputRemoverLock::Weak input_remover_;446 compiz::WindowInputRemoverLock::Weak input_remover_;
447
448 bool is_nux_window_;
427 glib::Source::UniquePtr focus_desktop_timeout_;449 glib::Source::UniquePtr focus_desktop_timeout_;
428};450};
429451
430452
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2012-06-20 12:35:22 +0000
+++ tests/CMakeLists.txt 2012-06-26 09:53:58 +0000
@@ -150,6 +150,7 @@
150 test_unityshell_private.cpp150 test_unityshell_private.cpp
151 test_showdesktop_handler.cpp151 test_showdesktop_handler.cpp
152 test_hud_private.cpp152 test_hud_private.cpp
153 test_shell_paint_schedule.cpp
153 ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp154 ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
154 ${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp155 ${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
155 ${UNITY_SRC}/DebugDBusInterface.cpp156 ${UNITY_SRC}/DebugDBusInterface.cpp
@@ -162,6 +163,7 @@
162 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp163 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
163 ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutModel.cpp164 ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutModel.cpp
164 ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutHintPrivate.cpp165 ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutHintPrivate.cpp
166 ${CMAKE_SOURCE_DIR}/unity-shared/ShellPaintSchedule.cpp
165 ${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp167 ${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
166 ${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp168 ${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp
167 ${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp169 ${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
168170
=== modified file 'tests/test-input-remover/test-input-remover.cpp'
--- tests/test-input-remover/test-input-remover.cpp 2011-09-13 12:52:31 +0000
+++ tests/test-input-remover/test-input-remover.cpp 2012-06-26 09:53:58 +0000
@@ -27,6 +27,8 @@
27#include <unistd.h> 27#include <unistd.h>
28#include <sstream>28#include <sstream>
2929
30using namespace unity;
31
30void usage ()32void usage ()
31{33{
32 std::cout << "test-input-remover [WINDOW] [TIME]" << std::endl;34 std::cout << "test-input-remover [WINDOW] [TIME]" << std::endl;
3335
=== modified file 'tests/test-minimize-window-handler/test-minimize-handler.cpp'
--- tests/test-minimize-window-handler/test-minimize-handler.cpp 2012-04-18 09:19:44 +0000
+++ tests/test-minimize-window-handler/test-minimize-handler.cpp 2012-06-26 09:53:58 +0000
@@ -34,6 +34,8 @@
3434
35#include <x11-window-read-transients.h>35#include <x11-window-read-transients.h>
3636
37using namespace unity;
38
37class X11WindowFakeMinimizable :39class X11WindowFakeMinimizable :
38 public X11WindowReadTransients,40 public X11WindowReadTransients,
39 public compiz::WindowInputRemoverLockAcquireInterface41 public compiz::WindowInputRemoverLockAcquireInterface
4042
=== added file 'tests/test_shell_paint_schedule.cpp'
--- tests/test_shell_paint_schedule.cpp 1970-01-01 00:00:00 +0000
+++ tests/test_shell_paint_schedule.cpp 2012-06-26 09:53:58 +0000
@@ -0,0 +1,271 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
18 *
19 */
20
21#include <gtest/gtest.h>
22#include <gmock/gmock.h>
23
24using ::testing::StrictMock;
25using ::testing::_;
26using ::testing::AtLeast;
27using ::testing::Return;
28
29#include "ShellPaintSchedule.h"
30
31using namespace unity::compiz;
32
33class MockShellPaintRequestor :
34 public ShellPaintRequestorInterface
35{
36public:
37
38 MOCK_METHOD0 (GetPaintRequestorType, PaintRequestorType ());
39
40 MockShellPaintRequestor ()
41 {
42 ON_CALL (*this, GetPaintRequestorType ()).WillByDefault (Return (ShellPaintRequestorInterface::PaintRequestorType::Nil));
43 }
44
45};
46
47class MockShellPaint :
48 public ShellPaintInterface
49{
50public:
51
52 MOCK_METHOD0 (PaintDisplay, void ());
53};
54
55class MockShellPaintDispatch
56{
57public:
58
59 MOCK_METHOD1 (Paint, bool (ShellPaintRequestorInterface *));
60 MOCK_METHOD1 (EnforceRequestor, void (ShellPaintRequestorInterface *));
61 MOCK_METHOD0 (ClearRequestorEnforcement, void ());
62 MOCK_METHOD0 (ProhibitedPaintRequestors, ShellPaintRequestorInterface::PaintRequestorType ());
63 MOCK_METHOD0 (RequireShellRepaint, void ());
64 MOCK_METHOD0 (RepaintPending, bool ());
65};
66
67class TestShellPaintSchedule :
68 public ::testing::Test
69{
70};
71
72TEST(TestShellPaintSchedule, NoPaintWhereNotRequired)
73{
74 StrictMock <MockShellPaint> p;
75 MockShellPaintRequestor r;
76 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
77
78 ShellPaintDispatch dispatch (&p, f);
79
80 dispatch.RequestShellRepaint (&r);
81}
82
83TEST(TestShellPaintSchedule, PaintWhereRequired)
84{
85 StrictMock <MockShellPaint> p;
86 MockShellPaintRequestor r;
87 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
88
89 ShellPaintDispatch dispatch (&p, f);
90
91 dispatch.RequireShellRepaint ();
92
93 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
94 EXPECT_CALL (p, PaintDisplay ());
95
96 dispatch.RequestShellRepaint (&r);
97}
98
99TEST(TestShellPaintSchedule, NoPaintTwice)
100{
101 StrictMock <MockShellPaint> p;
102 MockShellPaintRequestor r;
103 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
104
105 ShellPaintDispatch dispatch (&p, f);
106
107 dispatch.RequireShellRepaint ();
108
109 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
110 EXPECT_CALL (p, PaintDisplay ());
111
112 dispatch.RequestShellRepaint (&r);
113 dispatch.RequestShellRepaint (&r);
114}
115
116TEST(TestShellPaintSchedule, NoWindowPaintButScreenPaint)
117{
118 StrictMock <MockShellPaint> p;
119 MockShellPaintRequestor r;
120 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Window; } );
121
122 ShellPaintDispatch dispatch (&p, f);
123
124 dispatch.RequireShellRepaint ();
125
126 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
127
128 dispatch.RequestShellRepaint (&r);
129
130 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Screen));
131 EXPECT_CALL (p, PaintDisplay ());
132
133 dispatch.RequestShellRepaint (&r);
134}
135
136TEST(TestShellPaintSchedule, NoScreenPaintButWindowPaint)
137{
138 StrictMock <MockShellPaint> p;
139 MockShellPaintRequestor r;
140 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Screen; } );
141
142 ShellPaintDispatch dispatch (&p, f);
143
144 dispatch.RequireShellRepaint ();
145
146 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Screen));
147
148 dispatch.RequestShellRepaint (&r);
149
150 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
151 EXPECT_CALL (p, PaintDisplay ());
152
153 dispatch.RequestShellRepaint (&r);
154}
155
156TEST(TestShellPaintSchedule, TopRequestorOnlyPaints)
157{
158 StrictMock <MockShellPaint> p;
159 MockShellPaintRequestor r_w1, r_w2;
160 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
161
162 ShellPaintDispatch dispatch (&p, f);
163
164 dispatch.RequireShellRepaint ();
165
166 dispatch.AllowPaintByAnyRequestor ();
167 dispatch.EnforcePaintByRequestor (&r_w2);
168
169 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
170 EXPECT_CALL (r_w1, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
171
172 dispatch.RequestShellRepaint (&r_w1);
173
174 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
175 EXPECT_CALL (p, PaintDisplay ());
176
177 dispatch.RequestShellRepaint (&r_w2);
178}
179
180TEST(TestShellPaintSchedule, SuperveningRequestorOfOtherTypePaints)
181{
182 StrictMock <MockShellPaint> p;
183 MockShellPaintRequestor r_w1, r_w2, r_s1;
184 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
185
186 ShellPaintDispatch dispatch (&p, f);
187
188 dispatch.RequireShellRepaint ();
189
190 dispatch.AllowPaintByAnyRequestor ();
191 dispatch.EnforcePaintByRequestor (&r_w2);
192
193 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
194 EXPECT_CALL (r_w1, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
195
196 dispatch.RequestShellRepaint (&r_w1);
197
198 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
199 EXPECT_CALL (r_s1, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Screen));
200
201 EXPECT_CALL (p, PaintDisplay ());
202
203 dispatch.RequestShellRepaint (&r_s1);
204
205 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
206
207 dispatch.RequestShellRepaint (&r_w2);
208}
209
210TEST(TestShellPaintSchedule, DoubleEnforcementHasNoEffect)
211{
212 StrictMock <MockShellPaint> p;
213 MockShellPaintRequestor r_w1, r_w2;
214 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
215
216 ShellPaintDispatch dispatch (&p, f);
217
218 dispatch.RequireShellRepaint ();
219
220 dispatch.AllowPaintByAnyRequestor ();
221 dispatch.EnforcePaintByRequestor (&r_w2);
222 dispatch.EnforcePaintByRequestor (&r_w1);
223
224 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
225 EXPECT_CALL (r_w1, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
226
227 dispatch.RequestShellRepaint (&r_w1);
228
229 EXPECT_CALL (r_w2, GetPaintRequestorType ()).WillRepeatedly (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
230 EXPECT_CALL (p, PaintDisplay ());
231
232 dispatch.RequestShellRepaint (&r_w2);
233}
234
235TEST(TestShellPaintSchedule, GetPendingRepaint)
236{
237 StrictMock <MockShellPaint> p;
238 MockShellPaintRequestor r;
239 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([]() -> ShellPaintRequestorInterface::PaintRequestorType { return ShellPaintRequestorInterface::PaintRequestorType::Nil; } );
240
241 ShellPaintDispatch dispatch (&p, f);
242
243 EXPECT_FALSE (dispatch.RepaintPending ());
244
245 dispatch.RequireShellRepaint ();
246
247 EXPECT_TRUE (dispatch.RepaintPending ());
248
249 EXPECT_CALL (r, GetPaintRequestorType ()).WillOnce (Return (ShellPaintRequestorInterface::PaintRequestorType::Window));
250 EXPECT_CALL (p, PaintDisplay ());
251
252 dispatch.RequestShellRepaint (&r);
253
254 EXPECT_FALSE (dispatch.RepaintPending ());
255}
256
257TEST(TestShellPaintSchedule, GetProhibitedPaintMasks)
258{
259 StrictMock <MockShellPaint> p;
260 MockShellPaintRequestor r;
261 ShellPaintRequestorInterface::PaintRequestorType prohibited_paint_mask = ShellPaintRequestorInterface::PaintRequestorType::Nil;
262 ShellPaintDispatch::GetProhibitedPaintMasksFunc f ([&]() -> ShellPaintRequestorInterface::PaintRequestorType { return prohibited_paint_mask; } );
263
264 ShellPaintDispatch dispatch (&p, f);
265
266 EXPECT_EQ (prohibited_paint_mask, dispatch.ProhibitedPaintRequestors ());
267 prohibited_paint_mask = ShellPaintRequestorInterface::PaintRequestorType::Window;
268 EXPECT_EQ (prohibited_paint_mask, dispatch.ProhibitedPaintRequestors ());
269 prohibited_paint_mask = ShellPaintRequestorInterface::PaintRequestorType::Screen;
270 EXPECT_EQ (prohibited_paint_mask, dispatch.ProhibitedPaintRequestors ());
271}
0272
=== modified file 'tests/test_showdesktop_handler.cpp'
--- tests/test_showdesktop_handler.cpp 2012-04-18 09:30:53 +0000
+++ tests/test_showdesktop_handler.cpp 2012-06-26 09:53:58 +0000
@@ -4,12 +4,14 @@
4#include <gmock/gmock.h>4#include <gmock/gmock.h>
5#include <UnityShowdesktopHandler.h>5#include <UnityShowdesktopHandler.h>
66
7using namespace unity;
8using ::testing::_;7using ::testing::_;
9using ::testing::Return;8using ::testing::Return;
10using ::testing::Invoke;9using ::testing::Invoke;
11using ::testing::InSequence;10using ::testing::InSequence;
1211
12namespace unity
13{
14
13compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface () {}15compiz::WindowInputRemoverInterface::~WindowInputRemoverInterface () {}
1416
15class MockWindowInputRemover :17class MockWindowInputRemover :
@@ -96,11 +98,16 @@
96 MOCK_METHOD0 (DoDeleteHandler, void ());98 MOCK_METHOD0 (DoDeleteHandler, void ());
97};99};
98100
101}
102
103using namespace unity;
104using namespace unity::compiz;
105
99TEST_F(UnityShowdesktopHandlerTest, TestNoORWindowsSD)106TEST_F(UnityShowdesktopHandlerTest, TestNoORWindowsSD)
100{107{
101 MockUnityShowdesktopHandlerWindow mMockWindow;108 MockUnityShowdesktopHandlerWindow mMockWindow;
102109
103 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));110 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
104111
105 EXPECT_CALL (mMockWindow, IsOverrideRedirect ()).WillOnce (Return (true));112 EXPECT_CALL (mMockWindow, IsOverrideRedirect ()).WillOnce (Return (true));
106 EXPECT_FALSE (ShowdesktopHandler::ShouldHide (&mMockWindow));113 EXPECT_FALSE (ShowdesktopHandler::ShouldHide (&mMockWindow));
@@ -110,7 +117,7 @@
110{117{
111 MockUnityShowdesktopHandlerWindow mMockWindow;118 MockUnityShowdesktopHandlerWindow mMockWindow;
112119
113 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));120 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
114121
115 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());122 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
116 EXPECT_CALL (mMockWindow, IsManaged ()).WillOnce (Return (false));123 EXPECT_CALL (mMockWindow, IsManaged ()).WillOnce (Return (false));
@@ -121,7 +128,7 @@
121{128{
122 MockUnityShowdesktopHandlerWindow mMockWindow;129 MockUnityShowdesktopHandlerWindow mMockWindow;
123130
124 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));131 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
125132
126 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());133 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
127 EXPECT_CALL (mMockWindow, IsManaged ());134 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -133,7 +140,7 @@
133{140{
134 MockUnityShowdesktopHandlerWindow mMockWindow;141 MockUnityShowdesktopHandlerWindow mMockWindow;
135142
136 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));143 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
137144
138 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());145 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
139 EXPECT_CALL (mMockWindow, IsManaged ());146 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -146,7 +153,7 @@
146{153{
147 MockUnityShowdesktopHandlerWindow mMockWindow;154 MockUnityShowdesktopHandlerWindow mMockWindow;
148155
149 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));156 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
150157
151 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());158 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
152 EXPECT_CALL (mMockWindow, IsManaged ());159 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -160,7 +167,7 @@
160{167{
161 MockUnityShowdesktopHandlerWindow mMockWindow;168 MockUnityShowdesktopHandlerWindow mMockWindow;
162169
163 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));170 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
164171
165 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());172 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
166 EXPECT_CALL (mMockWindow, IsManaged ());173 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -177,7 +184,7 @@
177{184{
178 MockUnityShowdesktopHandlerWindow mMockWindow;185 MockUnityShowdesktopHandlerWindow mMockWindow;
179186
180 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));187 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
181188
182 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());189 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
183 EXPECT_CALL (mMockWindow, IsManaged ());190 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -193,7 +200,7 @@
193{200{
194 MockUnityShowdesktopHandlerWindow mMockWindow;201 MockUnityShowdesktopHandlerWindow mMockWindow;
195202
196 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));203 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
197204
198 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());205 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
199 EXPECT_CALL (mMockWindow, IsManaged ());206 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -211,7 +218,7 @@
211{218{
212 MockUnityShowdesktopHandlerWindow mMockWindow;219 MockUnityShowdesktopHandlerWindow mMockWindow;
213220
214 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));221 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
215222
216 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());223 EXPECT_CALL (mMockWindow, IsOverrideRedirect ());
217 EXPECT_CALL (mMockWindow, IsManaged ());224 EXPECT_CALL (mMockWindow, IsManaged ());
@@ -226,7 +233,7 @@
226}233}
227234
228class MockWindowInputRemoverTestFadeOut :235class MockWindowInputRemoverTestFadeOut :
229 public compiz::WindowInputRemoverInterface236 public WindowInputRemoverInterface
230{237{
231 public:238 public:
232239
@@ -252,7 +259,7 @@
252259
253 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOut>));260 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOut>));
254261
255 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));262 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
256263
257 EXPECT_CALL (mMockWindow, IsHidden ());264 EXPECT_CALL (mMockWindow, IsHidden ());
258 EXPECT_CALL (mMockWindow, DoHide ());265 EXPECT_CALL (mMockWindow, DoHide ());
@@ -264,7 +271,7 @@
264}271}
265272
266class MockWindowInputRemoverTestFadeOutAlready :273class MockWindowInputRemoverTestFadeOutAlready :
267 public compiz::WindowInputRemoverInterface274 public WindowInputRemoverInterface
268{275{
269 public:276 public:
270277
@@ -284,7 +291,7 @@
284{291{
285 MockUnityShowdesktopHandlerWindow mMockWindow;292 MockUnityShowdesktopHandlerWindow mMockWindow;
286293
287 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));294 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
288295
289 EXPECT_CALL (mMockWindow, IsHidden ()).WillOnce (Return (true));296 EXPECT_CALL (mMockWindow, IsHidden ()).WillOnce (Return (true));
290297
@@ -298,7 +305,7 @@
298 MockUnityShowdesktopHandlerWindow mMockWindow;305 MockUnityShowdesktopHandlerWindow mMockWindow;
299306
300 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOut>));307 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOut>));
301 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));308 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
302309
303 EXPECT_CALL (mMockWindow, IsHidden ());310 EXPECT_CALL (mMockWindow, IsHidden ());
304 EXPECT_CALL (mMockWindow, DoHide ());311 EXPECT_CALL (mMockWindow, DoHide ());
@@ -314,7 +321,7 @@
314{321{
315 MockUnityShowdesktopHandlerWindow mMockWindow;322 MockUnityShowdesktopHandlerWindow mMockWindow;
316323
317 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));324 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
318325
319 mMockHandler.FadeIn ();326 mMockHandler.FadeIn ();
320327
@@ -322,7 +329,7 @@
322}329}
323330
324class MockWindowInputRemoverTestFadeOutFadeIn :331class MockWindowInputRemoverTestFadeOutFadeIn :
325 public compiz::WindowInputRemoverInterface332 public WindowInputRemoverInterface
326{333{
327 public:334 public:
328335
@@ -347,7 +354,7 @@
347 MockUnityShowdesktopHandlerWindow mMockWindow;354 MockUnityShowdesktopHandlerWindow mMockWindow;
348355
349 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));356 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));
350 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));357 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
351358
352 EXPECT_CALL (mMockWindow, IsHidden ());359 EXPECT_CALL (mMockWindow, IsHidden ());
353 EXPECT_CALL (mMockWindow, DoHide ());360 EXPECT_CALL (mMockWindow, DoHide ());
@@ -368,7 +375,7 @@
368 MockUnityShowdesktopHandlerWindow mMockWindow;375 MockUnityShowdesktopHandlerWindow mMockWindow;
369376
370 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));377 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));
371 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));378 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
372379
373 EXPECT_CALL (mMockWindow, IsHidden ());380 EXPECT_CALL (mMockWindow, IsHidden ());
374 EXPECT_CALL (mMockWindow, DoHide ());381 EXPECT_CALL (mMockWindow, DoHide ());
@@ -409,7 +416,7 @@
409 MockUnityShowdesktopHandlerWindow mMockWindow;416 MockUnityShowdesktopHandlerWindow mMockWindow;
410417
411 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));418 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));
412 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));419 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
413420
414 EXPECT_CALL (mMockWindow, IsHidden ());421 EXPECT_CALL (mMockWindow, IsHidden ());
415 EXPECT_CALL (mMockWindow, DoHide ());422 EXPECT_CALL (mMockWindow, DoHide ());
@@ -465,7 +472,7 @@
465 MockUnityShowdesktopHandlerWindow mMockWindow;472 MockUnityShowdesktopHandlerWindow mMockWindow;
466473
467 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));474 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeIn>));
468 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));475 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
469476
470 EXPECT_CALL (mMockWindow, IsHidden ());477 EXPECT_CALL (mMockWindow, IsHidden ());
471 EXPECT_CALL (mMockWindow, DoHide ());478 EXPECT_CALL (mMockWindow, DoHide ());
@@ -491,7 +498,7 @@
491}498}
492499
493class MockWindowInputRemoverTestFadeOutFadeInWithShapeEvent :500class MockWindowInputRemoverTestFadeOutFadeInWithShapeEvent :
494 public compiz::WindowInputRemoverInterface501 public WindowInputRemoverInterface
495{502{
496 public:503 public:
497504
@@ -520,7 +527,7 @@
520 MockUnityShowdesktopHandlerWindow mMockWindow;527 MockUnityShowdesktopHandlerWindow mMockWindow;
521528
522 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeInWithShapeEvent>));529 EXPECT_CALL (mMockWindow, GetInputRemover ()).WillOnce (Invoke (UnityShowdesktopHandlerTest::getLock <MockWindowInputRemoverTestFadeOutFadeInWithShapeEvent>));
523 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <compiz::WindowInputRemoverLockAcquireInterface *> (&mMockWindow));530 ShowdesktopHandler mMockHandler (static_cast <ShowdesktopHandlerWindowInterface *> (&mMockWindow), static_cast <WindowInputRemoverLockAcquireInterface *> (&mMockWindow));
524531
525 EXPECT_CALL (mMockWindow, IsHidden ());532 EXPECT_CALL (mMockWindow, IsHidden ());
526 EXPECT_CALL (mMockWindow, DoHide ());533 EXPECT_CALL (mMockWindow, DoHide ());
527534
=== modified file 'tests/x11-window-read-transients.cpp'
--- tests/x11-window-read-transients.cpp 2011-08-24 16:46:09 +0000
+++ tests/x11-window-read-transients.cpp 2012-06-26 09:53:58 +0000
@@ -25,6 +25,8 @@
25#define _GNU_SOURCE25#define _GNU_SOURCE
26#endif26#endif
2727
28using namespace unity;
29
28X11WindowReadTransients::X11WindowReadTransients (Display *d, Window w) :30X11WindowReadTransients::X11WindowReadTransients (Display *d, Window w) :
29 X11Window::X11Window (d, w)31 X11Window::X11Window (d, w)
30{32{
3133
=== modified file 'unity-shared/CMakeLists.txt'
--- unity-shared/CMakeLists.txt 2012-05-22 10:15:47 +0000
+++ unity-shared/CMakeLists.txt 2012-06-26 09:53:58 +0000
@@ -47,6 +47,7 @@
47 PanelStyle.cpp47 PanelStyle.cpp
48 SearchBar.cpp48 SearchBar.cpp
49 SearchBarSpinner.cpp49 SearchBarSpinner.cpp
50 ShellPaintSchedule.cpp
50 StaticCairoText.cpp51 StaticCairoText.cpp
51 TextureCache.cpp52 TextureCache.cpp
52 Timer.cpp53 Timer.cpp
5354
=== added file 'unity-shared/ShellPaintSchedule.cpp'
--- unity-shared/ShellPaintSchedule.cpp 1970-01-01 00:00:00 +0000
+++ unity-shared/ShellPaintSchedule.cpp 2012-06-26 09:53:58 +0000
@@ -0,0 +1,93 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2012 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
18 */
19
20#include "ShellPaintSchedule.h"
21
22namespace unity
23{
24namespace compiz
25{
26
27ShellPaintDispatch::ShellPaintDispatch (ShellPaintInterface *paint_interface,
28 const GetProhibitedPaintMasksFunc &prohibited_func) :
29 shell_repaint_required_ (false),
30 top_requestor_ (nullptr),
31 prohibited_paint_masks_func_ (prohibited_func),
32 paint_interface_ (paint_interface)
33{
34}
35
36bool
37ShellPaintDispatch::RequestShellRepaint (ShellPaintRequestorInterface *requestor)
38{
39 if (!shell_repaint_required_)
40 return false;
41
42 if (prohibited_paint_masks_func_ () == requestor->GetPaintRequestorType ())
43 return false;
44
45 if (top_requestor_)
46 if ((top_requestor_->GetPaintRequestorType () ==
47 requestor->GetPaintRequestorType ()) && top_requestor_ != requestor)
48 return false;
49
50 paint_interface_->PaintDisplay ();
51
52 shell_repaint_required_ = false;
53
54 return true;
55}
56
57bool
58ShellPaintDispatch::EnforcePaintByRequestor (ShellPaintRequestorInterface *requestor)
59{
60 if (top_requestor_)
61 return false;
62
63 top_requestor_ = requestor;
64
65 return true;
66}
67
68void
69ShellPaintDispatch::AllowPaintByAnyRequestor ()
70{
71 top_requestor_ = nullptr;
72}
73
74ShellPaintRequestorInterface::PaintRequestorType
75ShellPaintDispatch::ProhibitedPaintRequestors ()
76{
77 return prohibited_paint_masks_func_ ();
78}
79
80void
81ShellPaintDispatch::RequireShellRepaint ()
82{
83 shell_repaint_required_ = true;
84}
85
86bool
87ShellPaintDispatch::RepaintPending ()
88{
89 return shell_repaint_required_;
90}
91
92}
93}
094
=== added file 'unity-shared/ShellPaintSchedule.h'
--- unity-shared/ShellPaintSchedule.h 1970-01-01 00:00:00 +0000
+++ unity-shared/ShellPaintSchedule.h 2012-06-26 09:53:58 +0000
@@ -0,0 +1,125 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2012 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
18 */
19
20#ifndef UNITY_PAINT_SCHEDULE_H
21#define UNITY_PAINT_SCHEDULE_H
22
23#include <boost/bind.hpp>
24#include <boost/function.hpp>
25
26namespace unity
27{
28namespace compiz
29{
30
31/*
32 * Implementors of ShellPaintRequestorInterface are able
33 * to request a repaint of the unity shell by calling
34 * Paint () in ShellPaintDispatchInterface. Requestors
35 * must identify themselves to an implementor of
36 * ShellPaintDispatchInterface such that ShellPaintDispatch
37 * interface can decide whether to allow a redraw
38 */
39class ShellPaintRequestorInterface
40{
41public:
42
43 enum class PaintRequestorType
44 {
45 Nil = 0,
46 Window = (1 << 0),
47 Screen = (1 << 1)
48 };
49
50 virtual ~ShellPaintRequestorInterface () {}
51
52 virtual PaintRequestorType GetPaintRequestorType () = 0;
53};
54
55/*
56 * Implementors of ShellPaintInterface are capable
57 * of repainting the shell */
58class ShellPaintInterface
59{
60public:
61
62 virtual ~ShellPaintInterface () {};
63
64 virtual void PaintDisplay () = 0;
65};
66
67/*
68 * Implementors of ShellPaintDispatchInterface
69 * manage when the shell is allowed to be repainted
70 * by examining what is requesting the repaint of
71 * the shell and determining whether or not a
72 * repaint is required
73 */
74class ShellPaintDispatchInterface
75{
76public:
77
78 virtual ~ShellPaintDispatchInterface () {}
79
80 virtual bool RequestShellRepaint (ShellPaintRequestorInterface *) = 0;
81 virtual bool EnforcePaintByRequestor (ShellPaintRequestorInterface *) = 0;
82 virtual void AllowPaintByAnyRequestor () = 0;
83 virtual ShellPaintRequestorInterface::PaintRequestorType ProhibitedPaintRequestors () = 0;
84 virtual void RequireShellRepaint () = 0;
85 virtual bool RepaintPending () = 0;
86
87};
88
89/*
90 * ShellPaintDispatch is the canonical implementor
91 * of ShellPaintDispatchInterface and manages when
92 * the shell is allowed to be repainted depending
93 * on what ShellPaintRequestorInterface is requesting
94 * the repaint
95 */
96class ShellPaintDispatch :
97 public ShellPaintDispatchInterface
98{
99public:
100
101 typedef boost::function <ShellPaintRequestorInterface::PaintRequestorType ()> GetProhibitedPaintMasksFunc;
102
103 ShellPaintDispatch (ShellPaintInterface * paint_interface,
104 const GetProhibitedPaintMasksFunc &func);
105
106 bool RequestShellRepaint (ShellPaintRequestorInterface *);
107 bool EnforcePaintByRequestor (ShellPaintRequestorInterface *);
108 void AllowPaintByAnyRequestor ();
109 ShellPaintRequestorInterface::PaintRequestorType ProhibitedPaintRequestors();
110 void RequireShellRepaint ();
111 bool RepaintPending ();
112
113
114protected:
115
116 bool shell_repaint_required_;
117 ShellPaintRequestorInterface *top_requestor_;
118 GetProhibitedPaintMasksFunc prohibited_paint_masks_func_;
119 ShellPaintInterface *paint_interface_;
120};
121
122}
123}
124
125#endif