summaryrefslogtreecommitdiffstats
path: root/src/client/vnc/vncwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/vnc/vncwindow.cpp')
-rw-r--r--src/client/vnc/vncwindow.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp
index 3ad75e8..4976bbd 100644
--- a/src/client/vnc/vncwindow.cpp
+++ b/src/client/vnc/vncwindow.cpp
@@ -22,7 +22,8 @@
#include <QTimer>
VncWindow::VncWindow(QWidget *parent) :
- QWidget(parent), _vncWorker(NULL), _viewOnly(true), _multiScreen(false), _clientId(0), _redrawTimer(0), _tcpTimeoutTimer(0)
+ QWidget(parent), _vncWorker(NULL), _viewOnly(true), _multiScreen(false), _clientId(0), _redrawTimer(0), _tcpTimeoutTimer(0),
+ _image(new QImage)
{
QTimer *upper = new QTimer(this);
connect(upper, SIGNAL(timeout()), this, SLOT(timer_moveToTop()));
@@ -85,7 +86,7 @@ void VncWindow::draw(const int x, const int y, const int w, const int h)
if (_vncWorker == NULL)
return;
QPainter painter(this);
- painter.drawImage(x, y, _vncWorker->getImage(), x, y, w, h);
+ painter.drawImage(x, y, *_image, x, y, w, h);
//painter.drawRect(x,y,w,h); // for debugging updated area
}
@@ -125,7 +126,7 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
QSize size;
if (fullscreen) {
- setWindowFlags(Qt::WindowStaysOnTopHint); // | Qt::X11BypassWindowManagerHint); <- better, but window won't get any keyboard input
+ setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool); // | Qt::X11BypassWindowManagerHint); <- better, but window won't get any keyboard input
// Show projection on rightmost screen
QDesktopWidget *desktop = QApplication::desktop();
int ns = desktop->numScreens();
@@ -137,9 +138,11 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
}
}
_multiScreen = ns > 1;
+ qDebug() << "Spawning at" << best;
size = best.size();
setGeometry(best);
- showFullScreen();
+ move(best.topLeft());
+ //showFullScreen();
activateWindow();
raise();
} else {
@@ -150,7 +153,7 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool
this->repaint();
this->show();
- _vncWorker->setTargetSize(size);
+ _vncWorker->setTargetBuffer(_image);
_tcpTimeoutTimer = startTimer(10000);
_vncWorker->start(QThread::LowPriority);
@@ -204,8 +207,7 @@ void VncWindow::onProjectionStarted()
_tcpTimeoutTimer = 0;
}
emit running(true, _clientId);
- _redrawTimer = startTimer(3000);
- _vncWorker->setTargetSize(this->size());
+ _redrawTimer = startTimer(500);
}
/**
@@ -246,8 +248,7 @@ void VncWindow::timerEvent(QTimerEvent *event)
if (event->timerId() == _redrawTimer) {
killTimer(_redrawTimer);
_redrawTimer = 0;
- if (this->isVisible())
- this->repaint();
+ this->update();
} else if (event->timerId() == _tcpTimeoutTimer) {
killTimer(_tcpTimeoutTimer);
_tcpTimeoutTimer = 0;
@@ -293,10 +294,13 @@ void VncWindow::paintEvent(QPaintEvent *event)
*/
void VncWindow::resizeEvent(QResizeEvent* event)
{
+ const QSize size = event->size();
+ if (size != _image->size()) {
+ _image = QSharedPointer<QImage>(new QImage(size, QImage::Format_RGB32));
+ }
if (_vncWorker != NULL) {
- _vncWorker->setTargetSize(event->size());
+ _vncWorker->setTargetBuffer(_image);
}
- this->repaint();
}
/**
@@ -304,7 +308,7 @@ void VncWindow::resizeEvent(QResizeEvent* event)
*/
void VncWindow::keyReleaseEvent(QKeyEvent* event)
{
- if (event->modifiers() == 0 && event->key() == Qt::Key_Escape && !clientApp->isConnectedToLocalManager()) {
+ if (event->modifiers() == 0 && event->key() == Qt::Key_Escape && clientApp->isConnectedToLocalManager()) {
this->close();
} else {
QWidget::keyReleaseEvent(event);