[Spice-devel] [PATCH v2 02/10] gtk: make SpiceDisplay private

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 11 20:50:33 UTC 2016


Do not leak internals of SpiceDisplay in our headers. This makes also
the class final, which let us extend more easily without fear of
breaking ABI.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/spice-widget-priv.h | 15 +++++++++++++++
 src/spice-widget.h      | 35 -----------------------------------
 2 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index c708e25..8ac0782 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -40,6 +40,21 @@
 
 G_BEGIN_DECLS
 
+typedef struct _SpiceDisplayPrivate SpiceDisplayPrivate;
+
+struct _SpiceDisplay {
+    GtkDrawingArea parent;
+    SpiceDisplayPrivate *priv;
+};
+
+struct _SpiceDisplayClass {
+    GtkDrawingAreaClass parent_class;
+
+    /* signals */
+    void (*mouse_grab)(SpiceChannel *channel, gint grabbed);
+    void (*keyboard_grab)(SpiceChannel *channel, gint grabbed);
+};
+
 #define SPICE_DISPLAY_GET_PRIVATE(obj)                                  \
     (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_DISPLAY, SpiceDisplayPrivate))
 
diff --git a/src/spice-widget.h b/src/spice-widget.h
index 213db7a..5a7c206 100644
--- a/src/spice-widget.h
+++ b/src/spice-widget.h
@@ -42,41 +42,6 @@ G_BEGIN_DECLS
 
 typedef struct _SpiceDisplay SpiceDisplay;
 typedef struct _SpiceDisplayClass SpiceDisplayClass;
-typedef struct _SpiceDisplayPrivate SpiceDisplayPrivate;
-
-/**
- * SpiceDisplay:
- *
- * The #SpiceDisplay struct is opaque and should not be accessed directly.
- */
-struct _SpiceDisplay {
-    GtkDrawingArea parent;
-    SpiceDisplayPrivate *priv;
-    /* Do not add fields to this struct */
-};
-
-/**
- * SpiceDisplayClass:
- * @parent_class: Parent class.
- * @mouse_grab: Signal class handler for the #SpiceDisplay::mouse_grab signal.
- * @keyboard_grab: Signal class handler for the #SpiceDisplay::keyboard_grab signal.
- *
- * Class structure for #SpiceDisplay.
- */
-struct _SpiceDisplayClass {
-    GtkDrawingAreaClass parent_class;
-
-    /* signals */
-    void (*mouse_grab)(SpiceChannel *channel, gint grabbed);
-    void (*keyboard_grab)(SpiceChannel *channel, gint grabbed);
-
-    /*< private >*/
-    /*
-     * If adding fields to this struct, remove corresponding
-     * amount of padding to avoid changing overall struct size
-     */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
-};
 
 /**
  * SpiceDisplayKeyEvent:
-- 
2.5.0



More information about the Spice-devel mailing list