From 88942028b3aac14c5e26bb630f5dc0ad0a58f9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 21 Feb 2017 17:00:56 +0400 Subject: [PATCH] virtManager/ui: add opengl graphics option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an OpenGL checkbox to the Spice graphics options (only available if SUPPORT_CONN_SPICE_GL). Signed-off-by: Marc-André Lureau --- ui/gfxdetails.ui | 30 ++++++++++++++++++++++++++++++ virtManager/addhardware.py | 3 ++- virtManager/details.py | 9 +++++++-- virtManager/domain.py | 5 ++++- virtManager/gfxdetails.py | 11 +++++++++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/ui/gfxdetails.ui b/ui/gfxdetails.ui index ad84ca99e..78e75b74e 100644 --- a/ui/gfxdetails.ui +++ b/ui/gfxdetails.ui @@ -363,5 +363,35 @@ 0 + + + True + False + 1 + Open_GL: + True + graphics-opengl + + + 0 + 8 + + + + + True + True + False + True + + + + + + + 1 + 8 + + diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index e63ad3d09..15292b0cd 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -1555,7 +1555,7 @@ class vmmAddHardware(vmmGObjectUI): def _validate_page_graphics(self): try: (gtype, port, - tlsport, addr, passwd, keymap) = self._gfxdetails.get_values() + tlsport, addr, passwd, keymap, gl) = self._gfxdetails.get_values() self._dev = virtinst.VirtualGraphics(self.conn.get_backend()) self._dev.type = gtype @@ -1563,6 +1563,7 @@ class vmmAddHardware(vmmGObjectUI): self._dev.passwd = passwd self._dev.listen = addr self._dev.tlsPort = tlsport + self._dev.gl = gl if keymap: self._dev.keymap = keymap except ValueError, e: diff --git a/virtManager/details.py b/virtManager/details.py index 9960d9913..f35bc569e 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -90,6 +90,7 @@ EDIT_GFX_KEYMAP, EDIT_GFX_ADDRESS, EDIT_GFX_TLSPORT, EDIT_GFX_PORT, +EDIT_GFX_OPENGL, EDIT_VIDEO_MODEL, @@ -104,7 +105,7 @@ EDIT_FS, EDIT_HOSTDEV_ROMBAR, -) = range(1, 45) +) = range(1, 46) # Columns in hw list model @@ -394,6 +395,8 @@ class vmmDetails(vmmGObjectUI): lambda *x: self.enable_apply(x, EDIT_GFX_TYPE)) self.gfxdetails.connect("changed-port", lambda *x: self.enable_apply(x, EDIT_GFX_PORT)) + self.gfxdetails.connect("changed-opengl", + lambda *x: self.enable_apply(x, EDIT_GFX_OPENGL)) self.gfxdetails.connect("changed-tlsport", lambda *x: self.enable_apply(x, EDIT_GFX_TLSPORT)) self.gfxdetails.connect("changed-address", @@ -2158,7 +2161,7 @@ class vmmDetails(vmmGObjectUI): def config_graphics_apply(self, devobj): (gtype, port, - tlsport, addr, passwd, keymap) = self.gfxdetails.get_values() + tlsport, addr, passwd, keymap, gl) = self.gfxdetails.get_values() kwargs = {} @@ -2170,6 +2173,8 @@ class vmmDetails(vmmGObjectUI): kwargs["keymap"] = keymap if self.edited(EDIT_GFX_PORT): kwargs["port"] = port + if self.edited(EDIT_GFX_OPENGL): + kwargs["gl"] = gl if self.edited(EDIT_GFX_TLSPORT): kwargs["tlsport"] = tlsport if self.edited(EDIT_GFX_TYPE): diff --git a/virtManager/domain.py b/virtManager/domain.py index 83784f250..420202dc9 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -825,7 +825,8 @@ class vmmDomain(vmmLibvirtObject): def define_graphics(self, devobj, do_hotplug, listen=_SENTINEL, port=_SENTINEL, tlsport=_SENTINEL, - passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL): + passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL, + gl=_SENTINEL): xmlobj = self._make_xmlobj_to_define() editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) if not editdev: @@ -843,6 +844,8 @@ class vmmDomain(vmmLibvirtObject): editdev.keymap = keymap if gtype != _SENTINEL: editdev.type = gtype + if gl != _SENTINEL: + editdev.gl = gl if do_hotplug: self.hotplug(device=editdev) diff --git a/virtManager/gfxdetails.py b/virtManager/gfxdetails.py index 0ae76c953..f3cd3a9d4 100644 --- a/virtManager/gfxdetails.py +++ b/virtManager/gfxdetails.py @@ -35,6 +35,7 @@ class vmmGraphicsDetails(vmmGObjectUI): "changed-type": (GObject.SignalFlags.RUN_FIRST, None, []), "changed-address": (GObject.SignalFlags.RUN_FIRST, None, []), "changed-keymap": (GObject.SignalFlags.RUN_FIRST, None, []), + "changed-opengl": (GObject.SignalFlags.RUN_FIRST, None, []), } def __init__(self, vm, builder, topwin): @@ -54,6 +55,7 @@ class vmmGraphicsDetails(vmmGObjectUI): "on_graphics_tlsport_changed": lambda ignore: self.emit("changed-tlsport"), "on_graphics_port_changed": lambda ignore: self.emit("changed-port"), "on_graphics_keymap_changed": lambda ignore: self.emit("changed-keymap"), + "on_graphics_opengl_toggled": lambda ignore: self.emit("changed-opengl"), }) self._init_ui() @@ -143,7 +145,9 @@ class vmmGraphicsDetails(vmmGObjectUI): if not self.widget("graphics-password-chk").get_active(): passwd = None - return gtype, port, tlsport, addr, passwd, keymap + gl = self.widget("graphics-opengl").get_active() + + return gtype, port, tlsport, addr, passwd, keymap, gl def set_dev(self, gfx): self.reset_state() @@ -188,6 +192,7 @@ class vmmGraphicsDetails(vmmGObjectUI): if is_spice: set_port("graphics-tlsport", gfx.tlsPort) + self.widget("graphics-opengl").set_active(gfx.gl or False) if is_sdl: title = _("Local SDL Window") @@ -208,13 +213,15 @@ class vmmGraphicsDetails(vmmGObjectUI): def _show_rows_from_type(self): hide_all = ["graphics-xauth", "graphics-display", "graphics-address", "graphics-password-box", "graphics-keymap", "graphics-port-box", - "graphics-tlsport-box"] + "graphics-tlsport-box", "graphics-opengl"] gtype = uiutil.get_list_selection(self.widget("graphics-type")) sdl_rows = ["graphics-xauth", "graphics-display"] vnc_rows = ["graphics-password-box", "graphics-address", "graphics-port-box", "graphics-keymap"] spice_rows = vnc_rows[:] + ["graphics-tlsport-box"] + if self.conn.check_support(self.conn.SUPPORT_CONN_SPICE_GL): + spice_rows.extend(["graphics-opengl"]) rows = [] if gtype == "sdl":