D26395: [XembedSNIProxy] Send all container windows to background on KWin restart

Konrad Materka noreply at phabricator.kde.org
Fri Jan 3 14:27:53 GMT 2020


kmaterka added a comment.


  This is another approach to fix 357443 <https://bugs.kde.org/show_bug.cgi?id=357443>. It is still a workaround, but more reliable and uses better concept.

INLINE COMMENTS

> fdoselectionmanager.cpp:167
> +        // workaround for BUG 357443: when KWin is restarted, container window is shown on top
> +        if (event->state == XCB_VISIBILITY_UNOBSCURED) {
> +            for (auto sniProxy : m_proxies.values()) {

XCB_VISIBILITY_UNOBSCURED is rare. During simulated click (when we stack window above) xembedsniproxy receives XCB_VISIBILITY_PARTIALLY_OBSCURED. Obviously we ignore the last possible case: XCB_VISIBILITY_FULLY_OBSCURED.

> fdoselectionmanager.cpp:168
> +        if (event->state == XCB_VISIBILITY_UNOBSCURED) {
> +            for (auto sniProxy : m_proxies.values()) {
> +                sniProxy->hideContainerWindow(event->window);

Iteration sucks, but this is the simplest (a in most cases the quickest) method. In this event we receive container window id, we can get its child and get sniproxy using it:

  xcb_connection_t *c = QX11Info::connection();
  xcb_query_tree_cookie_t cookie = xcb_query_tree(c, event->window);
  QScopedPointer<xcb_query_tree_reply_t, QScopedPointerPodDeleter>
      reply(xcb_query_tree_reply(c, cookie, nullptr));
  
  if (reply && xcb_query_tree_children_length(reply.data()) == 1) {
      xcb_window_t *children = xcb_query_tree_children(reply.data());
      const auto sniProxy = m_proxies.value(children[0]);
      if (sniProxy) {
          sniProxy->handleExposeEvent(event->window);
      }
  }

IMO this is slower.

The best would be to have second map like m_proxies, but with container windows id (or something similar in the idea).

> sniproxy.cpp:527
>      qCDebug(SNIPROXY) << "Received click" << mouseButton << "with passed x*y" << x << y;
> +    sendingClickEvent = true;
>  

During click, container window is showed for a brief moment (STACK_ABOVE), so it is possible that it will sent visibility event. This is probably not needed, I tested it and all events generated in this method (stack above, click, stack below) were processed before visibility event is received in XEmbedSNIProxy. I added this just in case - I'm not sure how X events are queued and how reliable the order is.

REPOSITORY
  R120 Plasma Workspace

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

To: kmaterka, #plasma_workspaces, #plasma, davidedmundson
Cc: plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200103/c129e28b/attachment-0001.html>


More information about the Plasma-devel mailing list