[Bf-blender-cvs] [787ae01dad5] blender-v3.4-release: Cleanup: move title into GWL_Window

Campbell Barton noreply at git.blender.org
Sat Nov 12 06:39:32 CET 2022


Commit: 787ae01dad539d8dfdcdcae7c918f6cd4a907a7b
Author: Campbell Barton
Date:   Sat Nov 12 16:26:53 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB787ae01dad539d8dfdcdcae7c918f6cd4a907a7b

Cleanup: move title into GWL_Window

Nearly all Wayland window data is stored in this struct,
follow this convention so GWL_Window functions can be self contained.

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

M	intern/ghost/intern/GHOST_WindowWayland.cpp
M	intern/ghost/intern/GHOST_WindowWayland.h

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

diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 561ef921187..58c6025f24c 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -106,6 +106,8 @@ struct GWL_Window {
   WGL_XDG_Decor_Window *xdg_decor = nullptr;
 
   wl_egl_window *egl_window = nullptr;
+
+  std::string title;
   bool is_maximised = false;
   bool is_fullscreen = false;
   bool is_active = false;
@@ -128,6 +130,8 @@ static void gwl_window_title_set(GWL_Window *win, const char *title)
     WGL_XDG_Decor_Window &decor = *win->xdg_decor;
     xdg_toplevel_set_title(decor.toplevel, title);
   }
+
+  win->title = title;
 }
 
 static GHOST_TWindowState gwl_window_state_get(const GWL_Window *win)
@@ -664,7 +668,6 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
   }
 
   gwl_window_title_set(window_, title);
-  title_ = title;
 
   wl_surface_set_user_data(window_->wl_surface, this);
 
@@ -754,13 +757,11 @@ GHOST_TSuccess GHOST_WindowWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitma
 void GHOST_WindowWayland::setTitle(const char *title)
 {
   gwl_window_title_set(window_, title);
-
-  title_ = title;
 }
 
 std::string GHOST_WindowWayland::getTitle() const
 {
-  return title_.empty() ? "untitled" : title_;
+  return window_->title.empty() ? "untitled" : window_->title;
 }
 
 void GHOST_WindowWayland::getWindowBounds(GHOST_Rect &bounds) const
diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h
index ec473c4a710..b9ef45358f2 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.h
+++ b/intern/ghost/intern/GHOST_WindowWayland.h
@@ -119,7 +119,6 @@ class GHOST_WindowWayland : public GHOST_Window {
  private:
   GHOST_SystemWayland *system_;
   struct GWL_Window *window_;
-  std::string title_;
 
   /**
    * \param type: The type of rendering context create.



More information about the Bf-blender-cvs mailing list