mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-01 00:17:58 +02:00
more work
This commit is contained in:
parent
4f2e4a2e65
commit
b0a8bff4ac
24 changed files with 208 additions and 145 deletions
|
|
@ -1066,10 +1066,10 @@ SP<CWLSurfaceResource> CCompositor::vectorWindowToSurface(const Vector2D& pos, P
|
|||
if (PPOPUP) {
|
||||
const auto OFF = PPOPUP->coordsRelativeToParent();
|
||||
sl = pos - pWindow->m_realPosition->goal() - OFF;
|
||||
return PPOPUP->m_wlSurface->resource();
|
||||
return PPOPUP->wlSurface()->resource();
|
||||
}
|
||||
|
||||
auto [surf, local] = pWindow->m_wlSurface->resource()->at(pos - pWindow->m_realPosition->goal(), true);
|
||||
auto [surf, local] = pWindow->wlSurface()->resource()->at(pos - pWindow->m_realPosition->goal(), true);
|
||||
if (surf) {
|
||||
sl = local;
|
||||
return surf;
|
||||
|
|
@ -1091,7 +1091,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
|||
|
||||
std::tuple<SP<CWLSurfaceResource>, Vector2D> iterData = {pSurface, {-1337, -1337}};
|
||||
|
||||
pWindow->m_wlSurface->resource()->breadthfirst(
|
||||
pWindow->wlSurface()->resource()->breadthfirst(
|
||||
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
||||
const auto PDATA = sc<std::tuple<SP<CWLSurfaceResource>, Vector2D>*>(data);
|
||||
if (surf == std::get<0>(*PDATA))
|
||||
|
|
@ -1138,7 +1138,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
|
|||
if (SURFACEAT) {
|
||||
*ppLayerSurfaceFound = ls.lock();
|
||||
*sCoords = pos - SURFACEAT->coordsGlobal();
|
||||
return SURFACEAT->m_wlSurface->resource();
|
||||
return SURFACEAT->wlSurface()->resource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1213,7 +1213,7 @@ bool CCompositor::isWindowActive(PHLWINDOW pWindow) {
|
|||
if (!pWindow->m_isMapped)
|
||||
return false;
|
||||
|
||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
||||
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||
|
||||
return PSURFACE == Desktop::focusState()->surface() || pWindow == Desktop::focusState()->window();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
|||
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
||||
}
|
||||
|
||||
const auto PWINDOWSURFACE = surface ? surface : pWindow->m_wlSurface->resource();
|
||||
const auto PWINDOWSURFACE = surface ? surface : pWindow->wlSurface()->resource();
|
||||
|
||||
rawSurfaceFocus(PWINDOWSURFACE, pWindow);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ void CFocusState::rawWindowFocus(PHLWINDOW pWindow, SP<CWLSurfaceResource> surfa
|
|||
}
|
||||
|
||||
void CFocusState::rawSurfaceFocus(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindowOwner) {
|
||||
if (g_pSeatManager->m_state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->m_state.keyboardFocus == pWindowOwner->m_wlSurface->resource()))
|
||||
if (g_pSeatManager->m_state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->m_state.keyboardFocus == pWindowOwner->wlSurface()->resource()))
|
||||
return; // Don't focus when already focused on this.
|
||||
|
||||
if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
|
||||
auto pMonitor = resource->m_monitor.empty() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromName(resource->m_monitor);
|
||||
|
||||
pLS->m_surface->assign(resource->m_surface.lock(), pLS);
|
||||
pLS->m_wlSurface->assign(resource->m_surface.lock(), pLS);
|
||||
|
||||
if (!pMonitor) {
|
||||
Debug::log(ERR, "New LS has no monitor??");
|
||||
|
|
@ -64,21 +64,19 @@ void CLayerSurface::registerCallbacks() {
|
|||
});
|
||||
}
|
||||
|
||||
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : m_layerSurface(resource_) {
|
||||
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : IView(CWLSurface::create()), m_layerSurface(resource_) {
|
||||
m_listeners.commit = m_layerSurface->m_events.commit.listen([this] { onCommit(); });
|
||||
m_listeners.map = m_layerSurface->m_events.map.listen([this] { onMap(); });
|
||||
m_listeners.unmap = m_layerSurface->m_events.unmap.listen([this] { onUnmap(); });
|
||||
m_listeners.destroy = m_layerSurface->m_events.destroy.listen([this] { onDestroy(); });
|
||||
|
||||
m_surface = CWLSurface::create();
|
||||
}
|
||||
|
||||
CLayerSurface::~CLayerSurface() {
|
||||
if (!g_pHyprOpenGL)
|
||||
return;
|
||||
|
||||
if (m_surface)
|
||||
m_surface->unassign();
|
||||
if (m_wlSurface)
|
||||
m_wlSurface->unassign();
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
std::erase_if(g_pHyprOpenGL->m_layerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == m_self.lock(); });
|
||||
|
||||
|
|
@ -89,6 +87,18 @@ CLayerSurface::~CLayerSurface() {
|
|||
}
|
||||
}
|
||||
|
||||
eViewType CLayerSurface::type() const {
|
||||
return VIEW_TYPE_LAYER_SURFACE;
|
||||
}
|
||||
|
||||
bool CLayerSurface::visible() const {
|
||||
return m_mapped;
|
||||
}
|
||||
|
||||
std::optional<CBox> CLayerSurface::logicalBox() const {
|
||||
return CBox{m_realPosition->value(), m_realSize->value()};
|
||||
}
|
||||
|
||||
void CLayerSurface::onDestroy() {
|
||||
Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get()));
|
||||
|
||||
|
|
@ -126,8 +136,8 @@ void CLayerSurface::onDestroy() {
|
|||
|
||||
m_readyToDelete = true;
|
||||
m_layerSurface.reset();
|
||||
if (m_surface)
|
||||
m_surface->unassign();
|
||||
if (m_wlSurface)
|
||||
m_wlSurface->unassign();
|
||||
|
||||
m_listeners.unmap.reset();
|
||||
m_listeners.destroy.reset();
|
||||
|
|
@ -159,7 +169,7 @@ void CLayerSurface::onMap() {
|
|||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||
|
||||
m_surface->resource()->enter(PMONITOR->m_self.lock());
|
||||
m_wlSurface->resource()->enter(PMONITOR->m_self.lock());
|
||||
|
||||
const bool ISEXCLUSIVE = m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||
|
||||
|
|
@ -173,14 +183,14 @@ void CLayerSurface::onMap() {
|
|||
|
||||
if (GRABSFOCUS) {
|
||||
// TODO: use the new superb really very cool grab
|
||||
if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_surface->resource()))
|
||||
if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_wlSurface->resource()))
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
Desktop::focusState()->rawSurfaceFocus(m_surface->resource());
|
||||
Desktop::focusState()->rawSurfaceFocus(m_wlSurface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||
}
|
||||
|
||||
|
|
@ -197,8 +207,8 @@ void CLayerSurface::onMap() {
|
|||
g_pEventManager->postEvent(SHyprIPCEvent{.event = "openlayer", .data = m_namespace});
|
||||
EMIT_HOOK_EVENT("openLayer", m_self.lock());
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::onUnmap() {
|
||||
|
|
@ -241,7 +251,7 @@ void CLayerSurface::onUnmap() {
|
|||
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
|
||||
const bool WASLASTFOCUS = g_pSeatManager->m_state.keyboardFocus == m_surface->resource() || g_pSeatManager->m_state.pointerFocus == m_surface->resource();
|
||||
const bool WASLASTFOCUS = g_pSeatManager->m_state.keyboardFocus == m_wlSurface->resource() || g_pSeatManager->m_state.pointerFocus == m_wlSurface->resource();
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
|
@ -252,7 +262,7 @@ void CLayerSurface::onUnmap() {
|
|||
(Desktop::focusState()->surface() && Desktop::focusState()->surface()->m_hlSurface && !Desktop::focusState()->surface()->m_hlSurface->keyboardFocusable())) {
|
||||
if (!g_pInputManager->refocusLastWindow(PMONITOR))
|
||||
g_pInputManager->refocus();
|
||||
} else if (Desktop::focusState()->surface() && Desktop::focusState()->surface() != m_surface->resource())
|
||||
} else if (Desktop::focusState()->surface() && Desktop::focusState()->surface() != m_wlSurface->resource())
|
||||
g_pSeatManager->setKeyboardFocus(Desktop::focusState()->surface());
|
||||
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
||||
|
|
@ -363,7 +373,7 @@ void CLayerSurface::onCommit() {
|
|||
if (!WASLASTFOCUS && m_popupHead) {
|
||||
m_popupHead->breadthfirst(
|
||||
[&WASLASTFOCUS](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
WASLASTFOCUS = WASLASTFOCUS || (popup->m_wlSurface && g_pSeatManager->m_state.keyboardFocus == popup->m_wlSurface->resource());
|
||||
WASLASTFOCUS = WASLASTFOCUS || (popup->wlSurface() && g_pSeatManager->m_state.keyboardFocus == popup->wlSurface()->resource());
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
|
@ -387,20 +397,20 @@ void CLayerSurface::onCommit() {
|
|||
// if now exclusive and not previously
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
Desktop::focusState()->rawSurfaceFocus(m_surface->resource());
|
||||
Desktop::focusState()->rawSurfaceFocus(m_wlSurface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pSeatManager->setPointerFocus(m_wlSurface->resource(), LOCAL);
|
||||
g_pInputManager->m_emptyFocusCursorSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_interactivity = m_layerSurface->m_current.interactivity;
|
||||
|
||||
g_pHyprRenderer->damageSurface(m_surface->resource(), m_position.x, m_position.y);
|
||||
g_pHyprRenderer->damageSurface(m_wlSurface->resource(), m_position.x, m_position.y);
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_wlSurface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
bool CLayerSurface::isFadedOut() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <string>
|
||||
#include "../../defines.hpp"
|
||||
#include "WLSurface.hpp"
|
||||
#include "View.hpp"
|
||||
#include "../rule/layerRule/LayerRuleApplicator.hpp"
|
||||
#include "../../helpers/AnimatedVariable.hpp"
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ class CLayerShellResource;
|
|||
|
||||
namespace Desktop::View {
|
||||
|
||||
class CLayerSurface {
|
||||
class CLayerSurface : public IView {
|
||||
public:
|
||||
static PHLLS create(SP<CLayerShellResource>);
|
||||
|
||||
|
|
@ -18,22 +19,24 @@ namespace Desktop::View {
|
|||
CLayerSurface(SP<CLayerShellResource>);
|
||||
|
||||
public:
|
||||
~CLayerSurface();
|
||||
virtual ~CLayerSurface();
|
||||
|
||||
bool isFadedOut();
|
||||
int popupsCount();
|
||||
virtual eViewType type() const;
|
||||
virtual bool visible() const;
|
||||
virtual std::optional<CBox> logicalBox() const;
|
||||
|
||||
PHLANIMVAR<Vector2D> m_realPosition;
|
||||
PHLANIMVAR<Vector2D> m_realSize;
|
||||
PHLANIMVAR<float> m_alpha;
|
||||
bool isFadedOut();
|
||||
int popupsCount();
|
||||
|
||||
WP<CLayerShellResource> m_layerSurface;
|
||||
PHLANIMVAR<Vector2D> m_realPosition;
|
||||
PHLANIMVAR<Vector2D> m_realSize;
|
||||
PHLANIMVAR<float> m_alpha;
|
||||
|
||||
WP<CLayerShellResource> m_layerSurface;
|
||||
|
||||
// the header providing the enum type cannot be imported here
|
||||
int m_interactivity = 0;
|
||||
|
||||
SP<Desktop::View::CWLSurface> m_surface;
|
||||
|
||||
bool m_mapped = false;
|
||||
uint32_t m_layer = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ UP<Desktop::View::CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<Desk
|
|||
popup->m_layerOwner = pOwner->m_layerOwner;
|
||||
popup->m_parent = pOwner;
|
||||
popup->m_self = popup;
|
||||
popup->m_wlSurface = CWLSurface::create();
|
||||
popup->m_wlSurface->assign(resource->m_surface->m_surface.lock(), popup.get());
|
||||
popup->wlSurface()->assign(resource->m_surface->m_surface.lock(), popup.get());
|
||||
|
||||
popup->m_lastSize = resource->m_surface->m_current.geometry.size();
|
||||
popup->reposition();
|
||||
|
|
@ -49,11 +48,27 @@ UP<Desktop::View::CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<Desk
|
|||
return popup;
|
||||
}
|
||||
|
||||
CPopup::CPopup() : IView(CWLSurface::create()) {
|
||||
;
|
||||
}
|
||||
|
||||
CPopup::~CPopup() {
|
||||
if (m_wlSurface)
|
||||
m_wlSurface->unassign();
|
||||
}
|
||||
|
||||
eViewType CPopup::type() const {
|
||||
return VIEW_TYPE_POPUP;
|
||||
}
|
||||
|
||||
bool CPopup::visible() const {
|
||||
return m_mapped;
|
||||
}
|
||||
|
||||
std::optional<CBox> CPopup::logicalBox() const {
|
||||
return logicalBox();
|
||||
}
|
||||
|
||||
void CPopup::initAllSignals() {
|
||||
|
||||
g_pAnimationManager->createAnimation(0.f, m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadePopupsIn"), AVARDAMAGE_NONE);
|
||||
|
|
@ -291,9 +306,9 @@ void CPopup::reposition() {
|
|||
|
||||
SP<Desktop::View::CWLSurface> CPopup::getT1Owner() {
|
||||
if (m_windowOwner)
|
||||
return m_windowOwner->m_wlSurface;
|
||||
return m_windowOwner->wlSurface();
|
||||
else
|
||||
return m_layerOwner->m_surface;
|
||||
return m_layerOwner->wlSurface();
|
||||
}
|
||||
|
||||
Vector2D CPopup::coordsRelativeToParent() {
|
||||
|
|
@ -307,7 +322,7 @@ Vector2D CPopup::coordsRelativeToParent() {
|
|||
|
||||
while (current->m_parent && current->m_resource) {
|
||||
|
||||
offset += current->m_wlSurface->resource()->m_current.offset;
|
||||
offset += current->wlSurface()->resource()->m_current.offset;
|
||||
offset += current->m_resource->m_geometry.pos();
|
||||
|
||||
current = current->m_parent;
|
||||
|
|
@ -361,9 +376,9 @@ Vector2D CPopup::size() {
|
|||
|
||||
void CPopup::sendScale() {
|
||||
if (!m_windowOwner.expired())
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_wlSurface->m_lastScaleFloat);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->wlSurface()->m_lastScaleFloat);
|
||||
else if (!m_layerOwner.expired())
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_lastScaleFloat);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->wlSurface()->m_lastScaleFloat);
|
||||
else
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
|
@ -430,7 +445,7 @@ WP<Desktop::View::CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsIn
|
|||
if (BOX.containsPoint(globalCoords))
|
||||
return p;
|
||||
} else {
|
||||
const auto REGION = CRegion{p->m_wlSurface->resource()->m_current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->m_current.size}).translate(p->coordsGlobal());
|
||||
const auto REGION = CRegion{p->wlSurface()->resource()->m_current.input}.intersect(CBox{{}, p->wlSurface()->resource()->m_current.size}).translate(p->coordsGlobal());
|
||||
if (REGION.containsPoint(globalCoords))
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include "Subsurface.hpp"
|
||||
#include "View.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
#include "../../helpers/memory/Memory.hpp"
|
||||
#include "../../helpers/AnimatedVariable.hpp"
|
||||
|
|
@ -10,7 +11,7 @@ class CXDGPopupResource;
|
|||
|
||||
namespace Desktop::View {
|
||||
|
||||
class CPopup {
|
||||
class CPopup : public IView {
|
||||
public:
|
||||
// dummy head nodes
|
||||
static UP<Desktop::View::CPopup> create(PHLWINDOW pOwner);
|
||||
|
|
@ -19,7 +20,11 @@ namespace Desktop::View {
|
|||
// real nodes
|
||||
static UP<Desktop::View::CPopup> create(SP<CXDGPopupResource> popup, WP<Desktop::View::CPopup> pOwner);
|
||||
|
||||
~CPopup();
|
||||
virtual ~CPopup();
|
||||
|
||||
virtual eViewType type() const;
|
||||
virtual bool visible() const;
|
||||
virtual std::optional<CBox> logicalBox() const;
|
||||
|
||||
SP<Desktop::View::CWLSurface> getT1Owner();
|
||||
Vector2D coordsRelativeToParent();
|
||||
|
|
@ -45,16 +50,15 @@ namespace Desktop::View {
|
|||
WP<Desktop::View::CPopup> at(const Vector2D& globalCoords, bool allowsInput = false);
|
||||
|
||||
//
|
||||
SP<Desktop::View::CWLSurface> m_wlSurface;
|
||||
WP<Desktop::View::CPopup> m_self;
|
||||
bool m_mapped = false;
|
||||
WP<Desktop::View::CPopup> m_self;
|
||||
bool m_mapped = false;
|
||||
|
||||
// fade in-out
|
||||
PHLANIMVAR<float> m_alpha;
|
||||
bool m_fadingOut = false;
|
||||
|
||||
private:
|
||||
CPopup() = default;
|
||||
CPopup();
|
||||
|
||||
// T1 owners, each popup has to have one of these
|
||||
PHLWINDOWREF m_windowOwner;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ UP<Desktop::View::CSubsurface> CSubsurface::create(PHLWINDOW pOwner) {
|
|||
subsurface->m_self = subsurface;
|
||||
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
||||
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ UP<Desktop::View::CSubsurface> CSubsurface::create(WP<Desktop::View::CPopup> pOw
|
|||
subsurface->m_popupParent = pOwner;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource());
|
||||
subsurface->initExistingSubsurfaces(pOwner->wlSurface()->resource());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
|
|
@ -35,8 +35,8 @@ UP<Desktop::View::CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSu
|
|||
subsurface->m_windowParent = pOwner;
|
||||
subsurface->m_subsurface = pSubsurface;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->m_wlSurface = CWLSurface::create();
|
||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->wlSurface() = CWLSurface::create();
|
||||
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||
return subsurface;
|
||||
|
|
@ -47,13 +47,29 @@ UP<Desktop::View::CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSu
|
|||
subsurface->m_popupParent = pOwner;
|
||||
subsurface->m_subsurface = pSubsurface;
|
||||
subsurface->m_self = subsurface;
|
||||
subsurface->m_wlSurface = CWLSurface::create();
|
||||
subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->wlSurface() = CWLSurface::create();
|
||||
subsurface->wlSurface()->assign(pSubsurface->m_surface.lock(), subsurface.get());
|
||||
subsurface->initSignals();
|
||||
subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
|
||||
return subsurface;
|
||||
}
|
||||
|
||||
CSubsurface::CSubsurface() : IView(CWLSurface::create()) {
|
||||
;
|
||||
}
|
||||
|
||||
eViewType CSubsurface::type() const {
|
||||
return VIEW_TYPE_SUBSURFACE;
|
||||
}
|
||||
|
||||
bool CSubsurface::visible() const {
|
||||
return m_wlSurface && m_wlSurface->resource() && m_wlSurface->resource()->m_mapped;
|
||||
}
|
||||
|
||||
std::optional<CBox> CSubsurface::logicalBox() const {
|
||||
return logicalBox();
|
||||
}
|
||||
|
||||
void CSubsurface::initSignals() {
|
||||
if (m_subsurface) {
|
||||
m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.listen([this] { onCommit(); });
|
||||
|
|
@ -63,9 +79,9 @@ void CSubsurface::initSignals() {
|
|||
m_listeners.newSubsurface = m_subsurface->m_surface->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||
} else {
|
||||
if (m_windowParent)
|
||||
m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||
m_listeners.newSubsurface = m_windowParent->wlSurface()->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||
else if (m_popupParent)
|
||||
m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||
m_listeners.newSubsurface = m_popupParent->wlSurface()->resource()->m_events.newSubsurface.listen([this](const auto& resource) { onNewSubsurface(resource); });
|
||||
else
|
||||
ASSERT(false);
|
||||
}
|
||||
|
|
@ -82,14 +98,14 @@ void CSubsurface::checkSiblingDamage() {
|
|||
continue;
|
||||
|
||||
const auto COORDS = n->coordsGlobal();
|
||||
g_pHyprRenderer->damageSurface(n->m_wlSurface->resource(), COORDS.x, COORDS.y, SCALE);
|
||||
g_pHyprRenderer->damageSurface(n->wlSurface()->resource(), COORDS.x, COORDS.y, SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
void CSubsurface::recheckDamageForSubsurfaces() {
|
||||
for (auto const& n : m_children) {
|
||||
const auto COORDS = n->coordsGlobal();
|
||||
g_pHyprRenderer->damageSurface(n->m_wlSurface->resource(), COORDS.x, COORDS.y);
|
||||
g_pHyprRenderer->damageSurface(n->wlSurface()->resource(), COORDS.x, COORDS.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +124,7 @@ void CSubsurface::onCommit() {
|
|||
|
||||
g_pHyprRenderer->damageSurface(m_wlSurface->resource(), COORDS.x, COORDS.y);
|
||||
|
||||
if (m_popupParent && !m_popupParent->inert() && m_popupParent->m_wlSurface)
|
||||
if (m_popupParent && !m_popupParent->inert() && m_popupParent->wlSurface())
|
||||
m_popupParent->recheckTree();
|
||||
if (!m_windowParent.expired()) // I hate you firefox why are you doing this
|
||||
m_windowParent->m_popupHead->recheckTree();
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
#include "../../defines.hpp"
|
||||
#include <vector>
|
||||
#include "WLSurface.hpp"
|
||||
#include "View.hpp"
|
||||
|
||||
class CWLSubsurfaceResource;
|
||||
|
||||
namespace Desktop::View {
|
||||
class CPopup;
|
||||
class CSubsurface {
|
||||
class CSubsurface : public IView {
|
||||
public:
|
||||
// root dummy nodes
|
||||
static UP<Desktop::View::CSubsurface> create(PHLWINDOW pOwner);
|
||||
|
|
@ -18,7 +19,11 @@ namespace Desktop::View {
|
|||
static UP<Desktop::View::CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner);
|
||||
static UP<Desktop::View::CSubsurface> create(SP<CWLSubsurfaceResource> pSubsurface, WP<Desktop::View::CPopup> pOwner);
|
||||
|
||||
~CSubsurface() = default;
|
||||
virtual ~CSubsurface() = default;
|
||||
|
||||
virtual eViewType type() const;
|
||||
virtual bool visible() const;
|
||||
virtual std::optional<CBox> logicalBox() const;
|
||||
|
||||
Vector2D coordsRelativeToParent();
|
||||
Vector2D coordsGlobal();
|
||||
|
|
@ -38,7 +43,7 @@ namespace Desktop::View {
|
|||
WP<Desktop::View::CSubsurface> m_self;
|
||||
|
||||
private:
|
||||
CSubsurface() = default;
|
||||
CSubsurface();
|
||||
|
||||
struct {
|
||||
CHyprSignalListener destroySubsurface;
|
||||
|
|
@ -48,10 +53,9 @@ namespace Desktop::View {
|
|||
CHyprSignalListener newSubsurface;
|
||||
} m_listeners;
|
||||
|
||||
WP<CWLSubsurfaceResource> m_subsurface;
|
||||
SP<Desktop::View::CWLSurface> m_wlSurface;
|
||||
Vector2D m_lastSize = {};
|
||||
Vector2D m_lastPosition = {};
|
||||
WP<CWLSubsurfaceResource> m_subsurface;
|
||||
Vector2D m_lastSize = {};
|
||||
Vector2D m_lastPosition = {};
|
||||
|
||||
// if nullptr, means it's a dummy node
|
||||
WP<Desktop::View::CSubsurface> m_parent;
|
||||
|
|
|
|||
|
|
@ -95,14 +95,12 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
|
|||
pWindow->addWindowDeco(makeUnique<CHyprDropShadowDecoration>(pWindow));
|
||||
pWindow->addWindowDeco(makeUnique<CHyprBorderDecoration>(pWindow));
|
||||
|
||||
pWindow->m_wlSurface->assign(pWindow->m_xdgSurface->m_surface.lock(), pWindow);
|
||||
pWindow->wlSurface()->assign(pWindow->m_xdgSurface->m_surface.lock(), pWindow);
|
||||
|
||||
return pWindow;
|
||||
}
|
||||
|
||||
CWindow::CWindow(SP<CXDGSurfaceResource> resource) : m_xdgSurface(resource) {
|
||||
m_wlSurface = CWLSurface::create();
|
||||
|
||||
CWindow::CWindow(SP<CXDGSurfaceResource> resource) : IView(CWLSurface::create()), m_xdgSurface(resource) {
|
||||
m_listeners.map = m_xdgSurface->m_events.map.listen([this] { Events::listener_mapWindow(this, nullptr); });
|
||||
m_listeners.ack = m_xdgSurface->m_events.ack.listen([this](uint32_t d) { onAck(d); });
|
||||
m_listeners.unmap = m_xdgSurface->m_events.unmap.listen([this] { Events::listener_unmapWindow(this, nullptr); });
|
||||
|
|
@ -112,9 +110,7 @@ CWindow::CWindow(SP<CXDGSurfaceResource> resource) : m_xdgSurface(resource) {
|
|||
m_listeners.updateMetadata = m_xdgSurface->m_toplevel->m_events.metadataChanged.listen([this] { onUpdateMeta(); });
|
||||
}
|
||||
|
||||
CWindow::CWindow(SP<CXWaylandSurface> surface) : m_xwaylandSurface(surface) {
|
||||
m_wlSurface = CWLSurface::create();
|
||||
|
||||
CWindow::CWindow(SP<CXWaylandSurface> surface) : IView(CWLSurface::create()), m_xwaylandSurface(surface) {
|
||||
m_listeners.map = m_xwaylandSurface->m_events.map.listen([this] { Events::listener_mapWindow(this, nullptr); });
|
||||
m_listeners.unmap = m_xwaylandSurface->m_events.unmap.listen([this] { Events::listener_unmapWindow(this, nullptr); });
|
||||
m_listeners.destroy = m_xwaylandSurface->m_events.destroy.listen([this] { Events::listener_destroyWindow(this, nullptr); });
|
||||
|
|
@ -144,7 +140,19 @@ CWindow::~CWindow() {
|
|||
std::erase_if(g_pHyprOpenGL->m_windowFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.get() == this; });
|
||||
}
|
||||
|
||||
SBoxExtents CWindow::getFullWindowExtents() {
|
||||
eViewType CWindow::type() const {
|
||||
return VIEW_TYPE_WINDOW;
|
||||
}
|
||||
|
||||
bool CWindow::visible() const {
|
||||
return m_isMapped && !m_hidden;
|
||||
}
|
||||
|
||||
std::optional<CBox> CWindow::logicalBox() const {
|
||||
return getFullWindowBoundingBox();
|
||||
}
|
||||
|
||||
SBoxExtents CWindow::getFullWindowExtents() const {
|
||||
if (m_fadingOut)
|
||||
return m_originalClosedExtents;
|
||||
|
||||
|
|
@ -174,7 +182,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
|
|||
// TODO: this could be better, perhaps make a getFullWindowRegion?
|
||||
m_popupHead->breadthfirst(
|
||||
[](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource())
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource())
|
||||
return;
|
||||
|
||||
CBox* pSurfaceExtents = sc<CBox*>(data);
|
||||
|
|
@ -202,7 +210,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
|
|||
return maxExtents;
|
||||
}
|
||||
|
||||
CBox CWindow::getFullWindowBoundingBox() {
|
||||
CBox CWindow::getFullWindowBoundingBox() const {
|
||||
if (m_ruleApplicator->dimAround().valueOrDefault()) {
|
||||
if (const auto PMONITOR = m_monitor.lock(); PMONITOR)
|
||||
return {PMONITOR->m_position.x, PMONITOR->m_position.y, PMONITOR->m_size.x, PMONITOR->m_size.y};
|
||||
|
|
@ -682,7 +690,7 @@ bool CWindow::hasPopupAt(const Vector2D& pos) {
|
|||
|
||||
auto popup = m_popupHead->at(pos);
|
||||
|
||||
return popup && popup->m_wlSurface->resource();
|
||||
return popup && popup->wlSurface()->resource();
|
||||
}
|
||||
|
||||
void CWindow::applyGroupRules() {
|
||||
|
|
@ -1051,7 +1059,7 @@ void CWindow::updateWindowData(const SWorkspaceRule& workspaceRule) {
|
|||
m_ruleApplicator->noShadow().matchOptional(workspaceRule.noShadow, Desktop::Types::PRIORITY_WORKSPACE_RULE);
|
||||
}
|
||||
|
||||
int CWindow::getRealBorderSize() {
|
||||
int CWindow::getRealBorderSize() const {
|
||||
if ((m_workspace && isEffectiveInternalFSMode(FSMODE_FULLSCREEN)) || !m_ruleApplicator->decorate().valueOrDefault())
|
||||
return 0;
|
||||
|
||||
|
|
@ -1186,7 +1194,7 @@ bool CWindow::isFullscreen() {
|
|||
return m_fullscreenState.internal != FSMODE_NONE;
|
||||
}
|
||||
|
||||
bool CWindow::isEffectiveInternalFSMode(const eFullscreenMode MODE) {
|
||||
bool CWindow::isEffectiveInternalFSMode(const eFullscreenMode MODE) const {
|
||||
return sc<eFullscreenMode>(std::bit_floor(sc<uint8_t>(m_fullscreenState.internal))) == MODE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include "View.hpp"
|
||||
#include "../../config/ConfigDataValues.hpp"
|
||||
#include "../../helpers/AnimatedVariable.hpp"
|
||||
#include "../../helpers/TagKeeper.hpp"
|
||||
|
|
@ -70,7 +71,7 @@ namespace Desktop::View {
|
|||
eFullscreenMode client = FSMODE_NONE;
|
||||
};
|
||||
|
||||
class CWindow {
|
||||
class CWindow : public IView {
|
||||
public:
|
||||
static PHLWINDOW create(SP<CXDGSurfaceResource>);
|
||||
static PHLWINDOW create(SP<CXWaylandSurface>);
|
||||
|
|
@ -80,9 +81,11 @@ namespace Desktop::View {
|
|||
CWindow(SP<CXWaylandSurface> surface);
|
||||
|
||||
public:
|
||||
~CWindow();
|
||||
virtual ~CWindow();
|
||||
|
||||
SP<Desktop::View::CWLSurface> m_wlSurface;
|
||||
virtual eViewType type() const;
|
||||
virtual bool visible() const;
|
||||
virtual std::optional<CBox> logicalBox() const;
|
||||
|
||||
struct {
|
||||
CSignalT<> destroy;
|
||||
|
|
@ -246,8 +249,8 @@ namespace Desktop::View {
|
|||
}
|
||||
|
||||
// methods
|
||||
CBox getFullWindowBoundingBox();
|
||||
SBoxExtents getFullWindowExtents();
|
||||
CBox getFullWindowBoundingBox() const;
|
||||
SBoxExtents getFullWindowExtents() const;
|
||||
CBox getWindowBoxUnified(uint64_t props);
|
||||
SBoxExtents getWindowExtentsUnified(uint64_t props);
|
||||
CBox getWindowIdealBoundingBoxIgnoreReserved();
|
||||
|
|
@ -282,8 +285,8 @@ namespace Desktop::View {
|
|||
int surfacesCount();
|
||||
void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize);
|
||||
bool isFullscreen();
|
||||
bool isEffectiveInternalFSMode(const eFullscreenMode);
|
||||
int getRealBorderSize();
|
||||
bool isEffectiveInternalFSMode(const eFullscreenMode) const;
|
||||
int getRealBorderSize() const;
|
||||
float getScrollMouse();
|
||||
float getScrollTouchpad();
|
||||
bool isScrollMouseOverridden();
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
// registers the animated vars and stuff
|
||||
PWINDOW->onMap();
|
||||
|
||||
const auto PWINDOWSURFACE = PWINDOW->m_wlSurface->resource();
|
||||
const auto PWINDOWSURFACE = PWINDOW->wlSurface()->resource();
|
||||
|
||||
if (!PWINDOWSURFACE) {
|
||||
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
|
||||
|
|
@ -528,8 +528,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
if (PWORKSPACE->m_hasFullscreenWindow && !PWINDOW->isFullscreen() && !PWINDOW->m_isFloating)
|
||||
PWINDOW->m_alpha->setValueAndWarp(0.f);
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->m_transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(PWINDOW->wlSurface()->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(PWINDOW->wlSurface()->resource(), PMONITOR->m_transform);
|
||||
|
||||
if (g_pSeatManager->m_mouse.expired() || !g_pInputManager->isConstrained())
|
||||
g_pInputManager->sendMotionEventsToFocused();
|
||||
|
|
@ -554,7 +554,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
const auto CURRENTWINDOWFSSTATE = PWINDOW->isFullscreen();
|
||||
const auto CURRENTFSMODE = PWINDOW->m_fullscreenState.internal;
|
||||
|
||||
if (!PWINDOW->m_wlSurface->exists() || !PWINDOW->m_isMapped) {
|
||||
if (!PWINDOW->wlSurface()->exists() || !PWINDOW->m_isMapped) {
|
||||
Debug::log(WARN, "{} unmapped without being mapped??", PWINDOW);
|
||||
PWINDOW->m_fadingOut = false;
|
||||
return;
|
||||
|
|
@ -719,7 +719,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
|||
g_pSeatManager->m_isPointerFrameSkipped = false;
|
||||
g_pSeatManager->m_isPointerFrameCommit = false;
|
||||
} else
|
||||
g_pHyprRenderer->damageSurface(PWINDOW->m_wlSurface->resource(), PWINDOW->m_realPosition->goal().x, PWINDOW->m_realPosition->goal().y,
|
||||
g_pHyprRenderer->damageSurface(PWINDOW->wlSurface()->resource(), PWINDOW->m_realPosition->goal().x, PWINDOW->m_realPosition->goal().y,
|
||||
PWINDOW->m_isX11 ? 1.0 / PWINDOW->m_X11SurfaceScaledBy : 1.0);
|
||||
|
||||
if (g_pSeatManager->m_isPointerFrameSkipped) {
|
||||
|
|
@ -735,8 +735,8 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
|||
|
||||
// tearing: if solitary, redraw it. This still might be a single surface window
|
||||
if (PMONITOR && PMONITOR->m_solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->m_tearingState.canTear &&
|
||||
PWINDOW->m_wlSurface->resource()->m_current.texture) {
|
||||
CRegion damageBox{PWINDOW->m_wlSurface->resource()->m_current.accumulateBufferDamage()};
|
||||
PWINDOW->wlSurface()->resource()->m_current.texture) {
|
||||
CRegion damageBox{PWINDOW->wlSurface()->resource()->m_current.accumulateBufferDamage()};
|
||||
|
||||
if (!damageBox.empty()) {
|
||||
if (PMONITOR->m_tearingState.busy) {
|
||||
|
|
@ -759,7 +759,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
|
|||
Desktop::focusState()->surface().reset();
|
||||
}
|
||||
|
||||
PWINDOW->m_wlSurface->unassign();
|
||||
PWINDOW->wlSurface()->unassign();
|
||||
|
||||
PWINDOW->m_listeners = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -2039,7 +2039,7 @@ std::optional<NColorManagement::SImageDescription> CMonitor::getFSImageDescripti
|
|||
if (!FS_WINDOW)
|
||||
return {}; // should be unreachable
|
||||
|
||||
const auto ROOT_SURF = FS_WINDOW->m_wlSurface->resource();
|
||||
const auto ROOT_SURF = FS_WINDOW->wlSurface()->resource();
|
||||
const auto SURF = ROOT_SURF->findWithCM();
|
||||
return SURF ? SURF->m_colorManagement->imageDescription() : SImageDescription{};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||
}
|
||||
|
||||
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
|
||||
const auto PWINDOWSURFACE = pWindow->m_wlSurface->resource();
|
||||
const auto PWINDOWSURFACE = pWindow->wlSurface()->resource();
|
||||
*pWindow->m_realSize = PWINDOWSURFACE->m_current.size;
|
||||
|
||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
|
||||
|
|
|
|||
|
|
@ -2401,9 +2401,9 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
// pass all mf shit
|
||||
if (!XWTOXW) {
|
||||
if (g_pKeybindManager->m_lastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||
}
|
||||
|
||||
g_pSeatManager->sendKeyboardMods(g_pInputManager->getModsFromAllKBs(), 0, 0, 0);
|
||||
|
|
@ -2549,15 +2549,15 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||
}
|
||||
|
||||
//copied the rest from pass and modified it
|
||||
// if wl -> xwl, activate destination
|
||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && !Desktop::focusState()->window()->m_isX11)
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->m_wlSurface->resource(), true);
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->wlSurface()->resource(), true);
|
||||
// if xwl -> xwl, send to current. Timing issues make this not work.
|
||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && Desktop::focusState()->window()->m_isX11)
|
||||
PWINDOW = nullptr;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ CHyprXWaylandManager::~CHyprXWaylandManager() {
|
|||
}
|
||||
|
||||
SP<CWLSurfaceResource> CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
||||
return pWindow ? pWindow->m_wlSurface->resource() : nullptr;
|
||||
return pWindow ? pWindow->wlSurface()->resource() : nullptr;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool activate) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
continue;
|
||||
|
||||
bool isInhibiting = false;
|
||||
w->m_wlSurface->resource()->breadthfirst(
|
||||
w->wlSurface()->resource()->breadthfirst(
|
||||
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
||||
if (ii->inhibitor->m_surface != surf)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
if (forcedFocus && !foundSurface) {
|
||||
pFoundWindow = forcedFocus;
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
}
|
||||
|
||||
// if we are holding a pointer button,
|
||||
|
|
@ -356,7 +356,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_exclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (!foundSurface) {
|
||||
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->m_surface->resource();
|
||||
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->wlSurface()->resource();
|
||||
surfacePos = (*g_pInputManager->m_exclusiveLSes.begin())->m_realPosition->goal();
|
||||
}
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
surfacePos = Vector2D(-1337, -1337);
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
|
@ -446,11 +446,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
if (!pFoundWindow->m_isX11) {
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
if (!foundSurface) {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
return;
|
||||
}
|
||||
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_cursorImageOverridden) {
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->wlSurface()->resource() && !m_cursorImageOverridden) {
|
||||
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
||||
if (VECNOTINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
||||
g_pHyprRenderer->setCursorFromName("left_ptr");
|
||||
|
|
|
|||
|
|
@ -213,11 +213,11 @@ void CScreencopyFrame::renderMon() {
|
|||
|
||||
auto hidePopups = [&](Vector2D popupBaseOffset) {
|
||||
return [&, popupBaseOffset](WP<Desktop::View::CPopup> popup, void*) {
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->m_mapped)
|
||||
return;
|
||||
|
||||
const auto popRel = popup->coordsRelativeToParent();
|
||||
popup->m_wlSurface->resource()->breadthfirst(
|
||||
popup->wlSurface()->resource()->breadthfirst(
|
||||
[&](SP<CWLSurfaceResource> surf, const Vector2D& localOff, void*) {
|
||||
const auto size = surf->m_current.size;
|
||||
const auto surfBox = CBox{popupBaseOffset + popRel + localOff, size}.translate(m_monitor->m_position).scale(m_monitor->m_scale).translate(-m_box.pos());
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
|
|||
m_resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
|
||||
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (w->m_wlSurface->resource() == surf_) {
|
||||
if (w->wlSurface()->resource() == surf_) {
|
||||
m_window = w;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
|
|||
}
|
||||
|
||||
for (const auto& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface || !w->m_wlSurface)
|
||||
if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface || !w->wlSurface())
|
||||
continue;
|
||||
|
||||
if (w->m_wlSurface->resource() == SURFACE) {
|
||||
if (w->wlSurface()->resource() == SURFACE) {
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{
|
||||
.event = "bell",
|
||||
.data = std::format("{:x}", rc<uintptr_t>(w.get())),
|
||||
|
|
|
|||
|
|
@ -2211,10 +2211,10 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
|
|||
if (pWindow->m_ruleApplicator->noBlur().valueOrDefault())
|
||||
return false;
|
||||
|
||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall)
|
||||
if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall)
|
||||
return true;
|
||||
|
||||
const auto PSURFACE = pWindow->m_wlSurface->resource();
|
||||
const auto PSURFACE = pWindow->wlSurface()->resource();
|
||||
|
||||
const auto PWORKSPACE = pWindow->m_workspace;
|
||||
const float A = pWindow->m_alpha->value() * pWindow->m_activeInactiveAlpha->value() * PWORKSPACE->m_alpha->value();
|
||||
|
|
|
|||
|
|
@ -164,11 +164,11 @@ CHyprRenderer::CHyprRenderer() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!w->m_wlSurface || !w->m_wlSurface->resource() || shouldRenderWindow(w.lock()))
|
||||
if (!w->wlSurface() || !w->wlSurface()->resource() || shouldRenderWindow(w.lock()))
|
||||
continue;
|
||||
|
||||
w->m_wlSurface->resource()->frame(Time::steadyNow());
|
||||
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->m_wlSurface->resource());
|
||||
w->wlSurface()->resource()->frame(Time::steadyNow());
|
||||
auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->wlSurface()->resource());
|
||||
FEEDBACK->attachMonitor(Desktop::focusState()->monitor());
|
||||
FEEDBACK->discarded();
|
||||
PROTO::presentation->queueData(std::move(FEEDBACK));
|
||||
|
|
@ -516,7 +516,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
// whether to use m_fMovingToWorkspaceAlpha, only if fading out into an invisible ws
|
||||
const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_monitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible());
|
||||
|
||||
renderdata.surface = pWindow->m_wlSurface->resource();
|
||||
renderdata.surface = pWindow->wlSurface()->resource();
|
||||
renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN);
|
||||
renderdata.fadeAlpha = pWindow->m_alpha->value() * (pWindow->m_pinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) *
|
||||
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_movingToWorkspaceAlpha->value() : 1.F) * pWindow->m_movingFromWorkspaceAlpha->value();
|
||||
|
|
@ -596,7 +596,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_ruleApplicator->nearestNeighbor().valueOrDefault())
|
||||
renderdata.useNearestNeighbor = true;
|
||||
|
||||
if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall && renderdata.blur) {
|
||||
if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall && renderdata.blur) {
|
||||
CBox wb = {renderdata.pos.x - pMonitor->m_position.x, renderdata.pos.y - pMonitor->m_position.y, renderdata.w, renderdata.h};
|
||||
wb.scale(pMonitor->m_scale).round();
|
||||
CRectPassElement::SRectData data;
|
||||
|
|
@ -611,7 +611,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
}
|
||||
|
||||
renderdata.surfaceCounter = 0;
|
||||
pWindow->m_wlSurface->resource()->breadthfirst(
|
||||
pWindow->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -622,7 +622,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
renderdata.localPos = offset;
|
||||
renderdata.texture = s->m_current.texture;
|
||||
renderdata.surface = s;
|
||||
renderdata.mainSurface = s == pWindow->m_wlSurface->resource();
|
||||
renderdata.mainSurface = s == pWindow->wlSurface()->resource();
|
||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||
renderdata.surfaceCounter++;
|
||||
},
|
||||
|
|
@ -683,14 +683,14 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
|
|||
return;
|
||||
}
|
||||
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->m_mapped)
|
||||
return;
|
||||
const auto pos = popup->coordsRelativeToParent();
|
||||
const Vector2D oldPos = renderdata.pos;
|
||||
renderdata.pos += pos;
|
||||
renderdata.fadeAlpha = popup->m_alpha->value();
|
||||
|
||||
popup->m_wlSurface->resource()->breadthfirst(
|
||||
popup->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -761,7 +761,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
|
||||
renderdata.fadeAlpha = pLayer->m_alpha->value();
|
||||
renderdata.blur = shouldBlur(pLayer);
|
||||
renderdata.surface = pLayer->m_surface->resource();
|
||||
renderdata.surface = pLayer->wlSurface()->resource();
|
||||
renderdata.decorate = false;
|
||||
renderdata.w = REALSIZ.x;
|
||||
renderdata.h = REALSIZ.y;
|
||||
|
|
@ -776,7 +776,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
}
|
||||
|
||||
if (!popups)
|
||||
pLayer->m_surface->resource()->breadthfirst(
|
||||
pLayer->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
@ -787,7 +787,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
renderdata.localPos = offset;
|
||||
renderdata.texture = s->m_current.texture;
|
||||
renderdata.surface = s;
|
||||
renderdata.mainSurface = s == pLayer->m_surface->resource();
|
||||
renderdata.mainSurface = s == pLayer->wlSurface()->resource();
|
||||
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
|
||||
renderdata.surfaceCounter++;
|
||||
},
|
||||
|
|
@ -801,10 +801,10 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
|
|||
if (popups) {
|
||||
pLayer->m_popupHead->breadthfirst(
|
||||
[this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->m_mapped)
|
||||
return;
|
||||
|
||||
const auto SURF = popup->m_wlSurface->resource();
|
||||
const auto SURF = popup->wlSurface()->resource();
|
||||
|
||||
if (!SURF->m_current.texture)
|
||||
return;
|
||||
|
|
@ -1138,7 +1138,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
|
|||
|
||||
static std::optional<Vector2D> getSurfaceExpectedSize(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main) {
|
||||
const auto CAN_USE_WINDOW = pWindow && main;
|
||||
const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->m_wlSurface->resource()->m_current.size;
|
||||
const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->wlSurface()->resource()->m_current.size;
|
||||
|
||||
if (pSurface->m_current.viewport.hasDestination)
|
||||
return (pSurface->m_current.viewport.destination * pMonitor->m_scale).round();
|
||||
|
|
@ -1577,7 +1577,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
|||
|
||||
bool hdrIsHandled = false;
|
||||
if (FS_WINDOW) {
|
||||
const auto ROOT_SURF = FS_WINDOW->m_wlSurface->resource();
|
||||
const auto ROOT_SURF = FS_WINDOW->wlSurface()->resource();
|
||||
const auto SURF = ROOT_SURF->findWithCM();
|
||||
|
||||
// we have a surface with image description
|
||||
|
|
@ -1707,21 +1707,21 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace
|
|||
|
||||
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->m_wlSurface->resource())
|
||||
if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->wlSurface()->resource())
|
||||
continue;
|
||||
|
||||
if (!shouldRenderWindow(w, pMonitor))
|
||||
continue;
|
||||
|
||||
w->m_wlSurface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
||||
w->wlSurface()->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
||||
}
|
||||
|
||||
for (auto const& lsl : pMonitor->m_layerSurfaceLayers) {
|
||||
for (auto const& ls : lsl) {
|
||||
if (ls->m_fadingOut || !ls->m_surface->resource())
|
||||
if (ls->m_fadingOut || !ls->wlSurface()->resource())
|
||||
continue;
|
||||
|
||||
ls->m_surface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
||||
ls->wlSurface()->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2516,7 +2516,7 @@ void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
|
|||
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
|
||||
return;
|
||||
|
||||
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
|
||||
if (!popup->wlSurface() || !popup->wlSurface()->resource() || !popup->m_mapped)
|
||||
return;
|
||||
|
||||
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
|
||||
|
|
@ -2544,7 +2544,7 @@ void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
|
|||
renderdata.popup = true;
|
||||
renderdata.blur = false;
|
||||
|
||||
popup->m_wlSurface->resource()->breadthfirst(
|
||||
popup->wlSurface()->resource()->breadthfirst(
|
||||
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
|
||||
if (!s->m_current.texture)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ void CRenderPass::renderDebugData() {
|
|||
renderHLSurface(m_debugData.keyboardFocusText, g_pSeatManager->m_state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F));
|
||||
renderHLSurface(m_debugData.pointerFocusText, g_pSeatManager->m_state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F));
|
||||
if (Desktop::focusState()->window())
|
||||
renderHLSurface(m_debugData.lastWindowText, Desktop::focusState()->window()->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
|
||||
renderHLSurface(m_debugData.lastWindowText, Desktop::focusState()->window()->wlSurface()->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
|
||||
|
||||
if (g_pSeatManager->m_state.pointerFocus) {
|
||||
if (g_pSeatManager->m_state.pointerFocus->m_current.input.intersect(CBox{{}, g_pSeatManager->m_state.pointerFocus->m_current.size}).getExtents().size() !=
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
|
|||
roundingPower = 2.0f;
|
||||
}
|
||||
|
||||
const bool WINDOWOPAQUE = m_data.pWindow && m_data.pWindow->m_wlSurface->resource() == m_data.surface ? m_data.pWindow->opaque() : false;
|
||||
const bool WINDOWOPAQUE = m_data.pWindow && m_data.pWindow->wlSurface()->resource() == m_data.surface ? m_data.pWindow->opaque() : false;
|
||||
const bool CANDISABLEBLEND = ALPHA >= 1.f && OVERALL_ALPHA >= 1.f && rounding == 0 && WINDOWOPAQUE;
|
||||
|
||||
if (CANDISABLEBLEND)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue