~unity-team/unity/trunk

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Brandon Schaefer
  • Date: 2013-07-12 16:06:39 UTC
  • mfrom: (3377.2.4 show-desktop-fix)
  • Revision ID: tarmac-20130712160639-ozeg4qp20dp97ms3
Show desktop now only works for individual workspaces. Also if any new windows are opened, or one is restored on that workspace then the next Show desktop will minimize those. The only time windows are restored are when no new windows have been mapped, and no windows have been restored for that workspace only. Fixes: https://bugs.launchpad.net/bugs/966030.

Approved by PS Jenkins bot, Christopher Townsend, Marco Trevisan (Treviño).

Show diffs side-by-side

added added

removed removed

Lines of Context:
858
858
{
859
859
  for (CompWindow *w : screen->windows ())
860
860
  {
 
861
    CompPoint const& viewport = w->defaultViewport();
861
862
    UnityWindow *uw = UnityWindow::get (w);
862
863
 
863
 
    if (ShowdesktopHandler::ShouldHide (static_cast <ShowdesktopHandlerWindowInterface *> (uw)))
 
864
    if (viewport == uScreen->screen->vp() &&
 
865
        ShowdesktopHandler::ShouldHide (static_cast <ShowdesktopHandlerWindowInterface *> (uw)))
864
866
    {
865
867
      UnityWindow::get (w)->enterShowDesktop ();
866
868
      // the animation plugin does strange things here ...
901
903
  {
902
904
    for (CompWindow *cw : screen->windows ())
903
905
    {
904
 
      if (cw->inShowDesktopMode ())
 
906
      CompPoint const& viewport = cw->defaultViewport();
 
907
 
 
908
      if (viewport == uScreen->screen->vp() &&
 
909
          cw->inShowDesktopMode ())
905
910
      {
906
911
        UnityWindow::get (cw)->leaveShowDesktop ();
907
912
        // the animation plugin does strange things here ...
912
917
 
913
918
    PluginAdapter::Default().OnLeaveDesktop();
914
919
 
915
 
    screen->leaveShowDesktopMode (w);
 
920
    if (w)
 
921
    {
 
922
      CompPoint const& viewport = w->defaultViewport();
 
923
 
 
924
      if (viewport == uScreen->screen->vp())
 
925
        screen->leaveShowDesktopMode (w);
 
926
    }
 
927
    else
 
928
    {
 
929
      screen->focusDefaultWindow();
 
930
    }
916
931
  }
917
932
  else
918
933
  {
997
1012
  ShowdesktopHandler::InhibitLeaveShowdesktopMode (window->id ());
998
1013
  window->activate ();
999
1014
  ShowdesktopHandler::AllowLeaveShowdesktopMode (window->id ());
 
1015
 
 
1016
  PluginAdapter::Default().OnLeaveDesktop();
1000
1017
}
1001
1018
 
1002
1019
void UnityWindow::DoEnableFocus ()
2825
2842
        window->unminimizeSetEnabled (this, false);
2826
2843
        window->minimizedSetEnabled (this, false);
2827
2844
      }
 
2845
 
 
2846
      PluginAdapter::Default().UpdateShowDesktopState();
2828
2847
        break;
2829
2848
      case CompWindowNotifyBeforeDestroy:
2830
2849
        being_destroyed.emit();
3439
3458
  GLWindowInterface::setHandler(gWindow);
3440
3459
  ScaleWindowInterface::setHandler (ScaleWindow::get (window));
3441
3460
 
 
3461
  PluginAdapter::Default().OnLeaveDesktop();
 
3462
 
3442
3463
  /* This needs to happen before we set our wrapable functions, since we
3443
3464
   * need to ask core (and not ourselves) whether or not the window is
3444
3465
   * minimized */