diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index b7b3d81e4..e0abd09fb 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -1707,8 +1707,9 @@ static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard, BOOL forc if (clipboard->owner && clipboard->owner != xfc->drawable) { /* Request the owner for TARGETS, and wait for SelectionNotify event */ - XConvertSelection(xfc->display, clipboard->clipboard_atom, clipboard->targets[1], - clipboard->property_atom, xfc->drawable, CurrentTime); + LogTagAndXConvertSelection(TAG, xfc->display, clipboard->clipboard_atom, + clipboard->targets[1], clipboard->property_atom, xfc->drawable, + CurrentTime); } xf_cliprdr_free_formats(formats, numFormats); @@ -2011,8 +2012,8 @@ xf_cliprdr_server_format_data_request(CliprdrClientContext* context, DEBUG_CLIPRDR("requested format 0x%08" PRIx32 " [%s] {local 0x%08" PRIx32 "} [%s]", format->formatToRequest, ClipboardGetFormatIdString(format->formatToRequest), format->localFormat, format->formatName); - XConvertSelection(xfc->display, clipboard->clipboard_atom, format->atom, - clipboard->property_atom, xfc->drawable, CurrentTime); + LogTagAndXConvertSelection(TAG, 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 CHANNEL_RC_OK; diff --git a/client/X11/xf_utils.c b/client/X11/xf_utils.c index 28d9f9966..b68a73dc1 100644 --- a/client/X11/xf_utils.c +++ b/client/X11/xf_utils.c @@ -86,6 +86,34 @@ int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, si return XDeleteProperty(display, w, property); } +int LogTagAndXConvertSelection_ex(const char* tag, const char* file, const char* fkt, size_t line, + Display* display, Atom selection, Atom target, Atom property, + Window requestor, Time time) +{ + wLog* log = WLog_Get(tag); + return LogDynAndXConvertSelection_ex(log, file, fkt, line, display, selection, target, property, + requestor, time); +} + +int LogDynAndXConvertSelection_ex(wLog* log, const char* file, const char* fkt, size_t line, + Display* display, Atom selection, Atom target, Atom property, + Window requestor, Time time) +{ + if (WLog_IsLevelActive(log, log_level)) + { + char* selectstr = Safe_XGetAtomName(log, display, selection); + char* targetstr = Safe_XGetAtomName(log, display, target); + char* propstr = Safe_XGetAtomName(log, display, property); + write_log(log, log_level, file, fkt, line, + "XConvertSelection(%p, %s [%d], %s [%d], %s [%d], %d, %lu)", display, selectstr, + selection, targetstr, target, propstr, property, requestor, time); + XFree(propstr); + XFree(targetstr); + XFree(selectstr); + } + return XConvertSelection(display, selection, target, property, requestor, time); +} + int LogTagAndXGetWindowProperty_ex(const char* tag, const char* file, const char* fkt, size_t line, Display* display, Window w, Atom property, long long_offset, long long_length, int delete, Atom req_type, diff --git a/client/X11/xf_utils.h b/client/X11/xf_utils.h index f72d55aa8..40dc2a27a 100644 --- a/client/X11/xf_utils.h +++ b/client/X11/xf_utils.h @@ -76,3 +76,16 @@ int LogTagAndXDeleteProperty_ex(const char* tag, const char* file, const char* f LogDynAndXDeleteProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property)) int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, size_t line, Display* display, Window w, Atom property); + +#define LogTagAndXConvertSelection(tag, display, selection, target, property, requestor, time) \ + LogTagAndXConvertSelection_ex((tag), __FILE__, __func__, __LINE__, (display), (selection), \ + (target), (property), (requestor), (time)) +int LogTagAndXConvertSelection_ex(const char* tag, const char* file, const char* fkt, size_t line, + Display* display, Atom selection, Atom target, Atom property, + Window requestor, Time time); + +#define LogDynAndXConvertSelection(log, display, selection, target, property, requestor, time) \ + LogDynAndXConvertSelection_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property)) +int LogDynAndXConvertSelection_ex(wLog* log, const char* file, const char* fkt, size_t line, + Display* display, Atom selection, Atom target, Atom property, + Window requestor, Time time);