~3v1n0/unity/missing-launcher-icon-fix-5.0

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/PluginAdapter.cpp

BamfLauncherIcon: Focus an application if no child window is actually on top of the stack. Raises all urgent windows.

This fixes bug #802816 that happens when an application raises a window on the top of the stack but the focus doesn't change.

Plus, don't perform unneeded checks when focusing non-active applications.. Fixes: https://bugs.launchpad.net/bugs/802816, https://bugs.launchpad.net/bugs/986443. Approved by Tim Penhey.

Show diffs side-by-side

added added

removed removed

Lines of Context:
530
530
}
531
531
 
532
532
bool
 
533
PluginAdapter::IsWindowOnTop(guint32 xid)
 
534
{
 
535
  Window win = xid;
 
536
  CompWindow* window;
 
537
 
 
538
  window = m_Screen->findWindow(win);
 
539
 
 
540
  if (window)
 
541
  {
 
542
    if (window->inShowDesktopMode() || !window->isMapped() || !window->isViewable() || window->minimized())
 
543
      return false;
 
544
 
 
545
    CompPoint window_vp = window->defaultViewport();
 
546
    std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList();
 
547
 
 
548
    for (CompWindow* sibling = window->next; sibling; sibling = sibling->next)
 
549
    {
 
550
      if (sibling->defaultViewport() == window_vp && !sibling->minimized() &&
 
551
          sibling->isMapped() && sibling->isViewable() && !sibling->inShowDesktopMode() &&
 
552
          !(sibling->state() & CompWindowStateAboveMask) &&
 
553
          std::find(our_xids.begin(), our_xids.end(), sibling->id()) == our_xids.end())
 
554
      {
 
555
        return false;
 
556
      }
 
557
    }
 
558
 
 
559
    return true;
 
560
  }
 
561
 
 
562
  return false;
 
563
}
 
564
 
 
565
bool
533
566
PluginAdapter::IsWindowClosable(guint32 xid)
534
567
{
535
568
  Window win = xid;