[Bf-blender-cvs] [cf3238c1c79] master: Fix initial window size being scaled down for Hi-DPI displays in Wayland

Campbell Barton noreply at git.blender.org
Sat Jun 18 13:28:00 CEST 2022


Commit: cf3238c1c79a8acb3e311938eda58558ece49cf6
Author: Campbell Barton
Date:   Sat Jun 18 20:51:49 2022 +1000
Branches: master
https://developer.blender.org/rBcf3238c1c79a8acb3e311938eda58558ece49cf6

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.

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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



More information about the Bf-blender-cvs mailing list