mirror of https://github.com/FreeRDP/FreeRDP
[client,x11] add helper util x11_error_to_string
The helper function x11_error_to_string stringifies a X11 error return code.
This commit is contained in:
parent
f67e641cce
commit
2b1abcd550
|
@ -226,3 +226,13 @@ fail:
|
||||||
pclose(keyScript);
|
pclose(keyScript);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* x11_error_to_string(xfContext* xfc, int error, char* buffer, size_t size)
|
||||||
|
{
|
||||||
|
WINPR_ASSERT(xfc);
|
||||||
|
WINPR_ASSERT(size <= INT32_MAX);
|
||||||
|
const int rc = XGetErrorText(xfc->display, error, buffer, (int)size);
|
||||||
|
if (rc)
|
||||||
|
WLog_WARN(TAG, "XGetErrorText returned %d", rc);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include "xfreerdp.h"
|
#include "xfreerdp.h"
|
||||||
|
|
||||||
|
const char* x11_error_to_string(xfContext* xfc, int error, char* buffer, size_t size);
|
||||||
|
|
||||||
#define X_GET_ATOM_VAR_NAME(x) #x
|
#define X_GET_ATOM_VAR_NAME(x) #x
|
||||||
#define Safe_XGetAtomName(log, display, atom) \
|
#define Safe_XGetAtomName(log, display, atom) \
|
||||||
Safe_XGetAtomNameEx((log), (display), (atom), X_GET_ATOM_VAR_NAME(atom))
|
Safe_XGetAtomNameEx((log), (display), (atom), X_GET_ATOM_VAR_NAME(atom))
|
||||||
|
|
Loading…
Reference in New Issue