Mir

Merge lp:~andreas-pokorny/mir/fix-1626435 into lp:mir

Proposed by Andreas Pokorny on 2016-09-23
Status: Merged
Approved by: Daniel van Vugt on 2016-09-27
Approved revision: 3715
Merged at revision: 3718
Proposed branch: lp:~andreas-pokorny/mir/fix-1626435
Merge into: lp:mir
Diff against target: 40 lines (+11/-1)
2 files modified
src/client/input/xkb_mapper.cpp (+2/-1)
tests/unit-tests/client/input/test_xkb_mapper.cpp (+9/-0)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/fix-1626435
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Needs Fixing on 2016-09-30
Mir CI Bot continuous-integration Approve on 2016-09-27
Daniel van Vugt Approve on 2016-09-27
Kevin DuBois (community) Approve on 2016-09-26
Brandon Schaefer (community) 2016-09-23 Approve on 2016-09-23
Review via email: mp+306655@code.launchpad.net

Commit message

Allow changing the keymap used for a device during runtime

Description of the change

Small error in Keymapper that made per device changes of the keymap impossible.

To post a comment you must log in.
Brandon Schaefer (brandontschaefer) wrote :

lgtm

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3713
https://mir-jenkins.ubuntu.com/job/mir-ci/1802/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2252/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2315
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2306
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2280
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2280/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2280
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2280/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2280
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2280/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2280
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2280/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2280/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1802/rebuild

review: Needs Fixing (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3713
https://mir-jenkins.ubuntu.com/job/mir-ci/1808/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2258/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2321
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2312
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2312
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2312
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2286
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2286/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2286
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2286/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2286
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2286/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2286
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2286/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2286/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1808/rebuild

review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

^^^
Your new test case is failing.

23:04:37 13: /<<BUILDDIR>>/mir-0.25.0+xenial2312bzr3713/tests/acceptance-tests/test_nested_input.cpp:334: Failure
23:04:37 13: Actual function call count doesn't match EXPECT_CALL(*nested_mir.mock_event_filter, handle(mt::KeyOfSymbol(0xfe03)))...
23:04:37 13: Expected: to be called once
23:04:37 13: Actual: never called - unsatisfied and active
23:04:37 13: [2016-09-23 23:04:37.696838] mirserver: Stopping
23:04:37 13: [ FAILED ] NestedInput.nested_server_can_switch_keymap_when_device_is_added (1460 ms)

lp:~andreas-pokorny/mir/fix-1626435 updated on 2016-09-26
3714. By Andreas Pokorny on 2016-09-26

Wait for the actual keyboard device to show up

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3714
https://mir-jenkins.ubuntu.com/job/mir-ci/1813/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2265/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2328
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2319
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2319
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2319
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2293
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2293/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2293/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2293/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2293
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2293/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2293/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1813/rebuild

review: Needs Fixing (continuous-integration)
Kevin DuBois (kdub) wrote :

alright once the test case passes ci

review: Approve
lp:~andreas-pokorny/mir/fix-1626435 updated on 2016-09-26
3715. By Andreas Pokorny on 2016-09-26

use a simpler test to validate the fix

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3715
https://mir-jenkins.ubuntu.com/job/mir-ci/1816/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2269/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2332
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2323
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2323
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2323
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2297/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2297/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2297/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2297/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1816/rebuild

review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

^^^
14:21:34 Slave went offline during the build

Daniel van Vugt (vanvugt) wrote :

Also approved new version

review: Approve
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)
Lukáš Tinkl (lukas-kde) wrote :
review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/input/xkb_mapper.cpp'
2--- src/client/input/xkb_mapper.cpp 2016-07-14 09:19:49 +0000
3+++ src/client/input/xkb_mapper.cpp 2016-09-26 13:49:27 +0000
4@@ -148,10 +148,10 @@
5 auto input_event = mir_event_get_input_event(&ev);
6 auto input_type = mir_input_event_get_type(input_event);
7 auto device_id = mir_input_event_get_device_id(input_event);
8- auto mapping_state = get_keymapping_state(device_id);
9
10 if (input_type == mir_input_event_type_key)
11 {
12+ auto mapping_state = get_keymapping_state(device_id);
13 if (mapping_state && mapping_state->update_and_map(ev))
14 update_modifier();
15 }
16@@ -211,6 +211,7 @@
17 {
18 std::lock_guard<std::mutex> lg(guard);
19
20+ device_mapping.erase(id);
21 device_mapping.emplace(std::piecewise_construct,
22 std::forward_as_tuple(id),
23 std::forward_as_tuple(std::move(new_keymap)));
24
25=== modified file 'tests/unit-tests/client/input/test_xkb_mapper.cpp'
26--- tests/unit-tests/client/input/test_xkb_mapper.cpp 2016-07-14 09:18:37 +0000
27+++ tests/unit-tests/client/input/test_xkb_mapper.cpp 2016-09-26 13:49:27 +0000
28@@ -325,3 +325,12 @@
29 map_event(keyboard_cz, mir_keyboard_action_up, KEY_CAPSLOCK);
30 map_event(keyboard_cz, mir_keyboard_action_down, KEY_2);
31 }
32+
33+TEST_F(XKBMapper, setting_keymap_again_overwrites_keymap)
34+{
35+ auto keyboard = MirInputDeviceId{3};
36+ mapper.set_keymap_for_device(keyboard, mi::Keymap{"pc105", "us", "",""});
37+ EXPECT_EQ(XKB_KEY_y, map_key(keyboard, mir_keyboard_action_down, KEY_Y));
38+ mapper.set_keymap_for_device(keyboard, mi::Keymap{"pc105", "de", "",""});
39+ EXPECT_EQ(XKB_KEY_y, map_key(keyboard, mir_keyboard_action_down, KEY_Z));
40+}

Subscribers

People subscribed via source and target branches