<table><tr><td style="">graesslin requested changes to this revision.<br />graesslin added inline comments.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D6591" rel="noreferrer">View Revision</a></tr></table><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/D6591#inline-31722" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">shell_client.cpp:222</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: rgba(151, 234, 151, .6);">        <span class="n">connect</span><span class="p">(</span><span style="color: #aa4000">static_cast</span><span style="color: #aa2211"><</span><span class="n">XdgShellInterface</span> <span style="color: #aa2211">*></span><span class="p">(</span><span class="n">m_xdgShellSurface</span><span style="color: #aa2211">-></span><span class="n">global</span><span class="p">()),</span> <span style="color: #aa2211">&</span><span class="n">XdgShellInterface</span><span style="color: #aa2211">::</span><span class="n">pingDelayed</span><span class="p">,</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">m_xdgShellSurface</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa4000">this</span><span class="p">](</span><span class="n">qint32</span> <span class="n">serial</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">maybe instead of the three casts just store a local variable?</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);">auto global = (static_cast<XdgShellInterface *>(m_xdgShellSurface->global());</pre></div>

</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/D6591#inline-31729" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">shell_client.cpp:231-239</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: rgba(151, 234, 151, .6);">        <span class="n">connect</span><span class="p">(</span><span style="color: #aa4000">static_cast</span><span style="color: #aa2211"><</span><span class="n">XdgShellInterface</span> <span style="color: #aa2211">*></span><span class="p">(</span><span class="n">m_xdgShellSurface</span><span style="color: #aa2211">-></span><span class="n">global</span><span class="p">()),</span> <span style="color: #aa2211">&</span><span class="n">XdgShellInterface</span><span style="color: #aa2211">::</span><span class="n">pingTimeout</span><span class="p">,</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">m_xdgShellSurface</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa4000">this</span><span class="p">](</span><span class="n">qint32</span> <span class="n">serial</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">auto</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">m_pingSerials</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="n">serial</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">it</span> <span style="color: #aa2211">!=</span> <span class="n">m_pingSerials</span><span class="p">.</span><span class="n">end</span><span class="p">())</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                    <span class="n">qCDebug</span><span class="p">(</span><span class="n">KWIN_CORE</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"Final ping timeout, asking to kill:"</span> <span style="color: #aa2211"><<</span> <span class="n">caption</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                    <span class="n">killWindow</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                    <span class="n">m_pingSerials</span><span class="p">.</span><span class="n">erase</span><span class="p">(</span><span class="n">it</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You should only kill if the ping reason is close. This would also ping for focus, wouldn't it?</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/D6591#inline-31723" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">shell_client.cpp:277-280</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: rgba(151, 234, 151, .6);">        <span class="n">connect</span><span class="p">(</span><span class="n">m_xdgShellPopup</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">XdgShellPopupInterface</span><span style="color: #aa2211">::</span><span class="n">grabbed</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa4000">this</span><span class="p">](</span><span class="n">SeatInterface</span> <span style="color: #aa2211">*</span><span class="n">seat</span><span class="p">,</span> <span class="n">quint32</span> <span class="n">serial</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">Q_UNUSED</span><span class="p">(</span><span class="n">serial</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">seat</span><span style="color: #aa2211">-></span><span class="n">setFocusedPointerSurface</span><span class="p">(</span><span class="n">surface</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="p">});</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">this needs to go through our PointerInputRedirection code, otherwise SeatInterface and PointerInputRedirection get out of sync. From my understanding that should be ::popupGrab?</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/D6591#inline-31727" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">shell_client.cpp:608-609</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; ">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_xdgShellSurface</span> <span style="color: #aa2211">&&</span> <span class="n">isCloseable</span><span class="p">())</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright"></span><span class="n"><span class="bright">m_xdgShellSurface</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">close</span></span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright"></span><span style="color: #aa4000"><span class="bright">return</span></span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_qtExtendedSurface</span> <span style="color: #aa2211">&&</span> <span class="n">isCloseable</span><span class="p">())</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span class="n"><span class="bright">qint32</span></span><span class="bright"> </span><span class="n"><span class="bright">pingSerial</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">static_cast</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright"><</span></span><span class="bright"></span><span class="n"><span class="bright">XdgShellInterface</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*></span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_xdgShellSurface</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">global</span></span><span class="bright"></span><span class="p"><span class="bright">())</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">ping</span></span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">m_pingSerials</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">insert</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">pingSerial</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">CloseWindow</span></span><span class="bright"></span><span class="p"><span class="bright">)</span>;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">else</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_qtExtendedSurface</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&&</span></span><span class="bright"> </span><span class="n"><span class="bright">isCloseable</span></span><span class="bright"></span><span class="p"><span class="bright">())</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">just wondering: isn't there a close() missing? It's only pinging...</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/D6591#inline-31728" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">shell_client.h:44</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; "><span style="color: #a0a000">public</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">enum</span> <span class="n">PingReason</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">CloseWindow</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">,</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">please use enum class for new enums.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D6591" rel="noreferrer">https://phabricator.kde.org/D6591</a></div></div><br /><div><strong>To: </strong>davidedmundson, Plasma, graesslin<br /><strong>Cc: </strong>graesslin, kwin, plasma-devel, KWin, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>