00001 #ifndef BCCLIPBOARD_H 00002 #define BCCLIPBOARD_H 00003 00004 #include "thread.h" 00005 00006 #include <stdio.h> 00007 #include <stdlib.h> 00008 #include <X11/Xatom.h> 00009 #include <X11/Xlib.h> 00010 00011 // The primary selection is filled by highlighting a region 00012 #define PRIMARY_SELECTION 0 00013 // The secondary selection is filled by copying 00014 #define SECONDARY_SELECTION 1 00015 00016 class BC_Clipboard : public Thread 00017 { 00018 public: 00019 BC_Clipboard(char *display_name); 00020 ~BC_Clipboard(); 00021 00022 int start_clipboard(); 00023 void run(); 00024 int stop_clipboard(); 00025 long clipboard_len(int clipboard_num); 00026 int to_clipboard(char *data, long len, int clipboard_num); 00027 int from_clipboard(char *data, long maxlen, int clipboard_num); 00028 00029 private: 00030 void handle_selectionrequest(XSelectionRequestEvent *request); 00031 int handle_request_string(XSelectionRequestEvent *request); 00032 int handle_request_targets(XSelectionRequestEvent *request); 00033 00034 Display *in_display, *out_display; 00035 Atom completion_atom, primary, secondary; 00036 Atom targets_atom; 00037 Window in_win, out_win; 00038 char *data[2]; 00039 long length[2]; 00040 }; 00041 00042 #endif
1.5.5