-#ifndef XFORMS_CLIPBOARD
-static
-string fromClipboard(Window win, XEvent * event)
-{
- string strret;
- if (event->xselection.type == XA_STRING
- && event->xselection.property) {
- Atom tmpatom;
- unsigned long ul1;
- unsigned long ul2;
- unsigned char * uc = 0;
- int tmpint;
- if (XGetWindowProperty(
- event->xselection.display, // display
- win, // w
- event->xselection.property, // property
- 0, // long_offset
- 0, // logn_length
- False, // delete
- XA_STRING, // req_type
- &tmpatom, // actual_type_return
- &tmpint, // actual_format_return
- &ul1,
- &ul2,
- &uc // prop_return
- ) != Success) {
- return strret;
- }
- if (uc) {
- free(uc);
- uc = 0;
- }
- if (XGetWindowProperty(
- event->xselection.display, // display
- win, // w
- event->xselection.property, // property
- 0, // long_offset
- ul2/4+1, // long_length
- True, // delete
- XA_STRING, // req_type
- &tmpatom, // actual_type_return
- &tmpint, // actual_format_return
- &ul1, // nitems_return
- &ul2, // bytes_after_return
- &uc // prop_return */
- ) != Success) {
- return strret;
- }
- if (uc) {
- strret = reinterpret_cast<char*>(uc);
- free(uc); // yes free!
- uc = 0;
- }
- }
- return strret;
-}
-
-
-void BufferView::Pimpl::workAreaSelectionNotify(Window win, XEvent * event)
-{
- if (buffer_ == 0) return;
-
- screen->HideCursor();
- bv_->beforeChange();
- string clb = fromClipboard(win, event);
- if (!clb.empty()) {
- if (!ascii_type)
- bv_->text->InsertStringA(clb);
- else
- bv_->text->InsertStringB(clb);
-
- update(1);
- }
-}
-#endif
-
-