[idd] capture: add forced indirect copy
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

This commit is contained in:
Geoffrey McRae
2026-08-17 05:12:05 +10:00
parent 96c3056cc9
commit 2005ea5d69
7 changed files with 73 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ CConfigWindow::CConfigWindow() : m_scale(1)
m_noGPU = m_settings.getNoGPU();
m_exclusive = m_settings.getExclusiveMonitor();
m_forceFullDirectCopy = m_settings.getForceFullDirectCopy();
m_forceIndirectCopy = m_settings.getForceIndirectCopy();
}
if (!CreateWindowEx(0, MAKEINTATOM(s_atom), L"Looking Glass IDD Configuration",
@@ -96,6 +97,7 @@ void CConfigWindow::updateFont()
*m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz, *m_modeSave, *m_modeRevert,
*m_prefGroup, *m_prefNoGPU, *m_prefExclusive,
*m_prefForceFullDirectCopy,
*m_prefForceIndirectCopy,
}))
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
}
@@ -191,6 +193,8 @@ LRESULT CConfigWindow::onCreate()
m_prefExclusive.reset(new CCheckbox(L"Make LG the only monitor", 0, m_hwnd));
m_prefForceFullDirectCopy.reset(new CCheckbox(
L"Force full direct frame copies", 0, m_hwnd));
m_prefForceIndirectCopy.reset(new CCheckbox(
L"Force indirect copy", 0, m_hwnd));
if (m_noGPU)
m_prefNoGPU->setChecked(*m_noGPU);
@@ -201,6 +205,9 @@ LRESULT CConfigWindow::onCreate()
if (m_forceFullDirectCopy)
m_prefForceFullDirectCopy->setChecked(*m_forceFullDirectCopy);
if (m_forceIndirectCopy)
m_prefForceIndirectCopy->setChecked(*m_forceIndirectCopy);
LONG width, height;
getMinimumSize(width, height);
SetWindowPos(m_hwnd, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
@@ -240,10 +247,11 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
pos.pinBottomLeft(*m_modeSave, 20, 20, 132, 24);
pos.pinBottomLeft(*m_modeRevert, 154, 20, 50, 24);
pos.pinTopLeft(*m_prefGroup, 224, 40, 200, 92);
pos.pinTopLeft(*m_prefGroup, 224, 40, 200, 112);
pos.pinTopLeft(*m_prefNoGPU, 236, 64, 176, 20);
pos.pinTopLeft(*m_prefExclusive, 236, 84, 176, 20);
pos.pinTopLeft(*m_prefForceFullDirectCopy, 236, 104, 188, 20);
pos.pinTopLeft(*m_prefForceIndirectCopy, 236, 124, 188, 20);
return 0;
}
@@ -368,6 +376,22 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
m_prefForceFullDirectCopy->setChecked(value);
sendSettingChange();
}
else if (m_prefForceIndirectCopy &&
hwnd == *m_prefForceIndirectCopy && code == BN_CLICKED &&
m_forceIndirectCopy)
{
const bool value = !*m_forceIndirectCopy;
const LSTATUS result = m_settings.setForceIndirectCopy(value);
if (result != ERROR_SUCCESS)
{
DEBUG_ERROR_HR(result, "Failed to save ForceIndirectCopy");
return 0;
}
*m_forceIndirectCopy = value;
m_prefForceIndirectCopy->setChecked(value);
sendSettingChange();
}
else if (m_modeSave && hwnd == *m_modeSave && code == BN_CLICKED)
{
bool updated = false;

View File

@@ -65,6 +65,7 @@ class CConfigWindow : public CWindow
std::unique_ptr<CCheckbox> m_prefNoGPU;
std::unique_ptr<CCheckbox> m_prefExclusive;
std::unique_ptr<CCheckbox> m_prefForceFullDirectCopy;
std::unique_ptr<CCheckbox> m_prefForceIndirectCopy;
std::function<void()> m_onDestroy;
std::function<void()> m_onSettingChange;
@@ -77,6 +78,7 @@ class CConfigWindow : public CWindow
std::optional<bool> m_noGPU;
std::optional<bool> m_exclusive;
std::optional<bool> m_forceFullDirectCopy;
std::optional<bool> m_forceIndirectCopy;
void getMinimumSize(LONG &width, LONG &height);
void updateFont();

View File

@@ -290,3 +290,28 @@ LSTATUS CRegistrySettings::setForceFullDirectCopy(bool forceFullCopy)
return RegSetValueEx(hKey, L"ForceFullDirectCopy", 0, REG_DWORD,
(LPBYTE)&dwValue, sizeof(DWORD));
}
std::optional<bool> CRegistrySettings::getForceIndirectCopy()
{
DWORD result, cbData = sizeof result;
LSTATUS status = RegGetValue(hKey, nullptr, L"ForceIndirectCopy",
RRF_RT_REG_DWORD, nullptr, &result, &cbData);
switch (status)
{
case ERROR_SUCCESS:
return !!result;
case ERROR_FILE_NOT_FOUND:
return false;
default:
DEBUG_ERROR_HR(status, "RegGetValue(ForceIndirectCopy)");
return {};
}
}
LSTATUS CRegistrySettings::setForceIndirectCopy(bool forceIndirectCopy)
{
DWORD dwValue = forceIndirectCopy;
return RegSetValueEx(hKey, L"ForceIndirectCopy", 0, REG_DWORD,
(LPBYTE)&dwValue, sizeof(DWORD));
}

View File

@@ -59,4 +59,7 @@ public:
std::optional<bool> getForceFullDirectCopy();
LSTATUS setForceFullDirectCopy(bool forceFullCopy);
std::optional<bool> getForceIndirectCopy();
LSTATUS setForceIndirectCopy(bool forceIndirectCopy);
};