summaryrefslogtreecommitdiff
path: root/panel
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2014-02-16 19:44:28 -0800
committerBrandon Schaefer <brandontschaefer@gmail.com>2014-02-16 19:44:28 -0800
commitf6c7cae34d0531745efdf436f24248e1f04c4f4c (patch)
treed436d9f3d37fed3d2e59dfee13597dfa472a4bb0 /panel
parent3ad97930904760225e8067f61914552fb6eb2c54 (diff)
* Update more with monitors checks for PanelHeight. A couple moure to go.
* Still need to update the window buttons correctly when different monitor sizes. (bzr r3566.6.7)
Diffstat (limited to 'panel')
-rw-r--r--panel/PanelIndicatorEntryView.cpp10
-rw-r--r--panel/PanelIndicatorsView.cpp9
-rw-r--r--panel/PanelIndicatorsView.h2
-rw-r--r--panel/PanelTray.cpp11
-rw-r--r--panel/PanelTray.h4
-rw-r--r--panel/PanelView.cpp2
6 files changed, 18 insertions, 20 deletions
diff --git a/panel/PanelIndicatorEntryView.cpp b/panel/PanelIndicatorEntryView.cpp
index 3048af1ad..e3dec5b0e 100644
--- a/panel/PanelIndicatorEntryView.cpp
+++ b/panel/PanelIndicatorEntryView.cpp
@@ -76,6 +76,12 @@ PanelIndicatorEntryView::PanelIndicatorEntryView(Entry::Ptr const& proxy, int pa
panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh));
Refresh();
+
+ geometry_changed.connect([this] (nux::Area*, nux::Geometry&) {
+ int monitor = WindowManager::Default().MonitorGeometryIn(GetAbsoluteGeometry());
+ if (monitor != monitor_)
+ SetMonitor(monitor);
+ });
}
PanelIndicatorEntryView::~PanelIndicatorEntryView()
@@ -101,7 +107,7 @@ void PanelIndicatorEntryView::ShowMenu(int button)
if (!wm.IsExpoActive() && !wm.IsScaleActive())
{
auto const& abs_geo = GetAbsoluteGeometry();
- proxy_->ShowMenu(abs_geo.x, abs_geo.y + panel::Style::Instance().PanelHeight(), button);
+ proxy_->ShowMenu(abs_geo.x, abs_geo.y + panel::Style::Instance().PanelHeight(monitor_), button);
}
}
@@ -437,7 +443,7 @@ void PanelIndicatorEntryView::Refresh()
unsigned int width = 0;
unsigned int icon_width = 0;
- unsigned int height = panel::Style::Instance().PanelHeight();
+ unsigned int height = panel::Style::Instance().PanelHeight(monitor_);
// First lets figure out our size
if (pixbuf && IsIconVisible())
diff --git a/panel/PanelIndicatorsView.cpp b/panel/PanelIndicatorsView.cpp
index 16cfab62c..97ac92241 100644
--- a/panel/PanelIndicatorsView.cpp
+++ b/panel/PanelIndicatorsView.cpp
@@ -301,15 +301,6 @@ void PanelIndicatorsView::AddEntryView(PanelIndicatorEntryView* view, IndicatorE
}
}
-void PanelIndicatorsView::SetAllEntrysMonitor(int monitor)
-{
- for (auto area : layout_->GetChildren())
- {
- auto en = static_cast<PanelIndicatorEntryView*>(area);
- en->SetMonitor(monitor);
- }
-}
-
PanelIndicatorEntryView *PanelIndicatorsView::AddEntry(Entry::Ptr const& entry, int padding, IndicatorEntryPosition pos, IndicatorEntryType type)
{
auto view = new PanelIndicatorEntryView(entry, padding, type);
diff --git a/panel/PanelIndicatorsView.h b/panel/PanelIndicatorsView.h
index edb1a9cd7..8067a02d9 100644
--- a/panel/PanelIndicatorsView.h
+++ b/panel/PanelIndicatorsView.h
@@ -75,8 +75,6 @@ public:
sigc::signal<void, PanelIndicatorEntryView*> entry_added;
sigc::signal<void, PanelIndicatorEntryView*> entry_removed;
- void SetAllEntrysMonitor(int monitor);
-
protected:
std::string GetName() const;
void AddProperties(debug::IntrospectionData&);
diff --git a/panel/PanelTray.cpp b/panel/PanelTray.cpp
index 389497d4c..6eb87a959 100644
--- a/panel/PanelTray.cpp
+++ b/panel/PanelTray.cpp
@@ -36,11 +36,12 @@ const std::array<std::string, 2> WHITELIST {{ "JavaEmbeddedFrame", "Wine" }};
namespace unity
{
-PanelTray::PanelTray()
+PanelTray::PanelTray(int monitor)
: View(NUX_TRACKER_LOCATION)
, window_(gtk_window_new(GTK_WINDOW_TOPLEVEL))
+ , monitor_(monitor)
{
- int panel_height = panel::Style::Instance().PanelHeight();
+ int panel_height = panel::Style::Instance().PanelHeight(monitor_);
auto gtkwindow = glib::object_cast<GtkWindow>(window_);
gtk_window_set_type_hint(gtkwindow, GDK_WINDOW_TYPE_HINT_DOCK);
@@ -73,7 +74,7 @@ PanelTray::PanelTray()
}
unity::Settings::Instance().dpi_changed.connect([this] {
- int height = panel::Style::Instance().PanelHeight(0);
+ int height = panel::Style::Instance().PanelHeight(monitor_);
SetMinMaxSize(1, height);
});
@@ -119,7 +120,7 @@ void PanelTray::Sync()
{
if (tray_)
{
- SetMinMaxSize(WidthOfTray() + (PADDING * 2), panel::Style::Instance().PanelHeight());
+ SetMinMaxSize(WidthOfTray() + (PADDING * 2), panel::Style::Instance().PanelHeight(monitor_));
QueueRelayout();
QueueDraw();
@@ -182,7 +183,7 @@ void PanelTray::OnTrayIconRemoved(NaTrayManager* manager, NaTrayChild* removed)
bool PanelTray::IdleSync()
{
int width = WidthOfTray();
- gtk_window_resize(GTK_WINDOW(window_.RawPtr()), width, panel::Style::Instance().PanelHeight());
+ gtk_window_resize(GTK_WINDOW(window_.RawPtr()), width, panel::Style::Instance().PanelHeight(monitor_));
Sync();
return false;
diff --git a/panel/PanelTray.h b/panel/PanelTray.h
index b6611c889..b2ff8e0b9 100644
--- a/panel/PanelTray.h
+++ b/panel/PanelTray.h
@@ -40,7 +40,7 @@ namespace unity
class PanelTray : public nux::View, public unity::debug::Introspectable
{
public:
- PanelTray();
+ PanelTray(int monitor);
~PanelTray();
void Sync();
@@ -70,6 +70,8 @@ private:
glib::Source::UniquePtr sync_idle_;
std::list<NaTrayChild*> children_;
nux::Geometry last_geo_;
+
+ int monitor_;
};
}
diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp
index 359744033..322ffc4cb 100644
--- a/panel/PanelView.cpp
+++ b/panel/PanelView.cpp
@@ -104,7 +104,7 @@ PanelView::PanelView(MockableBaseWindow* parent, indicator::DBusIndicators::Ptr
SetCompositionLayout(layout_);
- tray_ = new PanelTray();
+ tray_ = new PanelTray(monitor_);
layout_->AddView(tray_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
AddChild(tray_);