summaryrefslogtreecommitdiff
diff options
authorJay Taoko <jay.taoko@canonical.com>2012-09-16 13:39:42 +0100
committerJay Taoko <jay.taoko@canonical.com>2012-09-16 13:39:42 +0100
commit657934babaf1adc53bfeedd64267e85146dc5fd2 (patch)
tree720a15d10d1c22ced0885c328cc5a32bbfdbf04d
parent4a9aac9949725f5258da562c696b93b4f02ba0be (diff)
parentf09e61877be4b82ed009484a70714e8775bc8307 (diff)
* Merge with Unity trunk
(bzr r2696.3.1)
-rwxr-xr-xdash/CoverflowResultView.cpp18
-rw-r--r--dash/DashView.cpp579
-rw-r--r--dash/DashView.h27
-rw-r--r--dash/FilterAllButton.cpp4
-rw-r--r--dash/FilterBar.cpp15
-rw-r--r--dash/FilterBasicButton.cpp31
-rw-r--r--dash/FilterBasicButton.h2
-rw-r--r--dash/FilterExpanderLabel.cpp55
-rw-r--r--dash/FilterMultiRangeButton.cpp7
-rw-r--r--dash/FilterRatingsButton.cpp7
-rw-r--r--dash/LensBar.cpp46
-rw-r--r--dash/LensBarIcon.cpp14
-rwxr-xr-xdash/LensView.cpp6
-rwxr-xr-xdash/PlacesGroup.cpp13
-rw-r--r--dash/ResultViewGrid.cpp69
-rw-r--r--dash/ResultViewGrid.h2
-rw-r--r--dash/previews/PreviewContainer.cpp4
-rw-r--r--plugins/unityshell/src/unityshell.cpp8
-rw-r--r--plugins/unityshell/src/unityshell.h6
-rwxr-xr-xunity-shared/DashStyle.h2
-rw-r--r--unity-shared/PlacesVScrollBar.cpp25
-rw-r--r--unity-shared/SearchBar.cpp75
-rw-r--r--unity-shared/UBusMessages.h2
23 files changed, 915 insertions, 102 deletions
diff --git a/dash/CoverflowResultView.cpp b/dash/CoverflowResultView.cpp
index 8d40cb00b..47b496447 100755
--- a/dash/CoverflowResultView.cpp
+++ b/dash/CoverflowResultView.cpp
@@ -133,7 +133,7 @@ void CoverflowResultItem::Activate(int button)
int size = model_->Items().size();
ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD,
- g_variant_new("(iii)", 0, index, size - index));
+ g_variant_new("(iiii)", 0, 0, index, size - index));
}
CoverflowResultView::Impl::Impl(CoverflowResultView *parent)
@@ -191,7 +191,7 @@ CoverflowResultView::Impl::Impl(CoverflowResultView *parent)
int right_results = num_results ? (num_results - current_index) - 1 : 0;
parent_->UriActivated.emit(GetUriForIndex(current_index), ActivateType::PREVIEW);
ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD,
- g_variant_new("(iii)", 0, left_results, right_results));
+ g_variant_new("(iiii)", 0, 0, left_results, right_results));
}
});
}
@@ -267,6 +267,20 @@ void CoverflowResultView::DrawContent(nux::GraphicsEngine& GfxContext, bool forc
nux::Geometry base = GetGeometry();
GfxContext.PushClippingRectangle(base);
+ if (RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering. Clean the area below this view.
+ unsigned int current_alpha_blend;
+ unsigned int current_src_blend_factor;
+ unsigned int current_dest_blend_factor;
+ GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ GfxContext.GetRenderStates().SetBlend(false);
+ GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+
+ GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+ }
+
if (GetCompositionLayout())
{
nux::Geometry geo = GetCompositionLayout()->GetGeometry();
diff --git a/dash/DashView.cpp b/dash/DashView.cpp
index 2f48005a8..fa8a43477 100644
--- a/dash/DashView.cpp
+++ b/dash/DashView.cpp
@@ -16,6 +16,7 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
+
#include "DashView.h"
#include "DashViewPrivate.h"
@@ -36,6 +37,7 @@
#include "unity-shared/UBusMessages.h"
#include "unity-shared/PreviewStyle.h"
+#include "Nux/NuxTimerTickSource.h"
namespace unity
{
@@ -89,7 +91,14 @@ DashView::DashView()
, search_in_progress_(false)
, activate_on_finish_(false)
, visible_(false)
+ , fade_out_value_(0.0f)
+ , fade_in_value_(0.0f)
+ , opening_row_y_(0)
+ , opening_row_height_(0)
{
+ //tick_source_.reset(new nux::NuxTimerTickSource);
+ //animation_controller_.reset(new na::AnimationController(*tick_source_));
+
renderer_.SetOwner(this);
renderer_.need_redraw.connect([this] () {
QueueDraw();
@@ -107,6 +116,8 @@ DashView::DashView()
home_lens_->AddLenses(lenses_);
home_lens_->search_finished.connect(sigc::mem_fun(this, &DashView::OnGlobalSearchFinished));
lens_bar_->Activate("home.lens");
+
+ bghash_.RefreshColor();
}
DashView::~DashView()
@@ -124,25 +135,95 @@ void DashView::SetMonitorOffset(int x, int y)
void DashView::ClosePreview()
{
+ if (preview_displaying_)
+ {
+ layout_->SetPresentRedirectedView(true);
+ animation_.Stop();
+ fade_out_connection_.disconnect();
+ fade_in_connection_.disconnect();
+ // Set fade animation
+ animation_.SetDuration(250);
+ animation_.SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::ExpoEaseIn));
+ fade_in_connection_ = animation_.updated.connect(sigc::mem_fun(this, &DashView::FadeInCallBack));
+
+ fade_in_value_ = 1.0f;
+ animation_.SetStartValue(fade_in_value_);
+ animation_.SetFinishValue(0.0f);
+ animation_.Start();
+ }
+
preview_displaying_ = false;
- // sanity check
- if (!preview_container_)
- return;
- RemoveChild(preview_container_.GetPointer());
- preview_container_->UnParentObject();
- preview_container_.Release(); // free resources
- preview_state_machine_.ClosePreview();
+ // // sanity check
+ // if (!preview_container_)
+ // return;
+ // RemoveChild(preview_container_.GetPointer());
+ // preview_container_->UnParentObject();
+ // preview_container_.Release(); // free resources
+ // preview_state_machine_.ClosePreview();
// re-focus dash view component.
nux::GetWindowCompositor().SetKeyFocusArea(default_focus());
QueueDraw();
}
+void DashView::FadeOutCallBack(float const& fade_out_value)
+{
+ fade_out_value_ = fade_out_value;
+ QueueDraw();
+}
+
+void DashView::FadeInCallBack(float const& fade_in_value)
+{
+ fade_in_value_ = fade_in_value;
+ QueueDraw();
+
+ if (fade_in_value_ == 0.0f)
+ {
+ // sanity check
+ if (!preview_container_)
+ {
+ return;
+ }
+ RemoveChild(preview_container_.GetPointer());
+ preview_container_->UnParentObject();
+ preview_container_.Release(); // free resources
+ preview_state_machine_.ClosePreview();
+ }
+}
+
void DashView::BuildPreview(Preview::Ptr model)
{
if (!preview_displaying_)
{
+ // Make a copy of this DashView backup texture.
+ if (layout_->RedirectRenderingToTexture())
+ {
+ nux::TexCoordXForm texxform;
+ nux::ObjectPtr<nux::IOpenGLBaseTexture> src_texture;
+
+ layout_copy_ = src_texture = layout_->BackupTexture();
+ // nux::GetGraphicsDisplay()->GetGraphicsEngine()->QRP_GetCopyTexture(
+ // src_texture->GetWidth(), src_texture->GetHeight(),
+ // layout_copy_, src_texture,
+ // texxform, nux::color::White);
+
+ animation_.Stop();
+ fade_out_connection_.disconnect();
+ fade_in_connection_.disconnect();
+ // Set fade animation
+ animation_.SetDuration(250);
+ animation_.SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::ExpoEaseIn));
+ fade_out_connection_ = animation_.updated.connect(sigc::mem_fun(this, &DashView::FadeOutCallBack));
+
+ fade_out_value_ = 1.0f;
+ animation_.SetStartValue(fade_out_value_);
+ animation_.SetFinishValue(0.0f);
+ animation_.Start();
+
+ layout_->SetPresentRedirectedView(false);
+ }
+
preview_container_ = previews::PreviewContainer::Ptr(new previews::PreviewContainer());
AddChild(preview_container_.GetPointer());
preview_container_->Preview(model, previews::Navigation::NONE); // no swipe left or right
@@ -173,6 +254,9 @@ void DashView::BuildPreview(Preview::Ptr model)
preview_container_->request_close.connect([&] () { ClosePreview(); });
nux::GetWindowCompositor().SetKeyFocusArea(preview_container_.GetPointer());
+
+ // preview_container_->SetRedirectRenderingToTexture(true);
+ // preview_container_->SetPresentRedirectedView(false);
}
else
{
@@ -263,6 +347,8 @@ void DashView::SetupViews()
layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0);
layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0);
SetLayout(layout_);
+ layout_->SetRedirectRenderingToTexture(true);
+ //layout_->SetCopyPreviousFboTexture(false);
content_layout_ = new DashLayout(NUX_TRACKER_LOCATION);
content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0);
@@ -312,12 +398,16 @@ void DashView::SetupUBusConnections()
ubus_manager_.RegisterInterest(UBUS_DASH_PREVIEW_INFO_PAYLOAD, [&] (GVariant *data)
{
int position = -1;
+ int row_height = 0;
int results_to_the_left = 0;
int results_to_the_right = 0;
- g_variant_get(data, "(iii)", &position, &results_to_the_left, &results_to_the_right);
+ g_variant_get(data, "(iiii)", &position, &row_height, &results_to_the_left, &results_to_the_right);
preview_state_machine_.SetSplitPosition(SplitPosition::CONTENT_AREA, position);
preview_state_machine_.left_results = results_to_the_left;
preview_state_machine_.right_results = results_to_the_right;
+
+ opening_row_y_ = position;
+ opening_row_height_ = row_height;
});
}
@@ -396,27 +486,484 @@ nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo)
return nux::Geometry(0, 0, width, height);
}
-void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
+void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
- renderer_.DrawFull(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry());
+ renderer_.DrawFull(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry());
+
+ // we only do this because the previews don't redraw correctly right now, so we have to force
+ // a full redraw every frame. performance sucks but we'll fix it post FF
+
+ // float ghost_opacity = 0.25f;
+ // if (preview_displaying_ && layout_ && layout_->RedirectRenderingToTexture())
+ // {
+ // if (layout_copy_.IsValid())
+ // {
+ // graphics_engine.PushClippingRectangle(layout_->GetGeometry());
+ // graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ // nux::TexCoordXForm texxform;
+
+ // texxform.FlipVCoord(true);
+
+ // // texxform.uoffset = (search_bar_layout_->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // // texxform.voffset = (search_bar_layout_->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // // graphics_engine.QRP_1Tex(
+ // // search_bar_layout_->GetX(),
+ // // search_bar_layout_->GetY() - (1-fade_out_value_)*(search_bar_layout_->GetHeight() + 10),
+ // // search_bar_layout_->GetWidth(),
+ // // search_bar_layout_->GetHeight(),
+ // // layout_copy_, texxform,
+ // // nux::Color(fade_out_value_, fade_out_value_, fade_out_value_, fade_out_value_)
+ // // );
+
+ // int filter_width = 10;
+ // if (active_lens_view_ && active_lens_view_->filters_expanded)
+ // {
+ // texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // graphics_engine.QRP_1Tex(
+ // active_lens_view_->filter_bar()->GetX() + (1.0f - fade_out_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10),
+ // active_lens_view_->filter_bar()->GetY(),
+ // active_lens_view_->filter_bar()->GetWidth(),
+ // active_lens_view_->filter_bar()->GetHeight(),
+ // layout_copy_, texxform,
+ // nux::Color(fade_out_value_, fade_out_value_, fade_out_value_, fade_out_value_)
+ // );
+ // filter_width += active_lens_view_->filter_bar()->GetWidth();
+ // }
+
+ // // Ghost row of items above the preview
+ // {
+ // int final_x = layout_->GetX();
+ // int final_y = layout_->GetY() - (opening_row_y_);
+
+ // texxform.uoffset = 0.0f;
+ // texxform.voffset = 0.0f;
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // float opacity = fade_out_value_ < ghost_opacity ? ghost_opacity : fade_out_value_;
+
+ // graphics_engine.QRP_1Tex(
+ // fade_out_value_ * layout_->GetX() + (1.0f - fade_out_value_) * final_x,
+ // fade_out_value_ * layout_->GetY() + (1.0f - fade_out_value_) * final_y,
+ // layout_->GetWidth() - filter_width,
+ // opening_row_y_ + opening_row_height_,
+ // layout_copy_, texxform,
+ // nux::Color(opacity, opacity, opacity, opacity)
+ // );
+ // }
+
+ // // Ghost row of items below the preview
+ // {
+ // int final_x = layout_->GetX();
+ // int final_y = layout_->GetY() + layout_->GetHeight() - opening_row_height_ - 20;
+
+ // texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth();
+ // texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight();
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // float opacity = fade_out_value_ < ghost_opacity ? ghost_opacity : fade_out_value_;
+
+ // graphics_engine.QRP_1Tex(
+ // fade_out_value_ * layout_->GetX() + (1 - fade_out_value_) * final_x,
+ // fade_out_value_ * (opening_row_y_ + opening_row_height_) + (1 - fade_out_value_) * final_y,
+ // layout_->GetWidth() - filter_width,
+ // layout_->GetHeight() - opening_row_y_ - opening_row_height_,
+ // layout_copy_, texxform,
+ // nux::Color(opacity, opacity, opacity, opacity)
+ // );
+ // }
+
+ // // // Center part
+ // // texxform.uoffset = (home_view_->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // // texxform.voffset = (home_view_->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // // graphics_engine.QRP_1Tex(
+ // // home_view_->GetX(),
+ // // home_view_->GetY(),
+ // // home_view_->GetWidth() - filter_width,
+ // // home_view_->GetHeight(),
+ // // layout_copy_, texxform,
+ // // nux::Color(fade_out_value_, fade_out_value_, fade_out_value_, fade_out_value_)
+ // // //nux::Color(1.0f, 1.0f, 1.0f, 1.0f)
+ // // );
+
+ // graphics_engine.GetRenderStates().SetBlend(false);
+ // graphics_engine.PopClippingRectangle();
+ // }
+ // }
+ // else if (layout_ && layout_->RedirectRenderingToTexture() && fade_in_value_ != 0.0f)
+ // {
+ // if (layout_copy_.IsValid())
+ // {
+ // graphics_engine.PushClippingRectangle(layout_->GetGeometry());
+ // graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ // nux::TexCoordXForm texxform;
+
+ // texxform.FlipVCoord(true);
+
+ // // texxform.uoffset = (search_bar_layout_->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // // texxform.voffset = (search_bar_layout_->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // // graphics_engine.QRP_1Tex(
+ // // search_bar_layout_->GetX(),
+ // // search_bar_layout_->GetY() - (fade_in_value_)*(search_bar_layout_->GetHeight() + 10),
+ // // search_bar_layout_->GetWidth(),
+ // // search_bar_layout_->GetHeight(),
+ // // layout_copy_, texxform,
+ // // nux::Color(1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_)
+ // // );
+
+ // int filter_width = 10;
+ // if (active_lens_view_ && active_lens_view_->filters_expanded)
+ // {
+ // texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // graphics_engine.QRP_1Tex(
+ // active_lens_view_->filter_bar()->GetX() + (fade_in_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10),
+ // active_lens_view_->filter_bar()->GetY(),
+ // active_lens_view_->filter_bar()->GetWidth(),
+ // active_lens_view_->filter_bar()->GetHeight(),
+ // layout_copy_, texxform,
+ // nux::Color(1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_)
+ // );
+ // filter_width += active_lens_view_->filter_bar()->GetWidth();
+ // }
+
+ // // Ghost row of items above the preview
+ // {
+ // int final_x = layout_->GetX();
+ // int final_y = layout_->GetY() - (opening_row_y_);
+
+ // texxform.uoffset = 0.0f;
+ // texxform.voffset = 0.0f; //(opening_row_y_ - layout_->GetY())/(float)layout_->GetHeight();
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // float opacity = (1.0f - fade_in_value_) < ghost_opacity ? ghost_opacity : (1.0f - fade_in_value_);
+
+ // graphics_engine.QRP_1Tex(
+ // (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x,
+ // (1.0f - fade_in_value_) * layout_->GetY() + (fade_in_value_) * final_y,
+ // layout_->GetWidth() - filter_width,
+ // opening_row_y_ + opening_row_height_,
+ // layout_copy_, texxform,
+ // nux::Color(opacity, opacity, opacity, opacity)
+ // );
+ // }
+
+ // // Ghost row of items below the preview
+ // {
+ // int final_x = layout_->GetX();
+ // int final_y = layout_->GetY() + layout_->GetHeight() - opening_row_height_ - 20;
+
+ // texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth();
+ // texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight();
+ // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ // float opacity = (1.0f - fade_in_value_) < ghost_opacity ? ghost_opacity : (1.0f - fade_in_value_);
+
+ // graphics_engine.QRP_1Tex(
+ // (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x,
+ // (1.0f - fade_in_value_) * (opening_row_y_ + opening_row_height_) + (fade_in_value_) * final_y,
+ // layout_->GetWidth() - filter_width,
+ // layout_->GetHeight() - opening_row_y_ - opening_row_height_,
+ // layout_copy_, texxform,
+ // nux::Color(opacity, opacity, opacity, opacity)
+ // );
+ // }
+ // // // Center part
+ // // texxform.uoffset = (home_view_->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ // // texxform.voffset = (home_view_->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ // // texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+
+ // // graphics_engine.QRP_1Tex(
+ // // home_view_->GetX(),
+ // // home_view_->GetY(),
+ // // home_view_->GetWidth() - filter_width,
+ // // home_view_->GetHeight(),
+ // // layout_copy_, texxform,
+ // // nux::Color(1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_)
+ // // );
+
+ // graphics_engine.GetRenderStates().SetBlend(false);
+ // graphics_engine.PopClippingRectangle();
+ // }
+ // }
}
-void DashView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
+void DashView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
- renderer_.DrawInner(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry());
+ renderer_.DrawInner(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry());
+
+ bool display_ghost = false;
+ bool preview_redraw = false;
+ if (preview_container_)
+ {
+ preview_redraw = preview_container_->IsRedrawNeeded();
+ }
+
+ if (!preview_displaying_ && layout_->RedirectRenderingToTexture() && (fade_in_value_ == 0.0f))
+ {
+ nux::Geometry layout_geo = layout_->GetGeometry();
+ graphics_engine.PushClippingRectangle(layout_geo);
+ nux::GetPainter().PaintBackground(graphics_engine, layout_geo);
+ graphics_engine.PopClippingRectangle();
+ }
+
+ if (preview_displaying_ && (IsFullRedraw() || force_draw || preview_redraw) && layout_->RedirectRenderingToTexture())
+ {
+ display_ghost = true;
+ nux::Geometry layout_geo = layout_->GetGeometry();
+ graphics_engine.PushClippingRectangle(layout_geo);
+ nux::GetPainter().PaintBackground(graphics_engine, layout_geo);
+ graphics_engine.PopClippingRectangle();
+ }
if (IsFullRedraw())
+ {
nux::GetPainter().PushBackgroundStack();
+ }
+
if (preview_displaying_)
- preview_container_->ProcessDraw(gfx_context, (!force_draw) ? IsFullRedraw() : force_draw);
- else
- layout_->ProcessDraw(gfx_context, force_draw);
+ {
+ layout_->ProcessDraw(graphics_engine, force_draw);
+
+ // Progressively reveal the preview.
+ nux::Geometry preview_clip_geo = preview_container_->GetGeometry();
+ preview_clip_geo.y = (preview_clip_geo.y + preview_clip_geo.height)/2.0f -
+ (1.0f - fade_out_value_) * (preview_clip_geo.height)/2.0f;
+ preview_clip_geo.height = (1.0f - fade_out_value_) * (preview_clip_geo.height);
+
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-preview_container_->GetWidth()/2.0f, -preview_container_->GetHeight()/2.0f, 0));
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::SCALE(1.0f - fade_out_value_, 1.0f - fade_out_value_, 1.0f));
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(preview_container_->GetWidth()/2.0f, preview_container_->GetHeight()/2.0f, 0));
+
+ preview_container_->ProcessDraw(graphics_engine, (!force_draw) ? IsFullRedraw() : force_draw);
+
+ graphics_engine.PopModelViewMatrix();
+ graphics_engine.PopModelViewMatrix();
+ graphics_engine.PopModelViewMatrix();
+ }
+ else if (fade_in_value_ > 0.0f && preview_container_ && preview_container_.IsValid())
+ {
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-preview_container_->GetWidth()/2.0f, -preview_container_->GetHeight()/2.0f, 0));
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::SCALE(fade_in_value_, fade_in_value_, 1.0f));
+ graphics_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(preview_container_->GetWidth()/2.0f, preview_container_->GetHeight()/2.0f, 0));
+
+ preview_container_->ProcessDraw(graphics_engine, (!force_draw) ? IsFullRedraw() : force_draw);
+
+ graphics_engine.PopModelViewMatrix();
+ graphics_engine.PopModelViewMatrix();
+ graphics_engine.PopModelViewMatrix();
+ }
+ else if (fade_in_value_ == 0.0f)
+ {
+ layout_->ProcessDraw(graphics_engine, force_draw);
+ }
+
+ // Animation effect rendering
+ if (display_ghost || IsFullRedraw())
+ {
+ unsigned int current_alpha_blend;
+ unsigned int current_src_blend_factor;
+ unsigned int current_dest_blend_factor;
+ graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ float ghost_opacity = 0.25f;
+ float tint_factor = 1.2f;
+ float saturation_ref = 0.4f;
+ nux::Color bg_color = bghash_.CurrentColor();
+
+ int position_offset = 40;
+
+ if (preview_displaying_ && layout_ && layout_->RedirectRenderingToTexture())
+ {
+ if (layout_copy_.IsValid())
+ {
+ graphics_engine.PushClippingRectangle(layout_->GetGeometry());
+ graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ nux::TexCoordXForm texxform;
+
+ texxform.FlipVCoord(true);
+
+ int filter_width = 10;
+ if (active_lens_view_ && active_lens_view_->filters_expanded)
+ {
+ texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_1Tex(
+ active_lens_view_->filter_bar()->GetX() + (1.0f - fade_out_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10),
+ active_lens_view_->filter_bar()->GetY(),
+ active_lens_view_->filter_bar()->GetWidth(),
+ active_lens_view_->filter_bar()->GetHeight(),
+ layout_copy_, texxform,
+ nux::Color(fade_out_value_, fade_out_value_, fade_out_value_, fade_out_value_)
+ );
+ filter_width += active_lens_view_->filter_bar()->GetWidth();
+ }
+
+ float saturation = fade_out_value_ + (1.0f - fade_out_value_) * saturation_ref;
+ float opacity = fade_out_value_ < ghost_opacity ? ghost_opacity : fade_out_value_;
+ nux::Color tint = nux::Color(
+ fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.red,
+ fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.green,
+ fade_out_value_ + (1.0f - fade_out_value_) * tint_factor*bg_color.blue,
+ 1.0f);
+
+ // Ghost row of items above the preview
+ {
+ int final_x = layout_->GetX();
+ int final_y = layout_->GetY() - (opening_row_y_) - position_offset ;
+
+ texxform.uoffset = 0.0f;
+ texxform.voffset = 0.0f;
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_TexDesaturate(
+ fade_out_value_ * layout_->GetX() + (1.0f - fade_out_value_) * final_x,
+ fade_out_value_ * layout_->GetY() + (1.0f - fade_out_value_) * final_y,
+ layout_->GetWidth() - filter_width,
+ opening_row_y_ + opening_row_height_,
+ layout_copy_, texxform,
+ nux::Color(tint.red, tint.green, tint.blue, opacity),
+ saturation
+ );
+ }
+
+ // Ghost row of items below the preview
+ {
+ int final_x = layout_->GetX();
+ int final_y = layout_->GetY() + layout_->GetHeight() - position_offset;
+
+ texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth();
+ texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight();
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_TexDesaturate(
+ fade_out_value_ * layout_->GetX() + (1 - fade_out_value_) * final_x,
+ fade_out_value_ * (opening_row_y_ + opening_row_height_) + (1 - fade_out_value_) * final_y,
+ layout_->GetWidth() - filter_width,
+ layout_->GetHeight() - opening_row_y_ - opening_row_height_,
+ layout_copy_, texxform,
+ nux::Color(tint.red, tint.green, tint.blue, opacity),
+ saturation
+ );
+ }
+
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.PopClippingRectangle();
+ }
+
+
+ }
+ else if (layout_ && layout_->RedirectRenderingToTexture() && fade_in_value_ != 0.0f)
+ {
+ if (layout_copy_.IsValid())
+ {
+ graphics_engine.PushClippingRectangle(layout_->GetGeometry());
+ graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ nux::TexCoordXForm texxform;
+
+ texxform.FlipVCoord(true);
+
+ int filter_width = 10;
+ if (active_lens_view_ && active_lens_view_->filters_expanded)
+ {
+ texxform.uoffset = (active_lens_view_->filter_bar()->GetX() -layout_->GetX())/(float)layout_->GetWidth();
+ texxform.voffset = (active_lens_view_->filter_bar()->GetY() -layout_->GetY())/(float)layout_->GetHeight();
+
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_1Tex(
+ active_lens_view_->filter_bar()->GetX() + (fade_in_value_)*(active_lens_view_->filter_bar()->GetWidth() + 10),
+ active_lens_view_->filter_bar()->GetY(),
+ active_lens_view_->filter_bar()->GetWidth(),
+ active_lens_view_->filter_bar()->GetHeight(),
+ layout_copy_, texxform,
+ nux::Color(1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_, 1.0f - fade_in_value_)
+ );
+ filter_width += active_lens_view_->filter_bar()->GetWidth();
+ }
+
+ float saturation = fade_in_value_ * saturation_ref + (1.0f - fade_in_value_);
+ float opacity = (1.0f - fade_in_value_) < ghost_opacity ? ghost_opacity : (1.0f - fade_in_value_);
+ nux::Color tint = nux::Color(
+ fade_in_value_ * tint_factor*bg_color.red + (1.0f - fade_in_value_),
+ fade_in_value_ * tint_factor*bg_color.green + (1.0f - fade_in_value_),
+ fade_in_value_ * tint_factor*bg_color.blue + (1.0f - fade_in_value_),
+ 1.0f);
+
+ // Ghost row of items above the preview
+ {
+ int final_x = layout_->GetX();
+ int final_y = layout_->GetY() - (opening_row_y_) - position_offset;
+
+ texxform.uoffset = 0.0f;
+ texxform.voffset = 0.0f; //(opening_row_y_ - layout_->GetY())/(float)layout_->GetHeight();
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_TexDesaturate(
+ (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x,
+ (1.0f - fade_in_value_) * layout_->GetY() + (fade_in_value_) * final_y,
+ layout_->GetWidth() - filter_width,
+ opening_row_y_ + opening_row_height_,
+ layout_copy_, texxform,
+ nux::Color(tint.red, tint.green, tint.blue, opacity),
+ saturation
+ );
+ }
+
+ // Ghost row of items below the preview
+ {
+ int final_x = layout_->GetX();
+ int final_y = layout_->GetY() + layout_->GetHeight() - position_offset;
+
+ texxform.uoffset = (layout_->GetX() - layout_->GetX())/(float)layout_->GetWidth();
+ texxform.voffset = (opening_row_y_ + opening_row_height_ - layout_->GetY())/(float)layout_->GetHeight();
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ graphics_engine.QRP_TexDesaturate(
+ (1.0f - fade_in_value_) * layout_->GetX() + (fade_in_value_) * final_x,
+ (1.0f - fade_in_value_) * (opening_row_y_ + opening_row_height_) + (fade_in_value_) * final_y,
+ layout_->GetWidth() - filter_width,
+ layout_->GetHeight() - opening_row_y_ - opening_row_height_,
+ layout_copy_, texxform,
+ nux::Color(tint.red, tint.green, tint.blue, opacity),
+ saturation
+ );
+ }
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.PopClippingRectangle();
+ }
+ }
+
+ graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+ }
if (IsFullRedraw())
+ {
nux::GetPainter().PopBackgroundStack();
+ }
- renderer_.DrawInnerCleanup(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry());
+ renderer_.DrawInnerCleanup(graphics_engine, content_geo_, GetAbsoluteGeometry(), GetGeometry());
}
void DashView::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key)
diff --git a/dash/DashView.h b/dash/DashView.h
index e057e2f5e..e7d438eb8 100644
--- a/dash/DashView.h
+++ b/dash/DashView.h
@@ -23,6 +23,8 @@
#include <Nux/PaintLayer.h>
#include <Nux/View.h>
#include <Nux/VLayout.h>
+#include <Nux/NuxTimerTickSource.h>
+
#include <UnityCore/FilesystemLenses.h>
#include <UnityCore/HomeLens.h>
#include <UnityCore/GLibSource.h>
@@ -30,6 +32,7 @@
#include "unity-shared/BackgroundEffectHelper.h"
#include "unity-shared/SearchBar.h"
#include "unity-shared/Introspectable.h"
+#include "unity-shared/BGHash.h"
#include "LensBar.h"
#include "LensView.h"
#include "unity-shared/UBusWrapper.h"
@@ -38,6 +41,8 @@
#include "previews/PreviewContainer.h"
#include "PreviewStateMachine.h"
+namespace na = nux::animation;
+
namespace unity
{
namespace dash
@@ -150,6 +155,28 @@ private:
glib::Source::UniquePtr searching_timeout_;
glib::Source::UniquePtr hide_message_delay_;
+
+ nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_;
+ nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_;
+ nux::ObjectPtr<nux::IOpenGLBaseTexture> filter_view_copy_;
+ nux::ObjectPtr<nux::IOpenGLBaseTexture> layout_copy_;
+
+ float fade_out_value_;
+ float fade_in_value_;
+ std::unique_ptr<nux::NuxTimerTickSource> tick_source_;
+ std::unique_ptr<na::AnimationController> animation_controller_;
+ na::AnimateValue<float> animation_;
+
+ void FadeOutCallBack(float const& fade_out_value);
+ void FadeInCallBack(float const& fade_out_value);
+
+ int opening_row_y_;
+ int opening_row_height_;
+
+ sigc::connection fade_in_connection_;
+ sigc::connection fade_out_connection_;
+
+ unity::BGHash bghash_;
};
diff --git a/dash/FilterAllButton.cpp b/dash/FilterAllButton.cpp
index dc42e94f2..013be5690 100644
--- a/dash/FilterAllButton.cpp
+++ b/dash/FilterAllButton.cpp
@@ -38,6 +38,10 @@ FilterAllButton::FilterAllButton(NUX_FILE_LINE_DECL)
SetInputEventSensitivity(false);
state_change.connect(sigc::mem_fun(this, &FilterAllButton::OnStateChanged));
+
+ SetRedirectRenderingToTexture(true);
+ //SetCopyPreviousFboTexture(false);
+ SetClearBeforeDraw(true);
}
FilterAllButton::~FilterAllButton()
diff --git a/dash/FilterBar.cpp b/dash/FilterBar.cpp
index 8493fb772..6d8164d0f 100644
--- a/dash/FilterBar.cpp
+++ b/dash/FilterBar.cpp
@@ -99,21 +99,16 @@ void FilterBar::RemoveFilter(Filter::Ptr const& filter)
}
}
-void FilterBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+void FilterBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
- nux::Geometry const& geo = GetGeometry();
- GfxContext.PushClippingRectangle(geo);
- nux::GetPainter().PaintBackground(GfxContext, geo);
- GfxContext.PopClippingRectangle();
}
-void FilterBar::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+void FilterBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
- GfxContext.PushClippingRectangle(GetGeometry());
- GetLayout()->ProcessDraw(GfxContext, force_draw);
-
- GfxContext.PopClippingRectangle();
+ graphics_engine.PushClippingRectangle(GetGeometry());
+ GetLayout()->ProcessDraw(graphics_engine, force_draw);
+ graphics_engine.PopClippingRectangle();
}
//
diff --git a/dash/FilterBasicButton.cpp b/dash/FilterBasicButton.cpp
index 52a63f8aa..03fa909c4 100644
--- a/dash/FilterBasicButton.cpp
+++ b/dash/FilterBasicButton.cpp
@@ -70,6 +70,10 @@ void FilterBasicButton::Init()
SetAcceptKeyNavFocusOnMouseDown(false);
SetAcceptKeyNavFocusOnMouseEnter(true);
+ //SetRedirectRenderingToTexture(true);
+ //SetCopyPreviousFboTexture(false);
+ clear_before_draw_ = true;
+
key_nav_focus_change.connect([&] (nux::Area*, bool, nux::KeyNavDirection)
{
QueueDraw();
@@ -127,11 +131,15 @@ long FilterBasicButton::ComputeContentSize()
return ret;
}
-void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+void FilterBasicButton::SetClearBeforeDraw(bool clear_before_draw)
+{
+ clear_before_draw_ = clear_before_draw;
+}
+
+void FilterBasicButton::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
- gPainter.PaintBackground(GfxContext, geo);
// set up our texture mode
nux::TexCoordXForm texxform;
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
@@ -139,12 +147,19 @@ void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
// clear what is behind us
unsigned int alpha = 0, src = 0, dest = 0;
- GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
- GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ if (RedirectedAncestor() && clear_before_draw_)
+ {
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ }
+ graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Color col = nux::color::Black;
col.alpha = 0;
- GfxContext.QRP_Color(geo.x,
+ graphics_engine.QRP_Color(geo.x,
geo.y,
geo.width,
geo.height,
@@ -158,7 +173,7 @@ void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = active_->GetTexture();
- GfxContext.QRP_1Tex(geo.x,
+ graphics_engine.QRP_1Tex(geo.x,
geo.y,
geo.width,
geo.height,
@@ -168,7 +183,7 @@ void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
if (HasKeyboardFocus())
{
- GfxContext.QRP_1Tex(geo.x,
+ graphics_engine.QRP_1Tex(geo.x,
geo.y,
geo.width,
geo.height,
@@ -177,7 +192,7 @@ void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
}
- GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
}
} // namespace dash
diff --git a/dash/FilterBasicButton.h b/dash/FilterBasicButton.h
index 8216938f2..db7991ee4 100644
--- a/dash/FilterBasicButton.h
+++ b/dash/FilterBasicButton.h
@@ -40,6 +40,7 @@ public:
FilterBasicButton(NUX_FILE_LINE_PROTO);
virtual ~FilterBasicButton();
+ void SetClearBeforeDraw(bool clear_before_draw);
protected:
virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
@@ -60,6 +61,7 @@ protected:
private:
std::string label_;
+ bool clear_before_draw_;
};
} // namespace dash
diff --git a/dash/FilterExpanderLabel.cpp b/dash/FilterExpanderLabel.cpp
index 7f26e8d8b..5954d01b9 100644
--- a/dash/FilterExpanderLabel.cpp
+++ b/dash/FilterExpanderLabel.cpp
@@ -257,12 +257,22 @@ bool FilterExpanderLabel::ShouldBeHighlighted()
return ((expander_view_ && expander_view_->HasKeyFocus()));
}
-void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+void FilterExpanderLabel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
- GfxContext.PushClippingRectangle(base);
- nux::GetPainter().PaintBackground(GfxContext, base);
+ graphics_engine.PushClippingRectangle(base);
+
+ if (RedirectedAncestor())
+ {
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
+ }
if (ShouldBeHighlighted())
{
@@ -274,23 +284,46 @@ void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height));
highlight_layer_->SetGeometry(geo);
- highlight_layer_->Renderlayer(GfxContext);
+ highlight_layer_->Renderlayer(graphics_engine);
}
- GfxContext.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
}
-void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
- GfxContext.PushClippingRectangle(GetGeometry());
+ graphics_engine.PushClippingRectangle(GetGeometry());
- if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw())
+ if (RedirectedAncestor() && !IsFullRedraw())
{
- nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get());
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
}
- GetLayout()->ProcessDraw(GfxContext, force_draw);
- GfxContext.PopClippingRectangle();
+ int pushed_paint_layers = 0;
+ if (RedirectedAncestor())
+ {
+ if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw())
+ nux::GetPainter().RenderSinglePaintLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get());
+ }
+ else if (ShouldBeHighlighted() && highlight_layer_ && !IsFullRedraw())
+ {
+ ++pushed_paint_layers;
+ nux::GetPainter().PushLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get());
+ }
+
+ GetLayout()->ProcessDraw(graphics_engine, true);
+ graphics_engine.PopClippingRectangle();
+
+ if (pushed_paint_layers)
+ {
+ nux::GetPainter().PopBackground(pushed_paint_layers);
+ }
}
//
diff --git a/dash/FilterMultiRangeButton.cpp b/dash/FilterMultiRangeButton.cpp
index 5fd1701bb..9aef960ad 100644
--- a/dash/FilterMultiRangeButton.cpp
+++ b/dash/FilterMultiRangeButton.cpp
@@ -226,6 +226,13 @@ void FilterMultiRangeButton::Draw(nux::GraphicsEngine& GfxContext, bool force_dr
// clear what is behind us
unsigned int alpha = 0, src = 0, dest = 0;
GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
+ if (RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ GfxContext.GetRenderStates().SetBlend(false);
+ GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ }
GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Color col = nux::color::Black;
diff --git a/dash/FilterRatingsButton.cpp b/dash/FilterRatingsButton.cpp
index 503e8eeb1..e472051f4 100644
--- a/dash/FilterRatingsButton.cpp
+++ b/dash/FilterRatingsButton.cpp
@@ -107,6 +107,13 @@ void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
unsigned int alpha = 0, src = 0, dest = 0;
GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
+ if (RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ GfxContext.GetRenderStates().SetBlend(false);
+ GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ }
GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Color col = nux::color::Black;
diff --git a/dash/LensBar.cpp b/dash/LensBar.cpp
index 7b0bb1f99..1775e44da 100644
--- a/dash/LensBar.cpp
+++ b/dash/LensBar.cpp
@@ -104,32 +104,50 @@ void LensBar::Activate(std::string id)
}
}
-void LensBar::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
+void LensBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
- gfx_context.PushClippingRectangle(base);
- nux::GetPainter().PaintBackground(gfx_context, base);
+ graphics_engine.PushClippingRectangle(base);
bg_layer_->SetGeometry(base);
- nux::GetPainter().RenderSinglePaintLayer(gfx_context, base, bg_layer_.get());
+ nux::GetPainter().RenderSinglePaintLayer(graphics_engine, base, bg_layer_.get());
- gfx_context.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
}
-void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
+void LensBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
- gfx_context.PushClippingRectangle(base);
+ graphics_engine.PushClippingRectangle(base);
- if (!IsFullRedraw())
- nux::GetPainter().PushLayer(gfx_context, bg_layer_->GetGeometry(), bg_layer_.get());
+ int pushed_paint_layers = 0;
+ if(RedirectedAncestor())
+ {
+ {
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
+ }
+
+ nux::GetPainter().RenderSinglePaintLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
+ //nux::GetPainter().PushDrawLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
+ }
+ else if (!IsFullRedraw())
+ {
+ ++pushed_paint_layers;
+ nux::GetPainter().PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
+ }
- layout_->ProcessDraw(gfx_context, force_draw);
+ layout_->ProcessDraw(graphics_engine, true);
- if (!IsFullRedraw())
- nux::GetPainter().PopBackground();
+ if (pushed_paint_layers)
+ nux::GetPainter().PopBackground(pushed_paint_layers);
for (auto icon: icons_)
{
@@ -142,7 +160,7 @@ void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
// bigger one and clip part of them using the "-1".
int y = base.y - 1;
- nux::GetPainter().Draw2DTriangleColor(gfx_context,
+ nux::GetPainter().Draw2DTriangleColor(graphics_engine,
middle - size, y,
middle, y + size,
middle + size, y,
@@ -152,7 +170,7 @@ void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
}
}
- gfx_context.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
}
void LensBar::SetActive(LensBarIcon* activated)
diff --git a/dash/LensBarIcon.cpp b/dash/LensBarIcon.cpp
index e891220a4..cfb71c4da 100644
--- a/dash/LensBarIcon.cpp
+++ b/dash/LensBarIcon.cpp
@@ -58,21 +58,21 @@ LensBarIcon::LensBarIcon(std::string id_, std::string icon_hint)
active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged));
key_nav_focus_change.connect([&](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); });
+ SetRedirectRenderingToTexture(true);
}
LensBarIcon::~LensBarIcon()
{}
-void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
+void LensBarIcon::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
- gfx_context.PushClippingRectangle(geo);
- nux::GetPainter().PaintBackground(gfx_context, geo);
+ graphics_engine.PushClippingRectangle(geo);
if (!texture())
{
- gfx_context.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
return;
}
@@ -82,7 +82,7 @@ void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
nux::AbstractPaintLayer* layer = focus_layer_.get();
layer->SetGeometry(geo);
- layer->Renderlayer(gfx_context);
+ layer->Renderlayer(graphics_engine);
}
float opacity = active ? 1.0f : inactive_opacity_;
@@ -94,7 +94,7 @@ void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
- gfx_context.QRP_1Tex(geo.x + ((geo.width - width) / 2),
+ graphics_engine.QRP_1Tex(geo.x + ((geo.width - width) / 2),
geo.y + ((geo.height - height) / 2),
width,
height,
@@ -102,7 +102,7 @@ void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
texxform,
col);
- gfx_context.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
}
void LensBarIcon::OnActiveChanged(bool is_active)
diff --git a/dash/LensView.cpp b/dash/LensView.cpp
index a8e425e60..7526e8268 100755
--- a/dash/LensView.cpp
+++ b/dash/LensView.cpp
@@ -164,6 +164,8 @@ LensView::LensView(Lens::Ptr lens, nux::Area* show_filters)
nux::Geometry focused_pos;
g_variant_get (data, "(iiii)", &focused_pos.x, &focused_pos.y, &focused_pos.width, &focused_pos.height);
+ //printf("item to jump to:%d %d\n", focused_pos.x, focused_pos.y);
+
for (auto category : categories_)
{
if (category->GetLayout() != nullptr)
@@ -174,11 +176,11 @@ LensView::LensView(Lens::Ptr lens, nux::Area* show_filters)
if ((child && child->HasKeyFocus()) ||
(expand_label && expand_label->HasKeyFocus()))
{
-
focused_pos.x += child->GetGeometry().x;
focused_pos.y += child->GetGeometry().y - 30;
focused_pos.height += 30;
scroll_view_->ScrollToPosition(focused_pos);
+ //printf("jump to:%d %d\n", focused_pos.x, focused_pos.y);
break;
}
}
@@ -200,7 +202,7 @@ void LensView::SetupViews(nux::Area* show_filters)
scroll_view_->EnableHorizontalScrollBar(false);
layout_->AddView(scroll_view_);
- scroll_view_->OnGeometryChanged.connect([this] (nux::Area *area, nux::Geometry& geo)
+ scroll_view_->geometry_changed.connect([this] (nux::Area *area, nux::Geometry& geo)
{
CheckScrollBarState();
});
diff --git a/dash/PlacesGroup.cpp b/dash/PlacesGroup.cpp
index 76de3fd48..ac6b70d0e 100755
--- a/dash/PlacesGroup.cpp
+++ b/dash/PlacesGroup.cpp
@@ -461,7 +461,20 @@ void PlacesGroup::Draw(nux::GraphicsEngine& graphics_engine,
nux::Geometry const& base = GetGeometry();
graphics_engine.PushClippingRectangle(base);
+ if (RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering. Clean the area below this view.
+ unsigned int current_alpha_blend;
+ unsigned int current_src_blend_factor;
+ unsigned int current_dest_blend_factor;
+ graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+ }
+
if (ShouldBeHighlighted())
{
nux::Geometry geo(_header_layout->GetGeometry());
diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp
index fc9c2fcfa..61d63aff8 100644
--- a/dash/ResultViewGrid.cpp
+++ b/dash/ResultViewGrid.cpp
@@ -62,6 +62,7 @@ ResultViewGrid::ResultViewGrid(NUX_FILE_LINE_DECL)
, mouse_last_x_(-1)
, mouse_last_y_(-1)
, extra_horizontal_spacing_(0)
+ , hightlighted_index_(0)
{
SetAcceptKeyNavFocusOnMouseDown(false);
@@ -143,10 +144,43 @@ ResultViewGrid::ResultViewGrid(NUX_FILE_LINE_DECL)
<< " " << activated_uri_;
int left_results = current_index;
int right_results = num_results ? (num_results - current_index) - 1 : 0;
+
+ int row_y = padding + GetRootGeometry().y;
+ int row_size = renderer_->height + vertical_spacing;
+ int row_height = row_size;
+
+ if (GetItemsPerRow())
+ {
+ int num_row = GetNumResults() / GetItemsPerRow();
+ if (GetNumResults() % GetItemsPerRow())
+ {
+ ++num_row;
+ }
+ int row_index = current_index / GetItemsPerRow();
+
+ row_y += row_index * row_size;
+ }
+
+ // {
+ // std::tuple<int, int> focused_coord = GetResultPosition(selected_index_);
+
+ // int focused_x = std::get<0>(focused_coord);
+ // int focused_y = std::get<1>(focused_coord);
+ // ubus_.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED,
+ // g_variant_new("(iiii)", focused_x, focused_y, renderer_->width(), renderer_->height()));
+ // }
+
ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD,
- g_variant_new("(iii)", 0, left_results, right_results));
+ g_variant_new("(iiii)", row_y, row_height, left_results, right_results));
UriActivated.emit(activated_uri_, ActivateType::PREVIEW);
}
+ hightlighted_index_ = current_index;
+
+ if (current_index >= GetItemsPerRow())
+ {
+ expanded = true;
+ QueueDraw();
+ }
}
g_free(uri);
@@ -573,6 +607,19 @@ ResultListBounds ResultViewGrid::GetVisableResults()
void ResultViewGrid::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
+ if (RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering. Clean the area below this view.
+ unsigned int current_alpha_blend;
+ unsigned int current_src_blend_factor;
+ unsigned int current_dest_blend_factor;
+ GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ GfxContext.GetRenderStates().SetBlend(false);
+ GfxContext.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+
+ GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+ }
int items_per_row = GetItemsPerRow();
unsigned num_results = GetNumResults();
int total_rows = (!expanded) ? 0 : (num_results / items_per_row) + 1;
@@ -599,7 +646,7 @@ void ResultViewGrid::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
break;
ResultRenderer::ResultRendererState state = ResultRenderer::RESULT_RENDERER_NORMAL;
- if ((int)(index) == selected_index_)
+ if ((int)(index) == selected_index_ || (int)(index) == hightlighted_index_)
{
state = ResultRenderer::RESULT_RENDERER_SELECTED;
}
@@ -691,8 +738,24 @@ void ResultViewGrid::MouseClick(int x, int y, unsigned long button_flags, unsign
int left_results = index;
int right_results = (num_results - index) - 1;
//FIXME - just uses y right now, needs to use the absolute position of the bottom of the result
+ // (jay) Here is the fix: Compute the y position of the row where the item is located.
+ int row_y = padding + GetRootGeometry().y;
+ int row_size = renderer_->height + vertical_spacing;
+ int row_height = row_size;
+
+ if (GetItemsPerRow())
+ {
+ int num_row = GetNumResults() / GetItemsPerRow();
+ if (GetNumResults() % GetItemsPerRow())
+ {
+ ++num_row;
+ }
+ int row_index = index / GetItemsPerRow();
+
+ row_y += row_index * row_size;
+ }
ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD,
- g_variant_new("(iii)", y, left_results, right_results));
+ g_variant_new("(iiii)", row_y, row_height, left_results, right_results));
}
else
{
diff --git a/dash/ResultViewGrid.h b/dash/ResultViewGrid.h
index 2e50adf63..8d4d4d972 100644
--- a/dash/ResultViewGrid.h
+++ b/dash/ResultViewGrid.h
@@ -116,6 +116,8 @@ private:
UBusManager ubus_;
glib::Source::UniquePtr lazy_load_source_;
glib::Source::UniquePtr view_changed_idle_;
+
+ int hightlighted_index_;
};
} // namespace dash
diff --git a/dash/previews/PreviewContainer.cpp b/dash/previews/PreviewContainer.cpp
index 3bca735c3..e886dd830 100644
--- a/dash/previews/PreviewContainer.cpp
+++ b/dash/previews/PreviewContainer.cpp
@@ -70,7 +70,7 @@ public:
, nav_complete_(0)
, relative_nav_index_(0)
{
- OnGeometryChanged.connect([&](nux::Area*, nux::Geometry& geo)
+ geometry_changed.connect([&](nux::Area*, nux::Geometry& geo)
{
// Need to update the preview geometries when updating the container geo.
UpdateAnimationProgress(progress_, curve_progress_);
@@ -323,7 +323,7 @@ public:
}
}
- _queued_draw = false;
+ draw_cmd_queued_ = false;
}
sigc::signal<void> start_navigation;
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index f00fd11bd..f7f9139db 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -24,6 +24,7 @@
#include <Nux/HLayout.h>
#include <Nux/BaseWindow.h>
#include <Nux/WindowCompositor.h>
+#include <Nux/NuxTimerTickSource.h>
#include "BaseWindowRaiserImp.h"
#include "IconRenderer.h"
@@ -113,7 +114,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
, screen(screen)
, cScreen(CompositeScreen::get(screen))
, gScreen(GLScreen::get(screen))
- , animation_controller_(tick_source_)
+ //, animation_controller_(tick_source_)
, debugger_(this)
, enable_shortcut_overlay_(true)
, needsRelayout(false)
@@ -235,6 +236,9 @@ UnityScreen::UnityScreen(CompScreen* screen)
this));
#endif
+ tick_source_.reset(new nux::NuxTimerTickSource);
+ animation_controller_.reset(new na::AnimationController(*tick_source_));
+
wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested));
unity_a11y_init(wt.get());
@@ -1222,7 +1226,7 @@ void UnityScreen::preparePaint(int ms)
// Emit the current time throught the tick_source. This moves any running
// animations along their path.
- tick_source_.tick(g_get_monotonic_time());
+ //tick_source_.tick(g_get_monotonic_time());
for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
wi->HandleAnimations (ms);
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index b970a7567..9699b92db 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -245,8 +245,10 @@ private:
bool TopPanelBackgroundTextureNeedsUpdate() const;
void UpdateTopPanelBackgroundTexture();
- nux::animation::TickSource tick_source_;
- nux::animation::AnimationController animation_controller_;
+ // nux::animation::TickSource tick_source_;
+ // nux::animation::AnimationController animation_controller_;
+ std::unique_ptr<nux::NuxTimerTickSource> tick_source_;
+ std::unique_ptr<na::AnimationController> animation_controller_;
Settings dash_settings_;
dash::Style dash_style_;
diff --git a/unity-shared/DashStyle.h b/unity-shared/DashStyle.h
index 0592fdbe2..76d54dc19 100755
--- a/unity-shared/DashStyle.h
+++ b/unity-shared/DashStyle.h
@@ -246,9 +246,11 @@ public:
int GetCategorySeparatorLeftPadding() const;
int GetCategorySeparatorRightPadding() const;
+
sigc::signal<void> changed;
nux::Property<bool> always_maximised;
+ nux::Property<bool> preview_mode;
private:
class Impl;
diff --git a/unity-shared/PlacesVScrollBar.cpp b/unity-shared/PlacesVScrollBar.cpp
index 0f8619fcc..2af828916 100644
--- a/unity-shared/PlacesVScrollBar.cpp
+++ b/unity-shared/PlacesVScrollBar.cpp
@@ -67,15 +67,23 @@ PlacesVScrollBar::PostLayoutManagement(long LayoutResult)
}
void
-PlacesVScrollBar::Draw(nux::GraphicsEngine& gfxContext, bool force_draw)
+PlacesVScrollBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Color color = nux::color::White;
nux::Geometry const& base = GetGeometry();
nux::TexCoordXForm texxform;
- gfxContext.PushClippingRectangle(base);
+ graphics_engine.PushClippingRectangle(base);
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
- nux::GetPainter().PaintBackground(gfxContext, base);
+ if(RedirectedAncestor())
+ {
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ }
// check if textures have been computed... if they haven't, exit function
if (!_slider_texture)
@@ -83,14 +91,14 @@ PlacesVScrollBar::Draw(nux::GraphicsEngine& gfxContext, bool force_draw)
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
- gfxContext.GetRenderStates().SetBlend(true);
- gfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
+ graphics_engine.GetRenderStates().SetBlend(true);
+ graphics_engine.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
if (content_height_ > container_height_)
{
nux::Geometry const& slider_geo = _slider->GetGeometry();
- gfxContext.QRP_1Tex(slider_geo.x,
+ graphics_engine.QRP_1Tex(slider_geo.x,
slider_geo.y,
slider_geo.width,
slider_geo.height,
@@ -99,9 +107,8 @@ PlacesVScrollBar::Draw(nux::GraphicsEngine& gfxContext, bool force_draw)
color);
}
- gfxContext.GetRenderStates().SetBlend(false);
- gfxContext.PopClippingRectangle();
- gfxContext.GetRenderStates().SetBlend(true);
+ graphics_engine.PopClippingRectangle();
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
}
void PlacesVScrollBar::UpdateTexture()
diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp
index 8f1b9175f..11060e804 100644
--- a/unity-shared/SearchBar.cpp
+++ b/unity-shared/SearchBar.cpp
@@ -355,17 +355,16 @@ void SearchBar::OnShowingFiltersChanged(bool is_showing)
}
}
-void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+void SearchBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
UpdateBackground(false);
- GfxContext.PushClippingRectangle(base);
- nux::GetPainter().PaintBackground(GfxContext, base);
+ graphics_engine.PushClippingRectangle(base);
bg_layer_->SetGeometry(nux::Geometry(base.x, base.y, last_width_, last_height_));
- nux::GetPainter().RenderSinglePaintLayer(GfxContext,
+ nux::GetPainter().RenderSinglePaintLayer(graphics_engine,
bg_layer_->GetGeometry(),
bg_layer_.get());
@@ -381,35 +380,85 @@ void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
if (!highlight_layer_)
highlight_layer_.reset(style.FocusOverlay(geo.width, geo.height));
+ if (RedirectedAncestor())
+ {
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
+ }
+
highlight_layer_->SetGeometry(geo);
- highlight_layer_->Renderlayer(GfxContext);
+ highlight_layer_->Renderlayer(graphics_engine);
}
+ else if (expander_view_ && expander_view_->IsVisible())
+ {
+ nux::Geometry geo(expander_view_->GetGeometry());
+
+ geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2;
+ geo.height = HIGHLIGHT_HEIGHT;
- GfxContext.PopClippingRectangle();
+ if (RedirectedAncestor())
+ {
+ unsigned int alpha = 0, src = 0, dest = 0;
+ graphics_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ // This is necessary when doing redirected rendering.
+ // Clean the area below this view before drawing anything.
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
+ }
+ }
+ graphics_engine.PopClippingRectangle();
}
-void SearchBar::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+void SearchBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
- GfxContext.PushClippingRectangle(geo);
+ graphics_engine.PushClippingRectangle(geo);
if (highlight_layer_ && ShouldBeHighlighted() && !IsFullRedraw())
{
- nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get());
+ nux::GetPainter().PushLayer(graphics_engine, highlight_layer_->GetGeometry(), highlight_layer_.get());
}
-
if (!IsFullRedraw())
{
- gPainter.PushLayer(GfxContext, bg_layer_->GetGeometry(), bg_layer_.get());
+ unsigned int current_alpha_blend;
+ unsigned int current_src_blend_factor;
+ unsigned int current_dest_blend_factor;
+ graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ graphics_engine.GetRenderStates().SetBlend(false);
+ graphics_engine.QRP_Color(
+ pango_entry_->GetX(),
+ pango_entry_->GetY(),
+ pango_entry_->GetWidth(),
+ pango_entry_->GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+
+ if (spinner_->IsRedrawNeeded())
+ {
+ graphics_engine.QRP_Color(
+ spinner_->GetX(),
+ spinner_->GetY(),
+ spinner_->GetWidth(),
+ spinner_->GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f));
+ }
+
+ graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
+
+ gPainter.PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
}
else
{
nux::GetPainter().PushPaintLayerStack();
}
- layout_->ProcessDraw(GfxContext, force_draw);
+ layout_->ProcessDraw(graphics_engine, force_draw);
if (!IsFullRedraw())
{
@@ -420,7 +469,7 @@ void SearchBar::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
nux::GetPainter().PopPaintLayerStack();
}
- GfxContext.PopClippingRectangle();
+ graphics_engine.PopClippingRectangle();
}
void SearchBar::OnClearClicked(int x, int y, unsigned long button_fags,
diff --git a/unity-shared/UBusMessages.h b/unity-shared/UBusMessages.h
index 7330a70e6..825d978de 100644
--- a/unity-shared/UBusMessages.h
+++ b/unity-shared/UBusMessages.h
@@ -82,7 +82,7 @@
// FIXME - fix the nux focus api so we don't need this
#define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED"
-// for communicating positions to the preview state machine (iii)
+// for communicating positions to the preview state machine (iiii)
// (split y coord in absolute geometry, results to the left, results to the right)
#define UBUS_DASH_PREVIEW_INFO_PAYLOAD "DASH_PREVIEW_INFO_PAYLOAD"