1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

Implement XCB framebuffer plugin (port from x11)

Previously used x11 plugin does not compile with Qt5, because Qt5 does
not use Xlib, it uses xcb. Rewrite screen capture plugin from Xlib to
xcb.

I made xcb libs compile required dependency, but availability of X
shared memory extension is checked at runtime. It is used to effectively
get image pixels data, instead of transfering 8Mb over the wire. Xdamage
is used to limit image getting operations only within actually changed
rectangles of screen.

BUG: 377998

Tested on single-monitor system and dual-monitor, where primary monitor
does not start at (0,0) coordinate. Image transfer works fine.
Dual-monitor only has problems with receiving mouse cursor position and
clicks, but this should be fixed outside of framebuffer plugin.

Differential Revision: https://phabricator.kde.org/D5211
This commit is contained in:
Alexey Min
2017-06-15 23:20:48 +02:00
committed by Albert Astals Cid
parent c92ef2f230
commit b2cb3e8204
10 changed files with 1055 additions and 12 deletions

View File

@@ -0,0 +1,48 @@
/* This file is part of the KDE project
Copyright (C) 2017 Alexey Min <alexey.min@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef KRFB_FRAMEBUFFER_XCB_XCB_FRAMEBUFFER_H
#define KRFB_FRAMEBUFFER_XCB_XCB_FRAMEBUFFER_H
#include "framebuffer.h"
#include <QWidget>
#include <xcb/xcb.h>
/**
@author Alexey Min <alexey.min@gmail.com>
*/
class XCBFrameBuffer: public FrameBuffer
{
Q_OBJECT
public:
XCBFrameBuffer(WId winid, QObject *parent = 0);
~XCBFrameBuffer();
public:
QList<QRect> modifiedTiles() Q_DECL_OVERRIDE;
int depth() Q_DECL_OVERRIDE;
int height() Q_DECL_OVERRIDE;
int width() Q_DECL_OVERRIDE;
int paddedWidth() Q_DECL_OVERRIDE;
void getServerFormat(rfbPixelFormat &format) Q_DECL_OVERRIDE;
void startMonitor() Q_DECL_OVERRIDE;
void stopMonitor() Q_DECL_OVERRIDE;
public:
void handleXDamageNotify(xcb_generic_event_t *xevent);
private:
void cleanupRects();
class P;
P *const d;
};
#endif