Move MessageWindow from core to winAPI module#14035
Conversation
See test results for failed build of commit 981b655de7 |
See test results for failed build of commit 7f96082d17 |
| self.orientationCoordsCache = (width,height) | ||
| if width > height: | ||
| # If the height and width are the same, it's actually a screen flip, and we do want to alert of those! | ||
| if self.orientationStateCache == self.ORIENTATION_LANDSCAPE and self.orientationCoordsCache != (width,height): | ||
| return | ||
| #Translators: The screen is oriented so that it is wider than it is tall. | ||
| ui.message(_("Landscape" )) | ||
| self.orientationStateCache = self.ORIENTATION_LANDSCAPE | ||
| else: | ||
| if self.orientationStateCache == self.ORIENTATION_PORTRAIT and self.orientationCoordsCache != (width,height): |
There was a problem hiding this comment.
setting the cache on line 636 means line 639 and line 645 will never be true, so non-changes of orientation are incorrectly reported.
See test results for failed build of commit 0a7ac9dc44 |
feerrenrut
left a comment
There was a problem hiding this comment.
This is definitely an improvement.
Let's look for opportunites to add unit testing while at it, to make future modifications in the area easier.
See test results for failed build of commit f4ac14906b |
See test results for failed build of commit 91f7de5982 |
| @@ -137,6 +137,14 @@ def windowProc(self, hwnd: HWNDValT, msg: int, wParam: int, lParam: int) -> None | |||
| @param lParam: Additional message information. | |||
| """ | |||
| post_windowMessageReceipt.notify(msg=msg, wParam=wParam, lParam=lParam) | |||
There was a problem hiding this comment.
post_ should mean "after it has been handled", however given the naming of this extension point it is a bit of a fuzzy concept. Can you confirm that this is the original order of extension point vs handleWindowsMessage?
The reason to have consistency here is if the extension point listener wants to check state after it has been modified by NVDA.
There was a problem hiding this comment.
yes, this is keeping the original order.
There was a problem hiding this comment.
In this case, I believe post_ means "after the message has been received".
There was a problem hiding this comment.
It probably should have been named pre/post_handleWindowMessage
There was a problem hiding this comment.
This can be easily renamed in this PR, the old symbol has been deprecated/moved anyway.
I'll change this to pre_handleWindowMessage?
| # See the file COPYING for more details. | ||
|
|
||
| """ | ||
| When working on this file, consider moving to winAPI. |
There was a problem hiding this comment.
Let's leave these comments out for now, it isn't clear where the line is for what is "generic Windows abstraction" vs core NVDA behavior. Many files probably have these two concepts coupled, and it will require a careful approach to extract the generic Windows abstraction part into winAPI.
| Used to provide input gestures for touchscreens, touch modes and other support facilities. | ||
| In order to use touch features, NVDA must be installed on a touchscreen computer running Windows 8 and later. | ||
|
|
||
| When working on this file, consider moving to winAPI. |
feerrenrut
left a comment
There was a problem hiding this comment.
I'm a bit worried that the scope of this refactor is growing. This increases the changes of introducing regressions.
| _orientationState: Optional[OrientationState] = None | ||
|
|
||
|
|
||
| def initialize(): |
There was a problem hiding this comment.
Can this module be excluded from the add-on API? Given this is new code, and we don't know there is a demand for it within the API, keeping it excluded will let us iterate safely on the design.
There was a problem hiding this comment.
This also goes for the other new modules that don't need to be exposed.
| class SystemMetrics(IntEnum): | ||
| """ | ||
| GetSystemMetrics constants | ||
| https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-getsystemmetrics |
There was a problem hiding this comment.
Since these are winuser constants, the values living in winUser makes makes them easier to find.
The options I see right now:
- Keep these in
winUser, moving that towinAPIlater. - Add a new
winUsertowinAPI(containing only these constants) now, accepting that it will be confusing to have two identically named modules. - Rename this to
winUserConstants.
There was a problem hiding this comment.
As discussed, this has been moved to winAPI.winUser.constants
See test results for failed build of commit 0ae423b959 |
See test results for failed build of commit 82d6a27496 |
|
Previously, the battery status command read the percent followed by the charge state. This now seems to be reversed, which to me is less than ideal. Is there a reason to flip this information around? The numeric to me is the more important bit of information. |
|
@jage9 - could you open a new issue or GitHub discussion for this? In the issue, please say why this information is more important to you in that order. |
|
The API changes for this issue have been announced here: https://groups.google.com/a/nvaccess.org/g/nvda-api/c/7-8ddyZzloQ/m/6L_Jrpy3BQAJ This was merged before the mailing list was announced. However, we have announced API changes in 2022.3.3 and 2023.1, so it may be misleading to skip the API changes in 2022.4 (when the mailing list was created). |
Link to issue number:
None
Summary of the issue:
core.mainis too long of a function.Work was performed in the message window section of
core.main.In efforts to reduce the length of
core.main, theMessageWindowshould be factored out towinAPI.In doing this, a bug was discovered that orientation status was not incorrectly reported when the state had not changed.
The previous orientation status was not being correctly cached.
Description of user facing changes
A bug was fixed where orientation changes were incorrectly reported when the orientation has not changed.
When the power status changes, the amount of battery time remaining is now reported to be consistent with
script_say_battery_status.Description of development approach
Code has been migrated and reorganised to purpose driven modules.
Testing strategy:
Manually tested:
script_say_battery_status)Known issues with pull request:
None
Change log entries:
refer to PR diff
Code Review Checklist: