mirror of https://github.com/FreeRDP/FreeRDP
[client,x11] add Safe_XGetAtomName
This commit is contained in:
parent
05134dc3a0
commit
0b048e247e
|
@ -1755,6 +1755,12 @@ BOOL xf_setup_x11(xfContext* xfc)
|
|||
WLog_ERR(TAG, "Please check that the $DISPLAY environment variable is properly set.");
|
||||
goto fail;
|
||||
}
|
||||
if (xfc->debug)
|
||||
{
|
||||
WLog_INFO(TAG, "Enabling X11 debug mode.");
|
||||
XSynchronize(xfc->display, TRUE);
|
||||
_def_error_handler = XSetErrorHandler(_xf_error_handler);
|
||||
}
|
||||
|
||||
xfc->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||
|
||||
|
@ -1839,13 +1845,6 @@ BOOL xf_setup_x11(xfContext* xfc)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (xfc->debug)
|
||||
{
|
||||
WLog_INFO(TAG, "Enabling X11 debug mode.");
|
||||
XSynchronize(xfc->display, TRUE);
|
||||
_def_error_handler = XSetErrorHandler(_xf_error_handler);
|
||||
}
|
||||
|
||||
xf_check_extensions(xfc);
|
||||
|
||||
xfc->vscreen.monitors = calloc(16, sizeof(MONITOR_INFO));
|
||||
|
|
|
@ -1078,7 +1078,7 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
|||
case SelectionClear:
|
||||
{
|
||||
const XSelectionClearEvent* xevent = &event->xselectionclear;
|
||||
char* selection = XGetAtomName(xfc->display, xevent->selection);
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
WLog_Print(_log_cached_ptr, level, "got event %s [selection %s]",
|
||||
x11_event_string(event->type), selection);
|
||||
XFree(selection);
|
||||
|
@ -1087,9 +1087,9 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
|||
case SelectionNotify:
|
||||
{
|
||||
const XSelectionEvent* xevent = &event->xselection;
|
||||
char* selection = XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = XGetAtomName(xfc->display, xevent->property);
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(xfc->display, xevent->property);
|
||||
WLog_Print(_log_cached_ptr, level,
|
||||
"got event %s [selection %s, target %s, property %s]",
|
||||
x11_event_string(event->type), selection, target, property);
|
||||
|
@ -1101,9 +1101,9 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
|||
case SelectionRequest:
|
||||
{
|
||||
const XSelectionRequestEvent* xevent = &event->xselectionrequest;
|
||||
char* selection = XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = XGetAtomName(xfc->display, xevent->property);
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(xfc->display, xevent->property);
|
||||
WLog_Print(_log_cached_ptr, level,
|
||||
"got event %s [selection %s, target %s, property %s]",
|
||||
x11_event_string(event->type), selection, target, property);
|
||||
|
@ -1115,7 +1115,7 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
|||
case PropertyNotify:
|
||||
{
|
||||
const XPropertyEvent* xevent = &event->xproperty;
|
||||
char* atom = XGetAtomName(xfc->display, xevent->atom);
|
||||
char* atom = Safe_XGetAtomName(xfc->display, xevent->atom);
|
||||
WLog_Print(_log_cached_ptr, level, "got event %s [atom %s]",
|
||||
x11_event_string(event->type), atom);
|
||||
XFree(atom);
|
||||
|
|
|
@ -32,6 +32,13 @@ static void write_log(wLog* log, DWORD level, const char* fname, const char* fkt
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
char* Safe_XGetAtomName(Display* display, Atom atom)
|
||||
{
|
||||
if (atom == None)
|
||||
return strdup("Atom_None");
|
||||
return XGetAtomName(display, atom);
|
||||
}
|
||||
|
||||
int LogTagAndXChangeProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
|
||||
Display* display, Window w, Atom property, Atom type, int format,
|
||||
int mode, const unsigned char* data, int nelements)
|
||||
|
@ -47,8 +54,8 @@ int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, si
|
|||
{
|
||||
if (WLog_IsLevelActive(log, level))
|
||||
{
|
||||
char* propstr = XGetAtomName(display, property);
|
||||
char* typestr = XGetAtomName(display, type);
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
char* typestr = Safe_XGetAtomName(display, type);
|
||||
write_log(log, level, file, fkt, line,
|
||||
"XChangeProperty(%p, %d, %s [%d], %s [%d], %d, %d, %p, %d)", display, w, propstr,
|
||||
property, typestr, type, format, mode, data, nelements);
|
||||
|
@ -70,7 +77,7 @@ int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, si
|
|||
{
|
||||
if (WLog_IsLevelActive(log, level))
|
||||
{
|
||||
char* propstr = XGetAtomName(display, property);
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
write_log(log, level, file, fkt, line, "XDeleteProperty(%p, %d, %s [%d])", display, w,
|
||||
propstr, property);
|
||||
XFree(propstr);
|
||||
|
@ -100,8 +107,8 @@ int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt,
|
|||
{
|
||||
if (WLog_IsLevelActive(log, level))
|
||||
{
|
||||
char* propstr = XGetAtomName(display, property);
|
||||
char* req_type_str = XGetAtomName(display, req_type);
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
char* req_type_str = Safe_XGetAtomName(display, req_type);
|
||||
write_log(log, level, file, fkt, line,
|
||||
"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,
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
char* Safe_XGetAtomName(Display* display, Atom atom);
|
||||
|
||||
#define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \
|
||||
req_type, actual_type_return, actual_format_return, \
|
||||
nitems_return, bytes_after_return, prop_return) \
|
||||
|
|
Loading…
Reference in New Issue