check IsClipboardFormatAvailable(CF_HDROP) on clipboard update
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
69f1969e60
commit
ac743ca2fe
@ -181,32 +181,37 @@ pub fn server_clip_file(
|
|||||||
ClipboardFile::MonitorReady => {
|
ClipboardFile::MonitorReady => {
|
||||||
log::debug!("server_monitor_ready called");
|
log::debug!("server_monitor_ready called");
|
||||||
ret = server_monitor_ready(context, conn_id);
|
ret = server_monitor_ready(context, conn_id);
|
||||||
log::debug!("server_monitor_ready called, return {}", ret);
|
log::debug!("server_monitor_ready called, conn_id {}, return {}", conn_id, ret);
|
||||||
}
|
}
|
||||||
ClipboardFile::FormatList { format_list } => {
|
ClipboardFile::FormatList { format_list } => {
|
||||||
log::debug!("server_format_list called");
|
log::debug!("server_format_list called, conn_id {}, format_list: {:?}", conn_id, &format_list);
|
||||||
ret = server_format_list(context, conn_id, format_list);
|
ret = server_format_list(context, conn_id, format_list);
|
||||||
log::debug!("server_format_list called, return {}", ret);
|
log::debug!("server_format_list called, conn_id {}, return {}", conn_id, ret);
|
||||||
}
|
}
|
||||||
ClipboardFile::FormatListResponse { msg_flags } => {
|
ClipboardFile::FormatListResponse { msg_flags } => {
|
||||||
log::debug!("format_list_response called");
|
log::debug!("server_format_list_response called");
|
||||||
ret = server_format_list_response(context, conn_id, msg_flags);
|
ret = server_format_list_response(context, conn_id, msg_flags);
|
||||||
log::debug!("server_format_list_response called, return {}", ret);
|
log::debug!("server_format_list_response called, conn_id {}, msg_flags {}, return {}", conn_id, msg_flags, ret);
|
||||||
}
|
}
|
||||||
ClipboardFile::FormatDataRequest {
|
ClipboardFile::FormatDataRequest {
|
||||||
requested_format_id,
|
requested_format_id,
|
||||||
} => {
|
} => {
|
||||||
log::debug!("format_data_request called");
|
log::debug!("server_format_data_request called");
|
||||||
ret = server_format_data_request(context, conn_id, requested_format_id);
|
ret = server_format_data_request(context, conn_id, requested_format_id);
|
||||||
log::debug!("server_format_data_request called, return {}", ret);
|
log::debug!("server_format_data_request called, conn_id {}, requested_format_id {}, return {}", conn_id, requested_format_id, ret);
|
||||||
}
|
}
|
||||||
ClipboardFile::FormatDataResponse {
|
ClipboardFile::FormatDataResponse {
|
||||||
msg_flags,
|
msg_flags,
|
||||||
format_data,
|
format_data,
|
||||||
} => {
|
} => {
|
||||||
log::debug!("format_data_response called");
|
log::debug!("server_format_data_response called");
|
||||||
ret = server_format_data_response(context, conn_id, msg_flags, format_data);
|
ret = server_format_data_response(context, conn_id, msg_flags, format_data);
|
||||||
log::debug!("server_format_data_response called, return {}", ret);
|
log::debug!(
|
||||||
|
"server_format_data_response called, conn_id {}, msg_flags: {}, return {}",
|
||||||
|
conn_id,
|
||||||
|
msg_flags,
|
||||||
|
ret
|
||||||
|
);
|
||||||
}
|
}
|
||||||
ClipboardFile::FileContentsRequest {
|
ClipboardFile::FileContentsRequest {
|
||||||
stream_id,
|
stream_id,
|
||||||
@ -218,7 +223,7 @@ pub fn server_clip_file(
|
|||||||
have_clip_data_id,
|
have_clip_data_id,
|
||||||
clip_data_id,
|
clip_data_id,
|
||||||
} => {
|
} => {
|
||||||
log::debug!("file_contents_request called");
|
log::debug!("server_file_contents_request called");
|
||||||
ret = server_file_contents_request(
|
ret = server_file_contents_request(
|
||||||
context,
|
context,
|
||||||
conn_id,
|
conn_id,
|
||||||
@ -231,14 +236,24 @@ pub fn server_clip_file(
|
|||||||
have_clip_data_id,
|
have_clip_data_id,
|
||||||
clip_data_id,
|
clip_data_id,
|
||||||
);
|
);
|
||||||
log::debug!("server_file_contents_request called, return {}", ret);
|
log::debug!("server_file_contents_request called, conn_id {}, stream_id: {}, list_index {}, dw_flags {}, n_position_low {}, n_position_high {}, cb_requested {}, have_clip_data_id {}, clip_data_id {}, return {}", conn_id,
|
||||||
|
stream_id,
|
||||||
|
list_index,
|
||||||
|
dw_flags,
|
||||||
|
n_position_low,
|
||||||
|
n_position_high,
|
||||||
|
cb_requested,
|
||||||
|
have_clip_data_id,
|
||||||
|
clip_data_id,
|
||||||
|
ret
|
||||||
|
);
|
||||||
}
|
}
|
||||||
ClipboardFile::FileContentsResponse {
|
ClipboardFile::FileContentsResponse {
|
||||||
msg_flags,
|
msg_flags,
|
||||||
stream_id,
|
stream_id,
|
||||||
requested_data,
|
requested_data,
|
||||||
} => {
|
} => {
|
||||||
log::debug!("file_contents_response called");
|
log::debug!("server_file_contents_response called");
|
||||||
ret = server_file_contents_response(
|
ret = server_file_contents_response(
|
||||||
context,
|
context,
|
||||||
conn_id,
|
conn_id,
|
||||||
@ -246,7 +261,12 @@ pub fn server_clip_file(
|
|||||||
stream_id,
|
stream_id,
|
||||||
requested_data,
|
requested_data,
|
||||||
);
|
);
|
||||||
log::debug!("server_file_contents_response called, return {}", ret);
|
log::debug!("server_file_contents_response called, conn_id {}, msg_flags {}, stream_id {}, return {}",
|
||||||
|
conn_id,
|
||||||
|
msg_flags,
|
||||||
|
stream_id,
|
||||||
|
ret
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
@ -578,8 +598,6 @@ extern "C" fn client_format_data_request(
|
|||||||
_context: *mut CliprdrClientContext,
|
_context: *mut CliprdrClientContext,
|
||||||
format_data_request: *const CLIPRDR_FORMAT_DATA_REQUEST,
|
format_data_request: *const CLIPRDR_FORMAT_DATA_REQUEST,
|
||||||
) -> UINT {
|
) -> UINT {
|
||||||
log::debug!("client_format_data_request called");
|
|
||||||
|
|
||||||
let conn_id;
|
let conn_id;
|
||||||
let requested_format_id;
|
let requested_format_id;
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -589,6 +607,7 @@ extern "C" fn client_format_data_request(
|
|||||||
let data = ClipboardFile::FormatDataRequest {
|
let data = ClipboardFile::FormatDataRequest {
|
||||||
requested_format_id,
|
requested_format_id,
|
||||||
};
|
};
|
||||||
|
log::debug!("client_format_data_request called, conn_id: {}, requested_format_id: {}", conn_id, requested_format_id);
|
||||||
// no need to handle result here
|
// no need to handle result here
|
||||||
send_data(conn_id, data);
|
send_data(conn_id, data);
|
||||||
|
|
||||||
|
@ -1367,6 +1367,11 @@ static UINT cliprdr_send_format_list(wfClipboard *clipboard, UINT32 connID)
|
|||||||
if (!clipboard)
|
if (!clipboard)
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
|
|
||||||
|
if (!IsClipboardFormatAvailable(CF_HDROP))
|
||||||
|
{
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ZeroMemory(&formatList, sizeof(CLIPRDR_FORMAT_LIST));
|
ZeroMemory(&formatList, sizeof(CLIPRDR_FORMAT_LIST));
|
||||||
|
|
||||||
/* Ignore if other app is holding clipboard */
|
/* Ignore if other app is holding clipboard */
|
||||||
@ -1392,21 +1397,11 @@ static UINT cliprdr_send_format_list(wfClipboard *clipboard, UINT32 connID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
|
// IsClipboardFormatAvailable(CF_HDROP) is checked above
|
||||||
if (IsClipboardFormatAvailable(CF_HDROP))
|
|
||||||
{
|
|
||||||
UINT fsid = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
|
UINT fsid = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
|
||||||
UINT fcid = RegisterClipboardFormat(CFSTR_FILECONTENTS);
|
UINT fcid = RegisterClipboardFormat(CFSTR_FILECONTENTS);
|
||||||
|
|
||||||
formats[index++].formatId = fsid;
|
formats[index++].formatId = fsid;
|
||||||
formats[index++].formatId = fcid;
|
formats[index++].formatId = fcid;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (formatId = EnumClipboardFormats(formatId) && index < numFormats)
|
|
||||||
formats[index++].formatId = formatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
numFormats = index;
|
numFormats = index;
|
||||||
|
|
||||||
if (!CloseClipboard())
|
if (!CloseClipboard())
|
||||||
@ -2215,6 +2210,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext *context,
|
|||||||
|
|
||||||
for (i = 0; i < formatList->numFormats; i++)
|
for (i = 0; i < formatList->numFormats; i++)
|
||||||
{
|
{
|
||||||
|
printf("REMOVE ME ========================== idx: %d, format id: %d\n", i, formatList->formats[i].formatId);
|
||||||
format = &(formatList->formats[i]);
|
format = &(formatList->formats[i]);
|
||||||
mapping = &(clipboard->format_mappings[i]);
|
mapping = &(clipboard->format_mappings[i]);
|
||||||
mapping->remote_format_id = format->formatId;
|
mapping->remote_format_id = format->formatId;
|
||||||
@ -2594,6 +2590,7 @@ wf_cliprdr_server_format_data_response(CliprdrClientContext *context,
|
|||||||
{
|
{
|
||||||
// BOOL emptyRes = wf_do_empty_cliprdr((wfClipboard *)context->custom);
|
// BOOL emptyRes = wf_do_empty_cliprdr((wfClipboard *)context->custom);
|
||||||
// (void)emptyRes;
|
// (void)emptyRes;
|
||||||
|
printf("REMOVE ME ================================= msg flags: %d\n", formatDataResponse->msgFlags);
|
||||||
rc = E_FAIL;
|
rc = E_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user