Merge lp:~compiz-team/compiz/compiz.fix_1159430 into lp:compiz/0.9.10

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1159430
Merge into: lp:compiz/0.9.10
Diff against target: 398 lines (+173/-25)
11 files modified
debian/changelog (+2/-1)
include/core/abiversion.h (+1/-1)
include/core/screen.h (+11/-3)
plugins/opengl/src/paint.cpp (+6/-1)
plugins/wallpaper/src/wallpaper.cpp (+29/-2)
plugins/wallpaper/src/wallpaper.h (+4/-0)
src/event.cpp (+7/-2)
src/privatescreen.h (+6/-3)
src/privatescreen/tests/test-privatescreen.cpp (+67/-2)
src/screen.cpp (+20/-7)
src/window.cpp (+20/-3)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1159430
Reviewer Review Type Date Requested Status
MC Return Pending
Daniel van Vugt Pending
PS Jenkins bot continuous-integration Pending
Sebastien Bacher Pending
Review via email: mp+176799@code.launchpad.net

This proposal supersedes a proposal from 2013-06-21.

Description of the change

Handle ARGB desktop windows correctly.

core: compiz::private_screen::DesktopWindowCount - provide methods to
increment or decrement desktop windows based on their visual type.

desktopWindowCount () now returns the number of RGB and ARGB desktop windows,
argbDesktopWindowCount () just returns the number of ARGB desktop windows.

If they are equal, the only desktop window is ARGB.

opengl: Draw the root window background if the desktop window is ARGB.
wallpaper: Lie to core and say that our fake desktop window is RGB so that
core does not draw the root window background. Paint the desktop wallpaper
beneath the desktop window so that the ARGB desktop window is visible on
top of it.

Tests added for the increment/decrement logic in DesktopWindowCount.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

I am sorry, I cannot test this...

(still on Raring, using a patched Nautilus 3.4 as Nautilus is getting worse and worse with each version)

review: Abstain
Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

Can anyone help with testing this on Saucy ?

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote : Posted in a previous version of this proposal

> Can anyone help with testing this on Saucy ?
How to test?

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

Please re-target to lp:compiz

review: Needs Resubmitting

Unmerged revisions

3744. By Sam Spilsbury

Added more missing changes

3743. By Sam Spilsbury

Add missing change

3742. By Sam Spilsbury

Handle ARGB desktop windows correctly.

core: compiz::private_screen::DesktopWindowCount - provide methods to
increment or decrement desktop windows based on their visual type.

desktopWindowCount () now returns the number of RGB and ARGB desktop windows,
argbDesktopWindowCount () just returns the number of ARGB desktop windows.

If they are equal, the only desktop window is ARGB.

opengl: Draw the root window background if the desktop window is ARGB.
wallpaper: Lie to core and say that our fake desktop window is RGB so that
core does not draw the root window background. Paint the desktop wallpaper
beneath the desktop window so that the ARGB desktop window is visible on
top of it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-06-01 00:10:24 +0000
+++ debian/changelog 2013-07-24 21:57:49 +0000
@@ -1,8 +1,9 @@
1compiz (1:0.9.10-0ubuntu1) UNRELEASED; urgency=low1compiz (1:0.9.10-0ubuntu1) UNRELEASED; urgency=low
22
3 * Bump version to 0.9.103 * Bump version to 0.9.10
4 - Bump ABI to 20130621
45
5 -- Sam Spilsbury <smspillaz@interpol> Thu, 25 Apr 2013 11:13:32 +08006 -- Sam Spilsbury <smspillaz@gmail.com> Thu, 25 Apr 2013 11:13:32 +0800
67
7compiz (1:0.9.9~daily13.02.28-0ubuntu1) raring; urgency=low8compiz (1:0.9.9~daily13.02.28-0ubuntu1) raring; urgency=low
89
910
=== modified file 'include/core/abiversion.h'
--- include/core/abiversion.h 2013-04-17 06:58:36 +0000
+++ include/core/abiversion.h 2013-07-24 21:57:49 +0000
@@ -5,6 +5,6 @@
5# error Conflicting definitions of CORE_ABIVERSION5# error Conflicting definitions of CORE_ABIVERSION
6#endif6#endif
77
8#define CORE_ABIVERSION 201304158#define CORE_ABIVERSION 20130621
99
10#endif // COMPIZ_ABIVERSION_H10#endif // COMPIZ_ABIVERSION_H
1111
=== modified file 'include/core/screen.h'
--- include/core/screen.h 2012-12-03 10:36:42 +0000
+++ include/core/screen.h 2013-07-24 21:57:49 +0000
@@ -167,9 +167,17 @@
167class DesktopWindowCount167class DesktopWindowCount
168{168{
169public:169public:
170 virtual void incrementDesktopWindowCount() = 0;170
171 virtual void decrementDesktopWindowCount() = 0;171 enum VisualType
172 virtual int desktopWindowCount() = 0;172 {
173 RGB,
174 ARGB
175 };
176
177 virtual void incrementDesktopWindowCount (VisualType) = 0;
178 virtual void decrementDesktopWindowCount (VisualType) = 0;
179 virtual int desktopWindowCount () = 0;
180 virtual int argbDesktopWindowCount () = 0;
173protected:181protected:
174 ~DesktopWindowCount() {}182 ~DesktopWindowCount() {}
175};183};
176184
=== modified file 'plugins/opengl/src/paint.cpp'
--- plugins/opengl/src/paint.cpp 2013-06-28 01:10:57 +0000
+++ plugins/opengl/src/paint.cpp 2013-07-24 21:57:49 +0000
@@ -86,7 +86,12 @@
86 if (!nBox)86 if (!nBox)
87 return;87 return;
8888
89 if (screen->desktopWindowCount ())89 unsigned int rgbDesktops = screen->desktopWindowCount () -
90 screen->argbDesktopWindowCount ();
91
92 /* RGB desktops are assumed to cover the entire background
93 * so we do not need to paint any background behind them */
94 if (rgbDesktops > 0)
90 {95 {
91 if (!backgroundTextures.empty ())96 if (!backgroundTextures.empty ())
92 {97 {
9398
=== modified file 'plugins/wallpaper/src/wallpaper.cpp'
--- plugins/wallpaper/src/wallpaper.cpp 2013-05-15 22:15:41 +0000
+++ plugins/wallpaper/src/wallpaper.cpp 2013-07-24 21:57:49 +0000
@@ -567,8 +567,6 @@
567{567{
568 WALLPAPER_SCREEN (screen);568 WALLPAPER_SCREEN (screen);
569569
570 bool ret = gWindow->glDraw (transform, attrib, region, mask);
571
572 if ((!ws->desktop || ws->desktop == window) &&570 if ((!ws->desktop || ws->desktop == window) &&
573 !ws->backgroundsPrimary.empty() &&571 !ws->backgroundsPrimary.empty() &&
574 window->type () & CompWindowTypeDesktopMask)572 window->type () & CompWindowTypeDesktopMask)
@@ -597,6 +595,9 @@
597 ws->desktop = window;595 ws->desktop = window;
598 }596 }
599597
598 /* Draw wallpaper behind window */
599 bool ret = gWindow->glDraw (transform, attrib, region, mask);
600
600 return ret;601 return ret;
601}602}
602603
@@ -673,14 +674,40 @@
673 destroyFakeDesktopWindow ();674 destroyFakeDesktopWindow ();
674}675}
675676
677bool
678WallpaperWindow::alpha () const
679{
680 return true;
681}
682
676WallpaperWindow::WallpaperWindow (CompWindow *window) :683WallpaperWindow::WallpaperWindow (CompWindow *window) :
677 PluginClassHandler <WallpaperWindow, CompWindow> (window),684 PluginClassHandler <WallpaperWindow, CompWindow> (window),
678 window (window),685 window (window),
679 cWindow (CompositeWindow::get (window)),686 cWindow (CompositeWindow::get (window)),
680 gWindow (GLWindow::get (window))687 gWindow (GLWindow::get (window))
681{688{
689 WallpaperScreen *ws = WallpaperScreen::get (screen);
690
691 bool isFakeDesktopWindow =
692 window->id () == ws->fakeDesktop;
693
694 /* If we are the fake desktop, tell compiz that we have
695 * an alpha channel so that we don't get added to the argb
696 * desktop window count and compiz doesn't draw its own
697 * background */
698 WindowInterface::setHandler (window, isFakeDesktopWindow);
682 CompositeWindowInterface::setHandler (cWindow, true);699 CompositeWindowInterface::setHandler (cWindow, true);
683 GLWindowInterface::setHandler (gWindow, true);700 GLWindowInterface::setHandler (gWindow, true);
701
702 if (isFakeDesktopWindow)
703 ws->desktop = window;
704}
705
706WallpaperWindow::~WallpaperWindow ()
707{
708 WallpaperScreen *ws = WallpaperScreen::get (screen);
709 if (ws->desktop == window)
710 ws->desktop = NULL;
684}711}
685712
686bool713bool
687714
=== modified file 'plugins/wallpaper/src/wallpaper.h'
--- plugins/wallpaper/src/wallpaper.h 2013-05-15 22:15:41 +0000
+++ plugins/wallpaper/src/wallpaper.h 2013-07-24 21:57:49 +0000
@@ -124,12 +124,14 @@
124124
125class WallpaperWindow :125class WallpaperWindow :
126 public PluginClassHandler <WallpaperWindow, CompWindow>,126 public PluginClassHandler <WallpaperWindow, CompWindow>,
127 public WindowInterface,
127 public CompositeWindowInterface,128 public CompositeWindowInterface,
128 public GLWindowInterface129 public GLWindowInterface
129{130{
130 public:131 public:
131132
132 WallpaperWindow (CompWindow *);133 WallpaperWindow (CompWindow *);
134 ~WallpaperWindow ();
133135
134 CompWindow *window;136 CompWindow *window;
135 CompositeWindow *cWindow;137 CompositeWindow *cWindow;
@@ -150,6 +152,8 @@
150152
151 bool damageRect (bool ,153 bool damageRect (bool ,
152 const CompRect &);154 const CompRect &);
155
156 bool alpha () const;
153};157};
154158
155#define WALLPAPER_SCREEN(s) \159#define WALLPAPER_SCREEN(s) \
156160
=== modified file 'src/event.cpp'
--- src/event.cpp 2013-06-28 01:10:57 +0000
+++ src/event.cpp 2013-07-24 21:57:49 +0000
@@ -1577,10 +1577,15 @@
1577 {1577 {
1578 if (w->isViewable ())1578 if (w->isViewable ())
1579 {1579 {
1580 ::compiz::DesktopWindowCount::VisualType visual =
1581 w->alpha () ?
1582 ::compiz::DesktopWindowCount::ARGB :
1583 ::compiz::DesktopWindowCount::RGB;
1584
1580 if (w->type () == CompWindowTypeDesktopMask)1585 if (w->type () == CompWindowTypeDesktopMask)
1581 decrementDesktopWindowCount();1586 decrementDesktopWindowCount (visual);
1582 else if (type == CompWindowTypeDesktopMask)1587 else if (type == CompWindowTypeDesktopMask)
1583 incrementDesktopWindowCount();1588 incrementDesktopWindowCount (visual);
1584 }1589 }
15851590
1586 w->wmType () = type;1591 w->wmType () = type;
15871592
=== modified file 'src/privatescreen.h'
--- src/privatescreen.h 2013-05-12 08:20:10 +0000
+++ src/privatescreen.h 2013-07-24 21:57:49 +0000
@@ -531,11 +531,14 @@
531{531{
532public:532public:
533 DesktopWindowCount();533 DesktopWindowCount();
534 virtual void incrementDesktopWindowCount();534
535 virtual void decrementDesktopWindowCount();535 virtual void incrementDesktopWindowCount(VisualType);
536 virtual void decrementDesktopWindowCount(VisualType);
536 virtual int desktopWindowCount();537 virtual int desktopWindowCount();
538 virtual int argbDesktopWindowCount();
537private:539private:
538 int count;540 int rgbCount;
541 int argbCount;
539};542};
540543
541class MapNum :544class MapNum :
542545
=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
--- src/privatescreen/tests/test-privatescreen.cpp 2013-04-17 06:58:36 +0000
+++ src/privatescreen/tests/test-privatescreen.cpp 2013-07-24 21:57:49 +0000
@@ -144,6 +144,7 @@
144 CompSize &size,144 CompSize &size,
145 void *&data));145 void *&data));
146 MOCK_METHOD0(desktopWindowCount, int ());146 MOCK_METHOD0(desktopWindowCount, int ());
147 MOCK_METHOD0(argbDesktopWindowCount, int ());
147 MOCK_METHOD0(attrib, XWindowAttributes ());148 MOCK_METHOD0(attrib, XWindowAttributes ());
148 MOCK_CONST_METHOD0(defaultIcon, CompIcon *());149 MOCK_CONST_METHOD0(defaultIcon, CompIcon *());
149 virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock?150 virtual bool otherGrabExist (const char *, ...) { return false; } // TODO How to mock?
@@ -178,8 +179,8 @@
178 MOCK_METHOD0(grabbed, bool ());179 MOCK_METHOD0(grabbed, bool ());
179 MOCK_METHOD0(snDisplay, SnDisplay * ());180 MOCK_METHOD0(snDisplay, SnDisplay * ());
180 MOCK_CONST_METHOD0(createFailed, bool ());181 MOCK_CONST_METHOD0(createFailed, bool ());
181 MOCK_METHOD0(incrementDesktopWindowCount, void ());182 MOCK_METHOD1(incrementDesktopWindowCount, void (VisualType));
182 MOCK_METHOD0(decrementDesktopWindowCount, void ());183 MOCK_METHOD1(decrementDesktopWindowCount, void (VisualType));
183 MOCK_METHOD0(nextMapNum, unsigned int ());184 MOCK_METHOD0(nextMapNum, unsigned int ());
184 MOCK_CONST_METHOD0(updatePassiveKeyGrabs, void ());185 MOCK_CONST_METHOD0(updatePassiveKeyGrabs, void ());
185 MOCK_METHOD1(updatePassiveButtonGrabs, void (Window serverFrame));186 MOCK_METHOD1(updatePassiveButtonGrabs, void (Window serverFrame));
@@ -1416,3 +1417,67 @@
1416 ca::setActionActiveState (action, false);1417 ca::setActionActiveState (action, false);
1417 ASSERT_EQ (action.active (), false);1418 ASSERT_EQ (action.active (), false);
1418}1419}
1420
1421class DesktopWindowCountTest :
1422 public ::testing::Test
1423{
1424 protected:
1425
1426 ::compiz::private_screen::DesktopWindowCount count;
1427};
1428
1429TEST_F (DesktopWindowCountTest, IncrementRGBIncCount)
1430{
1431 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1432 EXPECT_EQ (1, count.desktopWindowCount ());
1433}
1434
1435TEST_F (DesktopWindowCountTest, IncrementRGBNoIncARGBCount)
1436{
1437 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1438 EXPECT_EQ (0, count.argbDesktopWindowCount ());
1439}
1440
1441TEST_F (DesktopWindowCountTest, DecrementRGBDecCount)
1442{
1443 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1444 count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1445 EXPECT_EQ (0, count.desktopWindowCount ());
1446}
1447
1448TEST_F (DesktopWindowCountTest, DecrementRGBNoDecARGBCount)
1449{
1450 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1451 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1452 count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1453 EXPECT_EQ (1, count.argbDesktopWindowCount ());
1454}
1455
1456TEST_F (DesktopWindowCountTest, IncrementARGBandRGBIncrementCountTwice)
1457{
1458 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1459 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1460 EXPECT_EQ (2, count.desktopWindowCount ());
1461}
1462
1463TEST_F (DesktopWindowCountTest, DecrementARGBandRGBDecrementCountTwice)
1464{
1465 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1466 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1467 count.decrementDesktopWindowCount (compiz::DesktopWindowCount::RGB);
1468 count.decrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1469 EXPECT_EQ (0, count.desktopWindowCount ());
1470}
1471
1472TEST_F (DesktopWindowCountTest, IncrementARGBNoIncRGBCount)
1473{
1474 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1475 EXPECT_EQ (1, count.desktopWindowCount ());
1476}
1477
1478TEST_F (DesktopWindowCountTest, NoRGBDesktopWindowsTest)
1479{
1480 count.incrementDesktopWindowCount (compiz::DesktopWindowCount::ARGB);
1481 EXPECT_EQ (0, count.desktopWindowCount () -
1482 count.argbDesktopWindowCount ());
1483}
14191484
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2013-05-13 13:27:30 +0000
+++ src/screen.cpp 2013-07-24 21:57:49 +0000
@@ -4314,7 +4314,13 @@
4314int4314int
4315cps::DesktopWindowCount::desktopWindowCount ()4315cps::DesktopWindowCount::desktopWindowCount ()
4316{4316{
4317 return count;4317 return rgbCount + argbCount;
4318}
4319
4320int
4321cps::DesktopWindowCount::argbDesktopWindowCount ()
4322{
4323 return argbCount;
4318}4324}
43194325
4320unsigned int4326unsigned int
@@ -4627,20 +4633,27 @@
4627 windowManager.incrementPendingDestroys();4633 windowManager.incrementPendingDestroys();
4628}4634}
46294635
4630cps::DesktopWindowCount::DesktopWindowCount() :4636cps::DesktopWindowCount::DesktopWindowCount () :
4631count(0)4637 rgbCount (0),
4638 argbCount (0)
4632{4639{
4633}4640}
46344641
4635void4642void
4636cps::DesktopWindowCount::incrementDesktopWindowCount()4643cps::DesktopWindowCount::incrementDesktopWindowCount (VisualType type)
4637{4644{
4638 count++;4645 if (type == ARGB)
4646 ++argbCount;
4647 else
4648 ++rgbCount;
4639}4649}
4640void4650void
4641cps::DesktopWindowCount::decrementDesktopWindowCount()4651cps::DesktopWindowCount::decrementDesktopWindowCount (VisualType type)
4642{4652{
4643 count--;4653 if (type == ARGB)
4654 --argbCount;
4655 else
4656 --rgbCount;
4644}4657}
46454658
4646cps::MapNum::MapNum() :4659cps::MapNum::MapNum() :
46474660
=== modified file 'src/window.cpp'
--- src/window.cpp 2013-07-19 18:39:38 +0000
+++ src/window.cpp 2013-07-24 21:57:49 +0000
@@ -1337,7 +1337,13 @@
1337 screen->updateClientList ();1337 screen->updateClientList ();
13381338
1339 if (priv->type & CompWindowTypeDesktopMask)1339 if (priv->type & CompWindowTypeDesktopMask)
1340 screen->incrementDesktopWindowCount();1340 {
1341 ::compiz::DesktopWindowCount::VisualType visual =
1342 alpha () ?
1343 ::compiz::DesktopWindowCount::ARGB :
1344 ::compiz::DesktopWindowCount::RGB;
1345 screen->incrementDesktopWindowCount (visual);
1346 }
13411347
1342 if (priv->protocols & CompWindowProtocolSyncRequestMask)1348 if (priv->protocols & CompWindowProtocolSyncRequestMask)
1343 {1349 {
@@ -1421,7 +1427,13 @@
1421 return;1427 return;
14221428
1423 if (priv->type == CompWindowTypeDesktopMask)1429 if (priv->type == CompWindowTypeDesktopMask)
1424 screen->decrementDesktopWindowCount();1430 {
1431 ::compiz::DesktopWindowCount::VisualType visual =
1432 alpha () ?
1433 ::compiz::DesktopWindowCount::ARGB :
1434 ::compiz::DesktopWindowCount::RGB;
1435 screen->decrementDesktopWindowCount (visual);
1436 }
14251437
1426 priv->attrib.map_state = IsUnmapped;1438 priv->attrib.map_state = IsUnmapped;
1427 priv->invisible = true;1439 priv->invisible = true;
@@ -6219,8 +6231,13 @@
62196231
6220 if (priv->attrib.map_state == IsViewable)6232 if (priv->attrib.map_state == IsViewable)
6221 {6233 {
6234 ::compiz::DesktopWindowCount::VisualType visual =
6235 alpha () ?
6236 ::compiz::DesktopWindowCount::ARGB :
6237 ::compiz::DesktopWindowCount::RGB;
6238
6222 if (priv->type == CompWindowTypeDesktopMask)6239 if (priv->type == CompWindowTypeDesktopMask)
6223 screen->decrementDesktopWindowCount ();6240 screen->decrementDesktopWindowCount (visual);
62246241
6225 if (priv->destroyed && priv->struts)6242 if (priv->destroyed && priv->struts)
6226 screen->updateWorkarea ();6243 screen->updateWorkarea ();

Subscribers

People subscribed via source and target branches

to all changes: