[+] AuLoop::DbgLoopSourceToReadFd

[+] AuLoop::DbgLoopSourceToWriteFd
This commit is contained in:
Reece Wilson 2024-01-03 01:44:36 +00:00
parent 81093fa2cd
commit 1c0efebd87
2 changed files with 52 additions and 0 deletions

View File

@ -88,6 +88,12 @@ namespace Aurora::IO::Loop
AUKN_SYM AuSPtr<ILoopSource> NewLSAppleSource();
AUKN_SYM AuSPtr<ILoopSource> NewLSIOHandle(const AuSPtr<IIOHandle> &pHandle);
// warn: only works on singular loop sources
AUKN_SYM AuInt64 DbgLoopSourceToReadFd(AuSPtr<ILoopSource> pLoopSource);
// warn: only works on singular loop sources
AUKN_SYM AuInt64 DbgLoopSourceToWriteFd(AuSPtr<ILoopSource> pLoopSource);
#if defined(X_PROTOCOL)
static AuSPtr<ILoopSource> NewLSX11(Display *display)
{

View File

@ -517,4 +517,50 @@ namespace Aurora::IO::Loop
return triggered;
}
AUKN_SYM AuInt64 DbgLoopSourceToReadFd(AuSPtr<ILoopSource> pLoopSource)
{
if (!pLoopSource)
{
return -1;
}
auto pSourceEx = AuDynamicCast<Loop::ILoopSourceEx>(pLoopSource);
if (!pSourceEx)
{
return -1;
}
if (!pSourceEx->Singular())
{
return -1;
}
return pSourceEx->GetHandle();
}
AUKN_SYM AuInt64 DbgLoopSourceToWriteFd(AuSPtr<ILoopSource> pLoopSource)
{
if (!pLoopSource)
{
return -1;
}
auto pSourceEx = AuDynamicCast<Loop::ILoopSourceEx>(pLoopSource);
if (!pSourceEx)
{
return -1;
}
if (!pSourceEx->Singular())
{
return -1;
}
#if defined(AURORA_IS_POSIX_DERIVED)
return pSourceEx->GetWriteHandle();
#else
return pSourceEx->GetHandle();
#endif
}
}