<div>graesslin requested changes to this revision.<br />
graesslin added a comment.<br />
This revision now requires changes to proceed.</div><br /><div><div><p>Overall I would also like to see autotests for it similar to the tests for other interfaces.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D1231#inline-6792" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">remote_access_interface.cpp:146-149</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">bound</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">        <span class="n">wl_client_post_no_memory</span><span class="p">(</span><span class="n">client</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">        <span style="color: #aa4000">return</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">if really only one client should be allowed (why?) it would be better to send a dedicated error state to inform it instead of "abusing" no memory.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D1231#inline-6791" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">remote_access_interface.cpp:158</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="n">wl_resource_set_implementation</span><span class="p">(</span><span class="n">resource</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">s_interface</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="n">unbind</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="n">m_resource</span> <span style="color: #aa2211">=</span> <span class="n">resource</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="n">bound</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">true</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">this allows to have only one client bind it. As soon as a second client binds the protocol it will get overwritten and breaks the existing one.</p>

<p style="padding: 0; margin: 8px;">I think you need a QVector<wl_resource*> here.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D1231#inline-6793" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">remote_access_interface.h:43</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #74777d"> **/</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #aa4000">struct</span> <span class="n">GbmBuffer</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">for ABI compatibility we cannot have structs defined in the header. See <a href="https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B#The_Do.27s_and_Don.27ts" class="remarkup-link" target="_blank" rel="noreferrer">https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B#The_Do.27s_and_Don.27ts</a> for explanation. Especially the last point of the Donts is relevant as it means we are never able to change this again.</p>

<p style="padding: 0; margin: 8px;">Thus I think the proper way has to be:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">class Buffer
{
public:
void setFd(int qint32);
void setSize(const QSize &size);
void setStride(qint32 stride);
enum class Format {
Format1,
Format2
};
void setFormat(Format format);

private:
class Private;
QScopedPointer<Private> d;
};</pre></div>

<p style="padding: 0; margin: 8px;">and then in the Implementation have the Private class which holds the data members.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D1231#inline-6790" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">remote_access_interface.h:94-112</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="n">class</span> <span class="n">KWAYLANDSERVER_EXPORT</span> <span style="color: #a0a000">RemoteBufferInterface</span> <span class="p">:</span> <span class="n">public</span> <span class="n">Resource</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="n">Q_OBJECT</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #a0a000">public</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span class="n">virtual</span> <span style="color: #aa2211">~</span><span class="n">RemoteBufferInterface</span><span class="p">()</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">default</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span style="color: #74777d">/**</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I don't see this class exposed in any way in the API. So a user of the library cannot have access to it.</p>

<p style="padding: 0; margin: 8px;">Thus I suggest to move it into a private header and remove the KWAYLANDSERVER_EXPORT. It's a private class to the library then, which makes life easier.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>rKWAYLAND KWayland</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D1231" rel="noreferrer">https://phabricator.kde.org/D1231</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>Kanedias, graesslin<br /><strong>Cc: </strong>plasma-devel, sebas<br /></div>