From f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25 Mon Sep 17 00:00:00 2001 From: wimpie Date: Wed, 25 Aug 2004 01:47:35 +0000 Subject: Final changes for RoH Feedback - changed *.pro file to compile in backend - some more fixes to rohfeedback and qpeapplication --- (limited to 'library/qpeapplication.cpp') diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 35f433c..c6d9cfd 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -97,12 +97,11 @@ #endif #include "qt_override_p.h" -#include +#include static bool useBigPixmaps = 0; - class HackWidget : public QWidget { public: @@ -116,8 +115,8 @@ public: class QPEApplicationData { public: - QPEApplicationData ( ) - : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), + QPEApplicationData ( ) : + presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), keep_running( true ), qcopQok( false ), fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), @@ -130,7 +129,7 @@ public: fontSize = cfg.readNumEntry( "FontSize", 10 ); smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK RoH = 0; #endif } @@ -138,7 +137,7 @@ public: int presstimer; QWidget* presswidget; QPoint presspos; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK Opie::Internal::RoHFeedback *RoH; #endif @@ -502,6 +501,7 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) } } } + }; class ResourceMimeFactory : public QMimeSourceFactory @@ -1215,8 +1215,10 @@ QPEApplication::~QPEApplication() delete sysChannel; delete pidChannel; #endif -#ifdef OPIE_ROHFEEDBACK - delete d->RoH; + +#ifdef OPIE_WITHROHFEEDBACK + if( d->RoH ) + delete d->RoH; #endif delete d; } @@ -2035,29 +2037,28 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) switch ( me->type() ) { case QEvent::MouseButtonPress: if ( me->button() == LeftButton ) { + static long Pref = 500; // #### pref. d->presswidget = (QWidget*)o; d->presspos = me->pos(); d->rightpressed = FALSE; - // just for the time being - static int pref = 500; -#ifdef OPIE_ROHFEEDBACK +#ifdef OPIE_WITHROHFEEDBACK if( ! d->RoH ) d->RoH = new Opie::Internal::RoHFeedback; d->RoH->init( me->globalPos(), d->presswidget ); - pref = d->RoH->delay(); + Pref = d->RoH->delay(); + #endif if (!d->presstimer ) - d->presstimer = startTimer( pref ); // #### pref. + d->presstimer = startTimer( Pref ); // #### pref. } break; case QEvent::MouseMove: if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #endif d->presstimer = 0; } @@ -2066,13 +2067,13 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) if ( me->button() == LeftButton ) { if ( d->presstimer ) { killTimer(d->presstimer); -#ifdef OPIE_ROHFEEDBACK - if( d->RoH ) - d->RoH->stop( ); +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop( ); #endif d->presstimer = 0; } if ( d->rightpressed && d->presswidget ) { + printf( "Send ButtonRelease\n" ); // Right released postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), @@ -2116,15 +2117,16 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) void QPEApplication::timerEvent( QTimerEvent *e ) { if ( e->timerId() == d->presstimer && d->presswidget ) { - // Right pressed - postEvent( d->presswidget, - new QMouseEvent( QEvent::MouseButtonPress, d->presspos, - RightButton, LeftButton ) ); - killTimer( d->presstimer ); - d->presstimer = 0; - d->rightpressed = TRUE; -#ifdef OPIE_ROHFEEDBACK - d->RoH->stop(); + + // Right pressed + postEvent( d->presswidget, + new QMouseEvent( QEvent::MouseButtonPress, d->presspos, + RightButton, LeftButton ) ); + killTimer( d->presstimer ); + d->presstimer = 0; + d->rightpressed = TRUE; +#ifdef OPIE_WITHROHFEEDBACK + d->RoH->stop(); #endif } } -- cgit v0.9.0.2