mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-11 07:55:52 -06:00
console: Fix send keys for spice and vnc
Unfortunately the bindings were both broken here, so patches are needed to make this work: https://bugs.freedesktop.org/show_bug.cgi?id=59444 https://bugzilla.gnome.org/show_bug.cgi?id=691821
This commit is contained in:
parent
9b2fd63480
commit
c342b58b84
@ -44,6 +44,7 @@ PAGE_UNAVAILABLE = 0
|
||||
PAGE_AUTHENTICATE = 1
|
||||
PAGE_VIEWER = 2
|
||||
|
||||
|
||||
def has_property(obj, setting):
|
||||
try:
|
||||
obj.get_property(setting)
|
||||
@ -51,6 +52,7 @@ def has_property(obj, setting):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ConnectionInfo(object):
|
||||
"""
|
||||
Holds all the bits needed to make a connection to a graphical console
|
||||
@ -97,6 +99,7 @@ class ConnectionInfo(object):
|
||||
return False
|
||||
return int(self.gport) == -1
|
||||
|
||||
|
||||
class Tunnel(object):
|
||||
def __init__(self):
|
||||
self.outfd = None
|
||||
@ -215,6 +218,7 @@ class Tunnel(object):
|
||||
|
||||
return errout
|
||||
|
||||
|
||||
class Tunnels(object):
|
||||
def __init__(self, ginfo):
|
||||
self.ginfo = ginfo
|
||||
@ -264,7 +268,7 @@ class Viewer(vmmGObject):
|
||||
raise NotImplementedError()
|
||||
|
||||
def send_keys(self, keys):
|
||||
return self.display.send_keys(keys)
|
||||
raise NotImplementedError()
|
||||
|
||||
def open_host(self, ginfo, password=None):
|
||||
raise NotImplementedError()
|
||||
@ -275,6 +279,7 @@ class Viewer(vmmGObject):
|
||||
def get_desktop_resolution(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class VNCViewer(Viewer):
|
||||
def __init__(self, console):
|
||||
Viewer.__init__(self, console)
|
||||
@ -332,6 +337,9 @@ class VNCViewer(Viewer):
|
||||
logging.debug("Error when getting the grab keys combination: %s",
|
||||
str(e))
|
||||
|
||||
def send_keys(self, keys):
|
||||
return self.display.send_keys([Gdk.keyval_from_name(k) for k in keys])
|
||||
|
||||
def _desktop_resize(self, src_ignore, w, h):
|
||||
self.desktop_resolution = (w, h)
|
||||
self.console.get_window().get_object("console-vnc-scroll").queue_resize()
|
||||
@ -476,6 +484,10 @@ class SpiceViewer(Viewer):
|
||||
logging.debug("Error when getting the grab keys combination: %s",
|
||||
str(e))
|
||||
|
||||
def send_keys(self, keys):
|
||||
return self.display.send_keys([Gdk.keyval_from_name(k) for k in keys],
|
||||
SpiceClientGtk.DisplayKeyEvent.CLICK)
|
||||
|
||||
def close(self):
|
||||
if self.spice_session is not None:
|
||||
self.spice_session.disconnect()
|
||||
|
Loading…
Reference in New Issue
Block a user