From 22940880a50764b8e3c3631ebc80c9ad38a70cd2 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 14 May 2024 12:24:45 +0700 Subject: [PATCH] #301 add clipboard sync to server button --- html5/icons/clipboard.png | Bin 0 -> 1441 bytes html5/index.html | 12 ++++++++++++ html5/js/Client.js | 11 ++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 html5/icons/clipboard.png diff --git a/html5/icons/clipboard.png b/html5/icons/clipboard.png new file mode 100644 index 0000000000000000000000000000000000000000..43cb162d4f3ebe6a64575b678fb4f8e22ac3c3cf GIT binary patch literal 1441 zcmV;S1z!4zP)O&_NHT_)h$Q%pE=KV~7K#WXZZttO1hX_7VMI4B9mqC2 zvoRaNMOH3Uln`VV*$4?PdKSrq&|x4mnM@`<-95i_cU8T6UDT&*2s720s($#IM>jN8 z?|#lX_udB-ylS;t@_S-pV$*+2kvn(p$o%~L+WGV6-xeOf_u1=D z{Ic=!aa_7|X@99yI@4@6_0-hVwS|R++1;8O|R@$(wE`I$%-T*_Y`63!pV)=!Fk(@aK zA3FxubpaxDn{%lDeGVd>Opw^wOa@p4WS3xS}O%70jF%t+fU-gNRV6 zRN(tQL3ea1x*AH1_+Wj15qTR=*Q7cA6V3iGawwo764@+s2>$d zglFI@ovl!&v!Aj1ii)K0FN1eQ;*SUfLb)>#?l2WHUZi9A={J4%B}-(^o;~R zIg9%|&+f+o;+`W$AS42ogvclWLefL00SHNodt4NWIZCY=2!&eX_W%|fUr8U-|Sn;JQTDik#n`J1_3APhlB;!ZU?URHn6h_he_ zLP#K#*~<2(Lfq?32JZzW!D10e-g!W?P+S#71j1}Ug<=^+CW*5llRU z48%8O@#WUQyV1B3Clg@aIuI8!^idWI?np%nxLVwVe;NEdu&MT-h|As7wF-fpvB3YT6rj@(X zFtsca0Hyqetm9*yePIv`FG0I2e!x1&<-pbHg|E8-zb7n~N%M(-jn3-B)+5vok5+K^ v!P?IBI9dvTV|d#D)Sk)^ZeBRKrH%gq@ptzCIsjU~00000NkvXXu0mjf){~SC literal 0 HcmV?d00001 diff --git a/html5/index.html b/html5/index.html index 83076c70..0e3530c9 100644 --- a/html5/index.html +++ b/html5/index.html @@ -257,6 +257,14 @@ data-icon="keyboard" > +
  • + +
  • Xpra Bug Report toggle_keyboard(); }); + $("#clipboard_button").on("click", function (e) { + client.read_clipboard(e); + }); + // Configure Xpra tray window list right click behavior. $("#open_windows_list") .siblings("a") diff --git a/html5/js/Client.js b/html5/js/Client.js index 54ae8255..f8f7fe44 100644 --- a/html5/js/Client.js +++ b/html5/js/Client.js @@ -96,6 +96,7 @@ class XpraClient { this.debug_categories = []; this.start_new_session = null; this.clipboard_enabled = false; + this.clipboard_poll = false; this.file_transfer = false; this.remote_file_size_limit = 0; this.remote_file_chunks = 0; @@ -1662,6 +1663,7 @@ class XpraClient { selections = ["CLIPBOARD", "PRIMARY"]; this.log("legacy clipboard"); } + this.log("clipboard polling: ", this.clipboard_poll); return { "enabled" : this.clipboard_enabled, "want_targets" : true, @@ -2119,7 +2121,7 @@ class XpraClient { } _poll_clipboard(e) { - if (this.clipboard_enabled === false) { + if (!this.clipboard_poll) { return; } //see if the clipboard contents have changed: @@ -2127,6 +2129,13 @@ class XpraClient { //we're still waiting to set the clipboard.. return false; } + this.read_clipboard(e); + } + + read_clipboard(e) { + if (this.clipboard_enabled === false) { + return; + } if (navigator.clipboard && navigator.clipboard.clipboardData) { this.debug("clipboard", "polling using", navigator.clipboard.clipboardData); this.read_clipboard_data();