From d3d706fa2ff8eb69791d829745e8f7cb4fe18f5e Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 30 May 2023 01:02:33 +0200 Subject: Fix cherry_window_get_title() The title can be obtained only if the window has drawn, otherwise must be retrieved by title attribute of CherryWindow. --- src/window.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/window.c b/src/window.c index 491e2b7..23c8abf 100644 --- a/src/window.c +++ b/src/window.c @@ -111,11 +111,16 @@ cherry_window_dispose_on_exit(CherryWindow *w) } char * -cherry_window_get_title(CherryWindow *w) +cherry_window_get_title(CherryWindow *window) { char *wnd_name; - CherryApplication *app = cherry_application_get_running_app(); - XFetchName(app->display, w->window_handler, &wnd_name); + + if (window->base.drawn) { + CherryApplication *app = cherry_application_get_running_app(); + XFetchName(app->display, window->window_handler, &wnd_name); + } else { + wnd_name = window->title; + } return wnd_name; } -- cgit v1.2.3