Skip to content

feat(windows): preserving keyboard options in engine#5668

Merged
rc-swag merged 10 commits intofeat/windows/keyman-core-integration-2from
feat/windows/preserving-keyboard-options-in-engine
Sep 27, 2021
Merged

feat(windows): preserving keyboard options in engine#5668
rc-swag merged 10 commits intofeat/windows/keyman-core-integration-2from
feat/windows/preserving-keyboard-options-in-engine

Conversation

@rc-swag
Copy link
Copy Markdown
Contributor

@rc-swag rc-swag commented Sep 3, 2021

Fixes #5653
Three functions are added SaveKeyboardOptionsCore UpdateKeyboardOptionsCore and RestoreKeyboardOptionsCore.
To facilitate in saving the keyboard processors keyboard options and then also restoring them.
Unit tests have also been added to test the added functions.

This functions was to update the keyboard options in the
windows engine with the current options in the core

However it is not needed as first thought. This is because the options
will not be updated in first Non updatable call kmtip. This is due to
the fact the actions will not be processed. A variation on the current
core implementation. I am still pushing the branch as the unit test will
be usefull.
Add save and restore methods for saving and restoring
keyboard processor options.
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Sep 3, 2021
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Sep 3, 2021

User Test Results

  • TEST_SETOPTION (PASSED): the keyboard does alternately output "t2" and "t1" on each key a press.

@rc-swag rc-swag changed the base branch from master to feat/windows/keyman-core-integration-2 September 3, 2021 04:00
@mcdurdin mcdurdin changed the title Feat/windows/preserving keyboard options in engine feat(windows): preserving keyboard options in engine Sep 5, 2021
@github-actions github-actions bot added the feat label Sep 7, 2021
@rc-swag
Copy link
Copy Markdown
Contributor Author

rc-swag commented Sep 7, 2021

User Testing

The test cases below uses the options_set.kmp keyboard. That keyboard outputs a toggled string to easily identify if the toggle has occurred twice for a single key press. The tester can use other keyboards where they are aware the "set
the option is used and verify the output is as expected.

Install options_set.kmp
Test cases

  • TEST_SETOPTION: Toggle option on K_A

press and release a
Expected result:
t2
press and release a
t1
... For each press and release of a
expect a toggle between t1 and t2
t2t1t2t1t2t1....

@keymanapp-test-bot keymanapp-test-bot bot added user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Sep 7, 2021
@MakaraSok
Copy link
Copy Markdown

MakaraSok commented Sep 7, 2021

  • TEST_SETOPTION: BLOCKED The keyboard doesn't show up on the keyboard menu, hence the test cannot be performed. Note that the build used is from this PR 15.0.96-alpha-test-5668

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is some memory leaking happening with keyboard option keys and values

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Sep 13, 2021
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good despite all my comments ;-)

Comment on lines +250 to +251
DisposeKeyboardOptionsCore(&SavedKBDOptions);
SavedKBDOptions = NULL;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to move the second line of this into DisposeKeyboardOptionsCore, given we are using that pattern elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

// Include the standard header and generate the precompiled header.
//

/**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this really shouldn't be in pch.cpp, which should only be a stub for precompiled headers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this really shouldn't be in pch.cpp, which should only be a stub for precompiled headers.

Ok I will move it all out to gtest_main.cpp as that makes it clear what it really is after all. I could go with gtest_mem as the original authour did but gtest_main is even clearer.
I will revert pch.cpp to just being a stub.

@rc-swag
Copy link
Copy Markdown
Contributor Author

rc-swag commented Sep 22, 2021

  • TEST_SETOPTION: BLOCKED The keyboard doesn't show up on the keyboard menu, hence the test cannot be performed. Note that the build used is from this PR [15.0.96-alpha-test-5668]

I have probably have set this keyboard up incorrectly. It wants English Australia (en-AU). However, it doesn't get you to install it. On my system it is available.

@MakaraSok If under the configuration of this Options Set keyboard layout you select the Add language button and choose English United States ( which you already have installed ) does it then show up on the keyboard menu?

I will make it build it again also this time with US because the test is so basic it doesn't need en-AU.

* @copyright (c) 2013 Stephan Brenner
* @license This project is released under the MIT License.
*
* Adapted in 2021 from the gtest_mem.cpp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a link to the original repo

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending user testing

@darcywong00
Copy link
Copy Markdown
Contributor

@mcdurdin - What are your thoughts of checking in the options_set.kmp test keyboard to windows/src/test/manual-tests/ ?

@mcdurdin
Copy link
Copy Markdown
Member

@darcywong00, at this stage, no need -- it's attached to this PR.

@rc-swag
Copy link
Copy Markdown
Contributor Author

rc-swag commented Sep 24, 2021

@keymanapp-test-bot retest

I have changed the Options Set test keyboard to use "en-US"

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Sep 24, 2021
@MakaraSok
Copy link
Copy Markdown

  • TEST_SETOPTION: PASSED the keyboard does alternately output "t2" and "t1" on each key a press.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Sep 27, 2021
@rc-swag rc-swag merged commit 2cf1dcc into feat/windows/keyman-core-integration-2 Sep 27, 2021
@rc-swag rc-swag deleted the feat/windows/preserving-keyboard-options-in-engine branch September 27, 2021 11:22
@rc-swag rc-swag self-assigned this Jun 2, 2023
@rc-swag rc-swag added this to the A15S14 milestone Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(windows): Saving/restoring keyboard options before/after processing a key stroke 🥑

4 participants