ctrlsel.h (2004B)
1 /* 2 * ctrlsel: X11 selection ownership and request helper functions 3 * 4 * Refer to the accompanying manual for a description of the interface. 5 */ 6 #ifndef _CTRLSEL_H_ 7 #define _CTRLSEL_H_ 8 9 enum { 10 CTRLSEL_NONE, 11 CTRLSEL_INTERNAL, 12 CTRLSEL_RECEIVED, 13 CTRLSEL_SENT, 14 CTRLSEL_DROPSELF, 15 CTRLSEL_DROPOTHER, 16 CTRLSEL_ERROR, 17 CTRLSEL_LOST 18 }; 19 20 enum { 21 CTRLSEL_COPY = 0x01, 22 CTRLSEL_MOVE = 0x02, 23 CTRLSEL_LINK = 0x04, 24 CTRLSEL_ASK = 0x08, 25 CTRLSEL_PRIVATE = 0x10, 26 }; 27 28 typedef struct CtrlSelContext CtrlSelContext; 29 30 struct CtrlSelTarget { 31 Atom target; 32 Atom type; 33 int format; 34 unsigned int action; 35 unsigned long nitems; 36 unsigned long bufsize; 37 unsigned char *buffer; 38 }; 39 40 void 41 ctrlsel_filltarget( 42 Atom target, 43 Atom type, 44 int format, 45 unsigned char *buffer, 46 unsigned long size, 47 struct CtrlSelTarget *fill 48 ); 49 50 CtrlSelContext * 51 ctrlsel_request( 52 Display *display, 53 Window window, 54 Atom selection, 55 Time time, 56 struct CtrlSelTarget targets[], 57 unsigned long ntargets 58 ); 59 60 CtrlSelContext * 61 ctrlsel_setowner( 62 Display *display, 63 Window window, 64 Atom selection, 65 Time time, 66 int ismanager, 67 struct CtrlSelTarget targets[], 68 unsigned long ntargets 69 ); 70 71 int ctrlsel_receive(struct CtrlSelContext *context, XEvent *event); 72 73 int ctrlsel_send(struct CtrlSelContext *context, XEvent *event); 74 75 void ctrlsel_cancel(struct CtrlSelContext *context); 76 77 void ctrlsel_disown(struct CtrlSelContext *context); 78 79 CtrlSelContext * 80 ctrlsel_dndwatch( 81 Display *display, 82 Window window, 83 unsigned int actions, 84 struct CtrlSelTarget targets[], 85 unsigned long ntargets 86 ); 87 88 int ctrlsel_dndreceive(struct CtrlSelContext *context, XEvent *event); 89 90 void ctrlsel_dndclose(struct CtrlSelContext *context); 91 92 int 93 ctrlsel_dndown( 94 Display *display, 95 Window window, 96 Window miniature, 97 Time time, 98 struct CtrlSelTarget targets[], 99 unsigned long ntargets, 100 CtrlSelContext **context 101 ); 102 103 int ctrlsel_dndsend(struct CtrlSelContext *context, XEvent *event); 104 105 void ctrlsel_dnddisown(struct CtrlSelContext *context); 106 107 #endif /* _CTRLSEL_H_ */