Wayland: Remove separate window title copy

This commit is contained in:
Camilla Löwy 2024-02-18 15:30:44 +01:00
parent 95d464bb4b
commit af5d250553
2 changed files with 2 additions and 11 deletions

View File

@ -387,7 +387,6 @@ typedef struct _GLFWwindowWayland
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
double cursorPosX, cursorPosY; double cursorPosX, cursorPosY;
char* title;
char* appId; char* appId;
// We need to track the monitors the window spans on to calculate the // We need to track the monitors the window spans on to calculate the

View File

@ -822,8 +822,7 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
if (strlen(window->wl.appId)) if (strlen(window->wl.appId))
libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId); libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId);
if (strlen(window->wl.title)) libdecor_frame_set_title(window->wl.libdecor.frame, window->title);
libdecor_frame_set_title(window->wl.libdecor.frame, window->wl.title);
if (window->minwidth != GLFW_DONT_CARE && if (window->minwidth != GLFW_DONT_CARE &&
window->minheight != GLFW_DONT_CARE) window->minheight != GLFW_DONT_CARE)
@ -939,8 +938,7 @@ static GLFWbool createXdgShellObjects(_GLFWwindow* window)
if (window->wl.appId) if (window->wl.appId)
xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId); xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId);
if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->title);
xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title);
if (window->monitor) if (window->monitor)
{ {
@ -1040,7 +1038,6 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
window->wl.height = wndconfig->height; window->wl.height = wndconfig->height;
window->wl.fbWidth = wndconfig->width; window->wl.fbWidth = wndconfig->width;
window->wl.fbHeight = wndconfig->height; window->wl.fbHeight = wndconfig->height;
window->wl.title = _glfw_strdup(wndconfig->title);
window->wl.appId = _glfw_strdup(wndconfig->wl.appId); window->wl.appId = _glfw_strdup(wndconfig->wl.appId);
window->wl.bufferScale = 1; window->wl.bufferScale = 1;
@ -2215,17 +2212,12 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
if (window->wl.surface) if (window->wl.surface)
wl_surface_destroy(window->wl.surface); wl_surface_destroy(window->wl.surface);
_glfw_free(window->wl.title);
_glfw_free(window->wl.appId); _glfw_free(window->wl.appId);
_glfw_free(window->wl.outputScales); _glfw_free(window->wl.outputScales);
} }
void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title) void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title)
{ {
char* copy = _glfw_strdup(title);
_glfw_free(window->wl.title);
window->wl.title = copy;
if (window->wl.libdecor.frame) if (window->wl.libdecor.frame)
libdecor_frame_set_title(window->wl.libdecor.frame, title); libdecor_frame_set_title(window->wl.libdecor.frame, title);
else if (window->wl.xdg.toplevel) else if (window->wl.xdg.toplevel)