<table><tr><td style="">broulik added a comment.
</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/D27959">View Revision</a></tr></table><br /><div><div><p>I think you should cache the X props, otherwise every <tt style="background: #ebebeb; font-size: 13px;">data</tt> access causes a round trip to the X server.</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/D27959#inline-159230">View Inline</a><span style="color: #4b4d51; font-weight: bold;">xwindowtasksmodel.cpp:472</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 style="color: #aa4000">static</span> <span style="color: #aa4000">const</span> <span class="n">QByteArray</span> <span class="n">s_x11AppMenuServiceNamePropertyName</span> <span style="color: #aa2211">=</span> <span class="n">QByteArrayLiteral</span><span class="p">(</span><span style="color: #766510">"_KDE_NET_WM_APPMENU_SERVICE_NAME"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">static</span> <span style="color: #aa4000">const</span> <span class="n">QByteArray</span> <span class="n">s_x11AppMenuObjectPathPropertyName</span> <span style="color: #aa2211">=</span> <span class="n">QByteArrayLiteral</span><span class="p">(</span><span style="color: #766510">"_KDE_NET_WM_APPMENU_OBJECT_PATH"</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We generally want to avoid global statics in library code. In the applet it's fine because it's a plugin that is loaded on demand</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/D27959#inline-159234">View Inline</a><span style="color: #4b4d51; font-weight: bold;">xwindowtasksmodel.cpp:475</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 style="color: #304a96">#if HAVE_X11</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">static</span> <span class="n">QHash</span><span style="color: #aa2211"><</span><span class="n">QByteArray</span><span class="p">,</span> <span class="n">xcb_atom_t</span><span style="color: #aa2211">></span> <span class="n">s_atoms</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Is this check needed? I would think <tt style="background: #ebebeb; font-size: 13px;">xwindowtasksmodel</tt> is guarded in its entirety both compile-time and run-time.</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/D27959#inline-159231">View Inline</a><span style="color: #4b4d51; font-weight: bold;">xwindowtasksmodel.cpp:486</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">QByteArray</span> <span class="n">value</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 style="color: #aa2211">!</span><span class="n">s_atoms</span><span class="p">.</span><span class="n">contains</span><span class="p">(</span><span class="n">name</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">const</span> <span class="n">xcb_intern_atom_cookie_t</span> <span class="n">atomCookie</span> <span style="color: #aa2211">=</span> <span class="n">xcb_intern_atom</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span style="color: #304a96">false</span><span class="p">,</span> <span class="n">name</span><span class="p">.</span><span class="n">length</span><span class="p">(),</span> <span class="n">name</span><span class="p">.</span><span class="n">constData</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Avoid double look-up, use iterator</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/D27959#inline-159232">View Inline</a><span style="color: #4b4d51; font-weight: bold;">xwindowtasksmodel.cpp:494</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">s_atoms</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span style="color: #aa2211">=</span> <span class="n">atomReply</span><span style="color: #aa2211">-></span><span class="n">atom</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">s_atoms</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span style="color: #aa2211">==</span> <span class="n">XCB_ATOM_NONE</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">return</span> <span class="n">value</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Avoid double hash look-up. Store atom in variable and check 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/D27959#inline-159233">View Inline</a><span style="color: #4b4d51; font-weight: bold;">xwindowtasksmodel.cpp:523</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="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">return</span> <span class="n">qMakePair</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">""</span><span class="p">),</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">""</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;">Use null <tt style="background: #ebebeb; font-size: 13px;">QString()</tt></p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27959">https://phabricator.kde.org/D27959</a></div></div><br /><div><strong>To: </strong>cblack, Plasma<br /><strong>Cc: </strong>broulik, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>