[client,X11] log XConvertSelection calls

This commit is contained in:
Armin Novak 2024-07-17 11:05:57 +02:00
parent 3f0f1a3bbb
commit 71760d6d9a
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
3 changed files with 46 additions and 4 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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);