summaryrefslogtreecommitdiff
path: root/launcher
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-11-19 01:31:42 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-11-19 01:31:42 +0100
commit6d1ce6ed1f24e755818780d3329bbef395771e67 (patch)
tree8d9a96bfa0ae6b8ed226ffbc0047f4372971d53a /launcher
parent433682ac2dd8c34a032578713b187afb3f8ca23a (diff)
SwitcherView: resize switcher view in PreLayoutManagement
(bzr r3347.5.21)
Diffstat (limited to 'launcher')
-rw-r--r--launcher/SwitcherView.cpp24
-rw-r--r--launcher/SwitcherView.h2
2 files changed, 15 insertions, 11 deletions
diff --git a/launcher/SwitcherView.cpp b/launcher/SwitcherView.cpp
index a28957ce2..2b0306375 100644
--- a/launcher/SwitcherView.cpp
+++ b/launcher/SwitcherView.cpp
@@ -39,7 +39,7 @@ namespace
unsigned int const VERTICAL_PADDING = 45;
unsigned int const SPREAD_OFFSET = 100;
unsigned int const EXTRA_ICON_SPACE = 10;
- unsigned int const MAX_DIRECTIONS_CHANGED = 3;
+ unsigned int const MAX_DIRECTIONS_CHANGED = 3;
}
NUX_IMPLEMENT_OBJECT_TYPE(SwitcherView);
@@ -61,11 +61,11 @@ SwitcherView::SwitcherView()
, text_view_(new StaticCairoText(""))
, last_icon_selected_(-1)
, last_detail_icon_selected_(-1)
- , target_sizes_set_(false)
, check_mouse_first_time_(true)
{
icon_renderer_->pip_style = OVER_TILE;
icon_renderer_->monitor = monitors::MAX;
+ icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing);
text_view_->SetMaximumWidth(tile_size * spread_size);
text_view_->SetLines(1);
@@ -88,6 +88,7 @@ SwitcherView::SwitcherView()
if (enabled)
{
SaveTime();
+ QueueRelayout();
QueueDraw();
}
else
@@ -199,7 +200,8 @@ void SwitcherView::SaveLast()
void SwitcherView::OnDetailSelectionIndexChanged(unsigned int index)
{
- QueueDraw ();
+ QueueRelayout();
+ QueueDraw();
}
void SwitcherView::OnDetailSelectionChanged(bool detail)
@@ -216,6 +218,7 @@ void SwitcherView::OnDetailSelectionChanged(bool detail)
}
SaveLast();
+ QueueRelayout();
QueueDraw();
}
@@ -227,6 +230,7 @@ void SwitcherView::OnSelectionChanged(AbstractLauncherIcon::Ptr const& selection
delta_tracker_.ResetState();
SaveLast();
+ QueueRelayout();
QueueDraw();
}
@@ -845,20 +849,19 @@ double SwitcherView::GetCurrentProgress()
return std::min<double>(1.0f, ms_since_change / static_cast<double>(animation_length()));
}
-void SwitcherView::PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw)
+void SwitcherView::PreLayoutManagement()
{
- double progress = GetCurrentProgress();
+ UnityWindowView::PreLayoutManagement();
- if (!target_sizes_set_)
- {
- icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing);
- target_sizes_set_ = true;
- }
+ double progress = GetCurrentProgress();
nux::Geometry background_geo;
last_args_ = RenderArgsFlat(background_geo, model_->SelectionIndex(), progress);
last_background_ = background_geo;
+}
+void SwitcherView::PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw)
+{
icon_renderer_->PreprocessIcons(last_args_, GetGeometry());
}
@@ -933,6 +936,7 @@ void SwitcherView::DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw,
if (ms_since_change < animation_length && !redraw_idle_)
{
redraw_idle_.reset(new glib::Idle([this] () {
+ QueueRelayout();
QueueDraw();
redraw_idle_.reset();
return false;
diff --git a/launcher/SwitcherView.h b/launcher/SwitcherView.h
index 8ceb23abb..9e09a0c11 100644
--- a/launcher/SwitcherView.h
+++ b/launcher/SwitcherView.h
@@ -108,6 +108,7 @@ protected:
ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon::Ptr const& icon);
+ virtual void PreLayoutManagement();
virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
virtual nux::Area* FindKeyFocusArea(unsigned int key_symbol, unsigned long x11_key_code, unsigned long special_keys_state);
@@ -157,7 +158,6 @@ private:
int last_icon_selected_;
int last_detail_icon_selected_;
- bool target_sizes_set_;
bool check_mouse_first_time_;
DeltaTracker delta_tracker_;