- XEvent event;
- Atom type_return, pty;
- int format;
- unsigned long nitems, size, new_size;
- char *temp_data = 0;
-
- pty = (clipboard_num == PRIMARY_SELECTION) ? primary : secondary;
- /* a property of our window
- for apps to put their
- selection into */
-
- XConvertSelection(in_display,
- clipboard_num == PRIMARY_SELECTION ? primary : secondary,
- strtype_atom,
- pty,
- in_win,
- CurrentTime);
-
- data[0] = 0;
- do
- {
- XNextEvent(in_display, &event);
- }while(event.type != SelectionNotify && event.type != None);
-
- if(event.type != None)
- {
-// Get size
- XGetWindowProperty(in_display,
- in_win, pty, 0, 0, False, AnyPropertyType,
- &type_return, &format, &nitems, &size,
- (unsigned char**)&temp_data);
-
- if(temp_data) XFree(temp_data);
- temp_data = 0;
-
-// Get data
- XGetWindowProperty(in_display,
- in_win, pty, 0, size, False, AnyPropertyType,
- &type_return, &format, &nitems, &new_size,
- (unsigned char**)&temp_data);
-
-
- if(type_return && temp_data)
- {
- strncpy(data, temp_data, maxlen);
- data[maxlen] = 0;
+ if( clipboard_num < CLIP_BUFFER0 ) {
+ char *bfr = data_buffer[clipboard_num];
+ if( data_length[clipboard_num] != len ) {
+ delete [] bfr; bfr = new char[len];
+ data_buffer[clipboard_num] = bfr;
+ data_length[clipboard_num] = len;