[virt-tools-list] [PATCH v4 1/2] virt-manager: add opengl graphics option
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Mon Nov 28 10:47:45 UTC 2016
From: Marc-André Lureau <marcandre.lureau at gmail.com>
Add an OpenGL checkbox to the Spice graphics options (only available if
SUPPORT_CONN_SPICE_GL).
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
ui/gfxdetails.ui | 29 +++++++++++++++++++++++++++++
virtManager/addhardware.py | 3 ++-
virtManager/details.py | 9 +++++++--
virtManager/domain.py | 5 ++++-
virtManager/gfxdetails.py | 11 +++++++++--
5 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/ui/gfxdetails.ui b/ui/gfxdetails.ui
index ad84ca9..5a4ddf8 100644
--- a/ui/gfxdetails.ui
+++ b/ui/gfxdetails.ui
@@ -363,5 +363,34 @@
<property name="top_attach">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Open_GL</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">graphics-opengl</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="graphics-opengl">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_graphics_opengl_toggled" swapped="no"/>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index aab9095..7a3c8f2 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1542,7 +1542,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
@@ -1550,6 +1550,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 b2f451d..d803d52 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
@@ -376,6 +377,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",
@@ -2133,7 +2136,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 = {}
@@ -2145,6 +2148,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 582de64..6e742b9 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 0ae76c9..f3cd3a9 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":
--
2.10.0
More information about the virt-tools-list
mailing list