mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 07:25:59 +01:00
parent
e5384774a8
commit
d5689bb539
30 changed files with 116 additions and 118 deletions
|
@ -750,7 +750,7 @@ PHLMONITOR CCompositor::getMonitorFromCursor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) {
|
PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
SP<CMonitor> mon;
|
PHLMONITOR mon;
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto const& m : m_vMonitors) {
|
||||||
if (CBox{m->vecPosition, m->vecSize}.containsPoint(point)) {
|
if (CBox{m->vecPosition, m->vecSize}.containsPoint(point)) {
|
||||||
mon = m;
|
mon = m;
|
||||||
|
@ -759,8 +759,8 @@ PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mon) {
|
if (!mon) {
|
||||||
float bestDistance = 0.f;
|
float bestDistance = 0.f;
|
||||||
SP<CMonitor> pBestMon;
|
PHLMONITOR pBestMon;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto const& m : m_vMonitors) {
|
||||||
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
||||||
|
@ -3008,7 +3008,7 @@ PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkDefaultCursorWarp(SP<CMonitor> monitor) {
|
static void checkDefaultCursorWarp(PHLMONITOR monitor) {
|
||||||
static auto PCURSORMONITOR = CConfigValue<std::string>("cursor:default_monitor");
|
static auto PCURSORMONITOR = CConfigValue<std::string>("cursor:default_monitor");
|
||||||
static bool cursorDefaultDone = false;
|
static bool cursorDefaultDone = false;
|
||||||
static bool firstLaunch = true;
|
static bool firstLaunch = true;
|
||||||
|
|
|
@ -59,8 +59,8 @@ class CCompositor {
|
||||||
std::string m_szInstancePath = "";
|
std::string m_szInstancePath = "";
|
||||||
std::string m_szCurrentSplash = "error";
|
std::string m_szCurrentSplash = "error";
|
||||||
|
|
||||||
std::vector<SP<CMonitor>> m_vMonitors;
|
std::vector<PHLMONITOR> m_vMonitors;
|
||||||
std::vector<SP<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
std::vector<PHLMONITOR> m_vRealMonitors; // for all monitors, even those turned off
|
||||||
std::vector<PHLWINDOW> m_vWindows;
|
std::vector<PHLWINDOW> m_vWindows;
|
||||||
std::vector<PHLLS> m_vLayers;
|
std::vector<PHLLS> m_vLayers;
|
||||||
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
||||||
|
@ -80,7 +80,7 @@ class CCompositor {
|
||||||
|
|
||||||
WP<CWLSurfaceResource> m_pLastFocus;
|
WP<CWLSurfaceResource> m_pLastFocus;
|
||||||
PHLWINDOWREF m_pLastWindow;
|
PHLWINDOWREF m_pLastWindow;
|
||||||
WP<CMonitor> m_pLastMonitor;
|
PHLMONITORREF m_pLastMonitor;
|
||||||
|
|
||||||
std::vector<PHLWINDOWREF> m_vWindowFocusHistory; // first element is the most recently focused.
|
std::vector<PHLWINDOWREF> m_vWindowFocusHistory; // first element is the most recently focused.
|
||||||
|
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ std::string CConfigManager::getDeviceString(const std::string& dev, const std::s
|
||||||
return VAL;
|
return VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitorRule CConfigManager::getMonitorRuleFor(const SP<CMonitor> PMONITOR) {
|
SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
|
||||||
auto applyWlrOutputConfig = [PMONITOR](SMonitorRule rule) -> SMonitorRule {
|
auto applyWlrOutputConfig = [PMONITOR](SMonitorRule rule) -> SMonitorRule {
|
||||||
const auto CONFIG = PROTO::outputManagement->getOutputStateFor(PMONITOR);
|
const auto CONFIG = PROTO::outputManagement->getOutputStateFor(PMONITOR);
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ class CConfigManager {
|
||||||
static std::string getMainConfigPath();
|
static std::string getMainConfigPath();
|
||||||
const std::string getConfigString();
|
const std::string getConfigString();
|
||||||
|
|
||||||
SMonitorRule getMonitorRuleFor(const SP<CMonitor>);
|
SMonitorRule getMonitorRuleFor(const PHLMONITOR);
|
||||||
SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace);
|
SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace);
|
||||||
std::string getDefaultWorkspaceFor(const std::string&);
|
std::string getDefaultWorkspaceFor(const std::string&);
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ class CHyprDebugOverlay {
|
||||||
void frameData(PHLMONITOR);
|
void frameData(PHLMONITOR);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<PHLMONITOR, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
std::map<PHLMONITORREF, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
|
||||||
|
|
||||||
cairo_surface_t* m_pCairoSurface = nullptr;
|
cairo_surface_t* m_pCairoSurface = nullptr;
|
||||||
cairo_t* m_pCairo = nullptr;
|
cairo_t* m_pCairo = nullptr;
|
||||||
|
|
||||||
SP<CTexture> m_pTexture;
|
SP<CTexture> m_pTexture;
|
||||||
|
|
||||||
friend class CHyprMonitorDebugOverlay;
|
friend class CHyprMonitorDebugOverlay;
|
||||||
friend class CHyprRenderer;
|
friend class CHyprRenderer;
|
||||||
|
|
|
@ -71,7 +71,7 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
|
|
||||||
Debug::log(LOG, "Removing monitor {} from realMonitors", szName);
|
Debug::log(LOG, "Removing monitor {} from realMonitors", szName);
|
||||||
|
|
||||||
std::erase_if(g_pCompositor->m_vRealMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
std::erase_if(g_pCompositor->m_vRealMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
|
||||||
});
|
});
|
||||||
|
|
||||||
listeners.state = output->events.state.registerListener([this](std::any d) {
|
listeners.state = output->events.state.registerListener([this](std::any d) {
|
||||||
|
@ -149,7 +149,7 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CMonitor>* thisWrapper = nullptr;
|
PHLMONITOR* thisWrapper = nullptr;
|
||||||
|
|
||||||
// find the wrap
|
// find the wrap
|
||||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
|
@ -356,7 +356,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
|
|
||||||
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
||||||
}
|
}
|
||||||
std::erase_if(g_pCompositor->m_vMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
std::erase_if(g_pCompositor->m_vMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
||||||
|
@ -509,7 +509,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
||||||
|
|
||||||
// push to mvmonitors
|
// push to mvmonitors
|
||||||
|
|
||||||
SP<CMonitor>* thisWrapper = nullptr;
|
PHLMONITOR* thisWrapper = nullptr;
|
||||||
|
|
||||||
// find the wrap
|
// find the wrap
|
||||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ class CMonitor {
|
||||||
SP<CSyncTimeline> outTimeline;
|
SP<CSyncTimeline> outTimeline;
|
||||||
uint64_t commitSeq = 0;
|
uint64_t commitSeq = 0;
|
||||||
|
|
||||||
WP<CMonitor> self;
|
PHLMONITORREF self;
|
||||||
|
|
||||||
// mirroring
|
// mirroring
|
||||||
PHLMONITORREF pMirrorOf;
|
PHLMONITORREF pMirrorOf;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void CPointerManager::unlockSoftwareForMonitor(PHLMONITOR mon) {
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPointerManager::softwareLockedFor(SP<CMonitor> mon) {
|
bool CPointerManager::softwareLockedFor(PHLMONITOR mon) {
|
||||||
auto state = stateFor(mon);
|
auto state = stateFor(mon);
|
||||||
return state->softwareLocks > 0 || state->hardwareFailed;
|
return state->softwareLocks > 0 || state->hardwareFailed;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ bool CPointerManager::hasCursor() {
|
||||||
return currentCursorImage.pBuffer || currentCursorImage.surface;
|
return currentCursorImage.pBuffer || currentCursorImage.surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CPointerManager::SMonitorPointerState> CPointerManager::stateFor(SP<CMonitor> mon) {
|
SP<CPointerManager::SMonitorPointerState> CPointerManager::stateFor(PHLMONITOR mon) {
|
||||||
auto it = std::find_if(monitorStates.begin(), monitorStates.end(), [mon](const auto& other) { return other->monitor == mon; });
|
auto it = std::find_if(monitorStates.begin(), monitorStates.end(), [mon](const auto& other) { return other->monitor == mon; });
|
||||||
if (it == monitorStates.end())
|
if (it == monitorStates.end())
|
||||||
return monitorStates.emplace_back(makeShared<CPointerManager::SMonitorPointerState>(mon));
|
return monitorStates.emplace_back(makeShared<CPointerManager::SMonitorPointerState>(mon));
|
||||||
|
@ -503,7 +503,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage, std::optional<Vector2D> overridePos) {
|
void CPointerManager::renderSoftwareCursorsFor(PHLMONITOR pMonitor, timespec* now, CRegion& damage, std::optional<Vector2D> overridePos) {
|
||||||
if (!hasCursor())
|
if (!hasCursor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ void CPointerManager::renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec*
|
||||||
currentCursorImage.surface->resource()->frame(now);
|
currentCursorImage.surface->resource()->frame(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPointerManager::getCursorPosForMonitor(SP<CMonitor> pMonitor) {
|
Vector2D CPointerManager::getCursorPosForMonitor(PHLMONITOR pMonitor) {
|
||||||
return CBox{pointerPos - pMonitor->vecPosition, {0, 0}}
|
return CBox{pointerPos - pMonitor->vecPosition, {0, 0}}
|
||||||
.transform(wlTransformToHyprutils(invertTransform(pMonitor->transform)), pMonitor->vecTransformedSize.x / pMonitor->scale,
|
.transform(wlTransformToHyprutils(invertTransform(pMonitor->transform)), pMonitor->vecTransformedSize.x / pMonitor->scale,
|
||||||
pMonitor->vecTransformedSize.y / pMonitor->scale)
|
pMonitor->vecTransformedSize.y / pMonitor->scale)
|
||||||
|
@ -546,7 +546,7 @@ Vector2D CPointerManager::getCursorPosForMonitor(SP<CMonitor> pMonitor) {
|
||||||
pMonitor->scale;
|
pMonitor->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPointerManager::transformedHotspot(SP<CMonitor> pMonitor) {
|
Vector2D CPointerManager::transformedHotspot(PHLMONITOR pMonitor) {
|
||||||
if (!pMonitor->cursorSwapchain)
|
if (!pMonitor->cursorSwapchain)
|
||||||
return {}; // doesn't matter, we have no hw cursor, and this is only for hw cursors
|
return {}; // doesn't matter, we have no hw cursor, and this is only for hw cursors
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ Vector2D CPointerManager::transformedHotspot(SP<CMonitor> pMonitor) {
|
||||||
.pos();
|
.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
CBox CPointerManager::getCursorBoxLogicalForMonitor(SP<CMonitor> pMonitor) {
|
CBox CPointerManager::getCursorBoxLogicalForMonitor(PHLMONITOR pMonitor) {
|
||||||
return getCursorBoxGlobal().translate(-pMonitor->vecPosition);
|
return getCursorBoxGlobal().translate(-pMonitor->vecPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ void CPointerManager::move(const Vector2D& deltaLogical) {
|
||||||
|
|
||||||
void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
||||||
|
|
||||||
SP<CMonitor> currentMonitor = g_pCompositor->m_pLastMonitor.lock();
|
PHLMONITOR currentMonitor = g_pCompositor->m_pLastMonitor.lock();
|
||||||
if (!currentMonitor || !dev)
|
if (!currentMonitor || !dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ void CPointerManager::detachTablet(SP<CTablet> tablet) {
|
||||||
std::erase_if(tabletListeners, [tablet](const auto& e) { return e->tablet.expired() || e->tablet == tablet; });
|
std::erase_if(tabletListeners, [tablet](const auto& e) { return e->tablet.expired() || e->tablet == tablet; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::damageCursor(SP<CMonitor> pMonitor) {
|
void CPointerManager::damageCursor(PHLMONITOR pMonitor) {
|
||||||
for (auto const& mw : monitorStates) {
|
for (auto const& mw : monitorStates) {
|
||||||
if (mw->monitor != pMonitor)
|
if (mw->monitor != pMonitor)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -43,18 +43,18 @@ class CPointerManager {
|
||||||
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
|
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
|
||||||
void resetCursorImage(bool apply = true);
|
void resetCursorImage(bool apply = true);
|
||||||
|
|
||||||
void lockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
void lockSoftwareForMonitor(PHLMONITOR pMonitor);
|
||||||
void unlockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
void unlockSoftwareForMonitor(PHLMONITOR pMonitor);
|
||||||
void lockSoftwareAll();
|
void lockSoftwareAll();
|
||||||
void unlockSoftwareAll();
|
void unlockSoftwareAll();
|
||||||
bool softwareLockedFor(SP<CMonitor> pMonitor);
|
bool softwareLockedFor(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
void renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
|
void renderSoftwareCursorsFor(PHLMONITOR pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
|
||||||
|
|
||||||
// this is needed e.g. during screensharing where
|
// this is needed e.g. during screensharing where
|
||||||
// the software cursors aren't locked during the cursor move, but they
|
// the software cursors aren't locked during the cursor move, but they
|
||||||
// are rendered later.
|
// are rendered later.
|
||||||
void damageCursor(SP<CMonitor> pMonitor);
|
void damageCursor(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
//
|
//
|
||||||
Vector2D position();
|
Vector2D position();
|
||||||
|
@ -78,13 +78,13 @@ class CPointerManager {
|
||||||
Vector2D closestValid(const Vector2D& pos);
|
Vector2D closestValid(const Vector2D& pos);
|
||||||
|
|
||||||
// returns the thing in device coordinates. Is NOT offset by the hotspot, relies on set_cursor with hotspot.
|
// returns the thing in device coordinates. Is NOT offset by the hotspot, relies on set_cursor with hotspot.
|
||||||
Vector2D getCursorPosForMonitor(SP<CMonitor> pMonitor);
|
Vector2D getCursorPosForMonitor(PHLMONITOR pMonitor);
|
||||||
// returns the thing in logical coordinates of the monitor
|
// returns the thing in logical coordinates of the monitor
|
||||||
CBox getCursorBoxLogicalForMonitor(SP<CMonitor> pMonitor);
|
CBox getCursorBoxLogicalForMonitor(PHLMONITOR pMonitor);
|
||||||
// returns the thing in global coords
|
// returns the thing in global coords
|
||||||
CBox getCursorBoxGlobal();
|
CBox getCursorBoxGlobal();
|
||||||
|
|
||||||
Vector2D transformedHotspot(SP<CMonitor> pMonitor);
|
Vector2D transformedHotspot(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
SP<CTexture> getCurrentCursorTexture();
|
SP<CTexture> getCurrentCursorTexture();
|
||||||
|
|
||||||
|
@ -160,10 +160,10 @@ class CPointerManager {
|
||||||
Vector2D storedUnaccel = {0, 0};
|
Vector2D storedUnaccel = {0, 0};
|
||||||
|
|
||||||
struct SMonitorPointerState {
|
struct SMonitorPointerState {
|
||||||
SMonitorPointerState(SP<CMonitor> m) : monitor(m) {}
|
SMonitorPointerState(PHLMONITOR m) : monitor(m) {}
|
||||||
~SMonitorPointerState() {}
|
~SMonitorPointerState() {}
|
||||||
|
|
||||||
WP<CMonitor> monitor;
|
PHLMONITORREF monitor;
|
||||||
|
|
||||||
int softwareLocks = 0;
|
int softwareLocks = 0;
|
||||||
bool hardwareFailed = false;
|
bool hardwareFailed = false;
|
||||||
|
@ -176,7 +176,7 @@ class CPointerManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<SP<SMonitorPointerState>> monitorStates;
|
std::vector<SP<SMonitorPointerState>> monitorStates;
|
||||||
SP<SMonitorPointerState> stateFor(SP<CMonitor> mon);
|
SP<SMonitorPointerState> stateFor(PHLMONITOR mon);
|
||||||
bool attemptHardwareCursor(SP<SMonitorPointerState> state);
|
bool attemptHardwareCursor(SP<SMonitorPointerState> state);
|
||||||
SP<Aquamarine::IBuffer> renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
|
SP<Aquamarine::IBuffer> renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
|
||||||
bool setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquamarine::IBuffer> buf);
|
bool setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquamarine::IBuffer> buf);
|
||||||
|
|
|
@ -81,6 +81,6 @@ void CHyprlandCTMControlProtocol::destroyResource(CHyprlandCTMControlResource* r
|
||||||
std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == res; });
|
std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == res; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlandCTMControlProtocol::setCTM(SP<CMonitor> monitor, const Mat3x3& ctm) {
|
void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm) {
|
||||||
monitor->setCTM(ctm);
|
monitor->setCTM(ctm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
||||||
private:
|
private:
|
||||||
void destroyResource(CHyprlandCTMControlResource* resource);
|
void destroyResource(CHyprlandCTMControlResource* resource);
|
||||||
|
|
||||||
void setCTM(SP<CMonitor> monitor, const Mat3x3& ctm);
|
void setCTM(PHLMONITOR monitor, const Mat3x3& ctm);
|
||||||
|
|
||||||
//
|
//
|
||||||
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
|
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;
|
||||||
|
|
|
@ -129,7 +129,7 @@ SP<CDRMLeaseConnectorResource> CDRMLeaseConnectorResource::fromResource(wl_resou
|
||||||
return data ? data->self.lock() : nullptr;
|
return data ? data->self.lock() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDRMLeaseConnectorResource::CDRMLeaseConnectorResource(SP<CWpDrmLeaseConnectorV1> resource_, SP<CMonitor> monitor_) : monitor(monitor_), resource(resource_) {
|
CDRMLeaseConnectorResource::CDRMLeaseConnectorResource(SP<CWpDrmLeaseConnectorV1> resource_, PHLMONITOR monitor_) : monitor(monitor_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ bool CDRMLeaseDeviceResource::good() {
|
||||||
return resource->resource();
|
return resource->resource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDRMLeaseDeviceResource::sendConnector(SP<CMonitor> monitor) {
|
void CDRMLeaseDeviceResource::sendConnector(PHLMONITOR monitor) {
|
||||||
if (std::find_if(connectorsSent.begin(), connectorsSent.end(), [monitor](const auto& e) { return e && !e->dead && e->monitor == monitor; }) != connectorsSent.end())
|
if (std::find_if(connectorsSent.begin(), connectorsSent.end(), [monitor](const auto& e) { return e && !e->dead && e->monitor == monitor; }) != connectorsSent.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ void CDRMLeaseProtocol::destroyResource(CDRMLeaseResource* resource) {
|
||||||
std::erase_if(m_vLeases, [resource](const auto& e) { return e.get() == resource; });
|
std::erase_if(m_vLeases, [resource](const auto& e) { return e.get() == resource; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDRMLeaseProtocol::offer(SP<CMonitor> monitor) {
|
void CDRMLeaseProtocol::offer(PHLMONITOR monitor) {
|
||||||
std::erase_if(primaryDevice->offeredOutputs, [](const auto& e) { return e.expired(); });
|
std::erase_if(primaryDevice->offeredOutputs, [](const auto& e) { return e.expired(); });
|
||||||
if (std::find(primaryDevice->offeredOutputs.begin(), primaryDevice->offeredOutputs.end(), monitor) != primaryDevice->offeredOutputs.end())
|
if (std::find(primaryDevice->offeredOutputs.begin(), primaryDevice->offeredOutputs.end(), monitor) != primaryDevice->offeredOutputs.end())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -56,7 +56,7 @@ class CDRMLeaseRequestResource {
|
||||||
|
|
||||||
class CDRMLeaseConnectorResource {
|
class CDRMLeaseConnectorResource {
|
||||||
public:
|
public:
|
||||||
CDRMLeaseConnectorResource(SP<CWpDrmLeaseConnectorV1> resource_, SP<CMonitor> monitor_);
|
CDRMLeaseConnectorResource(SP<CWpDrmLeaseConnectorV1> resource_, PHLMONITOR monitor_);
|
||||||
static SP<CDRMLeaseConnectorResource> fromResource(wl_resource*);
|
static SP<CDRMLeaseConnectorResource> fromResource(wl_resource*);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
@ -64,7 +64,7 @@ class CDRMLeaseConnectorResource {
|
||||||
|
|
||||||
WP<CDRMLeaseConnectorResource> self;
|
WP<CDRMLeaseConnectorResource> self;
|
||||||
WP<CDRMLeaseDeviceResource> parent;
|
WP<CDRMLeaseDeviceResource> parent;
|
||||||
WP<CMonitor> monitor;
|
PHLMONITORREF monitor;
|
||||||
bool dead = false;
|
bool dead = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -82,7 +82,7 @@ class CDRMLeaseDeviceResource {
|
||||||
CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resource_);
|
CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resource_);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
void sendConnector(SP<CMonitor> monitor);
|
void sendConnector(PHLMONITOR monitor);
|
||||||
|
|
||||||
std::vector<WP<CDRMLeaseConnectorResource>> connectorsSent;
|
std::vector<WP<CDRMLeaseConnectorResource>> connectorsSent;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class CDRMLeaseDevice {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
SP<Aquamarine::CDRMBackend> backend;
|
SP<Aquamarine::CDRMBackend> backend;
|
||||||
|
|
||||||
std::vector<WP<CMonitor>> offeredOutputs;
|
std::vector<PHLMONITORREF> offeredOutputs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDRMLeaseProtocol : public IWaylandProtocol {
|
class CDRMLeaseProtocol : public IWaylandProtocol {
|
||||||
|
@ -111,7 +111,7 @@ class CDRMLeaseProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
void offer(SP<CMonitor> monitor);
|
void offer(PHLMONITOR monitor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void destroyResource(CDRMLeaseDeviceResource* resource);
|
void destroyResource(CDRMLeaseDeviceResource* resource);
|
||||||
|
|
|
@ -21,7 +21,7 @@ static std::optional<dev_t> devIDFromFD(int fd) {
|
||||||
return stat.st_rdev;
|
return stat.st_rdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vector<std::pair<SP<CMonitor>, SDMABUFTranche>> tranches_) :
|
CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> tranches_) :
|
||||||
rendererTranche(_rendererTranche), monitorTranches(tranches_) {
|
rendererTranche(_rendererTranche), monitorTranches(tranches_) {
|
||||||
|
|
||||||
std::vector<SDMABUFFormatTableEntry> formatsVec;
|
std::vector<SDMABUFFormatTableEntry> formatsVec;
|
||||||
|
@ -436,7 +436,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
.formats = g_pHyprOpenGL->getDRMFormats(),
|
.formats = g_pHyprOpenGL->getDRMFormats(),
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::pair<SP<CMonitor>, SDMABUFTranche>> tches;
|
std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> tches;
|
||||||
|
|
||||||
if (g_pCompositor->m_pAqBackend->hasSession()) {
|
if (g_pCompositor->m_pAqBackend->hasSession()) {
|
||||||
// this assumes there's only 1 device used for both scanout and rendering
|
// this assumes there's only 1 device used for both scanout and rendering
|
||||||
|
@ -453,20 +453,18 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
|
|
||||||
static auto monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
|
static auto monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||||
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
||||||
auto mon = pMonitor->self.lock();
|
|
||||||
auto tranche = SDMABUFTranche{
|
auto tranche = SDMABUFTranche{
|
||||||
.device = mainDevice,
|
.device = mainDevice,
|
||||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||||
.formats = mon->output->getRenderFormats(),
|
.formats = pMonitor->output->getRenderFormats(),
|
||||||
};
|
};
|
||||||
formatTable->monitorTranches.push_back(std::make_pair<>(mon, tranche));
|
formatTable->monitorTranches.push_back(std::make_pair<>(pMonitor, tranche));
|
||||||
resetFormatTable();
|
resetFormatTable();
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto monitorRemoved = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
static auto monitorRemoved = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||||
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
auto pMonitor = std::any_cast<PHLMONITOR>(param);
|
||||||
auto mon = pMonitor->self.lock();
|
std::erase_if(formatTable->monitorTranches, [pMonitor](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == pMonitor; });
|
||||||
std::erase_if(formatTable->monitorTranches, [mon](std::pair<SP<CMonitor>, SDMABUFTranche> pair) { return pair.first == mon; });
|
|
||||||
resetFormatTable();
|
resetFormatTable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -508,8 +506,8 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
|
||||||
for (auto const& feedback : m_vFeedbacks) {
|
for (auto const& feedback : m_vFeedbacks) {
|
||||||
feedback->resource->sendFormatTable(newFormatTable->tableFD, newFormatTable->tableSize);
|
feedback->resource->sendFormatTable(newFormatTable->tableFD, newFormatTable->tableSize);
|
||||||
if (feedback->lastFeedbackWasScanout) {
|
if (feedback->lastFeedbackWasScanout) {
|
||||||
SP<CMonitor> mon;
|
PHLMONITOR mon;
|
||||||
auto HLSurface = CWLSurface::fromResource(feedback->surface);
|
auto HLSurface = CWLSurface::fromResource(feedback->surface);
|
||||||
if (auto w = HLSurface->getWindow(); w)
|
if (auto w = HLSurface->getWindow(); w)
|
||||||
if (auto m = g_pCompositor->getMonitorFromID(w->m_iMonitorID); m)
|
if (auto m = g_pCompositor->getMonitorFromID(w->m_iMonitorID); m)
|
||||||
mon = m->self.lock();
|
mon = m->self.lock();
|
||||||
|
@ -560,7 +558,7 @@ void CLinuxDMABufV1Protocol::destroyResource(CLinuxDMABuffer* resource) {
|
||||||
std::erase_if(m_vBuffers, [&](const auto& other) { return other.get() == resource; });
|
std::erase_if(m_vBuffers, [&](const auto& other) { return other.get() == resource; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor) {
|
void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, PHLMONITOR pMonitor) {
|
||||||
SP<CLinuxDMABUFFeedbackResource> feedbackResource;
|
SP<CLinuxDMABUFFeedbackResource> feedbackResource;
|
||||||
for (auto const& f : m_vFeedbacks) {
|
for (auto const& f : m_vFeedbacks) {
|
||||||
if (f->surface != surface)
|
if (f->surface != surface)
|
||||||
|
@ -582,7 +580,7 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& monitorTranchePair = std::find_if(formatTable->monitorTranches.begin(), formatTable->monitorTranches.end(),
|
const auto& monitorTranchePair = std::find_if(formatTable->monitorTranches.begin(), formatTable->monitorTranches.end(),
|
||||||
[pMonitor](std::pair<SP<CMonitor>, SDMABUFTranche> pair) { return pair.first == pMonitor; });
|
[pMonitor](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == pMonitor; });
|
||||||
|
|
||||||
if (monitorTranchePair == formatTable->monitorTranches.end()) {
|
if (monitorTranchePair == formatTable->monitorTranches.end()) {
|
||||||
LOGM(LOG, "updateScanoutTranche: monitor has no tranche");
|
LOGM(LOG, "updateScanoutTranche: monitor has no tranche");
|
||||||
|
|
|
@ -48,13 +48,13 @@ struct SDMABUFTranche {
|
||||||
|
|
||||||
class CDMABUFFormatTable {
|
class CDMABUFFormatTable {
|
||||||
public:
|
public:
|
||||||
CDMABUFFormatTable(SDMABUFTranche rendererTranche, std::vector<std::pair<SP<CMonitor>, SDMABUFTranche>> tranches);
|
CDMABUFFormatTable(SDMABUFTranche rendererTranche, std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> tranches);
|
||||||
~CDMABUFFormatTable();
|
~CDMABUFFormatTable();
|
||||||
|
|
||||||
int tableFD = -1;
|
int tableFD = -1;
|
||||||
size_t tableSize = 0;
|
size_t tableSize = 0;
|
||||||
SDMABUFTranche rendererTranche;
|
SDMABUFTranche rendererTranche;
|
||||||
std::vector<std::pair<SP<CMonitor>, SDMABUFTranche>> monitorTranches;
|
std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> monitorTranches;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLinuxDMABBUFParamsResource {
|
class CLinuxDMABBUFParamsResource {
|
||||||
|
@ -111,7 +111,7 @@ class CLinuxDMABufV1Protocol : public IWaylandProtocol {
|
||||||
~CLinuxDMABufV1Protocol();
|
~CLinuxDMABufV1Protocol();
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
void updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor);
|
void updateScanoutTranche(SP<CWLSurfaceResource> surface, PHLMONITOR pMonitor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void destroyResource(CLinuxDMABUFResource* resource);
|
void destroyResource(CLinuxDMABUFResource* resource);
|
||||||
|
|
|
@ -633,7 +633,7 @@ SP<COutputMode> COutputManagementProtocol::modeFromResource(wl_resource* r) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<SWlrManagerSavedOutputState> COutputManagementProtocol::getOutputStateFor(SP<CMonitor> pMonitor) {
|
SP<SWlrManagerSavedOutputState> COutputManagementProtocol::getOutputStateFor(PHLMONITOR pMonitor) {
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto const& m : m_vManagers) {
|
||||||
if (!m->monitorStates.contains(pMonitor->szName))
|
if (!m->monitorStates.contains(pMonitor->szName))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -153,7 +153,7 @@ class COutputManagementProtocol : public IWaylandProtocol {
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
// doesn't have to return one
|
// doesn't have to return one
|
||||||
SP<SWlrManagerSavedOutputState> getOutputStateFor(SP<CMonitor> pMonitor);
|
SP<SWlrManagerSavedOutputState> getOutputStateFor(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void destroyResource(COutputManager* resource);
|
void destroyResource(COutputManager* resource);
|
||||||
|
|
|
@ -14,7 +14,7 @@ void CQueuedPresentationData::setPresentationType(bool zeroCopy_) {
|
||||||
zeroCopy = zeroCopy_;
|
zeroCopy = zeroCopy_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQueuedPresentationData::attachMonitor(SP<CMonitor> pMonitor_) {
|
void CQueuedPresentationData::attachMonitor(PHLMONITOR pMonitor_) {
|
||||||
pMonitor = pMonitor_;
|
pMonitor = pMonitor_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, timespe
|
||||||
|
|
||||||
CPresentationProtocol::CPresentationProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CPresentationProtocol::CPresentationProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
static auto P = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||||
const auto PMONITOR = std::any_cast<PHLMONITOR>(param);
|
const auto PMONITOR = PHLMONITORREF{std::any_cast<PHLMONITOR>(param)};
|
||||||
std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor == PMONITOR; });
|
std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor == PMONITOR; });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ void CPresentationProtocol::onGetFeedback(CWpPresentation* pMgr, wl_resource* su
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPresentationProtocol::onPresented(SP<CMonitor> pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||||
timespec now;
|
timespec now;
|
||||||
timespec* presentedAt = when;
|
timespec* presentedAt = when;
|
||||||
if (!presentedAt) {
|
if (!presentedAt) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CQueuedPresentationData {
|
||||||
CQueuedPresentationData(SP<CWLSurfaceResource> surf);
|
CQueuedPresentationData(SP<CWLSurfaceResource> surf);
|
||||||
|
|
||||||
void setPresentationType(bool zeroCopy);
|
void setPresentationType(bool zeroCopy);
|
||||||
void attachMonitor(SP<CMonitor> pMonitor);
|
void attachMonitor(PHLMONITOR pMonitor);
|
||||||
|
|
||||||
void presented();
|
void presented();
|
||||||
void discarded();
|
void discarded();
|
||||||
|
@ -24,7 +24,7 @@ class CQueuedPresentationData {
|
||||||
private:
|
private:
|
||||||
bool wasPresented = false;
|
bool wasPresented = false;
|
||||||
bool zeroCopy = false;
|
bool zeroCopy = false;
|
||||||
WP<CMonitor> pMonitor;
|
PHLMONITORREF pMonitor;
|
||||||
WP<CWLSurfaceResource> surface;
|
WP<CWLSurfaceResource> surface;
|
||||||
|
|
||||||
friend class CPresentationFeedback;
|
friend class CPresentationFeedback;
|
||||||
|
@ -53,7 +53,7 @@ class CPresentationProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
void onPresented(SP<CMonitor> pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags);
|
void onPresented(PHLMONITOR pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags);
|
||||||
void queueData(SP<CQueuedPresentationData> data);
|
void queueData(SP<CQueuedPresentationData> data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "VirtualPointer.hpp"
|
#include "VirtualPointer.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
||||||
CVirtualPointerV1Resource::CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, WP<CMonitor> boundOutput_) : boundOutput(boundOutput_), resource(resource_) {
|
CVirtualPointerV1Resource::CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, PHLMONITORREF boundOutput_) : boundOutput(boundOutput_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void CVirtualPointerProtocol::destroyResource(CVirtualPointerV1Resource* pointer
|
||||||
std::erase_if(m_vPointers, [&](const auto& other) { return other.get() == pointer; });
|
std::erase_if(m_vPointers, [&](const auto& other) { return other.get() == pointer; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr, wl_resource* seat, uint32_t id, WP<CMonitor> output) {
|
void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr, wl_resource* seat, uint32_t id, PHLMONITORREF output) {
|
||||||
|
|
||||||
const auto RESOURCE = m_vPointers.emplace_back(makeShared<CVirtualPointerV1Resource>(makeShared<CZwlrVirtualPointerV1>(pMgr->client(), pMgr->version(), id), output));
|
const auto RESOURCE = m_vPointers.emplace_back(makeShared<CVirtualPointerV1Resource>(makeShared<CZwlrVirtualPointerV1>(pMgr->client(), pMgr->version(), id), output));
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
class CVirtualPointerV1Resource {
|
class CVirtualPointerV1Resource {
|
||||||
public:
|
public:
|
||||||
CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, WP<CMonitor> boundOutput_);
|
CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, PHLMONITORREF boundOutput_);
|
||||||
~CVirtualPointerV1Resource();
|
~CVirtualPointerV1Resource();
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -35,12 +35,12 @@ class CVirtualPointerV1Resource {
|
||||||
CSignal holdEnd;
|
CSignal holdEnd;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
wl_client* client();
|
wl_client* client();
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
WP<CMonitor> boundOutput;
|
PHLMONITORREF boundOutput;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CZwlrVirtualPointerV1> resource;
|
SP<CZwlrVirtualPointerV1> resource;
|
||||||
|
@ -63,7 +63,7 @@ class CVirtualPointerProtocol : public IWaylandProtocol {
|
||||||
private:
|
private:
|
||||||
void onManagerResourceDestroy(wl_resource* res);
|
void onManagerResourceDestroy(wl_resource* res);
|
||||||
void destroyResource(CVirtualPointerV1Resource* pointer);
|
void destroyResource(CVirtualPointerV1Resource* pointer);
|
||||||
void onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr, wl_resource* seat, uint32_t id, WP<CMonitor> output);
|
void onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr, wl_resource* seat, uint32_t id, PHLMONITORREF output);
|
||||||
|
|
||||||
//
|
//
|
||||||
std::vector<UP<CZwlrVirtualPointerManagerV1>> m_vManagers;
|
std::vector<UP<CZwlrVirtualPointerManagerV1>> m_vManagers;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void CXDGOutputProtocol::updateAllOutputs() {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
CXDGOutput::CXDGOutput(SP<CZxdgOutputV1> resource_, SP<CMonitor> monitor_) : monitor(monitor_), resource(resource_) {
|
CXDGOutput::CXDGOutput(SP<CZxdgOutputV1> resource_, PHLMONITOR monitor_) : monitor(monitor_), resource(resource_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ class CWLOutputProtocol;
|
||||||
|
|
||||||
class CXDGOutput {
|
class CXDGOutput {
|
||||||
public:
|
public:
|
||||||
CXDGOutput(SP<CZxdgOutputV1> resource, SP<CMonitor> monitor_);
|
CXDGOutput(SP<CZxdgOutputV1> resource, PHLMONITOR monitor_);
|
||||||
|
|
||||||
void sendDetails();
|
void sendDetails();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WP<CMonitor> monitor;
|
PHLMONITORREF monitor;
|
||||||
SP<CZxdgOutputV1> resource;
|
SP<CZxdgOutputV1> resource;
|
||||||
WP<CWLOutputProtocol> outputProto;
|
WP<CWLOutputProtocol> outputProto;
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ wl_client* CWLSurfaceResource::client() {
|
||||||
return pClient;
|
return pClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurfaceResource::enter(SP<CMonitor> monitor) {
|
void CWLSurfaceResource::enter(PHLMONITOR monitor) {
|
||||||
if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) != enteredOutputs.end())
|
if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) != enteredOutputs.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void CWLSurfaceResource::enter(SP<CMonitor> monitor) {
|
||||||
resource->sendEnter(output->getResource().get());
|
resource->sendEnter(output->getResource().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurfaceResource::leave(SP<CMonitor> monitor) {
|
void CWLSurfaceResource::leave(PHLMONITOR monitor) {
|
||||||
if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) == enteredOutputs.end())
|
if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) == enteredOutputs.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ void CWLSurfaceResource::updateCursorShm() {
|
||||||
memcpy(shmData.data(), pixelData, bufLen);
|
memcpy(shmData.data(), pixelData, bufLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurfaceResource::presentFeedback(timespec* when, SP<CMonitor> pMonitor) {
|
void CWLSurfaceResource::presentFeedback(timespec* when, PHLMONITOR pMonitor) {
|
||||||
frame(when);
|
frame(when);
|
||||||
auto FEEDBACK = makeShared<CQueuedPresentationData>(self.lock());
|
auto FEEDBACK = makeShared<CQueuedPresentationData>(self.lock());
|
||||||
FEEDBACK->attachMonitor(pMonitor);
|
FEEDBACK->attachMonitor(pMonitor);
|
||||||
|
|
|
@ -60,8 +60,8 @@ class CWLSurfaceResource {
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
wl_client* client();
|
wl_client* client();
|
||||||
void enter(SP<CMonitor> monitor);
|
void enter(PHLMONITOR monitor);
|
||||||
void leave(SP<CMonitor> monitor);
|
void leave(PHLMONITOR monitor);
|
||||||
void sendPreferredTransform(wl_output_transform t);
|
void sendPreferredTransform(wl_output_transform t);
|
||||||
void sendPreferredScale(int32_t scale);
|
void sendPreferredScale(int32_t scale);
|
||||||
void frame(timespec* now);
|
void frame(timespec* now);
|
||||||
|
@ -115,7 +115,7 @@ class CWLSurfaceResource {
|
||||||
std::vector<SP<CWLCallbackResource>> callbacks;
|
std::vector<SP<CWLCallbackResource>> callbacks;
|
||||||
WP<CWLSurfaceResource> self;
|
WP<CWLSurfaceResource> self;
|
||||||
WP<CWLSurface> hlSurface;
|
WP<CWLSurface> hlSurface;
|
||||||
std::vector<WP<CMonitor>> enteredOutputs;
|
std::vector<PHLMONITORREF> enteredOutputs;
|
||||||
bool mapped = false;
|
bool mapped = false;
|
||||||
std::vector<WP<CWLSubsurfaceResource>> subsurfaces;
|
std::vector<WP<CWLSubsurfaceResource>> subsurfaces;
|
||||||
SP<ISurfaceRole> role;
|
SP<ISurfaceRole> role;
|
||||||
|
@ -124,7 +124,7 @@ class CWLSurfaceResource {
|
||||||
|
|
||||||
void breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
|
void breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
|
||||||
CRegion accumulateCurrentBufferDamage();
|
CRegion accumulateCurrentBufferDamage();
|
||||||
void presentFeedback(timespec* when, SP<CMonitor> pMonitor);
|
void presentFeedback(timespec* when, PHLMONITOR pMonitor);
|
||||||
void lockPendingState();
|
void lockPendingState();
|
||||||
void unlockPendingState();
|
void unlockPendingState();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../helpers/Monitor.hpp"
|
#include "../../helpers/Monitor.hpp"
|
||||||
|
|
||||||
CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMonitor) : monitor(pMonitor), resource(resource_) {
|
CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonitor) : monitor(pMonitor), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void CWLOutputResource::updateState() {
|
||||||
resource->sendDone();
|
resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, SP<CMonitor> pMonitor) :
|
CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, PHLMONITOR pMonitor) :
|
||||||
IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) {
|
IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) {
|
||||||
|
|
||||||
listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) {
|
listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class CWLOutputProtocol;
|
||||||
|
|
||||||
class CWLOutputResource {
|
class CWLOutputResource {
|
||||||
public:
|
public:
|
||||||
CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMonitor);
|
CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonitor);
|
||||||
static SP<CWLOutputResource> fromResource(wl_resource*);
|
static SP<CWLOutputResource> fromResource(wl_resource*);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
@ -20,7 +20,7 @@ class CWLOutputResource {
|
||||||
SP<CWlOutput> getResource();
|
SP<CWlOutput> getResource();
|
||||||
void updateState();
|
void updateState();
|
||||||
|
|
||||||
WP<CMonitor> monitor;
|
PHLMONITORREF monitor;
|
||||||
WP<CWLOutputProtocol> owner;
|
WP<CWLOutputProtocol> owner;
|
||||||
WP<CWLOutputResource> self;
|
WP<CWLOutputResource> self;
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ class CWLOutputResource {
|
||||||
|
|
||||||
class CWLOutputProtocol : public IWaylandProtocol {
|
class CWLOutputProtocol : public IWaylandProtocol {
|
||||||
public:
|
public:
|
||||||
CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, SP<CMonitor> pMonitor);
|
CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, PHLMONITOR pMonitor);
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
SP<CWLOutputResource> outputResourceFrom(wl_client* client);
|
SP<CWLOutputResource> outputResourceFrom(wl_client* client);
|
||||||
void sendDone();
|
void sendDone();
|
||||||
|
|
||||||
WP<CMonitor> monitor;
|
PHLMONITORREF monitor;
|
||||||
WP<CWLOutputProtocol> self;
|
WP<CWLOutputProtocol> self;
|
||||||
|
|
||||||
// will mark the protocol for removal, will be removed when no. of bound outputs is 0 (or when overwritten by a new global)
|
// will mark the protocol for removal, will be removed when no. of bound outputs is 0 (or when overwritten by a new global)
|
||||||
|
|
|
@ -206,30 +206,30 @@ class CHyprOpenGLImpl {
|
||||||
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
|
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
|
||||||
|
|
||||||
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
|
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
|
||||||
std::vector<SDRMFormat> getDRMFormats();
|
std::vector<SDRMFormat> getDRMFormats();
|
||||||
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
|
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
|
||||||
SP<CEGLSync> createEGLSync(int fenceFD);
|
SP<CEGLSync> createEGLSync(int fenceFD);
|
||||||
bool waitForTimelinePoint(SP<CSyncTimeline> timeline, uint64_t point);
|
bool waitForTimelinePoint(SP<CSyncTimeline> timeline, uint64_t point);
|
||||||
|
|
||||||
SCurrentRenderData m_RenderData;
|
SCurrentRenderData m_RenderData;
|
||||||
|
|
||||||
GLint m_iCurrentOutputFb = 0;
|
GLint m_iCurrentOutputFb = 0;
|
||||||
|
|
||||||
int m_iGBMFD = -1;
|
int m_iGBMFD = -1;
|
||||||
gbm_device* m_pGbmDevice = nullptr;
|
gbm_device* m_pGbmDevice = nullptr;
|
||||||
EGLContext m_pEglContext = nullptr;
|
EGLContext m_pEglContext = nullptr;
|
||||||
EGLDisplay m_pEglDisplay = nullptr;
|
EGLDisplay m_pEglDisplay = nullptr;
|
||||||
EGLDeviceEXT m_pEglDevice = nullptr;
|
EGLDeviceEXT m_pEglDevice = nullptr;
|
||||||
|
|
||||||
bool m_bReloadScreenShader = true; // at launch it can be set
|
bool m_bReloadScreenShader = true; // at launch it can be set
|
||||||
|
|
||||||
PHLWINDOWREF m_pCurrentWindow; // hack to get the current rendered window
|
PHLWINDOWREF m_pCurrentWindow; // hack to get the current rendered window
|
||||||
PHLLS m_pCurrentLayer; // hack to get the current rendered layer
|
PHLLS m_pCurrentLayer; // hack to get the current rendered layer
|
||||||
|
|
||||||
std::map<PHLWINDOWREF, CFramebuffer> m_mWindowFramebuffers;
|
std::map<PHLWINDOWREF, CFramebuffer> m_mWindowFramebuffers;
|
||||||
std::map<PHLLSREF, CFramebuffer> m_mLayerFramebuffers;
|
std::map<PHLLSREF, CFramebuffer> m_mLayerFramebuffers;
|
||||||
std::unordered_map<PHLMONITORREF, SMonitorRenderData> m_mMonitorRenderResources;
|
std::map<PHLMONITORREF, SMonitorRenderData> m_mMonitorRenderResources;
|
||||||
std::unordered_map<PHLMONITORREF, CFramebuffer> m_mMonitorBGFBs;
|
std::map<PHLMONITORREF, CFramebuffer> m_mMonitorBGFBs;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
|
||||||
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, SP<CMonitor> pMonitor, bool main, const Vector2D& projSize,
|
void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main, const Vector2D& projSize,
|
||||||
const Vector2D& projSizeUnscaled, bool fixMisalignedFSV1) {
|
const Vector2D& projSizeUnscaled, bool fixMisalignedFSV1) {
|
||||||
if (!pWindow || !pWindow->m_bIsX11) {
|
if (!pWindow || !pWindow->m_bIsX11) {
|
||||||
Vector2D uvTL;
|
Vector2D uvTL;
|
||||||
|
@ -1603,7 +1603,7 @@ void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, SP<CMonitor> monitor) {
|
void CHyprRenderer::setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, PHLMONITOR monitor) {
|
||||||
if (!PROTO::linuxDma)
|
if (!PROTO::linuxDma)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class CHyprRenderer {
|
||||||
void ensureCursorRenderingMode();
|
void ensureCursorRenderingMode();
|
||||||
bool shouldRenderCursor();
|
bool shouldRenderCursor();
|
||||||
void setCursorHidden(bool hide);
|
void setCursorHidden(bool hide);
|
||||||
void calculateUVForSurface(PHLWINDOW, SP<CWLSurfaceResource>, SP<CMonitor> pMonitor, bool main = false, const Vector2D& projSize = {}, const Vector2D& projSizeUnscaled = {},
|
void calculateUVForSurface(PHLWINDOW, SP<CWLSurfaceResource>, PHLMONITOR pMonitor, bool main = false, const Vector2D& projSize = {}, const Vector2D& projSizeUnscaled = {},
|
||||||
bool fixMisalignedFSV1 = false);
|
bool fixMisalignedFSV1 = false);
|
||||||
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
|
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
|
||||||
void renderLockscreen(PHLMONITOR pMonitor, timespec* now, const CBox& geometry);
|
void renderLockscreen(PHLMONITOR pMonitor, timespec* now, const CBox& geometry);
|
||||||
|
@ -95,7 +95,7 @@ class CHyprRenderer {
|
||||||
DAMAGETRACKINGMODES
|
DAMAGETRACKINGMODES
|
||||||
damageTrackingModeFromStr(const std::string&);
|
damageTrackingModeFromStr(const std::string&);
|
||||||
|
|
||||||
void setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, SP<CMonitor> monitor); // nullptr monitor resets
|
void setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, PHLMONITOR monitor); // nullptr monitor resets
|
||||||
void initiateManualCrash();
|
void initiateManualCrash();
|
||||||
|
|
||||||
bool m_bCrashingInProgress = false;
|
bool m_bCrashingInProgress = false;
|
||||||
|
|
Loading…
Reference in a new issue