From kwin Thu Aug 30 20:59:23 2012 From: =?utf-8?q?Martin_Gr=C3=A4=C3=9Flin?= Date: Thu, 30 Aug 2012 20:59:23 +0000 To: kwin Subject: Re: Review Request: Compositor singleton and remove superfluous Compositor checks in events.cpp Message-Id: <20120830205923.21789.41250 () vidsolbach ! de> X-MARC-Message: https://marc.info/?l=kwin&m=134636037402014 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============3097050783693906054==" --===============3097050783693906054== Content-Type: multipart/alternative; boundary="===============1079724095708999499==" --===============1079724095708999499== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > On Aug. 30, 2012, 8:18 p.m., Thomas L=C3=BCbking wrote: > > kwin/composite.h, line 137 > > > > > > static CompositingType compositing() { > > return s_compositor && s_compositor->isActive() ? effects->comp= ositingType() : NoCompositing; > > } > > = > > ?? - Sorry for being pita =3D) not sure if it's worth it. It's only used in Client in one method and that = particular code is messy anyway - that is I want to rework it. - Martin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/106255/#review18291 ----------------------------------------------------------- On Aug. 30, 2012, 7:44 p.m., Martin Gr=C3=A4=C3=9Flin wrote: > = > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://git.reviewboard.kde.org/r/106255/ > ----------------------------------------------------------- > = > (Updated Aug. 30, 2012, 7:44 p.m.) > = > = > Review request for kwin. > = > = > Description > ------- > = > Remove superfluous Compositor checks in events.cpp > = > compositing() ensures that m_compositor is not null. > = > Make the Compositor a proper Singleton > = > The Compositor class actually behaves like a Singleton so it should be > one. Therefore four static methods are added: > * self() to access the Singleton > * createCompositor() to be used by Workspace to create the instance > * isCreated() to have a simple check whether the Singleton is already > created > * compositing() as a shortcut to test whether the compositor has been > created and is active > = > The isCreated() check is actually required as especially Clients might > be created and trying to access the Compositor before it is setup. > = > = > Diffs > ----- > = > kwin/bridge.cpp 670063e2276a506e0b3f3e29d2fef3b946032f82 = > kwin/client.cpp 569494418117f3b987f05c844debac48a88ed05d = > kwin/composite.h a4a37107ffe4981e9758c9ff65779c646ae94ffb = > kwin/composite.cpp 640ebd6a3c09e82492d79b9b2d68d752d6a0c62c = > kwin/events.cpp 23e1921bfa653fcf399378c0328733fb996b9d1f = > kwin/geometry.cpp 19a911d097c3fd87da28ede9dc9fd362310146cc = > kwin/paintredirector.cpp 55b20c4f4eae2723df46e92654c851e912cd5008 = > kwin/workspace.h 3f4bd9f93a27c832fef913e5fdbcc24518fadb4d = > kwin/workspace.cpp e03e5e765bea8d098bd86dd5118198ddccd8fd8d = > = > Diff: http://git.reviewboard.kde.org/r/106255/diff/ > = > = > Testing > ------- > = > = > Thanks, > = > Martin Gr=C3=A4=C3=9Flin > = > --===============1079724095708999499== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
This is an automatically generated e-mail. To reply, visit: http://git.revie= wboard.kde.org/r/106255/

On August 30th, 2012, 8:18 p.m., Thomas L= =C3=BCbking wrote:

= = =
kwin/composite.h (Diff revision 3)
class Compositor : public QObject {
136
    static bool compositing=
() {
static Co=
mpositingType compositing() {
    return s_compositor && s_compositor->isActive() ? effects-&g=
t;compositingType() : NoCompositing;
}

?? - Sorry for being pita =3D)
not sure if it's worth it. It's only used in Client in one m=
ethod and that particular code is messy anyway - that is I want to rework i=
t.

- Martin


On August 30th, 2012, 7:44 p.m., Martin Gr=C3=A4=C3=9Flin wrote:

Review request for kwin.
By Martin Gr=C3=A4=C3=9Flin.

Updated Aug. 30, 2012, 7:44 p.m.

Descripti= on

Remove superfluous Compositor checks in events.cpp

compositing() ensures that m_compositor is not null.

Make the Compositor a proper Singleton

The Compositor class actually behaves like a Singleton so it should be
one. Therefore four static methods are added:
* self() to access the Singleton
* createCompositor() to be used by Workspace to create the instance
* isCreated() to have a simple check whether the Singleton is already
  created
* compositing() as a shortcut to test whether the compositor has been
  created and is active

The isCreated() check is actually required as especially Clients might
be created and trying to access the Compositor before it is setup.

Diffs=

  • kwin/bridge.cpp (670063e2276a506e0b3f3e29d= 2fef3b946032f82)
  • kwin/client.cpp (569494418117f3b987f05c844= debac48a88ed05d)
  • kwin/composite.h (a4a37107ffe4981e9758c9ff= 65779c646ae94ffb)
  • kwin/composite.cpp (640ebd6a3c09e82492d79b= 9b2d68d752d6a0c62c)
  • kwin/events.cpp (23e1921bfa653fcf399378c03= 28733fb996b9d1f)
  • kwin/geometry.cpp (19a911d097c3fd87da28ede= 9dc9fd362310146cc)
  • kwin/paintredirector.cpp (55b20c4f4eae2723= df46e92654c851e912cd5008)
  • kwin/workspace.h (3f4bd9f93a27c832fef913e5= fdbcc24518fadb4d)
  • kwin/workspace.cpp (e03e5e765bea8d098bd86d= d5118198ddccd8fd8d)

View Diff

--===============1079724095708999499==-- --===============3097050783693906054== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kwin mailing list kwin@kde.org https://mail.kde.org/mailman/listinfo/kwin --===============3097050783693906054==--