ui/obs-browser-widget: Add missing includes for Unix compilers

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-03-10 20:15:18 +01:00
parent ce19d25d71
commit db23069eb6
2 changed files with 10 additions and 6 deletions

View File

@ -9,6 +9,7 @@
#include "../third-party/obs-studio/plugins/obs-browser/panel/browser-panel.hpp" #include "../third-party/obs-studio/plugins/obs-browser/panel/browser-panel.hpp"
#include <mutex> #include <mutex>
#include <stdexcept>
#ifdef D_PLATFORM_LINUX #ifdef D_PLATFORM_LINUX
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@ -111,12 +112,12 @@ void streamfx::ui::obs_browser_widget::set_url(QUrl url)
bool streamfx::ui::obs_browser_widget::is_available() bool streamfx::ui::obs_browser_widget::is_available()
{ {
#ifdef D_PLATFORM_LINUX #ifdef D_PLATFORM_LINUX
const char env_key[] = "XDG_SESSION_TYPE"; const char env_key[] = "XDG_SESSION_TYPE";
const char wayland[] = "wayland"; const char wayland[] = "wayland";
#ifdef __STDC_LIB_EXT1__ #ifdef __STDC_LIB_EXT1__
char env_value[2048]; char env_value[2048];
size_t env_value_len = sizeof(env_value); size_t env_value_len = sizeof(env_value);
if (getenv_s(&env_value_len, env_value, sizeof(env_key), env_key) == 0) { if (getenv_s(&env_value_len, env_value, sizeof(env_key), env_key) == 0) {
if (sizeof(wayland) == env_value_len) { if (sizeof(wayland) == env_value_len) {
if (strncmp(wayland, env_value, sizeof(wayland)) == 0) { if (strncmp(wayland, env_value, sizeof(wayland)) == 0) {
@ -124,12 +125,12 @@ bool streamfx::ui::obs_browser_widget::is_available()
} }
} }
} }
#else #else
const char* env_value = getenv(env_key); const char* env_value = getenv(env_key);
if (strncmp(env_value, wayland, sizeof(wayland)) == 0) { if (strncmp(env_value, wayland, sizeof(wayland)) == 0) {
return false; return false;
} }
#endif #endif
#endif #endif
return true; return true;
} }

View File

@ -6,6 +6,8 @@
#include "util/util-library.hpp" #include "util/util-library.hpp"
#include "warning-disable.hpp" #include "warning-disable.hpp"
#include <memory>
#include <QUrl> #include <QUrl>
#include <QWidget> #include <QWidget>
#include "warning-enable.hpp" #include "warning-enable.hpp"
@ -34,6 +36,7 @@ namespace streamfx::ui {
class obs_browser_widget : public QWidget { class obs_browser_widget : public QWidget {
Q_OBJECT Q_OBJECT
private:
std::shared_ptr<obs_browser_cef> _cef; std::shared_ptr<obs_browser_cef> _cef;
QWidget* _widget; QWidget* _widget;