BOOL xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent) { clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; if (xf_cliprdr_is_self_owned(xfi)) return FALSE; XDeleteProperty(xfi->display, cb->root_window, cb->property_atom); return TRUE; }
static BOOL xf_cliprdr_process_selection_clear(xfClipboard* clipboard, XEvent* xevent) { xfContext* xfc = clipboard->xfc; if (xf_cliprdr_is_self_owned(clipboard)) return FALSE; XDeleteProperty(xfc->display, clipboard->root_window, clipboard->property_atom); return TRUE; }
static void xf_cliprdr_send_format_list(xfInfo* xfi) { clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; if (xf_cliprdr_is_self_owned(xfi)) { xf_cliprdr_send_raw_format_list(xfi); } else if (cb->owner == None) { xf_cliprdr_send_null_format_list(xfi); } else if (cb->owner != xfi->drawable) { /* Request the owner for TARGETS, and wait for SelectionNotify event */ XConvertSelection(xfi->display, cb->clipboard_atom, cb->targets[1], cb->property_atom, xfi->drawable, CurrentTime); } }
static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_REQUEST_EVENT* event) { int i; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; DEBUG_X11_CLIPRDR("format %d", event->format); if (xf_cliprdr_is_self_owned(xfi)) { /* CB_FORMAT_RAW */ i = 0; XChangeProperty(xfi->display, xfi->drawable, cb->property_atom, XA_INTEGER, 32, PropModeReplace, (BYTE*) &event->format, 1); } else { i = xf_cliprdr_select_format_by_id(cb, event->format); } if (i < 0) { DEBUG_X11_CLIPRDR("unsupported format requested"); xf_cliprdr_send_null_data_response(xfi); } else { cb->request_index = i; DEBUG_X11_CLIPRDR("target=%d", (int) cb->format_mappings[i].target_format); XConvertSelection(xfi->display, cb->clipboard_atom, cb->format_mappings[i].target_format, cb->property_atom, xfi->drawable, CurrentTime); XFlush(xfi->display); /* After this point, we expect a SelectionNotify event from the clipboard owner. */ } }
static int xf_cliprdr_server_format_data_request(CliprdrClientContext* context, CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest) { xfCliprdrFormat* format = NULL; UINT32 formatId = formatDataRequest->requestedFormatId; xfClipboard* clipboard = (xfClipboard*) context->custom; xfContext* xfc = clipboard->xfc; if (xf_cliprdr_is_self_owned(clipboard)) { format = xf_cliprdr_get_format_by_id(clipboard, 0); XChangeProperty(xfc->display, xfc->drawable, clipboard->property_atom, XA_INTEGER, 32, PropModeReplace, (BYTE*) &formatId, 1); } else { format = xf_cliprdr_get_format_by_id(clipboard, formatId); } if (!format) { xf_cliprdr_send_data_response(clipboard, NULL, 0); return 1; } clipboard->requestedFormatId = formatId; XConvertSelection(xfc->display, clipboard->clipboard_atom, format->atom, clipboard->property_atom, xfc->drawable, CurrentTime); XFlush(xfc->display); /* After this point, we expect a SelectionNotify event from the clipboard owner. */ return 1; }