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

List:       kde-panel-devel
Subject:    Re: Review Request 121240: Port to new KScreen API
From:       Daniel_Vrátil <dvratil () redhat ! com>
Date:       2014-11-25 12:54:00
Message-ID: 20141125125400.11306.78216 () probe ! kde ! org
[Download RAW message or body]

--===============8868002920773283821==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit



> On Nov. 25, 2014, 12:56 p.m., Aleix Pol Gonzalez wrote:
> > shell/shellcorona.cpp, line 328
> > <https://git.reviewboard.kde.org/r/121240/diff/1/?file=329712#file329712line328>
> > 
> > Are you sure this is correct?
> > 
> > This was done because at some point Configuration::primaryOutput and \
> > Output::isPrimary were not consistent and this was a way to make it consistent.

The behaviour has changed a little with the new API (mostly because the way Outputs \
are updated have changed). Now Configuration::primaryOutput is changed after all \
Outputs have been updated. That's why this patch also switches from listening to \
Output::isPrimaryChanged to Configuration::primaryOutputChanged.

The problem with reacting to Output::isPrimaryChanged is, that you will get the \
signal always twice: once for the output that is set to be primary, and once for the \
output where primary flag is unset. If the order is first unset, then set, then \
everything is OK, but if the order happens to be that first you get signal from the \
output that was set a primary and then from the one that was unset from primary, \
stuff gets broken and you start hitting various asserts in the codepath.

By reacting to Config::primaryOutputChanged, you are sure that all the changes have \
already been applied (including primary), and that calling Config::primaryOutput \
gives you what you expect.


- Daniel


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121240/#review70911
-----------------------------------------------------------


On Nov. 25, 2014, 10:18 a.m., Daniel Vrátil wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121240/
> -----------------------------------------------------------
> 
> (Updated Nov. 25, 2014, 10:18 a.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> This patch ports ShellCorona and PanelView to new KScreen API. The new API is \
> completely asynchronous and is using shared pointers. The internals have also \
> undergone some major changes, but they don't directly affect Plasma. 
> Additionally to the port, this patch also changes the way ShellCorona reacts to \
> primary screen changes: instead of listening to Output::isPrimaryChanged on each \
> output, it listens now to Config::primaryOutputChanged. The reason is that when \
> some output is set as primary, the signal is emitted right away. This can happen \
> before the old primary is unset though, which then causes crashes in \
> screenInvariants() in some situations/configurations. Listening to \
> Config::primaryOutputChanges ensures that Plasma reacts only once, and only when \
> the Config is consistent. 
> The new KScreen API is available in dev/redesign branches in libkscreen.git. I'll \
> merge the branch to "frameworks" branch once this review is approved in order not \
> to break build. 
> 
> Diffs
> -----
> 
> shell/panelview.cpp 0dc5740 
> shell/shellcorona.h 5e97e02 
> shell/shellcorona.cpp 0da789f 
> 
> Diff: https://git.reviewboard.kde.org/r/121240/diff/
> 
> 
> Testing
> -------
> 
> Been using this patch and the new KScreen for couple weeks now, works better than \
> the old one. 
> 
> Thanks,
> 
> Daniel Vrátil
> 
> 


--===============8868002920773283821==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




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










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On November 25th, 2014, 12:56 p.m. CET, <b>Aleix \
Pol Gonzalez</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px \
solid #d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/121240/diff/1/?file=329712#file329712line328" \
style="color: black; font-weight: bold; text-decoration: \
underline;">shell/shellcorona.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static \
QList&lt;KScreen::Output*&gt; sortOutputs(const QHash&lt;int, KScreen::Output*&gt; \
&amp;outputs)</pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: \
140%; margin: 0; ">static QList&lt;KScreen::OutputPtr&gt; sortOutputs(const \
KScreen::OutputList &amp;outputs)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">320</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">KScreen</span><span class="o">::</span><span class="n">Output</span><span \
class="hl"> </span><span class="o"><span class="hl">*</span></span><span \
class="n">output</span> <span class="o">=</span> <span class="n"><span \
class="hl">findP</span>rimaryOutput</span><span class="p">();</span></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">327</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">   <span \
class="hl"> </span><span class="k"><span class="hl">const</span></span> <span \
class="n">KScreen</span><span class="o">::</span><span class="n">Output<span \
class="hl">Ptr</span></span><span class="hl"> </span><span class="n">output</span> \
<span class="o">=</span> <span class="n"><span \
class="hl">m_screenConfiguration</span></span><span class="o"><span \
class="hl">-&gt;</span></span><span class="n"><span \
class="hl">p</span>rimaryOutput</span><span class="p">();</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Are \
you sure this is correct?</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">This was done because at some point \
Configuration::primaryOutput and Output::isPrimary were not consistent and this was a \
way to make it consistent.</p></pre>  </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">The behaviour has changed a little with the new API (mostly because the way \
Outputs are updated have changed). Now Configuration::primaryOutput is changed after \
all Outputs have been updated. That's why this patch also switches from listening to \
Output::isPrimaryChanged to Configuration::primaryOutputChanged.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">The problem with reacting to Output::isPrimaryChanged is, that you will get \
the signal always twice: once for the output that is set to be primary, and once for \
the output where primary flag is unset. If the order is first unset, then set, then \
everything is OK, but if the order happens to be that first you get signal from the \
output that was set a primary and then from the one that was unset from primary, \
stuff gets broken and you start hitting various asserts in the codepath.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">By reacting to Config::primaryOutputChanged, you are sure that all the \
changes have already been applied (including primary), and that calling \
Config::primaryOutput gives you what you expect.</p></pre> <br />




<p>- Daniel</p>


<br />
<p>On November 25th, 2014, 10:18 a.m. CET, Daniel Vrátil wrote:</p>









<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for Plasma.</div>
<div>By Daniel Vrátil.</div>


<p style="color: grey;"><i>Updated Nov. 25, 2014, 10:18 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
plasma-workspace
</div>


<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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This patch ports ShellCorona and PanelView to new \
KScreen API. The new API is completely asynchronous and is using shared pointers. The \
internals have also undergone some major changes, but they don't directly affect \
Plasma.</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Additionally to the port, this patch also changes the \
way ShellCorona reacts to primary screen changes: instead of listening to \
Output::isPrimaryChanged on each output, it listens now to \
Config::primaryOutputChanged. The reason is that when some output is set as primary, \
the signal is emitted right away. This can happen before the old primary is unset \
though, which then causes crashes in screenInvariants() in some \
situations/configurations. Listening to Config::primaryOutputChanges ensures that \
Plasma reacts only once, and only when the Config is consistent.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">The new KScreen API is available in dev/redesign branches in \
libkscreen.git. I'll merge the branch to "frameworks" branch once this review is \
approved in order not to break build.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Been using this patch and the new KScreen for couple \
weeks now, works better than the old one.</p></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>shell/panelview.cpp <span style="color: grey">(0dc5740)</span></li>

 <li>shell/shellcorona.h <span style="color: grey">(5e97e02)</span></li>

 <li>shell/shellcorona.cpp <span style="color: grey">(0da789f)</span></li>

</ul>

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






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








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


--===============8868002920773283821==--



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


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

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