[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: Review Request: clean up & simplify quicktile / quick maximize
From: Martin_Gräßlin <kde () martin-graesslin ! com>
Date: 2011-02-16 18:10:09
Message-ID: 20110216181009.31487.55570 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/100664/#review1462
-----------------------------------------------------------
In general it looks nice and is a small little code cleanup :-) There are s=
ome red areas and coding style missmatches (here we have to be careful or o=
ur big rewrite wasn't worth it).
As you know had a look at the code: do you think it would be possible to re=
factor the code into an own class? I don't like that parts of it are split =
in different files (yes that's my own fault).
kwin/client.h
<http://git.reviewboard.kde.org/r/100664/#comment1224>
I don't think we need the desktop here. Looking through the patch it se=
ems like it's only called once and desktop is only used for clientArea wher=
e desktop basically does not matter.
kwin/geometry.cpp
<http://git.reviewboard.kde.org/r/100664/#comment1225>
do we really need such a warning? :-)
kwin/lib/kwinglobals.h
<http://git.reviewboard.kde.org/r/100664/#comment1226>
just an idea: as it's now basically flags why not use QFlags so that we=
do not need to pass ints around? I would like to have it a little bit more=
type safe..
- Martin
On Feb. 15, 2011, 11:09 p.m., Thomas L=C3=BCbking wrote:
> =
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100664/
> -----------------------------------------------------------
> =
> (Updated Feb. 15, 2011, 11:09 p.m.)
> =
> =
> Review request for kwin.
> =
> =
> Summary
> -------
> =
> clean up & simplify quicktile / quick maximize code
> in a second pass one should maybe align function names & simplify the sh=
ortcut slots (using one slot reading qobject_cast<QAction*>(sender())->data=
()
> =
> =
> Diffs
> -----
> =
> kwin/events.cpp 390313f =
> kwin/client.h e6f2ef4 =
> kwin/geometry.cpp 99e190b =
> kwin/lib/kwinglobals.h 8bb7565 =
> kwin/placement.cpp 0f3d4d3 =
> kwin/workspace.cpp 922de17 =
> =
> Diff: http://git.reviewboard.kde.org/r/100664/diff
> =
> =
> Testing
> -------
> =
> yes, everything from moving windows to edges to using shortcuts
> =
> =
> Thanks,
> =
> Thomas
> =
>
[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/100664/">http://git.reviewboard.kde.org/r/100664/</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;">In general it looks nice \
and is a small little code cleanup :-) There are some red areas and coding style \
missmatches (here we have to be careful or our big rewrite wasn't worth it).
As you know had a look at the code: do you think it would be possible to refactor the \
code into an own class? I don't like that parts of it are split in different \
files (yes that's my own fault).</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="http://git.reviewboard.kde.org/r/100664/diff/1/?file=9242#file9242line265" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/client.h</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; \
">public:</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">265</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QRect</span> <span class="n">electricBorderMaximizeGeometry</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">265</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">QRect</span> <span \
class="n">electricBorderMaximizeGeometry</span><span class="p">(</span><span \
class="n"><span class="hl">QPoint</span></span><span class="hl"> </span><span \
class="n"><span class="hl">pos</span></span><span class="p"><span \
class="hl">,</span></span><span class="hl"> </span><span class="kt"><span \
class="hl">int</span></span><span class="hl"> </span><span class="n"><span \
class="hl">desktop</span></span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don't \
think we need the desktop here. Looking through the patch it seems like it's only \
called once and desktop is only used for clientArea where desktop basically does not \
matter.</pre> </div>
<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="http://git.reviewboard.kde.org/r/100664/diff/1/?file=9244#file9244line2718" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/geometry.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 \
Client::finishMoveResize(bool cancel)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">2682</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k"><span \
class="hl">switch</span></span><span class="p"><span class="hl">(</span></span><span \
class="n"><span class="hl">e</span>lectric<span class="hl">Mode</span></span><span \
class="p"><span class="hl">)</span></span><span class="hl"> </span><span \
class="p"><span class="hl">{</span></span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">2705</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k"><span \
class="hl">if</span></span><span class="hl"> </span><span class="p"><span \
class="hl">(</span></span><span class="n"><span class="hl">border</span></span><span \
class="hl"> </span><span class="o"><span class="hl">==</span></span><span class="hl"> \
</span><span class="n"><span class="hl">E</span>lectric<span \
class="hl">None</span></span><span class="p"><span \
class="hl">)</span></span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">2683</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">case</span> <span class="nl">ElectricMaximizeMode:</span></pre></td> <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">2706</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">qWarning</span><span class="p">(</span><span \
class="s">"WAAAAAHHHH - BAD CORNER!!!!"</span><span \
class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">do we \
really need such a warning? :-)</pre> </div>
<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="http://git.reviewboard.kde.org/r/100664/diff/1/?file=9245#file9245line82" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/lib/kwinglobals.h</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; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">enum QuickTileMode {</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">82</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">enum</span> \
<span class="n">QuickTileMode</span> <span class="p">{</span></pre></td> <th \
bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">72</font></th> <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="k">enum</span> <span class="n">QuickTileMode</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">83</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileNone</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">73</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileNone</span><span class="hl"> </span><span class="o"><span \
class="hl">=</span></span><span class="hl"> </span><span class="mi"><span \
class="hl">0</span></span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">84</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileLeft</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">74</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileLeft</span><span class="hl"> </span><span class="o"><span \
class="hl">=</span></span><span class="hl"> </span><span class="mi"><span \
class="hl">1</span></span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">85</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileRight</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">75</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileRight</span><span class="hl"> </span><span class="o"><span \
class="hl">=</span></span><span class="hl"> </span><span class="mi"><span \
class="hl">1</span></span><span class="o"><span \
class="hl"><<</span></span><span class="mi"><span \
class="hl">1</span></span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">86</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileTop<span class="hl">Left</span></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">76</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">QuickTileTop</span><span \
class="hl"> </span><span class="o"><span class="hl">=</span></span><span class="hl"> \
</span><span class="mi"><span class="hl">1</span></span><span class="o"><span \
class="hl"><<</span></span><span class="mi"><span \
class="hl">2</span></span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">87</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTile<span class="hl">TopRight</span></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">77</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">QuickTile<span \
class="hl">Bottom</span></span><span class="hl"> </span><span class="o"><span \
class="hl">=</span></span><span class="hl"> </span><span class="mi"><span \
class="hl">1</span></span><span class="o"><span \
class="hl"><<</span></span><span class="mi"><span \
class="hl">3</span></span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">88</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileBottomLeft</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">78</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileHorizontal</span> <span class="o">=</span> <span \
class="n">QuickTileLeft</span><span class="o">|</span><span \
class="n">QuickTileRight</span><span class="p">,</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">89</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileBottomRight</span></pre></td> <th bgcolor="#e9eaa8" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">79</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileVertical</span> <span class="o">=</span> <span \
class="n">QuickTileTop</span><span class="o">|</span><span \
class="n">QuickTileBottom</span><span class="p">,</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">80</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QuickTileMaximize</span> <span class="o">=</span> <span \
class="n">QuickTileLeft</span><span class="o">|</span><span \
class="n">QuickTileRight</span><span class="o">|</span><span \
class="n">QuickTileTop</span><span class="o">|</span><span \
class="n">QuickTileBottom</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">90</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="p">};</span></pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">81</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "><span class="p">};</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">just an \
idea: as it's now basically flags why not use QFlags so that we do not need to \
pass ints around? I would like to have it a little bit more type safe..</pre> </div>
<br />
<p>- Martin</p>
<br />
<p>On February 15th, 2011, 11:09 p.m., Thomas Lübking wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.orgrb/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 Thomas Lübking.</div>
<p style="color: grey;"><i>Updated Feb. 15, 2011, 11:09 p.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;">clean up & simplify quicktile / quick maximize code in a second pass \
one should maybe align function names & simplify the shortcut slots (using one \
slot reading qobject_cast<QAction*>(sender())->data()</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;">yes, everything from moving windows to edges to using shortcuts</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/events.cpp <span style="color: grey">(390313f)</span></li>
<li>kwin/client.h <span style="color: grey">(e6f2ef4)</span></li>
<li>kwin/geometry.cpp <span style="color: grey">(99e190b)</span></li>
<li>kwin/lib/kwinglobals.h <span style="color: grey">(8bb7565)</span></li>
<li>kwin/placement.cpp <span style="color: grey">(0f3d4d3)</span></li>
<li>kwin/workspace.cpp <span style="color: grey">(922de17)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/100664/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