Skip to content

Commit

Permalink
Disable GPU compositing checkbox when GPU disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpsd committed Oct 19, 2024
1 parent 47cf382 commit 9db2199
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,10 @@ void CSettings::CreateGUI()
m_pCheckBoxBrowserGPUEnabled = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabBrowser, _("Enable GPU rendering"), true));
m_pCheckBoxBrowserGPUEnabled->SetPosition(CVector2D(vecTemp.fX + 300.0f, vecTemp.fY - 20.0f));
m_pCheckBoxBrowserGPUEnabled->AutoSize(NULL, 20.0f);
m_pCheckBoxBrowserGPUEnabled->SetClickHandler(GUI_CALLBACK(&CSettings::OnGPUSettingChanged, this));

m_pCheckBoxBrowserGPUCompositingEnabled =
reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabBrowser, _("Enable GPU compositing (GPU required)"), true));
reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(m_pTabBrowser, _("Enable GPU compositing"), true));
m_pCheckBoxBrowserGPUCompositingEnabled->SetPosition(CVector2D(vecTemp.fX + 300.0f, vecTemp.fY));
m_pCheckBoxBrowserGPUCompositingEnabled->AutoSize(NULL, 20.0f);

Expand Down Expand Up @@ -3298,6 +3299,10 @@ void CSettings::LoadData()
m_pCheckBoxRemoteJavascript->SetSelected(bVar);
CVARS_GET("browser_enable_gpu", bVar);
m_pCheckBoxBrowserGPUEnabled->SetSelected(bVar);

if (!bVar)
m_pCheckBoxBrowserGPUCompositingEnabled->SetEnabled(false);

CVARS_GET("browser_enable_gpu_compositing", bVar);
m_pCheckBoxBrowserGPUCompositingEnabled->SetSelected(bVar);

Expand Down Expand Up @@ -4901,3 +4906,9 @@ bool CSettings::IsActive()
{
return m_pWindow->IsActive();
}

bool CSettings::OnGPUSettingChanged(CGUIElement* pElement)
{
m_pCheckBoxBrowserGPUCompositingEnabled->SetEnabled(m_pCheckBoxBrowserGPUEnabled->GetSelected());
return true;
}
1 change: 1 addition & 0 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ class CSettings
bool OnBrowserWhitelistRemove(CGUIElement* pElement);
bool OnBrowserWhitelistDomainAddFocused(CGUIElement* pElement);
bool OnBrowserWhitelistDomainAddDefocused(CGUIElement* pElement);
bool OnGPUSettingChanged(CGUIElement* pElement);

bool OnMouseDoubleClick(CGUIMouseEventArgs Args);

Expand Down

0 comments on commit 9db2199

Please sign in to comment.