[virt-tools-list] [PATCH 4/5] virt-manager: add opengl graphics option
Marc-André Lureau
marcandre.lureau at redhat.com
Thu Apr 28 12:22:10 UTC 2016
From: Marc-André Lureau <marcandre.lureau at gmail.com>
Add a OpenGl checkbox to the Spice graphics option (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 | 2 +-
virtManager/details.py | 9 +++++++--
virtManager/domain.py | 5 ++++-
virtManager/gfxdetails.py | 13 ++++++++++---
5 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/ui/gfxdetails.ui b/ui/gfxdetails.ui
index 85dbac6..87c50f9 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">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="xalign">0.05000000074505806</property>
+ <property name="yalign">0.55000001192092896</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 56c9235..fbd4494 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1561,7 +1561,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
diff --git a/virtManager/details.py b/virtManager/details.py
index 0b8b145..189a8d5 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",
@@ -2131,7 +2134,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 = {}
@@ -2143,6 +2146,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 d79903f..66b7465 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..374eff8 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"]
+ spice_rows = vnc_rows[:] + ["graphics-tlsport-box", "graphics-opengl"]
+ if self.conn.check_support(self.conn.SUPPORT_CONN_SPICE_GL):
+ spice_rows = spice_rows[:] + ["graphics-opengl"]
rows = []
if gtype == "sdl":
--
2.7.4
More information about the virt-tools-list
mailing list