[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request: Remove superfluous Compositor checks in events.cpp
From:       Thomas_Lübking <thomas.luebking () web ! de>
Date:       2012-08-30 13:16:25
Message-ID: 20120830131625.23426.76370 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Aug. 28, 2012, 7:20 p.m., Thomas L=C3=BCbking wrote:
> > One could probably override the "->" operator to return NULL function p=
ointers what makes them noop and also returns false (::isActive() etc.) but=
 i'd have to try myself, so i'm not sure whether that works. <- Code Fu mas=
turbation ;-)
> > =

> > Another option was to make ::isActive (and some other functions) static=
 as well. *shrug*
> =

> Martin Gr=C3=A4=C3=9Flin wrote:
>     I first wanted to do the ::isActive but decided then to add just the =
::isCreated as it's kind of strange to make everything static. But override=
 the operator-> sound interesting but also a little bit academic ;-)

The hidden danger in overriding operator::-> is that any function that shou=
ld default to anything but false/0 will depending on the compositor instanc=
e default to NULL instead.

Given that ::isActive will be the most interesting condition for "external"=
 callers and the return in absence of a compositor is defined, i'd vote to =
make at least that one static next to ::isCreated - and leave wonky pointer=
 experiments to things with a lower amount of users ;-)


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106255/#review18179
-----------------------------------------------------------


On Aug. 30, 2012, 9:23 a.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, 9:23 a.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 three 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
> =

> 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
> =

>


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/106255/">http://git.reviewboard.kde.org/r/106255/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On August 28th, 2012, 7:20 p.m., <b>Thomas \
Lübking</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">One could probably override the &quot;-&gt;&quot; operator to return \
NULL function pointers what makes them noop and also returns false (::isActive() \
etc.) but i&#39;d have to try myself, so i&#39;m not sure whether that works. &lt;- \
Code Fu masturbation ;-)

Another option was to make ::isActive (and some other functions) static as well. \
*shrug*</pre>  </blockquote>




 <p>On August 28th, 2012, 8:16 p.m., <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I first wanted to do the \
::isActive but decided then to add just the ::isCreated as it&#39;s kind of strange \
to make everything static. But override the operator-&gt; sound interesting but also \
a little bit academic ;-)</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The hidden danger in \
overriding operator::-&gt; is that any function that should default to anything but \
false/0 will depending on the compositor instance default to NULL instead.

Given that ::isActive will be the most interesting condition for &quot;external&quot; \
callers and the return in absence of a compositor is defined, i&#39;d vote to make at \
least that one static next to ::isCreated - and leave wonky pointer experiments to \
things with a lower amount of users ;-)</pre> <br />








<p>- Thomas</p>


<br />
<p>On August 30th, 2012, 9:23 a.m., Martin Gräßlin wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin.</div>
<div>By Martin Gräßlin.</div>


<p style="color: grey;"><i>Updated Aug. 30, 2012, 9:23 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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 three 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

The isCreated() check is actually required as especially Clients might
be created and trying to access the Compositor before it is setup.</pre>
  </td>
 </tr>
</table>





<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/bridge.cpp <span style="color: \
grey">(670063e2276a506e0b3f3e29d2fef3b946032f82)</span></li>

 <li>kwin/client.cpp <span style="color: \
grey">(569494418117f3b987f05c844debac48a88ed05d)</span></li>

 <li>kwin/composite.h <span style="color: \
grey">(a4a37107ffe4981e9758c9ff65779c646ae94ffb)</span></li>

 <li>kwin/composite.cpp <span style="color: \
grey">(640ebd6a3c09e82492d79b9b2d68d752d6a0c62c)</span></li>

 <li>kwin/events.cpp <span style="color: \
grey">(23e1921bfa653fcf399378c0328733fb996b9d1f)</span></li>

 <li>kwin/geometry.cpp <span style="color: \
grey">(19a911d097c3fd87da28ede9dc9fd362310146cc)</span></li>

 <li>kwin/paintredirector.cpp <span style="color: \
grey">(55b20c4f4eae2723df46e92654c851e912cd5008)</span></li>

 <li>kwin/workspace.h <span style="color: \
grey">(3f4bd9f93a27c832fef913e5fdbcc24518fadb4d)</span></li>

 <li>kwin/workspace.cpp <span style="color: \
grey">(e03e5e765bea8d098bd86dd5118198ddccd8fd8d)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/106255/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic