Add support for DPI within size instruction and client info.

This commit is contained in:
Michael Jumper
2013-12-27 00:35:21 -08:00
parent 9b20d5e1eb
commit b722cf5977
5 changed files with 46 additions and 8 deletions

View File

@@ -251,6 +251,11 @@ public class BasicTunnelRequestUtility {
if (height != null)
info.setOptimalScreenHeight(Integer.parseInt(height));
// Set resolution if provided
String dpi = request.getParameter("dpi");
if (dpi != null)
info.setOptimalResolution(Integer.parseInt(dpi));
// Add audio mimetypes
String[] audio_mimetypes = request.getParameterValues("audio");
if (audio_mimetypes != null)

View File

@@ -105,8 +105,10 @@
try {
// Calculate optimal width/height for display
var optimal_width = window.innerWidth;
var optimal_height = window.innerHeight;
var pixel_density = window.devicePixelRatio || 1;
var optimal_dpi = pixel_density * 96;
var optimal_width = window.innerWidth * pixel_density;
var optimal_height = window.innerHeight * pixel_density;
// Scale width/height to be at least 600x600
if (optimal_width < 600 || optimal_height < 600) {
@@ -123,7 +125,8 @@
var connect_string =
window.location.search.substring(1)
+ "&width=" + optimal_width
+ "&height=" + optimal_height;
+ "&height=" + optimal_height
+ "&dpi=" + optimal_dpi;
// Add audio mimetypes to connect_string
GuacUI.Audio.supported.forEach(function(mimetype) {

View File

@@ -953,7 +953,11 @@ GuacUI.Client.attach = function(guac) {
*/
window.onresize = function() {
guac.sendSize(window.innerWidth, window.innerHeight);
var pixel_density = window.devicePixelRatio || 1;
var width = window.innerWidth * pixel_density;
var height = window.innerHeight * pixel_density;
guac.sendSize(width, height);
GuacUI.Client.updateDisplayScale();
};