[client,x11] wrap XGetWindowProperty
use a logging version of the function to diagnose issues
This commit is contained in:
parent
87a91eb0c6
commit
26d1fff864
@ -104,6 +104,7 @@
|
||||
#include "xf_input.h"
|
||||
#include "xf_channels.h"
|
||||
#include "xfreerdp.h"
|
||||
#include "xf_utils.h"
|
||||
|
||||
#include <freerdp/log.h>
|
||||
#define TAG CLIENT_TAG("x11")
|
||||
@ -1778,9 +1779,9 @@ BOOL xf_setup_x11(xfContext* xfc)
|
||||
int actual_format = 0;
|
||||
unsigned long nitems = 0, after = 0;
|
||||
unsigned char* data = NULL;
|
||||
int status = XGetWindowProperty(xfc->display, RootWindowOfScreen(xfc->screen),
|
||||
xfc->_NET_SUPPORTED, 0, 1024, False, XA_ATOM, &actual_type,
|
||||
&actual_format, &nitems, &after, &data);
|
||||
int status = LogTagAndXGetWindowProperty(
|
||||
TAG, xfc->display, RootWindowOfScreen(xfc->screen), xfc->_NET_SUPPORTED, 0, 1024, False,
|
||||
XA_ATOM, &actual_type, &actual_format, &nitems, &after, &data);
|
||||
|
||||
if ((status == Success) && (actual_type == XA_ATOM) && (actual_format == 32))
|
||||
{
|
||||
|
@ -233,9 +233,9 @@ static BOOL xf_cliprdr_is_raw_transfer_available(xfClipboard* clipboard)
|
||||
|
||||
if (owner != None)
|
||||
{
|
||||
result =
|
||||
XGetWindowProperty(xfc->display, owner, clipboard->raw_transfer_atom, 0, 4, 0,
|
||||
XA_INTEGER, &type, &format, &length, &bytes_left, (BYTE**)&data);
|
||||
result = LogTagAndXGetWindowProperty(TAG, xfc->display, owner, clipboard->raw_transfer_atom,
|
||||
0, 4, 0, XA_INTEGER, &type, &format, &length,
|
||||
&bytes_left, (BYTE**)&data);
|
||||
}
|
||||
|
||||
if (data)
|
||||
@ -536,9 +536,9 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_raw_server_formats(xfClipboard* clipboard,
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
*numFormats = 0;
|
||||
XGetWindowProperty(xfc->display, clipboard->owner, clipboard->raw_format_list_atom, 0, 4096,
|
||||
False, clipboard->raw_format_list_atom, &type, &format, &length, &remaining,
|
||||
&data);
|
||||
LogTagAndXGetWindowProperty(
|
||||
TAG, xfc->display, clipboard->owner, clipboard->raw_format_list_atom, 0, 4096, False,
|
||||
clipboard->raw_format_list_atom, &type, &format, &length, &remaining, &data);
|
||||
|
||||
if (data && length > 0 && format == 8 && type == clipboard->raw_format_list_atom)
|
||||
{
|
||||
@ -578,8 +578,8 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboar
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
*numFormats = 0;
|
||||
XGetWindowProperty(xfc->display, xfc->drawable, clipboard->property_atom, 0, 200, 0, XA_ATOM,
|
||||
&atom, &format_property, &length, &bytes_left, &data);
|
||||
LogTagAndXGetWindowProperty(TAG, xfc->display, xfc->drawable, clipboard->property_atom, 0, 200,
|
||||
0, XA_ATOM, &atom, &format_property, &length, &bytes_left, &data);
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
@ -917,8 +917,8 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
XGetWindowProperty(xfc->display, xfc->drawable, clipboard->property_atom, 0, 0, 0, target,
|
||||
&type, &format_property, &length, &bytes_left, &data);
|
||||
LogTagAndXGetWindowProperty(TAG, xfc->display, xfc->drawable, clipboard->property_atom, 0, 0, 0,
|
||||
target, &type, &format_property, &length, &bytes_left, &data);
|
||||
|
||||
if (data)
|
||||
{
|
||||
@ -954,9 +954,9 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
|
||||
clipboard->incr_starts = 0;
|
||||
has_data = TRUE;
|
||||
}
|
||||
else if (XGetWindowProperty(xfc->display, xfc->drawable, clipboard->property_atom, 0,
|
||||
bytes_left, 0, target, &type, &format_property, &length, &dummy,
|
||||
&data) == Success)
|
||||
else if (LogTagAndXGetWindowProperty(
|
||||
TAG, xfc->display, xfc->drawable, clipboard->property_atom, 0, bytes_left, 0,
|
||||
target, &type, &format_property, &length, &dummy, &data) == Success)
|
||||
{
|
||||
if (clipboard->incr_starts)
|
||||
{
|
||||
@ -1245,9 +1245,9 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
|
||||
|
||||
if (formatId == CF_RAW)
|
||||
{
|
||||
if (XGetWindowProperty(xfc->display, xevent->requestor, clipboard->property_atom, 0,
|
||||
4, 0, XA_INTEGER, &type, &fmt, &length, &bytes_left,
|
||||
&data) != Success)
|
||||
if (LogTagAndXGetWindowProperty(
|
||||
TAG, xfc->display, xevent->requestor, clipboard->property_atom, 0, 4, 0,
|
||||
XA_INTEGER, &type, &fmt, &length, &bytes_left, &data) != Success)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,3 +63,38 @@ int LogDynAndXDeleteProperty(wLog* log, Display* display, Window w, Atom propert
|
||||
}
|
||||
return XDeleteProperty(display, w, property);
|
||||
}
|
||||
|
||||
int LogTagAndXGetWindowProperty(const char* tag, Display* display, Window w, Atom property,
|
||||
long long_offset, long long_length, int delete, Atom req_type,
|
||||
Atom* actual_type_return, int* actual_format_return,
|
||||
unsigned long* nitems_return, unsigned long* bytes_after_return,
|
||||
unsigned char** prop_return)
|
||||
{
|
||||
wLog* log = WLog_Get(tag);
|
||||
return LogDynAndXGetWindowProperty(log, display, w, property, long_offset, long_length, delete,
|
||||
req_type, actual_type_return, actual_format_return,
|
||||
nitems_return, bytes_after_return, prop_return);
|
||||
}
|
||||
|
||||
int LogDynAndXGetWindowProperty(wLog* log, Display* display, Window w, Atom property,
|
||||
long long_offset, long long_length, int delete, Atom req_type,
|
||||
Atom* actual_type_return, int* actual_format_return,
|
||||
unsigned long* nitems_return, unsigned long* bytes_after_return,
|
||||
unsigned char** prop_return)
|
||||
{
|
||||
if (WLog_IsLevelActive(log, level))
|
||||
{
|
||||
char* propstr = XGetAtomName(display, property);
|
||||
char* req_type_str = XGetAtomName(display, req_type);
|
||||
WLog_Print(log, WLOG_DEBUG,
|
||||
"XGetWindowProperty(%p, %d, %s [%d], %ld, %ld, %d, %s [%d], %p, %p, %p, %p, %p)",
|
||||
display, w, propstr, property, long_offset, long_length, delete, req_type_str,
|
||||
req_type, actual_type_return, actual_format_return, nitems_return,
|
||||
bytes_after_return, prop_return);
|
||||
XFree(propstr);
|
||||
XFree(req_type_str);
|
||||
}
|
||||
return XGetWindowProperty(display, w, property, long_offset, long_length, delete, req_type,
|
||||
actual_type_return, actual_format_return, nitems_return,
|
||||
bytes_after_return, prop_return);
|
||||
}
|
||||
|
@ -23,6 +23,17 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
int LogTagAndXGetWindowProperty(const char* tag, Display* display, Window w, Atom property,
|
||||
long long_offset, long long_length, Bool delete, Atom req_type,
|
||||
Atom* actual_type_return, int* actual_format_return,
|
||||
unsigned long* nitems_return, unsigned long* bytes_after_return,
|
||||
unsigned char** prop_return);
|
||||
int LogDynAndXGetWindowProperty(wLog* log, Display* display, Window w, Atom property,
|
||||
long long_offset, long long_length, Bool delete, Atom req_type,
|
||||
Atom* actual_type_return, int* actual_format_return,
|
||||
unsigned long* nitems_return, unsigned long* bytes_after_return,
|
||||
unsigned char** prop_return);
|
||||
|
||||
int LogTagAndXChangeProperty(const char* tag, Display* display, Window w, Atom property, Atom type,
|
||||
int format, int mode, _Xconst unsigned char* data, int nelements);
|
||||
int LogDynAndXChangeProperty(wLog* log, Display* display, Window w, Atom property, Atom type,
|
||||
|
@ -362,8 +362,9 @@ BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int leng
|
||||
if (property == None)
|
||||
return FALSE;
|
||||
|
||||
status = XGetWindowProperty(xfc->display, window, property, 0, length, False, AnyPropertyType,
|
||||
&actual_type, &actual_format, nitems, bytes, prop);
|
||||
status = LogTagAndXGetWindowProperty(TAG, xfc->display, window, property, 0, length, False,
|
||||
AnyPropertyType, &actual_type, &actual_format, nitems,
|
||||
bytes, prop);
|
||||
|
||||
if (status != Success)
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user