9#include <QtCore/QLoggingCategory>
10#include <QtCore/qbytearray.h>
11#include <QtCore/qvarlengtharray.h>
12#include <qpa/qplatformcursor.h>
16Q_DECLARE_LOGGING_CATEGORY(lcVnc)
23class QVncClientCursor;
27#define MAP_TILE_SIZE 16
36 bool dirty(
int x,
int y)
const;
37 virtual void setDirty(
int x,
int y,
bool force =
false) = 0;
62 void setDirty(
int x,
int y,
bool force =
false)
override;
70 QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) {
71 x = _x; y = _y; w = _w; h = _h;
74 void read(QTcpSocket *s);
75 void write(QTcpSocket *s)
const;
86 static int size() {
return 16; }
88 void read(QTcpSocket *s);
89 void write(QTcpSocket *s);
112 void read(QTcpSocket *s);
113 void write(QTcpSocket *s);
124 bool read(QTcpSocket *s);
132 bool read(QTcpSocket *s);
141 bool read(QTcpSocket *s);
151 bool read(QTcpSocket *s);
161 bool read(QTcpSocket *s);
183 void write()
override;
196 bool read(
const uchar *data,
int width,
int height,
int stride);
197 void write(QTcpSocket *socket)
const;
208 bool read(
const uchar *data,
int width,
int height,
int stride);
209 void write(QTcpSocket *socket)
const;
215 } Q_PACKED rects[8 * 16];
221 inline int lastx()
const {
return rectx(numRects); }
222 inline int lasty()
const {
return recty(numRects); }
223 inline int rectx(
int r)
const {
return rects[r].xy >> 4; }
224 inline int recty(
int r)
const {
return rects[r].xy & 0x0f; }
225 inline int width(
int r)
const {
return (rects[r].wh >> 4) + 1; }
226 inline int height(
int r)
const {
return (rects[r].wh & 0x0f) + 1; }
228 inline void setX(
int r,
int x) {
229 rects[r].xy = (x << 4) | (rects[r].xy & 0x0f);
231 inline void setY(
int r,
int y) {
232 rects[r].xy = (rects[r].xy & 0xf0) | y;
234 inline void setWidth(
int r,
int width) {
235 rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f);
237 inline void setHeight(
int r,
int height) {
238 rects[r].wh = (rects[r].wh & 0xf0) | (height - 1);
241 inline void setWidth(
int width) { setWidth(numRects, width); }
242 inline void setHeight(
int height) { setHeight(numRects, height); }
243 inline void setX(
int x) { setX(numRects, x); }
244 inline void setY(
int y) { setY(numRects, y); }
253 bool read(
const uchar *data,
int width,
int height,
int stride);
254 void write(QTcpSocket *socket)
const;
257 inline quint8* rect(
int r) {
258 return rects.data() + r * (bpp + 2);
260 inline const quint8* rect(
int r)
const {
261 return rects.constData() + r * (bpp + 2);
263 inline void setX(
int r,
int x) {
264 quint8 *ptr = rect(r) + bpp;
265 *ptr = (x << 4) | (*ptr & 0x0f);
267 inline void setY(
int r,
int y) {
268 quint8 *ptr = rect(r) + bpp;
269 *ptr = (*ptr & 0xf0) | y;
271 void setColor(SRC color);
272 inline int rectx(
int r)
const {
273 const quint8 *ptr = rect(r) + bpp;
276 inline int recty(
int r)
const {
277 const quint8 *ptr = rect(r) + bpp;
280 inline void setWidth(
int r,
int width) {
281 quint8 *ptr = rect(r) + bpp + 1;
282 *ptr = ((width - 1) << 4) | (*ptr & 0x0f);
284 inline void setHeight(
int r,
int height) {
285 quint8 *ptr = rect(r) + bpp + 1;
286 *ptr = (*ptr & 0xf0) | (height - 1);
292 static const int maxRectsSize = 16 * 16;
293 QVarLengthArray<quint8, maxRectsSize> rects;
310 BackgroundSpecified = 2,
311 ForegroundSpecified = 4,
313 SubrectsColoured = 16
332class QVncClientCursor :
public QPlatformCursor
338 void write(QVncClient *client)
const;
340 void changeCursor(QCursor *widgetCursor, QWindow *window) override;
342 void addClient(QVncClient *client);
343 uint removeClient(QVncClient *client);
347 QList<QVncClient *> clients;
374 QTcpServer *serverSocket;
375 QList<QVncClient*> clients;
void write(QTcpSocket *socket) const
bool read(const uchar *data, int width, int height, int stride)
QRfbDualColorHextile(QRfbHextileEncoder< SRC > *e)
QRfbEncoder(QVncClient *s)
QRfbHextileEncoder(QVncServer *s)
QRfbMultiColorHextile(QRfbHextileEncoder< SRC > *e)
void write(QTcpSocket *socket) const
bool read(const uchar *data, int width, int height, int stride)
QRfbRawEncoder(QVncClient *s)
QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h)
void write(QTcpSocket *s) const
void setName(const char *n)
void write(QTcpSocket *s)
void write(QTcpSocket *socket) const
QRfbSingleColorHextile(QRfbHextileEncoder< SRC > *e)
bool read(const uchar *data, int width, int height, int stride)
QVncDirtyMapOptimized(QVncScreen *screen)
void setDirty(int x, int y, bool force=false) override
QVncDirtyMap(QVncScreen *screen)
bool dirty(int x, int y) const
virtual void setDirty(int x, int y, bool force=false)=0
void setClean(int x, int y)
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformServices * services() const override
QVncIntegration(const QStringList ¶mList)
QList< QPlatformScreen * > screens() const
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformNativeInterface * nativeInterface() const override
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QVncScreen * screen() const
QImage screenImage() const
void discardClient(QVncClient *client)
QVncDirtyMap * dirtyMap() const