Bug 161844 - Off-by-one error in rectangle size returned by XToolkit::getWorkArea
Summary: Off-by-one error in rectangle size returned by XToolkit::getWorkArea
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:25.2.0 target:24.8.0.0.beta2
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-30 05:27 UTC by Mike Kaganski
Modified: 2024-07-01 13:46 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-06-30 05:27:04 UTC
Consider this code:

Sub ShowScreenSize()
    screenRectangle = CreateUnoService("com.sun.star.awt.Toolkit").getWorkArea()
    MsgBox screenRectangle.Width & " x " & screenRectangle.Height
End Sub

According to the documentation [1], it returns the size and position of the primary display. On my system, the code gives "1919 x 1079", instead of expected "1920 x 1080".

[1] https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1XToolkit.html#a29f80014339cc32d254de3be5cb22057
Comment 1 Mike Kaganski 2024-06-30 05:31:37 UTC
https://gerrit.libreoffice.org/c/core/+/169766
Comment 2 Commit Notification 2024-06-30 07:17:08 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/58ed26938f254e1952dfaed4b208ad5a89b89387

tdf#161844: AbsoluteScreenPixelRectangle is a closed interval

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2024-07-01 13:46:51 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/239cfbdec6c167bcf75c9d9d33ff137f575ea5ce

tdf#161844: AbsoluteScreenPixelRectangle is a closed interval

It will be available in 24.8.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.