[Differential] [Changed Subscribers] D3086: RFC: Clean up KAppMenu

graesslin (Martin Gräßlin) noreply at phabricator.kde.org
Fri Oct 28 14:11:48 UTC 2016


graesslin added inline comments.

INLINE COMMENTS

> appmenu.cpp:88-89
> +        auto setWindowProperty = [c](WId id, const QByteArray &name, const QByteArray &value) {
> +            const xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, false, name.length(), name.constData());
> +            QScopedPointer<xcb_intern_atom_reply_t, QScopedPointerPodDeleter> reply(xcb_intern_atom_reply(c, cookie, Q_NULLPTR));
> +            if (!reply.isNull()) {

This causes a roundtrip every time it gets invoked. I suggest to cache the returned atom. You can just do something like:

  xcb_atom_t myAtom = XCB_ATOM_NONE;
  if(myAtom == XCB_ATOM_NONE) {
      // cookie-reply-dance
      myAtom = reply->atom;
  }
  if (myAtom == XCB_ATOM_NONE) {
      // whoops something failed with fetching the atom
      return;
  }
  xcb_change_property(....)

REPOSITORY
  rPLASMAWORKSPACE Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D3086

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: broulik, #plasma, mart
Cc: graesslin, plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20161028/cbc2aa0a/attachment.html>


More information about the Plasma-devel mailing list