mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 18:25:58 +01:00
Merge branch 'main' into main
This commit is contained in:
commit
4263871547
8 changed files with 34 additions and 7 deletions
|
@ -702,7 +702,8 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
const auto BB = w->getWindowBoxUnified(properties);
|
const auto BB = w->getWindowBoxUnified(properties);
|
||||||
CBox box = BB.copy().expand(w->m_iX11Type == 2 ? BORDER_GRAB_AREA : 0);
|
CBox box = BB.copy().expand(w->m_iX11Type == 2 ? BORDER_GRAB_AREA : 0);
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() && w != pIgnoreWindow) {
|
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
|
||||||
|
w != pIgnoreWindow) {
|
||||||
if (box.containsPoint(g_pPointerManager->position()))
|
if (box.containsPoint(g_pPointerManager->position()))
|
||||||
return w;
|
return w;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ class ICustomConfigValueData {
|
||||||
*/
|
*/
|
||||||
class CGradientValueData : public ICustomConfigValueData {
|
class CGradientValueData : public ICustomConfigValueData {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** @brief Default constructor. */
|
/** @brief Default constructor. */
|
||||||
CGradientValueData() {};
|
CGradientValueData() {};
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
||||||
m_vColors.push_back(col);
|
m_vColors.push_back(col);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** @brief Destructor. */
|
/** @brief Destructor. */
|
||||||
virtual ~CGradientValueData() {};
|
virtual ~CGradientValueData() {};
|
||||||
|
|
||||||
|
@ -116,6 +118,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
||||||
*/
|
*/
|
||||||
class CCssGapData : public ICustomConfigValueData {
|
class CCssGapData : public ICustomConfigValueData {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** @brief Default constructor. */
|
/** @brief Default constructor. */
|
||||||
CCssGapData() : top(0), right(0), bottom(0), left(0) {};
|
CCssGapData() : top(0), right(0), bottom(0), left(0) {};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../protocols/FractionalScale.hpp"
|
#include "../protocols/FractionalScale.hpp"
|
||||||
#include "../protocols/SessionLock.hpp"
|
#include "../protocols/SessionLock.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : surface(surface_) {
|
SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : surface(surface_) {
|
||||||
pWlrSurface = surface->surface();
|
pWlrSurface = surface->surface();
|
||||||
|
@ -77,7 +78,6 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
pLock->sendLocked();
|
|
||||||
g_pCompositor->focusSurface(nullptr);
|
g_pCompositor->focusSurface(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't want the red screen to flash.
|
// We don't want the red screen to flash.
|
||||||
// This violates the protocol a bit, but tries to handle the missing sync between a lock surface beeing created and the red screen beeing drawn.
|
|
||||||
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
|
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
|
||||||
if (!m_pSessionLock)
|
if (!m_pSessionLock)
|
||||||
return 0.F;
|
return 0.F;
|
||||||
|
@ -118,6 +117,18 @@ float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
|
||||||
return std::clamp(NOMAPPEDSURFACETIMER->second.getSeconds() - /* delay for screencopy */ 0.5f, 0.f, 1.f);
|
return std::clamp(NOMAPPEDSURFACETIMER->second.getSeconds() - /* delay for screencopy */ 0.5f, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
|
||||||
|
if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked)
|
||||||
|
return;
|
||||||
|
m_pSessionLock->m_lockedMonitors.emplace(id);
|
||||||
|
const auto MONITORS = g_pCompositor->m_vMonitors;
|
||||||
|
const bool LOCKED = std::all_of(MONITORS.begin(), MONITORS.end(), [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
|
||||||
|
if (LOCKED) {
|
||||||
|
m_pSessionLock->lock->sendLocked();
|
||||||
|
m_pSessionLock->m_hasSentLocked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CSessionLockManager::isSurfaceSessionLock(SP<CWLSurfaceResource> pSurface) {
|
bool CSessionLockManager::isSurfaceSessionLock(SP<CWLSurfaceResource> pSurface) {
|
||||||
// TODO: this has some edge cases when it's wrong (e.g. destroyed lock but not yet surfaces)
|
// TODO: this has some edge cases when it's wrong (e.g. destroyed lock but not yet surfaces)
|
||||||
// but can be easily fixed when I rewrite wlr_surface
|
// but can be easily fixed when I rewrite wlr_surface
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
class CSessionLockSurface;
|
class CSessionLockSurface;
|
||||||
class CSessionLock;
|
class CSessionLock;
|
||||||
|
@ -37,6 +38,9 @@ struct SSessionLock {
|
||||||
CHyprSignalListener unlock;
|
CHyprSignalListener unlock;
|
||||||
CHyprSignalListener destroy;
|
CHyprSignalListener destroy;
|
||||||
} listeners;
|
} listeners;
|
||||||
|
|
||||||
|
bool m_hasSentLocked = false;
|
||||||
|
std::unordered_set<uint64_t> m_lockedMonitors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSessionLockManager {
|
class CSessionLockManager {
|
||||||
|
@ -54,6 +58,8 @@ class CSessionLockManager {
|
||||||
|
|
||||||
void removeSessionLockSurface(SSessionLockSurface*);
|
void removeSessionLockSurface(SSessionLockSurface*);
|
||||||
|
|
||||||
|
void onLockscreenRenderedOnMonitor(uint64_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UP<SSessionLock> m_pSessionLock;
|
UP<SSessionLock> m_pSessionLock;
|
||||||
|
|
||||||
|
@ -64,4 +70,4 @@ class CSessionLockManager {
|
||||||
void onNewSessionLock(SP<CSessionLock> pWlrLock);
|
void onNewSessionLock(SP<CSessionLock> pWlrLock);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager;
|
inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager;
|
||||||
|
|
|
@ -81,6 +81,7 @@ void CForeignToplevelList::onTitle(PHLWINDOW pWindow) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
H->resource->sendTitle(pWindow->m_szTitle.c_str());
|
H->resource->sendTitle(pWindow->m_szTitle.c_str());
|
||||||
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onClass(PHLWINDOW pWindow) {
|
void CForeignToplevelList::onClass(PHLWINDOW pWindow) {
|
||||||
|
@ -92,6 +93,7 @@ void CForeignToplevelList::onClass(PHLWINDOW pWindow) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
H->resource->sendAppId(pWindow->m_szClass.c_str());
|
H->resource->sendAppId(pWindow->m_szClass.c_str());
|
||||||
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onUnmap(PHLWINDOW pWindow) {
|
void CForeignToplevelList::onUnmap(PHLWINDOW pWindow) {
|
||||||
|
|
|
@ -409,7 +409,8 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
|
||||||
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
glReadPixels(0, 0, frame->box.width, frame->box.height, PFORMAT->glFormat, PFORMAT->glType, pixelData);
|
auto glFormat = PFORMAT->flipRB ? GL_BGRA_EXT : GL_RGBA;
|
||||||
|
glReadPixels(0, 0, frame->box.width, frame->box.height, glFormat, PFORMAT->glType, pixelData);
|
||||||
|
|
||||||
if (frame->overlayCursor) {
|
if (frame->overlayCursor) {
|
||||||
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->self.lock());
|
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->self.lock());
|
||||||
|
|
|
@ -434,7 +434,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
|
||||||
if (!w->m_bIsFloating && *POPTIM && !w->onSpecialWorkspace())
|
if (!w->m_bIsFloating && *POPTIM && !w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_sWindowData.noBlur.valueOrDefault() || w->m_sWindowData.xray.valueOrDefault() == true)
|
if (w->m_sWindowData.noBlur.valueOrDefault() || !w->m_sWindowData.xray.hasValue() || w->m_sWindowData.xray.valueOrDefault())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->opaque())
|
if (w->opaque())
|
||||||
|
@ -1717,7 +1717,7 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWin
|
||||||
if (!m_RenderData.pCurrentMonData->blurFB.m_cTex->m_iTexID)
|
if (!m_RenderData.pCurrentMonData->blurFB.m_cTex->m_iTexID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pWindow && !pWindow->m_sWindowData.xray.valueOrDefault())
|
if (pWindow && pWindow->m_sWindowData.xray.hasValue() && !pWindow->m_sWindowData.xray.valueOrDefault())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pLayer && pLayer->xray == 0)
|
if (pLayer && pLayer->xray == 0)
|
||||||
|
|
|
@ -990,8 +990,11 @@ void CHyprRenderer::renderLockscreen(CMonitor* pMonitor, timespec* now, const CB
|
||||||
|
|
||||||
if (ALPHA < 1.f) /* animate */
|
if (ALPHA < 1.f) /* animate */
|
||||||
damageMonitor(pMonitor);
|
damageMonitor(pMonitor);
|
||||||
|
else
|
||||||
|
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
||||||
} else {
|
} else {
|
||||||
renderSessionLockSurface(PSLS, pMonitor, now);
|
renderSessionLockSurface(PSLS, pMonitor, now);
|
||||||
|
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue