mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-23 22:55:58 +01:00
minor fixas
This commit is contained in:
parent
e2b68a6d39
commit
f0afc1ab21
2 changed files with 17 additions and 11 deletions
|
@ -96,6 +96,7 @@ static void wlrOnBufferDone(void* data, struct zwlr_screencopy_frame_v1* frame)
|
|||
Debug::log(TRACE, "[sc] wlrOnBufferDone: no stream");
|
||||
zwlr_screencopy_frame_v1_destroy(frame);
|
||||
PSESSION->sharingData.frameCallback = nullptr;
|
||||
PSESSION->sharingData.status = FRAME_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,6 +111,7 @@ static void wlrOnBufferDone(void* data, struct zwlr_screencopy_frame_v1* frame)
|
|||
zwlr_screencopy_frame_v1_destroy(frame);
|
||||
g_pPortalManager->m_sPortals.screencopy->m_pPipewire->updateStreamParam(PSTREAM);
|
||||
g_pPortalManager->m_sPortals.screencopy->queueNextShareFrame(PSESSION);
|
||||
PSESSION->sharingData.status = FRAME_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,6 +124,7 @@ static void wlrOnBufferDone(void* data, struct zwlr_screencopy_frame_v1* frame)
|
|||
zwlr_screencopy_frame_v1_destroy(frame);
|
||||
PSESSION->sharingData.frameCallback = nullptr;
|
||||
Debug::log(LOG, "[screencopy/pipewire] Out of buffers");
|
||||
PSESSION->sharingData.status = FRAME_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -430,6 +433,11 @@ void CScreencopyPortal::startFrameCopy(CScreencopyPortal::SSession* pSession) {
|
|||
}
|
||||
|
||||
void CScreencopyPortal::queueNextShareFrame(CScreencopyPortal::SSession* pSession) {
|
||||
const auto PSTREAM = m_pPipewire->streamFromSession(pSession);
|
||||
|
||||
if (PSTREAM && !PSTREAM->streamState)
|
||||
return;
|
||||
|
||||
g_pPortalManager->m_vTimers.emplace_back(
|
||||
std::make_unique<CTimer>(1000.0 / pSession->sharingData.framerate, [pSession]() { g_pPortalManager->m_sPortals.screencopy->startFrameCopy(pSession); }));
|
||||
}
|
||||
|
@ -512,12 +520,7 @@ static void pwStreamStateChange(void* data, pw_stream_state old, pw_stream_state
|
|||
if (PSTREAM->pSession->sharingData.status == FRAME_NONE)
|
||||
g_pPortalManager->m_sPortals.screencopy->startFrameCopy(PSTREAM->pSession);
|
||||
break;
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
if (old == PW_STREAM_STATE_STREAMING)
|
||||
g_pPortalManager->m_sPortals.screencopy->m_pPipewire->enqueue(PSTREAM->pSession);
|
||||
PSTREAM->streamState = false;
|
||||
break;
|
||||
default: PSTREAM->streamState = false;
|
||||
default: PSTREAM->streamState = false; break;
|
||||
}
|
||||
|
||||
if (state == PW_STREAM_STATE_UNCONNECTED)
|
||||
|
@ -699,6 +702,9 @@ static void pwStreamRemoveBuffer(void* data, pw_buffer* buffer) {
|
|||
if (!PBUFFER)
|
||||
return;
|
||||
|
||||
if (PSTREAM->currentPWBuffer == PBUFFER)
|
||||
PSTREAM->currentPWBuffer = nullptr;
|
||||
|
||||
wl_buffer_destroy(PBUFFER->wlBuffer);
|
||||
for (int plane = 0; plane < PBUFFER->planeCount; plane++) {
|
||||
close(PBUFFER->fd[plane]);
|
||||
|
|
|
@ -14,6 +14,8 @@ SSelectionData promptForScreencopySelection() {
|
|||
|
||||
const auto RETVAL = execAndGet("hyprland-share-picker");
|
||||
|
||||
Debug::log(LOG, "[sc] Selection: {}", RETVAL);
|
||||
|
||||
if (RETVAL.find("screen:") == 0) {
|
||||
data.type = TYPE_OUTPUT;
|
||||
data.output = RETVAL.substr(7);
|
||||
|
@ -28,15 +30,13 @@ SSelectionData promptForScreencopySelection() {
|
|||
data.output = running.substr(0, running.find_first_of('@'));
|
||||
running = running.substr(running.find_first_of('@') + 1);
|
||||
|
||||
data.x = std::stoi(running.substr(running.find_first_of(',')));
|
||||
data.x = std::stoi(running.substr(0, running.find_first_of(',')));
|
||||
running = running.substr(running.find_first_of(',') + 1);
|
||||
data.y = std::stoi(running.substr(running.find_first_of(',')));
|
||||
data.y = std::stoi(running.substr(0, running.find_first_of(',')));
|
||||
running = running.substr(running.find_first_of(',') + 1);
|
||||
data.w = std::stoi(running.substr(running.find_first_of(',')));
|
||||
data.w = std::stoi(running.substr(0, running.find_first_of(',')));
|
||||
running = running.substr(running.find_first_of(',') + 1);
|
||||
data.h = std::stoi(running);
|
||||
|
||||
data.output.pop_back();
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
Loading…
Reference in a new issue