Console catches keyboard and mouse inputs only when mouse is hovering.
Also, when the mouse enters the VM screen, the current active element is unfocused.
This commit is contained in:
16
app/node_modules/angular-no-vnc/index.js
generated
vendored
16
app/node_modules/angular-no-vnc/index.js
generated
vendored
@@ -122,6 +122,22 @@ export default angular.module('no-vnc', [])
|
||||
|
||||
let canvas = $element.find('canvas')[0]
|
||||
|
||||
$scope.unfocus = () => {
|
||||
if (rfb) {
|
||||
rfb.get_keyboard().ungrab()
|
||||
rfb.get_mouse().ungrab()
|
||||
}
|
||||
}
|
||||
$scope.focus = () => {
|
||||
if (rfb) {
|
||||
if (document.activeElement) {
|
||||
document.activeElement.blur()
|
||||
}
|
||||
rfb.get_keyboard().grab()
|
||||
rfb.get_mouse().grab()
|
||||
}
|
||||
}
|
||||
|
||||
$attrs.$observe('url', (url) => {
|
||||
reset(url)
|
||||
})
|
||||
|
||||
2
app/node_modules/angular-no-vnc/view.jade
generated
vendored
2
app/node_modules/angular-no-vnc/view.jade
generated
vendored
@@ -1,5 +1,7 @@
|
||||
canvas.center-block(
|
||||
height = "{{noVnc.height}}"
|
||||
width = "{{noVnc.width}}"
|
||||
ng-mouseenter = 'focus()'
|
||||
ng-mouseleave = 'unfocus()'
|
||||
)
|
||||
| Sorry, your browser does not support the canvas element.
|
||||
|
||||
Reference in New Issue
Block a user