diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-12-16 00:56:12 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-12-16 00:56:12 +0100 |
| commit | dcf9766b5a3dd6bb0ada6a2c20fd36f0c03cea6a (patch) | |
| tree | 431c4ae6e003cc5cd55c60564ac97bdf4d3e79ae | |
| parent | ac5607a4aa643539d05ea2bcaac0c4a633af2caa (diff) | |
| parent | d3d35c01e31b13afd18519cf9c088c94e68c9ee0 (diff) | |
(bzr r1781.2.4)
| -rw-r--r-- | manual-tests/Showdesktop.txt | 15 | ||||
| -rw-r--r-- | plugins/unityshell/src/QuicklistView.cpp | 28 | ||||
| -rw-r--r-- | plugins/unityshell/src/QuicklistView.h | 4 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 64 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 5 |
5 files changed, 100 insertions, 16 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/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp index 261234daf..398cc1276 100644 --- a/plugins/unityshell/src/QuicklistView.cpp +++ b/plugins/unityshell/src/QuicklistView.cpp @@ -68,14 +68,24 @@ QuicklistView::QuicklistView() , _anchor_height(18) , _corner_radius(4) , _padding(13) + , _left_padding_correction(-1) + , _bottom_padding_correction_normal(-2) + , _bottom_padding_correction_single_item(-4) + , _offset_correction(-1) , _cairo_text_has_changed(true) , _compute_blur_bkg(true) , _current_item_index(0) { SetGeometry(nux::Geometry(0, 0, 1, 1)); - _left_space = new nux::SpaceLayout(_padding + _anchor_width + _corner_radius, - _padding + _anchor_width + _corner_radius, + _left_space = new nux::SpaceLayout(_padding + + _anchor_width + + _corner_radius + + _left_padding_correction, + _padding + + _anchor_width + + _corner_radius + + _left_padding_correction, 1, 1000); _right_space = new nux::SpaceLayout(_padding + _corner_radius, _padding + _corner_radius, @@ -533,12 +543,16 @@ void QuicklistView::PreLayoutManagement() if (TotalItemHeight < _anchor_height) { _top_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 + _padding + _corner_radius); - _bottom_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 + _padding + _corner_radius); + _bottom_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 + + _padding + _corner_radius + + _bottom_padding_correction_single_item); } else { _top_space->SetMinMaxSize(_padding + _corner_radius, _padding + _corner_radius); - _bottom_space->SetMinMaxSize(_padding + _corner_radius, _padding + _corner_radius); + _bottom_space->SetMinMaxSize(_padding + _corner_radius - 2, + _padding + _corner_radius + + _bottom_padding_correction_normal); } _item_layout->SetMinimumWidth(MaxItemWidth); @@ -553,8 +567,8 @@ long QuicklistView::PostLayoutManagement(long LayoutResult) UpdateTexture(); - int x = _padding + _anchor_width + _corner_radius; - int y = _padding + _corner_radius; + int x = _padding + _anchor_width + _corner_radius + _offset_correction; + int y = _padding + _corner_radius + _offset_correction; std::list<QuicklistMenuItem*>::iterator it; for (it = _item_list.begin(); it != _item_list.end(); it++) @@ -1354,7 +1368,7 @@ void QuicklistView::UpdateTexture() cairo_t* cr_mask = cairo_mask->GetContext(); cairo_t* cr_outline = cairo_outline->GetContext(); - float tint_color[4] = {0.0f, 0.0f, 0.0f, 0.80f}; + float tint_color[4] = {0.0f, 0.0f, 0.0f, 0.60f}; float hl_color[4] = {1.0f, 1.0f, 1.0f, 0.65f}; float dot_color[4] = {1.0f, 1.0f, 1.0f, 0.10f}; float shadow_color[4] = {0.0f, 0.0f, 0.0f, 1.00f}; diff --git a/plugins/unityshell/src/QuicklistView.h b/plugins/unityshell/src/QuicklistView.h index a9a74158a..f26d419af 100644 --- a/plugins/unityshell/src/QuicklistView.h +++ b/plugins/unityshell/src/QuicklistView.h @@ -166,6 +166,10 @@ private: float _anchor_height; float _corner_radius; float _padding; + float _left_padding_correction; + float _bottom_padding_correction_normal; + float _bottom_padding_correction_single_item; + float _offset_correction; nux::HLayout* _hlayout; nux::VLayout* _vlayout; nux::VLayout* _item_layout; 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); |
