xdgshell: bump to 6, send suspended states

This commit is contained in:
Vaxry 2023-12-23 22:30:49 +01:00
parent 5c7e23f86b
commit d5811283d2
5 changed files with 32 additions and 2 deletions

View file

@ -193,7 +193,7 @@ void CCompositor::initServer() {
m_sWLROutputPowerMgr = wlr_output_power_manager_v1_create(m_sWLDisplay); m_sWLROutputPowerMgr = wlr_output_power_manager_v1_create(m_sWLDisplay);
m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay, 5); m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay, 6);
m_sWLRCursor = wlr_cursor_create(); m_sWLRCursor = wlr_cursor_create();
wlr_cursor_attach_output_layout(m_sWLRCursor, m_sWLROutputLayout); wlr_cursor_attach_output_layout(m_sWLRCursor, m_sWLROutputLayout);
@ -2781,3 +2781,12 @@ void CCompositor::setPreferredScaleForSurface(wlr_surface* pSurface, double scal
void CCompositor::setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform) { void CCompositor::setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform) {
wlr_surface_set_preferred_buffer_transform(pSurface, transform); wlr_surface_set_preferred_buffer_transform(pSurface, transform);
} }
void CCompositor::updateSuspendedStates() {
for (auto& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped)
continue;
w->setSuspended(w->isHidden() || !g_pHyprRenderer->shouldRenderWindow(w.get()));
}
}

View file

@ -208,6 +208,7 @@ class CCompositor {
void leaveUnsafeState(); void leaveUnsafeState();
void setPreferredScaleForSurface(wlr_surface* pSurface, double scale); void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform); void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
void updateSuspendedStates();
std::string explicitConfigPath; std::string explicitConfigPath;

View file

@ -511,6 +511,8 @@ void CWindow::setHidden(bool hidden) {
if (hidden && g_pCompositor->m_pLastWindow == this) { if (hidden && g_pCompositor->m_pLastWindow == this) {
g_pCompositor->m_pLastWindow = nullptr; g_pCompositor->m_pLastWindow = nullptr;
} }
setSuspended(hidden);
} }
bool CWindow::isHidden() { bool CWindow::isHidden() {
@ -1007,3 +1009,13 @@ bool CWindow::shouldSendFullscreenState() {
const auto MODE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID)->m_efFullscreenMode; const auto MODE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID)->m_efFullscreenMode;
return m_bFakeFullscreenState || (m_bIsFullscreen && (MODE == FULLSCREEN_FULL)); return m_bFakeFullscreenState || (m_bIsFullscreen && (MODE == FULLSCREEN_FULL));
} }
void CWindow::setSuspended(bool suspend) {
if (suspend == m_bSuspended)
return;
if (m_bIsX11)
return;
wlr_xdg_toplevel_set_suspended(m_uSurface.xdg->toplevel, suspend);
}

View file

@ -367,6 +367,7 @@ class CWindow {
float rounding(); float rounding();
bool canBeTorn(); bool canBeTorn();
bool shouldSendFullscreenState(); bool shouldSendFullscreenState();
void setSuspended(bool suspend);
int getRealBorderSize(); int getRealBorderSize();
void updateSpecialRenderData(); void updateSpecialRenderData();
@ -392,7 +393,8 @@ class CWindow {
private: private:
// For hidden windows and stuff // For hidden windows and stuff
bool m_bHidden = false; bool m_bHidden = false;
bool m_bSuspended = false;
}; };
/** /**

View file

@ -565,6 +565,8 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal, bool
g_pCompositor->updateFullscreenFadeOnWorkspace(pWorkspace); g_pCompositor->updateFullscreenFadeOnWorkspace(pWorkspace);
g_pConfigManager->ensureVRR(this); g_pConfigManager->ensureVRR(this);
g_pCompositor->updateSuspendedStates();
} }
void CMonitor::changeWorkspace(const int& id, bool internal) { void CMonitor::changeWorkspace(const int& id, bool internal) {
@ -590,6 +592,8 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
else else
g_pInputManager->refocus(); g_pInputManager->refocus();
g_pCompositor->updateSuspendedStates();
return; return;
} }
@ -631,6 +635,8 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", pWorkspace->m_szName + "," + szName}); g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", pWorkspace->m_szName + "," + szName});
g_pHyprRenderer->damageMonitor(this); g_pHyprRenderer->damageMonitor(this);
g_pCompositor->updateSuspendedStates();
} }
void CMonitor::setSpecialWorkspace(const int& id) { void CMonitor::setSpecialWorkspace(const int& id) {