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

List:       kde-panel-devel
Subject:    Re: Review Request 119945: Dialog: Simplify handling of min/max width/height changed
From:       "Marco Martin" <notmart () gmail ! com>
Date:       2014-08-26 18:43:35
Message-ID: 20140826184335.11205.12555 () probe ! kde ! org
[Download RAW message or body]

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


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


didn't make more tests, but what i think it's happening is Layout.minimumWidth/Height \
etc of the main item being picked up only after the first resize, so it causes some \
popups to have the proper size, some other incorrect instead


src/plasmaquick/dialog.cpp
<https://git.reviewboard.kde.org/r/119945/#comment45637>

    instead of disconnecting and reconnecting, you can also just block and reenable \
signals on the object


- Marco Martin


On Aug. 26, 2014, 5:34 p.m., Vishesh Handa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119945/
> -----------------------------------------------------------
> 
> (Updated Aug. 26, 2014, 5:34 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> When the minimumWidth/Height of the attached Layout of the mainItem
> would change. The following events would happen -
> 
> - updateMinimumWidth is called
> --> results in resizeEvent being called
> --> results in syncMainItemToSize
> --> results in slots connected to mainItem widthChanged
> ---> syncMainItemToSize + syncToMainItemSize being called a few more
> times. It's not entirely apparent why at thist point.
> 
> This kind of logic is quite hard to follow and more importantly because
> of the timers in the middle, an extra paint event is called. This means
> the user can first see the window resize and then the item getting
> resized.
> 
> This patch introduces a little bit of code duplication (can be fixed in
> future commits) to clearly establish what updateMinimumWidth should be
> doing -
> * disconnect signals to make sure mainItem's widthChange is not triggered
> * update window size + item size + borders
> * reposition if required
> 
> The repositioning is useful as currently if a dialog becomes wider if
> will not reposition itself and will overflow. With this patch we always
> make sure the entire dialog is shown.
> 
> Minor Point: On testing without the patch the dialog does reposition
> itself if it is not already overflowing. I suspect this is kwin moving
> the window.
> 
> A test called dialog_minWidthHeighRepositioning.qml can be used to see
> how the change occurs before and after.
> 
> 
> Diffs
> -----
> 
> src/plasmaquick/dialog.h f207f88 
> src/plasmaquick/dialog.cpp 02271e4 
> 
> Diff: https://git.reviewboard.kde.org/r/119945/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Vishesh Handa
> 
> 


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




<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/119945/">https://git.reviewboard.kde.org/r/119945/</a>
  </td>
    </tr>
   </table>
   <br />





 <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;">didn't make more tests, but what i think it's happening is \
Layout.minimumWidth/Height etc of the main item being picked up only after the first \
resize, so it causes some popups to have the proper size, some other incorrect \
instead</p></pre>  <br />







<div>



<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/119945/diff/1/?file=307711#file307711line311" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/plasmaquick/dialog.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="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
DialogPrivate::updateVisibility(bool visible)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">286</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">if</span> <span class="p">(</span><span class="n">location</span> <span \
class="o">==</span> <span class="n">Plasma</span><span class="o">::</span><span \
class="n">Types</span><span class="o">::</span><span class="n">BottomEdge</span><span \
class="p">)</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">296</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">mainItem</span><span class="p">.</span><span class="n">data</span><span \
class="p">()</span><span class="o">-&gt;</span><span class="n">disconnect</span><span \
class="p">(</span><span class="n">q</span><span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">instead of disconnecting and reconnecting, you can also just block and \
reenable signals on the object</p></pre>  </div>
</div>
<br />



<p>- Marco Martin</p>


<br />
<p>On August 26th, 2014, 5:34 p.m. UTC, Vishesh Handa 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 Vishesh Handa.</div>


<p style="color: grey;"><i>Updated Aug. 26, 2014, 5:34 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
plasma-framework
</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;">When the minimumWidth/Height of the attached Layout of \
the mainItem<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;" /> would change. The following events would happen \
-</p> <ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: \
inherit;white-space: normal;"> <li style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;">updateMinimumWidth is called<br \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
                normal;" />
--&gt; results in resizeEvent being called<br style="padding: 0;text-rendering: \
                inherit;margin: 0;line-height: inherit;white-space: normal;" />
--&gt; results in syncMainItemToSize<br style="padding: 0;text-rendering: \
                inherit;margin: 0;line-height: inherit;white-space: normal;" />
--&gt; results in slots connected to mainItem widthChanged<br style="padding: \
                0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
                normal;" />
---&gt; syncMainItemToSize + syncToMainItemSize being called a few more<br \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;" /> times. It's not entirely apparent why at thist point.</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This kind of logic is quite hard to follow and more \
importantly because<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> of the timers in the middle, an extra \
paint event is called. This means<br style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;" /> the user can first \
see the window resize and then the item getting<br style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;" /> resized.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This patch introduces a little bit of code duplication \
(can be fixed in<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;" /> future commits) to clearly establish what \
updateMinimumWidth should be<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> doing -<br style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" /> <em \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;"> disconnect signals to make sure mainItem's widthChange is not triggered<br \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;" /> </em> update window size + item size + borders<br style="padding: \
                0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
                normal;" />
* reposition if required</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">The repositioning is useful as currently if a dialog \
becomes wider if<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;" /> will not reposition itself and will overflow. With \
this patch we always<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> make sure the entire dialog is \
shown.</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Minor Point: On testing without the patch the dialog \
does reposition<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;" /> itself if it is not already overflowing. I suspect \
this is kwin moving<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> the window.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">A test called dialog_minWidthHeighRepositioning.qml \
can be used to see<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> how the change occurs before and \
after.</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>src/plasmaquick/dialog.h <span style="color: grey">(f207f88)</span></li>

 <li>src/plasmaquick/dialog.cpp <span style="color: grey">(02271e4)</span></li>

</ul>

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






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








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


--===============3087664490598231550==--



_______________________________________________
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