Skip to content

Commit

Permalink
[WIP] UI: Allow to make the dock a native window
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Sep 13, 2023
1 parent 2aba466 commit 5ef1362
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions UI/api-interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ struct OBSStudioAPI : obs_frontend_callbacks {
}

bool obs_frontend_add_dock_by_id(const char *id, const char *title,
void *widget) override
void *_widget) override
{
if (main->IsDockObjectNameUsed(QT_UTF8(id))) {
blog(LOG_WARNING,
Expand All @@ -414,12 +414,16 @@ struct OBSStudioAPI : obs_frontend_callbacks {
}

OBSDock *dock = new OBSDock(main);
dock->setWidget((QWidget *)widget);
QWidget *widget = (QWidget *)_widget;
dock->setWidget(widget);
dock->setWindowTitle(QT_UTF8(title));
dock->setObjectName(QT_UTF8(id));

main->AddDockWidget(dock, Qt::RightDockWidgetArea);

if (widget->property("Dock_WA_NativeWindow").toBool())
dock->setAttribute(Qt::WA_NativeWindow);

dock->setFloating(true);
dock->setVisible(false);

Expand Down

1 comment on commit 5ef1362

@tytan652
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for myself: setAttribute(Qt::WA_DontCreateNativeAncestors, false); on the browser widget might be a better idea.

Please sign in to comment.