Skip to content

Commit

Permalink
remove MSIE workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jan 20, 2024
1 parent 75ee107 commit f4323d6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 81 deletions.
34 changes: 7 additions & 27 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,11 +1011,6 @@ class XpraClient {
}

_keyb_process(pressed, event) {
// MSIE hack
return this.do_keyb_process(pressed, event || window.event);
}

do_keyb_process(pressed, event) {
if (this.server_readonly) {
return true;
}
Expand Down Expand Up @@ -1999,10 +1994,6 @@ class XpraClient {
init_clipboard() {
window.addEventListener("paste", (e) => {
let clipboardData = (e.originalEvent || e).clipboardData;
//IE: must use window.clipboardData because the event clipboardData is null!
if (!clipboardData) {
clipboardData = window.clipboardData;
}
if (
clipboardData &&
clipboardData.files &&
Expand Down Expand Up @@ -2095,19 +2086,14 @@ class XpraClient {
", buffer=",
clipboard_buffer
);
//for IE:
let success = false;
if (
Object.hasOwn(window, "clipboardData") &&
Object.hasOwn(window.clipboardData, "setData") &&
typeof window.clipboardData.setData === "function"
) {
try {
if (Utilities.isIE()) {
window.clipboardData.setData("Text", clipboard_buffer);
} else {
window.clipboardData.setData(clipboard_datatype, clipboard_buffer);
}
window.clipboardData.setData(clipboard_datatype, clipboard_buffer);
success = true;
} catch {
success = false;
Expand Down Expand Up @@ -2142,16 +2128,9 @@ class XpraClient {
//fallback code for legacy mode:
let datatype = TEXT_PLAIN;
let clipboardData = (e.originalEvent || e).clipboardData;
//IE: must use window.clipboardData because the event clipboardData is null!
if (!clipboardData) {
clipboardData = window.clipboardData;
if (!clipboardData) {
this.debug("clipboard", "polling: no data available");
return false;
}
}
if (Utilities.isIE()) {
datatype = "Text";
this.debug("clipboard", "polling: no data available");
return false;
}
const raw_clipboard_buffer = clipboardData.getData(datatype);
if (raw_clipboard_buffer === null) {
Expand Down Expand Up @@ -4415,20 +4394,21 @@ class XpraClient {
return this.clipboard_datatype;
}

send_clipboard_token(data) {
send_clipboard_token(data, data_format) {
if (!this.clipboard_enabled || !this.connected) {
return;
}
this.debug("clipboard", "sending clipboard token with data:", data);
const claim = true; //Boolean(navigator.clipboard && navigator.clipboard.readText && navigator.clipboard.writeText);
const greedy = true;
const synchronous = true;
const actual_data_format = data_format || [UTF8_STRING, TEXT_PLAIN];
this.debug("clipboard", "sending clipboard token with data:", data, "as", actual_data_format);
let packet;
packet = data
? [
"clipboard-token",
"CLIPBOARD",
[UTF8_STRING, TEXT_PLAIN],
actual_data_format,
UTF8_STRING,
UTF8_STRING,
8,
Expand Down
8 changes: 0 additions & 8 deletions html5/js/MediaSourceUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ const MediaSourceUtil = {
},

getAuroraAudioCodecs() {
//IE is totally useless:
if (Utilities.isIE()) {
return {};
}
const codecs_supported = new Map();
const codecs_failed = new Map();
if (AV && AV.Decoder && AV.Decoder.find) {
Expand All @@ -144,10 +140,6 @@ const MediaSourceUtil = {
Utilities.log("audio forwarding: no media source API support");
return [];
}
//IE is totally useless:
if (Utilities.isIE()) {
return [];
}
const codecs_supported = [];
const codecs_failed = {};
for (const codec_option in MediaSourceConstants.CODEC_STRING) {
Expand Down
37 changes: 1 addition & 36 deletions html5/js/lib/detect-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,6 @@
devicePxPerCssPx: 1
};
};
/**
* IE 8 and 9: no trick needed!
* TODO: Test on IE10 and Windows 8 RT
* @return {Object}
* @private
**/
var ie8 = function () {
var zoom = Math.round((screen.deviceXDPI / screen.logicalXDPI) * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};

/**
* For IE10 we need to change our technique again...
* thanks https://github.com/stefanvanburen
* @return {Object}
* @private
*/
var ie10 = function () {
var zoom = Math.round((document.documentElement.offsetHeight / window.innerHeight) * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};

/**
* For chrome
Expand Down Expand Up @@ -271,16 +244,8 @@
*/
var detectFunction = (function () {
var func = fallback;
//IE8+
if (!isNaN(screen.logicalXDPI) && !isNaN(screen.systemXDPI)) {
func = ie8;
}
// IE10+ / Touch
else if (window.navigator.msMaxTouchPoints) {
func = ie10;
}
//chrome
else if(!!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' Opera') >= 0)){
if(!!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' Opera') >= 0)){
func = chrome;
}
//safari
Expand Down
11 changes: 1 addition & 10 deletions html5/js/lib/rencode.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,7 @@ function rdecode_intl(dec) {
function rdecode_intq(dec) {
const slice = dec.buf.slice(dec.pos+1, dec.pos+9)
const dv = new DataView(slice.buffer);
let s = 0;
if ("getBigInt64" in DataView.prototype) {
s = dv.getBigInt64(0);
}
else {
//oh, IE...
const left = dv.getInt32(0);
const right = dv.getUint32(4);
s = 2**32*left + right;
}
const s = dv.getBigInt64(0);
dec.pos += 9;
if (!Number.isSafeInteger(s)) {
//console.warn("value is not a safe integer: ", s);
Expand Down

0 comments on commit f4323d6

Please sign in to comment.