summaryrefslogtreecommitdiff
authorsandman <sandman>2002-08-28 23:18:58 (UTC)
committer sandman <sandman>2002-08-28 23:18:58 (UTC)
commit178bd471d12a88862fb4ac1a17842ea0fd63c160 (patch) (side-by-side diff)
treec37b10465eca3b6c2431b7999fe32eb4692f12ee
parent186bdeb08c0d9ccd78177310cf9f69ea80b76a96 (diff)
downloadopie-178bd471d12a88862fb4ac1a17842ea0fd63c160.zip
opie-178bd471d12a88862fb4ac1a17842ea0fd63c160.tar.gz
opie-178bd471d12a88862fb4ac1a17842ea0fd63c160.tar.bz2
Workaround for a possible race condition in the QWS server (mostly OZ)
(clipboard handling in Qt/E is a mess)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 4fbdf6f..3099a84 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -119,29 +119,29 @@ static const char * paste_xpm[] = {
ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
{
setFixedWidth ( 14 );
setFixedHeight ( 18 );
m_clipboardPixmap = QPixmap ( paste_xpm );
m_timer = new QTimer ( this );
connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( )));
connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( )));
- m_timer-> start ( 1500 );
-
m_menu = 0;
m_dirty = true;
m_lasttext = QString::null;
+
+ m_timer-> start ( 0, true );
}
ClipboardApplet::~ClipboardApplet ( )
{
}
void ClipboardApplet::shutdown ( )
{
// the timer has to be stopped, or Qt/E will hang on quit()
// see launcher/desktop.cpp
m_timer-> stop ( );
@@ -219,24 +219,37 @@ void ClipboardApplet::action(int id)
qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
}
}
void ClipboardApplet::paintEvent ( QPaintEvent* )
{
QPainter p ( this );
p. drawPixmap ( 0, 1, m_clipboardPixmap );
}
void ClipboardApplet::newData ( )
{
+ static bool excllock = false;
+
+ if ( excllock )
+ return;
+ else
+ excllock = true;
+
+ m_timer-> stop ( );
+
QCString type = "plain";
QString txt = QApplication::clipboard ( )-> text ( type );
if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
m_history. append ( txt );
if ( m_history. count ( ) > 5 )
m_history. remove ( m_history. begin ( ));
m_dirty = true;
}
+
+ m_timer-> start ( 1500, true );
+
+ excllock = false;
}