Skip to content

Commit

Permalink
Fix blank Dev Tools window title
Browse files Browse the repository at this point in the history
Turns out the reason our Dev Tools windows have a blank title when not
wrapped in a custom window is due to older code that performed an early
return on Title Change.

This moves the setting of the window title to the correct location.
  • Loading branch information
WizardCM committed Oct 14, 2024
1 parent aa8953c commit b89a128
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions panel/browser-panel-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,20 @@ void QCefBrowserClient::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefSt
QString qt_title = QString::fromUtf8(str_title.c_str());
QMetaObject::invokeMethod(widget, "titleChanged", Q_ARG(QString, qt_title));
} else { /* handle popup title */
if (title.compare("DevTools") == 0)
return;
CefString newTitle = title;
if (title.compare("DevTools") == 0 && widget)
newTitle = QString(obs_module_text("DevTools"))
.arg(widget->parentWidget()->windowTitle())
.toUtf8()
.constData();

#if defined(_WIN32)
CefWindowHandle handl = browser->GetHost()->GetWindowHandle();
std::wstring str_title = title;
std::wstring str_title = newTitle;
SetWindowTextW((HWND)handl, str_title.c_str());
#elif defined(__linux__)
CefWindowHandle handl = browser->GetHost()->GetWindowHandle();
XStoreName(cef_get_xdisplay(), handl, title.ToString().c_str());
XStoreName(cef_get_xdisplay(), handl, newTitle.ToString().c_str());
#endif
}
}
Expand Down Expand Up @@ -308,12 +312,10 @@ bool QCefBrowserClient::OnContextMenuCommand(CefRefPtr<CefBrowser> browser, CefR
CefRefPtr<CefBrowserHost> host = browser->GetHost();
CefWindowInfo windowInfo;
QPoint pos;
QString title;
switch (command_id) {
case MENU_ITEM_DEVTOOLS:
#if defined(_WIN32) && CHROME_VERSION_BUILD < 6533
title = QString(obs_module_text("DevTools")).arg(widget->parentWidget()->windowTitle());
windowInfo.SetAsPopup(host->GetWindowHandle(), title.toUtf8().constData());
windowInfo.SetAsPopup(host->GetWindowHandle(), "");
#endif
pos = widget->mapToGlobal(QPoint(0, 0));
windowInfo.bounds.x = pos.x();
Expand Down

0 comments on commit b89a128

Please sign in to comment.