refact, win, clipboard, notify callback, tmp commit

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-06-29 13:47:55 +08:00
parent 1dd599b011
commit fc8db69d9e
4 changed files with 77 additions and 7 deletions

View File

@@ -1089,6 +1089,39 @@ pub fn stop_global_event_stream(app_type: String) {
let _ = GLOBAL_EVENT_STREAM.write().unwrap().remove(&app_type);
}
fn msgbox_clipboard_(channel: &str, r#type: u32, msg: &str, details: &str) {
let msgtype = format!(
"{}-nocancel-nook-hasclose",
if r#type == 0 {
"info"
} else if r#type == 1 {
"warn"
} else {
"error"
}
);
let text = format!("{} {}", msg, details);
if let Ok(event) = serde_json::ser::to_string(&HashMap::from([
("type", &msgtype as &str),
("title", "clipboard"),
("text", &text),
("link", ""),
("hasRetry", ""),
])) {
push_global_event(channel, event);
}
}
#[inline]
pub fn msgbox_clipboard_remote(r#type: u32, msg: &str, details: &str) {
msgbox_clipboard_(APP_TYPE_DESKTOP_REMOTE, r#type, msg, details);
}
#[inline]
pub fn msgbox_clipboard_cm(r#type: u32, msg: &str, details: &str) {
msgbox_clipboard_(APP_TYPE_CM, r#type, msg, details);
}
#[no_mangle]
unsafe extern "C" fn get_rgba() {}