From 9032e7128e19bce776431b87bba419614531d7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 11 Nov 2005 13:09:23 +0000 Subject: [PATCH] InitData() no longer calls SetTitle(), but sets the title directly. SetTitle() now also works when called before the window is shown for the first time (ie. before the window thread is running). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14852 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 8c824c0d95..7f5ad19c7f 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1411,16 +1411,15 @@ BWindow::SetTitle(const char *title) SetName(threadName); // if the message loop has been started... - if (Thread() >= B_OK) { + if (Thread() >= B_OK) rename_thread(Thread(), threadName); - // we notify the app_server so we can actually see the change - if (Lock()) { - fLink->StartMessage(AS_SET_WINDOW_TITLE); - fLink->AttachString(fTitle); - fLink->Flush(); - Unlock(); - } + // we notify the app_server so we can actually see the change + if (Lock()) { + fLink->StartMessage(AS_SET_WINDOW_TITLE); + fLink->AttachString(fTitle); + fLink->Flush(); + Unlock(); } } @@ -1928,8 +1927,7 @@ BWindow::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, } -// #pragma mark - -//--------------------Private Methods------------------------------------------- +// #pragma mark - Private Methods void @@ -1938,8 +1936,6 @@ BWindow::InitData(BRect frame, const char* title, window_look look, { STRACE(("BWindow::InitData()\n")); - fTitle = NULL; - if (be_app == NULL) { debugger("You need a valid BApplication object before interacting with the app_server"); return; @@ -1947,8 +1943,10 @@ BWindow::InitData(BRect frame, const char* title, window_look look, fFrame = frame; - // ToDo: that looks wrong... - SetTitle(title ? title : "no_name_window"); + if (title == NULL) + title = ""; + fTitle = strdup(title); + SetName(title); fFeel = feel; fLook = look;