[virt-tools-list] [PATCH 08/22] display: make klass->close() optional

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Tue Jul 31 13:41:11 UTC 2018


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Spice and VTE display do not need to implement it.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/virt-viewer-display-spice.c | 8 --------
 src/virt-viewer-display.c       | 5 ++---
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index f9b383b..68be8ac 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -56,7 +56,6 @@ static void virt_viewer_display_spice_send_keys(VirtViewerDisplay *display,
                                                 int nkeyvals);
 static GdkPixbuf *virt_viewer_display_spice_get_pixbuf(VirtViewerDisplay *display);
 static void virt_viewer_display_spice_release_cursor(VirtViewerDisplay *display);
-static void virt_viewer_display_spice_close(VirtViewerDisplay *display G_GNUC_UNUSED);
 static gboolean virt_viewer_display_spice_selectable(VirtViewerDisplay *display);
 static void virt_viewer_display_spice_enable(VirtViewerDisplay *display);
 static void virt_viewer_display_spice_disable(VirtViewerDisplay *display);
@@ -69,7 +68,6 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass)
     dclass->send_keys = virt_viewer_display_spice_send_keys;
     dclass->get_pixbuf = virt_viewer_display_spice_get_pixbuf;
     dclass->release_cursor = virt_viewer_display_spice_release_cursor;
-    dclass->close = virt_viewer_display_spice_close;
     dclass->selectable = virt_viewer_display_spice_selectable;
     dclass->enable = virt_viewer_display_spice_enable;
     dclass->disable = virt_viewer_display_spice_disable;
@@ -348,12 +346,6 @@ virt_viewer_display_spice_release_cursor(VirtViewerDisplay *display)
     spice_display_mouse_ungrab(self->priv->display);
 }
 
-
-static void
-virt_viewer_display_spice_close(VirtViewerDisplay *display G_GNUC_UNUSED)
-{
-}
-
 static gboolean
 virt_viewer_display_spice_selectable(VirtViewerDisplay *self)
 {
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 011328e..b3cc095 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -657,9 +657,8 @@ void virt_viewer_display_close(VirtViewerDisplay *self)
     g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
 
     klass = VIRT_VIEWER_DISPLAY_GET_CLASS(self);
-    g_return_if_fail(klass->close != NULL);
-
-    klass->close(self);
+    if (klass->close)
+        klass->close(self);
 }
 
 void virt_viewer_display_set_fullscreen(VirtViewerDisplay *self, gboolean fullscreen)
-- 
2.18.0.321.gffc6fa0e39




More information about the virt-tools-list mailing list