Kasm 5598 click focus (#96)

* KASM-5598 modify click logic to tell other windows they can receive a click event

* KASM-5598 dont run the rest of the switch on click focus set

* KASM-5598 forgot to false

---------

Co-authored-by: ryan.kuba <ryan.kuba@kasmweb.com>
This commit is contained in:
Ryan Kuba 2024-02-08 07:11:26 -08:00 committed by GitHub
parent 933d5b7505
commit 3d7047e546
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -46,6 +46,7 @@ const DEFAULT_BACKGROUND = 'rgb(40, 40, 40)';
var _videoQuality = 2;
var _enableWebP = false;
var _enableQOI = false;
var _clickEligible = false;
// Minimum wait (ms) between two mouse moves
const MOUSE_MOVE_DELAY = 17;
@ -1467,11 +1468,20 @@ export default class RFB extends EventTargetMixin {
// added for multi-montiors
// as user moves from window to window, focus change loses a click, this marks the next mouse
// move to simulate a left click. We wait for the next mouse move because we need accurate x,y coords
if (this._clickEligible) {
this._sendLeftClickonNextMove = true;
this._clickEligible = false;
}
} else {
Log.Debug("Window focused while user switched between tabs.");
}
} else if (event.type == 'blur') {
// Tell all windows we lost focus
let message = {
eventType: 'lostFocus'
}
this._controlChannel.postMessage(message);
}
if (document.visibilityState === "visible" && this._lastVisibilityState === "hidden") {
@ -1790,6 +1800,10 @@ export default class RFB extends EventTargetMixin {
}
_handleControlMessage(event) {
if (event.data.eventType == 'lostFocus') {
this._clickEligible = true;
return;
}
if (this._isPrimaryDisplay) {
// Secondary to Primary screen message
let size;