summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-11-15 19:44:55 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-11-15 19:44:55 +0100
commitd8886be4c7b8d9c1cc3b76b0fa46dd1f443a205d (patch)
tree8c1f8bff588bb1494472c6337af0b80aa3f32f8d
parent15205f0079d36eeeba511d715255d885699cec20 (diff)
parent9e83449ca1069115a9cd80e3d6e24ce6ddfb309b (diff)
Merging with trunk
(bzr r2846.1.45)
-rw-r--r--CMakeLists.txt72
-rw-r--r--UnityCore/CMakeLists.txt11
-rw-r--r--UnityCore/GLibDBusProxy.cpp153
-rw-r--r--UnityCore/GLibDBusProxy.h11
-rw-r--r--UnityCore/HomeLens.cpp38
-rw-r--r--UnityCore/HomeLens.h7
-rw-r--r--UnityCore/Lens.cpp182
-rw-r--r--UnityCore/Lens.h7
-rw-r--r--dash/DashView.cpp36
-rw-r--r--dash/DashView.h6
-rwxr-xr-xdash/LensView.cpp6
-rw-r--r--dash/LensView.h2
-rw-r--r--dash/ResultViewGrid.cpp4
-rw-r--r--debian/changelog3
-rw-r--r--debian/control4
-rwxr-xr-xdebian/rules5
-rw-r--r--hud/HudController.cpp2
-rw-r--r--launcher/ApplicationLauncherIcon.cpp12
-rw-r--r--launcher/CMakeLists.txt8
-rw-r--r--launcher/Launcher.cpp55
-rw-r--r--launcher/Launcher.h11
-rw-r--r--launcher/LauncherController.cpp8
-rw-r--r--launcher/LauncherControllerPrivate.h4
-rw-r--r--launcher/LauncherOptions.h1
-rw-r--r--launcher/TrashLauncherIcon.cpp2
-rw-r--r--panel/PanelMenuView.cpp2
-rw-r--r--plugins/unity-mt-grab-handles/CMakeLists.txt2
-rw-r--r--tests/CMakeLists.txt140
-rw-r--r--tests/autopilot/unity/tests/test_hud.py3
-rw-r--r--tests/test_gdbus_proxy.cpp211
-rw-r--r--tests/test_home_lens.cpp74
-rw-r--r--tests/test_launcher.cpp112
-rw-r--r--tests/test_launcher_controller.cpp40
-rw-r--r--tests/test_lens.cpp6
-rw-r--r--unity-shared/CMakeLists.txt6
-rw-r--r--unity-shared/DebugDBusInterface.cpp (renamed from plugins/unityshell/src/DebugDBusInterface.cpp)9
-rw-r--r--unity-shared/DebugDBusInterface.h (renamed from plugins/unityshell/src/DebugDBusInterface.h)0
-rw-r--r--unity-shared/ResizingBaseWindow.h2
-rw-r--r--unity-shared/UnityWindowView.cpp2
-rw-r--r--unity-shared/WindowManager.h2
-rw-r--r--unity-shared/XPathQueryPart.cpp (renamed from plugins/unityshell/src/XPathQueryPart.cpp)0
-rw-r--r--unity-shared/XPathQueryPart.h (renamed from plugins/unityshell/src/XPathQueryPart.h)0
42 files changed, 738 insertions, 523 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5afe3c9ea..d2ccf1daf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,23 +18,32 @@ set (CMAKE_CXX_FLAGS_DEBUG "-g3")
set (CMAKE_CXX_FLAGS_RELEASE "")
option(
- UNITY_ENABLE_X_ORG_SUPPORT
+ ENABLE_X_SUPPORT
"Enable X.org support in unity"
ON
)
-if(UNITY_ENABLE_X_ORG_SUPPORT)
- add_definitions(-DUNITY_HAS_X_ORG_SUPPORT)
+# This is due to bug lp:668799 - qemu-arm segfaults executing msgmerge
+option(
+ I18N_SUPPORT
+ "Enable I18N, do the .po file thing."
+ ON
+)
+
+if (ENABLE_X_SUPPORT)
+ add_definitions(-DUSE_X11)
message("Unity is configured with support for X.org")
else ()
message("Unity is configured with without X.org")
-endif()
+ add_definitions(-DNO_X11)
+endif ()
if (BUILD_GLES)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNUX_OPENGLES_20 -DUSE_GLES")
- set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm -lpthread -ldl")
+ add_definitions(-DNUX_OPENGLES_20)
+ add_definitions(-DUSE_GLES)
+ set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm -lpthread -ldl")
else ()
- set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm -lpthread -ldl -lGL -lGLU")
+ set (UNITY_STANDALONE_LADD "-lunity-core-${UNITY_API_VERSION} -lm -lpthread -ldl -lGL -lGLU")
endif ()
#
@@ -56,7 +65,7 @@ add_custom_target (pre-distcheck
&& bzr tag ${UNITY_VERSION}
&& echo "• Running Distcheck"
)
-
+
add_custom_target (dist
COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -117,12 +126,14 @@ add_custom_command (OUTPUT ${CMAKE_SOURCE_DIR}/po/unity.pot
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
+if (I18N_SUPPORT)
if (${GETTEXT_FOUND} STREQUAL "TRUE")
set (HAVE_GETTEXT true)
file (GLOB _translations ${CMAKE_SOURCE_DIR}/po/*.po)
GETTEXT_CREATE_TRANSLATIONS (${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
ALL ${_translations})
endif (${GETTEXT_FOUND} STREQUAL "TRUE")
+endif()
#
# Enable or disable boot logging
@@ -144,14 +155,41 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MAINTAINER_CXXFLAGS}")
#
# Compiz Plugins
#
-if(UNITY_ENABLE_X_ORG_SUPPORT)
- set (UNITY_PLUGIN_DEPS "compiz>=0.9.8.0;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;gmodule-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis;xrender>=0.9;zeitgeist-1.0>=0.3.18")
-else ()
- set (UNITY_PLUGIN_DEPS "nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;gmodule-2.0;dbusmenu-glib-0.4;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis;xrender>=0.9;zeitgeist-1.0>=0.3.18")
-endif ()
+set(UNITY_PROTOCOL_PRIVATE_DEPS unity-protocol-private>=5.95.1)
+set(UNITY_PLUGIN_SHARED_DEPS
+ ${UNITY_PROTOCOL_PRIVATE_DEPS}
+ atk
+ atk-bridge-2.0
+ dbusmenu-glib-0.4
+ dee-1.0
+ gio-2.0
+ gio-unix-2.0
+ gmodule-2.0
+ gthread-2.0
+ gtk+-3.0>=3.1
+ indicator3-0.4>=0.4.90
+ json-glib-1.0
+ libbamf3
+ libnotify
+ libstartup-notification-1.0
+ nux-4.0>=4.0.0
+ sigc++-2.0
+ unity-misc>=0.4.0
+ zeitgeist-1.0>=0.3.18
+)
-set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.95.1")
+set(UNITY_PLUGIN_DEPS ${UNITY_PLUGIN_SHARED_DEPS})
+if(ENABLE_X_SUPPORT)
+ set(UNITY_PLUGIN_DEPS
+ ${UNITY_PLUGIN_DEPS}
+ compiz>=0.9.8.0
+ libgeis
+ x11
+ xfixes
+ xrender>=0.9
+ )
+endif ()
find_package (PkgConfig)
pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
@@ -159,16 +197,16 @@ pkg_check_modules (CACHED_UNITY_PRIVATE_DEPS REQUIRED ${UNITY_PROTOCOL_PRIVATE_D
add_subdirectory(unity-shared)
add_subdirectory(dash)
add_subdirectory(launcher)
-add_subdirectory(shortcuts)
-if(UNITY_ENABLE_X_ORG_SUPPORT)
+if (ENABLE_X_SUPPORT)
add_subdirectory(hud)
add_subdirectory(panel)
add_subdirectory(plugins/unityshell)
add_subdirectory(plugins/networkarearegion)
add_subdirectory(plugins/unitydialog)
add_subdirectory(plugins/unity-mt-grab-handles)
+ add_subdirectory(shortcuts)
add_subdirectory(unity-standalone)
-endif()
+endif ()
# subdirs
add_subdirectory(doc)
diff --git a/UnityCore/CMakeLists.txt b/UnityCore/CMakeLists.txt
index a036af4f0..2a7df66ac 100644
--- a/UnityCore/CMakeLists.txt
+++ b/UnityCore/CMakeLists.txt
@@ -1,5 +1,14 @@
find_package (PkgConfig)
-pkg_check_modules (CORE_DEPS REQUIRED glib-2.0 gio-2.0 dee-1.0 sigc++-2.0 nux-core-3.0 gdk-pixbuf-2.0 unity-protocol-private)
+set(UNITY_CORE_DEPS
+ glib-2.0
+ gio-2.0
+ dee-1.0
+ sigc++-2.0
+ nux-core-4.0
+ gdk-pixbuf-2.0
+ unity-protocol-private
+)
+pkg_check_modules (CORE_DEPS REQUIRED ${UNITY_CORE_DEPS})
pkg_check_modules (PRIVATE_CORE_DEPS REQUIRED unity-protocol-private)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} unity --variable lensesdir OUTPUT_VARIABLE _lensesdir OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/UnityCore/GLibDBusProxy.cpp b/UnityCore/GLibDBusProxy.cpp
index 54fd97e66..bd1be335d 100644
--- a/UnityCore/GLibDBusProxy.cpp
+++ b/UnityCore/GLibDBusProxy.cpp
@@ -59,10 +59,19 @@ public:
void StartReconnectionTimeout(unsigned timeout);
void Connect();
- void Call(string const& method_name,
+ void WaitForProxy(GCancellable* cancellable,
+ int timeout_msec,
+ std::function<void(glib::Error const&)> const& callback);
+ void CallNoError(string const& method_name,
+ GVariant* parameters,
+ ReplyCallback const& callback,
+ GCancellable* cancellable,
+ GDBusCallFlags flags,
+ int timeout_msec);
+ void Call(std::string const& method_name,
GVariant* parameters,
- ReplyCallback callback,
- GCancellable* cancellable,
+ CallFinishedCallback const& callback,
+ GCancellable *cancellable,
GDBusCallFlags flags,
int timeout_msec);
@@ -78,7 +87,7 @@ public:
struct CallData
{
- DBusProxy::ReplyCallback callback;
+ DBusProxy::CallFinishedCallback callback;
std::string method_name;
};
@@ -97,6 +106,7 @@ public:
glib::Signal<void, GDBusProxy*, char*, char*, GVariant*> g_signal_connection_;
glib::Signal<void, GDBusProxy*, GParamSpec*> name_owner_signal_;
glib::Source::UniquePtr reconnect_timeout_;
+ sigc::signal<void> proxy_acquired;
SignalHandlers handlers_;
};
@@ -117,6 +127,7 @@ DBusProxy::Impl::Impl(DBusProxy* owner,
, connected_(false)
, reconnection_attempts_(0)
{
+ // FIXME: get rid of this once glib doesn't deadlock in class initiation
StartReconnectionTimeout(1);
}
@@ -206,6 +217,8 @@ void DBusProxy::Impl::OnProxyConnectCallback(GObject* source,
self->connected_ = true;
self->owner_->connected.emit();
}
+
+ self->proxy_acquired.emit();
}
void DBusProxy::Impl::OnProxyNameOwnerChanged(GDBusProxy* proxy, GParamSpec* param)
@@ -245,33 +258,107 @@ void DBusProxy::Impl::OnProxySignal(GDBusProxy* proxy,
callback(parameters);
}
+void DBusProxy::Impl::WaitForProxy(GCancellable* cancellable,
+ int timeout_msec,
+ std::function<void(glib::Error const&)> const& callback)
+{
+ if (!proxy_)
+ {
+ auto con = std::make_shared<sigc::connection>();
+ auto canc = glib::Object<GCancellable>(cancellable, glib::AddRef());
+
+ // add a timeout
+ auto timeout = std::make_shared<glib::Timeout>(timeout_msec < 0 ? 30000 : timeout_msec, [con, canc, callback] ()
+ {
+ if (!g_cancellable_is_cancelled(canc))
+ {
+ glib::Error err;
+ GError** real_err = &err;
+ *real_err = g_error_new_literal(G_DBUS_ERROR, G_DBUS_ERROR_TIMED_OUT,
+ "Timed out waiting for proxy");
+ callback(err);
+ }
+ con->disconnect();
+ return false;
+ });
+ // wait for the signal
+ *con = proxy_acquired.connect([con, canc, timeout, callback] ()
+ {
+ if (!g_cancellable_is_cancelled(canc)) callback(glib::Error());
+
+ timeout->Remove();
+ con->disconnect();
+ });
+ }
+ else
+ {
+ callback(glib::Error());
+ }
+}
+
+void DBusProxy::Impl::CallNoError(string const& method_name,
+ GVariant* parameters,
+ ReplyCallback const& callback,
+ GCancellable* cancellable,
+ GDBusCallFlags flags,
+ int timeout_msec)
+{
+ if (callback)
+ {
+ auto cb = [callback] (GVariant* result, Error const& err)
+ {
+ if (!err) callback(result);
+ };
+
+ Call(method_name, parameters, cb, cancellable, flags, timeout_msec);
+ }
+ else
+ {
+ Call(method_name, parameters, nullptr, cancellable, flags, timeout_msec);
+ }
+}
+
void DBusProxy::Impl::Call(string const& method_name,
GVariant* parameters,
- ReplyCallback callback,
+ CallFinishedCallback const& callback,
GCancellable* cancellable,
GDBusCallFlags flags,
int timeout_msec)
{
- if (proxy_)
- {
- CallData* data = new CallData();
- data->callback = callback;
- data->method_name = method_name;
-
- g_dbus_proxy_call(proxy_,
- method_name.c_str(),
- parameters,
- flags,
- timeout_msec,
- cancellable != NULL ? cancellable : cancellable_,
- DBusProxy::Impl::OnCallCallback,
- data);
- }
- else
+ GCancellable* target_canc = cancellable != NULL ? cancellable : cancellable_;
+
+ if (!proxy_)
{
- LOG_WARNING(logger) << "Cannot call method " << method_name
- << " proxy " << object_path_ << " does not exist";
+ glib::Variant sinked_parameters(parameters);
+ glib::Object<GCancellable>canc(target_canc, glib::AddRef());
+ WaitForProxy(canc, timeout_msec, [this, method_name, sinked_parameters, callback, canc, flags, timeout_msec] (glib::Error const& err)
+ {
+ if (err)
+ {
+ callback(glib::Variant(), err);
+ LOG_WARNING(logger) << "Cannot call method " << method_name
+ << ": " << err;
+ }
+ else
+ {
+ Call(method_name, sinked_parameters, callback, canc, flags, timeout_msec);
+ }
+ });
+ return;
}
+
+ CallData* data = new CallData();
+ data->callback = callback;
+ data->method_name = method_name;
+
+ g_dbus_proxy_call(proxy_,
+ method_name.c_str(),
+ parameters,
+ flags,
+ timeout_msec,
+ target_canc,
+ DBusProxy::Impl::OnCallCallback,
+ data);
}
void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data)
@@ -284,7 +371,8 @@ void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointe
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- // silently ignore
+ // silently ignore, don't even invoke callback, FIXME: really?
+ return;
}
else
{
@@ -293,12 +381,10 @@ void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointe
<< g_dbus_proxy_get_object_path(G_DBUS_PROXY(source))
<< "\" failed: " << error;
}
-
- return;
}
if (data->callback)
- data->callback(result);
+ data->callback(result, error);
}
void DBusProxy::Impl::Connect(std::string const& signal_name, ReplyCallback callback)
@@ -320,11 +406,22 @@ DBusProxy::~DBusProxy()
void DBusProxy::Call(string const& method_name,
GVariant* parameters,
- ReplyCallback callback,
+ ReplyCallback const& callback,
GCancellable* cancellable,
GDBusCallFlags flags,
int timeout_msec)
{
+ pimpl->CallNoError(method_name, parameters, callback, cancellable, flags,
+ timeout_msec);
+}
+
+void DBusProxy::CallBegin(std::string const& method_name,
+ GVariant* parameters,
+ CallFinishedCallback const& callback,
+ GCancellable *cancellable,
+ GDBusCallFlags flags,
+ int timeout_msec)
+{
pimpl->Call(method_name, parameters, callback, cancellable, flags,
timeout_msec);
}
diff --git a/UnityCore/GLibDBusProxy.h b/UnityCore/GLibDBusProxy.h
index 06cce6cc6..35c2bca0c 100644
--- a/UnityCore/GLibDBusProxy.h
+++ b/UnityCore/GLibDBusProxy.h
@@ -26,6 +26,8 @@
#include <sigc++/signal.h>
#include <sigc++/trackable.h>
+#include "GLibWrapper.h"
+
namespace unity
{
namespace glib
@@ -38,6 +40,7 @@ class DBusProxy : public sigc::trackable, boost::noncopyable
public:
typedef std::shared_ptr<DBusProxy> Ptr;
typedef std::function<void(GVariant*)> ReplyCallback;
+ typedef std::function<void(GVariant*, Error const&)> CallFinishedCallback;
DBusProxy(std::string const& name,
std::string const& object_path,
@@ -48,10 +51,16 @@ public:
void Call(std::string const& method_name,
GVariant* parameters = nullptr,
- ReplyCallback callback = nullptr,
+ ReplyCallback const& callback = nullptr,
GCancellable *cancellable = nullptr,
GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE,
int timeout_msec = -1);
+ void CallBegin(std::string const& method_name,
+ GVariant* parameters,
+ CallFinishedCallback const& callback,
+ GCancellable *cancellable = nullptr,
+ GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE,
+ int timeout_msec = -1);
void Connect(std::string const& signal_name, ReplyCallback callback);
bool IsConnected();
diff --git a/UnityCore/HomeLens.cpp b/UnityCore/HomeLens.cpp
index 3f30885dd..2adde7ef2 100644
--- a/UnityCore/HomeLens.cpp
+++ b/UnityCore/HomeLens.cpp
@@ -863,19 +863,6 @@ void HomeLens::Impl::OnLensAdded (Lens::Ptr& lens)
lenses_.push_back (lens);
owner_->lens_added.emit(lens);
- /* When we dispatch a search we inc the search count and when we finish
- * one we decrease it. When we reach 0 we'll emit search_finished. */
- lens->global_search_finished.connect([this, lens] (Hints const& hints) {
- running_searches_--;
-
- LensSearchFinished(lens);
- if (running_searches_ <= 0)
- {
- owner_->search_finished.emit(Hints());
- LOG_INFO(logger) << "Search finished";
- }
- });
-
nux::ROProperty<glib::Object<DeeModel>>& results_prop = lens->global_results()->model;
nux::ROProperty<glib::Object<DeeModel>>& categories_prop = lens->categories()->model;
nux::ROProperty<glib::Object<DeeModel>>& filters_prop = lens->filters()->model;
@@ -998,6 +985,8 @@ void HomeLens::Impl::LensSearchFinished(Lens::Ptr const& lens)
cached_categories_order_ = order_vector;
owner_->categories_reordered();
}
+
+ owner_->lens_search_finished.emit(lens);
}
bool HomeLens::Impl::ResultsContainVisibleMatch(unsigned category)
@@ -1169,30 +1158,41 @@ Lens::Ptr HomeLens::GetLensAtIndex(std::size_t index) const
return Lens::Ptr();
}
-void HomeLens::GlobalSearch(std::string const& search_string)
+void HomeLens::GlobalSearch(std::string const& search_string, SearchFinishedCallback const& cb)
{
LOG_WARN(logger) << "Global search not enabled for HomeLens class."
<< " Ignoring query '" << search_string << "'";
}
-void HomeLens::Search(std::string const& search_string)
+void HomeLens::Search(std::string const& search_string, SearchFinishedCallback const& cb)
{
LOG_DEBUG(logger) << "Search '" << search_string << "'";
- /* Reset running search counter */
- pimpl->running_searches_ = 0;
pimpl->last_search_string_ = search_string;
pimpl->apps_lens_contains_visible_match = false;
+ auto running_searches = std::make_shared<int>();
for (auto lens: pimpl->lenses_)
{
if (lens->search_in_global())
{
+ (*running_searches.get())++;
+ auto closure = [this, lens, running_searches, cb] (Hints const&, glib::Error const&)
+ {
+ int remaining_searches = --(*running_searches.get());
+ pimpl->LensSearchFinished(lens);
+
+ if (remaining_searches <= 0)
+ {
+ cb(Hints(), glib::Error());
+ LOG_INFO(logger) << "Global search finished";
+ }
+ };
+
LOG_INFO(logger) << " - Global search on '" << lens->id() << "' for '"
<< search_string << "'";
lens->view_type = ViewType::HOME_VIEW;
- lens->GlobalSearch(search_string);
- pimpl->running_searches_++;
+ lens->GlobalSearch(search_string, closure);
}
}
}
diff --git a/UnityCore/HomeLens.h b/UnityCore/HomeLens.h
index 0facd0fa1..68fa0ce06 100644
--- a/UnityCore/HomeLens.h
+++ b/UnityCore/HomeLens.h
@@ -69,14 +69,17 @@ public:
Lens::Ptr GetLens(std::string const& lens_id) const;
Lens::Ptr GetLensAtIndex(std::size_t index) const;
- void GlobalSearch(std::string const& search_string);
- void Search(std::string const& search_string);
+ void GlobalSearch(std::string const& search_string, SearchFinishedCallback const& cb);
+ void Search(std::string const& search_string, SearchFinishedCallback const& cb);
void Activate(std::string const& uri);
void Preview(std::string const& uri);
std::vector<unsigned> GetCategoriesOrder();
glib::Object<DeeModel> GetFilterModelForCategory(unsigned category);
+ // emitted when global search for one lens finishes
+ sigc::signal<void, Lens::Ptr const&> lens_search_finished;
+
private:
class Impl;
class ModelMerger;
diff --git a/UnityCore/Lens.cpp b/UnityCore/Lens.cpp
index d2662136c..f0d7bac37 100644
--- a/UnityCore/Lens.cpp
+++ b/UnityCore/Lens.cpp
@@ -61,15 +61,14 @@ public:
void OnProxyConnectionChanged();
void OnProxyDisconnected();
- void ResultsModelUpdated(unsigned long long begin_seqnum,
- unsigned long long end_seqnum);
- void GlobalResultsModelUpdated(unsigned long long begin_seqnum,
- unsigned long long end_seqnum);
-
unsigned long long ExtractModelSeqnum(GVariant *parameters);
+ void WaitForModelUpdate(glib::Variant const& response_variant,
+ Results::Ptr const& model,
+ std::function<void(Hints const&)> const& callback);
+ void SearchCallFinished(GVariant* response, glib::Error const& error,
+ Results::Ptr const& model,
+ SearchFinishedCallback const& cb);
- void OnSearchFinished(GVariant* parameters);
- void OnGlobalSearchFinished(GVariant* parameters);
void OnChanged(GVariant* parameters);
void UpdateProperties(bool search_in_global,
bool visible,
@@ -82,8 +81,8 @@ public:
GVariantIter* hints_iter);
void OnViewTypeChanged(ViewType view_type);
- void GlobalSearch(std::string const& search_string);
- void Search(std::string const& search_string);
+ void GlobalSearch(std::string const& search_string, SearchFinishedCallback const& cb);
+ void Search(std::string const& search_string, SearchFinishedCallback const& cb);
void Activate(std::string const& uri);
void ActivationReply(GVariant* parameters);
void Preview(std::string const& uri);
@@ -188,12 +187,6 @@ Lens::Impl::Impl(Lens* owner,
proxy_->Connect("Changed", sigc::mem_fun(this, &Lens::Impl::OnChanged));
}
- /* Technically these signals will only be fired by remote models, but we
- * connect them no matter the ModelType. Dee may grow support in the future.
- */
- results_->end_transaction.connect(sigc::mem_fun(this, &Lens::Impl::ResultsModelUpdated));
- global_results_->end_transaction.connect(sigc::mem_fun(this, &Lens::Impl::GlobalResultsModelUpdated));
-
owner_->id.SetGetterFunction(sigc::mem_fun(this, &Lens::Impl::id));
owner_->dbus_name.SetGetterFunction(sigc::mem_fun(this, &Lens::Impl::dbus_name));
owner_->dbus_path.SetGetterFunction(sigc::mem_fun(this, &Lens::Impl::dbus_path));
@@ -247,35 +240,27 @@ void Lens::Impl::OnProxyDisconnected()
owner_->connected.EmitChanged(connected_);
}
-void Lens::Impl::ResultsModelUpdated(unsigned long long begin_seqnum,
- unsigned long long end_seqnum)
+void Lens::Impl::WaitForModelUpdate(glib::Variant const& response_variant,
+ Results::Ptr const& model,
+ std::function<void(Hints const&)> const& callback)
{
- if (results_variant_ && end_seqnum >= ExtractModelSeqnum (results_variant_))
+ // a bit of pointer craziness because using copy constructors screws us up
+ auto con = std::make_shared<sigc::connection>();
+ *con = model->end_transaction.connect([this, response_variant, model, callback, con]
+ (unsigned long long begin_seqnum,
+ unsigned long long end_seqnum)
{
- Hints hints;
-
- results_variant_.ASVToHints(hints);
-
- owner_->search_finished.emit(hints);
-
- results_variant_ = NULL;
- }
-}
-
-void Lens::Impl::GlobalResultsModelUpdated(unsigned long long begin_seqnum,
- unsigned long long end_seqnum)
-{
- if (global_results_variant_ &&
- end_seqnum >= ExtractModelSeqnum (global_results_variant_))
- {
- Hints hints;
-
- global_results_variant_.ASVToHints(hints);
+ if (end_seqnum >= ExtractModelSeqnum(response_variant))
+ {
+ Hints hints;
+ response_variant.ASVToHints(hints);
+ callback(hints);
- owner_->global_search_finished.emit(hints);
+ con->disconnect();
+ }
+ });
- global_results_variant_ = NULL;
- }
+ // FIXME: also add a timer and fail the call after ~30 seconds?
}
unsigned long long Lens::Impl::ExtractModelSeqnum(GVariant *parameters)
@@ -298,48 +283,6 @@ unsigned long long Lens::Impl::ExtractModelSeqnum(GVariant *parameters)
return seqnum;
}
-void Lens::Impl::OnSearchFinished(GVariant* parameters)
-{
- Hints hints;
- unsigned long long reply_seqnum;
-
- reply_seqnum = ExtractModelSeqnum (parameters);
- if (results_->seqnum < reply_seqnum)
- {
- // wait for the end-transaction signal
- results_variant_ = parameters;
-
- // ResultsModelUpdated will emit OnSearchFinished
- return;
- }
-
- glib::Variant dict (parameters);
- dict.ASVToHints(hints);
-
- owner_->search_finished.emit(hints);
-}
-
-void Lens::Impl::OnGlobalSearchFinished(GVariant* parameters)
-{
- Hints hints;
- unsigned long long reply_seqnum;
-
- reply_seqnum = ExtractModelSeqnum (parameters);
- if (global_results_->seqnum < reply_seqnum)
- {
- // wait for the end-transaction signal
- global_results_variant_ = parameters;
-
- // GlobalResultsModelUpdated will emit OnGlobalSearchFinished
- return;
- }
-
- glib::Variant dict (parameters);
- dict.ASVToHints(hints);
-
- owner_->global_search_finished.emit(hints);
-}
-
void Lens::Impl::OnChanged(GVariant* parameters)
{
glib::String dbus_path;
@@ -479,7 +422,35 @@ void Lens::Impl::OnViewTypeChanged(ViewType view_type)
proxy_->Call("SetViewType", g_variant_new("(u)", view_type));
}
-void Lens::Impl::GlobalSearch(std::string const& search_string)
+void Lens::Impl::SearchCallFinished(GVariant* response, glib::Error const& error, Results::Ptr const& model, SearchFinishedCallback const& cb)
+{
+ if (!error)
+ {
+ auto reply_seqnum = ExtractModelSeqnum(response);
+ if (model->seqnum < reply_seqnum)
+ {
+ WaitForModelUpdate(response, model, [this, cb] (Hints const& hints)
+ {
+ if (cb) cb(hints, glib::Error());
+ });
+ }
+ else
+ {
+ Hints hints;
+ glib::Variant dict(response);
+ dict.ASVToHints(hints);
+ if (cb) cb(hints, glib::Error());
+ }
+ }
+ else
+ {
+ // call failed
+ if (cb) cb(Hints(), error);
+ }
+}
+
+void Lens::Impl::GlobalSearch(std::string const& search_string,
+ SearchFinishedCallback const& cb)
{
LOG_DEBUG(logger) << "Global Searching '" << id_ << "' for '" << search_string << "'";
@@ -490,20 +461,23 @@ void Lens::Impl::GlobalSearch(std::string const& search_string)
g_cancellable_cancel (global_search_cancellable_);
global_search_cancellable_ = g_cancellable_new ();
- global_results_variant_ = NULL;
last_global_search_string_ = search_string;
- proxy_->Call("GlobalSearch",
- g_variant_new("(sa{sv})",
- search_string.c_str(),
- &b),
- sigc::mem_fun(this, &Lens::Impl::OnGlobalSearchFinished),
- global_search_cancellable_);
+ proxy_->CallBegin("GlobalSearch",
+ g_variant_new("(sa{sv})",
+ search_string.c_str(),
+ &b),
+ [this, cb] (GVariant* response, glib::Error const& error)
+ {
+ SearchCallFinished(response, error, global_results_, cb);
+ },
+ global_search_cancellable_);
g_variant_builder_clear(&b);
}
-void Lens::Impl::Search(std::string const& search_string)
+void Lens::Impl::Search(std::string const& search_string,
+ SearchFinishedCallback const& cb)
{
LOG_DEBUG(logger) << "Searching '" << id_ << "' for '" << search_string << "'";
@@ -519,15 +493,17 @@ void Lens::Impl::Search(std::string const& search_string)
if (search_cancellable_) g_cancellable_cancel (search_cancellable_);
search_cancellable_ = g_cancellable_new ();
- results_variant_ = NULL;
last_search_string_ = search_string;
- proxy_->Call("Search",
- g_variant_new("(sa{sv})",
- search_string.c_str(),
- &b),
- sigc::mem_fun(this, &Lens::Impl::OnSearchFinished),
- search_cancellable_);
+ proxy_->CallBegin("Search",
+ g_variant_new("(sa{sv})",
+ search_string.c_str(),
+ &b),
+ [this, cb] (GVariant* response, glib::Error const& error)
+ {
+ SearchCallFinished(response, error, results_, cb);
+ },
+ search_cancellable_);
g_variant_builder_clear(&b);
}
@@ -883,14 +859,16 @@ Lens::~Lens()
delete pimpl;
}
-void Lens::GlobalSearch(std::string const& search_string)
+void Lens::GlobalSearch(std::string const& search_string,
+ SearchFinishedCallback const& cb)
{
- pimpl->GlobalSearch(search_string);
+ pimpl->GlobalSearch(search_string, cb);
}
-void Lens::Search(std::string const& search_string)
+void Lens::Search(std::string const& search_string,
+ SearchFinishedCallback const& cb)
{
- pimpl->Search(search_string);
+ pimpl->Search(search_string, cb);
}
void Lens::Activate(std::string const& uri)
diff --git a/UnityCore/Lens.h b/UnityCore/Lens.h
index 08a448107..cf35f752a 100644
--- a/UnityCore/Lens.h
+++ b/UnityCore/Lens.h
@@ -57,6 +57,7 @@ class Lens : public sigc::trackable, boost::noncopyable
public:
typedef std::shared_ptr<Lens> Ptr;
typedef std::map<std::string, unity::glib::Variant> Hints;
+ typedef std::function<void(Hints const&, glib::Error const&)> SearchFinishedCallback;
Lens(std::string const& id,
std::string const& dbus_name,
@@ -81,8 +82,8 @@ public:
virtual ~Lens();
- virtual void GlobalSearch(std::string const& search_string);
- virtual void Search(std::string const& search_string);
+ virtual void GlobalSearch(std::string const& search_string, SearchFinishedCallback const& cb = nullptr);
+ virtual void Search(std::string const& search_string, SearchFinishedCallback const& cb = nullptr);
virtual void Activate(std::string const& uri);
virtual void Preview(std::string const& uri);
virtual void ActivatePreviewAction(std::string const& action_id,
@@ -125,8 +126,6 @@ public:
/* Emitted when any of the models' swarm name changes, but collates the name
* changes into a single signal emission (when all are changed) */
sigc::signal<void> models_changed;
- sigc::signal<void, Hints const&> search_finished;
- sigc::signal<void, Hints const&> global_search_finished;
sigc::signal<void, std::string const&, HandledType, Hints const&> activated;
sigc::signal<void, std::string const&, Preview::Ptr const&> preview_ready;
diff --git a/dash/DashView.cpp b/dash/DashView.cpp
index e941befe5..8450089c0 100644
--- a/dash/DashView.cpp
+++ b/dash/DashView.cpp
@@ -107,9 +107,14 @@ DashView::DashView()
Relayout();
home_lens_->AddLenses(lenses_);
- home_lens_->search_finished.connect(sigc::mem_fun(this, &DashView::OnGlobalSearchFinished));
lens_bar_->Activate("home.lens");
+ // we will special case when applications lens finishes global search
+ // because we want to be able to launch applications immediately
+ // without waiting for the search finished signal which will
+ // be delayed by all the lenses we're searching
+ home_lens_->lens_search_finished.connect(sigc::mem_fun(this, &DashView::OnAppsGlobalSearchFinished));
+
// We are interested in the color of the desktop background.
ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &DashView::OnBGColorChanged));
@@ -893,6 +898,7 @@ void DashView::OnSearchChanged(std::string const& search_string)
{
search_in_progress_ = true;
// it isn't guaranteed that we get a SearchFinished signal, so we need
+ // FIXME: it is now actually!!
// to make sure this isn't set even though we aren't doing any search
// 250ms for the Search method call, rest for the actual search
searching_timeout_.reset(new glib::Timeout(500, [&] () {
@@ -914,7 +920,8 @@ void DashView::OnLiveSearchReached(std::string const& search_string)
LOG_DEBUG(logger) << "Live search reached: " << search_string;
if (active_lens_view_)
{
- active_lens_view_->PerformSearch(search_string);
+ active_lens_view_->PerformSearch(search_string,
+ sigc::mem_fun(this, &DashView::OnSearchFinished));
}
}
@@ -932,7 +939,6 @@ void DashView::OnLensAdded(Lens::Ptr& lens)
lens_views_[lens->id] = view;
lens->activated.connect(sigc::mem_fun(this, &DashView::OnUriActivatedReply));
- lens->search_finished.connect(sigc::mem_fun(this, &DashView::OnSearchFinished));
lens->connected.changed.connect([&] (bool value)
{
std::string const& search_string = search_bar_->search_string;
@@ -940,7 +946,8 @@ void DashView::OnLensAdded(Lens::Ptr& lens)
&& !search_string.empty())
{
// force a (global!) search with the correct string
- lens->GlobalSearch(search_bar_->search_string);
+ lens->GlobalSearch(search_bar_->search_string,
+ sigc::mem_fun(this, &DashView::OnSearchFinished));
}
});
@@ -950,16 +957,6 @@ void DashView::OnLensAdded(Lens::Ptr& lens)
LOG_DEBUG(logger) << "Got preview for: " << uri;
preview_state_machine_.ActivatePreview(model); // this does not immediately display a preview - we now wait.
});
-
- // global search done is handled by the home lens, no need to connect to it
- // BUT, we will special case global search finished coming from
- // the applications lens, because we want to be able to launch applications
- // immediately without waiting for the search finished signal which will
- // be delayed by all the lenses we're searching
- if (id == "applications.lens")
- {
- lens->global_search_finished.connect(sigc::mem_fun(this, &DashView::OnAppsGlobalSearchFinished));
- }
}
void DashView::OnLensBarActivated(std::string const& id)
@@ -1006,12 +1003,13 @@ void DashView::OnLensBarActivated(std::string const& id)
QueueDraw();
}
-void DashView::OnSearchFinished(Lens::Hints const& hints)
+void DashView::OnSearchFinished(Lens::Hints const& hints, glib::Error const& err)
{
hide_message_delay_.reset();
if (active_lens_view_ == NULL) return;
+ // FIXME: bind the lens_view in PerformSearch
active_lens_view_->CheckNoResults(hints);
std::string const& search_string = search_bar_->search_string;
@@ -1024,15 +1022,15 @@ void DashView::OnSearchFinished(Lens::Hints const& hints)
}
}
-void DashView::OnGlobalSearchFinished(Lens::Hints const& hints)
+void DashView::OnGlobalSearchFinished(Lens::Hints const& hints, glib::Error const& error)
{
if (active_lens_view_ == home_view_)
- OnSearchFinished(hints);
+ OnSearchFinished(hints, error);
}
-void DashView::OnAppsGlobalSearchFinished(Lens::Hints const& hints)
+void DashView::OnAppsGlobalSearchFinished(Lens::Ptr const& lens)
{
- if (active_lens_view_ == home_view_)
+ if (active_lens_view_ == home_view_ && lens->id() == "applications.lens")
{
/* HACKITY HACK! We're resetting the state of search_in_progress when
* doing searches in the home lens and we get results from apps lens.
diff --git a/dash/DashView.h b/dash/DashView.h
index 7a1dca40d..f0589b275 100644
--- a/dash/DashView.h
+++ b/dash/DashView.h
@@ -100,9 +100,9 @@ private:
void OnLiveSearchReached(std::string const& search_string);
void OnLensAdded(Lens::Ptr& lens);
void OnLensBarActivated(std::string const& id);
- void OnSearchFinished(Lens::Hints const& hints);
- void OnGlobalSearchFinished(Lens::Hints const& hints);
- void OnAppsGlobalSearchFinished(Lens::Hints const& hints);
+ void OnSearchFinished(Lens::Hints const& hints, glib::Error const& error);
+ void OnGlobalSearchFinished(Lens::Hints const& hints, glib::Error const& error);
+ void OnAppsGlobalSearchFinished(Lens::Ptr const& lens);
void OnUriActivated(ResultView::ActivateType type, std::string const& uri, GVariant* data, std::string const& unique_id);
void OnUriActivatedReply(std::string const& uri, HandledType type, Lens::Hints const&);
bool DoFallbackActivation(std::string const& uri);
diff --git a/dash/LensView.cpp b/dash/LensView.cpp
index c75f863ca..76cac5177 100755
--- a/dash/LensView.cpp
+++ b/dash/LensView.cpp
@@ -604,10 +604,10 @@ void LensView::HideResultsMessage()
}
}
-void LensView::PerformSearch(std::string const& search_query)
+void LensView::PerformSearch(std::string const& search_query, Lens::SearchFinishedCallback const& cb)
{
search_string_ = search_query;
- lens_->Search(search_query);
+ lens_->Search(search_query, cb);
}
std::string LensView::get_search_string() const
@@ -663,7 +663,7 @@ void LensView::OnViewTypeChanged(ViewType view_type)
if (view_type != HIDDEN && initial_activation_)
{
/* We reset the lens for ourselves, in case this is a restart or something */
- lens_->Search(search_string_);
+ lens_->Search(search_string_, [] (Lens::Hints const&, glib::Error const&) {});
initial_activation_ = false;
}
diff --git a/dash/LensView.h b/dash/LensView.h
index 71da4c9df..47cbbf72a 100644
--- a/dash/LensView.h
+++ b/dash/LensView.h
@@ -70,7 +70,7 @@ public:
sigc::signal<void, ResultView::ActivateType, std::string const&, GVariant*, std::string const&> uri_activated;
- void PerformSearch(std::string const& search_query);
+ void PerformSearch(std::string const& search_query, Lens::SearchFinishedCallback const& cb);
void CheckNoResults(Lens::Hints const& hints);
void CheckCategoryExpansion();
void HideResultsMessage();
diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp
index fe4d67699..f2a4dfef1 100644
--- a/dash/ResultViewGrid.cpp
+++ b/dash/ResultViewGrid.cpp
@@ -777,7 +777,7 @@ std::tuple<int, int> ResultViewGrid::GetResultPosition(const unsigned int& index
*/
bool ResultViewGrid::DndSourceDragBegin()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
unsigned num_results = GetNumResults();
unsigned drag_index = GetIndexAtPosition(last_mouse_down_x_, last_mouse_down_y_);
@@ -929,7 +929,7 @@ const char* ResultViewGrid::DndSourceGetDataForType(const char* type, int* size,
void ResultViewGrid::DndSourceDragFinished(nux::DndAction result)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
UnReference();
last_mouse_down_x_ = -1;
last_mouse_down_y_ = -1;
diff --git a/debian/changelog b/debian/changelog
index 112343668..8de67756c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@ unity (6.10.0-0ubuntu3) UNRELEASED; urgency=low
- adding libgtest-dev and google-mock build-dep now that there are in main
(LP: #1076763)
+ [ bschaefer ]
+ * Ported to nux 4.0
+
-- Michael Terry <mterry@ubuntu.com> Tue, 06 Nov 2012 10:52:43 -0500
unity (6.10.0-0ubuntu2) quantal-proposed; urgency=low
diff --git a/debian/control b/debian/control
index 6f90dc184..94f496090 100644
--- a/debian/control
+++ b/debian/control
@@ -27,7 +27,7 @@ Build-Depends: cmake,
libunity-misc-dev (>= 4.0.4),
libgrail-dev (>= 1.0.20),
libxcb-icccm4-dev,
- libnux-3.0-dev (>= 3.8.0),
+ libnux-4.0-dev (>= 4.0.0),
compiz-dev (>= 1:0.9.8.4),
libcompizconfig0-dev (>= 1:0.9.8.0),
xsltproc,
@@ -147,7 +147,7 @@ Depends: ${misc:Depends},
libunity-core-6.0-5 (= ${binary:Version}),
libglib2.0-dev,
libsigc++-2.0-dev,
- libnux-3.0-dev (>= 3.0.0),
+ libnux-4.0-dev (>= 4.0.0),
libunity-dev (>= 4.0.0~),
libdee-dev,
Description: Core library for the Unity interface - development files
diff --git a/debian/rules b/debian/rules
index 036ef78bb..7a6538d49 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,6 +4,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
gles2_architectures := armel armhf
DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
@@ -14,7 +15,7 @@ export CXX=g++-4.6
CFLAGS=$(shell echo $$CFLAGS | sed -e 's/\-Wall//')
CORE_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+CORE_ABIVERSION[[:space:]]+//p' /usr/include/compiz/core/abiversion.h )
-NUX_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+NUX_ABIVERSION[[:space:]]+//p' /usr/include/Nux-3.0/Nux/ABI.h )
+NUX_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+NUX_ABIVERSION[[:space:]]+//p' /usr/include/Nux-4.0/Nux/ABI.h )
LIBUNITY_PRIVATE := $(shell pkg-config --libs-only-L unity-protocol-private | sed -e 's/-L\(.*\)/\1/' )
@@ -50,7 +51,7 @@ override_dh_shlibdeps:
dh_shlibdeps -l$(LIBUNITY_PRIVATE) -O--parallel
override_dh_auto_test:
- echo "not working right now"
+ make -C obj-$(DEB_HOST_GNU_TYPE) check-headless
%:
dh $@ --with translations,quilt,python2,migrations --parallel
diff --git a/hud/HudController.cpp b/hud/HudController.cpp
index b7c11bcf0..484b1ce9f 100644
--- a/hud/HudController.cpp
+++ b/hud/HudController.cpp
@@ -339,7 +339,7 @@ void Controller::ShowHud()
auto view = static_cast<BamfView*>(l->data);
Window xid = bamf_window_get_xid(win);
- if (bamf_view_user_visible(view) && bamf_window_get_window_type(win) != BAMF_WINDOW_DOCK &&
+ if (bamf_view_is_user_visible(view) && bamf_window_get_window_type(win) != BAMF_WINDOW_DOCK &&
wm.IsWindowOnCurrentDesktop(xid) &&
wm.IsWindowVisible(xid) &&
std::find(unity_xids.begin(), unity_xids.end(), xid) == unity_xids.end())
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp
index bb60f8296..8fabbb8b5 100644
--- a/launcher/ApplicationLauncherIcon.cpp
+++ b/launcher/ApplicationLauncherIcon.cpp
@@ -70,7 +70,7 @@ ApplicationLauncherIcon::ApplicationLauncherIcon(BamfApplication* app)
tooltip_text = BamfName();
icon_name = (icon ? icon.Str() : DEFAULT_ICON);
- SetQuirk(Quirk::VISIBLE, bamf_view_user_visible(bamf_view));
+ SetQuirk(Quirk::VISIBLE, bamf_view_is_user_visible(bamf_view));
SetQuirk(Quirk::ACTIVE, bamf_view_is_active(bamf_view));
SetQuirk(Quirk::RUNNING, bamf_view_is_running(bamf_view));
@@ -245,7 +245,7 @@ void ApplicationLauncherIcon::ActivateLauncherIcon(ActionArg arg)
if (arg.source != ActionArg::SWITCHER)
{
auto bamf_view = glib::object_cast<BamfView>(_bamf_app);
- user_visible = bamf_view_user_visible(bamf_view);
+ user_visible = bamf_view_is_user_visible(bamf_view);
if (active)
{
@@ -392,7 +392,7 @@ std::vector<Window> ApplicationLauncherIcon::GetWindows(WindowFilterMask filter,
if ((monitor >= 0 && bamf_window_get_monitor(window) == monitor) || monitor < 0)
{
- if ((user_visible && bamf_view_user_visible(view)) || !user_visible)
+ if ((user_visible && bamf_view_is_user_visible(view)) || !user_visible)
{
guint32 xid = bamf_window_get_xid(window);
@@ -683,7 +683,7 @@ std::vector<Window> ApplicationLauncherIcon::GetFocusableWindows(ActionArg arg,
Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
bool urgent = bamf_view_is_urgent(view);
- bool user_visible = bamf_view_user_visible(view);
+ bool user_visible = bamf_view_is_user_visible(view);
if (any_urgent)
{
@@ -960,7 +960,7 @@ void ApplicationLauncherIcon::UnStick()
BamfView* view = BAMF_VIEW(_bamf_app.RawPtr());
bamf_view_set_sticky(view, false);
- SetQuirk(Quirk::VISIBLE, bamf_view_user_visible(view));
+ SetQuirk(Quirk::VISIBLE, bamf_view_is_user_visible(view));
if (bamf_view_is_closed(view))
Remove();
@@ -1300,7 +1300,7 @@ bool ApplicationLauncherIcon::OnShouldHighlightOnDrag(DndData const& dnd_data)
nux::DndAction ApplicationLauncherIcon::OnQueryAcceptDrop(DndData const& dnd_data)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
return ValidateUrisForLaunch(dnd_data).empty() ? nux::DNDACTION_NONE : nux::DNDACTION_COPY;
#else
return nux::DNDACTION_NONE;
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 593315ce8..54c3c8961 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -75,13 +75,13 @@ set (LAUNCHER_SOURCES
VolumeMonitorWrapper.cpp
)
-if(UNITY_ENABLE_X_ORG_SUPPORT)
+if (ENABLE_X_SUPPORT)
set (LAUNCHER_SOURCES
EdgeBarrierController.cpp
PointerBarrier.cpp
${LAUNCHER_SOURCES}
)
-endif()
+endif ()
add_library (launcher-lib STATIC ${LAUNCHER_SOURCES})
add_dependencies (launcher-lib unity-core-${UNITY_API_VERSION} unity-shared)
@@ -103,8 +103,8 @@ add_executable (launcher StandaloneLauncher.cpp)
add_dependencies (launcher launcher-lib)
target_link_libraries (launcher launcher-lib unity-shared unity-shared-standalone)
-if(UNITY_ENABLE_X_ORG_SUPPORT)
+if (ENABLE_X_SUPPORT)
add_executable (switcher StandaloneSwitcher.cpp)
add_dependencies (switcher switcher-lib launcher-lib)
target_link_libraries (switcher switcher-lib launcher-lib unity-shared unity-shared-standalone)
-endif()
+endif ()
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp
index 225049665..25d4588c4 100644
--- a/launcher/Launcher.cpp
+++ b/launcher/Launcher.cpp
@@ -106,7 +106,7 @@ Launcher::Launcher(nux::BaseWindow* parent,
nux::ObjectPtr<DNDCollectionWindow> const& collection_window,
NUX_FILE_LINE_DECL)
: View(NUX_FILE_LINE_PARAM)
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
, display(nux::GetGraphicsDisplay()->GetX11Display())
#else
, display(0)
@@ -188,7 +188,7 @@ Launcher::Launcher(nux::BaseWindow* parent,
wm.terminate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
wm.screen_viewport_switch_ended.connect(sigc::mem_fun(this, &Launcher::EnsureAnimation));
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
#endif
@@ -232,8 +232,8 @@ void Launcher::OnDisplayChanged(Display* display)
_collection_window->display = display;
}
-void
-Launcher::OnDragStart(const nux::GestureEvent &event)
+#ifdef NUX_GESTURES_SUPPORT
+void Launcher::OnDragStart(const nux::GestureEvent &event)
{
_drag_gesture_ongoing = true;
if (_hidden)
@@ -247,16 +247,14 @@ Launcher::OnDragStart(const nux::GestureEvent &event)
}
}
-void
-Launcher::OnDragUpdate(const nux::GestureEvent &event)
+void Launcher::OnDragUpdate(const nux::GestureEvent &event)
{
_drag_out_delta_x =
CLAMP(_drag_out_delta_x + event.GetDelta().x, 0.0f, DRAG_OUT_PIXELS);
EnsureAnimation();
}
-void
-Launcher::OnDragFinish(const nux::GestureEvent &event)
+void Launcher::OnDragFinish(const nux::GestureEvent &event)
{
if (_drag_out_delta_x >= DRAG_OUT_PIXELS - 90.0f)
_hide_machine.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, true);
@@ -266,6 +264,7 @@ Launcher::OnDragFinish(const nux::GestureEvent &event)
EnsureAnimation();
_drag_gesture_ongoing = false;
}
+#endif
void Launcher::AddProperties(GVariantBuilder* builder)
{
@@ -640,15 +639,27 @@ float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon::Ptr const& icon, str
float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr const& icon, struct timespec const& current) const
{
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
+ return 1.0f;
+
+ if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::STARTING))
+ return 1.0f;
+
struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::STARTING);
int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * STARTING_BLINK_LAMBDA), 0.0f, 1.0f);
double val = IsBackLightModeToggles() ? 3.0f : 4.0f;
- return 0.5f + (float)(std::cos(M_PI * val * starting_progress)) * 0.5f;
+ return 1.0f-(0.5f + (float)(std::cos(M_PI * val * starting_progress)) * 0.5f);
}
float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr const& icon, struct timespec const& current) const
{
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
+ return 1.0f;
+
+ if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::STARTING))
+ return 1.0f;
+
struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::STARTING);
int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), 0.0f, 1.0f);
@@ -659,7 +670,7 @@ float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr const& icon, st
icon->ResetQuirkTime(AbstractLauncherIcon::Quirk::STARTING);
}
- return 0.5f + (float)(std::cos(M_PI * (float)(MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f;
+ return 1.0f-(0.5f + (float)(std::cos(M_PI * (float)(MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f);
}
float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr const& icon, struct timespec const& current) const
@@ -1357,7 +1368,7 @@ int Launcher::GetMouseY() const
bool Launcher::OnUpdateDragManagerTimeout()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (!display())
return false;
@@ -1399,7 +1410,7 @@ bool Launcher::OnUpdateDragManagerTimeout()
void Launcher::DndTimeoutSetup()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (sources_.GetSource(DND_CHECK_TIMEOUT))
return;
@@ -2223,7 +2234,7 @@ void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_
if (GetActionState() == ACTION_NONE)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (nux::Abs(_dnd_delta_y) >= nux::Abs(_dnd_delta_x))
{
_launcher_drag_delta += _dnd_delta_y;
@@ -2298,7 +2309,7 @@ void Launcher::RecvMouseWheel(int x, int y, int wheel_delta, unsigned long butto
EnsureAnimation();
}
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
bool Launcher::HandleBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event)
{
@@ -2530,6 +2541,7 @@ void Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLaun
unity::graphics::PopOffscreenRenderTarget();
}
+#ifdef NUX_GESTURES_SUPPORT
nux::GestureDeliveryRequest Launcher::GestureEvent(const nux::GestureEvent &event)
{
switch(event.type)
@@ -2547,6 +2559,7 @@ nux::GestureDeliveryRequest Launcher::GestureEvent(const nux::GestureEvent &even
return nux::GestureDeliveryRequest::NONE;
}
+#endif
bool Launcher::DndIsSpecialRequest(std::string const& uri) const
{
@@ -2555,7 +2568,7 @@ bool Launcher::DndIsSpecialRequest(std::string const& uri) const
void Launcher::OnDNDDataCollected(const std::list<char*>& mimes)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
_dnd_data.Reset();
const std::string uri_list = "text/uri-list";
@@ -2602,7 +2615,7 @@ void Launcher::OnDNDDataCollected(const std::list<char*>& mimes)
void Launcher::ProcessDndEnter()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
SetStateMouseOverLauncher(true);
_dnd_data.Reset();
@@ -2616,7 +2629,7 @@ void Launcher::ProcessDndEnter()
void Launcher::DndReset()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
_dnd_data.Reset();
bool is_overlay_open = IsOverlayOpen();
@@ -2644,7 +2657,7 @@ void Launcher::DndReset()
void Launcher::DndHoveredIconReset()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
_drag_edge_touching = false;
SetActionState(ACTION_NONE);
@@ -2664,7 +2677,7 @@ void Launcher::DndHoveredIconReset()
void Launcher::ProcessDndLeave()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
SetStateMouseOverLauncher(false);
DndHoveredIconReset();
@@ -2673,7 +2686,7 @@ void Launcher::ProcessDndLeave()
void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (!_data_checked)
{
const std::string uri_list = "text/uri-list";
@@ -2805,7 +2818,7 @@ void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
void Launcher::ProcessDndDrop(int x, int y)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (_steal_drag)
{
for (auto const& uri : _dnd_data.Uris())
diff --git a/launcher/Launcher.h b/launcher/Launcher.h
index a66c0c7ce..99e8ca9d2 100644
--- a/launcher/Launcher.h
+++ b/launcher/Launcher.h
@@ -43,7 +43,7 @@
#include "unity-shared/UBusWrapper.h"
#include "SoftwareCenterLauncherIcon.h"
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
# include "PointerBarrier.h"
# include "EdgeBarrierController.h"
#endif
@@ -57,7 +57,7 @@ extern const char* window_title;
class AbstractLauncherIcon;
class Launcher : public unity::debug::Introspectable,
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
// TODO: abstract this into a more generic class.
public ui::EdgeBarrierSubscriber,
#endif
@@ -148,7 +148,10 @@ public:
void RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon::Ptr const& icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
+#ifdef NUX_GESTURES_SUPPORT
virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event);
+#endif
+
protected:
// Introspectable methods
std::string GetName() const;
@@ -193,11 +196,13 @@ private:
void OnOptionChanged();
void UpdateOptions(Options::Ptr options);
+#ifdef NUX_GESTURES_SUPPORT
void OnDragStart(const nux::GestureEvent &event);
void OnDragUpdate(const nux::GestureEvent &event);
void OnDragFinish(const nux::GestureEvent &event);
+#endif
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
bool HandleBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event);
#endif
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp
index f333a5d25..a23498101 100644
--- a/launcher/LauncherController.cpp
+++ b/launcher/LauncherController.cpp
@@ -114,7 +114,7 @@ Controller::Impl::Impl(Controller* parent)
, gdbus_connection_(nullptr)
, reg_id_(0)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
edge_barriers_.options = parent_->options();
#endif
@@ -200,7 +200,7 @@ void Controller::Impl::EnsureLaunchers(int primary, std::vector<nux::Geometry> c
int monitor = (num_launchers == 1) ? primary : i;
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (launchers[i]->monitor() != monitor)
{
edge_barriers_.Unsubscribe(launchers[i].GetPointer(), launchers[i]->monitor);
@@ -209,7 +209,7 @@ void Controller::Impl::EnsureLaunchers(int primary, std::vector<nux::Geometry> c
launchers[i]->monitor(monitor);
launchers[i]->Resize();
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor);
#endif
}
@@ -221,7 +221,7 @@ void Controller::Impl::EnsureLaunchers(int primary, std::vector<nux::Geometry> c
{
parent_->RemoveChild(launcher.GetPointer());
launcher->GetParent()->UnReference();
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
edge_barriers_.Unsubscribe(launcher.GetPointer(), launcher->monitor);
#endif
}
diff --git a/launcher/LauncherControllerPrivate.h b/launcher/LauncherControllerPrivate.h
index 253bfbb16..210cedeb0 100644
--- a/launcher/LauncherControllerPrivate.h
+++ b/launcher/LauncherControllerPrivate.h
@@ -28,7 +28,7 @@
#include "AbstractLauncherIcon.h"
#include "DeviceLauncherSection.h"
#include "DevicesSettingsImp.h"
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
#include "EdgeBarrierController.h"
#endif
#include "LauncherController.h"
@@ -129,7 +129,7 @@ public:
AbstractLauncherIcon::Ptr expo_icon_;
AbstractLauncherIcon::Ptr desktop_icon_;
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
ui::EdgeBarrierController edge_barriers_;
#endif
diff --git a/launcher/LauncherOptions.h b/launcher/LauncherOptions.h
index 0a29a5bb6..81b7aabec 100644
--- a/launcher/LauncherOptions.h
+++ b/launcher/LauncherOptions.h
@@ -24,7 +24,6 @@
#include <memory>
#include <vector>
#include <sigc++/sigc++.h>
-#include <core/core.h>
#include <Nux/Nux.h>
diff --git a/launcher/TrashLauncherIcon.cpp b/launcher/TrashLauncherIcon.cpp
index c6f86431e..6f90b2c9f 100644
--- a/launcher/TrashLauncherIcon.cpp
+++ b/launcher/TrashLauncherIcon.cpp
@@ -139,7 +139,7 @@ void TrashLauncherIcon::UpdateTrashIconCb(GObject* source,
nux::DndAction TrashLauncherIcon::OnQueryAcceptDrop(DndData const& dnd_data)
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
return nux::DNDACTION_MOVE;
#else
return nux::DNDACTION_NONE;
diff --git a/panel/PanelMenuView.cpp b/panel/PanelMenuView.cpp
index b783b54b9..97e6ed5ef 100644
--- a/panel/PanelMenuView.cpp
+++ b/panel/PanelMenuView.cpp
@@ -1314,7 +1314,7 @@ Window PanelMenuView::GetTopWindow() const
continue;
Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
- bool visible = bamf_view_user_visible(static_cast<BamfView*>(l->data));
+ bool visible = bamf_view_is_user_visible(static_cast<BamfView*>(l->data));
if (visible && IsValidWindow(xid))
{
diff --git a/plugins/unity-mt-grab-handles/CMakeLists.txt b/plugins/unity-mt-grab-handles/CMakeLists.txt
index 3020cf6a3..a9c7c694b 100644
--- a/plugins/unity-mt-grab-handles/CMakeLists.txt
+++ b/plugins/unity-mt-grab-handles/CMakeLists.txt
@@ -2,4 +2,4 @@ find_package (Compiz REQUIRED)
include (CompizPlugin)
-compiz_plugin (unitymtgrabhandles PKGDEPS nux-3.0>=3.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x)
+compiz_plugin (unitymtgrabhandles PKGDEPS nux-4.0>=4.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0b3b43d0b..567d9673b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -112,52 +112,73 @@ if (GTEST_SRC_DIR AND
# The actual test executable (xless) - do not put anything that requires X in here
- add_executable(test-gtest-xless
- test_main_xless.cpp
- test_animator.cpp
- test_launcher_model.cpp
- test_glib_object.cpp
- test_glib_object_utils.cpp
- test_glib_object_utils.h
- test_glib_signals.cpp
- test_glib_signals_utils.cpp
- test_glib_signals_utils.h
- test_glib_source.cpp
- test_glib_variant.cpp
- test_grabhandle.cpp
- test_desktop_utilities.cpp
- test_hud_private.cpp
- test_indicator.cpp
- test_indicator_appmenu.cpp
- test_indicator_entry.cpp
- test_indicators.cpp
- test_introspection.cpp
- test_favorite_store.cpp
- test_favorite_store_gsettings.cpp
- test_favorite_store_private.cpp
- test_home_lens.cpp
- test_launcher_entry_remote.cpp
- test_layout_system.cpp
- test_model_iterator.cpp
- test_pointer_barrier.cpp
- test_previews.cpp
- test_shortcut_model.cpp
- test_shortcut_private.cpp
- test_showdesktop_handler.cpp
- test_ubus.cpp
- test_unityshell_private.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
- ${UNITY_SRC}/DebugDBusInterface.cpp
- ${UNITY_SRC}/XPathQueryPart.cpp
- ${UNITY_SRC}/UnityshellPrivate.cpp
- ${UNITY_SRC}/UnityShowdesktopHandler.cpp
- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
- ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp
- )
- target_link_libraries(test-gtest-xless gtest unity-shared unity-shared-standalone ${GMOCK_LIB} ${GMOCK_MAIN_LIB} ${LIBS} launcher-lib shortcuts-lib hud-lib)
+ set (GTEST_XLESS_SOURCES
+ test_main_xless.cpp
+ test_animator.cpp
+ test_launcher_model.cpp
+ test_glib_object.cpp
+ test_glib_object_utils.cpp
+ test_glib_object_utils.h
+ test_glib_signals.cpp
+ test_glib_signals_utils.cpp
+ test_glib_signals_utils.h
+ test_glib_source.cpp
+ test_glib_variant.cpp
+ test_grabhandle.cpp
+ test_desktop_utilities.cpp
+ test_indicator.cpp
+ test_indicator_appmenu.cpp
+ test_indicator_entry.cpp
+ test_indicators.cpp
+ test_introspection.cpp
+ test_favorite_store.cpp
+ test_favorite_store_gsettings.cpp
+ test_favorite_store_private.cpp
+ test_home_lens.cpp
+ test_launcher_entry_remote.cpp
+ test_layout_system.cpp
+ test_model_iterator.cpp
+ test_previews.cpp
+ test_ubus.cpp
+ test_unityshell_private.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
+ ${UNITY_SRC}/UnityshellPrivate.cpp
+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp
+ )
+
+ set (GTEST_XLESS_LIBS
+ gtest
+ unity-shared
+ unity-shared-standalone
+ launcher-lib
+ ${GMOCK_LIB}
+ ${GMOCK_MAIN_LIB}
+ ${LIBS}
+ )
+
+ if (ENABLE_X_SUPPORT)
+ set (GTEST_XLESS_SOURCES
+ test_hud_private.cpp
+ test_pointer_barrier.cpp
+ test_shortcut_model.cpp
+ test_shortcut_private.cpp
+ ${LAUNCHER_SOURCES}
+ )
+ set (GTEST_XLESS_LIBS
+ ${GTEST_XLESS_LIBS}
+ shortcuts-lib
+ hud-lib
+ )
+ endif ()
+
+ add_executable(test-gtest-xless ${GTEST_XLESS_SOURCES})
+
+ target_link_libraries(test-gtest-xless ${GTEST_XLESS_LIBS})
+
add_test(UnityGTestXless test-gtest-xless)
add_dependencies(test-gtest-xless unity-core-${UNITY_API_VERSION} gtest)
@@ -180,6 +201,7 @@ if (GTEST_SRC_DIR AND
add_test(UnityGTestDBus test-gtest-dbus)
add_dependencies(test-gtest-dbus unity-core-${UNITY_API_VERSION} test-gtest-service gtest)
+if (ENABLE_X_SUPPORT)
# Tests that require X
add_executable(test-gtest
test_main.cpp
@@ -216,6 +238,7 @@ if (GTEST_SRC_DIR AND
test_shortcut_controller.cpp
test_single_monitor_launcher_icon.cpp
test_expo_launcher_icon.cpp
+ test_showdesktop_handler.cpp
test_switcher_controller.cpp
test_switcher_model.cpp
test_texture_cache.cpp
@@ -228,17 +251,20 @@ if (GTEST_SRC_DIR AND
bamf-mock-application.c
gmockmount.c
gmockvolume.c
+ ${UNITY_SRC}/UnityShowdesktopHandler.cpp
${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp
)
target_link_libraries(test-gtest gtest gmock unity-shared ${LIBS} launcher-lib unity-shared-standalone shortcuts-lib previews-lib hud-lib switcher-lib dash-lib panel-lib)
add_test(UnityGTest test-gtest)
add_dependencies(test-gtest unity-core-${UNITY_API_VERSION} gtest gmock)
-
+endif (ENABLE_X_SUPPORT)
endif (GTEST_SRC_DIR AND
GMOCK_LIB AND
GMOCK_MAIN_LIB)
-add_subdirectory (test-gestures)
+if(ENABLE_X_SUPPORT)
+ add_subdirectory (test-gestures)
+endif()
#
# check target
@@ -246,10 +272,12 @@ add_subdirectory (test-gestures)
set (TEST_RESULT_DIR ${CMAKE_BINARY_DIR}/tests)
set (TEST_RESULT_XML ${TEST_RESULT_DIR}/test-results.xml)
set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html)
-set (GTEST_TEST_COMMAND ./test-gtest)
+if (ENABLE_X_SUPPORT)
+ set (GTEST_TEST_COMMAND ./test-gtest)
+ set (GTEST_TEST_COMMAND_GESTURES ./test-gestures/test-gestures)
+endif (ENABLE_X_SUPPORT)
set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless)
set (GTEST_TEST_COMMAND_DBUS dbus-test-runner --task ./test-gtest-service --task ./test-gtest-dbus)
-set (GTEST_TEST_COMMAND_GESTURES ./test-gestures/test-gestures)
set (TEST_COMMAND
gtester --verbose -k --g-fatal-warnings -o=${TEST_RESULT_XML} ./test-unit
@@ -266,10 +294,16 @@ set (TEST_COMMAND_HEADLESS
&& echo "Warning, DBus test cases are disabled!!")
if (GTEST_SRC_DIR)
- add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-xless test-gtest-dbus test-gestures)
- add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gestures)
+ if (ENABLE_X_SUPPORT)
+ add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-xless test-gtest-dbus test-gestures)
+ add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gestures)
+ add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless)
+ else ()
+ add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest-xless test-gtest-dbus)
+ add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus)
+ add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest-xless)
+ endif ()
add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML})
- add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless)
else (GTEST_SRC_DIR)
add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit)
endif (GTEST_SRC_DIR)
diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py
index 2ccb3b580..4623990be 100644
--- a/tests/autopilot/unity/tests/test_hud.py
+++ b/tests/autopilot/unity/tests/test_hud.py
@@ -669,6 +669,9 @@ class HudVisualTests(HudTestsBase):
"""
initial_workspace = self.workspace.current_workspace
self.addCleanup(self.workspace.switch_to, initial_workspace)
+ self.window_manager.enter_show_desktop()
+ self.addCleanup(self.window_manager.leave_show_desktop)
+
self.workspace.switch_to(0)
calc = self.start_app("Calculator")
self.assertTrue(calc.is_active)
diff --git a/tests/test_gdbus_proxy.cpp b/tests/test_gdbus_proxy.cpp
index de9675bf1..3e46913c3 100644
--- a/tests/test_gdbus_proxy.cpp
+++ b/tests/test_gdbus_proxy.cpp
@@ -3,71 +3,51 @@
#include <UnityCore/GLibWrapper.h>
#include <UnityCore/GLibDBusProxy.h>
+#include "test_utils.h"
+
using namespace std;
using namespace unity;
namespace
{
-GMainLoop* loop_ = NULL;
-glib::DBusProxy* proxy = NULL;
-
class TestGDBusProxy: public ::testing::Test
{
public:
TestGDBusProxy()
- : connected_result(false)
- , got_signal_return(false)
+ : got_signal_return(false)
, got_result_return(false)
+ , proxy("com.canonical.Unity.Test",
+ "/com/canonical/gdbus_wrapper",
+ "com.canonical.gdbus_wrapper")
{
}
- bool connected_result;
+
bool got_signal_return;
bool got_result_return;
+ glib::DBusProxy proxy;
};
-TEST_F(TestGDBusProxy, TestConstruction)
+class TestGDBusProxyInvalidService: public ::testing::Test
{
- loop_ = g_main_loop_new(NULL, FALSE);
- proxy = new glib::DBusProxy("com.canonical.Unity.Test",
- "/com/canonical/gdbus_wrapper",
- "com.canonical.gdbus_wrapper");
- // performs a check on the proxy, if the proxy is connected, report a sucess
- auto timeout_check = [] (gpointer data) -> gboolean
+public:
+ TestGDBusProxyInvalidService()
+ : got_result_return(false)
+ , proxy("com.canonical.Unity.Test.NonExistant",
+ "/com/canonical/gdbus_wrapper",
+ "com.canonical.gdbus_wrapper")
{
- TestGDBusProxy* self = static_cast<TestGDBusProxy*>(data);
- if (proxy->IsConnected())
- {
- self->connected_result = true;
- g_main_loop_quit(loop_);
- return FALSE;
- }
- else
- {
- self->connected_result = false;
- return TRUE;
- }
- };
-
+ }
- // if the proxy is not connected when this lambda runs, fail.
- auto timeout_bailout = [] (gpointer data) -> gboolean
- {
- TestGDBusProxy* self = static_cast<TestGDBusProxy*>(data);
- // reached timeout, failed testing
- self->connected_result = false;
- g_main_loop_quit(loop_);
- return FALSE;
- };
-
- guint timeout_source = g_timeout_add(1000, timeout_check, this); // check once a second
- guint bailout_source = g_timeout_add(10000, timeout_bailout, this); // bail out after ten
-
- g_main_loop_run(loop_);
- g_source_remove(timeout_source);
- g_source_remove(bailout_source);
-
- EXPECT_EQ(connected_result, true);
+ bool got_result_return;
+ glib::DBusProxy proxy;
+};
+
+TEST_F(TestGDBusProxy, TestConstruction)
+{
+ EXPECT_FALSE(proxy.IsConnected());
+ Utils::WaitUntil(sigc::mem_fun(proxy, &glib::DBusProxy::IsConnected));
+ EXPECT_TRUE(proxy.IsConnected());
}
TEST_F(TestGDBusProxy, TestMethodReturn)
@@ -75,23 +55,19 @@ TEST_F(TestGDBusProxy, TestMethodReturn)
// Our service is setup so that if you call the TestMethod method, it will emit the TestSignal method
// with whatever string you pass in
gchar* expected_return = (gchar *)"TestStringTestString☻☻☻"; // cast to get gcc to shut up
- gchar* returned_result = g_strdup("Not equal");
- gchar* returned_signal = g_strdup("Not equal");
+ std::string returned_signal("Not equal");
+ std::string returned_result("Not equal");
- GVariant* param_value = g_variant_new_string(expected_return);
- GVariant* parameters = g_variant_new_tuple(&param_value, 1);
+ GVariant* parameters = g_variant_new("(s)", expected_return);
// signal callback
auto signal_connection = [&](GVariant *variant)
{
if (variant != nullptr)
{
- g_free(returned_signal);
- returned_signal = g_strdup(g_variant_get_string(g_variant_get_child_value(variant, 0), NULL));
+ returned_signal = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
}
got_signal_return = true;
- if (got_signal_return && got_result_return)
- g_main_loop_quit(loop_);
};
// method callback
@@ -99,37 +75,124 @@ TEST_F(TestGDBusProxy, TestMethodReturn)
{
if (variant != nullptr)
{
- g_free(returned_result);
- returned_result = g_strdup(g_variant_get_string(g_variant_get_child_value(variant, 0), NULL));
+ returned_result = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
}
got_result_return = true;
- if (got_signal_return && got_result_return)
- g_main_loop_quit(loop_);
};
-
- auto timeout_bailout = [] (gpointer data) -> gboolean // bail out after 10 seconds
+
+ Utils::WaitUntil(sigc::mem_fun(proxy, &glib::DBusProxy::IsConnected));
+ EXPECT_TRUE(proxy.IsConnected()); // fail if we are not connected
+ proxy.Connect("TestSignal", signal_connection);
+ proxy.Call("TestMethod", parameters, method_connection);
+
+ Utils::WaitUntil(got_result_return);
+ Utils::WaitUntil(got_signal_return);
+
+ EXPECT_EQ(returned_result, expected_return);
+ EXPECT_EQ(returned_signal, expected_return);
+}
+
+TEST_F(TestGDBusProxy, TestCancelling)
+{
+ std::string call_return;
+ // method callback
+ auto method_connection = [&](GVariant *variant)
{
- g_main_loop_quit(loop_);
- return FALSE;
+ if (variant != nullptr)
+ {
+ call_return = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
+ }
+
+ got_result_return = true;
};
-
- guint bailout_source = g_timeout_add(10000, timeout_bailout, this);
- EXPECT_EQ(proxy->IsConnected(), true); // fail if we are not connected
- proxy->Connect("TestSignal", signal_connection);
- proxy->Call("TestMethod", parameters, method_connection);
+ EXPECT_FALSE(proxy.IsConnected()); // we shouldn't be connected yet
+ glib::Object<GCancellable> cancellable(g_cancellable_new());
+ // but this has to work eitherway
+ proxy.Call("TestMethod", g_variant_new("(s)", "TestStringTestString"),
+ method_connection, cancellable);
-
- // next check we get 30 entries from this specific known callback
- g_main_loop_run(loop_);
+ // this could mostly cause the next test to fail
+ g_cancellable_cancel(cancellable);
+ EXPECT_FALSE(got_result_return);
+}
+
+TEST_F(TestGDBusProxy, TestAcquiring)
+{
+ const int NUM_REQUESTS = 10;
+ int completed = 0;
+ std::string call_return;
+ // method callback
+ auto method_connection = [&](GVariant* variant, glib::Error const& err)
+ {
+ if (variant != nullptr)
+ {
+ call_return = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
+ }
+
+ if (++completed >= NUM_REQUESTS) got_result_return = true;
+ };
+
+ EXPECT_FALSE(proxy.IsConnected()); // we shouldn't be connected yet
+ for (int i = 0; i < NUM_REQUESTS; i++)
+ {
+ proxy.CallBegin("TestMethod", g_variant_new("(s)", "TestStringTestString"),
+ method_connection, nullptr);
+ Utils::WaitForTimeoutMSec(150);
+ }
+ Utils::WaitUntil(got_result_return);
+}
+
+TEST_F(TestGDBusProxyInvalidService, TestTimeouting)
+{
+ std::string call_return;
+ // method callback
+ auto method_connection = [&](GVariant* variant, glib::Error const& err)
+ {
+ if (variant != nullptr)
+ {
+ call_return = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
+ }
+
+ got_result_return = true;
+ };
+
+ EXPECT_FALSE(proxy.IsConnected()); // we shouldn't be connected yet
+
+ proxy.CallBegin("TestMethod", g_variant_new("(s)", "TestStringTestString"),
+ method_connection, nullptr, (GDBusCallFlags) 0, 100);
+ // want to test timeout, if non-blocking sleep was used, the proxy would
+ // be acquired (with a dbus error)
+ g_usleep(110000);
+
+ Utils::WaitUntil(got_result_return);
+ EXPECT_EQ(call_return, "");
+}
+
+TEST_F(TestGDBusProxy, TestMethodCall)
+{
+ std::string call_return;
+ // method callback
+ auto method_connection = [&](GVariant *variant)
+ {
+ if (variant != nullptr)
+ {
+ call_return = g_variant_get_string(g_variant_get_child_value(variant, 0), NULL);
+ }
- EXPECT_EQ(g_strcmp0(expected_return, returned_result), 0);
- EXPECT_EQ(g_strcmp0(expected_return, returned_signal), 0);
+ got_result_return = true;
+ };
- g_free(returned_result);
- g_free(returned_signal);
- g_source_remove(bailout_source);
+ EXPECT_FALSE(proxy.IsConnected()); // we shouldn't be connected yet
+ // but this has to work eitherway
+ proxy.Call("TestMethod", g_variant_new("(s)", "TestStringTestString"),
+ method_connection);
+
+ Utils::WaitUntil(got_result_return);
+
+ EXPECT_TRUE(proxy.IsConnected());
+ EXPECT_EQ("TestStringTestString", call_return);
}
diff --git a/tests/test_home_lens.cpp b/tests/test_home_lens.cpp
index 2cbd9d53a..3bbae4f31 100644
--- a/tests/test_home_lens.cpp
+++ b/tests/test_home_lens.cpp
@@ -10,6 +10,7 @@
#include <sigc++/trackable.h>
#include <UnityCore/GLibWrapper.h>
+#include <UnityCore/GLibSource.h>
#include <UnityCore/Variant.h>
#include <UnityCore/HomeLens.h>
#include <UnityCore/Lens.h>
@@ -30,14 +31,6 @@ namespace
class StaticTestLens;
-typedef struct {
- StaticTestLens* lens;
- gchar* search_string;
-} LensSearchClosure;
-
-static gboolean dispatch_global_search(gpointer userdata);
-
-
/*
* Mock Lens instance that does not use DBus. The default search does like this:
* For input "bar" output:
@@ -134,22 +127,28 @@ public:
}
g_free(row_buf);
-
- global_search_finished.emit(Hints());
}
- void GlobalSearch(string const& search_string)
+ void GlobalSearch(string const& search_string,
+ SearchFinishedCallback const& cb)
{
/* Dispatch search async, because that's what it'd normally do */
- LensSearchClosure* closure = g_new0(LensSearchClosure, 1);
- closure->lens = this;
- closure->search_string = g_strdup(search_string.c_str());
- g_idle_add(dispatch_global_search, closure);
+ source_manager_.Add(new glib::Idle([this, search_string, cb] ()
+ {
+ DoGlobalSearch(search_string);
+ cb(Lens::Hints(), glib::Error());
+ return false;
+ }));
}
- void Search(string const& search_string)
+ void Search(string const& search_string, SearchFinishedCallback const& cb)
{
-
+ /* Dispatch search async, because that's what it'd normally do */
+ source_manager_.Add(new glib::Idle([search_string, cb] ()
+ {
+ cb(Lens::Hints(), glib::Error());
+ return false;
+ }));
}
void Activate(string const& uri)
@@ -181,20 +180,9 @@ private:
string results_base_name_;
int num_results_;
bool provides_personal_results_;
+ glib::SourceManager source_manager_;
};
-static gboolean dispatch_global_search(gpointer userdata)
-{
- LensSearchClosure* closure = (LensSearchClosure*) userdata;
-
- closure->lens->DoGlobalSearch(closure->search_string);
-
- g_free(closure->search_string);
- g_free(closure);
-
- return FALSE;
-}
-
/*
* Mock Lenses class
*/
@@ -408,10 +396,8 @@ TEST(TestHomeLens, TestOneSearch)
home_lens_.AddLenses(lenses_);
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -473,10 +459,8 @@ TEST(TestHomeLens, TestOrderingAfterSearch)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -523,10 +507,8 @@ TEST(TestHomeLens, TestOrderingWithExactAppsMatch)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -570,10 +552,8 @@ TEST(TestHomeLens, TestOrderingWithoutExactAppsMatch)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -623,10 +603,8 @@ TEST(TestHomeLens, TestOrderingByNumResults)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -691,10 +669,8 @@ TEST(TestHomeLens, TestPersonalResultsFirst)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
@@ -752,10 +728,8 @@ TEST(TestHomeLens, TestNonPersonalCategoriesBeforeEmpty)
order_changed = true;
});
- home_lens_.Search("ape");
-
bool finished = false;
- home_lens_.search_finished.connect([&finished] (Lens::Hints const& hints)
+ home_lens_.Search("ape", [&finished] (Lens::Hints const&, glib::Error const&)
{
finished = true;
});
diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp
index 2b5827c49..d41a1ece3 100644
--- a/tests/test_launcher.cpp
+++ b/tests/test_launcher.cpp
@@ -80,65 +80,22 @@ public:
return AbstractLauncherIcon::Ptr();
}
- float IconBackgroundIntensity(AbstractLauncherIcon::Ptr const& icon, timespec const& current) const
- {
- return Launcher::IconBackgroundIntensity(icon, current);
- }
-
- void StartIconDrag(AbstractLauncherIcon::Ptr const& icon)
- {
- Launcher::StartIconDrag(icon);
- }
-
- void ShowDragWindow()
- {
- Launcher::ShowDragWindow();
- }
-
- void EndIconDrag()
- {
- Launcher::EndIconDrag();
- }
-
- void UpdateDragWindowPosition(int x, int y)
- {
- Launcher::UpdateDragWindowPosition(x, y);
- }
-
- void HideDragWindow()
- {
- Launcher::HideDragWindow();
- }
-
- void ResetMouseDragState()
- {
- Launcher::ResetMouseDragState();
- }
-
- bool DndIsSpecialRequest(std::string const& uri) const
- {
- return Launcher::DndIsSpecialRequest(uri);
- }
-
- int GetDragIconPosition() const
- {
- return _drag_icon_position;
- }
-
- void ProcessDndEnter()
- {
- Launcher::ProcessDndEnter();
- }
-
- void ProcessDndLeave()
- {
- Launcher::ProcessDndLeave();
- }
-
- void ProcessDndMove(int x, int y, std::list<char*> mimes)
- {
- Launcher::ProcessDndMove(x, y, mimes);
- }
+ using Launcher::IconBackgroundIntensity;
+ using Launcher::StartIconDrag;
+ using Launcher::ShowDragWindow;
+ using Launcher::EndIconDrag;
+ using Launcher::UpdateDragWindowPosition;
+ using Launcher::HideDragWindow;
+ using Launcher::ResetMouseDragState;
+ using Launcher::DndIsSpecialRequest;
+ using Launcher::ProcessDndEnter;
+ using Launcher::ProcessDndLeave;
+ using Launcher::ProcessDndMove;
+ using Launcher::ProcessDndDrop;
+ using Launcher::_drag_icon_position;
+
+ using Launcher::IconStartingBlinkValue;
+ using Launcher::IconStartingPulseValue;
void FakeProcessDndMove(int x, int y, std::list<std::string> uris)
{
@@ -158,11 +115,6 @@ public:
_dnd_hovered_icon = MouseIconIntersection(x, y);
}
-
- void ProcessDndDrop(int x, int y)
- {
- Launcher::ProcessDndDrop(x, y);
- }
};
TestLauncher()
@@ -354,7 +306,7 @@ TEST_F(TestLauncher, DragLauncherIconSavesIconOrderIfPositionHasChanged)
// Start dragging icon2
launcher_->StartIconDrag(icon2);
launcher_->ShowDragWindow();
- ASSERT_EQ(launcher_->GetDragIconPosition(), model_->IconIndex(icon2));
+ ASSERT_EQ(launcher_->_drag_icon_position, model_->IconIndex(icon2));
// Moving icon2 at the end
auto const& center3 = icon3->GetCenter(launcher_->monitor());
@@ -364,7 +316,7 @@ TEST_F(TestLauncher, DragLauncherIconSavesIconOrderIfPositionHasChanged)
model_->saved.connect([&model_saved] { model_saved = true; });
EXPECT_CALL(*icon2, Stick(false));
- ASSERT_NE(launcher_->GetDragIconPosition(), model_->IconIndex(icon2));
+ ASSERT_NE(launcher_->_drag_icon_position, model_->IconIndex(icon2));
launcher_->EndIconDrag();
// The icon order should be reset
@@ -391,7 +343,7 @@ TEST_F(TestLauncher, DragLauncherIconSavesIconOrderIfPositionHasNotChanged)
// Start dragging icon2
launcher_->StartIconDrag(icon2);
launcher_->ShowDragWindow();
- ASSERT_EQ(launcher_->GetDragIconPosition(), model_->IconIndex(icon2));
+ ASSERT_EQ(launcher_->_drag_icon_position, model_->IconIndex(icon2));
// Moving icon2 at the end
auto center3 = icon3->GetCenter(launcher_->monitor());
@@ -408,7 +360,7 @@ TEST_F(TestLauncher, DragLauncherIconSavesIconOrderIfPositionHasNotChanged)
bool model_saved = false;
model_->saved.connect([&model_saved] { model_saved = true; });
- ASSERT_EQ(launcher_->GetDragIconPosition(), model_->IconIndex(icon2));
+ ASSERT_EQ(launcher_->_drag_icon_position, model_->IconIndex(icon2));
launcher_->EndIconDrag();
// The icon order should be reset
@@ -524,6 +476,30 @@ TEST_F(TestLauncher, AddRequestSignal)
EXPECT_TRUE(add_request);
}
+TEST_F(TestLauncher, IconStartingPulseValue)
+{
+ struct timespec current;
+ clock_gettime(CLOCK_MONOTONIC, &current);
+ MockMockLauncherIcon::Ptr icon(new MockMockLauncherIcon);
+
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::STARTING, true);
+
+ // Pulse value should start at 0.
+ EXPECT_EQ(launcher_->IconStartingPulseValue(icon, current), 0.0);
+}
+
+TEST_F(TestLauncher, IconStartingBlinkValue)
+{
+ struct timespec current;
+ clock_gettime(CLOCK_MONOTONIC, &current);
+ MockMockLauncherIcon::Ptr icon(new MockMockLauncherIcon);
+
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::STARTING, true);
+
+ // Pulse value should start at 0.
+ EXPECT_EQ(launcher_->IconStartingBlinkValue(icon, current), 0.0);
+}
+
}
}
diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp
index 22d197b2d..8f033b9ba 100644
--- a/tests/test_launcher_controller.cpp
+++ b/tests/test_launcher_controller.cpp
@@ -222,7 +222,7 @@ protected:
{
auto const& model = Impl()->model_;
auto icon = std::find_if(model->begin(), model->end(),
- [&path](AbstractLauncherIcon::Ptr const& i) { return ( i->DesktopFile() == path); });
+ [&path](AbstractLauncherIcon::Ptr const& i) { return (i->DesktopFile() == path); });
if (icon != model->end())
return *icon;
@@ -287,13 +287,18 @@ TEST_F(TestLauncherController, Construction)
for (auto const& fav_uri : favorite_store.GetFavorites())
{
auto model_icon_it = std::find_if(lc.Impl()->model_->begin(), lc.Impl()->model_->end(),
- [&fav_uri](AbstractLauncherIcon::Ptr const& i) { return (i->RemoteUri() == fav_uri); });
- auto const& icon_it = *model_icon_it;
+ [&fav_uri](AbstractLauncherIcon::Ptr const& i) { return (i->RemoteUri() == fav_uri); });
+ bool valid_iter = (model_icon_it != lc.Impl()->model_->end());
if (fav_uri == places::APPS_URI || fav_uri == places::DEVICES_URI)
- ASSERT_FALSE(icon_it.IsValid());
+ {
+ ASSERT_FALSE(valid_iter);
+ }
else
- ASSERT_TRUE(icon_it.IsValid());
+ {
+ ASSERT_TRUE(valid_iter);
+ ASSERT_TRUE(model_icon_it->IsValid());
+ }
}
}
@@ -380,7 +385,7 @@ TEST_F(TestLauncherController, SingleMonitorSwitchToMultimonitor)
EXPECT_EQ(lc.launchers().size(), max_num_monitors);
}
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
TEST_F(TestLauncherController, MultiMonitorEdgeBarrierSubscriptions)
{
@@ -711,8 +716,10 @@ TEST_F(TestLauncherController, AddRunningApps)
if (!BAMF_IS_APPLICATION(l->data))
continue;
- BamfApplication* app = BAMF_APPLICATION(l->data);
+ if (bamf_view_is_sticky(BAMF_VIEW(l->data)))
+ continue;
+ BamfApplication* app = BAMF_APPLICATION(l->data);
ASSERT_NE(g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")), nullptr);
auto desktop = bamf_application_get_desktop_file(app);
@@ -755,9 +762,9 @@ TEST_F(TestLauncherController, SetupIcons)
FavoriteStore::URI_PREFIX_APP + app::SW_CENTER,
places::DEVICES_URI,
FavoriteStore::URI_PREFIX_APP + app::UPDATE_MANAGER });
- std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free);
lc.Impl()->SetupIcons();
lc.DisconnectSignals();
+ std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free);
auto fav = lc.Impl()->GetIconByUri(FavoriteStore::URI_PREFIX_APP + app::UBUNTU_ONE);
EXPECT_EQ(model->IconIndex(fav), icon_index);
@@ -771,12 +778,14 @@ TEST_F(TestLauncherController, SetupIcons)
fav = lc.Impl()->GetIconByUri(FavoriteStore::URI_PREFIX_APP + app::UPDATE_MANAGER);
EXPECT_EQ(model->IconIndex(fav), ++icon_index);
-
for (GList *l = apps.get(); l; l = l->next)
{
if (!BAMF_IS_APPLICATION(l->data))
continue;
+ if (bamf_view_is_sticky(BAMF_VIEW(l->data)))
+ continue;
+
auto desktop = bamf_application_get_desktop_file(BAMF_APPLICATION(l->data));
std::string path(desktop ? desktop : "");
++icon_index;
@@ -784,9 +793,7 @@ TEST_F(TestLauncherController, SetupIcons)
if (path.empty())
continue;
- auto const& icon = lc.GetIconByDesktop(path);
-
- ASSERT_TRUE(icon.IsValid());
+ auto icon = lc.GetIconByDesktop(path);
ASSERT_EQ(model->IconIndex(icon), icon_index);
}
@@ -801,9 +808,9 @@ TEST_F(TestLauncherController, ResetIconPriorities)
favorite_store.AddFavorite(places::APPS_URI, -1);
favorite_store.AddFavorite(places::DEVICES_URI, -1);
- std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free);
lc.Impl()->SetupIcons();
lc.DisconnectSignals();
+ std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free);
favorite_store.SetFavorites({ places::DEVICES_URI,
FavoriteStore::URI_PREFIX_APP + app::SW_CENTER,
@@ -825,6 +832,9 @@ TEST_F(TestLauncherController, ResetIconPriorities)
if (!BAMF_IS_APPLICATION(l->data))
continue;
+ if (bamf_view_is_sticky(BAMF_VIEW(l->data)))
+ continue;
+
auto desktop = bamf_application_get_desktop_file(BAMF_APPLICATION(l->data));
std::string path(desktop ? desktop : "");
++icon_index;
@@ -1516,7 +1526,9 @@ TEST_F(TestLauncherController, UpdateSelectionChanged)
{
UBusManager manager;
std::string last_selection_change;
- manager.RegisterInterest(UBUS_LAUNCHER_SELECTION_CHANGED, [&] (GVariant *data) { last_selection_change = g_variant_get_string(data, 0); });
+ manager.RegisterInterest(UBUS_LAUNCHER_SELECTION_CHANGED, [&] (GVariant *data) {
+ last_selection_change = g_variant_get_string(data, 0);
+ });
lc.KeyNavGrab();
ProcessUBusMessages();
diff --git a/tests/test_lens.cpp b/tests/test_lens.cpp
index 79decb031..629ab52f1 100644
--- a/tests/test_lens.cpp
+++ b/tests/test_lens.cpp
@@ -86,7 +86,7 @@ public:
{
Results::Ptr results = lens_->results;
- lens_->Search("Test Search String");
+ lens_->Search("Test Search String", nullptr);
WaitForModel<Result>(results.get(), 5);
Result result = results->RowAtIndex(0);
@@ -145,7 +145,7 @@ TEST_F(TestLens, TestSearch)
{
Results::Ptr results = lens_->results;
- lens_->Search("Test Search String");
+ lens_->Search("Test Search String", nullptr);
WaitForModel<Result>(results.get(), 5);
for (unsigned int i = 0; i < 5; i++)
@@ -169,7 +169,7 @@ TEST_F(TestLens, TestGlobalSearch)
{
Results::Ptr results = lens_->global_results;
- lens_->GlobalSearch("Test Global Search String");
+ lens_->GlobalSearch("Test Global Search String", nullptr);
WaitForModel<Result>(results.get(), 10);
for (unsigned int i = 0; i < 10; i++)
diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt
index cc03d821c..e8246f0ec 100644
--- a/unity-shared/CMakeLists.txt
+++ b/unity-shared/CMakeLists.txt
@@ -32,6 +32,7 @@ set (UNITY_SHARED_SOURCES
CoverArt.cpp
BackgroundEffectHelper.cpp
DashStyle.cpp
+ DebugDBusInterface.cpp
DefaultThumbnailProvider.cpp
FontSettings.cpp
GraphicsUtils.cpp
@@ -66,9 +67,10 @@ set (UNITY_SHARED_SOURCES
UnityWindowView.cpp
UserThumbnailProvider.cpp
WindowManager.cpp
+ XPathQueryPart.cpp
)
-if(UNITY_ENABLE_X_ORG_SUPPORT)
+if(ENABLE_X_SUPPORT)
set (UNITY_SHARED_SOURCES
XKeyboardUtil.cpp
XWindowManager.cpp
@@ -89,7 +91,7 @@ add_dependencies (unity-shared unity-core-${UNITY_API_VERSION})
# We also need to build compiz specific parts and standalone variants of those parts
#
-if(UNITY_ENABLE_X_ORG_SUPPORT)
+if (ENABLE_X_SUPPORT)
# compiz
set (UNITY_SHARED_COMPIZ_SOURCES
PluginAdapter.cpp
diff --git a/plugins/unityshell/src/DebugDBusInterface.cpp b/unity-shared/DebugDBusInterface.cpp
index 9a267ea21..ae07a851b 100644
--- a/plugins/unityshell/src/DebugDBusInterface.cpp
+++ b/unity-shared/DebugDBusInterface.cpp
@@ -24,7 +24,6 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/bind.hpp>
-#include <core/core.h>
#include <NuxCore/Logger.h>
#include <NuxCore/LoggingWriter.h>
@@ -303,7 +302,7 @@ std::list<Introspectable*> GetIntrospectableNodesFromQuery(std::string const& qu
query_strings.end(),
boost::bind( &std::string::empty, _1 ) ),
query_strings.end());
- foreach(std::string part, query_strings)
+ for (auto part : query_strings)
{
query_parts.push_back(XPathQueryPart(part));
}
@@ -343,7 +342,7 @@ std::list<Introspectable*> GetIntrospectableNodesFromQuery(std::string const& qu
start_points.push_back(node);
}
// Add all children of current node to queue.
- foreach(Introspectable* child, node->GetIntrospectableChildren())
+ for (Introspectable* child : node->GetIntrospectableChildren())
{
queue.push(child);
}
@@ -355,7 +354,7 @@ std::list<Introspectable*> GetIntrospectableNodesFromQuery(std::string const& qu
typedef std::pair<Introspectable*, std::list<XPathQueryPart>::iterator> node_match_pair;
std::queue<node_match_pair> traverse_queue;
- foreach(Introspectable *node, start_points)
+ for (Introspectable *node : start_points)
{
traverse_queue.push(node_match_pair(node, query_parts.begin()));
}
@@ -377,7 +376,7 @@ std::list<Introspectable*> GetIntrospectableNodesFromQuery(std::string const& qu
else
{
// push all children of current node to start of queue, advance search iterator, and loop again.
- foreach (Introspectable *child, node->GetIntrospectableChildren())
+ for (Introspectable* child : node->GetIntrospectableChildren())
{
if (query_it->Matches(child))
{
diff --git a/plugins/unityshell/src/DebugDBusInterface.h b/unity-shared/DebugDBusInterface.h
index 3c11a5a0b..3c11a5a0b 100644
--- a/plugins/unityshell/src/DebugDBusInterface.h
+++ b/unity-shared/DebugDBusInterface.h
diff --git a/unity-shared/ResizingBaseWindow.h b/unity-shared/ResizingBaseWindow.h
index c7f50cbb2..d461fcb03 100644
--- a/unity-shared/ResizingBaseWindow.h
+++ b/unity-shared/ResizingBaseWindow.h
@@ -35,7 +35,7 @@ public:
void UpdateInputWindowGeometry()
{
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
if (m_input_window && m_input_window_enabled)
m_input_window->SetGeometry(geo_func_(GetGeometry()));
#endif
diff --git a/unity-shared/UnityWindowView.cpp b/unity-shared/UnityWindowView.cpp
index 6b6a8a920..9de1d5857 100644
--- a/unity-shared/UnityWindowView.cpp
+++ b/unity-shared/UnityWindowView.cpp
@@ -136,7 +136,7 @@ void UnityWindowView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_dr
gPainter.PaintShapeCornerROP(GfxContext,
internal_clip,
nux::color::White,
- nux::eSHAPE_CORNER_ROUND5,
+ nux::eSHAPE_CORNER_ROUND4,
nux::eCornerTopLeft | nux::eCornerTopRight |
nux::eCornerBottomLeft | nux::eCornerBottomRight,
true,
diff --git a/unity-shared/WindowManager.h b/unity-shared/WindowManager.h
index 1f0b4bc97..28d474805 100644
--- a/unity-shared/WindowManager.h
+++ b/unity-shared/WindowManager.h
@@ -28,7 +28,7 @@
#include <NuxCore/Rect.h>
#include <Nux/Utils.h>
-#ifdef UNITY_HAS_X_ORG_SUPPORT
+#ifdef USE_X11
#include <X11/Xlib.h>
#else
typedef unsigned long Window;
diff --git a/plugins/unityshell/src/XPathQueryPart.cpp b/unity-shared/XPathQueryPart.cpp
index 3608a50b4..3608a50b4 100644
--- a/plugins/unityshell/src/XPathQueryPart.cpp
+++ b/unity-shared/XPathQueryPart.cpp
diff --git a/plugins/unityshell/src/XPathQueryPart.h b/unity-shared/XPathQueryPart.h
index b5beb3f4f..b5beb3f4f 100644
--- a/plugins/unityshell/src/XPathQueryPart.h
+++ b/unity-shared/XPathQueryPart.h