diff --git a/src/plugins/screencast/screencastmanager.cpp b/src/plugins/screencast/screencastmanager.cpp index 75a5d3e66a..5c869abd68 100644 --- a/src/plugins/screencast/screencastmanager.cpp +++ b/src/plugins/screencast/screencastmanager.cpp @@ -179,9 +179,10 @@ void ScreencastManager::streamRegion(KWaylandServer::ScreencastStreamV1Interface stream->setObjectName(rectToString(geometry)); stream->setCursorMode(mode, scale, geometry); - connect(stream, &ScreenCastStream::startStreaming, waylandStream, [geometry, stream, source] { + connect(stream, &ScreenCastStream::startStreaming, waylandStream, [geometry, stream, source, waylandStream] { Compositor::self()->scene()->addRepaint(geometry); + bool found = false; const auto allOutputs = workspace()->outputs(); for (auto output : allOutputs) { if (output->geometry().intersects(geometry)) { @@ -196,8 +197,12 @@ void ScreencastManager::streamRegion(KWaylandServer::ScreencastStreamV1Interface stream->recordFrame(scaleRegion(region.translated(-streamRegion.topLeft()).intersected(streamRegion), source->scale())); }; connect(output, &Output::outputChange, stream, bufferToStream); + found |= true; } } + if (!found) { + waylandStream->sendFailed(i18n("Region outside the workspace")); + } }); integrateStreams(waylandStream, stream); }