diff --git a/html5/index.html b/html5/index.html index ef4234b9..ab42ed02 100644 --- a/html5/index.html +++ b/html5/index.html @@ -1387,11 +1387,20 @@

Xpra Bug Report

}); // disable right click menu: window.oncontextmenu = function(e) { - client._poll_clipboard(e); + if (this.clipboard_direction === "to-client" || this.clipboard_direction === "both") { + client._poll_clipboard(e); + } e.preventDefault(); e.stopPropagation(); return false; } + + // Send clipboard from browser on focus if client-to-server clipboard is enabled. + $(window).on("focus", (e) => { + if (this.clipboard_direction === "to-server" || this.clipboard_direction === "both") { + client._poll_clipboard(e); + } + }); } window.inAltTab = false; diff --git a/html5/js/Client.js b/html5/js/Client.js index c9789a3e..40ffdfd4 100644 --- a/html5/js/Client.js +++ b/html5/js/Client.js @@ -138,6 +138,7 @@ XpraClient.prototype.init_state = function(container) { this.scroll_reverse_x = false; this.scroll_reverse_y = false; // clipboard + this.clipboard_direction = default_settings["clipboard_direction"] || "both"; this.clipboard_datatype = null; this.clipboard_buffer = ""; this.clipboard_server_buffers = {}; @@ -878,11 +879,8 @@ XpraClient.prototype.do_keyb_process = function(pressed, event) { unpress_now = true; } - //if (keyname=="Control_L" || keyname=="Control_R") - this._poll_clipboard(event); - let allow_default = false; - if (this.clipboard_enabled) { + if (this.clipboard_enabled && client.clipboard_direction !== "to-server") { //allow some key events that need to be seen by the browser //for handling the clipboard: let clipboard_modifier_keys = ["Control_L", "Control_R", "Shift_L", "Shift_R"]; @@ -1449,7 +1447,7 @@ XpraClient.prototype.do_window_mouse_click = function(e, window, pressed) { return; } let send_delay = 0; - if (this._poll_clipboard(e)) { + if (client.clipboard_direction !== "to-server" && this._poll_clipboard(e)) { send_delay = CLIPBOARD_EVENT_DELAY; } const mouse = this.getMouse(e, window),