Merge lp:~3v1n0/unity/spread-app-windows into lp:unity
- spread-app-windows
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4034 |
Proposed branch: | lp:~3v1n0/unity/spread-app-windows |
Merge into: | lp:unity |
Diff against target: |
223 lines (+78/-15) 5 files modified
plugins/unityshell/src/unityshell.cpp (+42/-8) plugins/unityshell/src/unityshell.h (+3/-0) plugins/unityshell/unityshell.xml.in (+12/-0) shortcuts/CompizShortcutModeller.cpp (+19/-0) unity-shared/GnomeKeyGrabber.cpp (+2/-7) |
To merge this branch: | bzr merge lp:~3v1n0/unity/spread-app-windows |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email:
|
Commit message
UnityScreen: add SpreadAppWindows option and trigger it on Super+Ctrl+
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrea Azzarone (azzar1) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
2 | --- plugins/unityshell/src/unityshell.cpp 2015-10-16 08:45:44 +0000 | |||
3 | +++ plugins/unityshell/src/unityshell.cpp 2015-10-28 09:25:56 +0000 | |||
4 | @@ -381,6 +381,8 @@ | |||
5 | 381 | optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3)); | 381 | optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3)); |
6 | 382 | optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3)); | 382 | optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3)); |
7 | 383 | optionSetPanelFirstMenuNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 383 | optionSetPanelFirstMenuNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
8 | 384 | optionSetSpreadAppWindowsInitiate(boost::bind(&UnityScreen::spreadAppWindowsInitiate, this, _1, _2, _3)); | ||
9 | 385 | optionSetSpreadAppWindowsAnywhereInitiate(boost::bind(&UnityScreen::spreadAppWindowsAnywhereInitiate, this, _1, _2, _3)); | ||
10 | 384 | optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 386 | optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
11 | 385 | optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 387 | optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
12 | 386 | optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 388 | optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
13 | @@ -2106,7 +2108,7 @@ | |||
14 | 2106 | action->setState(action->state() | CompAction::StateTermKey); | 2108 | action->setState(action->state() | CompAction::StateTermKey); |
15 | 2107 | 2109 | ||
16 | 2108 | super_keypressed_ = true; | 2110 | super_keypressed_ = true; |
18 | 2109 | int when = options[7].value().i(); // XEvent time in millisec | 2111 | int when = CompOption::getIntOptionNamed(options, "time"); |
19 | 2110 | launcher_controller_->HandleLauncherKeyPress(when); | 2112 | launcher_controller_->HandleLauncherKeyPress(when); |
20 | 2111 | EnsureSuperKeybindings (); | 2113 | EnsureSuperKeybindings (); |
21 | 2112 | 2114 | ||
22 | @@ -2138,7 +2140,7 @@ | |||
23 | 2138 | bool was_tap = state & CompAction::StateTermTapped; | 2140 | bool was_tap = state & CompAction::StateTermTapped; |
24 | 2139 | bool tap_handled = false; | 2141 | bool tap_handled = false; |
25 | 2140 | LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released"); | 2142 | LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released"); |
27 | 2141 | int when = options[7].value().i(); // XEvent time in millisec | 2143 | int when = CompOption::getIntOptionNamed(options, "time"); |
28 | 2142 | 2144 | ||
29 | 2143 | // hack...if the scale just wasn't activated AND the 'when' time is within time to start the | 2145 | // hack...if the scale just wasn't activated AND the 'when' time is within time to start the |
30 | 2144 | // dash then assume was_tap is also true, since the ScalePlugin doesn't accept that state... | 2146 | // dash then assume was_tap is also true, since the ScalePlugin doesn't accept that state... |
31 | @@ -2209,7 +2211,7 @@ | |||
32 | 2209 | /* In order to avoid too many events when keeping the keybinding pressed, | 2211 | /* In order to avoid too many events when keeping the keybinding pressed, |
33 | 2210 | * that would make the unity-panel-service to go crazy (see bug #948522) | 2212 | * that would make the unity-panel-service to go crazy (see bug #948522) |
34 | 2211 | * we need to filter them, just considering an event every 750 ms */ | 2213 | * we need to filter them, just considering an event every 750 ms */ |
36 | 2212 | int event_time = options[7].value().i(); // XEvent time in millisec | 2214 | int event_time = CompOption::getIntOptionNamed(options, "time"); |
37 | 2213 | 2215 | ||
38 | 2214 | if (event_time - first_menu_keypress_time_ < 750) | 2216 | if (event_time - first_menu_keypress_time_ < 750) |
39 | 2215 | { | 2217 | { |
40 | @@ -2279,6 +2281,38 @@ | |||
41 | 2279 | return true; | 2281 | return true; |
42 | 2280 | } | 2282 | } |
43 | 2281 | 2283 | ||
44 | 2284 | void UnityScreen::SpreadAppWindows(bool anywhere) | ||
45 | 2285 | { | ||
46 | 2286 | if (ApplicationPtr const& active_app = ApplicationManager::Default().GetActiveApplication()) | ||
47 | 2287 | { | ||
48 | 2288 | std::vector<Window> windows; | ||
49 | 2289 | |||
50 | 2290 | for (auto& window : active_app->GetWindows()) | ||
51 | 2291 | { | ||
52 | 2292 | if (anywhere || WM.IsWindowOnCurrentDesktop(window->window_id())) | ||
53 | 2293 | windows.push_back(window->window_id()); | ||
54 | 2294 | } | ||
55 | 2295 | |||
56 | 2296 | WM.ScaleWindowGroup(windows, 0, true); | ||
57 | 2297 | } | ||
58 | 2298 | } | ||
59 | 2299 | |||
60 | 2300 | bool UnityScreen::spreadAppWindowsInitiate(CompAction* action, | ||
61 | 2301 | CompAction::State state, | ||
62 | 2302 | CompOption::Vector& options) | ||
63 | 2303 | { | ||
64 | 2304 | SpreadAppWindows(false); | ||
65 | 2305 | return true; | ||
66 | 2306 | } | ||
67 | 2307 | |||
68 | 2308 | bool UnityScreen::spreadAppWindowsAnywhereInitiate(CompAction* action, | ||
69 | 2309 | CompAction::State state, | ||
70 | 2310 | CompOption::Vector& options) | ||
71 | 2311 | { | ||
72 | 2312 | SpreadAppWindows(true); | ||
73 | 2313 | return true; | ||
74 | 2314 | } | ||
75 | 2315 | |||
76 | 2282 | bool UnityScreen::setKeyboardFocusKeyInitiate(CompAction* action, | 2316 | bool UnityScreen::setKeyboardFocusKeyInitiate(CompAction* action, |
77 | 2283 | CompAction::State state, | 2317 | CompAction::State state, |
78 | 2284 | CompOption::Vector& options) | 2318 | CompOption::Vector& options) |
79 | @@ -2632,7 +2666,7 @@ | |||
80 | 2632 | // to receive the Terminate event | 2666 | // to receive the Terminate event |
81 | 2633 | if (state & CompAction::StateInitKey) | 2667 | if (state & CompAction::StateInitKey) |
82 | 2634 | action->setState(action->state() | CompAction::StateTermKey); | 2668 | action->setState(action->state() | CompAction::StateTermKey); |
84 | 2635 | hud_keypress_time_ = options[7].value().i(); // XEvent time in millisec | 2669 | hud_keypress_time_ = CompOption::getIntOptionNamed(options, "time"); |
85 | 2636 | 2670 | ||
86 | 2637 | // pass key through | 2671 | // pass key through |
87 | 2638 | return false; | 2672 | return false; |
88 | @@ -2653,7 +2687,7 @@ | |||
89 | 2653 | if (!(state & CompAction::StateTermTapped)) | 2687 | if (!(state & CompAction::StateTermTapped)) |
90 | 2654 | return false; | 2688 | return false; |
91 | 2655 | 2689 | ||
93 | 2656 | int release_time = options[7].value().i(); // XEvent time in millisec | 2690 | int release_time = CompOption::getIntOptionNamed(options, "time"); |
94 | 2657 | int tap_duration = release_time - hud_keypress_time_; | 2691 | int tap_duration = release_time - hud_keypress_time_; |
95 | 2658 | if (tap_duration > local::ALT_TAP_DURATION) | 2692 | if (tap_duration > local::ALT_TAP_DURATION) |
96 | 2659 | { | 2693 | { |
97 | @@ -3886,9 +3920,9 @@ | |||
98 | 3886 | screen->removeAction(&action); | 3920 | screen->removeAction(&action); |
99 | 3887 | 3921 | ||
100 | 3888 | // We notify that super/alt have been released, to avoid to leave unity in inconsistent state | 3922 | // We notify that super/alt have been released, to avoid to leave unity in inconsistent state |
104 | 3889 | CompOption::Vector options(8); | 3923 | CompOption::Vector options(1); |
105 | 3890 | options[7].setName("time", CompOption::TypeInt); | 3924 | options.back().setName("time", CompOption::TypeInt); |
106 | 3891 | options[7].value().set<int>(screen->getCurrentTime()); | 3925 | options.back().value().set<int>(screen->getCurrentTime()); |
107 | 3892 | 3926 | ||
108 | 3893 | showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, options); | 3927 | showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, options); |
109 | 3894 | showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, options); | 3928 | showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, options); |
110 | 3895 | 3929 | ||
111 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
112 | --- plugins/unityshell/src/unityshell.h 2015-05-12 13:10:07 +0000 | |||
113 | +++ plugins/unityshell/src/unityshell.h 2015-10-28 09:25:56 +0000 | |||
114 | @@ -185,6 +185,8 @@ | |||
115 | 185 | 185 | ||
116 | 186 | bool executeCommand(CompAction* action, CompAction::State state, CompOption::Vector& options); | 186 | bool executeCommand(CompAction* action, CompAction::State state, CompOption::Vector& options); |
117 | 187 | bool showDesktopKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | 187 | bool showDesktopKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); |
118 | 188 | bool spreadAppWindowsInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | ||
119 | 189 | bool spreadAppWindowsAnywhereInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | ||
120 | 188 | bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | 190 | bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); |
121 | 189 | 191 | ||
122 | 190 | bool altTabInitiateCommon(CompAction* action, switcher::ShowMode mode); | 192 | bool altTabInitiateCommon(CompAction* action, switcher::ShowMode mode); |
123 | @@ -318,6 +320,7 @@ | |||
124 | 318 | void DamageBlurUpdateRegion(nux::Geometry const&); | 320 | void DamageBlurUpdateRegion(nux::Geometry const&); |
125 | 319 | 321 | ||
126 | 320 | void ShowFirstRunHints(); | 322 | void ShowFirstRunHints(); |
127 | 323 | void SpreadAppWindows(bool anywhere); | ||
128 | 321 | 324 | ||
129 | 322 | std::unique_ptr<na::TickSource> tick_source_; | 325 | std::unique_ptr<na::TickSource> tick_source_; |
130 | 323 | std::unique_ptr<na::AnimationController> animation_controller_; | 326 | std::unique_ptr<na::AnimationController> animation_controller_; |
131 | 324 | 327 | ||
132 | === modified file 'plugins/unityshell/unityshell.xml.in' | |||
133 | --- plugins/unityshell/unityshell.xml.in 2015-05-12 13:09:57 +0000 | |||
134 | +++ plugins/unityshell/unityshell.xml.in 2015-10-28 09:25:56 +0000 | |||
135 | @@ -87,6 +87,18 @@ | |||
136 | 87 | <default><Alt>F10</default> | 87 | <default><Alt>F10</default> |
137 | 88 | </option> | 88 | </option> |
138 | 89 | 89 | ||
139 | 90 | <option name="spread_app_windows" type="key"> | ||
140 | 91 | <_short>Key to spread the current application windows</_short> | ||
141 | 92 | <_long>Initiate the window Spread for the current application windows.</_long> | ||
142 | 93 | <default><Control><Super>w</default> | ||
143 | 94 | </option> | ||
144 | 95 | |||
145 | 96 | <option name="spread_app_windows_anywhere" type="key"> | ||
146 | 97 | <_short>Key to spread the current application windows in any workspace</_short> | ||
147 | 98 | <_long>Initiate the window Spread for the current application windows, for the all the windows.</_long> | ||
148 | 99 | <default><Control><Super><Shift>w</default> | ||
149 | 100 | </option> | ||
150 | 101 | |||
151 | 90 | <option name="panel_opacity" type="float"> | 102 | <option name="panel_opacity" type="float"> |
152 | 91 | <_short>Panel Opacity</_short> | 103 | <_short>Panel Opacity</_short> |
153 | 92 | <_long>The opacity of the Panel background.</_long> | 104 | <_long>The opacity of the Panel background.</_long> |
154 | 93 | 105 | ||
155 | === modified file 'shortcuts/CompizShortcutModeller.cpp' | |||
156 | --- shortcuts/CompizShortcutModeller.cpp 2014-09-10 17:19:16 +0000 | |||
157 | +++ shortcuts/CompizShortcutModeller.cpp 2015-10-28 09:25:56 +0000 | |||
158 | @@ -68,6 +68,8 @@ | |||
159 | 68 | const std::string UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD = "launcher_switcher_forward"; | 68 | const std::string UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD = "launcher_switcher_forward"; |
160 | 69 | const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud"; | 69 | const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud"; |
161 | 70 | const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu"; | 70 | const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu"; |
162 | 71 | const std::string UNITYSHELL_OPTION_SPREAD_APP_WINDOWS = "spread_app_windows"; | ||
163 | 72 | const std::string UNITYSHELL_OPTION_SPREAD_APP_WINDOWS_ANYWHERE = "spread_app_windows_anywhere"; | ||
164 | 71 | const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward"; | 73 | const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward"; |
165 | 72 | const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL = "alt_tab_forward_all"; | 74 | const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL = "alt_tab_forward_all"; |
166 | 73 | const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window"; | 75 | const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window"; |
167 | @@ -316,6 +318,23 @@ | |||
168 | 316 | } | 318 | } |
169 | 317 | 319 | ||
170 | 318 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | 320 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", |
171 | 321 | (ws_enabled ? | ||
172 | 322 | _("Spreads all windows of the focused application in the current workspace.") : | ||
173 | 323 | _("Spreads all windows of the focused application.")), | ||
174 | 324 | shortcut::OptionType::COMPIZ_KEY, | ||
175 | 325 | UNITYSHELL_PLUGIN_NAME, | ||
176 | 326 | UNITYSHELL_OPTION_SPREAD_APP_WINDOWS)); | ||
177 | 327 | |||
178 | 328 | if (ws_enabled) | ||
179 | 329 | { | ||
180 | 330 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
181 | 331 | _("Spreads all windows of the focused application in all the workspaces."), | ||
182 | 332 | shortcut::OptionType::COMPIZ_KEY, | ||
183 | 333 | UNITYSHELL_PLUGIN_NAME, | ||
184 | 334 | UNITYSHELL_OPTION_SPREAD_APP_WINDOWS_ANYWHERE)); | ||
185 | 335 | } | ||
186 | 336 | |||
187 | 337 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
188 | 319 | _("Minimises all windows."), | 338 | _("Minimises all windows."), |
189 | 320 | shortcut::OptionType::COMPIZ_KEY, | 339 | shortcut::OptionType::COMPIZ_KEY, |
190 | 321 | CORE_PLUGIN_NAME, | 340 | CORE_PLUGIN_NAME, |
191 | 322 | 341 | ||
192 | === modified file 'unity-shared/GnomeKeyGrabber.cpp' | |||
193 | --- unity-shared/GnomeKeyGrabber.cpp 2015-10-01 03:52:09 +0000 | |||
194 | +++ unity-shared/GnomeKeyGrabber.cpp 2015-10-28 09:25:56 +0000 | |||
195 | @@ -64,11 +64,6 @@ | |||
196 | 64 | std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber"; | 64 | std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber"; |
197 | 65 | } | 65 | } |
198 | 66 | 66 | ||
199 | 67 | namespace | ||
200 | 68 | { | ||
201 | 69 | inline int compiz_event_timestamp(CompOption::Vector& options) { return options[7].value().i(); } | ||
202 | 70 | } | ||
203 | 71 | |||
204 | 72 | GnomeGrabber::Impl::Impl(bool test_mode) | 67 | GnomeGrabber::Impl::Impl(bool test_mode) |
205 | 73 | : screen_(screen) | 68 | : screen_(screen) |
206 | 74 | , shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME) | 69 | , shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME) |
207 | @@ -224,7 +219,7 @@ | |||
208 | 224 | action.setState(CompAction::StateInitKey); | 219 | action.setState(CompAction::StateInitKey); |
209 | 225 | action.setInitiate([this, action_id](CompAction* action, CompAction::State state, CompOption::Vector& options) { | 220 | action.setInitiate([this, action_id](CompAction* action, CompAction::State state, CompOption::Vector& options) { |
210 | 226 | LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\""; | 221 | LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\""; |
212 | 227 | ActivateDBusAction(*action, action_id, 0, compiz_event_timestamp(options)); | 222 | ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time")); |
213 | 228 | return true; | 223 | return true; |
214 | 229 | }); | 224 | }); |
215 | 230 | } | 225 | } |
216 | @@ -239,7 +234,7 @@ | |||
217 | 239 | if (state & CompAction::StateTermTapped) | 234 | if (state & CompAction::StateTermTapped) |
218 | 240 | { | 235 | { |
219 | 241 | LOG_DEBUG(logger) << "tapped \"" << key << "\""; | 236 | LOG_DEBUG(logger) << "tapped \"" << key << "\""; |
221 | 242 | ActivateDBusAction(*action, action_id, 0, compiz_event_timestamp(options)); | 237 | ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time")); |
222 | 243 | return true; | 238 | return true; |
223 | 244 | } | 239 | } |
224 | 245 | 240 |
FAILED: Continuous integration, rev:4033 jenkins. qa.ubuntu. com/job/ unity-ci/ 1324/ jenkins. qa.ubuntu. com/job/ unity-wily- amd64-ci/ 102 jenkins. qa.ubuntu. com/job/ unity-wily- armhf-ci/ 100 jenkins. qa.ubuntu. com/job/ unity-wily- i386-ci/ 100/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/1324/ rebuild
http://