UI: Support DnD overlay in linuxbrowser

Add support for checking multiple source types in Drag n Drop callback
to support overlays for linuxbrowser users. Once the "browsersource" is
available on the platform it will have priority.
This commit is contained in:
Kurt Kartaltepe
2020-01-13 19:20:54 -08:00
parent 1b3525e66a
commit aeed4a3aa1
+10 -3
View File
@@ -91,6 +91,7 @@ void OBSBasic::AddDropSource(const char *data, DropType image)
obs_data_t *settings = obs_data_create();
obs_source_t *source = nullptr;
const char *type = nullptr;
std::vector<const char *> types;
QString name;
obs_video_info ovi;
@@ -133,15 +134,21 @@ void OBSBasic::AddDropSource(const char *data, DropType image)
obs_data_set_int(settings, "width", ovi.base_width);
obs_data_set_int(settings, "height", ovi.base_height);
name = QUrl::fromLocalFile(QString(data)).fileName();
type = "browser_source";
types = {"browser_source", "linuxbrowser-source"};
break;
case DropType_Url:
AddDropURL(data, name, settings, ovi);
type = "browser_source";
types = {"browser_source", "linuxbrowser-source"};
break;
}
if (!obs_source_get_display_name(type)) {
for (char const *t : types) {
if (obs_source_get_display_name(t)) {
type = t;
break;
}
}
if (type == nullptr || !obs_source_get_display_name(type)) {
obs_data_release(settings);
return;
}