summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2017-04-04 18:51:39 +0800
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2017-04-04 18:51:39 +0800
commitf153e3cbf5ce8da50fb7171e7e8e0bc66fe00cc7 (patch)
tree496e940bc94478e56cdb293259e54e8e429f3683
parent9dd93a2e406d2c50499d86baddd6b7764fc7b1bb (diff)
parent7a43ed4dae7aa26df2e555e7c706b99efeecf153 (diff)
Merging with trunk
(bzr r4213.4.20)
-rw-r--r--debian/changelog17
-rw-r--r--lockscreen/BackgroundSettings.cpp17
-rw-r--r--lockscreen/LockScreenBaseShield.cpp1
-rw-r--r--plugins/unityshell/src/unityshell.cpp23
-rw-r--r--unity-shared/InputMonitor.cpp11
-rw-r--r--unity-shared/MenuManager.cpp11
6 files changed, 57 insertions, 23 deletions
diff --git a/debian/changelog b/debian/changelog
index 47a4d9146..f24e559cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+unity (7.5.0+17.04.20170301-0ubuntu1) zesty; urgency=medium
+
+ * UnityWindow: safely check validity of UnityWindow from scaled one
+ (LP: #1659847)
+ * InputMonitor: don't try to deference an invalid Nux display (LP:
+ #1632656)
+ * unity7.service: set ups and BAMF as wanted, not required
+
+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 01 Mar 2017 13:07:08 +0000
+
+unity (7.5.0+17.04.20170222-0ubuntu1) zesty; urgency=medium
+
+ * BackgroundSettings: use gnome-bg to generate textures with proper
+ scaling (LP: #1666359)
+
+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 22 Feb 2017 01:52:54 +0000
+
unity (7.5.0+17.04.20170125-0ubuntu1) zesty; urgency=medium
[ Marco Trevisan (Treviño) ]
diff --git a/lockscreen/BackgroundSettings.cpp b/lockscreen/BackgroundSettings.cpp
index 7ffcee98d..d5ec73cea 100644
--- a/lockscreen/BackgroundSettings.cpp
+++ b/lockscreen/BackgroundSettings.cpp
@@ -53,23 +53,28 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor)
auto& settings = Settings::Instance();
nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);
- cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale);
cairo_t* c = cairo_graphics.GetInternalContext();
+ glib::Object<GnomeBG> gnome_bg;
double s_width = geo.width / scale;
double s_height = geo.height / scale;
cairo_surface_t* bg_surface = nullptr;
if (settings.use_user_background())
{
- bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), s_width, s_height, FALSE);
+ gnome_bg = gnome_bg_;
}
else if (!settings.background().empty())
{
- glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), s_width, s_height, FALSE, NULL));
+ gnome_bg = gnome_bg_new();
+ gnome_bg_set_filename(gnome_bg, settings.background().c_str());
+ gnome_bg_set_placement(gnome_bg, G_DESKTOP_BACKGROUND_STYLE_ZOOM);
+ }
- if (pixbuf)
- bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL);
+ if (gnome_bg)
+ {
+ auto *root_window = gdk_get_default_root_window();
+ bg_surface = gnome_bg_create_surface(gnome_bg, root_window, geo.width, geo.height, FALSE);
}
if (bg_surface)
@@ -85,6 +90,8 @@ BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor)
cairo_paint(c);
}
+ cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale);
+
if (!settings.logo().empty())
{
int grid_x_offset = GetGridOffset(s_width);
diff --git a/lockscreen/LockScreenBaseShield.cpp b/lockscreen/LockScreenBaseShield.cpp
index cfd56814c..f4c591fb8 100644
--- a/lockscreen/LockScreenBaseShield.cpp
+++ b/lockscreen/LockScreenBaseShield.cpp
@@ -145,6 +145,7 @@ void BaseShield::UpdateBackgroundTexture()
{
auto background_texture = bg_settings_->GetBackgroundTexture(monitor);
background_layer_.reset(new nux::TextureLayer(background_texture->GetDeviceTexture(), nux::TexCoordXForm(), nux::color::White, true));
+ background_layer_->SetGeometry(monitor_geo);
SetBackgroundLayer(background_layer_.get());
}
}
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index d849e4bd6..41aed941d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -591,12 +591,14 @@ void UnityScreen::OnInitiateSpread()
for (auto const& swin : sScreen->getWindows())
{
- if (filtered_windows.find(swin->window->id()) != filtered_windows.end())
+ if (!swin->window || filtered_windows.find(swin->window->id()) != filtered_windows.end())
continue;
- auto* uwin = UnityWindow::get(swin->window);
- uwin->OnTerminateSpread();
- fake_decorated_windows_.erase(uwin);
+ if (UnityWindow* uwin = UnityWindow::get(swin->window))
+ {
+ uwin->OnTerminateSpread();
+ fake_decorated_windows_.erase(uwin);
+ }
}
for (auto xid : filtered_windows)
@@ -610,6 +612,9 @@ void UnityScreen::OnInitiateSpread()
for (auto const& swin : sScreen->getWindows())
{
+ if (!swin->window)
+ continue;
+
auto* uwin = UnityWindow::get(swin->window);
fake_decorated_windows_.insert(uwin);
uwin->OnInitiateSpread();
@@ -621,7 +626,13 @@ void UnityScreen::OnTerminateSpread()
spread_widgets_.reset();
for (auto const& swin : sScreen->getWindows())
- UnityWindow::get(swin->window)->OnTerminateSpread();
+ {
+ if (!swin->window)
+ continue;
+
+ if (UnityWindow* uwin = UnityWindow::get(swin->window))
+ uwin->OnTerminateSpread();
+ }
fake_decorated_windows_.clear();
}
@@ -3855,7 +3866,7 @@ bool UnityScreen::layoutSlotsAndAssignWindows()
for (ScaleWindow *sw : scaled_windows)
{
- if (sw->window->outputDevice() == static_cast<int>(output.id()))
+ if (sw->window && sw->window->outputDevice() == static_cast<int>(output.id()))
{
UnityWindow::get(sw->window)->deco_win_->scaled = true;
layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));
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)