refactor: Use new hyprutils casts (#11377)
This commit is contained in:
parent
aa6a78f0a4
commit
beee22a95e
116 changed files with 715 additions and 696 deletions
|
|
@ -57,7 +57,7 @@ bool CWLRegionResource::good() {
|
|||
}
|
||||
|
||||
SP<CWLRegionResource> CWLRegionResource::fromResource(wl_resource* res) {
|
||||
auto data = (CWLRegionResource*)(((CWlRegion*)wl_resource_get_user_data(res))->data());
|
||||
auto data = sc<CWLRegionResource*>(sc<CWlRegion*>(wl_resource_get_user_data(res))->data());
|
||||
return data ? data->m_self.lock() : nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : m_resource(re
|
|||
whenReadable();
|
||||
} else if (state->buffer->type() == Aquamarine::BUFFER_TYPE_DMABUF && state->buffer->dmabuf().success) {
|
||||
// async buffer and is dmabuf, then we can wait on implicit fences
|
||||
auto syncFd = dynamic_cast<CDMABuffer*>(state->buffer.m_buffer.get())->exportSyncFile();
|
||||
auto syncFd = dc<CDMABuffer*>(state->buffer.m_buffer.get())->exportSyncFile();
|
||||
|
||||
if (syncFd.isValid())
|
||||
g_pEventLoopManager->doOnReadable(std::move(syncFd), whenReadable);
|
||||
|
|
@ -211,7 +211,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : m_resource(re
|
|||
m_pending.updated.bits.transform = true;
|
||||
m_pending.updated.bits.damage = true;
|
||||
|
||||
m_pending.transform = (wl_output_transform)tr;
|
||||
m_pending.transform = sc<wl_output_transform>(tr);
|
||||
m_pending.bufferDamage = CBox{{}, m_pending.bufferSize};
|
||||
});
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ void CWLSurfaceResource::dropCurrentBuffer() {
|
|||
}
|
||||
|
||||
SP<CWLSurfaceResource> CWLSurfaceResource::fromResource(wl_resource* res) {
|
||||
auto data = (CWLSurfaceResource*)(((CWlSurface*)wl_resource_get_user_data(res))->data());
|
||||
auto data = sc<CWLSurfaceResource*>(sc<CWlSurface*>(wl_resource_get_user_data(res))->data());
|
||||
return data ? data->m_self.lock() : nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -379,7 +379,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
|
|||
for (auto const& n : nodes) {
|
||||
Vector2D offset = {};
|
||||
if (n->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
|
||||
auto subsurface = ((CSubsurfaceRole*)n->m_role.get())->m_subsurface.lock();
|
||||
auto subsurface = sc<CSubsurfaceRole*>(n->m_role.get())->m_subsurface.lock();
|
||||
offset = subsurface->posRelativeToParent();
|
||||
}
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ CBox CWLSurfaceResource::extends() {
|
|||
if (surf->m_role->role() != SURFACE_ROLE_SUBSURFACE)
|
||||
return;
|
||||
|
||||
((CRegion*)d)->add(CBox{offset, surf->m_current.size});
|
||||
sc<CRegion*>(d)->add(CBox{offset, surf->m_current.size});
|
||||
},
|
||||
&full);
|
||||
return full.getExtents();
|
||||
|
|
@ -515,7 +515,7 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
|
|||
m_current.texture->m_transform = wlTransformToHyprutils(m_current.transform);
|
||||
|
||||
if (m_role->role() == SURFACE_ROLE_SUBSURFACE) {
|
||||
auto subsurface = ((CSubsurfaceRole*)m_role.get())->m_subsurface.lock();
|
||||
auto subsurface = sc<CSubsurfaceRole*>(m_role.get())->m_subsurface.lock();
|
||||
if (subsurface->m_sync)
|
||||
return;
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
|
|||
breadthfirst(
|
||||
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
|
||||
if (surf->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
|
||||
auto subsurface = ((CSubsurfaceRole*)surf->m_role.get())->m_subsurface.lock();
|
||||
auto subsurface = sc<CSubsurfaceRole*>(surf->m_role.get())->m_subsurface.lock();
|
||||
if (!subsurface->m_sync)
|
||||
return;
|
||||
}
|
||||
|
|
@ -543,7 +543,7 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
|
|||
SImageDescription CWLSurfaceResource::getPreferredImageDescription() {
|
||||
auto parent = m_self;
|
||||
if (parent->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
|
||||
auto subsurface = ((CSubsurfaceRole*)parent->m_role.get())->m_subsurface.lock();
|
||||
auto subsurface = sc<CSubsurfaceRole*>(parent->m_role.get())->m_subsurface.lock();
|
||||
parent = subsurface->t1Parent();
|
||||
}
|
||||
WP<CMonitor> monitor;
|
||||
|
|
@ -611,7 +611,7 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) {
|
|||
// bpp is 32 INSALLAH
|
||||
auto begin = 4 * box.y1 * (box.x2 - box.x1) + box.x1;
|
||||
auto len = 4 * (box.x2 - box.x1);
|
||||
memcpy((uint8_t*)shmData.data() + begin, (uint8_t*)pixelData + begin, len);
|
||||
memcpy(shmData.data() + begin, pixelData + begin, len);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue