[Bf-blender-cvs] [56f783d8832] blender-v3.4-release: GHOST/Wayland: only use a single swapBuffers for libdecor redrawing

Campbell Barton noreply at git.blender.org
Tue Nov 15 02:33:40 CET 2022


Commit: 56f783d883239caeadaf92cc08d8d57d589169f5
Author: Campbell Barton
Date:   Tue Nov 15 12:28:45 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB56f783d883239caeadaf92cc08d8d57d589169f5

GHOST/Wayland: only use a single swapBuffers for libdecor redrawing

Using a single draw works in my tests and I couldn't reproduce the
issue noted in the comment.

Also apply minor cleanup, assigning a variable before calling methods to
reduce diff-noise in planned changes.

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

M	intern/ghost/intern/GHOST_WindowWayland.cpp

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

diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 7e9697d6a69..3445898a6a8 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -332,7 +332,10 @@ static void xdg_toplevel_handle_configure(void *data,
 static void xdg_toplevel_handle_close(void *data, xdg_toplevel * /*xdg_toplevel*/)
 {
   CLOG_INFO(LOG, 2, "close");
-  static_cast<GWL_Window *>(data)->ghost_window->close();
+
+  GWL_Window *win = static_cast<GWL_Window *>(data);
+
+  win->ghost_window->close();
 }
 
 static const xdg_toplevel_listener xdg_toplevel_listener = {
@@ -424,16 +427,18 @@ static void frame_handle_close(struct libdecor_frame * /*frame*/, void *data)
 {
   CLOG_INFO(LOG, 2, "close");
 
-  static_cast<GWL_Window *>(data)->ghost_window->close();
+  GWL_Window *win = static_cast<GWL_Window *>(data);
+
+  win->ghost_window->close();
 }
 
 static void frame_handle_commit(struct libdecor_frame * /*frame*/, void *data)
 {
   CLOG_INFO(LOG, 2, "commit");
 
-  /* We have to swap twice to keep any pop-up menus alive. */
-  static_cast<GWL_Window *>(data)->ghost_window->swapBuffers();
-  static_cast<GWL_Window *>(data)->ghost_window->swapBuffers();
+  GWL_Window *win = static_cast<GWL_Window *>(data);
+
+  win->ghost_window->swapBuffers();
 }
 
 static struct libdecor_frame_interface libdecor_frame_iface = {
@@ -461,7 +466,10 @@ static void xdg_toplevel_decoration_handle_configure(
     const uint32_t mode)
 {
   CLOG_INFO(LOG, 2, "configure (mode=%u)", mode);
-  static_cast<GWL_Window *>(data)->xdg_decor->mode = (zxdg_toplevel_decoration_v1_mode)mode;
+
+  GWL_Window *win = static_cast<GWL_Window *>(data);
+
+  win->xdg_decor->mode = (zxdg_toplevel_decoration_v1_mode)mode;
 }
 
 static const zxdg_toplevel_decoration_v1_listener xdg_toplevel_decoration_v1_listener = {



More information about the Bf-blender-cvs mailing list