Mir

Merge lp:~vanvugt/mir/rotate-using-keyboard into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1346
Proposed branch: lp:~vanvugt/mir/rotate-using-keyboard
Merge into: lp:mir
Prerequisite: lp:~vanvugt/mir/rotate-renderer
Diff against target: 46 lines (+36/-0)
1 file modified
examples/demo-shell/window_manager.cpp (+36/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/rotate-using-keyboard
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+202426@code.launchpad.net

Commit message

demo-shell: Add simple keyboard controls to rotate outputs;
    Ctrl + Alt + <arrow-key>

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM (but don't top-approve without prerequisite)

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-shell/window_manager.cpp'
2--- examples/demo-shell/window_manager.cpp 2014-01-13 06:12:33 +0000
3+++ examples/demo-shell/window_manager.cpp 2014-01-21 10:21:07 +0000
4@@ -164,6 +164,42 @@
5 compositor->start();
6 return true;
7 }
8+ else if ((event.key.modifiers & mir_key_modifier_alt) &&
9+ (event.key.modifiers & mir_key_modifier_ctrl))
10+ {
11+ MirOrientation orientation = mir_orientation_normal;
12+ bool rotating = true;
13+
14+ switch (event.key.scan_code)
15+ {
16+ case KEY_UP: orientation = mir_orientation_normal; break;
17+ case KEY_DOWN: orientation = mir_orientation_inverted; break;
18+ case KEY_LEFT: orientation = mir_orientation_left; break;
19+ case KEY_RIGHT: orientation = mir_orientation_right; break;
20+ default: rotating = false; break;
21+ }
22+
23+ if (rotating)
24+ {
25+ compositor->stop();
26+ auto conf = display->configuration();
27+ conf->for_each_output(
28+ [&](mg::DisplayConfigurationOutput const& output) -> void
29+ {
30+ conf->configure_output(output.id, output.used,
31+ output.top_left,
32+ output.current_mode_index,
33+ output.current_format,
34+ output.power_mode,
35+ orientation);
36+ }
37+ );
38+ display->configure(*conf);
39+ compositor->start();
40+ return true;
41+ }
42+ }
43+
44 }
45 else if (event.type == mir_event_type_motion &&
46 focus_controller)

Subscribers

People subscribed via source and target branches