Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Evergreen:11.2:Test
kdebase4-wallpapers
klipper-fix-empty-clipboard.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File klipper-fix-empty-clipboard.diff of Package kdebase4-wallpapers
--- klipper/klipper.cpp.sav 2010-02-11 17:18:44.202463879 +0100 +++ klipper/klipper.cpp 2010-02-11 17:18:54.299585753 +0100 @@ -22,6 +22,8 @@ Boston, MA 02110-1301, USA. */ +#include <config-X11.h> + #include <QtDBus/QDBusConnection> #include <kaboutdata.h> @@ -51,6 +53,9 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> +#ifdef HAVE_XFIXES +#include <X11/extensions/Xfixes.h> +#endif //#define NOISY_KLIPPER @@ -124,6 +129,8 @@ Klipper::Klipper(QObject *parent, const connect( m_clip, SIGNAL(changed(QClipboard::Mode)), this, SLOT( newClipData( QClipboard::Mode) ) ); + connect( &m_empty_detector, SIGNAL(changed(QClipboard::Mode)), + this, SLOT( newClipData( QClipboard::Mode) ) ); connect( &m_overflowClearTimer, SIGNAL( timeout()), SLOT( slotClearOverflow())); m_overflowClearTimer.start( 1000 ); @@ -1039,4 +1046,58 @@ static void ensureGlobalSyncOff(KSharedC } +// http://bugreports.qt.nokia.com/browse/QTBUG-8157 +#if KDE_IS_VERSION( 4, 4, 85 ) +#warning Check if this is still needed, hopefully not. +#endif +KlipperEmptyDetector::KlipperEmptyDetector() +: m_xfixes_event_base( -1 ) +, m_xa_clipboard( None ) +{ +#ifdef HAVE_XFIXES + m_xa_clipboard = XInternAtom( QX11Info::display(), "CLIPBOARD", False ); + kapp->installX11EventFilter( this ); + int dummy; + if( XFixesQueryExtension( QX11Info::display(), &m_xfixes_event_base, &dummy )) + { + XFixesSelectSelectionInput( QX11Info::display(), QX11Info::appRootWindow( 0 ), XA_PRIMARY, + XFixesSetSelectionOwnerNotifyMask | + XFixesSelectionWindowDestroyNotifyMask | + XFixesSelectionClientCloseNotifyMask ); + XFixesSelectSelectionInput( QX11Info::display(), QX11Info::appRootWindow( 0 ), m_xa_clipboard, + XFixesSetSelectionOwnerNotifyMask | + XFixesSelectionWindowDestroyNotifyMask | + XFixesSelectionClientCloseNotifyMask ); + } +#endif +} + +bool KlipperEmptyDetector::x11Event( XEvent* e ) +{ +#ifdef HAVE_XFIXES + if( m_xfixes_event_base != -1 && e->type == m_xfixes_event_base + XFixesSelectionNotify ) + { + XFixesSelectionNotifyEvent* ev = reinterpret_cast< XFixesSelectionNotifyEvent* >( e ); + if( ev->subtype == XFixesSelectionWindowDestroyNotify || ev->subtype == XFixesSelectionClientCloseNotify ) + { + if( ev->selection == XA_PRIMARY && !kapp->clipboard()->ownsSelection()) + { +#ifdef NOISY_KLIPPER + kDebug() << "Selection lost"; +#endif + emit changed( QClipboard::Selection ); + } + else if( ev->selection == m_xa_clipboard && !kapp->clipboard()->ownsClipboard()) + { +#ifdef NOISY_KLIPPER + kDebug() << "Clipboard lost"; +#endif + emit changed( QClipboard::Clipboard ); + } + } + } +#endif + return false; +} + #include "klipper.moc" --- klipper/klipper.h.sav 2010-02-11 17:18:44.203462136 +0100 +++ klipper/klipper.h 2010-02-11 17:18:54.299585753 +0100 @@ -44,6 +44,20 @@ class QMimeData; class HistoryItem; class KlipperSessionManager; +class KlipperEmptyDetector : public QWidget +{ +Q_OBJECT +public: + KlipperEmptyDetector(); +signals: + void changed( QClipboard::Mode m ); +protected: + virtual bool x11Event( XEvent* e ); +private: + int m_xfixes_event_base; + unsigned int m_xa_clipboard; +}; + class Klipper : public QObject { Q_OBJECT @@ -208,6 +222,7 @@ private: bool blockFetchingNewData(); KlipperSessionManager* m_session_managed; KActionCollection *m_collection; + KlipperEmptyDetector m_empty_detector; }; #endif
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