summaryrefslogtreecommitdiff
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2014-03-10 16:44:47 -0700
committerBrandon Schaefer <brandontschaefer@gmail.com>2014-03-10 16:44:47 -0700
commit8e2e3aff44bd1ada95fbb7f38941c78131b69e25 (patch)
tree764c268e42bb6713da867eb76fc4029bd545d559
parente7a9a5507f7a27f177cfae3a1a23d40e61ba045c (diff)
* Use a workaround to make sure the LayeredLayout sticks to the same min/max as
the PangoEntry (bzr r3680.8.9)
-rw-r--r--dash/DashView.cpp4
-rw-r--r--unity-shared/SearchBar.cpp42
2 files changed, 27 insertions, 19 deletions
diff --git a/dash/DashView.cpp b/dash/DashView.cpp
index 65e312463..89e7717e8 100644
--- a/dash/DashView.cpp
+++ b/dash/DashView.cpp
@@ -578,13 +578,13 @@ void DashView::OnDPIChanged()
{
double scale = cv_->DPIScale();
+ UpdateDashViewSize();
+
for (auto& scope : scope_views_)
scope.second->UpdateScale(scale);
search_bar_->UpdateScale(scale);
scope_bar_->UpdateScale(cv_->DPIScale());
-
- UpdateDashViewSize();
}
void DashView::UpdateDashViewSize()
diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp
index 1700a5f8f..d81662749 100644
--- a/unity-shared/SearchBar.cpp
+++ b/unity-shared/SearchBar.cpp
@@ -203,7 +203,8 @@ SearchBar::SearchBar(bool show_filter_hint, NUX_FILE_LINE_DECL)
filter_layout_ = new nux::HLayout();
filter_layout_->SetHorizontalInternalMargin(8);
- filter_layout_->SetLeftAndRightPadding(style.GetFilterResultsHighlightLeftPadding(), style.GetFilterResultsHighlightRightPadding()); // *
+ filter_layout_->SetLeftAndRightPadding(style.GetFilterResultsHighlightLeftPadding(),
+ style.GetFilterResultsHighlightRightPadding());
filter_layout_->SetContentDistribution(nux::MAJOR_POSITION_END);
filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER);
@@ -312,6 +313,29 @@ void SearchBar::UpdateSearchBarSize()
BOT_ARROW_MIN_HEIGHT.CP(scale_));
arrow_bottom_space_->SetMaximumSize(ARROW_MAX_WIDTH.CP(scale_),
BOT_ARROW_MAX_HEIGHT.CP(scale_));
+
+ // Based on the Font size, the MinHeight is changing in TextEntry. From there the
+ // layered_layout grows to match the MinHeight, but when the MinHeight is shurnk it
+ // is not changing (since the MaxHeight is int::MAX). Now we grab the MinHeight from
+ // PangoEntry, and set it for layered_layout.
+ int entry_min = pango_entry_->GetMinimumHeight();
+
+ pango_entry_->SetMaximumHeight(entry_min);
+ layered_layout_->SetMinimumHeight(entry_min);
+ layered_layout_->SetMaximumHeight(entry_min);
+}
+
+void SearchBar::UpdateScale(double scale)
+{
+ if (scale_ != scale)
+ {
+ scale_ = scale;
+
+ hint_->SetScale(scale_);
+ show_filters_->SetScale(scale_);
+
+ UpdateSearchBarSize();
+ }
}
void SearchBar::OnFontChanged(GtkSettings* settings, GParamSpec* pspec)
@@ -344,22 +368,6 @@ void SearchBar::OnFontChanged(GtkSettings* settings, GParamSpec* pspec)
}
}
-void SearchBar::UpdateScale(double scale)
-{
- if (scale_ != scale)
- {
- scale_ = scale;
-
- pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(scale_));
- hint_->SetScale(scale_);
- show_filters_->SetScale(scale_);
-
- spinner_->SetXY(0, 0);
-
- UpdateSearchBarSize();
- }
-}
-
void SearchBar::OnSearchHintChanged()
{
gchar* tmp = g_markup_escape_text(search_hint().c_str(), -1);