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
#ifndef __KMANAGERSELECTION_H
00026
#define __KMANAGERSELECTION_H
00027
00028
#include <qobject.h>
00029
#include <kdelibs_export.h>
00030
00031
#ifdef Q_WS_X11 // FIXME(E)
00032
00033
#include <X11/Xlib.h>
00034
00035
class KSelectionOwnerPrivate;
00036
00046 class KDECORE_EXPORT KSelectionOwner
00047 :
public QObject
00048 {
00049 Q_OBJECT
00050
public:
00059 KSelectionOwner( Atom selection,
int screen = -1,
QObject* parent = NULL );
00069 KSelectionOwner(
const char* selection,
int screen = -1,
QObject* parent = NULL );
00073
virtual ~KSelectionOwner();
00084
bool claim(
bool force,
bool force_kill =
true );
00088
void release();
00093 Window ownerWindow()
const;
00097
bool filterEvent( XEvent* ev_P );
00098 signals:
00105
void lostOwnership();
00106
protected:
00111
virtual bool handleMessage( XEvent* ev );
00121
virtual bool genericReply( Atom target, Atom property, Window requestor );
00127
virtual void replyTargets( Atom property, Window requestor );
00134
virtual void getAtoms();
00140
void setData(
long extra1,
long extra2 );
00141
private:
00142
void filter_selection_request( XSelectionRequestEvent& ev_P );
00143
bool handle_selection( Atom target_P, Atom property_P, Window requestor_P );
00144
const Atom selection;
00145
const int screen;
00146 Window window;
00147 Time timestamp;
00148
long extra1, extra2;
00149
static Atom manager_atom;
00150
static Atom xa_multiple;
00151
static Atom xa_targets;
00152
static Atom xa_timestamp;
00153
protected:
00154
virtual void virtual_hook(
int id,
void* data );
00155
private:
00156 KSelectionOwnerPrivate* d;
00157 };
00158
00159
class KSelectionWatcherPrivate;
00160
00169 class KDECORE_EXPORT KSelectionWatcher
00170 :
public QObject
00171 {
00172 Q_OBJECT
00173
public:
00182 KSelectionWatcher( Atom selection,
int screen = -1,
QObject* parent = NULL );
00192 KSelectionWatcher(
const char* selection,
int screen = -1,
QObject* parent = NULL );
00193
virtual ~KSelectionWatcher();
00197 Window owner();
00201
void filterEvent( XEvent* ev_P );
00202 signals:
00208
void newOwner( Window owner );
00215
void lostOwner();
00216
private:
00217
void init();
00218
const Atom selection;
00219
const int screen;
00220 Window selection_owner;
00221
static Atom manager_atom;
00222
protected:
00223
virtual void virtual_hook(
int id,
void* data );
00224
private:
00225 KSelectionWatcherPrivate* d;
00226 };
00227
00228
#endif
00229
#endif