[gtk-vnc] Pull pixel format struct out into a separate file with typedef



commit 3c2198477cf65806a9aaaeaa35c2ce4d22896aa4
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Nov 19 14:13:55 2009 +0000

    Pull pixel format struct out into a separate file with typedef
    
    Turn struct vnc_pixel_format into VncPixelFormat type

 src/Makefile.am      |    1 +
 src/vncconnection.c  |    6 ++--
 src/vncconnection.h  |   30 ++++++---------------------
 src/vncdisplay.c     |    4 +-
 src/vncpixelformat.h |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+), 28 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b295f1..cbe9d4c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ libgtk_vnc_1_0_la_SOURCES = blt.h blt1.h \
 	coroutine.h \
 	d3des.h d3des.c \
 	dh.h dh.c \
+	vncpixelformat.h \
 	vncconnection.h vncconnection.c \
 	vncdisplay.h vncdisplay.c \
         vncmarshal.h vncmarshal.c \
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 7354e1c..dabe2d4 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -119,7 +119,7 @@ struct _VncConnection
 	int fd;
 	char *host;
 	char *port;
-	struct vnc_pixel_format fmt;
+	VncPixelFormat fmt;
 	gboolean has_error;
 	int width;
 	int height;
@@ -1005,7 +1005,7 @@ static int vnc_connection_validate_certificate(VncConnection *conn)
 }
 
 
-static void vnc_connection_read_pixel_format(VncConnection *conn, struct vnc_pixel_format *fmt)
+static void vnc_connection_read_pixel_format(VncConnection *conn, VncPixelFormat *fmt)
 {
 	guint8 pad[3];
 
@@ -1040,7 +1040,7 @@ gboolean vnc_connection_has_error(VncConnection *conn)
 }
 
 gboolean vnc_connection_set_pixel_format(VncConnection *conn,
-					 const struct vnc_pixel_format *fmt)
+					 const VncPixelFormat *fmt)
 {
 	guint8 pad[3] = {0};
 
diff --git a/src/vncconnection.h b/src/vncconnection.h
index 91c32f2..1c8ef27 100644
--- a/src/vncconnection.h
+++ b/src/vncconnection.h
@@ -22,11 +22,10 @@
 #define _GVNC_H_
 
 #include <glib.h>
-#include <stdint.h>
 
-typedef struct _VncConnection VncConnection;
+#include "vncpixelformat.h"
 
-struct vnc_pixel_format;
+typedef struct _VncConnection VncConnection;
 
 typedef void (rgb24_render_func)(void *, int, int, int, int, guint8 *, int);
 
@@ -41,28 +40,15 @@ struct vnc_connection_ops
 	gboolean (*bell)(void *);
 	gboolean (*server_cut_text)(void *, const void *, size_t);
 	gboolean (*resize)(void *, int, int);
-        gboolean (*pixel_format)(void *, struct vnc_pixel_format *);
+	gboolean (*pixel_format)(void *, VncPixelFormat *);
 	gboolean (*pointer_type_change)(void *, int);
 	gboolean (*local_cursor)(void *, int, int, int, int, guint8 *);
 	gboolean (*auth_unsupported)(void *, unsigned int);
 	gboolean (*render_jpeg)(void *, rgb24_render_func *render, void *,
 				int, int, int, int, guint8 *, int);
-	gboolean (*get_preferred_pixel_format)(void *, struct vnc_pixel_format *);
+	gboolean (*get_preferred_pixel_format)(void *, VncPixelFormat *);
 };
 
-struct vnc_pixel_format
-{
-	guint8 bits_per_pixel;
-	guint8 depth;
-	guint16 byte_order;
-	guint8 true_color_flag;
-	guint16 red_max;
-	guint16 green_max;
-	guint16 blue_max;
-	guint8 red_shift;
-	guint8 green_shift;
-	guint8 blue_shift;
-};
 
 struct vnc_framebuffer
 {
@@ -178,10 +164,10 @@ gboolean vnc_connection_server_message(VncConnection *conn);
 gboolean vnc_connection_client_cut_text(VncConnection *conn,
 					const void *data, size_t length);
 
-gboolean vnc_connection_pointer_event(VncConnection *conn, uint8_t button_mask,
+gboolean vnc_connection_pointer_event(VncConnection *conn, guint8 button_mask,
 				      guint16 x, guint16 y);
 
-gboolean vnc_connection_key_event(VncConnection *conn, uint8_t down_flag,
+gboolean vnc_connection_key_event(VncConnection *conn, guint8 down_flag,
 				  guint32 key, guint16 scancode);
 
 gboolean vnc_connection_framebuffer_update_request(VncConnection *conn,
@@ -192,14 +178,12 @@ gboolean vnc_connection_framebuffer_update_request(VncConnection *conn,
 gboolean vnc_connection_set_encodings(VncConnection *conn, int n_encoding, gint32 *encoding);
 
 gboolean vnc_connection_set_pixel_format(VncConnection *conn,
-					 const struct vnc_pixel_format *fmt);
+					 const VncPixelFormat *fmt);
 
 gboolean vnc_connection_has_error(VncConnection *conn);
 
 gboolean vnc_connection_set_local(VncConnection *conn, struct vnc_framebuffer *fb);
 
-gboolean vnc_connection_shared_memory_enabled(VncConnection *conn);
-
 const char *vnc_connection_get_name(VncConnection *conn);
 int vnc_connection_get_width(VncConnection *conn);
 int vnc_connection_get_height(VncConnection *conn);
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index e5980cc..1af3e23 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1016,7 +1016,7 @@ static gboolean on_resize(void *opaque, int width, int height)
 }
 
 static gboolean on_pixel_format(void *opaque,
-	struct vnc_pixel_format *fmt G_GNUC_UNUSED)
+				VncPixelFormat *fmt G_GNUC_UNUSED)
 {
         VncDisplay *obj = VNC_DISPLAY(opaque);
         VncDisplayPrivate *priv = obj->priv;
@@ -1025,7 +1025,7 @@ static gboolean on_pixel_format(void *opaque,
 }
 
 static gboolean on_get_preferred_pixel_format(void *opaque,
-	struct vnc_pixel_format *fmt)
+					      VncPixelFormat *fmt)
 {
 	VncDisplay *obj = VNC_DISPLAY(opaque);
 	GdkVisual *v =  gdk_drawable_get_visual(gtk_widget_get_window(GTK_WIDGET(obj)));
diff --git a/src/vncpixelformat.h b/src/vncpixelformat.h
new file mode 100644
index 0000000..f9e40f8
--- /dev/null
+++ b/src/vncpixelformat.h
@@ -0,0 +1,54 @@
+/*
+ * GTK VNC Widget
+ *
+ * Copyright (C) 2006  Anthony Liguori <anthony codemonkey ws>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.0 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef VNC_PIXEL_FORMAT_H
+#define VNC_PIXEL_FORMAT_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+
+typedef struct _VncPixelFormat VncPixelFormat;
+
+struct _VncPixelFormat {
+	guint8 bits_per_pixel;
+	guint8 depth;
+	guint16 byte_order;
+	guint8 true_color_flag;
+	guint16 red_max;
+	guint16 green_max;
+	guint16 blue_max;
+	guint8 red_shift;
+	guint8 green_shift;
+	guint8 blue_shift;
+};
+
+G_END_DECLS
+
+#endif /* VNC_PIXEL_FORMAT_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */



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