Skip to content

Commit

Permalink
UI: Enable browser hw accel toggle under Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Oct 15, 2024
1 parent ba6a6bf commit e798f5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,13 @@ bool OBSApp::InitGlobalConfigDefaults()

#ifdef _WIN32
config_set_default_bool(appConfig, "Audio", "DisableAudioDucking", true);
#endif

#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
config_set_default_bool(appConfig, "General", "BrowserHWAccel", true);
#endif

#ifdef __APPLE__
config_set_default_bool(appConfig, "General", "BrowserHWAccel", true);
config_set_default_bool(appConfig, "Video", "DisableOSXVSync", true);
config_set_default_bool(appConfig, "Video", "ResetOSXVSyncOnExit", true);
#endif
Expand Down Expand Up @@ -1260,7 +1262,7 @@ bool OBSApp::OBSInit()

obs_set_ui_task_handler(ui_task_handler);

#if defined(_WIN32) || defined(__APPLE__)
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
bool browserHWAccel = config_get_bool(appConfig, "General", "BrowserHWAccel");

OBSDataAutoRelease settings = obs_data_create();
Expand Down
10 changes: 5 additions & 5 deletions UI/window-basic-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
#ifdef _WIN32
HookWidget(ui->disableAudioDucking, CHECK_CHANGED, ADV_CHANGED);
#endif
#if defined(_WIN32) || defined(__APPLE__)
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
HookWidget(ui->browserHWAccel, CHECK_CHANGED, ADV_RESTART);
#endif
HookWidget(ui->filenameFormatting, EDIT_CHANGED, ADV_CHANGED);
Expand Down Expand Up @@ -639,7 +639,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
delete ui->enableNewSocketLoop;
delete ui->enableLowLatencyMode;
delete ui->hideOBSFromCapture;
#ifdef __linux__
#if !defined(__APPLE__) && !defined(__linux__)
delete ui->browserHWAccel;
delete ui->sourcesGroup;
#endif
Expand All @@ -654,7 +654,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
ui->enableNewSocketLoop = nullptr;
ui->enableLowLatencyMode = nullptr;
ui->hideOBSFromCapture = nullptr;
#ifdef __linux__
#if !defined(__APPLE__) && !defined(__linux__)
ui->browserHWAccel = nullptr;
ui->sourcesGroup = nullptr;
#endif
Expand Down Expand Up @@ -2614,7 +2614,7 @@ void OBSBasicSettings::LoadAdvancedSettings()
ui->enableLowLatencyMode->setChecked(enableLowLatencyMode);
ui->enableLowLatencyMode->setToolTip(QTStr("Basic.Settings.Advanced.Network.TCPPacing.Tooltip"));
#endif
#if defined(_WIN32) || defined(__APPLE__)
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
bool browserHWAccel = config_get_bool(App()->GetAppConfig(), "General", "BrowserHWAccel");
ui->browserHWAccel->setChecked(browserHWAccel);
prevBrowserAccel = ui->browserHWAccel->isChecked();
Expand Down Expand Up @@ -3161,7 +3161,7 @@ void OBSBasicSettings::SaveAdvancedSettings()
SaveCheckBox(ui->enableNewSocketLoop, "Output", "NewSocketLoopEnable");
SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable");
#endif
#if defined(_WIN32) || defined(__APPLE__)
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
bool browserHWAccel = ui->browserHWAccel->isChecked();
config_set_bool(App()->GetAppConfig(), "General", "BrowserHWAccel", browserHWAccel);
#endif
Expand Down

0 comments on commit e798f5b

Please sign in to comment.