Skip to content

Improve reporting keyboard layout changes#8401

Merged
michaelDCurran merged 8 commits intonvaccess:masterfrom
dkager:i7383
Jul 18, 2018
Merged

Improve reporting keyboard layout changes#8401
michaelDCurran merged 8 commits intonvaccess:masterfrom
dkager:i7383

Conversation

@dkager
Copy link
Contributor

@dkager dkager commented Jun 15, 2018

Link to issue number:

Fixes #7383. Fixes #8419.

Summary of the issue:

If only one keyboard layout is available, NVDA still reports keyboard layout changes. This occurs most frequently when opening new windows. It appears that these notifications come from (de)activating a TSF profile. The chanes should have been ignored. A logic error caused them to be reported anyway.

The message would alternate between one with and one without the language name. For example:

  • English (United States) - United States-International
  • United States-International
  • English (United States) - United States-International
  • United States-International
  • etc

Description of how this pull request fixes the issue:

This PR fixes the logic error. It also overhauls the code to return early if the old and new layouts are identical. NVDA now queries the active layout when it starts instead of comparing the first layout change to None and then always reporting it. Finally, support for XP is removed from the TSF C++ code as requested by @LeonarddeR.

Testing performed:

Tested by using the new code for 15-30 minutes and looking at all the notifications NVDA got and what it did with them. I used one layout. Extensive testing by people who actually use multiple layouts is still needed.

Known issues with pull request:

Even if there is only one layout and NVDA would therefore never report chanes, it still listens for them. This could be avoided by checking how many layouts are installed when NVDA starts. However, this means that NVDA has to be restarted after adding or removing a keyboard layout. I think that the small overhead of just listening to layout changes is the better choice.

Change log entry:

Bug fixes:

dkager added 2 commits June 15, 2018 11:42
In particular, fixes the problem of reporting the same keyboard layout over and over, alternating between a message with and without language name.

  * Don't report if there is no change, typically on TSF profile (de)activation.
  * Query the keyboard layout when NVDA starts instead of starting without a value. The previous implementation caused the first layout change to always be announced, even if the old and new layouts were identical.
  * Don't allow the input method name (two placeholders separated by a hyphen) to be translatable.
  * Fix a log message.
  * Improve comments.
  * Add copyright header.
@dkager dkager requested a review from LeonarddeR June 15, 2018 10:10
@@ -1,3 +1,9 @@
#NVDAHelper.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2017-2018 NV Access Limited, Peter Vagner, Davy Kager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding the header, but I don't think 2017 is a very accurate guess here. Could you do a quick search with git blame and change this accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already know it's 2008, not sure why that got lost.

LeonarddeR
LeonarddeR previously approved these changes Jun 15, 2018
Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

It is indeed hard to predict whether this works 100% as you intend it to work. Therefore, let's give it some time in next to let it prove itself.

@ehollig
Copy link
Contributor

ehollig commented Jun 15, 2018

This sounds as if it fixes #5545 as well.

Copy link
Member

@michaelDCurran michaelDCurran left a comment

Choose a reason for hiding this comment

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

I have multiple layouts installed including Chinese, Japanese and English US. When I switch to say the japanese layout, the language is no longer announced which means I do not know it is Japanese. All it says when I switch is "Microsoft IME". This is similar for Chinese: All it says is "Microsoft Bopomofo". It used to say "Chinese Traditional (Taiwan) - Microsoft Bopomofo".

@dkager
Copy link
Contributor Author

dkager commented Jun 18, 2018

@michaelDCurran Sorry, this is fixed now.

michaelDCurran
michaelDCurran previously approved these changes Jun 18, 2018
@Nikita34196
Copy link

Hello. After this update, the NVDA does not tell you to switch the layout when you switch error occurs.

@Nikita34196
Copy link

INFO - main (11:31:16.726):
Starting NVDA
INFO - core.main (11:31:16.835):
Config dir: C:\Users\nikit\AppData\Roaming\nvda
INFO - config.ConfigManager._loadConfig (11:31:16.835):
Loading config: C:\Users\nikit\AppData\Roaming\nvda\nvda.ini
INFO - core.main (11:31:17.092):
NVDA version next-15324,255cb03f
INFO - core.main (11:31:17.092):
Using Windows version 10.0.17692 workstation
INFO - core.main (11:31:17.092):
Using Python version 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)]
INFO - core.main (11:31:17.094):
Using comtypes version 1.1.3
INFO - external:synthDrivers.RHVoice.SynthDriver.init (11:31:17.335):
Using RHVoice version 0.7.0
INFO - synthDriverHandler.setSynth (11:31:17.338):
Loaded synthDriver RHVoice
INFO - core.main (11:31:17.338):
Using wx version 4.0.1 msw (phoenix)
INFO - brailleInput.initialize (11:31:17.344):
Braille input initialized
INFO - braille.initialize (11:31:17.345):
Using liblouis version 3.6.0
INFO - braille.BrailleHandler.setDisplayByName (11:31:17.348):
Loaded braille display driver noBraille, current display has 0 cells.
WARNING - core.main (11:31:17.398):
Java Access Bridge not available
INFO - _UIAHandler.UIAHandler.MTAThreadFunc (11:31:17.404):
UIAutomation: IUIAutomation5
INFO - core.main (11:31:17.687):
NVDA initialized
ERROR - unhandled exception (11:31:25.529):
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "NVDAHelper.pyc", line 368, in nvdaControllerInternal_inputLangChangeNotify
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
ERROR - unhandled exception (11:31:25.546):
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "NVDAHelper.pyc", line 368, in nvdaControllerInternal_inputLangChangeNotify
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
ERROR - unhandled exception (11:31:27.565):
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "NVDAHelper.pyc", line 368, in nvdaControllerInternal_inputLangChangeNotify
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
ERROR - unhandled exception (11:31:27.585):
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "NVDAHelper.pyc", line 368, in nvdaControllerInternal_inputLangChangeNotify
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)

@dkager
Copy link
Contributor Author

dkager commented Jun 19, 2018

@gdata1 The most recent commit should fix this. Please give that build a try or wait until it lands in next.

@michaelDCurran michaelDCurran merged commit 366bbc1 into nvaccess:master Jul 18, 2018
@nvaccessAuto nvaccessAuto added this to the 2018.3 milestone Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVDA fails to report system input language switching with Alt+Shift nvda announces keyboard and input language in weird places

6 participants