Adjust screencast service to recent kwayland-server changes

master
Vlad Zahorodnii 2020-09-04 17:55:59 +03:00
parent 2b241d3081
commit 9663dd5fb3
4 changed files with 22 additions and 22 deletions

View File

@ -255,7 +255,7 @@ bool PipeWireStream::createStream()
return false;
}
if (m_cursor.mode == KWaylandServer::ScreencastInterface::Embedded) {
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Embedded) {
connect(Cursors::self(), &Cursors::positionChanged, this, [this] {
if (m_cursor.lastFrameTexture) {
m_repainting = true;
@ -348,7 +348,7 @@ void PipeWireStream::recordFrame(GLTexture *frameTexture, const QRegion &damaged
frameTexture->bind();
glGetTextureImage(frameTexture->texture(), 0, m_hasAlpha ? GL_BGRA : GL_BGR, GL_UNSIGNED_BYTE, bufferSize, data);
auto cursor = Cursors::self()->currentCursor();
if (m_cursor.mode == KWaylandServer::ScreencastInterface::Embedded && m_cursor.viewport.contains(cursor->pos())) {
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Embedded && m_cursor.viewport.contains(cursor->pos())) {
QImage dest(data, size.width(), size.height(), QImage::Format_RGBA8888_Premultiplied);
QPainter painter(&dest);
const auto position = (cursor->pos() - m_cursor.viewport.topLeft() - cursor->hotspot()) * m_cursor.scale;
@ -378,7 +378,7 @@ void PipeWireStream::recordFrame(GLTexture *frameTexture, const QRegion &damaged
frameTexture->render(damagedRegion, r, true);
auto cursor = Cursors::self()->currentCursor();
if (m_cursor.mode == KWaylandServer::ScreencastInterface::Embedded && m_cursor.viewport.contains(cursor->pos())) {
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Embedded && m_cursor.viewport.contains(cursor->pos())) {
if (!m_repainting) //We need to copy the last version of the stream to render the moved cursor on top
m_cursor.lastFrameTexture.reset(copyTexture(frameTexture));
@ -404,7 +404,7 @@ void PipeWireStream::recordFrame(GLTexture *frameTexture, const QRegion &damaged
}
frameTexture->unbind();
if (m_cursor.mode == KWaylandServer::ScreencastInterface::Metadata) {
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Metadata) {
sendCursorData(Cursors::self()->currentCursor(),
(spa_meta_cursor *) spa_buffer_find_meta_data (spa_buffer, SPA_META_Cursor, sizeof (spa_meta_cursor)));
}
@ -457,7 +457,7 @@ void PipeWireStream::sendCursorData(Cursor *cursor, spa_meta_cursor *spa_meta_cu
painter.drawImage(QPoint(), image);
}
void PipeWireStream::setCursorMode(KWaylandServer::ScreencastInterface::CursorMode mode, qreal scale, const QRect &viewport)
void PipeWireStream::setCursorMode(KWaylandServer::ScreencastV1Interface::CursorMode mode, qreal scale, const QRect &viewport)
{
m_cursor.mode = mode;
m_cursor.scale = scale;

View File

@ -11,7 +11,7 @@
#include "config-kwin.h"
#include "kwinglobals.h"
#include <KWaylandServer/screencast_interface.h>
#include <KWaylandServer/screencast_v1_interface.h>
#include <QHash>
#include <QObject>
@ -50,7 +50,7 @@ public:
/** Renders @p frame into the current framebuffer into the stream */
void recordFrame(GLTexture *frame, const QRegion &damagedRegion);
void setCursorMode(KWaylandServer::ScreencastInterface::CursorMode mode, qreal scale, const QRect &viewport);
void setCursorMode(KWaylandServer::ScreencastV1Interface::CursorMode mode, qreal scale, const QRect &viewport);
Q_SIGNALS:
void streamReady(quint32 nodeId);
@ -84,7 +84,7 @@ private:
const bool m_hasAlpha;
struct {
KWaylandServer::ScreencastInterface::CursorMode mode = KWaylandServer::ScreencastInterface::Hidden;
KWaylandServer::ScreencastV1Interface::CursorMode mode = KWaylandServer::ScreencastV1Interface::Hidden;
qreal scale = 1;
QRect viewport;
qint64 lastKey = 0;

View File

@ -29,11 +29,11 @@ namespace KWin
ScreencastManager::ScreencastManager(QObject *parent)
: QObject(parent)
, m_screencast(waylandServer()->display()->createScreencastInterface(this))
, m_screencast(waylandServer()->display()->createScreencastV1Interface(this))
{
connect(m_screencast, &KWaylandServer::ScreencastInterface::windowScreencastRequested,
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::windowScreencastRequested,
this, &ScreencastManager::streamWindow);
connect(m_screencast, &KWaylandServer::ScreencastInterface::outputScreencastRequested,
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::outputScreencastRequested,
this, &ScreencastManager::streamOutput);
}
@ -114,7 +114,7 @@ private:
Toplevel *m_toplevel;
};
void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamInterface *waylandStream, const QString &winid)
void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamV1Interface *waylandStream, const QString &winid)
{
auto *toplevel = Workspace::self()->findToplevel(winid);
@ -127,9 +127,9 @@ void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamInterface *
integrateStreams(waylandStream, stream);
}
void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamInterface *waylandStream,
void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamV1Interface *waylandStream,
KWaylandServer::OutputInterface *output,
KWaylandServer::ScreencastInterface::CursorMode mode)
KWaylandServer::ScreencastV1Interface::CursorMode mode)
{
AbstractWaylandOutput *streamOutput = waylandServer()->findOutput(output);
@ -157,9 +157,9 @@ void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamInterface *
integrateStreams(waylandStream, stream);
}
void ScreencastManager::integrateStreams(KWaylandServer::ScreencastStreamInterface *waylandStream, PipeWireStream *stream)
void ScreencastManager::integrateStreams(KWaylandServer::ScreencastStreamV1Interface *waylandStream, PipeWireStream *stream)
{
connect(waylandStream, &KWaylandServer::ScreencastStreamInterface::finished, stream, &PipeWireStream::stop);
connect(waylandStream, &KWaylandServer::ScreencastStreamV1Interface::finished, stream, &PipeWireStream::stop);
connect(stream, &PipeWireStream::stopStreaming, waylandStream, [stream, waylandStream] {
waylandStream->sendClosed();
delete stream;

View File

@ -8,7 +8,7 @@
#pragma once
#include <KWaylandServer/screencast_interface.h>
#include <KWaylandServer/screencast_v1_interface.h>
namespace KWin
{
@ -22,15 +22,15 @@ class ScreencastManager : public QObject
public:
explicit ScreencastManager(QObject *parent = nullptr);
void streamWindow(KWaylandServer::ScreencastStreamInterface *stream, const QString &winid);
void streamOutput(KWaylandServer::ScreencastStreamInterface *stream,
void streamWindow(KWaylandServer::ScreencastStreamV1Interface *stream, const QString &winid);
void streamOutput(KWaylandServer::ScreencastStreamV1Interface *stream,
KWaylandServer::OutputInterface *output,
KWaylandServer::ScreencastInterface::CursorMode mode);
KWaylandServer::ScreencastV1Interface::CursorMode mode);
private:
void integrateStreams(KWaylandServer::ScreencastStreamInterface *waylandStream, PipeWireStream *pipewireStream);
void integrateStreams(KWaylandServer::ScreencastStreamV1Interface *waylandStream, PipeWireStream *pipewireStream);
KWaylandServer::ScreencastInterface *m_screencast;
KWaylandServer::ScreencastV1Interface *m_screencast;
};
} // namespace KWin