Merge lp:~3v1n0/unity/dnd-launcher-icon-fixes into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3808
Proposed branch: lp:~3v1n0/unity/dnd-launcher-icon-fixes
Merge into: lp:unity
Diff against target: 313 lines (+76/-43)
10 files modified
dash/DashController.cpp (+3/-1)
hud/HudController.cpp (+1/-0)
launcher/AbstractLauncherIcon.h (+3/-2)
launcher/ApplicationLauncherIcon.cpp (+15/-14)
launcher/ApplicationLauncherIcon.h (+0/-1)
launcher/Launcher.cpp (+19/-2)
launcher/TrashLauncherIcon.cpp (+1/-0)
launcher/VolumeLauncherIcon.cpp (+1/-0)
plugins/unityshell/src/unityshell.cpp (+6/-15)
unity-shared/PluginAdapter.cpp (+27/-8)
To merge this branch: bzr merge lp:~3v1n0/unity/dnd-launcher-icon-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Brandon Schaefer (community) Approve
Review via email: mp+215993@code.launchpad.net

Commit message

ApplicationLauncherIcon: Focus and, in case, Spread the windows on DnD

After 1 second that an user is over an icon, that icon should focus the relative
application and Spread its windows if it has more than one opened.

Correctly handle the DnD scale in launcher, and apply glow to the icon under pointer.

Description of the change

To get all bugs properly fixed this needs lp:~3v1n0/compiz/scale-dndtarget-workarea-shape (not a strict dependency, though).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
Christopher Townsend (townsend) wrote :

