[PATCH spice-gtk 5/5] widget: switch 'display' type to DisplayChannel*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

This avoids the long casts. The Channel* type is less commonly used.

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 src/spice-widget-egl.c  |  2 +-
 src/spice-widget-priv.h |  2 +-
 src/spice-widget.c      | 19 ++++++++++---------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index f9c024c..7c21113 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -275,7 +275,7 @@ end:
 
     d->egl.context_ready = TRUE;
 
-    if (spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display)) != NULL) {
+    if (spice_display_get_gl_scanout(d->display) != NULL) {
         DISPLAY_DEBUG(display, "scanout present during egl init, updating widget");
         spice_display_widget_gl_scanout(display);
         spice_display_widget_update_monitor_area(display);
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index 5b3216f..ea7ed8e 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -91,7 +91,7 @@ struct _SpiceDisplayPrivate {
     SpiceSession            *session;
     SpiceGtkSession         *gtk_session;
     SpiceMainChannel        *main;
-    SpiceChannel            *display;
+    SpiceDisplayChannel     *display;
     SpiceCursorChannel      *cursor;
     SpiceInputsChannel      *inputs;
     SpiceSmartcardChannel   *smartcard;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index c7c48f1..e1191ed 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -301,7 +301,8 @@ void spice_display_widget_update_monitor_area(SpiceDisplay *display)
     if (c == NULL) {
         DISPLAY_DEBUG(display, "update monitor: no monitor %d", d->monitor_id);
         set_monitor_ready(display, false);
-        if (spice_channel_test_capability(d->display, SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
+        if (spice_channel_test_capability(SPICE_CHANNEL(d->display),
+                                          SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
             DISPLAY_DEBUG(display, "waiting until MonitorsConfig is received");
             g_clear_pointer(&monitors, g_array_unref);
             return;
@@ -586,7 +587,7 @@ gl_area_render(GtkGLArea *area, GdkGLContext *context, gpointer user_data)
     spice_egl_update_display(display);
     glFlush();
     if (d->egl.call_draw_done) {
-        spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+        spice_display_gl_draw_done(d->display);
         d->egl.call_draw_done = FALSE;
     }
 
@@ -620,7 +621,7 @@ drawing_area_realize(GtkWidget *area, gpointer user_data)
     SpiceDisplayPrivate *d = display->priv;
 
     if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
-        spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display))) {
+        spice_display_get_gl_scanout(d->display)) {
         spice_display_widget_gl_scanout(display);
     }
 
@@ -2505,7 +2506,7 @@ static void update_area(SpiceDisplay *display,
 #if HAVE_EGL
     if (egl_enabled(d)) {
         const SpiceGlScanout *so =
-            spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display));
+            spice_display_get_gl_scanout(d->display);
         g_return_if_fail(so != NULL);
         primary = (GdkRectangle) {
             .width = so->width,
@@ -2555,7 +2556,7 @@ static void primary_create(SpiceChannel *channel, gint format,
     spice_display_widget_update_monitor_area(display);
 }
 
-static void primary_destroy(SpiceChannel *channel, gpointer data)
+static void primary_destroy(SpiceDisplayChannel *channel, gpointer data)
 {
     SpiceDisplay *display = SPICE_DISPLAY(data);
     SpiceDisplayPrivate *d = display->priv;
@@ -2873,7 +2874,7 @@ void spice_display_widget_gl_scanout(SpiceDisplay *display)
     if (d->egl.context_ready) {
         const SpiceGlScanout *scanout;
 
-        scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display));
+        scanout = spice_display_get_gl_scanout(d->display);
         /* should only be called when the display has a scanout */
         g_return_if_fail(scanout != NULL);
 
@@ -2895,7 +2896,7 @@ static void gl_draw(SpiceDisplay *display,
 
     if (!d->egl.context_ready) {
         DISPLAY_DEBUG(display, "Draw without GL context, skipping");
-        spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+        spice_display_gl_draw_done(d->display);
         return;
     }
 
@@ -2912,7 +2913,7 @@ static void gl_draw(SpiceDisplay *display,
 #endif
     {
         spice_egl_update_display(display);
-        spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+        spice_display_gl_draw_done(d->display);
     }
 }
 #endif
@@ -2936,7 +2937,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
         SpiceDisplayPrimary primary;
         if (id != d->channel_id)
             return;
-        d->display = channel;
+        d->display = SPICE_DISPLAY_CHANNEL(channel);
         spice_g_signal_connect_object(channel, "display-primary-create",
                                       G_CALLBACK(primary_create), display, 0);
         spice_g_signal_connect_object(channel, "display-primary-destroy",
-- 
2.13.0.91.g00982b8dd

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]