mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Fix display sizing in zoomed mode.
This commit is contained in:
		| @@ -54,6 +54,7 @@ GuacUI.Client = { | |||||||
|     "expected_input_height" : 1, |     "expected_input_height" : 1, | ||||||
|  |  | ||||||
|     "connectionName"  : "Guacamole", |     "connectionName"  : "Guacamole", | ||||||
|  |     "overrideAutoFit" : false, | ||||||
|     "attachedClient"  : null |     "attachedClient"  : null | ||||||
|  |  | ||||||
| }; | }; | ||||||
| @@ -207,15 +208,14 @@ GuacUI.StateManager.registerComponent( | |||||||
|  */ |  */ | ||||||
| GuacUI.Client.ZoomedDisplay = function() { | GuacUI.Client.ZoomedDisplay = function() { | ||||||
|  |  | ||||||
|     var old_scale = null; |  | ||||||
|  |  | ||||||
|     this.show = function() { |     this.show = function() { | ||||||
|         old_scale = GuacUI.Client.attachedClient.getScale(); |         GuacUI.Client.overrideAutoFit = true; | ||||||
|         GuacUI.Client.attachedClient.scale(1.0); |         GuacUI.Client.updateDisplayScale(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     this.hide = function() { |     this.hide = function() { | ||||||
|         GuacUI.Client.attachedClient.scale(old_scale); |         GuacUI.Client.overrideAutoFit = false; | ||||||
|  |         GuacUI.Client.updateDisplayScale(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| }; | }; | ||||||
| @@ -515,7 +515,8 @@ GuacUI.Client.updateDisplayScale = function() { | |||||||
|     var guac = GuacUI.Client.attachedClient; |     var guac = GuacUI.Client.attachedClient; | ||||||
|  |  | ||||||
|     // If auto-fit is enabled, scale display |     // If auto-fit is enabled, scale display | ||||||
|     if (GuacUI.sessionState.getProperty("auto-fit")) { |     if (!GuacUI.Client.overrideAutoFit | ||||||
|  |          && GuacUI.sessionState.getProperty("auto-fit")) { | ||||||
|  |  | ||||||
|         // Calculate scale to fit screen |         // Calculate scale to fit screen | ||||||
|         var fit_scale = Math.min( |         var fit_scale = Math.min( | ||||||
| @@ -535,6 +536,18 @@ GuacUI.Client.updateDisplayScale = function() { | |||||||
|  |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Updates the document title based on the connection name. | ||||||
|  |  */ | ||||||
|  | GuacUI.Client.updateTitle = function () { | ||||||
|  |      | ||||||
|  |     if (GuacUI.Client.titlePrefix) | ||||||
|  |         document.title = GuacUI.Client.titlePrefix + " " + GuacUI.Client.connectionName; | ||||||
|  |     else | ||||||
|  |         document.title = GuacUI.Client.connectionName; | ||||||
|  |  | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Hides the currently-visible status overlay, if any. |  * Hides the currently-visible status overlay, if any. | ||||||
|  */ |  */ | ||||||
| @@ -583,7 +596,7 @@ GuacUI.Client.attach = function(guac) { | |||||||
|      */ |      */ | ||||||
|  |  | ||||||
|     guac.onresize = function(width, height) { |     guac.onresize = function(width, height) { | ||||||
|         updateDisplayScale(); |         GuacUI.Client.updateDisplayScale(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* |     /* | ||||||
| @@ -592,33 +605,31 @@ GuacUI.Client.attach = function(guac) { | |||||||
|  |  | ||||||
|     guac.onstatechange = function(clientState) { |     guac.onstatechange = function(clientState) { | ||||||
|  |  | ||||||
|         var title_prefix; |  | ||||||
|  |  | ||||||
|         switch (clientState) { |         switch (clientState) { | ||||||
|  |  | ||||||
|             // Idle |             // Idle | ||||||
|             case 0: |             case 0: | ||||||
|                 GuacUI.Client.showStatus("Idle."); |                 GuacUI.Client.showStatus("Idle."); | ||||||
|                 title_prefix = "[Idle]"; |                 GuacUI.Client.titlePrefix = "[Idle]"; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             // Connecting |             // Connecting | ||||||
|             case 1: |             case 1: | ||||||
|                 GuacUI.Client.showStatus("Connecting..."); |                 GuacUI.Client.showStatus("Connecting..."); | ||||||
|                 title_prefix = "[Connecting...]"; |                 GuacUI.Client.titlePrefix = "[Connecting...]"; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             // Connected + waiting |             // Connected + waiting | ||||||
|             case 2: |             case 2: | ||||||
|                 GuacUI.Client.showStatus("Connected, waiting for first update..."); |                 GuacUI.Client.showStatus("Connected, waiting for first update..."); | ||||||
|                 title_prefix = "[Waiting...]"; |                 GuacUI.Client.titlePrefix = "[Waiting...]"; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             // Connected |             // Connected | ||||||
|             case 3: |             case 3: | ||||||
|  |  | ||||||
|                 GuacUI.Client.hideStatus(); |                 GuacUI.Client.hideStatus(); | ||||||
|                 title_prefix = null; |                 GuacUI.Client.titlePrefix = null; | ||||||
|  |  | ||||||
|                 // Update clipboard with current data |                 // Update clipboard with current data | ||||||
|                 if (GuacUI.sessionState.getProperty("clipboard")) |                 if (GuacUI.sessionState.getProperty("clipboard")) | ||||||
| @@ -629,13 +640,13 @@ GuacUI.Client.attach = function(guac) { | |||||||
|             // Disconnecting |             // Disconnecting | ||||||
|             case 4: |             case 4: | ||||||
|                 GuacUI.Client.showStatus("Disconnecting..."); |                 GuacUI.Client.showStatus("Disconnecting..."); | ||||||
|                 title_prefix = "[Disconnecting...]"; |                 GuacUI.Client.titlePrefix = "[Disconnecting...]"; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             // Disconnected |             // Disconnected | ||||||
|             case 5: |             case 5: | ||||||
|                 GuacUI.Client.showStatus("Disconnected."); |                 GuacUI.Client.showStatus("Disconnected."); | ||||||
|                 title_prefix = "[Disconnected]"; |                 GuacUI.Client.titlePrefix = "[Disconnected]"; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|             // Unknown status code |             // Unknown status code | ||||||
| @@ -644,7 +655,7 @@ GuacUI.Client.attach = function(guac) { | |||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         document.title = title_prefix + " " + GuacUI.Client.connectionName; |         GuacUI.Client.updateTitle(); | ||||||
|  |  | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -654,6 +665,7 @@ GuacUI.Client.attach = function(guac) { | |||||||
|  |  | ||||||
|     guac.onname = function(name) { |     guac.onname = function(name) { | ||||||
|         GuacUI.Client.connectionName = name; |         GuacUI.Client.connectionName = name; | ||||||
|  |         GuacUI.Client.updateTitle(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     /* |     /* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user