<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/126381/">https://git.reviewboard.kde.org/r/126381/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 16th, 2015, 7:29 p.m. UTC, <b>Daniel Vrátil</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/126381/diff/2/?file=423828#file423828line147" style="color: black; font-weight: bold; text-decoration: underline;">autotests/testkwaylandconfig.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<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">147</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QVERIFY</span><span class="p">(</span><span class="n">configSpy</span><span class="p">.</span><span class="n">count</span><span class="p">()</span> <span class="o">></span> <span class="mi">0</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;">Shouldn't this always be equal to 1? I mean if you perform exactly one change on a single output, you should not get more than one configurationChanged notifications from ConfigMonitor...</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;">One, actually. We change the whole thing and once all the changes are applied to the output. So with that version, we get a lot of events fired. </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">On the other hand, the compositor will tell us once it's done changing things. So what I'm doing now is blocking configChanged events between applying the new configuration and the compositor telling us that it's applied() or failed(), then unblock and trigger configChanged. The block signals logic was of course already there, just needed some tweaks for this to work. We now only get one change signal, even if we apply a series of changes to the config.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Good catch, this change may prevent a lot of unnecessary UI updates, or worse, resizing of the Plasma shell.</p></pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 16th, 2015, 7:29 p.m. UTC, <b>Daniel Vrátil</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/126381/diff/2/?file=423835#file423835line172" style="color: black; font-weight: bold; text-decoration: underline;">backends/kwayland/waylandconfig.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<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">172</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">connect</span><span class="p">(</span><span class="n">waylandoutput</span><span class="p">,</span> <span class="o">&</span><span class="n">WaylandOutput</span><span class="o">::</span><span class="n">complete</span><span class="p">,</span> <span class="p">[</span><span class="o">=</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;">Not that I would not like lambda slots, but there should be limit on how much code you can stuff into them :)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">IMO if it's not possible to deduce what the code is doing from a quick glance at it, it should not be an anonymous lambda, but a normal method with a descriptive name.</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;">Well, that one couldn't be much clearer: it's in Config::addOutput, and it "does something" when on "kwaylandoutput complete". I think a lambda especially here makes sense, since the code doesn't need to be called from elsewhere (so I can keep it "more local"), and it's in context of the addOutput slot, which means it's close to where the initialization of that output happens.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I've tightened the capture a bit, added context and a comment, but kept it a lambda in that place.</p></pre>
<br />
<p>- Sebastian</p>
<br />
<p>On December 16th, 2015, 2:05 a.m. UTC, Sebastian Kügler 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, Solid, Daniel Vrátil, and Martin Gräßlin.</div>
<div>By Sebastian Kügler.</div>
<p style="color: grey;"><i>Updated Dec. 16, 2015, 2:05 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
libkscreen
</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 adds a kwayland backend to libkscreen.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This backend uses KWayland's OutputManagement protocol for enlisting and
configuring devices.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Enlisting outputs</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">KScreen's outputs are created from KWayland::Client::OutputDevice objects,
they copy the data into kscreen's Outputs, and update these objects. A list
of outputs is requested from the client Registry object.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Configuring outputs</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The backend asks the global OutputManagement interface for an OutputConfiguration
object, then sets the changes per outputdevice on this object, and asks the
compositor to apply() this configuration.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">For this to work, the compositor should support the Wayland org_kde_kwin_outputdevice
and org_kde_kwin_outputmanagement protocols, for example through
KWayland::Server classes OutputDevice, OutputManagmenent and OuputConfiguration.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">General working</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">WaylandBackend creates a global static internal config, available through
WaylandBackend::internalConfig(). WaylandConfig binds to the wl_registry
callbacks and catches org_kde_kwin_outputdevice creation and destruction.
It passes org_kde_kwin_outputdevice creation and removal on to
WB::internalConfig() to handle its internal data representation as WaylandOutput.
WaylandOutput binds to org_kde_kwin_outputdevice's callback, and gets notified
of geometry and modes, including changes. WaylandOutput administrates the
internal representation of these objects, and invokes the global notifier,
which then runs the pointers it holds through the updateK* methods in
Wayland{Screen,Output,...}.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">KScreen:{Screen,Output,Edid,Mode} objects are created from the internal
representation as requested (usually triggered by the creation of a
KScreen::Config object through KScreen::Config::current()). As with other
backends, the objects which are handed out to the lib's user are expected
to be deleted by the user, the backend only takes ownership of its internal
data representation objects.</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;">The patch contains a test server, which is used for the autotests.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The test server uses KWayland's server classes and is set up from the json config data we use for the other tests. That means that the backends runs against a real server to test everything.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I also tested the kscreen UI, which also works as expected.</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>CMakeLists.txt <span style="color: grey">(efac5ce)</span></li>
<li>autotests/CMakeLists.txt <span style="color: grey">(07b7bbc)</span></li>
<li>autotests/configs/default.json <span style="color: grey">(3ac3e19)</span></li>
<li>autotests/testconfigserializer.cpp <span style="color: grey">(1af3069)</span></li>
<li>autotests/testkwaylandbackend.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>autotests/testkwaylandconfig.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/CMakeLists.txt <span style="color: grey">(ff5d751)</span></li>
<li>backends/kwayland/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/README.txt <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandbackend.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandbackend.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandconfig.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandconfig.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandoutput.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandoutput.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandscreen.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>backends/kwayland/waylandscreen.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>src/backendmanager.cpp <span style="color: grey">(89ae31e)</span></li>
<li>src/config.cpp <span style="color: grey">(e8b8a8f)</span></li>
<li>src/screen.h <span style="color: grey">(4cd1e82)</span></li>
<li>tests/CMakeLists.txt <span style="color: grey">(d5e41d5)</span></li>
<li>tests/kwayland/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/kwayland/main.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/kwayland/waylandconfigreader.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/kwayland/waylandconfigreader.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/kwayland/waylandtestserver.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>tests/kwayland/waylandtestserver.cpp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/126381/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>