mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Ensure width/height/DPI are sent as integers. Properly adjust display scale for reported pixel size.
This commit is contained in:
@@ -117,8 +117,8 @@
|
||||
// Scale width/height to be at least 600x600
|
||||
if (optimal_width < 600 || optimal_height < 600) {
|
||||
var scale = Math.max(600 / optimal_width, 600 / optimal_height);
|
||||
optimal_width = Math.floor(optimal_width * scale);
|
||||
optimal_height = Math.floor(optimal_height * scale);
|
||||
optimal_width = optimal_width * scale;
|
||||
optimal_height = optimal_height * scale;
|
||||
}
|
||||
|
||||
// Get entire query string, and pass to connect().
|
||||
@@ -128,9 +128,9 @@
|
||||
|
||||
var connect_string =
|
||||
window.location.search.substring(1)
|
||||
+ "&width=" + optimal_width
|
||||
+ "&height=" + optimal_height
|
||||
+ "&dpi=" + optimal_dpi;
|
||||
+ "&width=" + Math.floor(optimal_width)
|
||||
+ "&height=" + Math.floor(optimal_height)
|
||||
+ "&dpi=" + Math.floor(optimal_dpi);
|
||||
|
||||
// Add audio mimetypes to connect_string
|
||||
GuacUI.Audio.supported.forEach(function(mimetype) {
|
||||
|
@@ -618,6 +618,7 @@ GuacUI.Client.updateDisplayScale = function() {
|
||||
|
||||
// Currently attacched client
|
||||
var guac = GuacUI.Client.attachedClient;
|
||||
var adjusted_scale = 1 / (window.devicePixelRatio || 1);
|
||||
|
||||
// If auto-fit is enabled, scale display
|
||||
if (!GuacUI.Client.overrideAutoFit
|
||||
@@ -630,14 +631,14 @@ GuacUI.Client.updateDisplayScale = function() {
|
||||
);
|
||||
|
||||
// Scale client
|
||||
if (fit_scale != guac.getScale())
|
||||
if (guac.getScale() !== fit_scale)
|
||||
guac.scale(fit_scale);
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, scale to 100%
|
||||
else if (guac.getScale() != 1.0)
|
||||
guac.scale(1.0);
|
||||
else if (guac.getScale() !== adjusted_scale)
|
||||
guac.scale(adjusted_scale);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user