diff options
| -rw-r--r-- | manual-tests/Showdesktop.txt | 15 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 64 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 5 |
3 files changed, 75 insertions, 9 deletions
diff --git a/manual-tests/Showdesktop.txt b/manual-tests/Showdesktop.txt new file mode 100644 index 000000000..e06ca4704 --- /dev/null +++ b/manual-tests/Showdesktop.txt @@ -0,0 +1,15 @@ +Test Showdesktop Mode +------------------- +This test shows that the "show desktop" mode works correctly + +#. Open two applications +#. Use either alt-tab or ctrl-alt-d to activate "show desktop" mode +#. Use either alt-tab or ctrl-alt-d to deactivate "show desktop" mode +#. Use either alt-tab or ctrl-alt-d to activate "show desktop" mode +#. Select an active application from the launcher +#. Use either alt-tab or ctrl-alt-d to deactivate "show desktop" mode + +Outcome + Both windows will fade out, both windows will fade in, both windows + will fade out, the clicked application will fade in only, all other + windows will fade in. diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 9324a9ced..03e17fef2 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -715,20 +715,37 @@ void UnityScreen::enterShowDesktopMode () void UnityScreen::leaveShowDesktopMode (CompWindow *w) { - for (CompWindow *cw : screen->windows ()) + /* Where a window is inhibiting, only allow the window + * that is inhibiting the leave show desktop to actually + * fade in again - all other windows should remain faded out */ + if (!UnityShowdesktopHandler::inhibitingXid ()) { - if (cw->inShowDesktopMode ()) + for (CompWindow *cw : screen->windows ()) { - UnityWindow::get (cw)->leaveShowDesktop (); - // the animation plugin does strange things here ... - // if this notification is sent - //cw->windowNotify (CompWindowNotifyLeaveShowDesktopMode); + if (cw->inShowDesktopMode ()) + { + UnityWindow::get (cw)->leaveShowDesktop (); + // the animation plugin does strange things here ... + // if this notification is sent + //cw->windowNotify (CompWindowNotifyLeaveShowDesktopMode); + } } - } - PluginAdapter::Default()->OnLeaveDesktop(); + PluginAdapter::Default()->OnLeaveDesktop(); - screen->leaveShowDesktopMode (w); + screen->leaveShowDesktopMode (w); + } + else + { + CompWindow *cw = screen->findWindow (UnityShowdesktopHandler::inhibitingXid ()); + if (cw) + { + if (cw->inShowDesktopMode ()) + { + UnityWindow::get (cw)->leaveShowDesktop (); + } + } + } } void UnityWindow::enterShowDesktop () @@ -751,6 +768,13 @@ void UnityWindow::leaveShowDesktop () } } +void UnityWindow::activate () +{ + UnityShowdesktopHandler::inhibitLeaveShowdesktopMode (window->id ()); + window->activate (); + UnityShowdesktopHandler::allowLeaveShowdesktopMode (window->id ()); +} + bool UnityWindow::handleAnimations (unsigned int ms) { if (mShowdesktopHandler) @@ -794,6 +818,28 @@ bool UnityShowdesktopHandler::shouldHide (CompWindow *w) return true; } +guint32 UnityShowdesktopHandler::mInhibitingXid = 0; + +void +UnityShowdesktopHandler::inhibitLeaveShowdesktopMode (guint32 xid) +{ + if (!mInhibitingXid) + mInhibitingXid = xid; +} + +void +UnityShowdesktopHandler::allowLeaveShowdesktopMode (guint32 xid) +{ + if (mInhibitingXid == xid) + mInhibitingXid = 0; +} + +guint32 +UnityShowdesktopHandler::inhibitingXid () +{ + return mInhibitingXid; +} + UnityShowdesktopHandler::UnityShowdesktopHandler (CompWindow *w) : mWindow (w), mRemover (new compiz::WindowInputRemover (screen->dpy (), w->id ())), diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 86be0c4cd..d852caf6c 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -115,6 +115,9 @@ public: static const unsigned int fade_time; static CompWindowList animating_windows; static bool shouldHide (CompWindow *); + static void inhibitLeaveShowdesktopMode (guint32 xid); + static void allowLeaveShowdesktopMode (guint32 xid); + static guint32 inhibitingXid (); private: @@ -123,6 +126,7 @@ private: UnityShowdesktopHandler::State mState; float mProgress; bool mWasHidden; + static guint32 mInhibitingXid; }; @@ -350,6 +354,7 @@ public: void unminimize (); bool minimized (); bool focus (); + void activate (); void updateFrameRegion (CompRegion ®ion); |
