summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorEleni Maria Stea <elenimaria.stea@canonical.com>2017-04-05 10:28:47 +0300
committerEleni Maria Stea <elenimaria.stea@canonical.com>2017-04-05 10:28:47 +0300
commitfcb883d86aa33c453fa1a9b49b75b8313223d6e6 (patch)
treef4d51e165635a8af1aac229a1c16d22ecb367c62 /unity-shared
parentb7c9ac619b20a7643dc44dc1f71be9d4981e8388 (diff)
parent7a43ed4dae7aa26df2e555e7c706b99efeecf153 (diff)
merged to trunk
(bzr r4213.3.13)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/BackgroundEffectHelper.cpp3
-rw-r--r--unity-shared/InputMonitor.cpp11
-rw-r--r--unity-shared/MenuManager.cpp11
-rw-r--r--unity-shared/SystemdWrapper.cpp1
-rw-r--r--unity-shared/UnitySettings.cpp4
5 files changed, 15 insertions, 15 deletions
diff --git a/unity-shared/BackgroundEffectHelper.cpp b/unity-shared/BackgroundEffectHelper.cpp
index 82d66a744..507c3eacc 100644
--- a/unity-shared/BackgroundEffectHelper.cpp
+++ b/unity-shared/BackgroundEffectHelper.cpp
@@ -143,6 +143,9 @@ bool BackgroundEffectHelper::UpdateOwnerGeometry()
void BackgroundEffectHelper::UpdateBlurGeometries()
{
+ if (blur_type == BLUR_NONE)
+ return;
+
int radius = GetBlurRadius();
blur_geometries_.clear();
blur_geometries_.reserve(registered_list_.size());
diff --git a/unity-shared/InputMonitor.cpp b/unity-shared/InputMonitor.cpp
index 465c5afad..c7b70538a 100644
--- a/unity-shared/InputMonitor.cpp
+++ b/unity-shared/InputMonitor.cpp
@@ -225,7 +225,8 @@ struct Monitor::Impl
void UpdateEventMonitor()
{
- auto* dpy = nux::GetGraphicsDisplay()->GetX11Display();
+ auto* nux_dpy = nux::GetGraphicsDisplay();
+ auto* dpy = nux_dpy ? nux_dpy->GetX11Display() : gdk_x11_get_default_xdisplay();
Window root = DefaultRootWindow(dpy);
unsigned char master_dev_bits[XIMaskLen(XI_LASTEVENT)] = { 0 };
@@ -263,9 +264,9 @@ struct Monitor::Impl
if (!pointer_callbacks_.empty() || !key_callbacks_.empty() || !barrier_callbacks_.empty())
{
- if (!event_filter_set_)
+ if (!event_filter_set_ && nux_dpy)
{
- nux::GetGraphicsDisplay()->AddEventFilter({[] (XEvent event, void* data) {
+ nux_dpy->AddEventFilter({[] (XEvent event, void* data) {
return static_cast<Impl*>(data)->HandleEvent(event);
}, this});
@@ -275,7 +276,9 @@ struct Monitor::Impl
}
else if (event_filter_set_)
{
- nux::GetGraphicsDisplay()->RemoveEventFilter(this);
+ if (nux_dpy)
+ nux_dpy->RemoveEventFilter(this);
+
event_filter_set_ = false;
LOG_DEBUG(logger) << "Event filter disabled";
}
diff --git a/unity-shared/MenuManager.cpp b/unity-shared/MenuManager.cpp
index 77828700d..36d9d538b 100644
--- a/unity-shared/MenuManager.cpp
+++ b/unity-shared/MenuManager.cpp
@@ -325,17 +325,12 @@ struct Manager::Impl : sigc::trackable
bool RegisterTracker(std::string const& menubar, PositionTracker const& cb)
{
- auto it = position_trackers_.find(menubar);
-
- if (it != end(position_trackers_))
- return false;
-
- position_trackers_.insert({menubar, cb});
+ bool added = position_trackers_.insert({menubar, cb}).second;
- if (active_menubar_ == menubar)
+ if (added && active_menubar_ == menubar)
UpdateActiveTracker();
- return true;
+ return added;
}
bool UnregisterTracker(std::string const& menubar, PositionTracker const& cb)
diff --git a/unity-shared/SystemdWrapper.cpp b/unity-shared/SystemdWrapper.cpp
index f3f294f0b..5917ddc24 100644
--- a/unity-shared/SystemdWrapper.cpp
+++ b/unity-shared/SystemdWrapper.cpp
@@ -39,7 +39,6 @@ public:
private:
bool test_mode_;
- glib::DBusProxy::Ptr systemd_proxy_;
};
SystemdWrapper::Impl::Impl(bool test)
diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp
index 07d9fcf4e..eff28667d 100644
--- a/unity-shared/UnitySettings.cpp
+++ b/unity-shared/UnitySettings.cpp
@@ -362,7 +362,7 @@ public:
const auto dpi = std::max(dpi_x, dpi_y);
if (dpi > DPI_SCALING_LIMIT)
- scale = static_cast<int>(std::lround(scale * dpi / DPI_SCALING_LIMIT));
+ scale = static_cast<int>(scale * std::lround(dpi / DPI_SCALING_LIMIT));
}
return scale;
@@ -439,7 +439,7 @@ public:
{
changing_gnome_settings_ = true;
changing_gnome_settings_timeout_.reset();
- unsigned integer_scaling = std::max<unsigned>(1, scale);
+ unsigned integer_scaling = std::max<unsigned>(1, std::lround(scale));
double point_scaling = scale / static_cast<double>(integer_scaling);
double text_scale_factor = parent_->font_scaling() * point_scaling;
glib::Variant default_cursor_size(g_settings_get_default_value(gnome_ui_settings_, GNOME_CURSOR_SIZE.c_str()), glib::StealRef());