00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
#ifndef __KMANAGERSELECTION_H
00028
#define __KMANAGERSELECTION_H
00029
00030
#include <qobject.h>
00031
#ifdef Q_WS_X11 // FIXME(E)
00032
00033
#include <X11/Xlib.h>
00034
00035
class KSelectionOwnerPrivate;
00036
00046
class KSelectionOwner
00047 :
public QObject
00048 {
00049 Q_OBJECT
00050
public:
00057 KSelectionOwner( Atom selection,
int screen = -1,
QObject* parent = NULL );
00065 KSelectionOwner(
const char* selection,
int screen = -1,
QObject* parent = NULL );
00069
virtual ~KSelectionOwner();
00080
bool claim(
bool force,
bool force_kill =
true );
00084
void release();
00089 Window ownerWindow() const;
00093
bool filterEvent( XEvent* ev_P );
00094 signals:
00101
void lostOwnership();
00102 protected:
00107 virtual
bool handleMessage( XEvent* ev );
00117 virtual
bool genericReply( Atom target, Atom property, Window requestor );
00123 virtual
void replyTargets( Atom property, Window requestor );
00130 virtual
void getAtoms();
00136
void setData(
long extra1,
long extra2 );
00137 private:
00138
void filter_selection_request( XSelectionRequestEvent& ev_P );
00139
bool handle_selection( Atom target_P, Atom property_P, Window requestor_P );
00140 const Atom selection;
00141 const
int screen;
00142 Window window;
00143 Time timestamp;
00144
long extra1, extra2;
00145 static Atom manager_atom;
00146 static Atom xa_multiple;
00147 static Atom xa_targets;
00148 static Atom xa_timestamp;
00149 protected:
00150 virtual
void virtual_hook(
int id,
void* data );
00151 private:
00152 KSelectionOwnerPrivate* d;
00153 };
00154
00155 class KSelectionWatcherPrivate;
00156
00165 class KSelectionWatcher
00166 : public
QObject
00167 {
00168 Q_OBJECT
00169
public:
00176 KSelectionWatcher( Atom selection_P,
int screen_P = -1, QObject* parent = NULL );
00184 KSelectionWatcher(
const char* selection_P,
int screen_P = -1, QObject* parent = NULL );
00185
virtual ~KSelectionWatcher();
00189 Window owner();
00193
void filterEvent( XEvent* ev_P );
00194 signals:
00200
void newOwner( Window owner );
00207
void lostOwner();
00208
private:
00209
void init();
00210
const Atom selection;
00211
const int screen;
00212 Window selection_owner;
00213
static Atom manager_atom;
00214
protected:
00215
virtual void virtual_hook(
int id,
void* data );
00216
private:
00217 KSelectionWatcherPrivate* d;
00218 };
00219
00220
#endif
00221
#endif