00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CLIPBOARDPOLL_H_
00021 #define _CLIPBOARDPOLL_H_
00022
00023 #include <tqwidget.h>
00024 #include <tqtimer.h>
00025 #include <X11/Xlib.h>
00026 #include <fixx11h.h>
00027
00028 class ClipboardPoll
00029 : public QWidget
00030 {
00031 Q_OBJECT
00032 public:
00033 ClipboardPoll( TQWidget* parent );
00034 signals:
00035 void clipboardChanged( bool selectionMode );
00036 protected:
00037 virtual bool x11Event( XEvent* );
00038 private slots:
00039 void timeout();
00040 void qtSelectionChanged();
00041 void qtClipboardChanged();
00042 private:
00043 struct SelectionData
00044 {
00045 Atom atom;
00046 Atom sentinel_atom;
00047 Atom timestamp_atom;
00048 Window last_owner;
00049 bool owner_is_qt;
00050 Time last_change;
00051 bool waiting_for_timestamp;
00052 Time waiting_x_time;
00053 };
00054 void updateQtOwnership( SelectionData& data );
00055 bool checkTimestamp( SelectionData& data );
00056 bool changedTimestamp( SelectionData& data, const XEvent& e );
00057 void initPolling();
00058 TQTimer timer;
00059 SelectionData selection;
00060 SelectionData clipboard;
00061 Atom xa_clipboard;
00062 Atom xa_timestamp;
00063 int xfixes_event_base;
00064 };
00065
00066 #endif