Merge pull request #10319 from akallabeth/safe_atom_name_log
[client,X11] log atom numbers passed to XGetAtomName
This commit is contained in:
commit
b00b38abc2
@ -1126,7 +1126,8 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
||||
case SelectionClear:
|
||||
{
|
||||
const XSelectionClearEvent* xevent = &event->xselectionclear;
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
char* selection =
|
||||
Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->selection);
|
||||
WLog_Print(_log_cached_ptr, level, "got event %s [selection %s]",
|
||||
x11_event_string(event->type), selection);
|
||||
XFree(selection);
|
||||
@ -1135,9 +1136,10 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
||||
case SelectionNotify:
|
||||
{
|
||||
const XSelectionEvent* xevent = &event->xselection;
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(xfc->display, xevent->property);
|
||||
char* selection =
|
||||
Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(_log_cached_ptr, 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);
|
||||
@ -1149,9 +1151,10 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
||||
case SelectionRequest:
|
||||
{
|
||||
const XSelectionRequestEvent* xevent = &event->xselectionrequest;
|
||||
char* selection = Safe_XGetAtomName(xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(xfc->display, xevent->property);
|
||||
char* selection =
|
||||
Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->selection);
|
||||
char* target = Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->target);
|
||||
char* property = Safe_XGetAtomName(_log_cached_ptr, 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);
|
||||
@ -1163,7 +1166,7 @@ static void log_selection_event(xfContext* xfc, const XEvent* event)
|
||||
case PropertyNotify:
|
||||
{
|
||||
const XPropertyEvent* xevent = &event->xproperty;
|
||||
char* atom = Safe_XGetAtomName(xfc->display, xevent->atom);
|
||||
char* atom = Safe_XGetAtomName(_log_cached_ptr, xfc->display, xevent->atom);
|
||||
WLog_Print(_log_cached_ptr, level, "got event %s [atom %s]",
|
||||
x11_event_string(event->type), atom);
|
||||
XFree(atom);
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "xf_event.h"
|
||||
#include "xf_input.h"
|
||||
#include "xf_utils.h"
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/wtypes.h>
|
||||
@ -133,12 +134,16 @@ static BOOL register_input_events(xfContext* xfc, Window window)
|
||||
}
|
||||
case XIValuatorClass:
|
||||
{
|
||||
const XIValuatorClassInfo* t = (const XIValuatorClassInfo*)class;
|
||||
char* name = t->label ? XGetAtomName(xfc->display, t->label) : NULL;
|
||||
static wLog* log = NULL;
|
||||
if (!log)
|
||||
log = WLog_Get(TAG);
|
||||
|
||||
WLog_DBG(TAG, "%s device (id: %d) valuator %d label %s range %f - %f",
|
||||
dev->name, dev->deviceid, t->number, name ? name : "None", t->min,
|
||||
t->max);
|
||||
const XIValuatorClassInfo* t = (const XIValuatorClassInfo*)class;
|
||||
char* name = t->label ? Safe_XGetAtomName(log, xfc->display, t->label) : NULL;
|
||||
|
||||
WLog_Print(log, WLOG_DEBUG,
|
||||
"%s device (id: %d) valuator %d label %s range %f - %f", dev->name,
|
||||
dev->deviceid, t->number, name ? name : "None", t->min, t->max);
|
||||
free(name);
|
||||
|
||||
if (t->number == 2)
|
||||
|
@ -32,8 +32,9 @@ static void write_log(wLog* log, DWORD level, const char* fname, const char* fkt
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
char* Safe_XGetAtomName(Display* display, Atom atom)
|
||||
char* Safe_XGetAtomName(wLog* log, Display* display, Atom atom)
|
||||
{
|
||||
WLog_Print(log, log_level, "XGetAtomName(0x%08" PRIx32 ")", atom);
|
||||
if (atom == None)
|
||||
return strdup("Atom_None");
|
||||
return XGetAtomName(display, atom);
|
||||
@ -54,8 +55,8 @@ int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, si
|
||||
{
|
||||
if (WLog_IsLevelActive(log, log_level))
|
||||
{
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
char* typestr = Safe_XGetAtomName(display, type);
|
||||
char* propstr = Safe_XGetAtomName(log, display, property);
|
||||
char* typestr = Safe_XGetAtomName(log, display, type);
|
||||
write_log(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);
|
||||
@ -77,7 +78,7 @@ int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, si
|
||||
{
|
||||
if (WLog_IsLevelActive(log, log_level))
|
||||
{
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
char* propstr = Safe_XGetAtomName(log, display, property);
|
||||
write_log(log, log_level, file, fkt, line, "XDeleteProperty(%p, %d, %s [%d])", display, w,
|
||||
propstr, property);
|
||||
XFree(propstr);
|
||||
@ -107,8 +108,8 @@ int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt,
|
||||
{
|
||||
if (WLog_IsLevelActive(log, log_level))
|
||||
{
|
||||
char* propstr = Safe_XGetAtomName(display, property);
|
||||
char* req_type_str = Safe_XGetAtomName(display, req_type);
|
||||
char* propstr = Safe_XGetAtomName(log, display, property);
|
||||
char* req_type_str = Safe_XGetAtomName(log, display, req_type);
|
||||
write_log(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,7 +23,7 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
char* Safe_XGetAtomName(Display* display, Atom atom);
|
||||
char* Safe_XGetAtomName(wLog* log, Display* display, Atom atom);
|
||||
|
||||
#define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \
|
||||
req_type, actual_type_return, actual_format_return, \
|
||||
|
Loading…
Reference in New Issue
Block a user