From c2c41fb14ce780ec7b97bde1c4e8ccf75942f3ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2022 11:25:34 +1100 Subject: [PATCH] Fix missing title-bar redrawing with Wayland & libdecor Regression in [0], changing active/inactive missed redrawing the title-bar, [0]: 37b256e26feb454d9febd84dac1b1ce8b8d84d90 --- intern/ghost/intern/GHOST_WindowWayland.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index 07fbbc12d31..ba7df56a34c 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -355,6 +355,8 @@ static void gwl_window_frame_update_from_pending_lockfree(GWL_Window *win) #endif + bool do_redraw = false; + if (win->frame_pending.size[0] != 0 && win->frame_pending.size[1] != 0) { if ((win->frame.size[0] != win->frame_pending.size[0]) || (win->frame.size[1] != win->frame_pending.size[1])) { @@ -362,6 +364,9 @@ static void gwl_window_frame_update_from_pending_lockfree(GWL_Window *win) } } + bool is_active_ghost = (win->ghost_window == + win->ghost_system->getWindowManager()->getActiveWindow()); + if (win->frame_pending.is_active) { win->ghost_window->activate(); } @@ -369,6 +374,10 @@ static void gwl_window_frame_update_from_pending_lockfree(GWL_Window *win) win->ghost_window->deactivate(); } + if (is_active_ghost != win->frame_pending.is_active) { + do_redraw = true; + } + win->frame_pending.size[0] = win->frame.size[0]; win->frame_pending.size[1] = win->frame.size[1]; @@ -377,6 +386,15 @@ static void gwl_window_frame_update_from_pending_lockfree(GWL_Window *win) /* Signal not to apply the scale unless it's configured. */ win->frame_pending.size[0] = 0; win->frame_pending.size[1] = 0; + + if (do_redraw) { +#ifdef USE_EVENT_BACKGROUND_THREAD + /* Could swap buffers, use pending to a redundant call in some cases. */ + gwl_window_pending_actions_tag(win, PENDING_SWAP_BUFFERS); +#else + win->ghost_window->swapBuffers(); +#endif + } } static void gwl_window_frame_update_from_pending(GWL_Window *win)