[Spice-devel] [PATCH spice-gtk 4/5] gtk: rename spicex_* functions

Marc-André Lureau marcandre.lureau at gmail.com
Tue May 24 19:31:25 UTC 2016


spice-gtk used to have x11/shm backend, now it's only cairo

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/spice-widget-cairo.c |  8 ++++----
 src/spice-widget-priv.h  |  8 ++++----
 src/spice-widget.c       | 27 +++++++++++++--------------
 3 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/src/spice-widget-cairo.c b/src/spice-widget-cairo.c
index 7f5f79d..dfe9c3c 100644
--- a/src/spice-widget-cairo.c
+++ b/src/spice-widget-cairo.c
@@ -23,7 +23,7 @@
 
 
 G_GNUC_INTERNAL
-int spicex_image_create(SpiceDisplay *display)
+int spice_cairo_image_create(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
 
@@ -51,7 +51,7 @@ int spicex_image_create(SpiceDisplay *display)
 }
 
 G_GNUC_INTERNAL
-void spicex_image_destroy(SpiceDisplay *display)
+void spice_cairo_image_destroy(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
 
@@ -62,7 +62,7 @@ void spicex_image_destroy(SpiceDisplay *display)
 }
 
 G_GNUC_INTERNAL
-void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
+void spice_cairo_draw_event(SpiceDisplay *display, cairo_t *cr)
 {
     SpiceDisplayPrivate *d = display->priv;
     cairo_rectangle_int_t rect;
@@ -132,7 +132,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
 }
 
 G_GNUC_INTERNAL
-gboolean spicex_is_scaled(SpiceDisplay *display)
+gboolean spice_cairo_is_scaled(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
     return d->allow_scaling;
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index 266cc87..e36baf3 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -147,10 +147,10 @@ struct _SpiceDisplayPrivate {
 #endif
 };
 
-int      spicex_image_create                 (SpiceDisplay *display);
-void     spicex_image_destroy                (SpiceDisplay *display);
-void     spicex_draw_event                   (SpiceDisplay *display, cairo_t *cr);
-gboolean spicex_is_scaled                    (SpiceDisplay *display);
+int      spice_cairo_image_create                 (SpiceDisplay *display);
+void     spice_cairo_image_destroy                (SpiceDisplay *display);
+void     spice_cairo_draw_event                   (SpiceDisplay *display, cairo_t *cr);
+gboolean spice_cairo_is_scaled                    (SpiceDisplay *display);
 void     spice_display_get_scaling           (SpiceDisplay *display, double *s, int *x, int *y, int *w, int *h);
 gboolean spice_egl_init                      (SpiceDisplay *display, GError **err);
 gboolean spice_egl_realize_display           (SpiceDisplay *display, GdkWindow *win,
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f788dc1..1c9ac2d 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -417,7 +417,7 @@ static void spice_display_dispose(GObject *obj)
 
     SPICE_DEBUG("spice display dispose");
 
-    spicex_image_destroy(display);
+    spice_cairo_image_destroy(display);
     g_clear_object(&d->session);
     d->gtk_session = NULL;
 
@@ -1113,7 +1113,7 @@ static void recalc_geometry(GtkWidget *widget)
     SpiceDisplayPrivate *d = display->priv;
     gdouble zoom = 1.0;
 
-    if (spicex_is_scaled(display))
+    if (spice_cairo_is_scaled(display))
         zoom = (gdouble)d->zoom_level / 100;
 
     SPICE_DEBUG("recalc geom monitor: %d:%d, guest +%d+%d:%dx%d, window %dx%d, zoom %g",
@@ -1228,7 +1228,7 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
         d->area.width == 0 || d->area.height == 0)
         return false;
 
-    spicex_draw_event(display, cr);
+    spice_cairo_draw_event(display, cr);
     update_mouse_pointer(display);
 
     return true;
@@ -1742,10 +1742,9 @@ static int button_mask_gdk_to_spice(int gdk)
     return spice;
 }
 
-G_GNUC_INTERNAL
-void spicex_transform_input (SpiceDisplay *display,
-                             double window_x, double window_y,
-                             int *input_x, int *input_y)
+static void transform_input(SpiceDisplay *display,
+                            double window_x, double window_y,
+                            int *input_x, int *input_y)
 {
     SpiceDisplayPrivate *d = display->priv;
     int display_x, display_y, display_w, display_h;
@@ -1798,7 +1797,7 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
         try_keyboard_grab(display);
     }
 
-    spicex_transform_input (display, motion->x, motion->y, &x, &y);
+    transform_input(display, motion->x, motion->y, &x, &y);
 
     switch (d->mouse_mode) {
     case SPICE_MOUSE_MODE_CLIENT:
@@ -1871,7 +1870,7 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
     if (d->disable_inputs)
         return true;
 
-    spicex_transform_input (display, button->x, button->y, &x, &y);
+    transform_input(display, button->x, button->y, &x, &y);
     if ((x < 0 || x >= d->area.width ||
          y < 0 || y >= d->area.height) &&
         d->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
@@ -1955,7 +1954,7 @@ static void update_image(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
 
-    spicex_image_create(display);
+    spice_cairo_image_create(display);
     if (d->canvas.convert)
         do_color_convert(display, &d->area);
 }
@@ -1976,7 +1975,7 @@ static void realize(GtkWidget *widget)
 
 static void unrealize(GtkWidget *widget)
 {
-    spicex_image_destroy(SPICE_DISPLAY(widget));
+    spice_cairo_image_destroy(SPICE_DISPLAY(widget));
 #ifndef G_OS_WIN32
     spice_egl_unrealize_display(SPICE_DISPLAY(widget));
 #endif
@@ -2326,7 +2325,7 @@ static void update_area(SpiceDisplay *display,
     if (!d->egl.enabled)
 #endif
     {
-        spicex_image_destroy(display);
+        spice_cairo_image_destroy(display);
         if (gtk_widget_get_realized(GTK_WIDGET(display)))
             update_image(display);
     }
@@ -2357,7 +2356,7 @@ static void primary_destroy(SpiceChannel *channel, gpointer data)
     SpiceDisplay *display = SPICE_DISPLAY(data);
     SpiceDisplayPrivate *d = display->priv;
 
-    spicex_image_destroy(display);
+    spice_cairo_image_destroy(display);
     d->canvas.width  = 0;
     d->canvas.height = 0;
     d->canvas.stride = 0;
@@ -2515,7 +2514,7 @@ void spice_display_get_scaling(SpiceDisplay *display,
         wh = fbh;
     }
 
-    if (!spicex_is_scaled(display)) {
+    if (!spice_cairo_is_scaled(display)) {
         s = 1.0;
         x = 0;
         y = 0;
-- 
2.7.4



More information about the Spice-devel mailing list