Report virtual desktop switches in Windows 10 - #11031
Conversation
|
Hi, one test case to consider: what if virtual desktops are renamed (available starting Version 2004/May 2020 Update/build 19041)? As for testing on earlier builds, I can try on at least 1809. Thanks.
|
|
Oh yeah, I tested that and forgot to note it in my testing scenarios. It
works. I'll update.
|
josephsl
left a comment
There was a problem hiding this comment.
IN desktop object class, I think you can use winVersion.isWin10(version=1903), as it will say yes if one is indeed running May 2019 Update (build 18362) and later.
|
Hi, This might pose a problem if the following happens: Suppose a user running Version 2004 opens multiple virtual desktops. If two or more consecutive virtual desktops have the same name, desktop name will not be reported. STR:
Expected: the names of last two virtual desktops are announced. Thanks. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Desktop switches can only be reported on Windows 10 May 2019 and above. Previous Windows 10 builds could experience delays and incorrect desktop names. Implementation details: 1. Added a Desktop IAccessible NVDAObject which is now used instead of the Desktop Window NVDAObject. This is used for api.getDesktopObject(). It is also used to retrieve the name and to catch nameChange events (see below). Querying of the name via IAccessible is disabled altogether before Windows 10 may 2019, in which case it is hard-coded like it was before this PR. 2. Added eventHandler.handlePossibleDesktopNameChange function. This function checks to see if the Desktop's name has changed since the last time it was called. If so, then it reports the new desktop name. It fetches the desktop name using the Desktop IAccessible object. 3. eventHandler.doPreGainFocus now calls handlePossibleDesktopNameChange, but only after any possible foreground event, so as to ensure that speech is not interrupted. In short this means that the desktop name will be announced before the new focus and its ancestry, but after speech is canceled due to a foreground change. 4. handlePossibleDesktopNameChange is also called for nameChange events on the Desktop IAccessible object. However, NVDA delays the execution of handlePossibleDesktopNameChange in this case by 250 ms, to ensure that it executes after any other possible focus changes. Of course if a focus change did detect the desktop name change, then the delayed call from the name change event will simply do nothing. The reason for the call in the name change event is to handle the situations where the desktop changes but there is no focus event, such as when focused on the taskbar. Co-authored-by: Michael Curran <mick@nvaccess.org>
|
Any updates on this PR? |
|
@jcsteh Do you have any new progress on this PR? Thank you |
|
I don't see how I can reasonably address #11031 (comment) without risking double speaking. Personally, I don't see a good use case for having two consecutive desktops with the same name and I'm not willing to risk double speaking for that edge case. Still, it's been noted that this is a requirement for getting this reviewed and I don't have a solution, so this is stalled. |
|
In what situations you've experienced |
|
The This reports a different guid for a different desktop. There also seems to be an undocumented way to query desktops, but that might not be a good idea to use: |
|
Hi, what we are interested in is the earlier version of Windows 10 that this method will work reliably. Based on what Jamie and others observed, the approach should be reliable on Version 1903 and later – we use name change event handler for this. Thanks.
|
This page suggests that the IVirtualDesktopManager was added in 1511: as for the undocumented methods, this version claims to work on 1607: |
|
Hi, this means, for all practical purposes, Version 1507 is out. I wonder if the suggested approach would work when rearranging virtual desktops as in build 21343 and later. Thanks.
|
|
Hi, 2021 update: given multiple requests to implement this PR, I think for the purposes of getting this merged ASAP, I think it would be best to take one of the following actions:
Although the resulting work would be limited to Windows 10 Version 2004 (May 2020 Update) and later, at least we would have something. Thanks. |
|
Hi, After looking into IVirtualDesktopManager, a few things come to my mind:
Provided that different GUID's are tied to each virtual desktop, a possible solution is checking GUID's instead of names when announcing virtual desktop switches, allowing NvDA to deal with identically named virtual desktops placed next to each other (provided that GUID's are different). If the virtual desktop/GUID pair stays the same when the virtual desktop is rearranged, then we do need to think about the approach again as it can cause NVDA to not announce the newly rearranged virtual desktop (see above). Given the complexity, I think it would be best to just let NVDA announce all virtual desktop switches and refine desktop switch handler as we go i.e. remove equality check for now. Also, I have created and updated Jamie's virtual desktop branch on my repo, which includes just the announcement portion, lint updates, and use of newer NVDA API. Thanks. |
|
Hi, Actually, take back my comment on announcement-only implementation: Jamie is correct in that NVDA will announce desktop name each time focus moves, so something other than desktop name should be used to compare virtual desktops. Also, Python thros attribute error as IAccessible handler is initialized way later, so when desktop object is initialized from core.main, it is incomplete. Thanks. |
|
Hi, 2022 update: I'm looking into IVirtualDesktopManager route as a follow-up to this PR. For now may I suggest that we drop the duplicate desktop name requirement to get this PR merged ASAP? CC @jcsteh, I think it would be best if we can drop the duplicate desktop name requirement i.e. convert this from a draft. Thanks. |
|
Hi, By the way, Jamie, if you don't mind, could you resolve conflicts with master branch (ideally with Microsoft Detours commit added)? Thanks. |
|
Hello @jcsteh. Would you be able to give some visibility on this PR as asked by @josephsl :
Sorry to ask this again, but this feature is regularly asked on mailing lists and it seems blocked only by a corner case. |
|
I wasn't concerned about the duplicate name issue in the first place. I
think it's a very rare corner case and I personally think we shouldn't let
the perfect be the enemy of the good here. This got blocked because others
were concerned (which is fair, regardless of my own opinion) and we didn't
have a good solution for that.
Unfortunately, I don't have an ETA on when I'll be able to pick this up.
It's been a long time since I worked on it, so there's a lot of context
I'll need to re-acquire.
|
|
@feerrenrut in #11031 (comment), you have asked to take into account the corner case of 2 desktops having the same name. Anyone else is still concerned by the corner case of 2 desktops having the same name? Thanks. |
|
@CyrilleB79 As long as this situation is considered and will be handled gracefully, IE not cause an error. A note in the userguide would also be good. I doubt this situation would be common. |
|
Given #11031 (comment), I understand that the duplicate desktop name is not a requirement anymore. More specifically, it is expected that the desktop name be reported upon desktop change unless in the rare case of identical names for consecutive desktops; in this spcific case however it should not cause any error. @jcsteh could you confirm that this PR fulfills this new expectation. If yes, do you still plan to submit it, i.e. resolving the merge conflicts with master branch? |
|
This PR (when it was written) did fulfill that expectation. As I noted above, though, unfortunately, I don't have an estimated time as to when I'll be able to pick this up. It's been a long time since I worked on it, so there's a lot of context |
|
Hi, September 2022 update: as mentioned in josephsl/wintenApps#77, I'm trying out a different approach thanks to the fact that it is CSRSS (client/server runtime subsystem) that raises a name change event when switching between virtual desktops, which eliminates the "same desktop name" problem I raised earlier. However, in order to bring this to core, NVDA's event handler must somehow recognize that the name change event comes from CSRSS's desktop object representation (note that CSRSS's process handle is 0/NULL as seen by NVDA) whenever handling foreground events, as CSRSS will raise name change event as soon as virtual desktops are switched before others can get a chance to raise focus events (tested with Windows App Essentials and Event Tracker add-ons). Thanks. |
|
Hi all, 2023 update: I propose a reimagining of the approach - testing shows that CSRSS method works and is more effective than defining our own desktop object. This means event handler must be notified whenever CSRSS raises name change event. This also means only the newer Windows 10 releases will be supported (will test to pinpoint exactly when the change occurred), meaning Windows 11 will be supported automatically. As an alternative, I might go down the core module patching route via an add-on to experiment with event handler solution and bring the bulk of this PR forward (function names will remain the same but the internals might be different). Thanks. |
|
Hi all, Good news - the earliest release to support CSRSS-based virtual desktop name change event is Windows 10 Creators Update (build 15063), which is ancient by today's standards. Because older releases do not use CSRSS method, it is safe to proceed with CSRSS approach. Note that this means executable names must be checked every time event handler is entered. Thanks. |
|
Hi all, @jcsteh: I can pick this up this weekend at the earliest as I'm testing a solution that resolves the issue I raised. The solution involves editing execute event function to catch name change event coming from CSRSS/virtual desktop object, record the new desktop name (which can be identical to the previous desktop name), then in handle desktop switch function, check the flag and see if it is a string (if yes, announce virtual deskotp name, otherwise do nothing). I also think we can reduce the call later to about 100 milliseconds, but I'd keep it 250 unless future PR's introduce the need to reduce the delay somewhat. Thanks. |
|
Hi, yep, will be closed – thanks for catching this.
From: Cyrille Bougot ***@***.***>
Sent: Tuesday, June 13, 2023 4:34 AM
To: nvaccess/nvda ***@***.***>
Cc: Joseph Lee ***@***.***>; Mention ***@***.***>
Subject: Re: [nvaccess/nvda] Report virtual desktop switches in Windows 10 (#11031)
@jcsteh <https://github.com/jcsteh> , @josephsl <https://github.com/josephsl> :
Since #14932 <#14932> has been merged, I feel that this PR should be closed.
Or did I miss something?
—
Reply to this email directly, view it on GitHub <#11031 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB4AXEA5YIHRB2F5DIVUJZDXLBFZRANCNFSM4MLTOWEA> .
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Link to issue number:
Fixes #5641.
Summary of the issue:
In Windows 10, it is possible to have different virtual desktops, so as to switch between large groups of applications.
To switch between desktops, press control+windows+left/rightArrow.
NVDA however does not report when the desktop changes.
Description of how this pull request fixes the issue:
Based on reverted #8259.
Desktop switches can only be reported on Windows 10 May 2019 and above.
Previous Windows 10 builds could experience delays and incorrect desktop names.
Implementation details:
This is used for api.getDesktopObject().
It is also used to retrieve the name and to catch nameChange events (see below).
Querying of the name via IAccessible is disabled altogether before Windows 10 may 2019, in which case it is hard-coded like it was before this PR.
This function checks to see if the Desktop's name has changed since the last time it was called.
If so, then it reports the new desktop name.
It fetches the desktop name using the Desktop IAccessible object.
In short this means that the desktop name will be announced before the new focus and its ancestry, but after speech is canceled due to a foreground change.
However, NVDA delays the execution of handlePossibleDesktopNameChange in this case by 250 ms, to ensure that it executes after any other possible focus changes.
Of course if a focus change did detect the desktop name change, then the delayed call from the name change event will simply do nothing.
The reason for the call in the name change event is to handle the situations where the desktop changes but there is no focus event, such as when focused on the taskbar.
Changes from #8259:
Testing performed:
Ran NVDA on Windows 10. Switched between multiple virtual desktops. Confirmed that the new desktop name was reported. This test was done both with focus in an application, and on the taskbar.
Also confirmed that if a desktop is renamed, the user specified name is reported instead of "Desktop 1", etc.
Known issues with pull request:
I don't have older builds of Windows 10 to test with. I believe this should address the issues that caused #8259 to be reverted, but I can't be certain.
Change log entry:
New features:
- The name of the current virtual desktop on windows 10 is now reported when switching virtual desktops. (#5641)