Mir

Merge lp:~vanvugt/mir/stub-subfocus into lp:mir

Proposed by Daniel van Vugt
Status: Work in progress
Proposed branch: lp:~vanvugt/mir/stub-subfocus
Merge into: lp:mir
Diff against target: 86 lines (+46/-0)
4 files modified
include/client/mir_toolkit/mir_window.h (+13/-0)
src/client/mir_surface_api.cpp (+5/-0)
src/client/symbols.map (+5/-0)
tests/acceptance-tests/test_client_library.cpp (+23/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/stub-subfocus
Reviewer Review Type Date Requested Status
Chris Halse Rogers Disapprove
Andreas Pokorny (community) Needs Information
Alan Griffiths Needs Information
Mir CI Bot continuous-integration Approve
Review via email: mp+315974@code.launchpad.net

Commit message

Add a stub client API function `mir_window_subfocus' to direct future
desktop zoom and other accessibility features to follow keyboard
navigation.

Better to get toolkits using it early, even if not implemented yet.

Description of the change

This came out of previous discussions with the Unity team about what is required for truly accessible desktop zoom. The zoom should follow keyboard navigation (e.g. text fields and tabbing) when appropriate.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4002
https://mir-jenkins.ubuntu.com/job/mir-ci/2897/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3829
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3908
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/3898
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3856/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/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3856/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3856/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3856/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/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3856/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/3856
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3856/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Can we have a test that shows how the *feature* you envisage works with this API?

I'd be far more confident that this function is useful if it (or a follow-up branch) actually did something.

As it is we're just guessing that this is something we will use one day.

review: Needs Information
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Shouldnt that be a mir_window_spec like API?

Apart from that I could imagine further use cases.. I.e. temporarily moving partially occluded focused windows far enough into the screen to show the "subfocus" area entirely. Then still we could also add that function after 1.0.

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Alan:
No not right now. It's not important enough to implement just right now, so if we're not confident about the design then forget it and we can do this in a later release.

Andreas:
No it's not related to spec. It's just a hint to the shell as to what to look at (if zoomed, and the window is visible and focused and the mouse isn't moving, but that's shell-specific policy). The subfocus area might change on any keystroke. There's no reason I can think of to synchronize that with spec-things, or to trouble the user with the spec API on this. But I like your idea for further use cases.

Revision history for this message
Chris Halse Rogers (raof) wrote :

Very mild disapprove.

I don't think it's a good idea to land API that we don't intend to implement at all during the same release cycle.

review: Disapprove
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, I'll save it for later

Unmerged revisions

4002. By Daniel van Vugt

Prototype

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir_toolkit/mir_window.h'
2--- include/client/mir_toolkit/mir_window.h 2017-01-24 16:49:18 +0000
3+++ include/client/mir_toolkit/mir_window.h 2017-01-31 08:22:49 +0000
4@@ -758,6 +758,19 @@
5 */
6 MirPersistentId* mir_window_request_persistent_id_sync(MirWindow* window);
7
8+/**
9+ * Provide a hint to the shell about the region of a window currently being
10+ * interacted with via the keyboard or voice. This is useful during desktop
11+ * zoom (etc) to notify the shell when the zoom should move to a specific
12+ * region such as a text box or button that has been tabbed to. Shells may
13+ * choose to ignore this information, but it is provided for future-proofing
14+ * toolkits and applications to work correctly with such accessibility features.
15+ * \param [in] window The window whose widget is being focused.
16+ * \param [in] area The area or point to focus on within the window, or
17+ * set this to NULL to remove the focus.
18+ */
19+void mir_window_subfocus(MirWindow* window, MirRectangle const* area);
20+
21 #ifdef __cplusplus
22 }
23 /**@}*/
24
25=== modified file 'src/client/mir_surface_api.cpp'
26--- src/client/mir_surface_api.cpp 2017-01-25 03:34:22 +0000
27+++ src/client/mir_surface_api.cpp 2017-01-31 08:22:49 +0000
28@@ -829,6 +829,11 @@
29 return result;
30 }
31
32+void mir_window_subfocus(MirWindow*, MirRectangle const*)
33+{
34+ // TODO for future use
35+}
36+
37 #pragma GCC diagnostic push
38 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
39
40
41=== modified file 'src/client/symbols.map'
42--- src/client/symbols.map 2017-01-30 08:13:20 +0000
43+++ src/client/symbols.map 2017-01-31 08:22:49 +0000
44@@ -577,3 +577,8 @@
45 mir_window_request_persistent_id;
46 mir_window_request_persistent_id_sync;
47 } MIR_CLIENT_0.25;
48+
49+MIR_CLIENT_0.27 { # New functions in Mir 0.27 or 1.0 or whatever
50+ global:
51+ mir_window_subfocus;
52+} MIR_CLIENT_0.26;
53
54=== modified file 'tests/acceptance-tests/test_client_library.cpp'
55--- tests/acceptance-tests/test_client_library.cpp 2017-01-30 08:13:20 +0000
56+++ tests/acceptance-tests/test_client_library.cpp 2017-01-31 08:22:49 +0000
57@@ -1139,6 +1139,29 @@
58 mir_connection_release(connection);
59 }
60
61+TEST_F(ClientLibrary, can_set_subfocus)
62+{
63+ auto connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
64+
65+ auto surface_spec = mir_create_normal_window_spec(connection, 800, 600);
66+ mir_window_spec_set_pixel_format(surface_spec, mir_pixel_format_argb_8888);
67+ auto window = mir_create_window_sync(surface_spec);
68+ mir_window_spec_release(surface_spec);
69+ ASSERT_THAT(window, IsValid());
70+
71+ // No expectations other than verifying the function is public and
72+ // doesn't crash...
73+ MirRectangle const area{12,34, 56,78};
74+ mir_window_subfocus(window, &area);
75+ mir_window_subfocus(window, NULL);
76+ MirRectangle const point{98,76, 0,0};
77+ mir_window_subfocus(window, &point);
78+ mir_window_subfocus(window, NULL);
79+
80+ mir_window_release_sync(window);
81+ mir_connection_release(connection);
82+}
83+
84 TEST_F(ClientLibrary, input_method_can_specify_foreign_surface_id)
85 {
86 auto first_client = mir_connect_sync(new_connection().c_str(), "Regular Client");

Subscribers

People subscribed via source and target branches