summaryrefslogtreecommitdiff
diff options
-rw-r--r--launcher/Launcher.cpp172
-rw-r--r--launcher/Launcher.h14
-rw-r--r--launcher/LauncherController.cpp42
-rw-r--r--launcher/LauncherController.h3
-rw-r--r--launcher/LauncherControllerPrivate.h5
-rw-r--r--launcher/StandaloneLauncher.cpp4
-rw-r--r--plugins/unityshell/src/unityshell.cpp10
-rw-r--r--tests/test_launcher.cpp12
-rw-r--r--tests/test_launcher_controller.cpp76
-rw-r--r--unity-standalone/StandaloneUnity.cpp6
10 files changed, 201 insertions, 143 deletions
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp
index a13b764ce..fca524362 100644
--- a/launcher/Launcher.cpp
+++ b/launcher/Launcher.cpp
@@ -91,7 +91,6 @@ const int START_DRAGICON_DURATION = 250;
const int MOUSE_DEADZONE = 15;
const float DRAG_OUT_PIXELS = 300.0f;
-const std::string DND_CHECK_TIMEOUT = "dnd-check-timeout";
const std::string START_DRAGICON_TIMEOUT = "start-dragicon-timeout";
const std::string SCROLL_TIMEOUT = "scroll-timeout";
const std::string ANIMATION_IDLE = "animation-idle";
@@ -103,7 +102,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(Launcher);
const int Launcher::Launcher::ANIM_DURATION_SHORT = 125;
Launcher::Launcher(nux::BaseWindow* parent,
- nux::ObjectPtr<DNDCollectionWindow> const& collection_window,
NUX_FILE_LINE_DECL)
: View(NUX_FILE_LINE_PARAM)
#ifdef USE_X11
@@ -145,14 +143,11 @@ Launcher::Launcher(nux::BaseWindow* parent,
, _drag_out_delta_x(0.0f)
, _drag_gesture_ongoing(false)
, _last_reveal_progress(0.0f)
- , _collection_window(collection_window)
, _selection_atom(0)
, _background_color(nux::color::DimGray)
{
m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);
- _collection_window->collected.connect(sigc::mem_fun(this, &Launcher::OnDNDDataCollected));
-
bg_effect_helper_.owner = this;
bg_effect_helper_.enabled = false;
@@ -180,18 +175,12 @@ Launcher::Launcher(nux::BaseWindow* parent,
ql_manager.quicklist_closed.connect(sigc::mem_fun(this, &Launcher::RecvQuicklistClosed));
WindowManager& wm = WindowManager::Default();
- wm.window_mapped.connect(sigc::hide(sigc::mem_fun(this, &Launcher::DndTimeoutSetup)));
- wm.window_unmapped.connect(sigc::hide(sigc::mem_fun(this, &Launcher::DndTimeoutSetup)));
wm.initiate_spread.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
wm.initiate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
wm.terminate_spread.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
wm.terminate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
wm.screen_viewport_switch_ended.connect(sigc::mem_fun(this, &Launcher::EnsureAnimation));
-#ifdef USE_X11
- display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
-#endif
-
// 0 out timers to avoid wonky startups
for (int i = 0; i < TIME_LAST; ++i)
{
@@ -227,11 +216,6 @@ std::string Launcher::GetName() const
return "Launcher";
}
-void Launcher::OnDisplayChanged(Display* display)
-{
- _collection_window->display = display;
-}
-
#ifdef NUX_GESTURES_SUPPORT
void Launcher::OnDragStart(const nux::GestureEvent &event)
{
@@ -1366,59 +1350,6 @@ int Launcher::GetMouseY() const
return _mouse_position.y;
}
-bool Launcher::OnUpdateDragManagerTimeout()
-{
-#ifdef USE_X11
- if (display() == 0)
- return false;
-
- if (!_selection_atom)
- _selection_atom = XInternAtom(display(), "XdndSelection", false);
-
- Window drag_owner = XGetSelectionOwner(display(), _selection_atom);
-
- // evil hack because Qt does not release the seelction owner on drag finished
- Window root_r, child_r;
- int root_x_r, root_y_r, win_x_r, win_y_r;
- unsigned int mask;
- XQueryPointer(display(), DefaultRootWindow(display()), &root_r, &child_r, &root_x_r, &root_y_r, &win_x_r, &win_y_r, &mask);
-
- if (drag_owner && (mask & (Button1Mask | Button2Mask | Button3Mask)))
- {
- if (_data_checked == false)
- {
- _data_checked = true;
- _collection_window->Collect();
- }
-
- return true;
- }
-
- _data_checked = false;
- _collection_window->PushToBack();
- _collection_window->EnableInputWindow(false, "DNDCollectionWindow");
-
- if (IsOverlayOpen() && !_hovered)
- DesaturateIcons();
-
- DndReset();
- _hide_machine.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, false);
- _hide_machine.SetQuirk(LauncherHideMachine::DND_PUSHED_OFF, false);
-#endif
- return false;
-}
-
-void Launcher::DndTimeoutSetup()
-{
-#ifdef USE_X11
- if (sources_.GetSource(DND_CHECK_TIMEOUT))
- return;
-
- auto cb_func = sigc::mem_fun(this, &Launcher::OnUpdateDragManagerTimeout);
- sources_.AddTimeout(200, cb_func, DND_CHECK_TIMEOUT);
-#endif
-}
-
void Launcher::OnPluginStateChanged()
{
WindowManager& wm = WindowManager::Default();
@@ -2566,53 +2497,6 @@ bool Launcher::DndIsSpecialRequest(std::string const& uri) const
return (boost::algorithm::ends_with(uri, ".desktop") || uri.find("device://") == 0);
}
-void Launcher::OnDNDDataCollected(const std::list<char*>& mimes)
-{
-#ifdef USE_X11
- _dnd_data.Reset();
-
- const std::string uri_list = "text/uri-list";
- auto& display = nux::GetWindowThread()->GetGraphicsDisplay();
-
- for (auto const& mime : mimes)
- {
- if (mime != uri_list)
- continue;
-
- _dnd_data.Fill(display.GetDndData(const_cast<char*>(uri_list.c_str())));
- break;
- }
-
- _hide_machine.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true);
-
- auto const& uris = _dnd_data.Uris();
- if (std::find_if(uris.begin(), uris.end(), [this] (std::string const& uri)
- {return DndIsSpecialRequest(uri);}) != uris.end())
- {
- _steal_drag = true;
-
- if (IsOverlayOpen())
- SaturateIcons();
- }
- else
- {
- for (auto const& it : *_model)
- {
- if (it->ShouldHighlightOnDrag(_dnd_data))
- {
- it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false);
- it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, true);
- }
- else
- {
- it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true);
- it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false);
- }
- }
- }
-#endif
-}
-
void Launcher::ProcessDndEnter()
{
#ifdef USE_X11
@@ -2873,5 +2757,61 @@ int Launcher::GetDragDelta() const
return _launcher_drag_delta;
}
+void Launcher::DndStarted(std::string const& data)
+{
+ SetDndQuirk();
+
+ _dnd_data.Fill(data.c_str());
+
+ auto const& uris = _dnd_data.Uris();
+ if (std::find_if(uris.begin(), uris.end(), [this] (std::string const& uri)
+ {return DndIsSpecialRequest(uri);}) != uris.end())
+ {
+ _steal_drag = true;
+
+ if (IsOverlayOpen())
+ SaturateIcons();
+ }
+ else
+ {
+ for (auto const& it : *_model)
+ {
+ if (it->ShouldHighlightOnDrag(_dnd_data))
+ {
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, true);
+ }
+ else
+ {
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false);
+ }
+ }
+ }
+}
+
+void Launcher::DndFinished()
+{
+ UnsetDndQuirk();
+
+ _data_checked = false;
+
+ if (IsOverlayOpen() && !_hovered)
+ DesaturateIcons();
+
+ DndReset();
+}
+
+void Launcher::SetDndQuirk()
+{
+ _hide_machine.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true);
+}
+
+void Launcher::UnsetDndQuirk()
+{
+ _hide_machine.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, false);
+ _hide_machine.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, false);
+}
+
} // namespace launcher
} // namespace unity
diff --git a/launcher/Launcher.h b/launcher/Launcher.h
index 99e8ca9d2..f05ef034a 100644
--- a/launcher/Launcher.h
+++ b/launcher/Launcher.h
@@ -32,7 +32,6 @@
#include "unity-shared/AbstractIconRenderer.h"
#include "unity-shared/BackgroundEffectHelper.h"
#include "DevicesSettings.h"
-#include "DNDCollectionWindow.h"
#include "DndData.h"
#include "unity-shared/Introspectable.h"
#include "LauncherModel.h"
@@ -66,7 +65,7 @@ class Launcher : public unity::debug::Introspectable,
NUX_DECLARE_OBJECT_TYPE(Launcher, nux::View);
public:
- Launcher(nux::BaseWindow* parent, nux::ObjectPtr<DNDCollectionWindow> const& collection_window, NUX_FILE_LINE_PROTO);
+ Launcher(nux::BaseWindow* parent, NUX_FILE_LINE_PROTO);
nux::Property<Display*> display;
nux::Property<int> monitor;
@@ -127,6 +126,11 @@ public:
int GetDragDelta() const;
void SetHover(bool hovered);
+ void DndStarted(std::string const& mimes);
+ void DndFinished();
+ void SetDndQuirk();
+ void UnsetDndQuirk();
+
sigc::signal<void, std::string const&, AbstractLauncherIcon::Ptr const&> add_request;
sigc::signal<void, AbstractLauncherIcon::Ptr const&> remove_request;
sigc::signal<void> selection_change;
@@ -213,7 +217,6 @@ private:
bool StrutHack();
bool StartIconDragTimeout(int x, int y);
bool OnScrollTimeout();
- bool OnUpdateDragManagerTimeout();
void SetMousePosition(int x, int y);
@@ -322,12 +325,8 @@ private:
virtual long PostLayoutManagement(long LayoutResult);
- void OnDisplayChanged(Display* display);
- void OnDNDDataCollected(const std::list<char*>& mimes);
-
void DndReset();
void DndHoveredIconReset();
- void DndTimeoutSetup();
bool DndIsSpecialRequest(std::string const& uri) const;
LauncherModel::Ptr _model;
@@ -383,7 +382,6 @@ private:
nux::Point2 _mouse_position;
nux::ObjectPtr<nux::IOpenGLBaseTexture> _offscreen_drag_texture;
nux::ObjectPtr<LauncherDragWindow> _drag_window;
- nux::ObjectPtr<unity::DNDCollectionWindow> _collection_window;
LauncherHideMachine _hide_machine;
LauncherHoverMachine _hover_machine;
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp
index a23498101..fdb843ee5 100644
--- a/launcher/LauncherController.cpp
+++ b/launcher/LauncherController.cpp
@@ -95,10 +95,11 @@ GDBusInterfaceVTable Controller::Impl::interface_vtable =
{ Controller::Impl::OnDBusMethodCall, NULL, NULL};
-Controller::Impl::Impl(Controller* parent)
+Controller::Impl::Impl(Controller* parent, XdndManager::Ptr xdnd_manager)
: parent_(parent)
, model_(std::make_shared<LauncherModel>())
, matcher_(bamf_matcher_get_default())
+ , xdnd_manager_(xdnd_manager)
, device_section_(std::make_shared<VolumeMonitorWrapper>(), std::make_shared<DevicesSettingsImp>())
, expo_icon_(new ExpoLauncherIcon())
, desktop_icon_(new DesktopLauncherIcon())
@@ -161,6 +162,39 @@ Controller::Impl::Impl(Controller* parent)
});
parent_->AddChild(model_.get());
+
+ xdnd_manager_->dnd_started.connect([this](std::string const& data, int monitor) {
+ if (parent_->multiple_launchers)
+ {
+ last_dnd_monitor_ = monitor;
+ launchers[last_dnd_monitor_]->DndStarted(data);
+ }
+ else
+ {
+ launcher_->DndStarted(data);
+ }
+ });
+
+ xdnd_manager_->dnd_finished.connect([this]() {
+ if (parent_->multiple_launchers)
+ {
+ launchers[last_dnd_monitor_]->DndFinished();
+ last_dnd_monitor_ = -1;
+ }
+ else
+ {
+ launcher_->DndFinished();
+ }
+ });
+
+ xdnd_manager_->monitor_changed.connect([this](int monitor) {
+ if (parent_->multiple_launchers)
+ {
+ launchers[last_dnd_monitor_]->UnsetDndQuirk();
+ last_dnd_monitor_ = monitor;
+ launchers[last_dnd_monitor_]->SetDndQuirk();
+ }
+ });
}
Controller::Impl::~Impl()
@@ -259,7 +293,7 @@ Launcher* Controller::Impl::CreateLauncher(int monitor)
{
nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow"));
- Launcher* launcher = new Launcher(launcher_window, nux::ObjectPtr<DNDCollectionWindow>(new DNDCollectionWindow));
+ Launcher* launcher = new Launcher(launcher_window);
launcher->monitor = monitor;
launcher->options = parent_->options();
launcher->SetModel(model_);
@@ -974,10 +1008,10 @@ void Controller::Impl::SendHomeActivationRequest()
g_variant_new("(sus)", "home.lens", dash::NOT_HANDLED, ""));
}
-Controller::Controller()
+Controller::Controller(XdndManager::Ptr xdnd_manager)
: options(Options::Ptr(new Options()))
, multiple_launchers(true)
- , pimpl(new Impl(this))
+ , pimpl(new Impl(this, xdnd_manager))
{
multiple_launchers.changed.connect([&](bool value) -> void {
UScreen* uscreen = UScreen::GetDefault();
diff --git a/launcher/LauncherController.h b/launcher/LauncherController.h
index ec203ec8f..780ba9475 100644
--- a/launcher/LauncherController.h
+++ b/launcher/LauncherController.h
@@ -27,6 +27,7 @@
#include "LauncherOptions.h"
#include "SoftwareCenterLauncherIcon.h"
+#include "XdndManager.h"
namespace unity
{
@@ -47,7 +48,7 @@ public:
nux::Property<Options::Ptr> options;
nux::Property<bool> multiple_launchers;
- Controller();
+ Controller(XdndManager::Ptr xdnd_manager);
~Controller();
Launcher& launcher() const;
diff --git a/launcher/LauncherControllerPrivate.h b/launcher/LauncherControllerPrivate.h
index 210cedeb0..41ed7f866 100644
--- a/launcher/LauncherControllerPrivate.h
+++ b/launcher/LauncherControllerPrivate.h
@@ -39,6 +39,7 @@
#include "SoftwareCenterLauncherIcon.h"
#include "unity-shared/UBusWrapper.h"
#include "VolumeMonitorWrapper.h"
+#include "XdndManager.h"
namespace unity
{
@@ -48,7 +49,7 @@ namespace launcher
class Controller::Impl
{
public:
- Impl(Controller* parent);
+ Impl(Controller* parent, XdndManager::Ptr xdnd_manager);
~Impl();
void UpdateNumWorkspaces(int workspaces);
@@ -124,6 +125,7 @@ public:
glib::Object<BamfMatcher> matcher_;
nux::ObjectPtr<Launcher> launcher_;
nux::ObjectPtr<Launcher> keyboard_launcher_;
+ XdndManager::Ptr xdnd_manager_;
DeviceLauncherSection device_section_;
LauncherEntryRemoteModel remote_model_;
AbstractLauncherIcon::Ptr expo_icon_;
@@ -143,6 +145,7 @@ public:
int reactivate_index;
bool keynav_restore_window_;
int launcher_key_press_time_;
+ int last_dnd_monitor_;
unsigned dbus_owner_;
GDBusConnection* gdbus_connection_;
diff --git a/launcher/StandaloneLauncher.cpp b/launcher/StandaloneLauncher.cpp
index 04869b605..7801696a3 100644
--- a/launcher/StandaloneLauncher.cpp
+++ b/launcher/StandaloneLauncher.cpp
@@ -35,8 +35,8 @@ static launcher::Controller::Ptr controller;
void ThreadWidgetInit(nux::NThread* thread, void* InitData)
{
-// launcherWindow->SetGeometry (nux::Geometry(0, 0, 300, 800));
- controller.reset(new launcher::Controller());
+ auto xdnd_manager = std::make_shared<XdndManager>();
+ controller.reset(new launcher::Controller(xdnd_manager));
}
int main(int argc, char** argv)
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 7c5814e98..59408234a 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -41,6 +41,9 @@
#include "unityshell.h"
#include "BackgroundEffectHelper.h"
#include "UnityGestureBroker.h"
+#include "launcher/XdndCollectionWindowImp.h"
+#include "launcher/XdndManagerImp.h"
+#include "launcher/XdndStartStopNotifierImp.h"
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
@@ -3075,7 +3078,12 @@ void UnityScreen::OnDashRealized ()
void UnityScreen::initLauncher()
{
Timer timer;
- launcher_controller_ = std::make_shared<launcher::Controller>();
+
+ auto xdnd_collection_window = std::make_shared<XdndCollectionWindowImp>();
+ auto xdnd_start_stop_notifier = std::make_shared<XdndStartStopNotifierImp>();
+ auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);
+
+ launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager);
AddChild(launcher_controller_.get());
switcher_controller_ = std::make_shared<switcher::Controller>();
diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp
index d41a1ece3..2c32b8885 100644
--- a/tests/test_launcher.cpp
+++ b/tests/test_launcher.cpp
@@ -26,7 +26,6 @@ using namespace testing;
#include <Nux/Nux.h>
#include <Nux/BaseWindow.h>
-#include "launcher/DNDCollectionWindow.h"
#include "launcher/MockLauncherIcon.h"
#include "launcher/Launcher.h"
#include "unity-shared/PanelStyle.h"
@@ -63,8 +62,8 @@ public:
class MockLauncher : public Launcher
{
public:
- MockLauncher(nux::BaseWindow* parent, nux::ObjectPtr<DNDCollectionWindow> const& collection_window)
- : Launcher(parent, collection_window)
+ MockLauncher(nux::BaseWindow* parent)
+ : Launcher(parent)
{}
AbstractLauncherIcon::Ptr MouseIconIntersection(int x, int y) const
@@ -119,10 +118,9 @@ public:
TestLauncher()
: parent_window_(new nux::BaseWindow("TestLauncherWindow"))
- , dnd_collection_window_(new DNDCollectionWindow)
, model_(new LauncherModel)
, options_(new Options)
- , launcher_(new MockLauncher(parent_window_, dnd_collection_window_))
+ , launcher_(new MockLauncher(parent_window_))
{
launcher_->options = options_;
launcher_->SetModel(model_);
@@ -153,7 +151,6 @@ public:
MockUScreen uscreen;
nux::BaseWindow* parent_window_;
- nux::ObjectPtr<DNDCollectionWindow> dnd_collection_window_;
Settings settings;
panel::Style panel_style;
LauncherModel::Ptr model_;
@@ -189,9 +186,8 @@ TEST_F(TestLauncher, TestQuirksDuringDnd)
EXPECT_CALL(*third, ShouldHighlightOnDrag(_))
.WillRepeatedly(Return(false));
- std::list<char*> uris;
- dnd_collection_window_->collected.emit(uris);
+ launcher_->DndStarted("");
Utils::WaitForTimeout(1);
EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT));
diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp
index 8f033b9ba..cebd5defa 100644
--- a/tests/test_launcher_controller.cpp
+++ b/tests/test_launcher_controller.cpp
@@ -200,6 +200,11 @@ namespace launcher
{
struct TestLauncherController : public testing::Test
{
+ TestLauncherController()
+ : xdnd_manager_(std::make_shared<XdndManager>())
+ , lc(xdnd_manager_)
+ {}
+
virtual void SetUp()
{
lc.multiple_launchers = true;
@@ -216,6 +221,10 @@ struct TestLauncherController : public testing::Test
protected:
struct MockLauncherController : Controller
{
+ MockLauncherController(XdndManager::Ptr xdnd_manager)
+ : Controller(xdnd_manager)
+ {}
+
Controller::Impl* Impl() const { return pimpl.get(); }
AbstractLauncherIcon::Ptr GetIconByDesktop(std::string const& path) const
@@ -258,6 +267,7 @@ protected:
Settings settings;
panel::Style panel_style;
MockFavoriteStore favorite_store;
+ XdndManager::Ptr xdnd_manager_;
MockLauncherController lc;
};
}
@@ -1544,4 +1554,70 @@ TEST_F(TestLauncherController, UpdateSelectionChanged)
ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change);
}
+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); });
+
+ lc.KeyNavGrab();
+ ProcessUBusMessages();
+ ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change);
+
+ lc.KeyNavNext();
+ ProcessUBusMessages();
+ ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change);
+
+ lc.Impl()->OpenQuicklist();
+ lc.Impl()->model_->Selection()->CloseQuicklist();
+ ProcessUBusMessages();
+ ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change);
+}
+
+TEST_F(TestLauncherController, DragAndDrop_MultipleLaunchers)
+{
+ lc.multiple_launchers = true;
+ uscreen.SetupFakeMultiMonitor();
+ lc.options()->hide_mode = LAUNCHER_HIDE_AUTOHIDE;
+
+ auto check_fn = [this](int index) {
+ return lc.launchers()[index]->Hidden();
+ };
+
+ xdnd_manager_->dnd_started.emit("my_awesome_file", 0);
+
+ for (int i = 0; i < max_num_monitors; ++i)
+ Utils::WaitUntil(std::bind(check_fn, i), i != 0);
+
+ xdnd_manager_->monitor_changed.emit(3);
+
+ for (int i = 0; i < max_num_monitors; ++i)
+ Utils::WaitUntil(std::bind(check_fn, i), i != 3);
+
+ xdnd_manager_->dnd_finished.emit();
+
+ for (int i = 0; i < max_num_monitors; ++i)
+ Utils::WaitUntil(std::bind(check_fn, i), true);
+}
+
+TEST_F(TestLauncherController, DragAndDrop_SingleLauncher)
+{
+ lc.multiple_launchers = false;
+ uscreen.SetupFakeMultiMonitor(2);
+ lc.options()->hide_mode = LAUNCHER_HIDE_AUTOHIDE;
+
+ auto check_fn = [this]() {
+ return lc.launcher().Hidden();
+ };
+
+ xdnd_manager_->dnd_started.emit("my_awesome_file", 0);
+ Utils::WaitUntil(check_fn, false);
+
+ xdnd_manager_->monitor_changed.emit(2);
+ Utils::WaitUntil(check_fn, false);
+
+ xdnd_manager_->dnd_finished.emit();
+ Utils::WaitUntil(check_fn, true);
+}
+
}
diff --git a/unity-standalone/StandaloneUnity.cpp b/unity-standalone/StandaloneUnity.cpp
index ebc649a96..5ddaa0dd0 100644
--- a/unity-standalone/StandaloneUnity.cpp
+++ b/unity-standalone/StandaloneUnity.cpp
@@ -86,7 +86,8 @@ UnityStandalone::~UnityStandalone ()
void UnityStandalone::Init ()
{
- launcher_controller.reset(new launcher::Controller());
+ auto xdnd_manager = std::make_shared<XdndManager>();
+ launcher_controller.reset(new launcher::Controller(xdnd_manager));
panel_controller.reset(new panel::Controller());
dash_controller.reset(new dash::Controller());
@@ -119,7 +120,8 @@ UnityStandaloneTV::~UnityStandaloneTV() {};
void UnityStandaloneTV::Init()
{
- launcher_controller.reset(new launcher::Controller());
+ auto xdnd_manager = std::make_shared<XdndManager>();
+ launcher_controller.reset(new launcher::Controller(xdnd_manager));
dash_controller.reset(new dash::Controller());
dash_controller->launcher_width = launcher_controller->launcher().GetAbsoluteWidth() - 1;