Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Coordinates of the bottom right corner exceed the resolution bounds, resulting in the OnScreenKeyboard failing to render #518

Closed
1 task done
wenbhou opened this issue Jul 11, 2024 · 2 comments
Labels
state:needs-triage Needs to triaged to determine next steps state:stale Has not been updated in a long time type:bug Something isn't working urgency:high Significant with a critical impact

Comments

@wenbhou
Copy link
Contributor

wenbhou commented Jul 11, 2024

Is there an existing issue for this?

  • I have searched existing issues

Current Behavior

The SWM_RECT structure is designed to represent a bounding rectangle, defined by the coordinates of its top-left and bottom-right corners. The top-left coordinates originate from a zero-based index, necessitating the subtraction of one from the bottom-right coordinates to ensure the rectangle's dimensions do not surpass the resolution limits. However, the current implementation omits this decrement, leading to rendering issues with the OnScreenKeyboard on certain screen sizes.

Expected Behavior

For any SWM_RECT instance, the width is calculated as width = right - left + 1, and the height is determined by height = bottom - top + 1. When the origin point of a rectangle is known, along with its width and height, the right coordinate can be derived using right = left + width - 1, and the bottom coordinate is given by bottom = top + height - 1.

Steps To Reproduce

On 13" Laptop:

  1. Press power button and hold Vol Up key to boot to UEFI front page
  2. Go to "Date and Time" page and tap "New date and time" input box to call out OSK
  3. OSK should render properly on screen. <-- Bug here

Build Environment

- OS(s): Windows 11
- Tool Chain(s): VS2022
- Targets Impacted: All

Version Information

url = https://github.com/microsoft/mu_plus
branch = release/202302
SHA = 69d1c094ca61f6d12e8c8e172b07576120e6d259

Urgency

High

Are you going to fix this?

I will fix it

Do you need maintainer feedback?

No maintainer feedback needed

Anything else?

No response

@wenbhou wenbhou added state:needs-triage Needs to triaged to determine next steps type:bug Something isn't working labels Jul 11, 2024
@github-actions github-actions bot added the urgency:high Significant with a critical impact label Jul 11, 2024
makubacki pushed a commit that referenced this issue Jul 16, 2024
## Description

Fix issues in coordinate calculation to solve On-screen keyboard render
issue, and potential issues in other UI widgets.
See #518

The SWM_RECT structure defines a standard bounding rectangle by
specifying the left, top, right, and bottom coordinates. For any
SWM_RECT instance, the width is calculated as `width = right - left +
1`, and the height is determined by `height = bottom - top + 1`. When
the origin point of a rectangle is known, along with its width and
height, the right coordinate can be derived using `right = left + width
- 1`, and the bottom coordinate is given by `bottom = top + height - 1`.
Ensuring the correct application of these formulas prevents the
On-Screen Keyboard (OSK) boundary from exceeding its defined limits.

- [x] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Boot to UEFI menu, all UI items rendered correctly and OSK functioned
well.

## Integration Instructions

N/A
Copy link

This issue has been automatically marked as stale because it has not had activity in 45 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the state:stale Has not been updated in a long time label Aug 25, 2024
@wenbhou wenbhou closed this as completed Aug 26, 2024
@wenbhou
Copy link
Contributor Author

wenbhou commented Aug 26, 2024

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:needs-triage Needs to triaged to determine next steps state:stale Has not been updated in a long time type:bug Something isn't working urgency:high Significant with a critical impact
Projects
None yet
Development

No branches or pull requests

1 participant