summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfbcanvas.cpp
Side-by-side diff
Diffstat (limited to 'noncore/comm/keypebble/krfbcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbcanvas.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp
index 918ce8b..049bbd4 100644
--- a/noncore/comm/keypebble/krfbcanvas.cpp
+++ b/noncore/comm/keypebble/krfbcanvas.cpp
@@ -1,41 +1,45 @@
#include "krfbconnection.h"
#include "krfbcanvas.h"
#include "krfbserver.h"
#include "krfbbuffer.h"
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <qaction.h>
#include <qpixmap.h>
+#include <qpoint.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <qiconset.h>
KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name )
: QScrollView( parent, name )
{
connection_ = new KRFBConnection();
connect( connection_, SIGNAL( loggedIn() ),
this, SLOT( loggedIn() ) );
loggedIn_ = false;
//QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold);
viewport()->setFocusPolicy( QWidget::StrongFocus );
viewport()->setFocus();
+
+ nextRightClick=0;
+ nextDoubleClick=0;
}
KRFBCanvas::~KRFBCanvas()
{
}
void KRFBCanvas::openConnection(KRFBServer server)
{
QCString host = server.hostname.latin1();
@@ -115,34 +119,55 @@ void KRFBCanvas::viewportPaintEvent( QPaintEvent *e )
else {
QScrollView::viewportPaintEvent( e );
}
}
void KRFBCanvas::viewportUpdate( int x, int y, int w, int h )
{
updateContents( x, y, w, h );
}
void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e )
{
- if ( loggedIn_ )
+
+ if (nextDoubleClick) {
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0));
+ } if (nextRightClick) {
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton));
+ connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0));
+ } else if ( loggedIn_ )
connection_->buffer()->mouseEvent( e );
+
+ qDebug("Press");
+ qDebug(QString::number(e->type()==QEvent::MouseButtonPress));
}
void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e )
{
- if ( loggedIn_ )
+ if ( loggedIn_ && !nextRightClick && !nextDoubleClick) {
connection_->buffer()->mouseEvent( e );
}
+ nextRightClick=0;
+ nextDoubleClick=0;
+ qDebug("Release");
+ qDebug(QString::number(e->button()));
+}
+
void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e )
{
if ( loggedIn_ )
connection_->buffer()->mouseEvent( e );
}
void KRFBCanvas::keyPressEvent( QKeyEvent *e )
{
if ( loggedIn_ )
connection_->buffer()->keyPressEvent( e );
}
@@ -158,22 +183,31 @@ void KRFBCanvas::refresh()
connection_->refresh();
}
void KRFBCanvas::clipboardChanged()
{
if ( loggedIn_ ) {
connection_->sendCutText( qApp->clipboard()->text() );
}
}
void KRFBCanvas::sendCtlAltDel( void)
{
- qDebug("Here");
if ( loggedIn_ ) {
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Control, 0,0));
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Alt, 0,0));
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyPress,Qt::Key_Delete, 0,0));
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Control, 0,0));
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Alt, 0,0));
connection_->buffer()->keyPressEvent( &QKeyEvent(QEvent::KeyRelease,Qt::Key_Delete, 0,0));
}
}
+
+void KRFBCanvas::markDoubleClick( void)
+{
+ nextRightClick=1;
+}
+
+void KRFBCanvas::markRightClick( void)
+{
+ nextRightClick=1;
+}