r895: Fix clipboard handling to return only data of the requested type.
[cinelerra_cv/ct.git] / guicast / bcclipboard.h
blob4ba5acf900f8c2dce9b8255b2197d7c33712bea2
1 #ifndef BCCLIPBOARD_H
2 #define BCCLIPBOARD_H
4 #include "thread.h"
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <X11/Xatom.h>
9 #include <X11/Xlib.h>
11 // The primary selection is filled by highlighting a region
12 #define PRIMARY_SELECTION 0
13 // The secondary selection is filled by copying
14 #define SECONDARY_SELECTION 1
16 class BC_Clipboard : public Thread
18 public:
19 BC_Clipboard(char *display_name);
20 ~BC_Clipboard();
22 int start_clipboard();
23 void run();
24 int stop_clipboard();
25 long clipboard_len(int clipboard_num);
26 int to_clipboard(char *data, long len, int clipboard_num);
27 int from_clipboard(char *data, long maxlen, int clipboard_num);
29 private:
30 void handle_selectionrequest(XSelectionRequestEvent *request);
31 int handle_request_string(XSelectionRequestEvent *request);
32 int handle_request_targets(XSelectionRequestEvent *request);
34 Display *in_display, *out_display;
35 Atom completion_atom, primary, secondary;
36 Atom targets_atom;
37 Window in_win, out_win;
38 char *data[2];
39 long length[2];
42 #endif