Remove unmaintained and broken VNC platform plugin
Change-Id: Ie0a07c3a6822870b095a20d997b63fb1635f20be Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Robert Griebl <robert.griebl@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
This commit is contained in:
parent
329469d5a1
commit
8a79e8b645
@ -86,7 +86,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
|
||||
BEARERPLUGINS = qgenericbearer qnativewifibearer
|
||||
CODECPLUGINS = qcncodecs qjpcodecs qkrcodecs qtwcodecs
|
||||
DECORATIONPLUGINS = qdecorationdefault qdecorationstyled qdecorationwindows
|
||||
GFXDRIVERPLUGINS = qgfxvnc qscreenvfb qgfxtransformed qgfxshadowfb qgfxpvregl qscreenlinuxfb qeglnullws qdirectfbscreen qahiscreen
|
||||
GFXDRIVERPLUGINS = qscreenvfb qgfxtransformed qgfxshadowfb qgfxpvregl qscreenlinuxfb qeglnullws qdirectfbscreen qahiscreen
|
||||
GRAPHICSSYSTEMPLUGINS = qmeegographicssystem qglgraphicssystem qvggraphicssystem qshivavggraphicssystem
|
||||
IMAGEPLUGINS = qgif qico qjpeg qsvg
|
||||
INPUTPLUGINS = qimsw-multi
|
||||
|
@ -1,73 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qvncintegration.h"
|
||||
#include <qstringlist.h>
|
||||
#include <QtGui/QPlatformIntegrationPlugin>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVNCIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QPlatformIntegration *create(const QString&, const QStringList &);
|
||||
};
|
||||
|
||||
QStringList QVNCIntegrationPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << "VNC";
|
||||
return list;
|
||||
}
|
||||
|
||||
QPlatformIntegration* QVNCIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == "vnc")
|
||||
return new QVNCIntegration(paramList);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(vnc, QVNCIntegrationPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,156 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QPainter>
|
||||
#include <QTcpSocket>
|
||||
#include <arpa/inet.h>
|
||||
#include <QBitmap>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "qvnccursor.h"
|
||||
#include "qvncserver.h"
|
||||
#include "qvncintegration.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCScreen *scr )
|
||||
:QPlatformSoftwareCursor(scr), useVncCursor(false), server(srvr)
|
||||
{
|
||||
}
|
||||
|
||||
void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget)
|
||||
{
|
||||
QPlatformSoftwareCursor::changeCursor(widgetCursor, widget);
|
||||
if (useVncCursor) {
|
||||
server->setDirtyCursor();
|
||||
} else {
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
void QVNCCursor::setCursorMode(bool vnc)
|
||||
{
|
||||
if (vnc) {
|
||||
setDirty();
|
||||
server->setDirtyCursor();
|
||||
} else {
|
||||
server->setDirtyCursor();
|
||||
}
|
||||
useVncCursor = vnc;
|
||||
}
|
||||
|
||||
QRect QVNCCursor::drawCursor(QPainter & painter)
|
||||
{
|
||||
if (useVncCursor)
|
||||
return QRect();
|
||||
|
||||
return QPlatformSoftwareCursor::drawCursor(painter);
|
||||
}
|
||||
|
||||
void QVNCCursor::clearClientCursor()
|
||||
{
|
||||
QTcpSocket *socket = server->clientSocket();
|
||||
if (!socket) {
|
||||
return;
|
||||
}
|
||||
// FramebufferUpdate header
|
||||
{
|
||||
const quint16 tmp[6] = { htons(0),
|
||||
htons(1),
|
||||
htons(0), htons(0),
|
||||
htons(0),
|
||||
htons(0) };
|
||||
socket->write((char*)tmp, sizeof(tmp));
|
||||
|
||||
const quint32 encoding = htonl(-239);
|
||||
socket->write((char*)(&encoding), sizeof(encoding));
|
||||
}
|
||||
}
|
||||
|
||||
void QVNCCursor::sendClientCursor()
|
||||
{
|
||||
if (useVncCursor == false) {
|
||||
clearClientCursor();
|
||||
return;
|
||||
}
|
||||
QImage *image = graphic->image();
|
||||
if (image->isNull())
|
||||
return;
|
||||
QTcpSocket *socket = server->clientSocket();
|
||||
if (!socket) {
|
||||
return;
|
||||
}
|
||||
// FramebufferUpdate header
|
||||
{
|
||||
const quint16 tmp[6] = { htons(0),
|
||||
htons(1),
|
||||
htons(graphic->hotspot().x()), htons(graphic->hotspot().y()),
|
||||
htons(image->width()),
|
||||
htons(image->height()) };
|
||||
socket->write((char*)tmp, sizeof(tmp));
|
||||
|
||||
const quint32 encoding = htonl(-239);
|
||||
socket->write((char*)(&encoding), sizeof(encoding));
|
||||
}
|
||||
|
||||
// write pixels
|
||||
//Q_ASSERT(cursor->hasAlphaChannel());
|
||||
const QImage img = image->convertToFormat(QImage::Format_RGB32);
|
||||
const int n = server->clientBytesPerPixel() * img.width();
|
||||
char *buffer = new char[n];
|
||||
for (int i = 0; i < img.height(); ++i) {
|
||||
server->convertPixels(buffer, (const char*)img.scanLine(i), img.width());
|
||||
socket->write(buffer, n);
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
// write mask
|
||||
const QImage bitmap = image->createAlphaMask().convertToFormat(QImage::Format_Mono);
|
||||
Q_ASSERT(bitmap.depth() == 1);
|
||||
Q_ASSERT(bitmap.size() == img.size());
|
||||
const int width = (bitmap.width() + 7) / 8;
|
||||
for (int i = 0; i < bitmap.height(); ++i)
|
||||
socket->write((const char*)bitmap.scanLine(i), width);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,76 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QVNCCURSOR_H
|
||||
#define QVNCCURSOR_H
|
||||
|
||||
#include "../fb_base/fb_base.h"
|
||||
#include <QList>
|
||||
#include <QImage>
|
||||
#include <QMouseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVNCScreen;
|
||||
class QVNCServer;
|
||||
|
||||
class QVNCCursor : public QPlatformSoftwareCursor {
|
||||
public:
|
||||
QVNCCursor(QVNCServer *, QVNCScreen *);
|
||||
|
||||
// input methods
|
||||
void setCursorMode(bool vnc);
|
||||
void changeCursor(QCursor * widgetCursor, QWidget * widget);
|
||||
|
||||
// output methods
|
||||
QRect drawCursor(QPainter &);
|
||||
|
||||
// VNC client communication
|
||||
void sendClientCursor();
|
||||
void clearClientCursor();
|
||||
private:
|
||||
bool useVncCursor; // VNC or local
|
||||
|
||||
QVNCServer * server; // VNC server to get events from
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QVNCCURSOR_H
|
@ -1,255 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qvncintegration.h"
|
||||
#include "../fb_base/fb_base.h"
|
||||
#include <private/qapplication_p.h>
|
||||
#include <QtGui/private/qpixmap_raster_p.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
#include <qvncserver.h>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include "qgenericunixfontdatabase.h"
|
||||
|
||||
QVNCScreen::QVNCScreen(QRect screenSize, int screenId)
|
||||
: QFbScreen::QFbScreen()
|
||||
{
|
||||
setGeometry(screenSize);
|
||||
setDepth(32);
|
||||
setFormat(QImage::Format_RGB32);
|
||||
setPhysicalSize((geometry().size()*254)/720);
|
||||
|
||||
|
||||
d_ptr = new QVNCScreenPrivate(this, screenId);
|
||||
|
||||
cursor = new QVNCCursor(d_ptr->vncServer, this);
|
||||
d_ptr->vncServer->setCursor(static_cast<QVNCCursor *>(cursor));
|
||||
}
|
||||
|
||||
QVNCDirtyMap *QVNCScreen::dirtyMap()
|
||||
{
|
||||
return d_ptr->dirty;
|
||||
}
|
||||
|
||||
QRegion QVNCScreen::doRedraw()
|
||||
{
|
||||
QRegion touched;
|
||||
touched = QFbScreen::doRedraw();
|
||||
|
||||
QVector<QRect> rects = touched.rects();
|
||||
for (int i = 0; i < rects.size(); i++)
|
||||
d_ptr->setDirty(rects[i]);
|
||||
return touched;
|
||||
}
|
||||
|
||||
static inline int defaultWidth() { return 800; }
|
||||
static inline int defaultHeight() { return 600; }
|
||||
static inline int defaultDisplay() { return 0; }
|
||||
|
||||
static void usage()
|
||||
{
|
||||
qWarning() << "VNC Platform Integration options:";
|
||||
qWarning() << " size=<Width>x<Height> - set the display width and height";
|
||||
qWarning() << " defaults to" << defaultWidth() << "x" << defaultHeight();
|
||||
qWarning() << " display=<ID> - set the VNC display port to ID + 5900";
|
||||
qWarning() << " defaults to" << defaultDisplay();
|
||||
qWarning() << " offset=<X>x<Y> - set the current screens offset";
|
||||
qWarning() << " vnc - start configuration of a new screen";
|
||||
qWarning() << " size and offset are inherited from the previous screen if not set";
|
||||
qWarning() << " display id is incremented from the previous screen if not set";
|
||||
qWarning() << " virtual - manage the set of screens as a virtual desktop";
|
||||
}
|
||||
|
||||
QVNCIntegration::QVNCIntegration(const QStringList& paramList)
|
||||
: virtualDesktop(false), fontDb(new QGenericUnixFontDatabase())
|
||||
{
|
||||
int sizeX = defaultWidth();
|
||||
int sizeY = defaultHeight();
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
int display = defaultDisplay();
|
||||
bool showUsage = false;
|
||||
|
||||
foreach(QString confString, paramList) {
|
||||
if (confString.startsWith(QLatin1String("size="))) {
|
||||
QString val = confString.section(QLatin1Char('='), 1, 1);
|
||||
sizeX = val.section(QLatin1Char('x'), 0, 0).toInt();
|
||||
sizeY = val.section(QLatin1Char('x'), 1, 1).toInt();
|
||||
}
|
||||
else if (confString.startsWith(QLatin1String("display="))) {
|
||||
display = confString.section(QLatin1Char('='), 1, 1).toInt();
|
||||
}
|
||||
else if (confString.startsWith(QLatin1String("offset="))) {
|
||||
QString val = confString.section(QLatin1Char('='), 1, 1);
|
||||
offsetX = val.section(QLatin1Char('x'), 0, 0).toInt();
|
||||
offsetY = val.section(QLatin1Char('x'), 1, 1).toInt();
|
||||
}
|
||||
else if (confString == QLatin1String("vnc")) {
|
||||
QRect screenRect(offsetX, offsetY, sizeX, sizeY);
|
||||
QVNCScreen *screen = new QVNCScreen(screenRect, display);
|
||||
mScreens.append(screen);
|
||||
screen->setObjectName(QString("screen %1").arg(display));
|
||||
screen->setDirty(screenRect);
|
||||
++display;
|
||||
}
|
||||
else if (confString == QLatin1String("virtual")) {
|
||||
virtualDesktop = true;
|
||||
}
|
||||
else {
|
||||
qWarning() << "Unknown VNC option:" << confString;
|
||||
showUsage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (showUsage)
|
||||
usage();
|
||||
|
||||
QRect screenRect(offsetX, offsetY, sizeX, sizeY);
|
||||
QVNCScreen *screen = new QVNCScreen(screenRect, display);
|
||||
mScreens.append(screen);
|
||||
mPrimaryScreen = qobject_cast<QVNCScreen *>(mScreens.first());
|
||||
screen->setObjectName(QString("screen %1").arg(display));
|
||||
screen->setDirty(screenRect);
|
||||
}
|
||||
|
||||
bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
{
|
||||
switch (cap) {
|
||||
case ThreadedPixmaps: return true;
|
||||
default: return QPlatformIntegration::hasCapability(cap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QPlatformPixmap *QVNCIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
{
|
||||
return new QRasterPlatformPixmap(type);
|
||||
}
|
||||
|
||||
QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const
|
||||
{
|
||||
QFbWindowSurface * surface;
|
||||
surface = new QFbWindowSurface(mPrimaryScreen, widget);
|
||||
return surface;
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const
|
||||
{
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const
|
||||
{
|
||||
QFbWindow *w = new QFbWindow(widget);
|
||||
if (virtualDesktop) {
|
||||
QList<QPlatformScreen *>::const_iterator i = mScreens.constBegin();
|
||||
QList<QPlatformScreen *>::const_iterator end = mScreens.constEnd();
|
||||
QFbScreen *screen;
|
||||
while (i != end) {
|
||||
screen = static_cast<QFbScreen *>(*i);
|
||||
screen->addWindow(w);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
mPrimaryScreen->addWindow(w);
|
||||
return w;
|
||||
}
|
||||
|
||||
QPixmap QVNCIntegration::grabWindow(WId window, int x, int y, int width, int height) const
|
||||
{
|
||||
// qDebug() << "QVNCIntegration::grabWindow" << window << x << y << width << height;
|
||||
|
||||
if (window == 0) { //desktop
|
||||
QImage *desktopImage = mPrimaryScreen->image();
|
||||
if (x==0 && y == 0 && width < 0 && height < 0) {
|
||||
return QPixmap::fromImage(*desktopImage);
|
||||
}
|
||||
if (width < 0)
|
||||
width = desktopImage->width() - x;
|
||||
if (height < 0)
|
||||
height = desktopImage->height() - y;
|
||||
int bytesPerPixel = desktopImage->depth()/8; //We don't support 1, 2, or 4 bpp
|
||||
QImage img(desktopImage->scanLine(y) + bytesPerPixel*x, width, height, desktopImage->bytesPerLine(), desktopImage->format());
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
||||
QWidget *win = QWidget::find(window);
|
||||
if (win) {
|
||||
QRect r = win->geometry();
|
||||
if (width < 0)
|
||||
width = r.width() - x;
|
||||
if (height < 0)
|
||||
height = r.height() - y;
|
||||
QImage *desktopImage = mPrimaryScreen->image();
|
||||
int bytesPerPixel = desktopImage->depth()/8; //We don't support 1, 2, or 4 bpp
|
||||
|
||||
QImage img(desktopImage->scanLine(r.top() + y) + bytesPerPixel*(r.left()+x), width, height, desktopImage->bytesPerLine(), desktopImage->format());
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
|
||||
void QVNCIntegration::moveToScreen(QWidget *window, int screen)
|
||||
{
|
||||
if (virtualDesktop) { // all windows exist on all screens in virtual desktop mode
|
||||
return;
|
||||
}
|
||||
if (screen < 0 || screen > mScreens.size())
|
||||
return;
|
||||
QVNCScreen * newScreen = qobject_cast<QVNCScreen *>(mScreens.at(screen));
|
||||
for(int i = 0; i < mScreens.size(); i++) {
|
||||
QVNCScreen *oldScreen = qobject_cast<QVNCScreen *>(mScreens.at(i));
|
||||
if (oldScreen->windowStack.contains(static_cast<QFbWindow *>(window->platformWindow()))) {
|
||||
oldScreen->removeWindow(static_cast<QFbWindow *>(window->platformWindow()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
window->platformWindow()->setGeometry(window->geometry()); // this should be unified elsewhere
|
||||
newScreen->addWindow(static_cast<QFbWindow *>(window->platformWindow()));
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QVNCIntegration::fontDatabase() const
|
||||
{
|
||||
return fontDb;
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QGRAPHICSSYSTEM_VNC_H
|
||||
#define QGRAPHICSSYSTEM_VNC_H
|
||||
|
||||
#include "qvnccursor.h"
|
||||
#include "../fb_base/fb_base.h"
|
||||
#include <QPlatformIntegration>
|
||||
#include "qgenericunixfontdatabase.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVNCServer;
|
||||
class QVNCDirtyMap;
|
||||
|
||||
class QVNCScreenPrivate;
|
||||
|
||||
class QVNCScreen : public QFbScreen
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVNCScreen(QRect screenSize, int screenId);
|
||||
|
||||
int linestep() const { return image() ? image()->bytesPerLine() : 0; }
|
||||
uchar *base() const { return image() ? image()->bits() : 0; }
|
||||
QVNCDirtyMap *dirtyMap();
|
||||
|
||||
public:
|
||||
QVNCScreenPrivate *d_ptr;
|
||||
|
||||
private:
|
||||
QVNCServer *server;
|
||||
QRegion doRedraw();
|
||||
friend class QVNCIntegration;
|
||||
};
|
||||
|
||||
class QVNCIntegrationPrivate;
|
||||
class QAbstractEventDispatcher;
|
||||
|
||||
class QVNCIntegration : public QPlatformIntegration
|
||||
{
|
||||
public:
|
||||
QVNCIntegration(const QStringList& paramList);
|
||||
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
|
||||
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
|
||||
QAbstractEventDispatcher createEventDispatcher() const;
|
||||
|
||||
QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
|
||||
|
||||
QList<QPlatformScreen *> screens() const { return mScreens; }
|
||||
|
||||
bool isVirtualDesktop() { return virtualDesktop; }
|
||||
void moveToScreen(QWidget *window, int screen);
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
private:
|
||||
QVNCScreen *mPrimaryScreen;
|
||||
QList<QPlatformScreen *> mScreens;
|
||||
bool virtualDesktop;
|
||||
QPlatformFontDatabase *fontDb;
|
||||
};
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QGRAPHICSSYSTEM_VNC_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,533 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QSCREENVNC_P_H
|
||||
#define QSCREENVNC_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from version to version
|
||||
// without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qvncintegration.h"
|
||||
#include "qvnccursor.h"
|
||||
#define QT_NO_QWS_CURSOR
|
||||
|
||||
#ifndef QT_NO_QWS_VNC
|
||||
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
#include <QtCore/qsharedmemory.h>
|
||||
#include <QtNetwork/qtcpsocket.h>
|
||||
#include <QtNetwork/qtcpserver.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVNCServer;
|
||||
|
||||
#ifndef QT_NO_QWS_CURSOR
|
||||
class QVNCCursor : public QProxyScreenCursor
|
||||
{
|
||||
public:
|
||||
QVNCCursor(QVNCScreen *s);
|
||||
~QVNCCursor();
|
||||
|
||||
void hide();
|
||||
void show();
|
||||
void set(const QImage &image, int hotx, int hoty);
|
||||
void move(int x, int y);
|
||||
|
||||
private:
|
||||
void setDirty(const QRect &r) const;
|
||||
QVNCScreen *screen;
|
||||
};
|
||||
|
||||
class QVNCClientCursor : public QProxyScreenCursor
|
||||
{
|
||||
public:
|
||||
QVNCClientCursor(QVNCServer *s);
|
||||
~QVNCClientCursor();
|
||||
|
||||
void set(const QImage &image, int hotx, int hoty);
|
||||
void write() const;
|
||||
|
||||
private:
|
||||
QVNCServer *server;
|
||||
};
|
||||
#endif // QT_NO_QWS_CURSOR
|
||||
|
||||
#define MAP_TILE_SIZE 16
|
||||
#define MAP_WIDTH 1280 / MAP_TILE_SIZE
|
||||
#define MAP_HEIGHT 1024 / MAP_TILE_SIZE
|
||||
|
||||
class QVNCDirtyMap
|
||||
{
|
||||
public:
|
||||
QVNCDirtyMap(QVNCScreen *screen);
|
||||
virtual ~QVNCDirtyMap();
|
||||
|
||||
void reset();
|
||||
bool dirty(int x, int y) const;
|
||||
virtual void setDirty(int x, int y, bool force = false) = 0;
|
||||
void setClean(int x, int y);
|
||||
|
||||
int bytesPerPixel;
|
||||
|
||||
int numDirty;
|
||||
int mapWidth;
|
||||
int mapHeight;
|
||||
|
||||
protected:
|
||||
uchar *map;
|
||||
QVNCScreen *screen;
|
||||
uchar *buffer;
|
||||
int bufferWidth;
|
||||
int bufferHeight;
|
||||
int bufferStride;
|
||||
int numTiles;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class QVNCDirtyMapOptimized : public QVNCDirtyMap
|
||||
{
|
||||
public:
|
||||
QVNCDirtyMapOptimized(QVNCScreen *screen) : QVNCDirtyMap(screen) {}
|
||||
~QVNCDirtyMapOptimized() {}
|
||||
|
||||
void setDirty(int x, int y, bool force = false);
|
||||
};
|
||||
|
||||
class QRfbRect
|
||||
{
|
||||
public:
|
||||
QRfbRect() {}
|
||||
QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) {
|
||||
x = _x; y = _y; w = _w; h = _h;
|
||||
}
|
||||
|
||||
void read(QTcpSocket *s);
|
||||
void write(QTcpSocket *s) const;
|
||||
|
||||
quint16 x;
|
||||
quint16 y;
|
||||
quint16 w;
|
||||
quint16 h;
|
||||
};
|
||||
|
||||
class QRfbPixelFormat
|
||||
{
|
||||
public:
|
||||
static int size() { return 16; }
|
||||
|
||||
void read(QTcpSocket *s);
|
||||
void write(QTcpSocket *s);
|
||||
|
||||
int bitsPerPixel;
|
||||
int depth;
|
||||
bool bigEndian;
|
||||
bool trueColor;
|
||||
int redBits;
|
||||
int greenBits;
|
||||
int blueBits;
|
||||
int redShift;
|
||||
int greenShift;
|
||||
int blueShift;
|
||||
};
|
||||
|
||||
class QRfbServerInit
|
||||
{
|
||||
public:
|
||||
QRfbServerInit() { name = 0; }
|
||||
~QRfbServerInit() { delete[] name; }
|
||||
|
||||
int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); }
|
||||
void setName(const char *n);
|
||||
|
||||
void read(QTcpSocket *s);
|
||||
void write(QTcpSocket *s);
|
||||
|
||||
quint16 width;
|
||||
quint16 height;
|
||||
QRfbPixelFormat format;
|
||||
char *name;
|
||||
};
|
||||
|
||||
class QRfbSetEncodings
|
||||
{
|
||||
public:
|
||||
bool read(QTcpSocket *s);
|
||||
|
||||
quint16 count;
|
||||
};
|
||||
|
||||
class QRfbFrameBufferUpdateRequest
|
||||
{
|
||||
public:
|
||||
bool read(QTcpSocket *s);
|
||||
|
||||
char incremental;
|
||||
QRfbRect rect;
|
||||
};
|
||||
|
||||
class QRfbKeyEvent
|
||||
{
|
||||
public:
|
||||
bool read(QTcpSocket *s);
|
||||
|
||||
char down;
|
||||
int keycode;
|
||||
int unicode;
|
||||
};
|
||||
|
||||
class QRfbPointerEvent
|
||||
{
|
||||
public:
|
||||
bool read(QTcpSocket *s);
|
||||
|
||||
Qt::MouseButtons buttons;
|
||||
enum { WheelNone,
|
||||
WheelUp,
|
||||
WheelDown,
|
||||
WheelLeft,
|
||||
WheelRight
|
||||
} wheelDirection;
|
||||
quint16 x;
|
||||
quint16 y;
|
||||
};
|
||||
|
||||
class QRfbClientCutText
|
||||
{
|
||||
public:
|
||||
bool read(QTcpSocket *s);
|
||||
|
||||
quint32 length;
|
||||
};
|
||||
|
||||
class QVNCScreenPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QVNCScreenPrivate(QVNCScreen *parent, int screenId);
|
||||
~QVNCScreenPrivate();
|
||||
|
||||
void setDirty(const QRect &rect, bool force = false);
|
||||
void configure();
|
||||
|
||||
qreal dpiX;
|
||||
qreal dpiY;
|
||||
bool doOnScreenSurface;
|
||||
QVNCDirtyMap *dirty;
|
||||
int refreshRate;
|
||||
QVNCServer *vncServer;
|
||||
|
||||
#if !defined(QT_NO_SHAREDMEMORY)
|
||||
QSharedMemory shm;
|
||||
#endif
|
||||
|
||||
QVNCScreen *q_ptr;
|
||||
};
|
||||
|
||||
class QRfbEncoder
|
||||
{
|
||||
public:
|
||||
QRfbEncoder(QVNCServer *s) : server(s) {}
|
||||
virtual ~QRfbEncoder() {}
|
||||
|
||||
virtual void write() = 0;
|
||||
|
||||
protected:
|
||||
QVNCServer *server;
|
||||
};
|
||||
|
||||
class QRfbRawEncoder : public QRfbEncoder
|
||||
{
|
||||
public:
|
||||
QRfbRawEncoder(QVNCServer *s) : QRfbEncoder(s) {}
|
||||
|
||||
void write();
|
||||
|
||||
private:
|
||||
QByteArray buffer;
|
||||
};
|
||||
|
||||
template <class SRC> class QRfbHextileEncoder;
|
||||
|
||||
template <class SRC>
|
||||
class QRfbSingleColorHextile
|
||||
{
|
||||
public:
|
||||
QRfbSingleColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
|
||||
bool read(const uchar *data, int width, int height, int stride);
|
||||
void write(QTcpSocket *socket) const;
|
||||
|
||||
private:
|
||||
QRfbHextileEncoder<SRC> *encoder;
|
||||
};
|
||||
|
||||
template <class SRC>
|
||||
class QRfbDualColorHextile
|
||||
{
|
||||
public:
|
||||
QRfbDualColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
|
||||
bool read(const uchar *data, int width, int height, int stride);
|
||||
void write(QTcpSocket *socket) const;
|
||||
|
||||
private:
|
||||
struct Rect {
|
||||
quint8 xy;
|
||||
quint8 wh;
|
||||
} Q_PACKED rects[8 * 16];
|
||||
|
||||
quint8 numRects;
|
||||
QRfbHextileEncoder<SRC> *encoder;
|
||||
|
||||
private:
|
||||
inline int lastx() const { return rectx(numRects); }
|
||||
inline int lasty() const { return recty(numRects); }
|
||||
inline int rectx(int r) const { return rects[r].xy >> 4; }
|
||||
inline int recty(int r) const { return rects[r].xy & 0x0f; }
|
||||
inline int width(int r) const { return (rects[r].wh >> 4) + 1; }
|
||||
inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; }
|
||||
|
||||
inline void setX(int r, int x) {
|
||||
rects[r].xy = (x << 4) | (rects[r].xy & 0x0f);
|
||||
}
|
||||
inline void setY(int r, int y) {
|
||||
rects[r].xy = (rects[r].xy & 0xf0) | y;
|
||||
}
|
||||
inline void setWidth(int r, int width) {
|
||||
rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f);
|
||||
}
|
||||
inline void setHeight(int r, int height) {
|
||||
rects[r].wh = (rects[r].wh & 0xf0) | (height - 1);
|
||||
}
|
||||
|
||||
inline void setWidth(int width) { setWidth(numRects, width); }
|
||||
inline void setHeight(int height) { setHeight(numRects, height); }
|
||||
inline void setX(int x) { setX(numRects, x); }
|
||||
inline void setY(int y) { setY(numRects, y); }
|
||||
void next();
|
||||
};
|
||||
|
||||
template <class SRC>
|
||||
class QRfbMultiColorHextile
|
||||
{
|
||||
public:
|
||||
QRfbMultiColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
|
||||
bool read(const uchar *data, int width, int height, int stride);
|
||||
void write(QTcpSocket *socket) const;
|
||||
|
||||
private:
|
||||
inline quint8* rect(int r) {
|
||||
return rects.data() + r * (bpp + 2);
|
||||
}
|
||||
inline const quint8* rect(int r) const {
|
||||
return rects.constData() + r * (bpp + 2);
|
||||
}
|
||||
inline void setX(int r, int x) {
|
||||
quint8 *ptr = rect(r) + bpp;
|
||||
*ptr = (x << 4) | (*ptr & 0x0f);
|
||||
}
|
||||
inline void setY(int r, int y) {
|
||||
quint8 *ptr = rect(r) + bpp;
|
||||
*ptr = (*ptr & 0xf0) | y;
|
||||
}
|
||||
void setColor(SRC color);
|
||||
inline int rectx(int r) const {
|
||||
const quint8 *ptr = rect(r) + bpp;
|
||||
return *ptr >> 4;
|
||||
}
|
||||
inline int recty(int r) const {
|
||||
const quint8 *ptr = rect(r) + bpp;
|
||||
return *ptr & 0x0f;
|
||||
}
|
||||
inline void setWidth(int r, int width) {
|
||||
quint8 *ptr = rect(r) + bpp + 1;
|
||||
*ptr = ((width - 1) << 4) | (*ptr & 0x0f);
|
||||
}
|
||||
inline void setHeight(int r, int height) {
|
||||
quint8 *ptr = rect(r) + bpp + 1;
|
||||
*ptr = (*ptr & 0xf0) | (height - 1);
|
||||
}
|
||||
|
||||
bool beginRect();
|
||||
void endRect();
|
||||
|
||||
static const int maxRectsSize = 16 * 16;
|
||||
QVarLengthArray<quint8, maxRectsSize> rects;
|
||||
|
||||
quint8 bpp;
|
||||
quint8 numRects;
|
||||
QRfbHextileEncoder<SRC> *encoder;
|
||||
};
|
||||
|
||||
template <class SRC>
|
||||
class QRfbHextileEncoder : public QRfbEncoder
|
||||
{
|
||||
public:
|
||||
QRfbHextileEncoder(QVNCServer *s);
|
||||
void write();
|
||||
|
||||
private:
|
||||
enum SubEncoding {
|
||||
Raw = 1,
|
||||
BackgroundSpecified = 2,
|
||||
ForegroundSpecified = 4,
|
||||
AnySubrects = 8,
|
||||
SubrectsColoured = 16
|
||||
};
|
||||
|
||||
QByteArray buffer;
|
||||
QRfbSingleColorHextile<SRC> singleColorHextile;
|
||||
QRfbDualColorHextile<SRC> dualColorHextile;
|
||||
QRfbMultiColorHextile<SRC> multiColorHextile;
|
||||
|
||||
SRC bg;
|
||||
SRC fg;
|
||||
bool newBg;
|
||||
bool newFg;
|
||||
|
||||
friend class QRfbSingleColorHextile<SRC>;
|
||||
friend class QRfbDualColorHextile<SRC>;
|
||||
friend class QRfbMultiColorHextile<SRC>;
|
||||
};
|
||||
|
||||
class QVNCServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVNCServer(QVNCScreen *screen);
|
||||
QVNCServer(QVNCScreen *screen, int id);
|
||||
~QVNCServer();
|
||||
|
||||
void setDirty();
|
||||
void setDirtyCursor() { dirtyCursor = true; setDirty(); }
|
||||
inline bool isConnected() const { return state == Connected; }
|
||||
inline void setRefreshRate(int rate) { refreshRate = rate; }
|
||||
|
||||
enum ClientMsg { SetPixelFormat = 0,
|
||||
FixColourMapEntries = 1,
|
||||
SetEncodings = 2,
|
||||
FramebufferUpdateRequest = 3,
|
||||
KeyEvent = 4,
|
||||
PointerEvent = 5,
|
||||
ClientCutText = 6 };
|
||||
|
||||
enum ServerMsg { FramebufferUpdate = 0,
|
||||
SetColourMapEntries = 1 };
|
||||
|
||||
void convertPixels(char *dst, const char *src, int count) const;
|
||||
|
||||
inline int clientBytesPerPixel() const {
|
||||
return pixelFormat.bitsPerPixel / 8;
|
||||
}
|
||||
|
||||
inline QVNCScreen* screen() const { return qvnc_screen; }
|
||||
inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); }
|
||||
inline QTcpSocket* clientSocket() const { return client; }
|
||||
QImage *screenImage() const;
|
||||
inline bool doPixelConversion() const { return needConversion; }
|
||||
#ifndef QT_NO_QWS_CURSOR
|
||||
inline bool hasClientCursor() const { return qvnc_cursor != 0; }
|
||||
#endif
|
||||
|
||||
void setCursor(QVNCCursor * c) { cursor = c; }
|
||||
private:
|
||||
void setPixelFormat();
|
||||
void setEncodings();
|
||||
void frameBufferUpdateRequest();
|
||||
void pointerEvent();
|
||||
void keyEvent();
|
||||
void clientCutText();
|
||||
bool pixelConversionNeeded() const;
|
||||
|
||||
private slots:
|
||||
void newConnection();
|
||||
void readClient();
|
||||
void checkUpdate();
|
||||
void discardClient();
|
||||
|
||||
private:
|
||||
void init(uint port);
|
||||
enum ClientState { Unconnected, Protocol, Init, Connected };
|
||||
QTimer *timer;
|
||||
QTcpServer *serverSocket;
|
||||
QTcpSocket *client;
|
||||
ClientState state;
|
||||
quint8 msgType;
|
||||
bool handleMsg;
|
||||
QRfbPixelFormat pixelFormat;
|
||||
Qt::KeyboardModifiers keymod;
|
||||
Qt::MouseButtons buttons;
|
||||
int encodingsPending;
|
||||
int cutTextPending;
|
||||
uint supportCopyRect : 1;
|
||||
uint supportRRE : 1;
|
||||
uint supportCoRRE : 1;
|
||||
uint supportHextile : 1;
|
||||
uint supportZRLE : 1;
|
||||
uint supportCursor : 1;
|
||||
uint supportDesktopSize : 1;
|
||||
bool wantUpdate;
|
||||
bool sameEndian;
|
||||
bool needConversion;
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
bool swapBytes;
|
||||
#endif
|
||||
bool dirtyCursor;
|
||||
int refreshRate;
|
||||
QVNCScreen *qvnc_screen;
|
||||
#ifndef QT_NO_QWS_CURSOR
|
||||
QVNCClientCursor *qvnc_cursor;
|
||||
#endif
|
||||
|
||||
QRfbEncoder *encoder;
|
||||
QVNCCursor *cursor;
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_QWS_VNC
|
||||
#endif // QSCREENVNC_P_H
|
@ -1,22 +0,0 @@
|
||||
TARGET = qvncgraphicssystem
|
||||
load(qt_plugin)
|
||||
|
||||
QT += network core-private gui-private platformsupport-private
|
||||
|
||||
DESTDIR = $$QT.gui.plugins/platforms
|
||||
|
||||
SOURCES = main.cpp qvncintegration.cpp
|
||||
HEADERS = qvncintegration.h
|
||||
|
||||
HEADERS += qvncserver.h
|
||||
SOURCES += qvncserver.cpp
|
||||
|
||||
HEADERS += qvnccursor.h
|
||||
SOURCES += qvnccursor.cpp
|
||||
|
||||
include(../fb_base/fb_base.pri)
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||
|
||||
INSTALLS += target
|
@ -18,7 +18,6 @@ SUBDIRS=\
|
||||
qaccessibility \
|
||||
qcomplextext \
|
||||
qfocusevent \
|
||||
qmultiscreen \
|
||||
qnetworkaccessmanager_and_qprogressdialog \
|
||||
qobjectperformance \
|
||||
qobjectrace \
|
||||
@ -40,8 +39,7 @@ wince*|!contains(QT_CONFIG, accessibility):SUBDIRS -= qaccessibility
|
||||
macplist
|
||||
|
||||
!embedded|wince*: SUBDIRS -= \
|
||||
qdirectpainter \
|
||||
qmultiscreen \
|
||||
qdirectpainter
|
||||
|
||||
!linux*-g++*:SUBDIRS -= exceptionsafety_objects
|
||||
|
||||
|
1
tests/auto/other/qmultiscreen/.gitignore
vendored
1
tests/auto/other/qmultiscreen/.gitignore
vendored
@ -1 +0,0 @@
|
||||
tst_qmultiscreen
|
@ -1,7 +0,0 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qmultiscreen
|
||||
QT += widgets testlib
|
||||
SOURCES += tst_qmultiscreen.cpp
|
||||
|
||||
requires(embedded)
|
||||
|
@ -1,163 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qscreen_qws.h>
|
||||
#include <qscreendriverfactory_qws.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
class tst_QMultiScreen : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QMultiScreen() : screen(0), oldScreen(0) {}
|
||||
~tst_QMultiScreen() {}
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void widgetSetFixedSize();
|
||||
void grabWindow();
|
||||
|
||||
private:
|
||||
QScreen *screen;
|
||||
QScreen *oldScreen;
|
||||
};
|
||||
|
||||
void tst_QMultiScreen::cleanupTestCase()
|
||||
{
|
||||
screen->shutdownDevice();
|
||||
screen->disconnect();
|
||||
delete screen;
|
||||
screen = 0;
|
||||
|
||||
qt_screen = oldScreen;
|
||||
}
|
||||
|
||||
void tst_QMultiScreen::initTestCase()
|
||||
{
|
||||
oldScreen = qt_screen;
|
||||
|
||||
QVERIFY(QScreenDriverFactory::keys().contains(QLatin1String("Multi")));
|
||||
QVERIFY(QScreenDriverFactory::keys().contains(QLatin1String("VNC")));
|
||||
|
||||
const int id = 10;
|
||||
screen = QScreenDriverFactory::create("Multi", id);
|
||||
QVERIFY(screen);
|
||||
QVERIFY(screen->connect(QString("Multi: "
|
||||
"VNC:size=640x480:depth=32:offset=0,0:%1 "
|
||||
"VNC:size=640x480:depth=32:offset=640,0:%2 "
|
||||
"VNC:size=640x480:depth=16:offset=0,480:%3 "
|
||||
":%4")
|
||||
.arg(id+1).arg(id+2).arg(id+3).arg(id)));
|
||||
QVERIFY(screen->initDevice());
|
||||
|
||||
QDesktopWidget desktop;
|
||||
QCOMPARE(desktop.numScreens(), 3);
|
||||
}
|
||||
|
||||
void tst_QMultiScreen::widgetSetFixedSize()
|
||||
{
|
||||
QDesktopWidget desktop;
|
||||
QRect maxRect;
|
||||
for (int i = 0; i < desktop.numScreens(); ++i)
|
||||
maxRect |= desktop.availableGeometry(i);
|
||||
|
||||
maxRect = maxRect.adjusted(50, 50, -50, -50);
|
||||
|
||||
// make sure we can set a size larger than a single screen (task 166368)
|
||||
QWidget w;
|
||||
w.setFixedSize(maxRect.size());
|
||||
w.show();
|
||||
QApplication::processEvents();
|
||||
QCOMPARE(w.geometry().size(), maxRect.size());
|
||||
}
|
||||
|
||||
void tst_QMultiScreen::grabWindow()
|
||||
{
|
||||
QDesktopWidget desktop;
|
||||
|
||||
QVERIFY(desktop.numScreens() >= 2);
|
||||
|
||||
const QRect r0 = desktop.availableGeometry(0).adjusted(50, 50, -50, -50);
|
||||
const QRect r1 = desktop.availableGeometry(1).adjusted(60, 60, -60, -60);
|
||||
|
||||
QWidget w;
|
||||
w.setGeometry(r0);
|
||||
w.show();
|
||||
|
||||
QLabel l("hi there");
|
||||
l.setGeometry(r1);
|
||||
l.show();
|
||||
|
||||
QApplication::processEvents();
|
||||
QApplication::sendPostedEvents(); // workaround for glib event loop
|
||||
QVERIFY(desktop.screenNumber(&w) == 0);
|
||||
QVERIFY(desktop.screenNumber(&l) == 1);
|
||||
|
||||
const QPixmap p0 = QPixmap::grabWindow(w.winId());
|
||||
const QPixmap p1 = QPixmap::grabWindow(l.winId());
|
||||
|
||||
// p0.save("w.png", "PNG");
|
||||
// p1.save("l.png", "PNG");
|
||||
QCOMPARE(p0.size(), w.size());
|
||||
QCOMPARE(p1.size(), l.size());
|
||||
|
||||
const QImage img0 = p0.toImage();
|
||||
const QImage img1 = p1.toImage();
|
||||
|
||||
// QPixmap::grabWidget(&w).toImage().convertToFormat(img0.format()).save("w_img.png", "PNG");
|
||||
// QPixmap::grabWidget(&l).toImage().convertToFormat(img1.format()).save("l_img.png", "PNG");
|
||||
|
||||
QImage::Format format = QImage::Format_RGB16;
|
||||
QCOMPARE(img0.convertToFormat(format),
|
||||
QPixmap::grabWidget(&w).toImage().convertToFormat(format));
|
||||
QCOMPARE(img1.convertToFormat(format),
|
||||
QPixmap::grabWidget(&l).toImage().convertToFormat(format));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QMultiScreen)
|
||||
|
||||
#include "tst_qmultiscreen.moc"
|
@ -1381,7 +1381,7 @@ void Configure::applySpecSpecifics()
|
||||
dictionary[ "STYLE_WINDOWSXP" ] = "no";
|
||||
dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
|
||||
dictionary[ "KBD_DRIVERS" ] = "tty";
|
||||
dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc";
|
||||
dictionary[ "GFX_DRIVERS" ] = "linuxfb";
|
||||
dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
|
||||
dictionary[ "OPENGL" ] = "no";
|
||||
dictionary[ "EXCEPTIONS" ] = "no";
|
||||
@ -2860,7 +2860,7 @@ void Configure::generateConfigfiles()
|
||||
|
||||
QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
|
||||
QStringList allGfxDrivers;
|
||||
allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
|
||||
allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"multiscreen"<<"ahi";
|
||||
foreach (const QString &gfx, allGfxDrivers) {
|
||||
if (!gfxDrivers.contains(gfx))
|
||||
tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
|
||||
|
Loading…
Reference in New Issue
Block a user