mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 18:18:03 +02:00
protocols: fix image-copy-capture stop handling and remove non protocol errors (#13706)
* protocols: send image-copy-capture stopped instead of destroy Fixes a protocol error where the resource was destroyed instead of sending stopped() to the client. * protocols: don't send protocol errors in image-copy-capture for server errors
This commit is contained in:
parent
0cb69c1039
commit
a2b9947704
1 changed files with 3 additions and 12 deletions
|
|
@ -39,14 +39,13 @@ CImageCopyCaptureSession::CImageCopyCaptureSession(SP<CExtImageCopyCaptureSessio
|
|||
|
||||
if UNLIKELY (!m_session) {
|
||||
m_resource->sendStopped();
|
||||
m_resource->error(-1, "unable to share screen");
|
||||
return;
|
||||
}
|
||||
|
||||
sendConstraints();
|
||||
|
||||
m_listeners.constraintsChanged = m_session->m_events.constraintsChanged.listen([this]() { sendConstraints(); });
|
||||
m_listeners.stopped = m_session->m_events.stopped.listen([this]() { PROTO::imageCopyCapture->destroyResource(this); });
|
||||
m_listeners.stopped = m_session->m_events.stopped.listen([this]() { m_resource->sendStopped(); });
|
||||
}
|
||||
|
||||
CImageCopyCaptureSession::~CImageCopyCaptureSession() {
|
||||
|
|
@ -65,7 +64,6 @@ void CImageCopyCaptureSession::sendConstraints() {
|
|||
|
||||
if UNLIKELY (formats.empty()) {
|
||||
m_session->stop();
|
||||
m_resource->error(-1, "no formats available");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +141,6 @@ CImageCopyCaptureCursorSession::CImageCopyCaptureCursorSession(SP<CExtImageCopyC
|
|||
m_session = Screenshare::mgr()->newCursorSession(pMgr->client(), m_pointer);
|
||||
if UNLIKELY (!m_session) {
|
||||
m_sessionResource->sendStopped();
|
||||
m_sessionResource->error(-1, "unable to share cursor");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +278,6 @@ void CImageCopyCaptureCursorSession::sendConstraints() {
|
|||
auto format = m_session->format();
|
||||
if UNLIKELY (format == DRM_FORMAT_INVALID) {
|
||||
m_session->stop();
|
||||
m_sessionResource->error(-1, "no formats available");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -313,13 +309,8 @@ void CImageCopyCaptureCursorSession::sendConstraints() {
|
|||
|
||||
void CImageCopyCaptureCursorSession::sendCursorEvents() {
|
||||
const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(m_resource->client(), PERMISSION_TYPE_CURSOR_POS);
|
||||
if (PERM != PERMISSION_RULE_ALLOW_MODE_ALLOW) {
|
||||
if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
|
||||
m_resource->error(-1, "client not allowed to capture cursor");
|
||||
PROTO::imageCopyCapture->destroyResource(this);
|
||||
}
|
||||
if (PERM != PERMISSION_RULE_ALLOW_MODE_ALLOW)
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PMONITOR = m_source->m_monitor.expired() ? m_source->m_window->m_monitor.lock() : m_source->m_monitor.lock();
|
||||
CBox sourceBox = m_source->logicalBox();
|
||||
|
|
@ -484,7 +475,7 @@ void CImageCopyCaptureProtocol::bindManager(wl_client* client, void* data, uint3
|
|||
SP<CImageCaptureSource> source = PROTO::imageCaptureSource->sourceFromResource(source_);
|
||||
if (!source) {
|
||||
LOGM(Log::ERR, "Client tried to create image copy capture session from invalid source");
|
||||
destroyResource(pMgr);
|
||||
pMgr->error(-1, "invalid image capture source");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue