FreeRDP
xf_utils.h
1 
20 #pragma once
21 
22 #include <winpr/wlog.h>
23 #include <winpr/wtypes.h>
24 
25 #include <X11/Xlib.h>
26 #include "xfreerdp.h"
27 
28 const char* x11_error_to_string(xfContext* xfc, int error, char* buffer, size_t size);
29 
30 #define X_GET_ATOM_VAR_NAME(x) #x
31 #define Safe_XGetAtomName(log, display, atom) \
32  Safe_XGetAtomNameEx((log), (display), (atom), X_GET_ATOM_VAR_NAME(atom))
33 char* Safe_XGetAtomNameEx(wLog* log, Display* display, Atom atom, const char* varname);
34 Atom Logging_XInternAtom(wLog* log, Display* display, _Xconst char* atom_name, Bool only_if_exists);
35 
36 typedef BOOL (*fn_action_script_run)(xfContext* xfc, const char* buffer, size_t size, void* user,
37  const char* what, const char* arg);
38 BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_action_script_run fkt,
39  void* user);
40 
41 #define LogTagAndXGetWindowProperty(tag, display, w, property, long_offset, long_length, delete, \
42  req_type, actual_type_return, actual_format_return, \
43  nitems_return, bytes_after_return, prop_return) \
44  LogTagAndXGetWindowProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), \
45  (property), (long_offset), (long_length), (delete), (req_type), \
46  (actual_type_return), (actual_format_return), (nitems_return), \
47  (bytes_after_return), (prop_return))
48 int LogTagAndXGetWindowProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
49  Display* display, Window w, Atom property, long long_offset,
50  long long_length, Bool delete, Atom req_type,
51  Atom* actual_type_return, int* actual_format_return,
52  unsigned long* nitems_return, unsigned long* bytes_after_return,
53  unsigned char** prop_return);
54 
55 #define LogDynAndXGetWindowProperty(log, display, w, property, long_offset, long_length, delete, \
56  req_type, actual_type_return, actual_format_return, \
57  nitems_return, bytes_after_return, prop_return) \
58  LogDynAndXGetWindowProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), \
59  (property), (long_offset), (long_length), (delete), (req_type), \
60  (actual_type_return), (actual_format_return), (nitems_return), \
61  (bytes_after_return), (prop_return))
62 int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt, size_t line,
63  Display* display, Window w, Atom property, long long_offset,
64  long long_length, Bool delete, Atom req_type,
65  Atom* actual_type_return, int* actual_format_return,
66  unsigned long* nitems_return, unsigned long* bytes_after_return,
67  unsigned char** prop_return);
68 
69 #define LogTagAndXChangeProperty(tag, display, w, property, type, format, mode, data, nelements) \
70  LogTagAndXChangeProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), (property), \
71  (type), (format), (mode), (data), (nelements))
72 int LogTagAndXChangeProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
73  Display* display, Window w, Atom property, Atom type, int format,
74  int mode, _Xconst unsigned char* data, int nelements);
75 
76 #define LogDynAndXChangeProperty(log, display, w, property, type, format, mode, data, nelements) \
77  LogDynAndXChangeProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property), \
78  (type), (format), (mode), (data), (nelements))
79 int LogDynAndXChangeProperty_ex(wLog* log, const char* file, const char* fkt, size_t line,
80  Display* display, Window w, Atom property, Atom type, int format,
81  int mode, _Xconst unsigned char* data, int nelements);
82 
83 #define LogTagAndXDeleteProperty(tag, display, w, property) \
84  LogTagAndXDeleteProperty_ex((tag), __FILE__, __func__, __LINE__, (display), (w), (property))
85 int LogTagAndXDeleteProperty_ex(const char* tag, const char* file, const char* fkt, size_t line,
86  Display* display, Window w, Atom property);
87 
88 #define LogDynAndXDeleteProperty(log, display, w, property) \
89  LogDynAndXDeleteProperty_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property))
90 int LogDynAndXDeleteProperty_ex(wLog* log, const char* file, const char* fkt, size_t line,
91  Display* display, Window w, Atom property);
92 
93 #define LogTagAndXConvertSelection(tag, display, selection, target, property, requestor, time) \
94  LogTagAndXConvertSelection_ex((tag), __FILE__, __func__, __LINE__, (display), (selection), \
95  (target), (property), (requestor), (time))
96 int LogTagAndXConvertSelection_ex(const char* tag, const char* file, const char* fkt, size_t line,
97  Display* display, Atom selection, Atom target, Atom property,
98  Window requestor, Time time);
99 
100 #define LogDynAndXConvertSelection(log, display, selection, target, property, requestor, time) \
101  LogDynAndXConvertSelection_ex((log), __FILE__, __func__, __LINE__, (display), (w), (property))
102 int LogDynAndXConvertSelection_ex(wLog* log, const char* file, const char* fkt, size_t line,
103  Display* display, Atom selection, Atom target, Atom property,
104  Window requestor, Time time);
105 
106 BOOL IsGnome(void);