From 48d95e9cdeca7183eae5013e4b9dabbc25c09cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirco=20M=C3=BCller?= Date: Mon, 12 Dec 2011 11:43:36 +0100 Subject: Fix left-, right-, top- and bottom-padding in Quicklists... also for edge-case with one-item Quicklist (e.g. Trashcan-Quicklist) (bzr r1773.1.1) --- plugins/unityshell/src/QuicklistView.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp index b7213f42f..3c884f7bc 100644 --- a/plugins/unityshell/src/QuicklistView.cpp +++ b/plugins/unityshell/src/QuicklistView.cpp @@ -74,8 +74,8 @@ QuicklistView::QuicklistView() { 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 - 1, + _padding + _anchor_width + _corner_radius - 1, 1, 1000); _right_space = new nux::SpaceLayout(_padding + _corner_radius, _padding + _corner_radius, @@ -533,12 +533,12 @@ 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 - 4); } 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 - 2); } _item_layout->SetMinimumWidth(MaxItemWidth); @@ -553,8 +553,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 - 1; + int y = _padding + _corner_radius - 1; std::list::iterator it; for (it = _item_list.begin(); it != _item_list.end(); it++) -- cgit v1.2.3 From 4cecc9e5568434e020eb3f37a217492a90ddd9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirco=20M=C3=BCller?= Date: Mon, 12 Dec 2011 13:11:28 +0100 Subject: After much discussion and ping-ponging screenshots with Design (Rosie) this is the tint-opacity-value that should be used (bzr r1773.1.2) --- plugins/unityshell/src/QuicklistView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp index 3c884f7bc..6d1906c89 100644 --- a/plugins/unityshell/src/QuicklistView.cpp +++ b/plugins/unityshell/src/QuicklistView.cpp @@ -1354,7 +1354,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}; -- cgit v1.2.3 From 4cb697c733181a498d57adf322533e9c91812757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirco=20M=C3=BCller?= Date: Tue, 13 Dec 2011 13:00:55 +0100 Subject: use self-explanatory variable-names instead of magic numbers (bzr r1773.1.3) --- plugins/unityshell/src/QuicklistView.cpp | 26 ++++++++++++++++++++------ plugins/unityshell/src/QuicklistView.h | 4 ++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp index 6d1906c89..8165aa5ef 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 - 1, - _padding + _anchor_width + _corner_radius - 1, + _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 - 4); + _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 - 2, _padding + _corner_radius - 2); + _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 - 1; - int y = _padding + _corner_radius - 1; + int x = _padding + _anchor_width + _corner_radius + _offset_correction; + int y = _padding + _corner_radius + _offset_correction; std::list::iterator it; for (it = _item_list.begin(); it != _item_list.end(); it++) diff --git a/plugins/unityshell/src/QuicklistView.h b/plugins/unityshell/src/QuicklistView.h index ebdd9b2db..f2acaf2e4 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; -- cgit v1.2.3 From 90d5558fa3d6093695d3b79490a68241bfc51a33 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Thu, 15 Dec 2011 15:08:41 +0800 Subject: Inhibit other windows from leaving show desktop mode in the case that core tries to leave show desktop mode after a window was activated - in this case we should only allow the window that was activated to leave show desktop mode and keep the "show desktop" mode state on until the user explicitly leave s show desktop mode. Fixes LP #871801 and LP #899932 Fixes LP: #871801 (bzr r1781.1.1) --- plugins/unityshell/src/unityshell.cpp | 64 ++++++++++++++++++++++++++++++----- plugins/unityshell/src/unityshell.h | 5 +++ 2 files changed, 60 insertions(+), 9 deletions(-) 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); -- cgit v1.2.3 From 86dca5945f5269db3bae8621d252620b7eaa60fb Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Thu, 15 Dec 2011 15:12:39 +0800 Subject: Added manual test (bzr r1781.1.2) --- manual-tests/Showdesktop.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 manual-tests/Showdesktop.txt 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. -- cgit v1.2.3