Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-10-25 17:58:06 +0300
committerCampbell Barton <campbell@blender.org>2022-10-25 18:01:01 +0300
commit9d188740834017992967a9b91286e2e9b366edd3 (patch)
treecb16734ed47e2bee883a3cfc81cb6a745e583976 /intern
parent7da85ea35abafd60777009c680c06a44c39cbdb9 (diff)
Fix window flickering when moving windows between monitors in Wayland
Moving widows between monitors with different scale set could flicker in a feedback loop because the bounds of the window resizing could cause the bounds of the windows to overlap different monitors. Now the window is resized immediately, instead of letting the change to the windows surface scale resize the window.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index edcbcc14a37..6ee1fb8b27f 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -1041,12 +1041,23 @@ bool GHOST_WindowWayland::outputs_changed_update_scale()
bool changed = false;
if (scale_next != scale_curr) {
- /* Unlikely but possible there is a pending size change is set. */
- window_->size_pending[0] = (window_->size_pending[0] / scale_curr) * scale_next;
- window_->size_pending[1] = (window_->size_pending[1] / scale_curr) * scale_next;
-
window_->scale = scale_next;
wl_surface_set_buffer_scale(window_->wl_surface, scale_next);
+
+ /* It's important to resize the window immediately, to avoid the window changing size
+ * and flickering in a constant feedback loop (in some bases). */
+ if ((window_->size_pending[0] != 0) && (window_->size_pending[1] != 0)) {
+ /* Unlikely but possible there is a pending size change is set. */
+ window_->size[0] = window_->size_pending[0];
+ window_->size[1] = window_->size_pending[1];
+ window_->size_pending[0] = 0;
+ window_->size_pending[1] = 0;
+ }
+ window_->size[0] = (window_->size[0] / scale_curr) * scale_next;
+ window_->size[1] = (window_->size[1] / scale_curr) * scale_next;
+ wl_egl_window_resize(window_->egl_window, UNPACK2(window_->size), 0, 0);
+ window_->ghost_window->notify_size();
+
changed = true;
}