protocols/kde-deco: fix tug of war in deco mode

fixes #11591
This commit is contained in:
Vaxry 2025-09-04 10:16:54 +01:00
parent 127aab8159
commit 4e785d12a9
No known key found for this signature in database
GPG key ID: 665806380871D640
2 changed files with 11 additions and 5 deletions

View file

@ -8,16 +8,20 @@ CServerDecorationKDE::CServerDecorationKDE(SP<COrgKdeKwinServerDecoration> resou
m_resource->setRelease([this](COrgKdeKwinServerDecoration* pMgr) { PROTO::serverDecorationKDE->destroyResource(this); });
m_resource->setOnDestroy([this](COrgKdeKwinServerDecoration* pMgr) { PROTO::serverDecorationKDE->destroyResource(this); });
m_resource->setRequestMode([this](COrgKdeKwinServerDecoration*, uint32_t mode) {
if (m_requestsSent > 3)
return; // don't start a tug of war
auto sendMode = kdeModeOnRequestCSD(mode);
m_resource->sendMode(sendMode);
mostRecentlySent = sendMode;
mostRecentlyRequested = mode;
m_mostRecentlySent = sendMode;
m_mostRecentlyRequested = mode;
m_requestsSent++;
});
// we send this and ignore request_mode.
auto sendMode = kdeDefaultModeCSD();
m_resource->sendMode(sendMode);
mostRecentlySent = sendMode;
m_mostRecentlySent = sendMode;
}
bool CServerDecorationKDE::good() {

View file

@ -13,8 +13,8 @@ class CServerDecorationKDE {
SP<CWLSurfaceResource> m_surf;
uint32_t mostRecentlySent = 0;
uint32_t mostRecentlyRequested = 0;
uint32_t m_mostRecentlySent = 0;
uint32_t m_mostRecentlyRequested = 0;
bool good();
@ -24,6 +24,8 @@ class CServerDecorationKDE {
uint32_t kdeModeOnReleaseCSD();
SP<COrgKdeKwinServerDecoration> m_resource;
uint32_t m_requestsSent = 0;
};
class CServerDecorationKDEProtocol : public IWaylandProtocol {