44 #include <QtCore/qtimer.h> 45 #include <QtCore/qregexp.h> 46 #include <QtGui/qwidget.h> 47 #include <QtGui/qpolygon.h> 48 #include <QtGui/qpainter.h> 50 #include <QtGui/qevent.h> 51 #include <QWindowSystemInterface> 53 #include <qplatformdefs.h> 60 #define QT_QWS_VNC_DEBUG 61 #define QT_NO_QWS_CURSOR //### 69 #ifndef QT_QWS_DEPTH16_RGB 70 #define QT_QWS_DEPTH16_RGB 565 96 return qRgb(tr,tg,tb);
103 static const struct {
147 s->
read((
char*)buf, 8);
161 s->
write((
char*)buf, 8);
168 bitsPerPixel = buf[0];
175 while (a) { a >>= 1; redBits++; }
177 a = ntohs(*(
quint16 *)(buf + 6));
179 while (a) { a >>= 1; greenBits++; }
181 a = ntohs(*(
quint16 *)(buf + 8));
183 while (a) { a >>= 1; blueBits++; }
186 greenShift = buf[11];
193 buf[0] = bitsPerPixel;
199 for (
int i = 0; i < redBits; i++) a = (a << 1) | 1;
200 *(
quint16 *)(buf + 4) = htons(a);
203 for (
int i = 0; i < greenBits; i++) a = (a << 1) | 1;
204 *(
quint16 *)(buf + 6) = htons(a);
207 for (
int i = 0; i < blueBits; i++) a = (a << 1) | 1;
208 *(
quint16 *)(buf + 8) = htons(a);
211 buf[11] = greenShift;
220 name =
new char [strlen(n) + 1];
226 s->
read((
char *)&width, 2);
227 width = ntohs(width);
228 s->
read((
char *)&height, 2);
229 height = ntohs(height);
233 s->
read((
char *)&len, 4);
236 name =
new char [len + 1];
244 s->
write((
char *)&t, 2);
246 s->
write((
char *)&t, 2);
250 s->
write((
char *)&len, 4);
261 s->
read((
char *)&count, 2);
262 count = ntohs(count);
272 s->
read(&incremental, 1);
285 s->
read((
char *)&tmp, 2);
288 s->
read((
char *)&key, 4);
302 if (key >=
'a' && key <=
'z')
304 else if (key >=
' ' && key <=
'~')
318 s->
read(&buttonMask, 1);
321 wheelDirection = WheelNone;
329 wheelDirection = WheelUp;
331 wheelDirection = WheelDown;
333 wheelDirection = WheelLeft;
335 wheelDirection = WheelRight;
338 s->
read((
char *)&tmp, 2);
340 s->
read((
char *)&tmp, 2);
353 s->
read((
char *)&length, 4);
354 length = ntohl(length);
362 : qvnc_screen(screen), cursor(0)
368 : qvnc_screen(screen), cursor(0)
375 qDebug() <<
"QVNCServer::init" << port;
379 encodingsPending = 0;
387 timer->setSingleShot(
true);
392 qDebug() <<
"QVNCServer could not connect:" << serverSocket->errorString();
394 qDebug(
"QVNCServer created on port %d", port);
396 connect(serverSocket,
SIGNAL(newConnection()),
this,
SLOT(newConnection()));
398 #ifndef QT_NO_QWS_CURSOR 410 #ifndef QT_NO_QWS_CURSOR 418 if (state == Connected && !
timer->isActive() &&
419 ((dirtyMap()->numDirty > 0) || dirtyCursor)) {
429 client = serverSocket->nextPendingConnection();
430 connect(client,
SIGNAL(readyRead()),
this,
SLOT(readClient()));
431 connect(client,
SIGNAL(disconnected()),
this,
SLOT(discardClient()));
433 encodingsPending = 0;
435 supportHextile =
false;
438 timer->start(1000 / refreshRate);
442 const char *proto =
"RFB 003.003\n";
443 client->write(proto, 12);
454 if (client->bytesAvailable() >= 12) {
456 client->read(proto, 12);
458 qDebug(
"Client protocol version %s", proto);
461 client->write((
char *) &auth,
sizeof(auth));
467 if (client->bytesAvailable() >= 1) {
469 client->read((
char *) &shared, 1);
474 switch (qvnc_screen->depth()) {
568 qDebug(
"QVNC cannot drive depth %d", qvnc_screen->depth());
572 sim.
width = qvnc_screen->geometry().width();
573 sim.
height = qvnc_screen->geometry().height();
574 sim.
setName(
"Qt for Embedded Linux VNC Server");
583 client->read((
char *)&msgType, 1);
591 case FixColourMapEntries:
592 qDebug(
"Not supported: FixColourMapEntries");
598 case FramebufferUpdateRequest:
599 frameBufferUpdateRequest();
611 qDebug(
"Unknown message type: %d", (
int)msgType);
615 }
while (!handleMsg && client->bytesAvailable());
622 #if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN 629 return screen()->frameBufferLittleEndian();
630 return frameBufferLittleEndian();
636 if (client->bytesAvailable() >= 19) {
638 client->read(buf, 3);
639 pixelFormat.read(client);
640 #ifdef QT_QWS_VNC_DEBUG 641 qDebug(
"Want format: %d %d %d %d %d %d %d %d %d %d",
642 int(pixelFormat.bitsPerPixel),
643 int(pixelFormat.depth),
644 int(pixelFormat.bigEndian),
645 int(pixelFormat.trueColor),
646 int(pixelFormat.redBits),
647 int(pixelFormat.greenBits),
648 int(pixelFormat.blueBits),
649 int(pixelFormat.redShift),
650 int(pixelFormat.greenShift),
651 int(pixelFormat.blueShift));
653 if (!pixelFormat.trueColor) {
654 qDebug(
"Can only handle true color clients");
658 sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!pixelFormat.bigEndian;
659 needConversion = pixelConversionNeeded();
660 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 661 swapBytes = qvnc_screen->swapBytes();
670 if (!encodingsPending && enc.
read(client)) {
671 encodingsPending = enc.
count;
672 if (!encodingsPending)
692 supportCursor =
false;
694 if (encodingsPending && (
unsigned)client->bytesAvailable() >=
695 encodingsPending *
sizeof(
quint32)) {
696 for (
int i = 0; i < encodingsPending; ++i) {
700 #ifdef QT_QWS_VNC_DEBUG 701 qDebug(
"QVNCServer::setEncodings: %d", enc);
707 #ifdef QT_QWS_VNC_DEBUG 708 qDebug(
"QVNCServer::setEncodings: using raw");
713 supportCopyRect =
true;
722 supportHextile =
true;
725 switch (qvnc_screen->depth()) {
726 #ifdef QT_QWS_DEPTH_8 731 #ifdef QT_QWS_DEPTH_12 736 #ifdef QT_QWS_DEPTH_15 741 #ifdef QT_QWS_DEPTH_16 746 #ifdef QT_QWS_DEPTH_18 751 #ifdef QT_QWS_DEPTH_24 756 #ifdef QT_QWS_DEPTH_32 764 #ifdef QT_QWS_VNC_DEBUG 765 qDebug(
"QVNCServer::setEncodings: using hextile");
772 supportCursor =
true;
773 #ifndef QT_NO_QWS_CURSOR 781 supportDesktopSize =
true;
788 encodingsPending = 0;
793 #ifdef QT_QWS_VNC_DEBUG 794 qDebug(
"QVNCServer::setEncodings: fallback using raw");
799 cursor->setCursorMode(supportCursor);
806 if (ev.
read(client)) {
810 qvnc_screen->d_ptr->setDirty(r,
true);
823 if ((before & b) != (after & b)) {
825 *isPress = (after & b);
837 if (ev.
read(client)) {
839 eventPoint += screenOffset;
866 if (ev.
read(client)) {
892 if (cutTextPending == 0 && ev.
read(client)) {
893 cutTextPending = ev.
length;
898 if (cutTextPending && client->bytesAvailable() >= cutTextPending) {
899 char *
text =
new char [cutTextPending+1];
900 client->read(text, cutTextPending);
910 int width,
int height,
int stride)
912 const int depth = encoder->server->screen()->depth();
913 if (width % (depth / 8))
916 static int alwaysFalse =
qgetenv(
"QT_VNC_NOCHECKFILL").
toInt();
923 if ((data8[0] & 0xf) != (data8[0] >> 4))
929 if (data8[0] != data8[1])
937 if (data16[0] != data16[1])
945 const quint32 first = data32[0];
946 const int linestep = (stride /
sizeof(
quint32)) - width;
947 for (
int y = 0;
y < height; ++
y) {
948 for (
int x = 0;
x < width; ++
x) {
949 if (*(data32++) != first)
960 SRC color =
reinterpret_cast<const SRC*
>(
data)[0];
961 encoder->newBg |= (color != encoder->bg);
969 if (
true || encoder->newBg) {
970 const int bpp = encoder->server->clientBytesPerPixel();
971 const int padding = 3;
974 encoder->server->convertPixels(buffer.
data() + padding + 1,
975 reinterpret_cast<char*
>(&encoder->bg),
977 socket->
write(buffer.
data() + padding, bpp + 1);
981 socket->
write(&subenc, 1);
987 int width,
int height,
int stride)
989 const SRC *
ptr =
reinterpret_cast<const SRC*
>(
data);
990 const int linestep = (stride /
sizeof(SRC)) - width;
1002 while (y < height) {
1008 goto found_second_color;
1020 while (y < height) {
1024 }
else if (*ptr == c2) {
1043 encoder->newBg |= (c1 != encoder->bg);
1044 encoder->newFg |= (c2 != encoder->fg);
1050 bool inRect =
false;
1052 ptr =
reinterpret_cast<const SRC*
>(
data);
1053 for (y = 0; y < height; ++
y) {
1054 for (x = 0; x < width; ++
x) {
1055 if (inRect && *ptr == encoder->bg) {
1057 setWidth(x - lastx());
1060 }
else if (!inRect && *ptr == encoder->fg) {
1071 setWidth(width - lastx());
1081 template <
class SRC>
1084 const int bpp = encoder->server->clientBytesPerPixel();
1085 const int padding = 3;
1087 char &subenc = buffer[padding];
1088 int n = padding +
sizeof(subenc);
1092 if (encoder->newBg) {
1094 encoder->server->convertPixels(buffer.
data() + n, (
char*)&encoder->bg, 1);
1099 if (encoder->newFg) {
1101 encoder->server->convertPixels(buffer.
data() + n, (
char*)&encoder->fg, 1);
1105 buffer[n] = numRects;
1106 n +=
sizeof(numRects);
1108 socket->
write(buffer.
data() + padding, n - padding);
1109 socket->
write((
char*)rects, numRects *
sizeof(Rect));
1112 template <
class SRC>
1115 for (
int r = numRects - 1; r >= 0; --r) {
1116 if (recty(r) == lasty())
1118 if (recty(r) < lasty() - 1)
1120 if (rectx(r) == lastx() && width(r) == width(numRects)) {
1128 template <
class SRC>
1131 encoder->server->convertPixels(reinterpret_cast<char*>(rect(numRects)),
1132 (
const char*)&color, 1);
1135 template <
class SRC>
1138 if ((rects.size() + bpp + 2) > maxRectsSize)
1140 rects.resize(rects.size() + bpp + 2);
1144 template <
class SRC>
1147 setHeight(numRects, 1);
1151 template <
class SRC>
1153 int width,
int height,
int stride)
1155 const SRC *
ptr =
reinterpret_cast<const SRC*
>(
data);
1156 const int linestep = (stride /
sizeof(SRC)) - width;
1158 bpp = encoder->server->clientBytesPerPixel();
1161 encoder->bg = ptr[0];
1163 const SRC bg = encoder->bg;
1165 bool inRect =
false;
1170 for (
int y = 0;
y < height; ++
y) {
1171 for (
int x = 0;
x < width; ++
x) {
1172 if (inRect && *ptr != color) {
1173 setWidth(numRects,
x - rectx(numRects));
1178 if (!inRect && *ptr != bg) {
1190 setWidth(numRects, width - rectx(numRects));
1200 template <
class SRC>
1203 const int padding = 3;
1206 quint8 &subenc = buffer[padding];
1207 int n = padding +
sizeof(
quint8);
1211 if (encoder->newBg) {
1213 encoder->server->convertPixels(reinterpret_cast<char*>(buffer.
data() + n),
1214 reinterpret_cast<const char*>(&encoder->bg),
1220 buffer[n] = numRects;
1221 n +=
sizeof(numRects);
1223 socket->
write(reinterpret_cast<const char*>(buffer.
data() + padding),
1225 socket->
write(reinterpret_cast<const char*>(rects.constData()),
1234 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 1235 if (qvnc_screen->swapBytes())
1239 const int screendepth = qvnc_screen->depth();
1240 if (screendepth != pixelFormat.bitsPerPixel)
1243 switch (screendepth) {
1248 return (pixelFormat.redBits == 6
1249 && pixelFormat.greenBits == 6
1250 && pixelFormat.blueBits == 6);
1252 return (pixelFormat.redBits == 5
1253 && pixelFormat.greenBits == 6
1254 && pixelFormat.blueBits == 5);
1256 return (pixelFormat.redBits == 5
1257 && pixelFormat.greenBits == 5
1258 && pixelFormat.blueBits == 5);
1260 return (pixelFormat.redBits == 4
1261 && pixelFormat.greenBits == 4
1262 && pixelFormat.blueBits == 4);
1270 const int screendepth = qvnc_screen->depth();
1271 const bool isBgr =
false;
1274 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 1278 if (screendepth == pixelFormat.bitsPerPixel) {
1280 switch (screendepth) {
1282 memcpy(dst, src, count *
sizeof(
quint32));
1285 if (pixelFormat.redBits == 5
1286 && pixelFormat.greenBits == 6
1287 && pixelFormat.blueBits == 5)
1289 memcpy(dst, src, count *
sizeof(
quint16));
1293 }
else if (screendepth == 16 && pixelFormat.bitsPerPixel == 32) {
1294 #if defined(__i386__) // Currently fails on ARM if dst is not 4 byte aligned 1304 result1 = ((s & 0xf8000000) | ((s & 0xe0000000) >> 5)) >> 8;
1305 result2 = ((s & 0x0000f800) | ((s & 0x0000e000) >> 5)) << 8;
1308 result1 |= ((s & 0x07e00000) | ((s & 0x06000000) >> 6)) >> 11;
1309 result2 |= ((s & 0x000007e0) | ((s & 0x00000600) >> 6)) << 5;
1312 result1 |= ((s & 0x001f0000) | ((s & 0x001c0000) >> 5)) >> 13;
1313 result2 |= ((s & 0x0000001f) | ((s & 0x0000001c) >> 5)) << 3;
1327 const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8;
1331 for (
int i = 0; i < count; ++i) {
1334 switch (screendepth) {
1338 r = ((*src) & 0x0f) << 4;
1350 QRgb rgb = qvnc_screen->clut()[int(*src)];
1358 #ifdef QT_QWS_DEPTH_12 1368 #ifdef QT_QWS_DEPTH_15 1380 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 1382 p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8);
1384 r = (p >> 11) & 0x1f;
1385 g = (p >> 5) & 0x3f;
1393 #ifdef QT_QWS_DEPTH_18 1403 #ifdef QT_QWS_DEPTH_24 1415 r = (p >> 16) & 0xff;
1416 g = (p >> 8) & 0xff;
1423 qDebug(
"QVNCServer: don't support %dbpp display", screendepth);
1428 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 1429 if (swapBytes ^ isBgr)
1435 r >>= (8 - pixelFormat.redBits);
1436 g >>= (8 - pixelFormat.greenBits);
1437 b >>= (8 - pixelFormat.blueBits);
1439 int pixel = (r << pixelFormat.redShift) |
1440 (g << pixelFormat.greenShift) |
1441 (b << pixelFormat.blueShift);
1443 if (sameEndian || pixelFormat.bitsPerPixel == 8) {
1444 memcpy(dst, &pixel, bytesPerPixel);
1450 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
1451 switch (pixelFormat.bitsPerPixel) {
1453 pixel = (((pixel & 0x0000ff00) << 8) |
1454 ((pixel & 0x000000ff) << 24));
1457 pixel = (((pixel & 0xff000000) >> 24) |
1458 ((pixel & 0x00ff0000) >> 8) |
1459 ((pixel & 0x0000ff00) << 8) |
1460 ((pixel & 0x000000ff) << 24));
1463 qDebug(
"Cannot handle %d bpp client", pixelFormat.bitsPerPixel);
1466 switch (pixelFormat.bitsPerPixel) {
1468 pixel = (((pixel & 0xff000000) >> 8) |
1469 ((pixel & 0x00ff0000) << 8));
1472 pixel = (((pixel & 0xff000000) >> 24) |
1473 ((pixel & 0x00ff0000) >> 8) |
1474 ((pixel & 0x0000ff00) << 8) |
1475 ((pixel & 0x000000ff) << 24));
1478 qDebug(
"Cannot handle %d bpp client",
1479 pixelFormat.bitsPerPixel);
1483 memcpy(dst, &pixel, bytesPerPixel);
1488 #ifndef QT_NO_QWS_CURSOR 1492 const QRect intersection = (cursorRect & imageRect);
1500 #endif // QT_NO_QWS_CURSOR 1545 static bool alwaysForce =
qgetenv(
"QT_VNC_NO_COMPAREBUFFER").
toInt();
1549 bool changed =
false;
1552 const int lstep = screen->
linestep();
1559 const int tileHeight = (startY + MAP_TILE_SIZE >
bufferHeight ?
1561 const int tileWidth = (startX + MAP_TILE_SIZE >
bufferWidth ?
1579 memcpy(old, scrn,
sizeof(T) * MAP_TILE_SIZE);
1586 if (memcmp(old, scrn,
sizeof(T) * tileWidth)) {
1596 memcpy(old, scrn,
sizeof(T) * tileWidth);
1604 const int mapIndex = tileY *
mapWidth + tileX;
1605 if ((force || changed) && !
map[mapIndex]) {
1611 template <
class SRC>
1614 singleColorHextile(
this), dualColorHextile(
this), multiColorHextile(
this)
1622 template <
class SRC>
1630 const quint32 encoding = htonl(5);
1634 const char tmp[2] = { 0, 0 };
1635 socket->
write(tmp,
sizeof(tmp));
1639 socket->
write((
char *)&count,
sizeof(count));
1653 QSize screenSize =
server->screen()->geometry().size();
1655 for (
int y = 0; y < map->
mapHeight; ++y) {
1657 rect.
h = screenSize.
height() - rect.
y;
1659 for (
int x = 0; x < map->
mapWidth; ++x) {
1660 if (!map->
dirty(x, y))
1665 if (rect.
x + MAP_TILE_SIZE > screenSize.
width())
1666 rect.
w = screenSize.
width() - rect.
x;
1669 socket->
write((
char *)&encoding,
sizeof(encoding));
1672 + rect.
x * screenImage.
depth() / 8;
1675 #ifndef QT_NO_QWS_CURSOR 1678 && !
server->hasClientCursor()
1681 if (doBlendCursor) {
1682 const QRect tileRect(rect.
x, rect.
y, rect.
w, rect.
h);
1686 tileImage = screenImage.
copy(tileRect);
1689 screendata = tileImage.
bits();
1693 #endif // QT_NO_QWS_CURSOR 1695 if (singleColorHextile.read(screendata, rect.
w, rect.
h, linestep)) {
1696 singleColorHextile.write(socket);
1697 }
else if (dualColorHextile.read(screendata, rect.
w, rect.
h, linestep)) {
1698 dualColorHextile.write(socket);
1699 }
else if (multiColorHextile.read(screendata, rect.
w, rect.
h, linestep)) {
1700 multiColorHextile.write(socket);
1701 }
else if (
server->doPixelConversion()) {
1702 const int bufferSize = rect.
w * rect.
h * bytesPerPixel + 1;
1703 const int padding =
sizeof(
quint32) -
sizeof(
char);
1704 buffer.resize(bufferSize + padding);
1709 char *b =
buffer.data() + padding + 1;
1711 for (
int i = 0; i < rect.
h; ++i) {
1712 server->convertPixels(b, (
const char*)screendata, rect.
w);
1713 screendata += linestep;
1716 socket->
write(
buffer.constData() + padding, bufferSize);
1719 socket->
write((
char *)&subenc, 1);
1722 for (
int i = 0; i < rect.
h; ++i) {
1723 socket->
write((
const char*)screendata,
1724 rect.
w * bytesPerPixel);
1725 screendata += linestep;
1747 QSize screenSize =
server->screen()->geometry().size();
1752 for (
int y = 0; y < map->
mapHeight; ++y) {
1753 for (
int x = 0; x < map->
mapWidth; ++x) {
1754 if (!map->
dirty(x, y))
1757 MAP_TILE_SIZE, MAP_TILE_SIZE);
1768 const char tmp[2] = { 0, 0 };
1769 socket->
write(tmp,
sizeof(tmp));
1773 const quint16 count = htons(rects.size());
1774 socket->
write((
char *)&count,
sizeof(count));
1777 if (rects.size() <= 0) {
1784 for (
int i = 0; i < rects.size(); ++i) {
1785 const QRect tileRect = rects.at(i);
1786 const QRfbRect rect(tileRect.
x(), tileRect.
y(),
1790 const quint32 encoding = htonl(0);
1791 socket->
write((
char *)&encoding,
sizeof(encoding));
1795 + rect.x * screenImage->
depth() / 8;
1797 #ifndef QT_NO_QWS_CURSOR 1800 && !
server->hasClientCursor()
1803 if (doBlendCursor) {
1807 tileImage = screenImage->
copy(tileRect);
1810 screendata = tileImage.
bits();
1814 #endif // QT_NO_QWS_CURSOR 1816 if (
server->doPixelConversion()) {
1818 if (bufferSize >
buffer.size())
1819 buffer.resize(bufferSize);
1824 for (
int i = 0; i < rect.h; ++i) {
1825 server->convertPixels(b, (
const char*)screendata, rect.w);
1826 screendata += linestep;
1831 for (
int i = 0; i < rect.h; ++i) {
1832 socket->
write((
const char*)screendata, rect.w * bytesPerPixel);
1833 screendata += linestep;
1846 return qvnc_screen->image();
1855 #ifndef QT_NO_QWS_CURSOR 1857 qvnc_cursor->write();
1859 cursor->sendClientCursor();
1860 dirtyCursor =
false;
1875 state = Unconnected;
1878 #ifndef QT_NO_QWS_CURSOR 1889 : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25),
1890 vncServer(0), q_ptr(parent)
1892 #if 0//ndef QT_NO_QWS_SIGNALHANDLER 1922 const QRect r = rect;
The QPainter class performs low-level painting on widgets and other paint devices.
void convertPixels(char *dst, const char *src, int count) const
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
bool dirty(int x, int y) const
void frameBufferUpdateRequest()
#define QT_END_NAMESPACE
This macro expands to.
static void blendCursor(QImage *dest, const QImage &cursor, const QPoint &offset)
QRgb qt_conv16ToRgb(ushort c)
static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
qint64 bytesAvailable() const
Returns the number of incoming bytes that are waiting to be read.
bool flush()
This function writes as much as possible from the internal write buffer to the underlying network soc...
static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::MouseButton *button, bool *isPress)
static void handleWheelEvent(QWidget *w, const QPoint &local, const QPoint &global, int d, Qt::Orientation o)
void setDirty(const QRect &rect, bool force=false)
static Qt::MouseButtons buttons
static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
void write(QTcpSocket *socket) const
static int bytesPerPixel(QImage::Format format)
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int width() const
Returns the width of the rectangle.
static const int qt_red_rounding_shift
int bytesPerLine() const
Returns the number of bytes per image scanline.
long ASN1_INTEGER_get ASN1_INTEGER * a
QVNCDirtyMap(QScreen *screen)
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QVNCServer(QVNCScreen *screen)
QRfbHextileEncoder(QVNCServer *s)
virtual void setDirty(int x, int y, bool force=false)=0
void addObject(QObject *object)
QImage image() const
Returns the cursor's image.
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
static QWSSignalHandler * instance()
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
void setName(const char *n)
Q_CORE_EXPORT void qDebug(const char *,...)
bool isAccelerated() const
Returns true if the cursor is accelerated; otherwise false.
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setRefreshRate(int rate)
virtual int depth() const
Reimplement in subclass to return current depth of the screen.
#define QT_QWS_DEPTH16_RGB
bool pixelConversionNeeded() const
The QVNCScreen class implements a screen driver for VNC servers.
static const int qt_red_shift
bool read(const uchar *data, int width, int height, int stride)
QSize size() const
Returns the size of the rectangle.
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
bool read(const uchar *data, int width, int height, int stride)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
bool read(const uchar *data, int width, int height, int stride)
The QTcpSocket class provides a TCP socket.
The QRegion class specifies a clip region for a painter.
const T * ptr(const T &t)
int depth() const
Returns the depth of the image.
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
void qSwap(T &value1, T &value2)
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QRgb qRgb(int r, int g, int b)
Returns the ARGB quadruplet (255, {r}, {g}, {b}).
void write(QTcpSocket *s) const
uchar * bits()
Returns a pointer to the first pixel data.
static QAuServer & server()
enum QRfbPointerEvent::@354 wheelDirection
int right() const
Returns the x-coordinate of the rectangle's right edge.
static const int qt_red_mask
Type
This enum type defines the valid event types in Qt.
void write(QTcpSocket *socket) const
int y() const
Returns the y-coordinate of the rectangle's top edge.
void write(QTcpSocket *s)
int x() const
Returns the x-coordinate of the rectangle's left edge.
QRect boundingRect() const
Returns the cursor's bounding rectangle.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
The QPoint class defines a point in the plane using integer precision.
static const int qt_blue_mask
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
void write(QTcpSocket *socket) const
The QTcpServer class provides a TCP-based server.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
static const int qt_blue_rounding_shift
static const int qt_gbits
static const int qt_green_shift
static const struct @353 keyMap[]
The QSize class defines the size of a two-dimensional object using integer point precision.
QImage screenImage() const
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
virtual QRect geometry() const
Reimplement in subclass to return the pixel geometry of the screen.
QVNCScreenPrivate(QVNCScreen *parent)
Q_GUI_EXPORT QScreenCursor * qt_screencursor
The QTimer class provides repetitive and single-shot timers.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
static const int qt_rbits
static const int qt_bbits
void setClean(int x, int y)
static const int qt_green_mask
static const int qt_green_rounding_shift
static const int qt_neg_blue_shift
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
SocketState state() const
Returns the state of the socket.
The KeyEvent object provides information about a key event.
void setDirty(int x, int y, bool force=false)
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.