summaryrefslogtreecommitdiff
diff options
authorAndrea Azzarone <azzaronea@gmail.com>2012-02-09 23:54:29 +0100
committerAndrea Azzarone <azzaronea@gmail.com>2012-02-09 23:54:29 +0100
commite4a4f67f646523449e33f87f972f9675d9f5fb7a (patch)
treed13715064f16c9944887d9376b7df7d9a9fb9bb0
parentc86ea6e30da605e14967ac78b2b1ceeeb3856a92 (diff)
parent86df61bc862581b59299b8d623d83f560cdd5739 (diff)
Merge trunk.
(bzr r1935.1.2)
-rw-r--r--UnityCore/DBusIndicators.cpp3
-rw-r--r--plugins/unityshell/resources/launcher_arrow_ltr.pngbin376 -> 279 bytes
-rw-r--r--plugins/unityshell/resources/launcher_arrow_outline_ltr.pngbin383 -> 310 bytes
-rw-r--r--plugins/unityshell/resources/launcher_arrow_outline_rtl.pngbin363 -> 301 bytes
-rw-r--r--plugins/unityshell/resources/launcher_arrow_rtl.pngbin345 -> 269 bytes
-rw-r--r--plugins/unityshell/resources/launcher_pip_ltr.pngbin328 -> 205 bytes
-rw-r--r--plugins/unityshell/resources/launcher_pip_rtl.pngbin318 -> 195 bytes
-rw-r--r--plugins/unityshell/src/FilterExpanderLabel.cpp3
-rw-r--r--plugins/unityshell/src/HudIcon.cpp6
-rw-r--r--plugins/unityshell/src/HudIcon.h2
-rw-r--r--plugins/unityshell/src/Launcher.cpp53
-rw-r--r--plugins/unityshell/src/LauncherIcon.cpp58
-rw-r--r--plugins/unityshell/src/LauncherIcon.h9
-rw-r--r--plugins/unityshell/src/QuicklistView.cpp6
-rw-r--r--plugins/unityshell/src/SearchBar.cpp11
-rw-r--r--plugins/unityshell/src/Tooltip.cpp6
-rw-r--r--plugins/unityshell/src/UnityWindowStyle.cpp8
-rw-r--r--plugins/unityshell/src/unityshell.cpp10
18 files changed, 95 insertions, 80 deletions
diff --git a/UnityCore/DBusIndicators.cpp b/UnityCore/DBusIndicators.cpp
index 4c1830604..484120f91 100644
--- a/UnityCore/DBusIndicators.cpp
+++ b/UnityCore/DBusIndicators.cpp
@@ -392,7 +392,10 @@ void DBusIndicators::Impl::SyncGeometries(std::string const& name,
}
if (!found_changed_locations)
+ {
+ g_variant_builder_clear(&b);
return;
+ }
g_variant_builder_close(&b);
g_dbus_proxy_call(proxy_, "SyncGeometries",
diff --git a/plugins/unityshell/resources/launcher_arrow_ltr.png b/plugins/unityshell/resources/launcher_arrow_ltr.png
index 8eca12e02..d1044a9aa 100644
--- a/plugins/unityshell/resources/launcher_arrow_ltr.png
+++ b/plugins/unityshell/resources/launcher_arrow_ltr.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_arrow_outline_ltr.png b/plugins/unityshell/resources/launcher_arrow_outline_ltr.png
index d6633f56f..6b3d427b0 100644
--- a/plugins/unityshell/resources/launcher_arrow_outline_ltr.png
+++ b/plugins/unityshell/resources/launcher_arrow_outline_ltr.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_arrow_outline_rtl.png b/plugins/unityshell/resources/launcher_arrow_outline_rtl.png
index 1fdeab89c..e2afda4ad 100644
--- a/plugins/unityshell/resources/launcher_arrow_outline_rtl.png
+++ b/plugins/unityshell/resources/launcher_arrow_outline_rtl.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_arrow_rtl.png b/plugins/unityshell/resources/launcher_arrow_rtl.png
index 6caa92229..5ae5f6c7f 100644
--- a/plugins/unityshell/resources/launcher_arrow_rtl.png
+++ b/plugins/unityshell/resources/launcher_arrow_rtl.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_pip_ltr.png b/plugins/unityshell/resources/launcher_pip_ltr.png
index 83700a026..36e341b99 100644
--- a/plugins/unityshell/resources/launcher_pip_ltr.png
+++ b/plugins/unityshell/resources/launcher_pip_ltr.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_pip_rtl.png b/plugins/unityshell/resources/launcher_pip_rtl.png
index 4665a3cdc..60cb2bacb 100644
--- a/plugins/unityshell/resources/launcher_pip_rtl.png
+++ b/plugins/unityshell/resources/launcher_pip_rtl.png
Binary files differ
diff --git a/plugins/unityshell/src/FilterExpanderLabel.cpp b/plugins/unityshell/src/FilterExpanderLabel.cpp
index 7d6ff2564..ecffa2112 100644
--- a/plugins/unityshell/src/FilterExpanderLabel.cpp
+++ b/plugins/unityshell/src/FilterExpanderLabel.cpp
@@ -102,7 +102,8 @@ void FilterExpanderLabel::SetRightHandView(nux::View* view)
void FilterExpanderLabel::SetContents(nux::Layout* contents)
{
- contents_.Adopt(contents);
+ // Since the contents is initially unowned, we don't want to Adopt it, just assign.
+ contents_ = contents;
layout_->AddLayout(contents_.GetPointer(), 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
top_bar_layout_->SetTopAndBottomPadding(0);
diff --git a/plugins/unityshell/src/HudIcon.cpp b/plugins/unityshell/src/HudIcon.cpp
index d0128ff42..3b213447c 100644
--- a/plugins/unityshell/src/HudIcon.cpp
+++ b/plugins/unityshell/src/HudIcon.cpp
@@ -50,9 +50,9 @@ void Icon::Init()
{
SetMinimumWidth(66);
SetMinimumHeight(66);
- background_ = nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_back_54.png", -1, true);
- gloss_ = nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_shine_54.png", -1, true);
- edge_ = nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_edge_54.png", -1, true);
+ background_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_back_54.png", -1, true));
+ gloss_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_shine_54.png", -1, true));
+ edge_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/launcher_icon_edge_54.png", -1, true));
texture_updated.connect([&] (nux::BaseTexture* texture)
{
diff --git a/plugins/unityshell/src/HudIcon.h b/plugins/unityshell/src/HudIcon.h
index 5e24b518b..82ddf3ba9 100644
--- a/plugins/unityshell/src/HudIcon.h
+++ b/plugins/unityshell/src/HudIcon.h
@@ -50,7 +50,7 @@ namespace hud
class Icon : public unity::IconTexture
{
public:
- typedef nux::ObjectPtr<IconTexture> Ptr;
+ typedef nux::ObjectPtr<IconTexture> Ptr;
Icon(nux::BaseTexture* texture, guint width, guint height);
Icon(const char* icon_name, unsigned int size, bool defer_icon_loading = false);
~Icon();
diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp
index 22a44d6f7..1686b8144 100644
--- a/plugins/unityshell/src/Launcher.cpp
+++ b/plugins/unityshell/src/Launcher.cpp
@@ -43,6 +43,8 @@
#include "QuicklistView.h"
#include "IconRenderer.h"
#include "TimeUtil.h"
+#include "TextureCache.h"
+#include "IconLoader.h"
#include "WindowManager.h"
#include "UScreen.h"
@@ -52,6 +54,22 @@
#include <UnityCore/GLibWrapper.h>
#include <UnityCore/Variant.h>
+#include <type_traits>
+#include <sigc++/sigc++.h>
+
+namespace sigc
+{
+template <typename Functor>
+struct functor_trait<Functor, false>
+{
+typedef decltype (::sigc::mem_fun (std::declval<Functor&> (),
+&Functor::operator())) _intermediate;
+
+typedef typename _intermediate::result_type result_type;
+typedef Functor functor_type;
+};
+}
+
namespace unity
{
using ui::RenderArg;
@@ -266,36 +284,13 @@ Launcher::Launcher(nux::BaseWindow* parent,
bg_effect_helper_.owner = this;
bg_effect_helper_.enabled = false;
- //FIXME (gord)- replace with async loading
- unity::glib::Object<GdkPixbuf> pixbuf;
- unity::glib::Error error;
- pixbuf = gdk_pixbuf_new_from_file(PKGDATADIR"/dash_sheen.png", &error);
- if (error)
- {
- LOG_WARN(logger) << "Unable to texture " << PKGDATADIR << "/dash_sheen.png" << ": " << error;
- }
- else
- {
- launcher_sheen_ = nux::CreateTexture2DFromPixbuf(pixbuf, true);
- // TODO: when nux has the ability to create a smart pointer that takes
- // ownership without adding a reference, we can remove the unref here. By
- // unreferencing, the object is solely owned by the smart pointer.
- launcher_sheen_->UnReference();
- }
+ TextureCache& cache = TextureCache::GetDefault();
+ TextureCache::CreateTextureCallback cb = [&](std::string const& name, int width, int height) -> nux::BaseTexture* {
+ return nux::CreateTexture2DFromFile((PKGDATADIR"/" + name + ".png").c_str(), -1, true);
+ };
- pixbuf = gdk_pixbuf_new_from_file(PKGDATADIR"/launcher_pressure_effect.png", &error);
- if (error)
- {
- LOG_WARN(logger) << "Unable to texture " << PKGDATADIR << "/launcher_pressure_effect.png" << ": " << error;
- }
- else
- {
- launcher_pressure_effect_ = nux::CreateTexture2DFromPixbuf(pixbuf, true);
- // TODO: when nux has the ability to create a smart pointer that takes
- // ownership without adding a reference, we can remove the unref here. By
- // unreferencing, the object is solely owned by the smart pointer.
- launcher_pressure_effect_->UnReference();
- }
+ launcher_sheen_ = cache.FindTexture("dash_sheen", 0, 0, cb);
+ launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect", 0, 0, cb);
_pointer_barrier = PointerBarrierWrapper::Ptr(new PointerBarrierWrapper());
_pointer_barrier->barrier_event.connect(sigc::mem_fun(this, &Launcher::OnPointerBarrierEvent));
diff --git a/plugins/unityshell/src/LauncherIcon.cpp b/plugins/unityshell/src/LauncherIcon.cpp
index 119342ad1..d68410604 100644
--- a/plugins/unityshell/src/LauncherIcon.cpp
+++ b/plugins/unityshell/src/LauncherIcon.cpp
@@ -70,7 +70,6 @@ GtkIconTheme* LauncherIcon::_unity_theme = NULL;
LauncherIcon::LauncherIcon()
: _menuclient_dynamic_quicklist(nullptr)
- , _quicklist_is_initialized(false)
, _remote_urgent(false)
, _present_urgency(0)
, _progress(0)
@@ -96,20 +95,12 @@ LauncherIcon::LauncherIcon()
_quirk_times[i].tv_nsec = 0;
}
- _tooltip = new Tooltip();
-
tooltip_text.SetSetterFunction(sigc::mem_fun(this, &LauncherIcon::SetTooltipText));
tooltip_text = "blank";
- _quicklist = new QuicklistView();
-
// FIXME: the abstraction is already broken, should be fixed for O
// right now, hooking the dynamic quicklist the less ugly possible way
- QuicklistManager::Default()->RegisterQuicklist(_quicklist.GetPointer());
-
- // Add to introspection
- AddChild(_quicklist.GetPointer());
- AddChild(_tooltip.GetPointer());
+
mouse_enter.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseEnter));
mouse_leave.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseLeave));
@@ -122,10 +113,6 @@ LauncherIcon::~LauncherIcon()
{
SetQuirk(QUIRK_URGENT, false);
- // Remove from introspection
- RemoveChild(_quicklist.GetPointer());
- RemoveChild(_tooltip.GetPointer());
-
if (_present_time_handle)
g_source_remove(_present_time_handle);
_present_time_handle = 0;
@@ -158,6 +145,22 @@ LauncherIcon::~LauncherIcon()
}
}
+void LauncherIcon::LoadTooltip()
+{
+ _tooltip = new Tooltip();
+ AddChild(_tooltip.GetPointer());
+
+ _tooltip->SetText(nux::NString(tooltip_text().c_str()));
+}
+
+void LauncherIcon::LoadQuicklist()
+{
+ _quicklist = new QuicklistView();
+ AddChild(_quicklist.GetPointer());
+
+ QuicklistManager::Default()->RegisterQuicklist(_quicklist.GetPointer());
+}
+
const bool
LauncherIcon::WindowVisibleOnMonitor(int monitor)
{
@@ -451,7 +454,8 @@ bool LauncherIcon::SetTooltipText(std::string& target, std::string const& value)
if (escaped != target)
{
target = escaped;
- _tooltip->SetText(nux::NString(target.c_str()));
+ if (_tooltip)
+ _tooltip->SetText(nux::NString(target.c_str()));
result = true;
}
@@ -476,7 +480,7 @@ LauncherIcon::GetShortcut()
void
LauncherIcon::ShowTooltip()
{
- if (_quicklist->IsVisible())
+ if (_quicklist && _quicklist->IsVisible())
return;
int tip_x = 100;
@@ -488,6 +492,8 @@ LauncherIcon::ShowTooltip()
tip_y = geo.y + _center[_last_monitor].y;
}
+ if (!_tooltip)
+ LoadTooltip();
_tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
_tooltip->ShowWindow(!tooltip_text().empty());
}
@@ -509,17 +515,22 @@ void LauncherIcon::RecvMouseLeave(int monitor)
{
_last_monitor = -1;
- _tooltip->ShowWindow(false);
+ if (_tooltip)
+ _tooltip->ShowWindow(false);
}
bool LauncherIcon::OpenQuicklist(bool default_to_first_item, int monitor)
{
std::list<DbusmenuMenuitem*> menus = Menus();
+ if (!_quicklist)
+ LoadQuicklist();
+
if (menus.empty())
return false;
- _tooltip->ShowWindow(false);
+ if (_tooltip)
+ _tooltip->ShowWindow(false);
_quicklist->RemoveAllMenuItem();
for (auto menu_item : menus)
@@ -601,7 +612,7 @@ void LauncherIcon::RecvMouseUp(int button, int monitor)
{
if (button == 3)
{
- if (_quicklist->IsVisible())
+ if (_quicklist && _quicklist->IsVisible())
_quicklist->CaptureMouseDownAnyWhereElse(true);
}
}
@@ -619,7 +630,8 @@ void LauncherIcon::RecvMouseClick(int button, int monitor)
void LauncherIcon::HideTooltip()
{
- _tooltip->ShowWindow(false);
+ if (_tooltip)
+ _tooltip->ShowWindow(false);
}
gboolean
@@ -649,9 +661,9 @@ LauncherIcon::SetCenter(nux::Point3 center, int monitor, nux::Geometry geo)
tip_x = geo.x + geo.width - 4 * geo.width / 48;
tip_y = geo.y + _center[monitor].y;
- if (_quicklist->IsVisible())
+ if (_quicklist && _quicklist->IsVisible())
QuicklistManager::Default()->ShowQuicklist(_quicklist.GetPointer(), tip_x, tip_y);
- else if (_tooltip->IsVisible())
+ else if (_tooltip && _tooltip->IsVisible())
_tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
}
@@ -742,7 +754,7 @@ LauncherIcon::Unpresent()
void
LauncherIcon::Remove()
{
- if (_quicklist->IsVisible())
+ if (_quicklist && _quicklist->IsVisible())
_quicklist->Hide();
SetQuirk(QUIRK_VISIBLE, false);
diff --git a/plugins/unityshell/src/LauncherIcon.h b/plugins/unityshell/src/LauncherIcon.h
index 0155f2325..6d45c8d39 100644
--- a/plugins/unityshell/src/LauncherIcon.h
+++ b/plugins/unityshell/src/LauncherIcon.h
@@ -263,8 +263,6 @@ protected:
void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);
- nux::ObjectPtr<Tooltip> _tooltip;
- nux::ObjectPtr<QuicklistView> _quicklist;
// This looks like a case for boost::logical::tribool
static int _current_theme_is_mono;
@@ -278,6 +276,9 @@ private:
Quirk quirk;
} DelayedUpdateArg;
+ nux::ObjectPtr<Tooltip> _tooltip;
+ nux::ObjectPtr<QuicklistView> _quicklist;
+
static void ChildRealized(DbusmenuMenuitem* newitem, QuicklistView* quicklist);
static void RootChanged(DbusmenuClient* client, DbusmenuMenuitem* newroot, QuicklistView* quicklist);
static gboolean OnPresentTimeout(gpointer data);
@@ -286,8 +287,10 @@ private:
void ColorForIcon(GdkPixbuf* pixbuf, nux::Color& background, nux::Color& glow);
+ void LoadTooltip();
+ void LoadQuicklist();
+
std::vector<bool> _has_visible_window;
- bool _quicklist_is_initialized;
bool _remote_urgent;
float _present_urgency;
float _progress;
diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp
index 41733e991..24ea7d6af 100644
--- a/plugins/unityshell/src/QuicklistView.cpp
+++ b/plugins/unityshell/src/QuicklistView.cpp
@@ -1323,9 +1323,9 @@ void QuicklistView::UpdateTexture()
cairo_destroy(cr_outline);
cairo_destroy(cr_mask);
- texture_bg_ = texture_from_cairo_graphics(cairo_bg);
- texture_mask_ = texture_from_cairo_graphics(cairo_mask);
- texture_outline_ = texture_from_cairo_graphics(cairo_outline);
+ texture_bg_ = texture_ptr_from_cairo_graphics(cairo_bg);
+ texture_mask_ = texture_ptr_from_cairo_graphics(cairo_mask);
+ texture_outline_ = texture_ptr_from_cairo_graphics(cairo_outline);
_cairo_text_has_changed = false;
diff --git a/plugins/unityshell/src/SearchBar.cpp b/plugins/unityshell/src/SearchBar.cpp
index 04d56d3c5..55bb79b4b 100644
--- a/plugins/unityshell/src/SearchBar.cpp
+++ b/plugins/unityshell/src/SearchBar.cpp
@@ -444,11 +444,13 @@ void SearchBar::UpdateBackground(bool force)
height,
true);
- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
- cairo_set_line_width(cr, 1.0);
- cairo_stroke_preserve(cr);
- cairo_graphics.BlurSurface (3, cairo_get_target (cr));
+ // Disable glow effect #929183
+ //cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
+ //cairo_set_line_width(cr, 1.0);
+ //cairo_stroke_preserve(cr);
+ //cairo_graphics.BlurSurface (3, cairo_get_target (cr));
+ // XXX: Not sure this code is 100% correct.
cairo_operator_t op = CAIRO_OPERATOR_OVER;
op = cairo_get_operator (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -458,6 +460,7 @@ void SearchBar::UpdateBackground(bool force)
cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f);
cairo_fill_preserve(cr);
cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.8f);
+ cairo_set_line_width(cr, 1.0);
cairo_stroke(cr);
cairo_destroy(cr);
diff --git a/plugins/unityshell/src/Tooltip.cpp b/plugins/unityshell/src/Tooltip.cpp
index c7f3256dd..d1a9843ba 100644
--- a/plugins/unityshell/src/Tooltip.cpp
+++ b/plugins/unityshell/src/Tooltip.cpp
@@ -513,9 +513,9 @@ void Tooltip::UpdateTexture()
cairo_destroy(cr_outline);
cairo_destroy(cr_mask);
- texture_bg_ = texture_from_cairo_graphics(cairo_bg);
- texture_mask_ = texture_from_cairo_graphics(cairo_mask);
- texture_outline_ = texture_from_cairo_graphics(cairo_outline);
+ texture_bg_ = texture_ptr_from_cairo_graphics(cairo_bg);
+ texture_mask_ = texture_ptr_from_cairo_graphics(cairo_mask);
+ texture_outline_ = texture_ptr_from_cairo_graphics(cairo_outline);
_cairo_text_has_changed = false;
}
diff --git a/plugins/unityshell/src/UnityWindowStyle.cpp b/plugins/unityshell/src/UnityWindowStyle.cpp
index 826f7669d..348688ff8 100644
--- a/plugins/unityshell/src/UnityWindowStyle.cpp
+++ b/plugins/unityshell/src/UnityWindowStyle.cpp
@@ -24,9 +24,9 @@ namespace ui {
UnityWindowStyle::UnityWindowStyle()
{
- background_top_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true));
- background_left_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true));
- background_corner_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true));
+ background_top_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true));
+ background_left_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true));
+ background_corner_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true));
}
UnityWindowStyle::~UnityWindowStyle()
@@ -61,4 +61,4 @@ nux::BaseTexture* UnityWindowStyle::GetBackgroundCorner() const
}
-} \ No newline at end of file
+}
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index cdb2f7d0a..bc2ee10fb 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -1272,17 +1272,15 @@ void UnityScreen::damageNuxRegions()
it != end; ++it)
{
nux::Geometry const& geo = *it;
- nux_damage = CompRegion(geo.x, geo.y, geo.width, geo.height);
- cScreen->damageRegion(nux_damage);
+ nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
}
nux::Geometry geo = wt->GetWindowCompositor().GetTooltipMainWindowGeometry();
- nux_damage = CompRegion(geo.x, geo.y, geo.width, geo.height);
- cScreen->damageRegion(nux_damage);
+ nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
geo = lastTooltipArea;
- nux_damage = CompRegion(lastTooltipArea.x, lastTooltipArea.y,
- lastTooltipArea.width, lastTooltipArea.height);
+ nux_damage += CompRegion(lastTooltipArea.x, lastTooltipArea.y,
+ lastTooltipArea.width, lastTooltipArea.height);
cScreen->damageRegion(nux_damage);
wt->ClearDrawList();