mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-326: Add notification for mouse emulation type change. Use it to signal completed downloads while we're at it.
This commit is contained in:
		| @@ -871,6 +871,22 @@ GuacUI.Client.showError = function(title, status, reconnect) { | |||||||
|     GuacUI.Client.visibleStatus.show(); |     GuacUI.Client.visibleStatus.show(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | GuacUI.Client.showNotification = function(message) { | ||||||
|  |  | ||||||
|  |     // Create notification | ||||||
|  |     var element = GuacUI.createElement("div", "message notification"); | ||||||
|  |     GuacUI.createChildElement(element, "div", "caption").textContent = message; | ||||||
|  |  | ||||||
|  |     // Add to DOM | ||||||
|  |     GuacUI.Client.notification_area.appendChild(element); | ||||||
|  |  | ||||||
|  |     // Remove from DOM after around 5 seconds | ||||||
|  |     window.setTimeout(function() { | ||||||
|  |         GuacUI.Client.notification_area.removeChild(element); | ||||||
|  |     }, 5000); | ||||||
|  |  | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Connects to the current Guacamole connection, attaching a new Guacamole |  * Connects to the current Guacamole connection, attaching a new Guacamole | ||||||
|  * client to the user interface. If a Guacamole client is already attached, |  * client to the user interface. If a Guacamole client is already attached, | ||||||
| @@ -1565,6 +1581,7 @@ GuacUI.Client.attach = function(guac) { | |||||||
|                 if (offset >= bytes.length) { |                 if (offset >= bytes.length) { | ||||||
|                     stream.sendEnd(); |                     stream.sendEnd(); | ||||||
|                     GuacUI.Client.notification_area.removeChild(upload.getElement()); |                     GuacUI.Client.notification_area.removeChild(upload.getElement()); | ||||||
|  |                     GuacUI.Client.showNotification("Upload of \"" + file.name + "\" complete."); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 // Otherwise, update progress |                 // Otherwise, update progress | ||||||
| @@ -1733,14 +1750,20 @@ GuacUI.Client.attach = function(guac) { | |||||||
|  |  | ||||||
|     GuacUI.Client.absolute_radio.onclick = |     GuacUI.Client.absolute_radio.onclick = | ||||||
|     GuacUI.Client.absolute_radio.onchange = function() { |     GuacUI.Client.absolute_radio.onchange = function() { | ||||||
|  |         if (!GuacUI.Client.emulate_absolute) { | ||||||
|  |             GuacUI.Client.showNotification("Absolute mouse emulation selected"); | ||||||
|             GuacUI.Client.setMouseEmulationAbsolute(GuacUI.Client.absolute_radio.checked); |             GuacUI.Client.setMouseEmulationAbsolute(GuacUI.Client.absolute_radio.checked); | ||||||
|             GuacUI.Client.showMenu(false); |             GuacUI.Client.showMenu(false); | ||||||
|  |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     GuacUI.Client.relative_radio.onclick = |     GuacUI.Client.relative_radio.onclick = | ||||||
|     GuacUI.Client.relative_radio.onchange = function() { |     GuacUI.Client.relative_radio.onchange = function() { | ||||||
|  |         if (GuacUI.Client.emulate_absolute) { | ||||||
|  |             GuacUI.Client.showNotification("Relative mouse emulation selected"); | ||||||
|             GuacUI.Client.setMouseEmulationAbsolute(!GuacUI.Client.relative_radio.checked); |             GuacUI.Client.setMouseEmulationAbsolute(!GuacUI.Client.relative_radio.checked); | ||||||
|             GuacUI.Client.showMenu(false); |             GuacUI.Client.showMenu(false); | ||||||
|  |         } | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     // Prevent default on all touch events |     // Prevent default on all touch events | ||||||
|   | |||||||
| @@ -36,3 +36,18 @@ | |||||||
|     to   { opacity: 1; } |     to   { opacity: 1; } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * fadeout: Fade from fully opaque to fully transparent. | ||||||
|  |  */ | ||||||
|  | @keyframes fadeout { | ||||||
|  |     from { opacity: 1; } | ||||||
|  |     to   { opacity: 0; } | ||||||
|  | } | ||||||
|  | @-moz-keyframes fadeout { | ||||||
|  |     from { opacity: 1; } | ||||||
|  |     to   { opacity: 0; } | ||||||
|  | } | ||||||
|  | @-webkit-keyframes fadeout { | ||||||
|  |     from { opacity: 1; } | ||||||
|  |     to   { opacity: 0; } | ||||||
|  | } | ||||||
|   | |||||||
| @@ -640,3 +640,17 @@ p.hint { | |||||||
|     bottom: 0; |     bottom: 0; | ||||||
|     opacity: 0; |     opacity: 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .notification.message { | ||||||
|  |     background: #DFD; | ||||||
|  |     animation: fadein 0.125s linear, fadeout 2s 3s linear; | ||||||
|  |     -webkit-animation: fadein 0.125s linear, fadeout 2s 3s linear; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .notification.message .caption { | ||||||
|  |     vertical-align: middle; | ||||||
|  |     white-space: normal; | ||||||
|  |     overflow: hidden; | ||||||
|  |     text-overflow: ellipsis; | ||||||
|  | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user