[OH] Provide correct geometry offset and fix available screen dimensions (#36915)

This commit corrects the geometry details provided under the OH platform
by getting the offset from the OS. OH port provides correct offset and
available space.

Fixes: #36466

---------

Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
Astraea Quinn S 2025-05-09 17:07:49 +02:00 committed by GitHub
parent 2aaf9695df
commit 366515f256
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 6 deletions

View file

@ -97,7 +97,10 @@ pub fn init(
let Ok(window_size) = (unsafe { super::get_xcomponent_size(xcomponent, native_window) }) else {
return Err("Failed to get xcomponent size");
};
let coordinates = Coordinates::new(0, 0, window_size.width, window_size.height);
let Ok((x, y)) = (unsafe { super::get_xcomponent_offset(xcomponent, native_window) }) else {
return Err("Failed to get xcomponent offset");
};
let coordinates = Coordinates::new(x, y, window_size.width, window_size.height);
let display_handle = RawDisplayHandle::Ohos(OhosDisplayHandle::new());
let display_handle = unsafe { DisplayHandle::borrow_raw(display_handle) };