~azzar1/unity/fix-trash-li-blocking

« back to all changes in this revision

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

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
nux::logging::Logger logger("unity.plugin");
30
30
 
 
31
const int THRESHOLD_HEIGHT = 600;
 
32
const int THRESHOLD_WIDTH = 1024;
 
33
 
31
34
}
32
35
 
33
36
PluginAdapter* PluginAdapter::_default = 0;
569
572
}
570
573
 
571
574
void 
572
 
PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility)
 
575
PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor)
573
576
{
574
577
  CompPoint target_vp = m_Screen->vp();
575
 
  CompWindow* top_win = NULL;
 
578
  CompWindow* top_window = NULL;
 
579
  CompWindow* top_window_on_monitor = NULL;
576
580
  bool any_on_current = false;
577
581
  bool any_mapped = false;
 
582
  bool any_mapped_on_current = false;
578
583
  bool forced_unminimize = false;
579
584
 
580
585
  /* sort the list */
592
597
    if (win->defaultViewport() == m_Screen->vp())
593
598
    {
594
599
      any_on_current = true;
 
600
 
 
601
      if (!win->minimized())
 
602
      {
 
603
        any_mapped_on_current = true;
 
604
      }
595
605
    }
596
606
 
597
607
    if (!win->minimized())
629
639
             win->mapNum () == 0))
630
640
       {
631
641
         bool is_mapped = win->mapNum () != 0;
632
 
         top_win = win;
 
642
         top_window = win;
 
643
         if (monitor >= 0 && win->outputDevice() == monitor)
 
644
          top_window_on_monitor = win;
633
645
         win->unminimize ();
634
646
 
635
647
         forced_unminimize = true;
638
650
         if (!is_mapped)
639
651
           win->raise ();
640
652
       }
641
 
       else if ((any_mapped && !win->minimized()) || !any_mapped)
 
653
       else if ((any_mapped_on_current && !win->minimized()) || !any_mapped_on_current)
642
654
       {
643
655
         if (!forced_unminimize || target_vp == m_Screen->vp())
644
656
         {
645
657
           win->raise();
646
 
           top_win = win;
 
658
           top_window = win;
 
659
           if (monitor >= 0 && win->outputDevice() == monitor)
 
660
            top_window_on_monitor = win;
647
661
         }
648
662
       }
649
663
    }
650
664
  }
651
665
 
652
 
  if (top_win)
653
 
    top_win->activate();
 
666
  if (monitor > 0 && top_window_on_monitor)
 
667
    top_window_on_monitor->activate();
 
668
  else if (top_window)
 
669
    top_window->activate();
654
670
}
655
671
 
656
672
bool 
923
939
 
924
940
  screen_height = o.workArea().height();
925
941
  screen_width = o.workArea().width();
 
942
  
 
943
  // See bug https://bugs.launchpad.net/unity/+bug/797808
 
944
  if (screen_height * screen_width > THRESHOLD_HEIGHT * THRESHOLD_WIDTH)
 
945
    return false;
926
946
 
927
947
  // use server<parameter> because the window won't show the real parameter as
928
948
  // not mapped yet