presencevnc (0.3) unstable; urgency=low
* Compatibility fix for RealVNC Personal/Enterprise
+ * Fix crash on exit
+ * Add option to disable tapping
-- Christian Pulvermacher <pulvermacher@gmx.de> Tue, 03 Aug 2010 18:35:57 +0200
#currently builds a maemo-only package
#comment this line for quick builds
-#buildlibs=foo
+buildlibs=foo
SOURCEDIR=./
BUILDDIR=debian/build/
dh_testroot
dh_installdocs
dh_installchangelogs
- #dh_strip
+ dh_strip
dh_compress
dh_fixperms
dh_installdeb
configure:26995: result: yes
configure:27002: checking for _doprnt
configure:27059: gcc -o conftest -g -O2 conftest.c -lpthread -lz -ljpeg >&5
-/tmp/cc6wOTSk.o: In function `main':
+/tmp/ccUTRY7o.o: In function `main':
/home/christian/presencevnc/libvnc/conftest.c:91: undefined reference to `_doprnt'
-/tmp/cc6wOTSk.o:(.data+0x0): undefined reference to `_doprnt'
+/tmp/ccUTRY7o.o:(.data+0x0): undefined reference to `_doprnt'
collect2: ld returned 1 exit status
configure:27065: $? = 1
configure: failed program was:
#endif
- /*
if (client->sock >= 0)
close(client->sock);
- */
+
free(client->desktopName);
free(client->serverHost);
free(client);
{
setWindowTitle("Presence VNC");
setAttribute(Qt::WA_Maemo5StackedWindow);
+
+ migrateConfiguration();
+
QSettings settings;
//set up toolbar
QMenuBar *menu = new QMenuBar(this);
QAction *connect_action = new QAction("Connect", this);
disconnect_action = new QAction("Disconnect", this);
-// menu->addAction(connect_action);
-// menu->addAction(disconnect_action);
+ menu->addAction(connect_action);
+ menu->addAction(disconnect_action);
scaling = new QAction("Fit to Screen", this);
scaling->setCheckable(true);
scaling->setChecked(settings.value("rescale", true).toBool());
vnc_view->start();
vnc_view->enableScaling(scaling->isChecked());
}
-
- if(!vnc_view) //not connected
- QTimer::singleShot(100, this, SLOT(close()));
}
void MainWindow::grabZoomKeys(bool grab)
disconnectFromHost();
vnc_view = new VncView(this, url, RemoteView::Quality(2)); //TODO: get quality in dialog
- scroll_area->setWidget(vnc_view);
connect(scaling, SIGNAL(toggled(bool)),
vnc_view, SLOT(enableScaling(bool)));
connect(vnc_view, SIGNAL(statusChanged(RemoteView::RemoteStatus)),
this, SLOT(statusChanged(RemoteView::RemoteStatus)));
+ scroll_area->setWidget(vnc_view);
vnc_view->start();
vnc_view->enableScaling(scaling->isChecked());
disconnect_action->setEnabled(true);
if(!vnc_view)
return;
-// vnc_view->startQuitting();
scroll_area->setWidget(0);
vnc_view->disconnect(); //remove all signal-slot connections
break;
case RemoteView::Connected:
setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
+ if(!scaling->isChecked()) {
+ //if remote desktop is shown in full size, 2nd connection will have black screen
+ //ugly hack to force a refresh (forceFullRepaint() doesn't repaint?? -> vnc_view hidden???)
+ vnc_view->resize(scroll_area->size());
+ vnc_view->enableScaling(false);
+ }
break;
case RemoteView::Disconnecting:
if(old_status != RemoteView::Disconnected) { //Disconnecting also occurs while connecting, so check last state
QMaemo5InformationBox::information(this, "Connection lost");
- close();
+
+ //clean up
+ scroll_area->setWidget(0);
+ vnc_view = 0;
+ disconnect_action->setEnabled(false);
+ toolbar->setEnabled(false);
+
+ //exit fullscreen mode
+ if(windowState() & Qt::WindowFullScreen)
+ setWindowState(windowState() ^ Qt::WindowFullScreen);
}
break;
case RemoteView::Disconnected:
#include "preferences.h"
+#include <iostream>
+
+void migrateConfiguration()
+{
+ QSettings settings;
+ int config_ver = settings.value("config_version", 0).toInt();
+ if(config_ver == 1) //config file up-to-date
+ return;
+
+ std::cout << "Migrating from configuration ver. " << config_ver << "\n";
+
+ if(config_ver == 0) {
+ int left_zoom = settings.value("left_zoom", 0).toInt();
+ int right_zoom = settings.value("left_zoom", 0).toInt();
+ if(left_zoom >= 2)
+ settings.setValue("left_zoom", left_zoom+1);
+ if(right_zoom >= 2)
+ settings.setValue("left_zoom", right_zoom+1);
+ config_ver = 1;
+ }
+ settings.setValue("config_version", config_ver);
+ settings.sync();
+}
+
+
Preferences::Preferences(QWidget *parent):
QDialog(parent)
{
QMaemo5ValueButton *leftzoom = new QMaemo5ValueButton(tr("Left Zoom Button"), this);
leftzoom_selector = new QMaemo5ListPickSelector(this);
QStandardItemModel *key_model = new QStandardItemModel(0, 1, this);
- key_model->appendRow(new QStandardItem(tr("Left Click"))); //0
- key_model->appendRow(new QStandardItem(tr("Right Click")));//1
- key_model->appendRow(new QStandardItem(tr("Wheel Up")));//2
- key_model->appendRow(new QStandardItem(tr("Wheel Down")));//3
- key_model->appendRow(new QStandardItem(tr("Page Up")));//4
- key_model->appendRow(new QStandardItem(tr("Page Down")));//5
+ key_model->insertRow(0, new QStandardItem(tr("Left Click")));
+ key_model->insertRow(1, new QStandardItem(tr("Right Click")));
+ key_model->insertRow(2, new QStandardItem(tr("Middle Click")));
+ key_model->insertRow(3, new QStandardItem(tr("Wheel Up")));
+ key_model->insertRow(4, new QStandardItem(tr("Wheel Down")));
+ key_model->insertRow(5, new QStandardItem(tr("Page Up")));
+ key_model->insertRow(6, new QStandardItem(tr("Page Down")));
leftzoom_selector->setModel(key_model);
leftzoom_selector->setCurrentIndex(settings.value("left_zoom", 0).toInt());
leftzoom->setPickSelector(leftzoom_selector);
rightzoom->setValueLayout(QMaemo5ValueButton::ValueBesideText);
layout2->addWidget(rightzoom);
+ disable_tapping = new QCheckBox(tr("Disable Tapping"), this);
+ disable_tapping->setChecked(settings.value("disable_tapping", false).toBool());
+ layout2->addWidget(disable_tapping);
+
QPushButton *ok = new QPushButton("OK");
ok->setMaximumWidth(100);
settings.setValue("screen_rotation", rotation_selector->currentIndex());
settings.setValue("left_zoom", leftzoom_selector->currentIndex());
settings.setValue("right_zoom", rightzoom_selector->currentIndex());
+ settings.setValue("disable_tapping", disable_tapping->isChecked());
settings.sync();
}
class QMaemo5ListPickSelector;
+void migrateConfiguration(); //checks for old configuration and migrates them if necessary
+
class Preferences : public QDialog {
Q_OBJECT
public:
QMaemo5ListPickSelector *rotation_selector;
QMaemo5ListPickSelector *leftzoom_selector;
QMaemo5ListPickSelector *rightzoom_selector;
+ QCheckBox *disable_tapping;
};
#endif
QCursor RemoteView::localDotCursor() const
{
#ifdef QTONLY
- return QCursor(); //TODO
+const uchar bits[] =
+{ 0xffffffff, 0xffffffff, 0xffffffff,
+ 0xffffffff, 0xff000000, 0xffffffff,
+ 0xffffffff, 0xffffffff, 0xffffffff };
+
+ QBitmap cursorBitmap = QBitmap::fromData(QSize(3,3), bits , QImage::Format_RGB32);
+ QBitmap cursorMask(QSize(3,3));
+ cursorMask.clear();
+
+ return QCursor(cursorBitmap, cursorMask);
+ //return QCursor(); //TODO
#else
QBitmap cursorBitmap(KGlobal::dirs()->findResource("appdata",
"pics/pointcursor.png"));
// Disconnect all signals so that we don't get any more callbacks from the client thread
vncThread.disconnect();
- /*
- disconnect(&vncThread, SIGNAL(imageUpdated(int, int, int, int)), this, SLOT(updateImage(int, int, int, int)));
- disconnect(&vncThread, SIGNAL(gotCut(const QString&)), this, SLOT(setCut(const QString&)));
- disconnect(&vncThread, SIGNAL(passwordRequest()), this, SLOT(requestPassword()));
- disconnect(&vncThread, SIGNAL(outputErrorMessage(QString)), this, SLOT(outputErrorMessage(QString)));
- */
startQuitting();
}
void VncView::forceFullRepaint()
{
+ kDebug(5011) << "forceFullRepaint()";
force_full_repaint = true;
repaint();
}
}
}
-void VncView::updateConfiguration()
-{
- RemoteView::updateConfiguration();
-
- // Update the scaling mode in case KeepAspectRatio changed
- if(parentWidget())
- scaleResize(parentWidget()->width(), parentWidget()->height());
- else
- scaleResize(width(), height());
-}
void VncView::startQuitting()
{
void VncView::paintEvent(QPaintEvent *event)
{
-// kDebug(5011) << "paint event: x: " << m_x << ", y: " << m_y << ", w: " << m_w << ", h: " << m_h;
+ //kDebug(5011) << "paint event: x: " << m_x << ", y: " << m_y << ", w: " << m_w << ", h: " << m_h;
if (m_frame.isNull() || m_frame.format() == QImage::Format_Invalid) {
kDebug(5011) << "no valid image to paint";
RemoteView::paintEvent(event);
QPainter painter(this);
- if (m_repaint) {
+ if (m_repaint and !force_full_repaint) {
// kDebug(5011) << "normal repaint";
painter.drawImage(QRect(qRound(m_x*m_horizontalFactor), qRound(m_y*m_verticalFactor),
qRound(m_w*m_horizontalFactor), qRound(m_h*m_verticalFactor)),
}
}
-
+//call with e == 0 to flush held events
void VncView::mouseEventHandler(QMouseEvent *e)
{
static bool tap_detected = false;
cursor_y = qRound(e->y()/m_verticalFactor);
vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask); // plain move event
+ if(disable_tapping) { //only move cursor
+ e->ignore();
+ return;
+ }
+
if(e->type() == QEvent::MouseButtonPress or e->type() == QEvent::MouseButtonDblClick) {
press_time.start();
if(tap_detected and up_time.elapsed() < DOUBLE_TAP_UP_TIME) {
else
m_buttonMask &= 0xfb;
vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
- } else if(current_zoom == 2 and pressed) { //wheel up
+ } else if(current_zoom == 2) { //middle click
+ if(pressed)
+ m_buttonMask |= 0x02;
+ else
+ m_buttonMask &= 0xfd;
+ vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
+ } else if(current_zoom == 3 and pressed) { //wheel up
int eb = 0x8;
vncThread.mouseEvent(cursor_x, cursor_y, eb | m_buttonMask);
vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
- } else if(current_zoom == 3 and pressed) { //wheel down
+ } else if(current_zoom == 4 and pressed) { //wheel down
int eb = 0x10;
vncThread.mouseEvent(cursor_x, cursor_y, eb | m_buttonMask);
vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
- } else if(current_zoom == 4) { //page up
+ } else if(current_zoom == 5) { //page up
vncThread.keyEvent(0xff55, pressed);
- } else if(current_zoom == 5) { //page down
+ } else if(current_zoom == 6) { //page down
vncThread.keyEvent(0xff56, pressed);
}
}
QSettings settings;
left_zoom = settings.value("left_zoom", 0).toInt();
right_zoom = settings.value("right_zoom", 1).toInt();
+ disable_tapping = settings.value("disable_tapping", false).toBool();
}
#include "moc_vncview.cpp"
void showDotCursor(DotCursorState state);
void sendKey(Qt::Key key);
- virtual void updateConfiguration();
-
public slots:
void enableScaling(bool scale);
void scaleResize(int w, int h);
bool force_full_repaint;
RemoteView::Quality quality;
int left_zoom, right_zoom;
+ bool disable_tapping;
void keyEventHandler(QKeyEvent *e);
void unpressModifiers();
LIBS += -Llibvnc/libvncclient/.libs -lvncclient
DEFINES += QTONLY
QT += maemo5
-CONFIG += silent debug
+CONFIG += silent release
OBJECTS_DIR = $${PWD}/tmp
MOC_DIR = $${PWD}/tmp