Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2:Test
kdebase4-wallpapers
klipper-fixes.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File klipper-fixes.diff of Package kdebase4-wallpapers
------------------------------------------------------------------------ Index: klipper/klipper.cpp =================================================================== --- klipper/klipper.cpp (revision 1055586) +++ klipper/klipper.cpp (revision 1055587) @@ -22,7 +22,6 @@ Boston, MA 02110-1301, USA. */ -#include <QClipboard> #include <QtDBus/QDBusConnection> #include <kaboutdata.h> @@ -44,7 +43,6 @@ #include "klippersettings.h" #include "urlgrabber.h" #include "version.h" -#include "clipboardpoll.h" #include "history.h" #include "historyitem.h" #include "historystringitem.h" @@ -126,6 +124,9 @@ updateTimestamp(); // read initial X user time m_clip = kapp->clipboard(); + connect( m_clip, SIGNAL(changed(QClipboard::Mode)), + this, SLOT( newClipData( QClipboard::Mode) ) ); + connect( &m_overflowClearTimer, SIGNAL( timeout()), SLOT( slotClearOverflow())); m_pendingCheckTimer.setSingleShot( true ); @@ -179,10 +180,6 @@ // if it's too old, drop it and just use load history readProperties(m_config.data()); - m_poll = new ClipboardPoll; - connect( m_poll, SIGNAL( clipboardChanged( bool ) ), - this, SLOT( newClipData( bool ) ) ); - QAction *a = m_collection->addAction("show_klipper_popup"); a->setText(i18n("Show Klipper Popup-Menu")); a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_V)); @@ -234,7 +231,6 @@ Klipper::~Klipper() { - delete m_poll; delete m_session_managed; delete m_showTimer; delete m_hideTimer; @@ -650,7 +646,7 @@ } -void Klipper::newClipData( bool selectionMode ) +void Klipper::newClipData( QClipboard::Mode mode ) { if ( m_locklevel ) { return; @@ -659,7 +655,7 @@ if( blockFetchingNewData()) return; - checkClipData( selectionMode ); + checkClipData( mode == QClipboard::Selection ? true : false ); } @@ -719,7 +715,7 @@ return; m_pendingContentsCheck = false; // blockFetchingNewData() will be called again updateTimestamp(); - newClipData( true ); // always selection + newClipData( QClipboard::Selection ); // always selection } void Klipper::checkClipData( bool selectionMode ) @@ -777,8 +773,15 @@ // TODO: Rewrite to Qt4 !!! //int lastSerialNo = selectionMode ? m_lastSelection : m_lastClipboard; //bool changed = data->serialNumber() != lastSerialNo; - bool changed = true; // ### FIXME + bool changed = true; // ### FIXME (only relevant under polling, might be better to simply remove polling and rely on XFixes) bool clipEmpty = data->formats().isEmpty(); + if (clipEmpty) { + // Might be a timeout. Try again + clipEmpty = data->formats().isEmpty(); +#ifdef NOISY_KLIPPER + kDebug() << "was empty. Retried, now " << (clipEmpty?" still empty":" no longer empty"); +#endif + } if ( changed && clipEmpty && m_bNoNullClipboard ) { const HistoryItem* top = history()->first(); @@ -883,7 +886,7 @@ if( m_overflowCounter > MAX_CLIPBOARD_CHANGES ) { kDebug() << "App owning the clipboard/selection is lame"; // update to the latest data - this unfortunately may trigger the problem again - newClipData( true ); // Always the selection. + newClipData( QClipboard::Selection ); // Always the selection. } m_overflowCounter = 0; } Index: klipper/klipper.h =================================================================== --- klipper/klipper.h (revision 1055586) +++ klipper/klipper.h (revision 1055587) @@ -25,6 +25,7 @@ #include <QKeyEvent> #include <QMenu> #include <QTimer> +#include <QClipboard> #include <KApplication> #include <KIcon> @@ -37,7 +38,6 @@ class KAboutData; class KActionCollection; class URLGrabber; -class ClipboardPoll; class QTime; class History; class QAction; @@ -148,7 +148,7 @@ void disableURLGrabber(); private Q_SLOTS: - void newClipData( bool selectionMode ); + void newClipData( QClipboard::Mode ); void slotClearClipboard(); void slotSelectionChanged() { @@ -214,7 +214,6 @@ QTimer m_overflowClearTimer; QTimer m_pendingCheckTimer; bool m_pendingContentsCheck; - ClipboardPoll* m_poll; static KAboutData* m_about_data; bool blockFetchingNewData(); Index: klipper/clipboardpoll.cpp =================================================================== --- klipper/clipboardpoll.cpp (revision 1055586) +++ klipper/clipboardpoll.cpp (revision 1055587) @@ -42,6 +42,10 @@ /* + After Qt 4.something, this part worked poorly. Meanwhile, XFixes was integrated into QClipboard, + and has become pretty ubiquitous, so I'm risking retiring this code. The alternative is essentially + reimplementation of QClipboard, and the duplication would help noone. (Esben Mose Hansen, 2009-11-28 11:44:43) + The polling magic: There's no way with X11 how to find out if the selection has changed (unless its ownership
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor