diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-18 13:58:00 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-18 14:27:23 +0300 |
commit | 7d030213b259420d176228f6a57af3ccc99d08f8 (patch) | |
tree | a927592c8e7426f2eee586376007fb166b2848bc | |
parent | cf3238c1c79a8acb3e311938eda58558ece49cf6 (diff) |
GHOST/Wayland: implement getAllDisplayDimensions
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 18 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.h | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index f2caa1e3ce3..db8bfceda9b 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -2372,7 +2372,23 @@ void GHOST_SystemWayland::getMainDisplayDimensions(uint32_t &width, uint32_t &he void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const { - getMainDisplayDimensions(width, height); + int32_t xy_min[2] = {INT32_MAX, INT32_MAX}; + int32_t xy_max[2] = {INT32_MIN, INT32_MIN}; + + for (const output_t *output : d->outputs) { + int32_t xy[2] = {0, 0}; + if (output->has_position_logical) { + xy[0] = output->position_logical[0]; + xy[1] = output->position_logical[1]; + } + xy_min[0] = std::min(xy_min[0], xy[0]); + xy_min[1] = std::min(xy_min[1], xy[1]); + xy_max[0] = std::max(xy_max[0], xy[0] + output->size_native[0]); + xy_max[1] = std::max(xy_max[1], xy[1] + output->size_native[1]); + } + + width = xy_max[0] - xy_min[0]; + height = xy_max[1] - xy_min[1]; } GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*glSettings*/) diff --git a/intern/ghost/intern/GHOST_SystemWayland.h b/intern/ghost/intern/GHOST_SystemWayland.h index 04aa4063947..1599e644c68 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.h +++ b/intern/ghost/intern/GHOST_SystemWayland.h @@ -32,6 +32,7 @@ struct output_t { int32_t size_logical[2] = {0, 0}; bool has_size_logical = false; + /** Monitor position in pixels. */ int32_t position_logical[2] = {0, 0}; bool has_position_logical = false; |