diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-18 13:51:49 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-18 14:27:23 +0300 |
commit | cf3238c1c79a8acb3e311938eda58558ece49cf6 (patch) | |
tree | b2b0de9c27b2bb609981ae60f3be1ced39ae79e2 | |
parent | ac4836af6ad915aa6fa2c0e268459d384e0b466e (diff) |
Fix initial window size being scaled down for Hi-DPI displays in Wayland
getMainDisplayDimensions return values were scaled by the UI-scale,
instead of returning pixel values.
Also correct an error accessing the rotated monitor size,
which happened to be harmless as the value isn't used at the moment.
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index aebee003145..f2caa1e3ce3 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -2013,7 +2013,7 @@ static void output_handle_done(void *data, struct wl_output * /*wl_output*/) int32_t size_native[2]; if (output->transform & WL_OUTPUT_TRANSFORM_90) { size_native[0] = output->size_native[1]; - size_native[1] = output->size_native[1]; + size_native[1] = output->size_native[0]; } else { size_native[0] = output->size_native[0]; @@ -2362,11 +2362,12 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorPosition(int32_t /*x*/, int32_t /*y void GHOST_SystemWayland::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const { - if (getNumDisplays() > 0) { - /* We assume first output as main. */ - width = uint32_t(d->outputs[0]->size_native[0]) / d->outputs[0]->scale; - height = uint32_t(d->outputs[0]->size_native[1]) / d->outputs[0]->scale; + if (getNumDisplays() == 0) { + return; } + /* We assume first output as main. */ + width = uint32_t(d->outputs[0]->size_native[0]); + height = uint32_t(d->outputs[0]->size_native[1]); } void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const |