From 778523ca7ccd76ce0d4266d9f93888adf2e392f1 Mon Sep 17 00:00:00 2001 From: Christian Pulvermacher Date: Mon, 13 Sep 2010 01:35:45 +0200 Subject: [PATCH] draw local cursor ourselves --- src/remoteview.cpp | 17 ++--------------- src/vncview.cpp | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/remoteview.cpp b/src/remoteview.cpp index f8b9474..91aeffe 100644 --- a/src/remoteview.cpp +++ b/src/remoteview.cpp @@ -244,21 +244,8 @@ void RemoteView::saveWalletPassword(const QString &password, bool fromUserNameOn QCursor RemoteView::localDotCursor() const { -#ifdef QTONLY -const uchar bits[] = -{ 0xff, 0x8e, 0x8e, 0x8e, 0xff }; - - QBitmap cursorBitmap = QBitmap::fromData(QSize(5,5), bits , QImage::Format_Mono); - QBitmap cursorMask = cursorBitmap; - - return QCursor(cursorBitmap, cursorMask); -#else - QBitmap cursorBitmap(KGlobal::dirs()->findResource("appdata", - "pics/pointcursor.png")); - QBitmap cursorMask(KGlobal::dirs()->findResource("appdata", - "pics/pointcursormask.png")); - return QCursor(cursorBitmap, cursorMask); -#endif + //we take care of this in paintEvent() + return QCursor(Qt::BlankCursor); } void RemoteView::focusInEvent(QFocusEvent *event) diff --git a/src/vncview.cpp b/src/vncview.cpp index 809b09e..9878818 100644 --- a/src/vncview.cpp +++ b/src/vncview.cpp @@ -30,6 +30,7 @@ critical(parent, caption, message) #include +#include #include #include #include @@ -325,9 +326,6 @@ if(x == 0 and y == 0) { installEventFilter(this); setCursor(((m_dotCursorState == CursorOn) || m_forceLocalCursor) ? localDotCursor() : Qt::BlankCursor); -#ifdef Q_WS_MAEMO_5 - QApplication::setOverrideCursor(((m_dotCursorState == CursorOn) || m_forceLocalCursor) ? localDotCursor() : Qt::BlankCursor); -#endif setMouseTracking(true); // get mouse events even when there is no mousebutton pressed setFocusPolicy(Qt::WheelFocus); @@ -385,10 +383,6 @@ void VncView::showDotCursor(DotCursorState state) RemoteView::showDotCursor(state); setCursor(state == CursorOn ? localDotCursor() : Qt::BlankCursor); - QApplication::setOverrideCursor(localDotCursor()); -#ifdef Q_WS_MAEMO_5 - QApplication::setOverrideCursor(state == CursorOn ? localDotCursor() : Qt::BlankCursor); -#endif } void VncView::enableScaling(bool scale) @@ -461,6 +455,17 @@ void VncView::paintEvent(QPaintEvent *event) } } + //draw local cursor ourselves, normal mouse pointer doesn't deal with scrolling + if((m_dotCursorState == CursorOn) || m_forceLocalCursor) { + const uchar bits[] = + { 0xff, 0x8e, 0x8e, 0x8e, 0xff }; + + QBitmap cursorBitmap = QBitmap::fromData(QSize(5,5), bits , QImage::Format_Mono); + cursorBitmap.setMask(cursorBitmap); + + painter.drawPixmap(cursor_x, cursor_y, cursorBitmap); + } + RemoteView::paintEvent(event); } -- 1.7.9.5