Cool, looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashController.cpp'
--- dash/DashController.cpp 2014-03-21 05:23:42 +0000
+++ dash/DashController.cpp 2014-04-16 02:02:27 +0000
@@ -105,7 +105,9 @@
105 }105 }
106 });106 });
107107
108 WindowManager::Default().initiate_spread.connect(sigc::mem_fun(this, &Controller::HideDash));108 auto& wm = WindowManager::Default();
109 wm.initiate_spread.connect(sigc::mem_fun(this, &Controller::HideDash));
110 wm.screen_viewport_switch_started.connect(sigc::mem_fun(this, &Controller::HideDash));
109111
110 dbus_server_.AddObjects(dbus::INTROSPECTION, dbus::PATH);112 dbus_server_.AddObjects(dbus::INTROSPECTION, dbus::PATH);
111 dbus_server_.GetObjects().front()->SetMethodsCallsHandler([this] (std::string const& method, GVariant*) {113 dbus_server_.GetObjects().front()->SetMethodsCallsHandler([this] (std::string const& method, GVariant*) {
112114
=== modified file 'hud/HudController.cpp'
--- hud/HudController.cpp 2014-02-28 16:56:19 +0000
+++ hud/HudController.cpp 2014-04-16 02:02:27 +0000
@@ -102,6 +102,7 @@
102 WindowManager& wm = WindowManager::Default();102 WindowManager& wm = WindowManager::Default();
103 wm.screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed));103 wm.screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed));
104 wm.initiate_spread.connect(sigc::mem_fun(this, &Controller::HideHud));104 wm.initiate_spread.connect(sigc::mem_fun(this, &Controller::HideHud));
105 wm.screen_viewport_switch_started.connect(sigc::mem_fun(this, &Controller::HideHud));
105106
106 hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished));107 hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished));
107 timeline_animator_.updated.connect(sigc::mem_fun(this, &Controller::OnViewShowHideFrame));108 timeline_animator_.updated.connect(sigc::mem_fun(this, &Controller::OnViewShowHideFrame));
108109
=== modified file 'launcher/AbstractLauncherIcon.h'
--- launcher/AbstractLauncherIcon.h 2014-03-17 20:58:25 +0000
+++ launcher/AbstractLauncherIcon.h 2014-04-16 02:02:27 +0000
@@ -110,10 +110,11 @@
110 UNFOLDED,110 UNFOLDED,
111 STARTING,111 STARTING,
112 SHIMMER,112 SHIMMER,
113 CENTER_SAVED,113 DESAT,
114 GLOW,
114 PROGRESS,115 PROGRESS,
115 DESAT,
116 PULSE_ONCE,116 PULSE_ONCE,
117 CENTER_SAVED,
117118
118 LAST119 LAST
119 };120 };
120121
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2014-04-02 14:36:55 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2014-04-16 02:02:27 +0000
@@ -49,9 +49,10 @@
49// We use the "bamf-" prefix since the manager is protected, to avoid name clash49// We use the "bamf-" prefix since the manager is protected, to avoid name clash
50const std::string WINDOW_MOVE_TIMEOUT = "bamf-window-move";50const std::string WINDOW_MOVE_TIMEOUT = "bamf-window-move";
51const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove";51const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove";
52//const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over";52const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over";
53const std::string DEFAULT_ICON = "application-default-icon";53const std::string DEFAULT_ICON = "application-default-icon";
54const int MAXIMUM_QUICKLIST_WIDTH = 300;54const int MAXIMUM_QUICKLIST_WIDTH = 300;
55const int COMPIZ_SCALE_DND_SPREAD = 1 << 7;
5556
56enum MenuItemType57enum MenuItemType
57{58{
@@ -1157,28 +1158,28 @@
1157 return _remote_uri;1158 return _remote_uri;
1158}1159}
11591160
1160void ApplicationLauncherIcon::OnDndHovered()
1161{
1162 // for now, let's not do this, it turns out to be quite buggy
1163 //if (IsRunning())
1164 // Spread(CompAction::StateInitEdgeDnd, true);
1165}
1166
1167void ApplicationLauncherIcon::OnDndEnter()1161void ApplicationLauncherIcon::OnDndEnter()
1168{1162{
1169 /* Disabled, since the DND code is currently disabled as well.1163 auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
1170 _source_manager.AddTimeout(1000, [this] {1164
1171 OnDndHovered();1165 _source_manager.AddTimeout(1000, [this, timestamp] {
1166 WindowManager::Default().TerminateScale();
1167
1168 if (!IsRunning())
1169 return false;
1170
1171 Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp));
1172
1173 if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1)
1174 Spread(true, COMPIZ_SCALE_DND_SPREAD, false);
1175
1172 return false;1176 return false;
1173 }, ICON_DND_OVER_TIMEOUT);1177 }, ICON_DND_OVER_TIMEOUT);
1174 */
1175}1178}
11761179
1177void ApplicationLauncherIcon::OnDndLeave()1180void ApplicationLauncherIcon::OnDndLeave()
1178{1181{
1179 /* Disabled, since the DND code is currently disabled as well.
1180 _source_manager.Remove(ICON_DND_OVER_TIMEOUT);1182 _source_manager.Remove(ICON_DND_OVER_TIMEOUT);
1181 */
1182}1183}
11831184
1184bool ApplicationLauncherIcon::IsFileManager()1185bool ApplicationLauncherIcon::IsFileManager()
11851186
=== modified file 'launcher/ApplicationLauncherIcon.h'
--- launcher/ApplicationLauncherIcon.h 2014-03-06 21:19:21 +0000
+++ launcher/ApplicationLauncherIcon.h 2014-04-16 02:02:27 +0000
@@ -83,7 +83,6 @@
83 void AddProperties(debug::IntrospectionData&);83 void AddProperties(debug::IntrospectionData&);
84 void OnAcceptDrop(DndData const& dnd_data);84 void OnAcceptDrop(DndData const& dnd_data);
85 void OnDndEnter();85 void OnDndEnter();
86 void OnDndHovered();
87 void OnDndLeave();86 void OnDndLeave();
88 void OpenInstanceLauncherIcon(Time timestamp) override;87 void OpenInstanceLauncherIcon(Time timestamp) override;
89 void ToggleSticky();88 void ToggleSticky();
9089
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2014-04-14 13:46:01 +0000
+++ launcher/Launcher.cpp 2014-04-16 02:02:27 +0000
@@ -157,6 +157,7 @@
157 hide_machine_.should_hide_changed.connect(sigc::mem_fun(this, &Launcher::SetHidden));157 hide_machine_.should_hide_changed.connect(sigc::mem_fun(this, &Launcher::SetHidden));
158 hide_machine_.reveal_progress.changed.connect(redraw_cb);158 hide_machine_.reveal_progress.changed.connect(redraw_cb);
159 hover_machine_.should_hover_changed.connect(sigc::mem_fun(this, &Launcher::SetHover));159 hover_machine_.should_hover_changed.connect(sigc::mem_fun(this, &Launcher::SetHover));
160 bg_effect_helper_.enabled.changed.connect(redraw_cb);
160161
161 mouse_down.connect(sigc::mem_fun(this, &Launcher::RecvMouseDown));162 mouse_down.connect(sigc::mem_fun(this, &Launcher::RecvMouseDown));
162 mouse_up.connect(sigc::mem_fun(this, &Launcher::RecvMouseUp));163 mouse_up.connect(sigc::mem_fun(this, &Launcher::RecvMouseUp));
@@ -599,7 +600,7 @@
599 else600 else
600 urgent_progress = CLAMP(urgent_progress * 3.0f - 2.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle601 urgent_progress = CLAMP(urgent_progress * 3.0f - 2.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
601602
602 arg.glow_intensity = urgent_progress;603 arg.glow_intensity = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::GLOW, monitor()) + urgent_progress;
603604
604 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)605 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
605 {606 {
@@ -1171,6 +1172,9 @@
1171 hide_machine_.SetQuirk(LauncherHideMachine::SCALE_ACTIVE, active);1172 hide_machine_.SetQuirk(LauncherHideMachine::SCALE_ACTIVE, active);
1172 bg_effect_helper_.enabled = active;1173 bg_effect_helper_.enabled = active;
11731174
1175 if (hide_machine_.GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE))
1176 return;
1177
1174 if (active && icon_under_mouse_)1178 if (active && icon_under_mouse_)
1175 icon_under_mouse_->HideTooltip();1179 icon_under_mouse_->HideTooltip();
11761180
@@ -1592,6 +1596,7 @@
1592 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, ANIM_DURATION, monitor());1596 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, ANIM_DURATION, monitor());
1593 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, ANIM_DURATION, monitor());1597 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, ANIM_DURATION, monitor());
1594 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, ANIM_DURATION_SHORT_SHORT, monitor());1598 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, ANIM_DURATION_SHORT_SHORT, monitor());
1599 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, ANIM_DURATION_SHORT, monitor());
15951600
1596 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)1601 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
1597 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), monitor());1602 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), monitor());
@@ -2523,7 +2528,10 @@
2523 }2528 }
25242529
2525 if (!steal_drag_ && dnd_hovered_icon_)2530 if (!steal_drag_ && dnd_hovered_icon_)
2531 {
2526 dnd_hovered_icon_->SendDndLeave();2532 dnd_hovered_icon_->SendDndLeave();
2533 dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor());
2534 }
25272535
2528 steal_drag_ = false;2536 steal_drag_ = false;
2529 drag_edge_touching_ = false;2537 drag_edge_touching_ = false;
@@ -2581,7 +2589,10 @@
2581 mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_)))2589 mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_)))
2582 {2590 {
2583 if (dnd_hovered_icon_)2591 if (dnd_hovered_icon_)
2584 dnd_hovered_icon_->SendDndLeave();2592 {
2593 dnd_hovered_icon_->SendDndLeave();
2594 dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor());
2595 }
25852596
2586 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD);2597 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD);
2587 drag_edge_touching_ = true;2598 drag_edge_touching_ = true;
@@ -2640,6 +2651,9 @@
2640 {2651 {
2641 hovered_icon->SendDndEnter();2652 hovered_icon->SendDndEnter();
2642 drag_action_ = hovered_icon->QueryAcceptDrop(dnd_data_);2653 drag_action_ = hovered_icon->QueryAcceptDrop(dnd_data_);
2654
2655 if (drag_action_ != nux::DNDACTION_NONE)
2656 hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, true, monitor());
2643 }2657 }
2644 else2658 else
2645 {2659 {
@@ -2647,7 +2661,10 @@
2647 }2661 }
26482662
2649 if (dnd_hovered_icon_)2663 if (dnd_hovered_icon_)
2664 {
2650 dnd_hovered_icon_->SendDndLeave();2665 dnd_hovered_icon_->SendDndLeave();
2666 dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor());
2667 }
26512668
2652 dnd_hovered_icon_ = hovered_icon;2669 dnd_hovered_icon_ = hovered_icon;
2653 }2670 }
26542671
=== modified file 'launcher/TrashLauncherIcon.cpp'
--- launcher/TrashLauncherIcon.cpp 2014-01-15 14:51:10 +0000
+++ launcher/TrashLauncherIcon.cpp 2014-04-16 02:02:27 +0000
@@ -173,6 +173,7 @@
173 }173 }
174174
175 SetQuirk(LauncherIcon::Quirk::PULSE_ONCE, true);175 SetQuirk(LauncherIcon::Quirk::PULSE_ONCE, true);
176 FullyAnimateQuirkDelayed(100, LauncherIcon::Quirk::SHIMMER);
176}177}
177178
178std::string TrashLauncherIcon::GetName() const179std::string TrashLauncherIcon::GetName() const
179180
=== modified file 'launcher/VolumeLauncherIcon.cpp'
--- launcher/VolumeLauncherIcon.cpp 2014-02-13 10:14:20 +0000
+++ launcher/VolumeLauncherIcon.cpp 2014-04-16 02:02:27 +0000
@@ -410,6 +410,7 @@
410 auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;410 auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
411 pimpl_->CopyFilesToVolume(dnd_data.Uris(), timestamp);411 pimpl_->CopyFilesToVolume(dnd_data.Uris(), timestamp);
412 SetQuirk(Quirk::PULSE_ONCE, true);412 SetQuirk(Quirk::PULSE_ONCE, true);
413 FullyAnimateQuirkDelayed(100, LauncherIcon::Quirk::SHIMMER);
413}414}
414415
415//416//
416417
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-04-14 14:21:46 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-04-16 02:02:27 +0000
@@ -517,6 +517,7 @@
517517
518void UnityScreen::OnInitiateSpread()518void UnityScreen::OnInitiateSpread()
519{519{
520 scale_just_activated_ = super_keypressed_;
520 spread_filter_ = std::make_shared<spread::Filter>();521 spread_filter_ = std::make_shared<spread::Filter>();
521 spread_filter_->text.changed.connect([this] (std::string const& filter) {522 spread_filter_->text.changed.connect([this] (std::string const& filter) {
522 if (filter.empty())523 if (filter.empty())
@@ -1977,19 +1978,7 @@
1977{1978{
1978 PluginAdapter& adapter = PluginAdapter::Default();1979 PluginAdapter& adapter = PluginAdapter::Default();
1979 adapter.NotifyCompizEvent(plugin, event, option);1980 adapter.NotifyCompizEvent(plugin, event, option);
1980 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent (plugin, event, option);1981 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::handleCompizEvent(plugin, event, option);
1981
1982 if (launcher_controller_->IsOverlayOpen() && g_strcmp0(event, "start_viewport_switch") == 0)
1983 {
1984 ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
1985 }
1986
1987 if (super_keypressed_ && g_strcmp0(plugin, "scale") == 0 &&
1988 g_strcmp0(event, "activate") == 0)
1989 {
1990 scale_just_activated_ = CompOption::getBoolOptionNamed(option, "active");
1991 }
1992
1993 screen->handleCompizEvent(plugin, event, option);1982 screen->handleCompizEvent(plugin, event, option);
1994}1983}
19951984
@@ -3836,8 +3825,10 @@
3836 CompOption::Value v(launcher_width);3825 CompOption::Value v(launcher_width);
3837 screen->setOptionForPlugin("expo", "x_offset", v);3826 screen->setOptionForPlugin("expo", "x_offset", v);
38383827
3839 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)3828 if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER)
3840 screen->setOptionForPlugin("scale", "x_offset", v);3829 v.set(0);
3830
3831 screen->setOptionForPlugin("scale", "x_offset", v);
3841 };3832 };
38423833
3843 for (auto const& launcher : launcher_controller_->launchers())3834 for (auto const& launcher : launcher_controller_->launchers())
38443835
=== modified file 'unity-shared/PluginAdapter.cpp'
--- unity-shared/PluginAdapter.cpp 2014-04-02 21:42:12 +0000
+++ unity-shared/PluginAdapter.cpp 2014-04-16 02:02:27 +0000
@@ -190,15 +190,34 @@
190 _vp_switch_started = false;190 _vp_switch_started = false;
191 screen_viewport_switch_ended.emit();191 screen_viewport_switch_ended.emit();
192 }192 }
193 else if (IsScaleActive() && g_strcmp0(plugin, "scale") == 0 &&193 else if (g_strcmp0(plugin, "scale") == 0 && g_strcmp0(event, "activate") == 0)
194 g_strcmp0(event, "activate") == 0)
195 {194 {
196 // If the scale plugin is activated again while is already grabbing the screen195 bool new_state = CompOption::getBoolOptionNamed(option, "active");
197 // it means that is switching the view (i.e. switching from a spread application196
198 // to another), so we need to notify our clients that it has really terminated197 if (_spread_state != new_state)
199 // and initiated again.198 {
200 terminate_spread.emit();199 _spread_state = new_state;
201 initiate_spread.emit();200 _spread_state ? initiate_spread.emit() : terminate_spread.emit();
201
202 if (!_spread_state)
203 _spread_windows_state = false;
204 }
205 else if (_spread_state && new_state)
206 {
207 // If the scale plugin is activated again while is already grabbing the screen
208 // it means that is switching the view (i.e. switching from a spread application
209 // to another), so we need to notify our clients that it has really terminated
210 // and initiated again.
211
212 bool old_windows_state = _spread_windows_state;
213 _spread_state = false;
214 _spread_windows_state = false;
215 terminate_spread.emit();
216
217 _spread_state = true;
218 _spread_windows_state = old_windows_state;
219 initiate_spread.emit();
220 }
202 }221 }
203}222}
204223