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
1=== modified file 'launcher/LauncherController.cpp'
2--- launcher/LauncherController.cpp 2013-03-14 18:55:36 +0000
3+++ launcher/LauncherController.cpp 2013-03-29 17:02:22 +0000
4@@ -119,7 +119,6 @@
5 , keynav_restore_window_(true)
6 , launcher_key_press_time_(0)
7 , last_dnd_monitor_(-1)
8- , super_tap_duration_(0)
9 , dbus_server_(DBUS_NAME)
10 {
11 #ifdef USE_X11
12@@ -1055,7 +1054,7 @@
13 }
14
15 Controller::Controller(XdndManager::Ptr const& xdnd_manager)
16- : options(Options::Ptr(new Options()))
17+ : options(std::make_shared<Options>())
18 , multiple_launchers(true)
19 , pimpl(new Impl(this, xdnd_manager))
20 {
21@@ -1169,7 +1168,7 @@
22
23 return false;
24 };
25- pimpl->sources_.AddTimeout(pimpl->super_tap_duration_, show_launcher, local::KEYPRESS_TIMEOUT);
26+ pimpl->sources_.AddTimeout(options()->super_tap_duration, show_launcher, local::KEYPRESS_TIMEOUT);
27
28 auto show_shortcuts = [&]()
29 {
30@@ -1189,7 +1188,7 @@
31
32 bool Controller::AboutToShowDash(int was_tap, int when) const
33 {
34- if ((when - pimpl->launcher_key_press_time_) < pimpl->super_tap_duration_ && was_tap)
35+ if ((when - pimpl->launcher_key_press_time_) < options()->super_tap_duration && was_tap)
36 return true;
37 return false;
38 }
39@@ -1197,7 +1196,7 @@
40 void Controller::HandleLauncherKeyRelease(bool was_tap, int when)
41 {
42 int tap_duration = when - pimpl->launcher_key_press_time_;
43- if (tap_duration < pimpl->super_tap_duration_ && was_tap)
44+ if (tap_duration < options()->super_tap_duration && was_tap)
45 {
46 LOG_DEBUG(logger) << "Quick tap, sending activation request.";
47 pimpl->SendHomeActivationRequest();
48@@ -1412,11 +1411,6 @@
49 return false;
50 }
51
52-void Controller::UpdateSuperTapDuration(int const super_tap_duration)
53-{
54- pimpl->super_tap_duration_ = super_tap_duration;
55-}
56-
57 std::string
58 Controller::GetName() const
59 {
60
61=== modified file 'launcher/LauncherController.h'
62--- launcher/LauncherController.h 2013-02-14 17:22:08 +0000
63+++ launcher/LauncherController.h 2013-03-29 17:02:22 +0000
64@@ -82,8 +82,6 @@
65
66 bool IsOverlayOpen() const;
67
68- void UpdateSuperTapDuration(int const super_tap_duration);
69-
70 protected:
71 // Introspectable methods
72 std::string GetName() const;
73
74=== modified file 'launcher/LauncherControllerPrivate.h'
75--- launcher/LauncherControllerPrivate.h 2013-03-06 13:13:37 +0000
76+++ launcher/LauncherControllerPrivate.h 2013-03-29 17:02:22 +0000
77@@ -145,7 +145,6 @@
78 bool keynav_restore_window_;
79 int launcher_key_press_time_;
80 int last_dnd_monitor_;
81- int super_tap_duration_;
82
83 glib::DBusServer dbus_server_;
84 glib::SourceManager sources_;
85
86=== modified file 'launcher/LauncherOptions.cpp'
87--- launcher/LauncherOptions.cpp 2013-01-18 18:22:03 +0000
88+++ launcher/LauncherOptions.cpp 2013-03-29 17:02:22 +0000
89@@ -37,6 +37,7 @@
90 , background_alpha(0.6667)
91 , icon_size(48)
92 , tile_size(54)
93+ , super_tap_duration(250)
94 , edge_decay_rate(1500)
95 , edge_overcome_pressure(2000)
96 , edge_stop_velocity(6500)
97@@ -47,7 +48,8 @@
98 , show_for_all(false)
99 {
100 auto changed_lambda = [this] {
101- changed_idle_.reset(new glib::Idle([this] { option_changed.emit(); return false; }));
102+ changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
103+ changed_idle_->Run([this] { option_changed.emit(); return false; });
104 };
105
106 auto_hide_animation.changed.connect(sigc::hide(changed_lambda));
107@@ -65,6 +67,7 @@
108 launch_animation.changed.connect(sigc::hide(changed_lambda));
109 reveal_trigger.changed.connect(sigc::hide(changed_lambda));
110 tile_size.changed.connect(sigc::hide(changed_lambda));
111+ super_tap_duration.changed.connect(sigc::hide(changed_lambda));
112 urgent_animation.changed.connect(sigc::hide(changed_lambda));
113 edge_resist.changed.connect(sigc::hide(changed_lambda));
114 }
115
116=== modified file 'launcher/LauncherOptions.h'
117--- launcher/LauncherOptions.h 2013-01-18 18:22:03 +0000
118+++ launcher/LauncherOptions.h 2013-03-29 17:02:22 +0000
119@@ -93,6 +93,7 @@
120 nux::Property<float> background_alpha;
121 nux::Property<int> icon_size;
122 nux::Property<int> tile_size;
123+ nux::Property<int> super_tap_duration;
124 nux::Property<int> edge_decay_rate;
125 nux::Property<int> edge_overcome_pressure;
126 nux::Property<int> edge_stop_velocity;
127
128=== modified file 'plugins/unityshell/src/unityshell.cpp'
129--- plugins/unityshell/src/unityshell.cpp 2013-03-20 01:14:35 +0000
130+++ plugins/unityshell/src/unityshell.cpp 2013-03-29 17:02:22 +0000
131@@ -3076,7 +3076,7 @@
132 PluginAdapter::Default().SetCoverageAreaBeforeAutomaximize(optionGetAutomaximizeValue() / 100.0f);
133 break;
134 case UnityshellOptions::DashTapDuration:
135- launcher_controller_->UpdateSuperTapDuration(optionGetDashTapDuration());
136+ launcher_options->super_tap_duration = optionGetDashTapDuration();
137 break;
138 case UnityshellOptions::AltTabTimeout:
139 switcher_controller_->SetDetailOnTimeout(optionGetAltTabTimeout());
140@@ -3216,7 +3216,6 @@
141 auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);
142
143 launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager);
144- launcher_controller_->UpdateSuperTapDuration(optionGetDashTapDuration());
145 AddChild(launcher_controller_.get());
146
147 switcher_controller_ = std::make_shared<switcher::Controller>();