Merge lp:~3v1n0/unity/faster-launcher-options-updates into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3261
Proposed branch: lp:~3v1n0/unity/faster-launcher-options-updates
Merge into: lp:unity
Diff against target: 147 lines (+10/-16)
6 files modified
launcher/LauncherController.cpp (+4/-10)
launcher/LauncherController.h (+0/-2)
launcher/LauncherControllerPrivate.h (+0/-1)
launcher/LauncherOptions.cpp (+4/-1)
launcher/LauncherOptions.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+1/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/faster-launcher-options-updates
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+156162@code.launchpad.net

This proposal supersedes a proposal from 2013-03-29.

Commit message

LauncherOptions: use faster Idle and add super-tap-duration

Description of the change

Emit options has changed, when the launcher options have changed. So there is no delay while updating the options (mainly on startup).

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

Mh, I'm not sure this is the best thing since it bypasses the idle we have in LauncherOptions and that could be ok for the very first change, but the problem is that it also emits the option_changed signal when the values have been not really changed (even if compiz could handle it).

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

FYI, this is enough to fix this case: http://pastebin.ubuntu.com/5658122/

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Sweet, nice fix :). LGTM

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/LauncherController.cpp'
--- launcher/LauncherController.cpp 2013-03-14 18:55:36 +0000
+++ launcher/LauncherController.cpp 2013-03-29 17:02:22 +0000
@@ -119,7 +119,6 @@
119 , keynav_restore_window_(true)119 , keynav_restore_window_(true)
120 , launcher_key_press_time_(0)120 , launcher_key_press_time_(0)
121 , last_dnd_monitor_(-1)121 , last_dnd_monitor_(-1)
122 , super_tap_duration_(0)
123 , dbus_server_(DBUS_NAME)122 , dbus_server_(DBUS_NAME)
124{123{
125#ifdef USE_X11124#ifdef USE_X11
@@ -1055,7 +1054,7 @@
1055}1054}
10561055
1057Controller::Controller(XdndManager::Ptr const& xdnd_manager)1056Controller::Controller(XdndManager::Ptr const& xdnd_manager)
1058 : options(Options::Ptr(new Options()))1057 : options(std::make_shared<Options>())
1059 , multiple_launchers(true)1058 , multiple_launchers(true)
1060 , pimpl(new Impl(this, xdnd_manager))1059 , pimpl(new Impl(this, xdnd_manager))
1061{1060{
@@ -1169,7 +1168,7 @@
11691168
1170 return false;1169 return false;
1171 };1170 };
1172 pimpl->sources_.AddTimeout(pimpl->super_tap_duration_, show_launcher, local::KEYPRESS_TIMEOUT);1171 pimpl->sources_.AddTimeout(options()->super_tap_duration, show_launcher, local::KEYPRESS_TIMEOUT);
11731172
1174 auto show_shortcuts = [&]()1173 auto show_shortcuts = [&]()
1175 {1174 {
@@ -1189,7 +1188,7 @@
11891188
1190bool Controller::AboutToShowDash(int was_tap, int when) const1189bool Controller::AboutToShowDash(int was_tap, int when) const
1191{1190{
1192 if ((when - pimpl->launcher_key_press_time_) < pimpl->super_tap_duration_ && was_tap)1191 if ((when - pimpl->launcher_key_press_time_) < options()->super_tap_duration && was_tap)
1193 return true;1192 return true;
1194 return false;1193 return false;
1195}1194}
@@ -1197,7 +1196,7 @@
1197void Controller::HandleLauncherKeyRelease(bool was_tap, int when)1196void Controller::HandleLauncherKeyRelease(bool was_tap, int when)
1198{1197{
1199 int tap_duration = when - pimpl->launcher_key_press_time_;1198 int tap_duration = when - pimpl->launcher_key_press_time_;
1200 if (tap_duration < pimpl->super_tap_duration_ && was_tap)1199 if (tap_duration < options()->super_tap_duration && was_tap)
1201 {1200 {
1202 LOG_DEBUG(logger) << "Quick tap, sending activation request.";1201 LOG_DEBUG(logger) << "Quick tap, sending activation request.";
1203 pimpl->SendHomeActivationRequest();1202 pimpl->SendHomeActivationRequest();
@@ -1412,11 +1411,6 @@
1412 return false;1411 return false;
1413}1412}
14141413
1415void Controller::UpdateSuperTapDuration(int const super_tap_duration)
1416{
1417 pimpl->super_tap_duration_ = super_tap_duration;
1418}
1419
1420std::string1414std::string
1421Controller::GetName() const1415Controller::GetName() const
1422{1416{
14231417
=== modified file 'launcher/LauncherController.h'
--- launcher/LauncherController.h 2013-02-14 17:22:08 +0000
+++ launcher/LauncherController.h 2013-03-29 17:02:22 +0000
@@ -82,8 +82,6 @@
8282
83 bool IsOverlayOpen() const;83 bool IsOverlayOpen() const;
8484
85 void UpdateSuperTapDuration(int const super_tap_duration);
86
87protected:85protected:
88 // Introspectable methods86 // Introspectable methods
89 std::string GetName() const;87 std::string GetName() const;
9088
=== modified file 'launcher/LauncherControllerPrivate.h'
--- launcher/LauncherControllerPrivate.h 2013-03-06 13:13:37 +0000
+++ launcher/LauncherControllerPrivate.h 2013-03-29 17:02:22 +0000
@@ -145,7 +145,6 @@
145 bool keynav_restore_window_;145 bool keynav_restore_window_;
146 int launcher_key_press_time_;146 int launcher_key_press_time_;
147 int last_dnd_monitor_;147 int last_dnd_monitor_;
148 int super_tap_duration_;
149148
150 glib::DBusServer dbus_server_;149 glib::DBusServer dbus_server_;
151 glib::SourceManager sources_;150 glib::SourceManager sources_;
152151
=== modified file 'launcher/LauncherOptions.cpp'
--- launcher/LauncherOptions.cpp 2013-01-18 18:22:03 +0000
+++ launcher/LauncherOptions.cpp 2013-03-29 17:02:22 +0000
@@ -37,6 +37,7 @@
37 , background_alpha(0.6667)37 , background_alpha(0.6667)
38 , icon_size(48)38 , icon_size(48)
39 , tile_size(54)39 , tile_size(54)
40 , super_tap_duration(250)
40 , edge_decay_rate(1500)41 , edge_decay_rate(1500)
41 , edge_overcome_pressure(2000)42 , edge_overcome_pressure(2000)
42 , edge_stop_velocity(6500)43 , edge_stop_velocity(6500)
@@ -47,7 +48,8 @@
47 , show_for_all(false)48 , show_for_all(false)
48{49{
49 auto changed_lambda = [this] {50 auto changed_lambda = [this] {
50 changed_idle_.reset(new glib::Idle([this] { option_changed.emit(); return false; }));51 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
52 changed_idle_->Run([this] { option_changed.emit(); return false; });
51 };53 };
5254
53 auto_hide_animation.changed.connect(sigc::hide(changed_lambda));55 auto_hide_animation.changed.connect(sigc::hide(changed_lambda));
@@ -65,6 +67,7 @@
65 launch_animation.changed.connect(sigc::hide(changed_lambda));67 launch_animation.changed.connect(sigc::hide(changed_lambda));
66 reveal_trigger.changed.connect(sigc::hide(changed_lambda));68 reveal_trigger.changed.connect(sigc::hide(changed_lambda));
67 tile_size.changed.connect(sigc::hide(changed_lambda));69 tile_size.changed.connect(sigc::hide(changed_lambda));
70 super_tap_duration.changed.connect(sigc::hide(changed_lambda));
68 urgent_animation.changed.connect(sigc::hide(changed_lambda));71 urgent_animation.changed.connect(sigc::hide(changed_lambda));
69 edge_resist.changed.connect(sigc::hide(changed_lambda));72 edge_resist.changed.connect(sigc::hide(changed_lambda));
70}73}
7174
=== modified file 'launcher/LauncherOptions.h'
--- launcher/LauncherOptions.h 2013-01-18 18:22:03 +0000
+++ launcher/LauncherOptions.h 2013-03-29 17:02:22 +0000
@@ -93,6 +93,7 @@
93 nux::Property<float> background_alpha;93 nux::Property<float> background_alpha;
94 nux::Property<int> icon_size;94 nux::Property<int> icon_size;
95 nux::Property<int> tile_size;95 nux::Property<int> tile_size;
96 nux::Property<int> super_tap_duration;
96 nux::Property<int> edge_decay_rate;97 nux::Property<int> edge_decay_rate;
97 nux::Property<int> edge_overcome_pressure;98 nux::Property<int> edge_overcome_pressure;
98 nux::Property<int> edge_stop_velocity;99 nux::Property<int> edge_stop_velocity;
99100
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2013-03-20 01:14:35 +0000
+++ plugins/unityshell/src/unityshell.cpp 2013-03-29 17:02:22 +0000
@@ -3076,7 +3076,7 @@
3076 PluginAdapter::Default().SetCoverageAreaBeforeAutomaximize(optionGetAutomaximizeValue() / 100.0f);3076 PluginAdapter::Default().SetCoverageAreaBeforeAutomaximize(optionGetAutomaximizeValue() / 100.0f);
3077 break;3077 break;
3078 case UnityshellOptions::DashTapDuration:3078 case UnityshellOptions::DashTapDuration:
3079 launcher_controller_->UpdateSuperTapDuration(optionGetDashTapDuration());3079 launcher_options->super_tap_duration = optionGetDashTapDuration();
3080 break;3080 break;
3081 case UnityshellOptions::AltTabTimeout:3081 case UnityshellOptions::AltTabTimeout:
3082 switcher_controller_->SetDetailOnTimeout(optionGetAltTabTimeout());3082 switcher_controller_->SetDetailOnTimeout(optionGetAltTabTimeout());
@@ -3216,7 +3216,6 @@
3216 auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);3216 auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);
32173217
3218 launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager);3218 launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager);
3219 launcher_controller_->UpdateSuperTapDuration(optionGetDashTapDuration());
3220 AddChild(launcher_controller_.get());3219 AddChild(launcher_controller_.get());
32213220
3222 switcher_controller_ = std::make_shared<switcher::Controller>();3221 switcher_controller_ = std::make_shared<switcher::Controller>();