summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv/clipboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sesman/chansrv/clipboard.c')
-rw-r--r--sesman/chansrv/clipboard.c483
1 files changed, 255 insertions, 228 deletions
diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c
index 3aac8dbc..c2062605 100644
--- a/sesman/chansrv/clipboard.c
+++ b/sesman/chansrv/clipboard.c
@@ -172,17 +172,45 @@ x-special/gnome-copied-files
#include "xcommon.h"
#include "chansrv_fuse.h"
-#define LLOG_LEVEL 11
-#define LLOGLN(_level, _args) \
- do \
- { \
- if (_level < LLOG_LEVEL) \
- { \
- g_write("chansrv:clip [%10.10u]: ", g_time3()); \
- g_writeln _args ; \
- } \
- } \
- while (0)
+/* module based logging */
+#define LOG_ERROR 0
+#define LOG_INFO 1
+#define LOG_DEBUG 2
+#define LOG_LEVEL LOG_ERROR
+
+#define log_error(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ERROR: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_always(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ALWAYS: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_info(_params...) \
+{ \
+ if (LOG_INFO <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
+
+#define log_debug(_params...) \
+{ \
+ if (LOG_DEBUG <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
static char g_bmp_image_header[] =
{
@@ -302,7 +330,7 @@ clipboard_init(void)
int ver_min;
Status st;
- LOGM((LOG_LEVEL_DEBUG, "xrdp-chansrv: in clipboard_init"));
+ log_debug("xrdp-chansrv: in clipboard_init");
if (g_clip_up)
{
@@ -321,7 +349,7 @@ clipboard_init(void)
if (g_clipboard_atom == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: XInternAtom failed"));
+ log_error("clipboard_init: XInternAtom failed");
rv = 3;
}
}
@@ -330,18 +358,18 @@ clipboard_init(void)
{
if (!XFixesQueryExtension(g_display, &g_xfixes_event_base, &dummy))
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: no xfixes"));
+ log_error("clipboard_init: no xfixes");
rv = 5;
}
}
if (rv == 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: g_xfixes_event_base %d",
- g_xfixes_event_base));
+ log_debug("clipboard_init: g_xfixes_event_base %d",
+ g_xfixes_event_base);
st = XFixesQueryVersion(g_display, &ver_maj, &ver_min);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init st %d, maj %d min %d", st,
- ver_maj, ver_min));
+ log_debug("clipboard_init st %d, maj %d min %d", st,
+ ver_maj, ver_min);
g_clip_property_atom = XInternAtom(g_display, "XRDP_CLIP_PROPERTY_ATOM",
False);
g_get_time_atom = XInternAtom(g_display, "XRDP_GET_TIME_ATOM",
@@ -360,8 +388,8 @@ clipboard_init(void)
if (g_image_bmp_atom == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: g_image_bmp_atom was "
- "not allocated"));
+ log_error("clipboard_init: g_image_bmp_atom was "
+ "not allocated");
}
g_wnd = XCreateSimpleWindow(g_display, RootWindowOfScreen(g_screen),
@@ -395,13 +423,13 @@ clipboard_init(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: data out, sending "
- "CB_CLIP_CAPS (clip_msg_id = 1)"));
+ log_debug("clipboard_init: data out, sending "
+ "CB_CLIP_CAPS (clip_msg_id = 1)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: send_channel_data failed "
- "rv = %d", rv));
+ log_error("clipboard_init: send_channel_data failed "
+ "rv = %d", rv);
rv = 4;
}
}
@@ -416,13 +444,13 @@ clipboard_init(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: data out, sending "
- "CB_MONITOR_READY (clip_msg_id = 1)"));
+ log_debug("clipboard_init: data out, sending "
+ "CB_MONITOR_READY (clip_msg_id = 1)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: send_channel_data failed "
- "rv = %d", rv));
+ log_error("clipboard_init: send_channel_data failed "
+ "rv = %d", rv);
rv = 4;
}
}
@@ -436,7 +464,7 @@ clipboard_init(void)
}
else
{
- LOGM((LOG_LEVEL_ERROR, "xrdp-chansrv: clipboard_init: error on exit"));
+ log_error("xrdp-chansrv: clipboard_init: error on exit");
}
return rv;
@@ -446,7 +474,7 @@ clipboard_init(void)
int APP_CC
clipboard_deinit(void)
{
- LLOGLN(10, ("clipboard_deinit:"));
+ log_debug("clipboard_deinit:");
if (g_wnd != 0)
{
XDestroyWindow(g_display, g_wnd);
@@ -474,8 +502,8 @@ clipboard_send_data_request(int format_id)
int size;
int rv;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_request:"));
- LLOGLN(0, ("clipboard_send_data_request: %d", format_id));
+ log_debug("clipboard_send_data_request:");
+ log_debug("clipboard_send_data_request: %d", format_id);
g_clip_c2s.in_request = 1;
make_stream(s);
init_stream(s, 8192);
@@ -486,8 +514,8 @@ clipboard_send_data_request(int format_id)
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_request: data out, sending "
- "CLIPRDR_DATA_REQUEST (clip_msg_id = 4)"));
+ log_debug("clipboard_send_data_request: data out, sending "
+ "CLIPRDR_DATA_REQUEST (clip_msg_id = 4)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -509,8 +537,8 @@ clipboard_send_format_ack(void)
out_uint32_le(s, 0); /* extra 4 bytes */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_format_ack: data out, sending "
- "CLIPRDR_FORMAT_ACK (clip_msg_id = 3)"));
+ log_debug("clipboard_send_format_ack: data out, sending "
+ "CLIPRDR_FORMAT_ACK (clip_msg_id = 3)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -601,7 +629,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
int rv;
char *holdp;
- LLOGLN(10, ("clipboard_send_format_announce:"));
+ log_debug("clipboard_send_format_announce:");
make_stream(s);
init_stream(s, 8192);
out_uint16_le(s, CB_FORMAT_LIST); /* 2 CLIPRDR_FORMAT_ANNOUNCE */
@@ -613,7 +641,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
switch (xrdp_clip_type)
{
case XRDP_CB_FILE:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_FILE"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_FILE");
/* canned response for "file" */
out_uint32_le(s, 0x0000c0bc);
clipboard_out_unicode(s, "FileGroupDescriptorW", 21);
@@ -623,7 +651,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "DropEffect", 11);
break;
case XRDP_CB_BITMAP:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_BITMAP"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_BITMAP");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000c004);
clipboard_out_unicode(s, "Native", 7);
@@ -635,7 +663,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "", 1);
break;
case XRDP_CB_TEXT:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_TEXT"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_TEXT");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000000d);
clipboard_out_unicode(s, "", 1);
@@ -647,8 +675,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "", 1);
break;
default:
- LLOGLN(10, ("clipboard_send_format_announce: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_format_announce: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
break;
}
}
@@ -657,7 +685,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
switch (xrdp_clip_type)
{
case XRDP_CB_FILE:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_FILE"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_FILE");
/* canned response for "file" */
out_uint32_le(s, 0x0000c0bc);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -667,7 +695,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
case XRDP_CB_BITMAP:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_BITMAP"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_BITMAP");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000c004);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -679,7 +707,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
case XRDP_CB_TEXT:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_TEXT"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_TEXT");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000000d);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -691,8 +719,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
default:
- LLOGLN(10, ("clipboard_send_format_announce: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_format_announce: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
break;
}
}
@@ -706,8 +734,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
s_mark_end(s);
size = (int)(s->end - s->data);
//g_hexdump(s->data, size);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_format_announce: data out, sending "
- "CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)"));
+ log_debug("clipboard_send_format_announce: data out, sending "
+ "CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -721,8 +749,8 @@ clipboard_send_data_response_for_image(char* data, int data_size)
int size;
int rv;
- LLOGLN(10, ("clipboard_send_data_response_for_image: data_size %d",
- data_size));
+ log_debug("clipboard_send_data_response_for_image: data_size %d",
+ data_size);
make_stream(s);
init_stream(s, 64 + data_size);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -746,18 +774,18 @@ clipboard_send_data_response_for_text(char* data, int data_size)
int rv;
int num_chars;
- LLOGLN(10, ("clipboard_send_data_response_for_text: data_size %d",
- data_size));
+ log_debug("clipboard_send_data_response_for_text: data_size %d",
+ data_size);
//g_hexdump(data, data_size);
num_chars = g_mbstowcs(0, data, 0);
if (num_chars < 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_response_for_text: "
- "bad string"));
+ log_error("clipboard_send_data_response_for_text: "
+ "bad string");
num_chars = 0;
}
- LLOGLN(10, ("clipboard_send_data_response_for_text: data_size %d "
- "num_chars %d", data_size, num_chars));
+ log_debug("clipboard_send_data_response_for_text: data_size %d "
+ "num_chars %d", data_size, num_chars);
make_stream(s);
init_stream(s, 64 + num_chars * 2);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -765,16 +793,16 @@ clipboard_send_data_response_for_text(char* data, int data_size)
out_uint32_le(s, num_chars * 2 + 2); /* length */
if (clipboard_out_unicode(s, data, num_chars) != num_chars * 2)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_response_for_text: error "
- "clipboard_out_unicode didn't write right number of bytes"));
+ log_error("clipboard_send_data_response_for_text: error "
+ "clipboard_out_unicode didn't write right number of bytes");
}
out_uint16_le(s, 0); /* nil for string */
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_response_for_text: data out, "
+ log_debug("clipboard_send_data_response_for_text: data out, "
"sending CLIPRDR_DATA_RESPONSE (clip_msg_id = 5) size %d "
- "num_chars %d", size, num_chars));
+ "num_chars %d", size, num_chars);
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -784,7 +812,7 @@ clipboard_send_data_response_for_text(char* data, int data_size)
static int APP_CC
clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
{
- LLOGLN(10, ("clipboard_send_data_response:"));
+ log_debug("clipboard_send_data_response:");
if (data != 0)
{
if (xrdp_clip_type == XRDP_CB_FILE)
@@ -801,13 +829,13 @@ clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
}
else
{
- LLOGLN(0, ("clipboard_send_data_response: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_data_response: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
}
}
else
{
- LLOGLN(0, ("clipboard_send_data_response: data is nil"));
+ log_error("clipboard_send_data_response: data is nil");
}
return 0;
}
@@ -818,7 +846,7 @@ clipboard_set_selection_owner(void)
{
Window owner;
- LLOGLN(10, ("clipboard_set_selection_owner:"));
+ log_debug("clipboard_set_selection_owner:");
g_selection_time = clipboard_get_server_time();
XSetSelectionOwner(g_display, g_clipboard_atom, g_wnd, g_selection_time);
owner = XGetSelectionOwner(g_display, g_clipboard_atom);
@@ -840,8 +868,8 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
XEvent xev;
long val1[2];
- LLOGLN(10, ("clipboard_provide_selection_c2s: bytes %d",
- g_clip_c2s.total_bytes));
+ log_debug("clipboard_provide_selection_c2s: bytes %d",
+ g_clip_c2s.total_bytes);
if (g_clip_c2s.total_bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@@ -866,9 +894,9 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
g_clip_c2s.type = type;
g_clip_c2s.property = req->property;
g_clip_c2s.window = req->requestor;
- LLOGLN(10, ("clipboard_provide_selection_c2s: start INCR property %s "
+ log_debug("clipboard_provide_selection_c2s: start INCR property %s "
"type %s", XGetAtomName(g_display, req->property),
- XGetAtomName(g_display, type)));
+ XGetAtomName(g_display, type));
val1[0] = g_clip_c2s.total_bytes;
val1[1] = 0;
XChangeProperty(g_display, req->requestor, req->property,
@@ -899,7 +927,7 @@ clipboard_provide_selection(XSelectionRequestEvent *req, Atom type, int format,
bytes = FORMAT_TO_BYTES(format);
bytes *= length;
- LLOGLN(10, ("clipboard_provide_selection: bytes %d", bytes));
+ log_debug("clipboard_provide_selection: bytes %d", bytes);
if (bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@@ -952,9 +980,9 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
char desc[256];
char *holdp;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_format_announce: "
- "CLIPRDR_FORMAT_ANNOUNCE"));
- LLOGLN(10, ("clipboard_process_format_announce %d", clip_msg_len));
+ log_debug("clipboard_process_format_announce: "
+ "CLIPRDR_FORMAT_ANNOUNCE");
+ log_debug("clipboard_process_format_announce %d", clip_msg_len);
clipboard_send_format_ack();
xfuse_clear_clip_dir();
@@ -984,14 +1012,14 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
desc[15] = 0;
clip_msg_len -= 32;
}
- LLOGLN(10, ("clipboard_process_format_announce: formatId 0x%8.8x "
+ log_debug("clipboard_process_format_announce: formatId 0x%8.8x "
"wszFormatName [%s] clip_msg_len %d", formatId, desc,
- clip_msg_len));
+ clip_msg_len);
g_formatIds[g_num_formatIds] = formatId;
g_num_formatIds++;
if (g_num_formatIds > 15)
{
- LLOGLN(10, ("clipboard_process_format_announce: max formats"));
+ log_debug("clipboard_process_format_announce: max formats");
}
/* format id for file copy copy seems to keep changing */
@@ -1008,8 +1036,8 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
{
if (clipboard_set_selection_owner() != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_process_format_announce: "
- "XSetSelectionOwner failed"));
+ log_error("clipboard_process_format_announce: "
+ "XSetSelectionOwner failed");
}
}
@@ -1023,8 +1051,8 @@ static int APP_CC
clipboard_prcoess_format_ack(struct stream *s, int clip_msg_status,
int clip_msg_len)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK"));
- LLOGLN(10, ("clipboard_prcoess_format_ack:"));
+ log_debug("clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK");
+ log_debug("clipboard_prcoess_format_ack:");
return 0;
}
@@ -1036,7 +1064,7 @@ clipboard_send_data_response_failed(void)
int size;
int rv;
- LLOGLN(10, ("clipboard_send_data_response_failed:"));
+ log_error("clipboard_send_data_response_failed:");
make_stream(s);
init_stream(s, 64);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -1059,24 +1087,24 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
{
int requestedFormatId;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_request: "
- "CLIPRDR_DATA_REQUEST"));
- LLOGLN(10, ("clipboard_process_data_request:"));
- LLOGLN(10, (" %d", g_clip_s2c.xrdp_clip_type));
+ log_debug("clipboard_process_data_request: "
+ "CLIPRDR_DATA_REQUEST");
+ log_debug("clipboard_process_data_request:");
+ log_debug(" %d", g_clip_s2c.xrdp_clip_type);
in_uint32_le(s, requestedFormatId);
switch (requestedFormatId)
{
case CB_FORMAT_FILE: /* 0xC0BC */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_FILE) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_FILE");
clipboard_send_data_response(XRDP_CB_FILE, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE, "
- "calling XConvertSelection to g_utf8_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_FILE, "
+ "calling XConvertSelection to g_utf8_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_FILE;
XConvertSelection(g_display, g_clipboard_atom, g_clip_s2c.type,
g_clip_property_atom, g_wnd, CurrentTime);
@@ -1085,14 +1113,14 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
case CB_FORMAT_DIB: /* 0x0008 */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_BITMAP) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_DIB");
clipboard_send_data_response(XRDP_CB_BITMAP, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB, "
- "calling XConvertSelection to g_image_bmp_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_DIB, "
+ "calling XConvertSelection to g_image_bmp_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_BITMAP;
XConvertSelection(g_display, g_clipboard_atom, g_image_bmp_atom,
g_clip_property_atom, g_wnd, CurrentTime);
@@ -1101,22 +1129,22 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
case CB_FORMAT_UNICODETEXT: /* 0x000D */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_TEXT) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_UNICODETEXT");
clipboard_send_data_response(XRDP_CB_TEXT, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
- "calling XConvertSelection to g_utf8_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
+ "calling XConvertSelection to g_utf8_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_TEXT;
XConvertSelection(g_display, g_clipboard_atom, g_utf8_atom,
g_clip_property_atom, g_wnd, CurrentTime);
}
break;
default:
- LLOGLN(10, ("clipboard_process_data_request: unknown type %d",
- requestedFormatId));
+ log_debug("clipboard_process_data_request: unknown type %d",
+ requestedFormatId);
clipboard_send_data_response_failed();
break;
}
@@ -1137,8 +1165,8 @@ clipboard_process_data_response_for_image(struct stream *s,
XSelectionRequestEvent *lxev;
int len;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_response_for_image: "
- "CLIPRDR_DATA_RESPONSE_FOR_IMAGE"));
+ log_debug("clipboard_process_data_response_for_image: "
+ "CLIPRDR_DATA_RESPONSE_FOR_IMAGE");
lxev = &g_saved_selection_req_event;
len = (int)(s->end - s->p);
if (len < 1)
@@ -1160,8 +1188,8 @@ clipboard_process_data_response_for_image(struct stream *s,
g_clip_c2s.read_bytes_done = g_clip_c2s.total_bytes;
g_memcpy(g_clip_c2s.data, g_bmp_image_header, 14);
in_uint8a(s, g_clip_c2s.data + 14, len);
- LLOGLN(10, ("clipboard_process_data_response_for_image: calling "
- "clipboard_provide_selection_c2s"));
+ log_debug("clipboard_process_data_response_for_image: calling "
+ "clipboard_provide_selection_c2s");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -1183,7 +1211,7 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
int len;
int index;
- LLOGLN(10, ("clipboard_process_data_response:"));
+ log_debug("clipboard_process_data_response:");
lxev = &g_saved_selection_req_event;
g_clip_c2s.in_request = 0;
if (g_clip_c2s.xrdp_clip_type == XRDP_CB_BITMAP)
@@ -1209,15 +1237,15 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
}
else
{
- LLOGLN(0, ("clipboard_process_data_response: error"));
+ log_error("clipboard_process_data_response: error");
}
g_clip_c2s.total_bytes = g_strlen(g_clip_c2s.data);
g_clip_c2s.read_bytes_done = g_clip_c2s.total_bytes;
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_response: "
- "CLIPRDR_DATA_RESPONSE"));
+ log_debug("clipboard_process_data_response: "
+ "CLIPRDR_DATA_RESPONSE");
len = (int)(s->end - s->p);
if (len < 1)
{
@@ -1277,7 +1305,7 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
int flags;
char *holdp;
- LLOGLN(10, ("clipboard_process_clip_caps:"));
+ log_debug("clipboard_process_clip_caps:");
//g_hexdump(s->p, s->end - s->p);
in_uint16_le(s, cCapabilitiesSets);
in_uint8s(s, 2); /* pad */
@@ -1291,11 +1319,11 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
case CB_CAPSTYPE_GENERAL:
in_uint32_le(s, version); /* version */
in_uint32_le(s, flags); /* generalFlags */
- LLOGLN(0, ("clipboard_process_clip_caps: "
+ log_debug("clipboard_process_clip_caps: "
"g_cliprdr_version %d version %d "
"g_cliprdr_flags 0x%x flags 0x%x",
g_cliprdr_version, version,
- g_cliprdr_flags, flags));
+ g_cliprdr_flags, flags);
if (version < g_cliprdr_version)
{
g_cliprdr_version = version;
@@ -1303,8 +1331,8 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
g_cliprdr_flags &= flags;
break;
default:
- LLOGLN(0, ("clipboard_process_clip_caps: unknown "
- "capabilitySetType %d", capabilitySetType));
+ log_debug("clipboard_process_clip_caps: unknown "
+ "capabilitySetType %d", capabilitySetType);
break;
}
s->p = holdp + lengthCapability;
@@ -1319,10 +1347,10 @@ ss_part(char *data, int data_bytes)
int index;
char *text;
- LLOGLN(10, ("ss_part: data_bytes %d read_bytes_done %d "
+ log_debug("ss_part: data_bytes %d read_bytes_done %d "
"incr_bytes_done %d", data_bytes,
g_clip_c2s.read_bytes_done,
- g_clip_c2s.incr_bytes_done));
+ g_clip_c2s.incr_bytes_done);
/* copy to buffer */
if (g_clip_c2s.type == g_utf8_atom)
{
@@ -1347,12 +1375,12 @@ ss_part(char *data, int data_bytes)
}
if (g_clip_c2s.incr_in_progress)
{
- LLOGLN(10, ("ss_part: incr_in_progress set"));
+ log_debug("ss_part: incr_in_progress set");
return 0;
}
if (g_clip_c2s.read_bytes_done <= g_clip_c2s.incr_bytes_done)
{
- LLOGLN(10, ("ss_part: read_bytes_done < incr_bytes_done"));
+ log_debug("ss_part: read_bytes_done < incr_bytes_done");
return 0;
}
data = g_clip_c2s.data + g_clip_c2s.incr_bytes_done;
@@ -1376,18 +1404,18 @@ ss_end(void)
char *data;
int data_bytes;
- LLOGLN(10, ("ss_end:"));
+ log_debug("ss_end:");
g_clip_c2s.doing_response_ss = 0;
g_clip_c2s.in_request = 0;
if (g_clip_c2s.incr_in_progress)
{
- LLOGLN(10, ("ss_end: incr_in_progress set"));
+ log_debug("ss_end: incr_in_progress set");
return 0;
}
if (g_clip_c2s.read_bytes_done <= g_clip_c2s.incr_bytes_done)
{
- LLOGLN(10, ("ss_end: read_bytes_done < incr_bytes_done"));
+ log_debug("ss_end: read_bytes_done < incr_bytes_done");
return 0;
}
data = g_clip_c2s.data + g_clip_c2s.incr_bytes_done;
@@ -1413,8 +1441,8 @@ ss_start(char *data, int data_bytes, int total_bytes)
long val1[2];
int incr_bytes;
- LLOGLN(10, ("ss_start: data_bytes %d total_bytes %d",
- data_bytes, total_bytes));
+ log_debug("ss_start: data_bytes %d total_bytes %d",
+ data_bytes, total_bytes);
req = &g_saved_selection_req_event;
incr_bytes = total_bytes;
@@ -1481,24 +1509,24 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
if (!g_clip_up)
{
- LOG(10, ("aborting clipboard_data_in - clipboard has not "
- "been initialized"));
+ log_error("aborting clipboard_data_in - clipboard has not "
+ "been initialized");
/* we return 0 here to indicate no protocol problem occured */
return 0;
}
- LLOGLN(10, ("clipboard_data_in: chan_id %d "
+ log_debug("clipboard_data_in: chan_id %d "
"chan_flags 0x%x length %d total_length %d "
"in_request %d g_ins->size %d",
chan_id, chan_flags, length, total_length,
- g_clip_c2s.in_request, g_ins->size));
+ g_clip_c2s.in_request, g_ins->size);
if (g_clip_c2s.doing_response_ss)
{
ss_part(s->p, length);
if ((chan_flags & 3) == 2)
{
- LLOGLN(10, ("clipboard_data_in: calling ss_end"));
+ log_debug("clipboard_data_in: calling ss_end");
ss_end();
}
return 0;
@@ -1550,12 +1578,12 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
in_uint16_le(ls, clip_msg_status);
in_uint32_le(ls, clip_msg_len);
- LOG(10, ("clipboard_data_in: clip_msg_id %d "
+ log_debug("clipboard_data_in: clip_msg_id %d "
"clip_msg_status %d clip_msg_len %d",
- clip_msg_id, clip_msg_status, clip_msg_len));
+ clip_msg_id, clip_msg_status, clip_msg_len);
rv = 0;
- LLOGLN(0, ("clipboard_data_in: %d", clip_msg_id));
+ log_debug("clipboard_data_in: %d", clip_msg_id);
switch (clip_msg_id)
{
/* sent by client or server when its local system clipboard is */
@@ -1599,9 +1627,9 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
clip_msg_len);
break;
default:
- LLOGLN(0, ("clipboard_data_in: unknown clip_msg_id %d", clip_msg_id));
- LOGM((LOG_LEVEL_ERROR, "clipboard_data_in: unknown clip_msg_id %d",
- clip_msg_id));
+ log_debug("clipboard_data_in: unknown clip_msg_id %d", clip_msg_id);
+ log_error("clipboard_data_in: unknown clip_msg_id %d",
+ clip_msg_id);
break;
}
@@ -1631,16 +1659,16 @@ clipboard_event_selection_owner_notify(XEvent *xevent)
XFixesSelectionNotifyEvent *lxevent;
lxevent = (XFixesSelectionNotifyEvent *)xevent;
- LLOGLN(10, ("clipboard_event_selection_owner_notify: %p", lxevent->owner));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: "
+ log_debug("clipboard_event_selection_owner_notify: %p", lxevent->owner);
+ log_debug("clipboard_event_selection_owner_notify: "
"window %d subtype %d owner %d g_wnd %d",
- lxevent->window, lxevent->subtype, lxevent->owner, g_wnd));
+ lxevent->window, lxevent->subtype, lxevent->owner, g_wnd);
if (lxevent->owner == g_wnd)
{
- LLOGLN(10, ("clipboard_event_selection_owner_notify: matches g_wnd"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: skipping, "
- "onwer == g_wnd"));
+ log_debug("clipboard_event_selection_owner_notify: matches g_wnd");
+ log_debug("clipboard_event_selection_owner_notify: skipping, "
+ "onwer == g_wnd");
g_got_selection = 1;
return 0;
}
@@ -1668,8 +1696,8 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt,
tui8 *lxdata;
Atom ltype;
- LLOGLN(10, ("clipboard_get_window_property:"));
- LLOGLN(10, (" prop %d name %s", prop, XGetAtomName(g_display, prop)));
+ log_debug("clipboard_get_window_property:");
+ log_debug(" prop %d name %s", prop, XGetAtomName(g_display, prop));
lxdata = 0;
ltype = 0;
XGetWindowProperty(g_display, wnd, prop, 0, 0, 0,
@@ -1784,8 +1812,7 @@ clipboard_event_selection_notify(XEvent *xevent)
Atom *atoms;
Atom type;
- LLOGLN(10, ("clipboard_event_selection_notify:"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify:"));
+ log_debug("clipboard_event_selection_notify:");
data_size = 0;
n_items = 0;
fmt = 0;
@@ -1801,23 +1828,23 @@ clipboard_event_selection_notify(XEvent *xevent)
if (lxevent->property == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: clip could "
- "not be converted"));
+ log_error("clipboard_event_selection_notify: clip could "
+ "not be converted");
rv = 1;
}
if (rv == 0)
{
- LLOGLN(10, ("clipboard_event_selection_notify: wnd %p prop %s",
+ log_debug("clipboard_event_selection_notify: wnd %p prop %s",
lxevent->requestor,
- XGetAtomName(g_display, lxevent->property)));
+ XGetAtomName(g_display, lxevent->property));
rv = clipboard_get_window_property(lxevent->requestor, lxevent->property,
&type, &fmt,
&n_items, &data, &data_size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "clipboard_get_window_property failed error %d", rv));
+ log_error("clipboard_event_selection_notify: "
+ "clipboard_get_window_property failed error %d", rv);
return 0;
}
//g_hexdump(data, data_size);
@@ -1826,10 +1853,10 @@ clipboard_event_selection_notify(XEvent *xevent)
{
/* nothing more to do here, the data is comming in through
PropertyNotify */
- LLOGLN(10, ("clipboard_event_selection_notify: type is INCR "
+ log_debug("clipboard_event_selection_notify: type is INCR "
"data_size %d property name %s type %s", data_size,
XGetAtomName(g_display, lxevent->property),
- XGetAtomName(g_display, lxevent->type)));
+ XGetAtomName(g_display, lxevent->type));
g_clip_s2c.incr_in_progress = 1;
g_clip_s2c.property = lxevent->property;
g_clip_s2c.type = lxevent->target;
@@ -1855,10 +1882,10 @@ clipboard_event_selection_notify(XEvent *xevent)
for (index = 0; index < n_items; index++)
{
atom = atoms[index];
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d",
- atom, XGetAtomName(g_display, atom), XA_STRING));
- LLOGLN(10, ("clipboard_event_selection_notify: 0x%x %s",
- atom, XGetAtomName(g_display, atom)));
+ log_debug("clipboard_event_selection_notify: %d %s %d",
+ atom, XGetAtomName(g_display, atom), XA_STRING);
+ log_debug("clipboard_event_selection_notify: 0x%x %s",
+ atom, XGetAtomName(g_display, atom));
if (atom == g_utf8_atom)
{
got_utf8 = 1;
@@ -1873,28 +1900,28 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if ((atom == g_file_atom1) || (atom == g_file_atom2))
{
- LLOGLN(10, ("clipboard_event_selection_notify: file"));
+ log_debug("clipboard_event_selection_notify: file");
got_file_atom = atom;
}
else
{
- LLOGLN(10, ("clipboard_event_selection_notify: unknown atom 0x%x", atom));
+ log_error("clipboard_event_selection_notify: unknown atom 0x%x", atom);
}
}
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: error, "
+ log_error("clipboard_event_selection_notify: error, "
"target is 'TARGETS' and type[%d] or fmt[%d] not right, "
- "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32));
+ "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32);
}
}
else if (lxevent->target == g_utf8_atom)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: UTF8_STRING "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: UTF8_STRING "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: UTF8_STRING "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: UTF8_STRING "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1916,10 +1943,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == XA_STRING)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: XA_STRING "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: XA_STRING "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: XA_STRING "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: XA_STRING "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1933,10 +1960,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_image_bmp_atom)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: image/bmp "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: image/bmp "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: image/bmp "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: image/bmp "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 14))
{
g_free(g_clip_s2c.data);
@@ -1949,10 +1976,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_file_atom1)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1966,10 +1993,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_file_atom2)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1983,14 +2010,14 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "unknown target"));
+ log_error("clipboard_event_selection_notify: "
+ "unknown target");
}
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "unknown selection"));
+ log_error("clipboard_event_selection_notify: "
+ "unknown selection");
}
}
@@ -2074,26 +2101,26 @@ clipboard_event_selection_request(XEvent *xevent)
char *xdata;
lxev = (XSelectionRequestEvent *)xevent;
- LLOGLN(10, ("clipboard_event_selection_request: %p", lxev->property));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_wnd %d, "
+ log_debug("clipboard_event_selection_request: %p", lxev->property);
+ log_debug("clipboard_event_selection_request: g_wnd %d, "
".requestor %d .owner %d .selection %d '%s' .target %d .property %d",
g_wnd, lxev->requestor, lxev->owner, lxev->selection,
XGetAtomName(g_display, lxev->selection),
- lxev->target, lxev->property));
+ lxev->target, lxev->property);
if (lxev->property == None)
{
- LLOGLN(10, ("clipboard_event_selection_request: lxev->property "
- "is None"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "lxev->property is None"));
+ log_debug("clipboard_event_selection_request: lxev->property "
+ "is None");
+ log_debug("clipboard_event_selection_request: "
+ "lxev->property is None");
}
else if (lxev->target == g_targets_atom)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_targets_atom"));
+ log_debug("clipboard_event_selection_request: g_targets_atom");
/* requestor is asking what the selection can be converted to */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_targets_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_targets_atom");
atom_buf[0] = g_targets_atom;
atom_buf[1] = g_timestamp_atom;
atom_buf[2] = g_multiple_atom;
@@ -2102,29 +2129,29 @@ clipboard_event_selection_request(XEvent *xevent)
atom_count = 5;
if (clipboard_find_format_id(CB_FORMAT_DIB) >= 0)
{
- LLOGLN(10, (" reporting image/bmp"));
+ log_debug(" reporting image/bmp");
atom_buf[atom_count] = g_image_bmp_atom;
atom_count++;
}
if (clipboard_find_format_id(g_file_format_id) >= 0)
{
- LLOGLN(10, (" reporting text/uri-list"));
+ log_debug(" reporting text/uri-list");
atom_buf[atom_count] = g_file_atom1;
atom_count++;
- LLOGLN(10, (" reporting x-special/gnome-copied-files"));
+ log_debug(" reporting x-special/gnome-copied-files");
atom_buf[atom_count] = g_file_atom2;
atom_count++;
}
atom_buf[atom_count] = 0;
- LLOGLN(10, (" reporting %d formats", atom_count));
+ log_debug(" reporting %d formats", atom_count);
return clipboard_provide_selection(lxev, XA_ATOM, 32,
(char *)atom_buf, atom_count);
}
else if (lxev->target == g_timestamp_atom)
{
/* requestor is asking the time I got the selection */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_timestamp_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_timestamp_atom");
atom_buf[0] = g_selection_time;
atom_buf[1] = 0;
return clipboard_provide_selection(lxev, XA_INTEGER, 32,
@@ -2133,8 +2160,8 @@ clipboard_event_selection_request(XEvent *xevent)
else if (lxev->target == g_multiple_atom)
{
/* target, property pairs */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_multiple_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_multiple_atom");
xdata = 0;
if (clipboard_get_window_property(xev.xselection.requestor,
@@ -2142,8 +2169,8 @@ clipboard_event_selection_request(XEvent *xevent)
&type, &fmt, &n_items, &xdata,
&xdata_size) == 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_multiple_atom "
- "n_items %d", n_items));
+ log_debug("clipboard_event_selection_request: g_multiple_atom "
+ "n_items %d", n_items);
/* todo */
g_free(xdata);
}
@@ -2159,10 +2186,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_image_bmp_atom)
{
- LLOGLN(10, ("clipboard_event_selection_request: image/bmp"));
+ log_debug("clipboard_event_selection_request: image/bmp");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2175,10 +2202,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_file_atom1)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_file_atom1"));
+ log_debug("clipboard_event_selection_request: g_file_atom1");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2191,10 +2218,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_file_atom2)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_file_atom2"));
+ log_debug("clipboard_event_selection_request: g_file_atom2");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2207,10 +2234,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else
{
- LLOGLN(10, ("clipboard_event_selection_request: unknown "
- "target %s", XGetAtomName(g_display, lxev->target)));
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_request: unknown "
- "target %s", XGetAtomName(g_display, lxev->target)));
+ log_debug("clipboard_event_selection_request: unknown "
+ "target %s", XGetAtomName(g_display, lxev->target));
+ log_error("clipboard_event_selection_request: unknown "
+ "target %s", XGetAtomName(g_display, lxev->target));
}
clipboard_refuse_selection(lxev);
@@ -2232,7 +2259,7 @@ clipboard_event_selection_request(XEvent *xevent)
static int APP_CC
clipboard_event_selection_clear(XEvent *xevent)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_clear:"));
+ log_debug("clipboard_event_selection_clear:");
return 0;
}
@@ -2262,24 +2289,24 @@ clipboard_event_property_notify(XEvent *xevent)
int data_bytes;
char *cptr;
- LLOGLN(10, ("clipboard_event_property_notify:"));
- LLOGLN(10, ("clipboard_event_property_notify: PropertyNotify .window %d "
+ log_debug("clipboard_event_property_notify:");
+ log_debug("clipboard_event_property_notify: PropertyNotify .window %d "
".state %d .atom %d %s", xevent->xproperty.window,
xevent->xproperty.state, xevent->xproperty.atom,
- XGetAtomName(g_display, xevent->xproperty.atom)));
+ XGetAtomName(g_display, xevent->xproperty.atom));
if (g_clip_c2s.incr_in_progress &&
(xevent->xproperty.window == g_clip_c2s.window) &&
(xevent->xproperty.atom == g_clip_c2s.property) &&
(xevent->xproperty.state == PropertyDelete))
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyDelete"));
+ log_debug("clipboard_event_property_notify: INCR PropertyDelete");
/* this is used for when copying a large clipboard to the other app,
it will delete the property so we know to send the next one */
if ((g_clip_c2s.data == 0) || (g_clip_c2s.total_bytes < 1))
{
- LLOGLN(0, ("clipboard_event_property_notify: INCR error"));
+ log_debug("clipboard_event_property_notify: INCR error");
return 0;
}
data = (tui8 *)(g_clip_c2s.data + g_clip_c2s.incr_bytes_done);
@@ -2295,13 +2322,13 @@ clipboard_event_property_notify(XEvent *xevent)
data_bytes = g_incr_max_req_size;
}
g_clip_c2s.incr_bytes_done += data_bytes;
- LLOGLN(10, ("clipboard_event_property_notify: data_bytes %d", data_bytes));
+ log_debug("clipboard_event_property_notify: data_bytes %d", data_bytes);
XChangeProperty(xevent->xproperty.display, xevent->xproperty.window,
xevent->xproperty.atom, g_clip_c2s.type, 8,
PropModeReplace, data, data_bytes);
if (data_bytes < 1)
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR done"));
+ log_debug("clipboard_event_property_notify: INCR done");
g_clip_c2s.incr_in_progress = 0;
/* we no longer need property notify */
XSelectInput(xevent->xproperty.display, xevent->xproperty.window,
@@ -2314,7 +2341,7 @@ clipboard_event_property_notify(XEvent *xevent)
(xevent->xproperty.atom == g_clip_s2c.property) &&
(xevent->xproperty.state == PropertyNewValue))
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyNewValue"));
+ log_debug("clipboard_event_property_notify: INCR PropertyNewValue");
rv = XGetWindowProperty(g_display, g_wnd, g_clip_s2c.property, 0, 0, 0,
AnyPropertyType, &actual_type_return, &actual_format_return,
&nitems_returned, &bytes_left, &data);
@@ -2327,7 +2354,7 @@ clipboard_event_property_notify(XEvent *xevent)
if (bytes_left <= 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_property_notify: INCR done"));
+ log_debug("clipboard_event_property_notify: INCR done");
/* clipboard INCR cycle has completed */
g_clip_s2c.incr_in_progress = 0;
if (g_clip_s2c.type == g_image_bmp_atom)
@@ -2349,8 +2376,8 @@ clipboard_event_property_notify(XEvent *xevent)
}
else
{
- LLOGLN(0, ("clipboard_event_property_notify: error unknown type %d",
- g_clip_s2c.type));
+ log_error("clipboard_event_property_notify: error unknown type %d",
+ g_clip_s2c.type);
clipboard_send_data_response_failed();
}
@@ -2382,7 +2409,7 @@ clipboard_event_property_notify(XEvent *xevent)
return 0;
}
- LLOGLN(10, ("clipboard_event_property_notify: new_data_len %d", new_data_len));
+ log_debug("clipboard_event_property_notify: new_data_len %d", new_data_len);
g_clip_s2c.data = cptr;
g_memcpy(g_clip_s2c.data + g_clip_s2c.total_bytes, data, new_data_len);
g_clip_s2c.total_bytes += new_data_len;
@@ -2430,30 +2457,30 @@ clipboard_xevent(void *xevent)
clipboard_event_property_notify(lxevent);
break;
case UnmapNotify:
- LOG(0, ("chansrv::clipboard_xevent: got UnmapNotify"));
+ log_debug("chansrv::clipboard_xevent: got UnmapNotify");
break;
case ClientMessage:
- LOG(0, ("chansrv::clipboard_xevent: got ClientMessage"));
+ log_debug("chansrv::clipboard_xevent: got ClientMessage");
break;
default:
if (lxevent->type == g_xfixes_event_base +
XFixesSetSelectionOwnerNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSetSelectionOwnerNotify"));
+ log_debug("clipboard_xevent: got XFixesSetSelectionOwnerNotify");
clipboard_event_selection_owner_notify(lxevent);
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionWindowDestroyNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSelectionWindowDestroyNotify"));
+ log_debug("clipboard_xevent: got XFixesSelectionWindowDestroyNotify");
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionClientCloseNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSelectionClientCloseNotify"));
+ log_debug("clipboard_xevent: got XFixesSelectionClientCloseNotify");
break;
}