summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2010-11-10 22:56:39 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2010-11-10 23:13:15 +0100
commitb1210d3cd6a605fadf82c09a630fa5238f4ce9f3 (patch)
tree3d6c9c1316e9fbf94263b54aeeedfce902ad7fe2
parent0d980674ca6cc6903c42478e3fbc61abed7b2cb2 (diff)
gtk: add pygtk modulegtk.v2
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.ac48
-rw-r--r--gtk/Makefile.am63
-rw-r--r--gtk/spice-channel.c4
-rw-r--r--gtk/spice-channel.h11
-rw-r--r--gtk/spice-client-gtk-module.c26
-rw-r--r--gtk/spice-client-gtk.defs370
-rw-r--r--gtk/spice-client-gtk.override16
-rw-r--r--gtk/spice-widget.c13
-rw-r--r--gtk/spice-widget.h11
-rw-r--r--gtk/spicy.c2
-rw-r--r--m4/check_python.m446
13 files changed, 593 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 2690fbd..6006e12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS = -I m4
+
SUBDIRS = common server client gtk python_modules
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/autogen.sh b/autogen.sh
index 2619803..de1f266 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,7 +8,7 @@ set -e # exit on errors
PACKAGE=spice
-ACLOCAL_FLAGS=""
+ACLOCAL_FLAGS="-I m4"
LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
LIBTOOLIZE_FLAGS="--copy --force"
AUTOHEADER=${AUTOHEADER-autoheader}
diff --git a/configure.ac b/configure.ac
index f639707..8ecc110 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,6 +264,54 @@ AC_CHECK_LIB(z, deflate, Z_LIBS='-lz', AC_MSG_ERROR([zlib not found]))
AC_SUBST(Z_LIBS)
GOBJECT_INTROSPECTION_CHECK([0.6.7])
+PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
+ [gobject-introspection-1.0 >= 0.9.4],
+ [has_symbol_prefix=yes], [:])
+AM_CONDITIONAL([G_IR_SCANNER_SYMBOL_PREFIX], [test "x$has_symbol_prefix" = "xyes"])
+
+AC_ARG_WITH(python,
+[ --with-python build python bindings],
+[case "${withval}" in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for python option]) ;;
+ esac],[withval=yes])
+
+if test "$with_gtk" = "3.0"
+then
+ WITH_PYTHON=no
+else
+ WITH_PYTHON=$withval
+fi
+
+if test "$WITH_PYTHON" = "yes"; then
+ PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.0.0)
+ AC_SUBST(PYGTK_CFLAGS)
+ AC_SUBST(PYGTK_LIBS)
+
+ AM_PATH_PYTHON
+
+ AC_MSG_CHECKING([whether $PYTHON version >= 2.0])
+ HAVE_PYTHON_REQUIRED=no
+ AM_PYTHON_CHECK_VERSION([$PYTHON], [2.0],
+ [HAVE_PYTHON_REQUIRED="yes"],
+ [HAVE_PYTHON_REQUIRED="no"])
+
+ AC_MSG_RESULT($HAVE_PYTHON_REQUIRED)
+
+ if test "x$HAVE_PYTHON_REQUIRED" != "xyes"
+ then
+ AC_MSG_ERROR("No suitable python found")
+ fi
+
+ AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
+
+ if test "x$have_python_headers" != "xyes"
+ then
+ AC_MSG_ERROR("No python development headers found")
+ fi
+fi
+
+AM_CONDITIONAL(WITH_PYTHON, [test "$WITH_PYTHON" = "yes"])
dnl ===========================================================================
dnl check compiler flags
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index fdaa09f..d44fff2 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -90,6 +90,8 @@ libspice_client_glib_la_SOURCES = \
spice-session.h \
spice-channel.c \
spice-channel.h \
+ spice-channel-enums.h \
+ spice-channel-enums.c \
spice-channel-priv.h \
tcp.c \
tcp.h \
@@ -148,6 +150,7 @@ libspice_client_glibinclude_HEADERS = \
spice-types.h \
spice-session.h \
spice-channel.h \
+ spice-channel-enums.h \
channel-main.h \
channel-display.h \
channel-cursor.h \
@@ -197,6 +200,30 @@ spice-marshal.c: spice-marshal.txt
spice-marshal.h: spice-marshal.txt
$(AM_V_GEN)glib-genmarshal --header $< > $@ || (rm -f $@ && exit 1)
+spice-channel-enums.c: spice-channel.h
+ $(AM_V_GEN)glib-mkenums --fhead "#include <glib-object.h>\n" \
+ --fhead "#include \"spice-channel-enums.h\"\n\n" \
+ --fprod "\n#include \"spice-channel.h\"\n" \
+ --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n};\n\n" \
+ --vtail "GType\n@enum_name@_get_type (void)\n{\n" \
+ --vtail " static GType type = 0;\n\n" \
+ --vtail " if (!type)\n" \
+ --vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \
+ --vtail " return type;\n}\n\n" \
+ $< > $@
+
+spice-channel-enums.h: spice-channel.h
+ $(AM_V_GEN)glib-mkenums --fhead "#ifndef SPICE_CHANNEL_ENUMS_H\n" \
+ --fhead "#define SPICE_CHANNEL_ENUMS_H\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif /* SPICE_CHANNEL_ENUMS_H */\n" \
+ --eprod "#define SPICE_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \
+ --eprod "GType @enum_name@_get_type (void);\n" \
+ $< > $@
+
generated_demarshallers.c: $(top_srcdir)/spice.proto
$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@
@@ -234,14 +261,48 @@ vncdisplaykeymap_win322xtkbd.c:
BUILT_SOURCES = spice-marshal.c spice-marshal.h \
generated_demarshallers.c generated_demarshallers1.c \
generated_marshallers.c generated_marshallers1.c \
+ spice-channel-enums.c spice-channel-enums.h \
$(KEYMAPS)
CLEANFILES = $(BUILT_SOURCES)
+if WITH_PYTHON
+pyexec_LTLIBRARIES = SpiceClientGtk.la
+
+SpiceClientGtk_la_LIBADD = libspice-client-gtk.la libspice-client-glib.la @PYGTK_LIBS@
+SpiceClientGtk_la_CFLAGS = @GTK2_CFLAGS@ @PYTHON_INCLUDES@ @PYGTK_CFLAGS@
+SpiceClientGtk_la_LDFLAGS = -module -avoid-version -fPIC
+SpiceClientGtk_la_SOURCES = spice-client-gtk-module.c spice-client-gtk-module.defs.c
+
+CODEGENDIR = $(shell pkg-config --variable=codegendir pygtk-2.0)
+DEFSDIR = $(shell pkg-config --variable=defsdir pygtk-2.0)
+
+spice-client-gtk.defs: $(libspice_client_gtkinclude_HEADERS) $(libspice_client_glibinclude_HEADERS)
+ $(AM_V_GEN)$(PYTHON) $(CODEGENDIR)/h2def.py $(libspice_client_gtkinclude_HEADERS) $(libspice_client_glibinclude_HEADERS) > $@
+
+spice-client-gtk-module.defs.c: spice-client-gtk.override spice-client-gtk.defs
+ $(AM_V_GEN)pygobject-codegen-2.0 --prefix spice \
+ --register $(DEFSDIR)/gdk-types.defs \
+ --register $(DEFSDIR)/gtk-types.defs \
+ --override $(srcdir)/spice-client-gtk.override \
+ spice-client-gtk.defs > $@
+
+CLEANFILES += spice-client-gtk.defs spice-client-gtk-module.defs.c
+EXTRA_DIST += spice-client-gtk.override
+else
+EXTRA_DIST += spice-client-gtk.override spice-client-gtk-module.c
+endif
+
-include $(INTROSPECTION_MAKEFILE)
+if G_IR_SCANNER_SYMBOL_PREFIX
+PREFIX_ARGS = --symbol-prefix=spice --identifier-prefix=Spice
+else
+PREFIX_ARGS = --strip-prefix=Spice
+endif
+
INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --strip-prefix=Spice
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) $(PREFIX_ARGS)
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 53cd21e..ac15034 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -220,7 +220,7 @@ static void spice_channel_class_init(SpiceChannelClass *klass)
}
static void spice_channel_emit_event(SpiceChannel *channel,
- enum SpiceChannelEvent event)
+ SpiceChannelEvent event)
{
g_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, event);
}
@@ -932,7 +932,7 @@ reconnect:
return true;
}
-void spice_channel_disconnect(SpiceChannel *channel, enum SpiceChannelEvent reason)
+void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent reason)
{
spice_channel *c = SPICE_CHANNEL_GET_PRIVATE(channel);
diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h
index 69211d6..ff06c90 100644
--- a/gtk/spice-channel.h
+++ b/gtk/spice-channel.h
@@ -3,6 +3,8 @@
G_BEGIN_DECLS
+#include "spice-types.h"
+
#define SPICE_TYPE_CHANNEL (spice_channel_get_type ())
#define SPICE_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_TYPE_CHANNEL, SpiceChannel))
#define SPICE_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_TYPE_CHANNEL, SpiceChannelClass))
@@ -13,7 +15,8 @@ G_BEGIN_DECLS
typedef struct spice_msg_in spice_msg_in;
typedef struct spice_msg_out spice_msg_out;
-enum SpiceChannelEvent {
+typedef enum
+{
SPICE_CHANNEL_NONE = 0,
SPICE_CHANNEL_OPENED = 10,
SPICE_CHANNEL_CLOSED,
@@ -22,7 +25,7 @@ enum SpiceChannelEvent {
SPICE_CHANNEL_ERROR_LINK,
SPICE_CHANNEL_ERROR_AUTH,
SPICE_CHANNEL_ERROR_IO,
-};
+} SpiceChannelEvent;
struct _SpiceChannel
{
@@ -40,7 +43,7 @@ struct _SpiceChannelClass
void (*channel_up)(SpiceChannel *channel);
/* signals */
- void (*spice_channel_event)(SpiceChannel *channel, enum SpiceChannelEvent event);
+ void (*spice_channel_event)(SpiceChannel *channel, SpiceChannelEvent event);
#if 0
/*
@@ -58,7 +61,7 @@ typedef void (*spice_msg_handler)(SpiceChannel *channel, spice_msg_in *in);
SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id);
void spice_channel_destroy(SpiceChannel *channel);
gboolean spice_channel_connect(SpiceChannel *channel);
-void spice_channel_disconnect(SpiceChannel *channel, enum SpiceChannelEvent event);
+void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent event);
G_END_DECLS
diff --git a/gtk/spice-client-gtk-module.c b/gtk/spice-client-gtk-module.c
new file mode 100644
index 0000000..6989a5d
--- /dev/null
+++ b/gtk/spice-client-gtk-module.c
@@ -0,0 +1,26 @@
+#include <pygobject.h>
+
+void spice_register_classes (PyObject *d);
+void spice_add_constants(PyObject *module, const gchar *strip_prefix);
+extern PyMethodDef spice_functions[];
+
+DL_EXPORT(void) initSpiceClientGtk(void)
+{
+ PyObject *m, *d;
+
+ init_pygobject ();
+
+ m = Py_InitModule ("SpiceClientGtk", spice_functions);
+ if (PyErr_Occurred())
+ Py_FatalError("can't init module");
+
+ d = PyModule_GetDict (m);
+ if (PyErr_Occurred())
+ Py_FatalError("can't get dict");
+
+ spice_register_classes (d);
+
+ if (PyErr_Occurred ()) {
+ Py_FatalError ("can't initialise module SpiceClientGtk");
+ }
+}
diff --git a/gtk/spice-client-gtk.defs b/gtk/spice-client-gtk.defs
new file mode 100644
index 0000000..7599667
--- /dev/null
+++ b/gtk/spice-client-gtk.defs
@@ -0,0 +1,370 @@
+;; -*- scheme -*-
+; object definitions ...
+(define-object Channel
+ (in-module "Spice")
+ (parent "GObject")
+ (c-name "SpiceChannel")
+ (gtype-id "SPICE_TYPE_CHANNEL")
+)
+
+(define-object CursorChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpiceCursorChannel")
+ (gtype-id "SPICE_TYPE_CURSOR_CHANNEL")
+)
+
+(define-object Display
+ (in-module "Spice")
+ (parent "GtkDrawingArea")
+ (c-name "SpiceDisplay")
+ (gtype-id "SPICE_TYPE_DISPLAY")
+)
+
+(define-object DisplayChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpiceDisplayChannel")
+ (gtype-id "SPICE_TYPE_DISPLAY_CHANNEL")
+)
+
+(define-object InputsChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpiceInputsChannel")
+ (gtype-id "SPICE_TYPE_INPUTS_CHANNEL")
+)
+
+(define-object MainChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpiceMainChannel")
+ (gtype-id "SPICE_TYPE_MAIN_CHANNEL")
+)
+
+(define-object PlaybackChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpicePlaybackChannel")
+ (gtype-id "SPICE_TYPE_PLAYBACK_CHANNEL")
+)
+
+(define-object RecordChannel
+ (in-module "Spice")
+ (parent "SpiceChannel")
+ (c-name "SpiceRecordChannel")
+ (gtype-id "SPICE_TYPE_RECORD_CHANNEL")
+)
+
+(define-object Session
+ (in-module "Spice")
+ (parent "GObject")
+ (c-name "SpiceSession")
+ (gtype-id "SPICE_TYPE_SESSION")
+)
+
+;; Enumerations and flags ...
+
+(define-enum ChannelEvent
+ (in-module "Spice")
+ (c-name "SpiceChannelEvent")
+ (gtype-id "SPICE_TYPE_CHANNEL_EVENT")
+ (values
+ '("none" "SPICE_CHANNEL_NONE")
+ '("opened" "SPICE_CHANNEL_OPENED")
+ '("closed" "SPICE_CHANNEL_CLOSED")
+ '("error-connect" "SPICE_CHANNEL_ERROR_CONNECT")
+ '("error-tls" "SPICE_CHANNEL_ERROR_TLS")
+ '("error-link" "SPICE_CHANNEL_ERROR_LINK")
+ '("error-auth" "SPICE_CHANNEL_ERROR_AUTH")
+ '("error-io" "SPICE_CHANNEL_ERROR_IO")
+ )
+)
+
+
+;; From spice-widget.h
+
+(define-function spice_display_get_type
+ (c-name "spice_display_get_type")
+ (return-type "GType")
+)
+
+(define-function spice_display_new
+ (c-name "spice_display_new")
+ (is-constructor-of "SpiceDisplay")
+ (return-type "SpiceDisplay*")
+ (parameters
+ '("SpiceSession*" "session")
+ '("int" "id")
+ )
+)
+
+(define-method mouse_ungrab
+ (of-object "SpiceDisplay")
+ (c-name "spice_display_mouse_ungrab")
+ (return-type "none")
+)
+
+(define-method copy_to_guest
+ (of-object "SpiceDisplay")
+ (c-name "spice_display_copy_to_guest")
+ (return-type "none")
+)
+
+(define-method paste_from_guest
+ (of-object "SpiceDisplay")
+ (c-name "spice_display_paste_from_guest")
+ (return-type "none")
+)
+
+
+
+;; From spice-audio.h
+
+(define-function spice_audio_new
+ (c-name "spice_audio_new")
+ (is-constructor-of "SpiceAudio")
+ (return-type "GObject*")
+ (parameters
+ '("SpiceSession*" "session")
+ '("GMainLoop*" "mainloop")
+ '("const-char*" "name")
+ )
+)
+
+
+
+;; From spice-client.h
+
+
+
+;; From spice-types.h
+
+
+
+;; From spice-session.h
+
+(define-function spice_session_get_type
+ (c-name "spice_session_get_type")
+ (return-type "GType")
+)
+
+(define-function spice_session_new
+ (c-name "spice_session_new")
+ (is-constructor-of "SpiceSession")
+ (return-type "SpiceSession*")
+)
+
+(define-method connect
+ (of-object "SpiceSession")
+ (c-name "spice_session_connect")
+ (return-type "gboolean")
+)
+
+(define-method disconnect
+ (of-object "SpiceSession")
+ (c-name "spice_session_disconnect")
+ (return-type "none")
+)
+
+(define-method get_channels
+ (of-object "SpiceSession")
+ (c-name "spice_session_get_channels")
+ (return-type "GList*")
+)
+
+
+
+;; From spice-channel.h
+
+(define-function spice_channel_get_type
+ (c-name "spice_channel_get_type")
+ (return-type "GType")
+)
+
+(define-function spice_channel_new
+ (c-name "spice_channel_new")
+ (is-constructor-of "SpiceChannel")
+ (return-type "SpiceChannel*")
+ (parameters
+ '("SpiceSession*" "s")
+ '("int" "type")
+ '("int" "id")
+ )
+)
+
+(define-method destroy
+ (of-object "SpiceChannel")
+ (c-name "spice_channel_destroy")
+ (return-type "none")
+)
+
+(define-method connect
+ (of-object "SpiceChannel")
+ (c-name "spice_channel_connect")
+ (return-type "gboolean")
+)
+
+(define-method disconnect
+ (of-object "SpiceChannel")
+ (c-name "spice_channel_disconnect")
+ (return-type "none")
+ (parameters
+ '("SpiceChannelEvent" "event")
+ )
+)
+
+
+
+;; From spice-channel-enums.h
+
+(define-function spice_channel_event_get_type
+ (c-name "spice_channel_event_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From channel-main.h
+
+(define-function spice_main_channel_get_type
+ (c-name "spice_main_channel_get_type")
+ (return-type "GType")
+)
+
+(define-method set_display
+ (of-object "SpiceMainChannel")
+ (c-name "spice_main_set_display")
+ (return-type "none")
+ (parameters
+ '("int" "id")
+ '("int" "x")
+ '("int" "y")
+ '("int" "width")
+ '("int" "height")
+ )
+)
+
+(define-method clipboard_grab
+ (of-object "SpiceMainChannel")
+ (c-name "spice_main_clipboard_grab")
+ (return-type "none")
+ (parameters
+ '("int*" "types")
+ '("int" "ntypes")
+ )
+)
+
+(define-method clipboard_release
+ (of-object "SpiceMainChannel")
+ (c-name "spice_main_clipboard_release")
+ (return-type "none")
+)
+
+
+
+;; From channel-display.h
+
+(define-function spice_display_channel_get_type
+ (c-name "spice_display_channel_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From channel-cursor.h
+
+(define-function spice_cursor_channel_get_type
+ (c-name "spice_cursor_channel_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From channel-inputs.h
+
+(define-function spice_inputs_channel_get_type
+ (c-name "spice_inputs_channel_get_type")
+ (return-type "GType")
+)
+
+(define-method motion
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_motion")
+ (return-type "none")
+ (parameters
+ '("gint" "dx")
+ '("gint" "dy")
+ '("gint" "button_state")
+ )
+)
+
+(define-method position
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_position")
+ (return-type "none")
+ (parameters
+ '("gint" "x")
+ '("gint" "y")
+ '("gint" "display")
+ '("gint" "button_state")
+ )
+)
+
+(define-method button_press
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_button_press")
+ (return-type "none")
+ (parameters
+ '("gint" "button")
+ '("gint" "button_state")
+ )
+)
+
+(define-method button_release
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_button_release")
+ (return-type "none")
+ (parameters
+ '("gint" "button")
+ '("gint" "button_state")
+ )
+)
+
+(define-method key_press
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_key_press")
+ (return-type "none")
+ (parameters
+ '("guint" "keyval")
+ )
+)
+
+(define-method key_release
+ (of-object "SpiceInputsChannel")
+ (c-name "spice_inputs_key_release")
+ (return-type "none")
+ (parameters
+ '("guint" "keyval")
+ )
+)
+
+
+
+;; From channel-playback.h
+
+(define-function spice_playback_channel_get_type
+ (c-name "spice_playback_channel_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From channel-record.h
+
+(define-function spice_record_channel_get_type
+ (c-name "spice_record_channel_get_type")
+ (return-type "GType")
+)
+
+
diff --git a/gtk/spice-client-gtk.override b/gtk/spice-client-gtk.override
new file mode 100644
index 0000000..44bae2b
--- /dev/null
+++ b/gtk/spice-client-gtk.override
@@ -0,0 +1,16 @@
+%%
+headers
+#include <Python.h>
+#include "pygobject.h"
+#include "spice-widget.h"
+#include "spice-channel-enums.h"
+%%
+modulename spice_client_gtk
+%%
+import gobject.GObject as PyGObject_Type
+import gtk.DrawingArea as PyGtkDrawingArea_Type
+import gtk.Widget as PyGtkWidget_Type
+%%
+ignore-glob
+ *_get_type
+%%
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index c30dabd..8dc8224 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1324,7 +1324,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat
return;
}
-GtkWidget *spice_display_new(SpiceSession *session, int id)
+SpiceDisplay *spice_display_new(SpiceSession *session, int id)
{
SpiceDisplay *display;
spice_display *d;
@@ -1345,17 +1345,16 @@ GtkWidget *spice_display_new(SpiceSession *session, int id)
}
g_list_free(list);
- return GTK_WIDGET(display);
+ return display;
}
-void spice_display_mouse_ungrab(GtkWidget *widget)
+void spice_display_mouse_ungrab(SpiceDisplay *display)
{
- try_mouse_ungrab(widget);
+ try_mouse_ungrab(GTK_WIDGET(display));
}
-void spice_display_copy_to_guest(GtkWidget *widget)
+void spice_display_copy_to_guest(SpiceDisplay *display)
{
- SpiceDisplay *display = SPICE_DISPLAY(widget);
spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display);
if (d->clip_hasdata && !d->clip_grabbed) {
@@ -1363,7 +1362,7 @@ void spice_display_copy_to_guest(GtkWidget *widget)
}
}
-void spice_display_paste_from_guest(GtkWidget *widget)
+void spice_display_paste_from_guest(SpiceDisplay *display)
{
g_warning("%s: TODO", __FUNCTION__);
}
diff --git a/gtk/spice-widget.h b/gtk/spice-widget.h
index bccf6b8..e1e3c4d 100644
--- a/gtk/spice-widget.h
+++ b/gtk/spice-widget.h
@@ -35,11 +35,12 @@ struct _SpiceDisplayClass {
};
GType spice_display_get_type(void);
-G_END_DECLS
-GtkWidget* spice_display_new(SpiceSession *session, int id);
-void spice_display_mouse_ungrab(GtkWidget *widget);
-void spice_display_copy_to_guest(GtkWidget *widget);
-void spice_display_paste_from_guest(GtkWidget *widget);
+SpiceDisplay* spice_display_new(SpiceSession *session, int id);
+void spice_display_mouse_ungrab(SpiceDisplay *display);
+void spice_display_copy_to_guest(SpiceDisplay *display);
+void spice_display_paste_from_guest(SpiceDisplay *display);
+
+G_END_DECLS
#endif /* __SPICE_CLIENT_WIDGET_H__ */
diff --git a/gtk/spicy.c b/gtk/spicy.c
index ddda9fa..f139e28 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -584,7 +584,7 @@ static void recent_add(SpiceSession *session)
gtk_recent_manager_add_full(recent, uri, &meta);
}
-static void main_channel_event(SpiceChannel *channel, enum SpiceChannelEvent event,
+static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
gpointer data)
{
spice_connection *conn = data;
diff --git a/m4/check_python.m4 b/m4/check_python.m4
new file mode 100644
index 0000000..16fb49c
--- /dev/null
+++ b/m4/check_python.m4
@@ -0,0 +1,46 @@
+# serial 3
+# Find valid warning flags for the C Compiler. -*-Autoconf-*-
+#
+# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+# Written by Jesse Thilo.
+
+dnl a macro to check for ability to create python extensions
+dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_INCLUDES
+AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+ [AC_REQUIRE([AM_PATH_PYTHON])
+ AC_MSG_CHECKING(for headers required to compile python extensions)
+ dnl deduce PYTHON_INCLUDES
+ py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+ py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+ PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+ if test "$py_prefix" != "$py_exec_prefix"; then
+ PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+ fi
+ AC_SUBST(PYTHON_INCLUDES)
+ dnl check if the headers exist:
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+ AC_TRY_CPP([#include <Python.h>],dnl
+ [AC_MSG_RESULT(found)
+ $1],dnl
+ [AC_MSG_RESULT(not found)
+ $2])
+ CPPFLAGS="$save_CPPFLAGS"
+])