spice-space-commit Mailing List for Spice Space (Page 2)
Brought to you by:
ykamay
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(81) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:59
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit c8c1837809bfa2d8a2c2d0f5a797fc6c595dd71e Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 11:58:00 2010 +0200 common: add "install" target for make (subdir config) Install source files in $(prefix)/src/spice-common/ Install linux/ffmpeg_inc.h in $(prefix)/src/spice-common/linux/ Install spice-common.pc in $(libdir)/pkgconfig/ Signed-off-by: Uri Lublin <ur...@re...> diff --git a/common/Makefile.am b/common/Makefile.am index 7fcdfe9..c1a55f1 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -47,3 +47,13 @@ COMMON_SRCS = \ EXTRA_DIST = $(COMMON_SRCS) +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = spice-common.pc + +common_srcdir=$(prefix)/src/spice-common +common_src_DATA = $(COMMON_SRCS) + +linux_includedir=$(common_srcdir)/linux +linux_include_DATA=linux/ffmpeg_inc.h + +DISTCLEANFILES = spice-common.pc linux/ffmpeg_inc.h |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:50
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit b23e84ce37a4e50d7d8ef932aa483924f27c9909 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 11:58:00 2010 +0200 common: add spice-common.pc (subdir config) The package-config file is to be used when ../common is not available, e.g. when building each subdir separately. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/common/configure.ac b/common/configure.ac index c375809..76318e6 100644 --- a/common/configure.ac +++ b/common/configure.ac @@ -10,7 +10,7 @@ AC_CONFIG_MACRO_DIR([m4]) m4_include(../configure.ac.shared) -AC_CONFIG_FILES([Makefile linux/ffmpeg_inc.h]) +AC_CONFIG_FILES([Makefile linux/ffmpeg_inc.h spice-common.pc]) AC_OUTPUT dnl ========================================================================== diff --git a/common/spice-common.pc.in b/common/spice-common.pc.in new file mode 100644 index 0000000..669b3c9 --- /dev/null +++ b/common/spice-common.pc.in @@ -0,0 +1,6 @@ +prefix=@prefix@ +common_src_dir=${prefix}/src/spice-common + +Name: @PACKAGE@ +Description: Spice common sources +Version: @VERSION@ |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:42
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit e2dd219f6bb96036e54acfd7c2cf65ff09847f9e Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 11:58:00 2010 +0200 configure.ac: use AC_CONFIG_SUBDIRS to run configure in subdirs (subdir config) That's about all the work configure.ac does. Moved config.pc.in to server, and updated Makefile.am and server/Makefile.am accordingly Signed-off-by: Uri Lublin <ur...@re...> diff --git a/Makefile.am b/Makefile.am index c5e5c7b..b4232cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1 @@ SUBDIRS = common server client - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = spice.pc - -DISTCLEANFILES = \ - spice.pc diff --git a/configure.ac b/configure.ac index ec2d99f..742987e 100644 --- a/configure.ac +++ b/configure.ac @@ -8,84 +8,11 @@ AC_INIT(spice, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice) AC_CONFIG_MACRO_DIR([m4]) -# Define default SPICE_COMMON_SRCDIR -# Maybe overwritten by ./configure.ac.shared -SPICE_COMMON_SRCDIR='$(top_srcdir)'/common - m4_include(configure.ac.shared) -AC_PROG_LIBTOOL - -SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_MAJOR, SPICE_MINOR, SPICE_MICRO) -AC_SUBST(SPICE_LT_VERSION) - - -if test "$platform_win32" = yes; then - red_target=windows -else - red_target=x11 -fi -AC_SUBST(red_target) - -dnl ========================================================================= -dnl Check deps - - -PKG_CHECK_MODULES(XRANDR, xrandr) -AC_SUBST(XRANDR_CFLAGS) -AC_SUBST(XRANDR_LIBS) -SPICE_REQUIRES+=" xrandr" - -PKG_CHECK_MODULES(XRANDR12, - xrandr >= 1.2, - have_xrandr12=yes, - have_xrandr12=no) - -AM_CONDITIONAL([HAVE_XRANDR12], [test "x$have_xrandr12" = "xyes"]) -if test "x$have_xrandr12" = "xyes" ; then - AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12]) -fi - - -PKG_CHECK_MODULES(LOG4CPP, log4cpp) -AC_SUBST(LOG4CPP_CFLAGS) -AC_SUBST(LOG4CPP_LIBS) -SPICE_REQUIRES+=" log4cpp" - -dnl ========================================================================= -dnl -fvisibility stuff - -have_gcc4=no -AC_MSG_CHECKING(for -fvisibility) -AC_COMPILE_IFELSE([ -#if defined(__GNUC__) && (__GNUC__ >= 4) -#else -error Need GCC 4.0 for visibility -#endif -int main () { return 0; } -], have_gcc4=yes) - -if test "x$have_gcc4" = "xyes"; then - VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden" -fi -AC_MSG_RESULT($have_gcc4) -AC_SUBST(VISIBILITY_HIDDEN_CFLAGS) - -AC_SUBST(SPICE_COMMON_SRCDIR) -AC_SUBST(SPICE_REQUIRES) -AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) -AC_SUBST(SPICE_NONPKGCONFIG_LIBS) - -AC_OUTPUT([ -Makefile -spice.pc -common/Makefile -common/linux/ffmpeg_inc.h -server/Makefile -client/Makefile -client/x11/Makefile -client/x11/images/Makefile -]) +AC_CONFIG_SUBDIRS([common server client]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT dnl ========================================================================== echo " @@ -97,9 +24,5 @@ echo " c compiler: ${CC} c++ compiler: ${CXX} - Have XRANDR 1.2: ${have_xrandr12} - - Red target: ${red_target} - Now type 'make' to build $PACKAGE " diff --git a/server/Makefile.am b/server/Makefile.am index 63d88e1..15ed08e 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -82,3 +82,9 @@ EXTRA_DIST = \ glz_encode_match_tmpl.c \ glz_encode_tmpl.c \ $(NULL) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = spice.pc + +DISTCLEANFILES = \ + spice.pc diff --git a/server/configure.ac b/server/configure.ac index 254341e..d047078 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -32,8 +32,7 @@ AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) -AC_CONFIG_FILES([Makefile]) -#AC_CONFIG_FILES([Makefile spice.pc]) +AC_CONFIG_FILES([Makefile spice.pc]) AC_OUTPUT dnl ========================================================================== diff --git a/spice.pc.in b/server/spice.pc.in similarity index 100% rename from spice.pc.in rename to server/spice.pc.in |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:34
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 49e532c327b1ee0d2f83e98812708d58a8496c94 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 09:04:06 2010 +0200 configure.ac.shared: prefer ffmpeg-spice (if exists) over ffmpeg (subdir config) If ffmpeg-spice exists use ffmpeg-spice. If ffmpeg-spice does not exist and ffmpeg exists, use ffmpeg If none exist, fail. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac.shared b/configure.ac.shared index 88bc8be..0cb9859 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -99,12 +99,22 @@ AC_SUBST(CELT051_LIBS) AC_SUBST(CELT051_LIBDIR) SPICE_REQUIRES+=" celt051 >= 0.5.1.1" -PKG_CHECK_MODULES(FFMPEG, libavcodec libavutil) -AC_SUBST(FFMPEG_CFLAGS) -AC_SUBST(FFMPEG_LIBS) -FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil` -AC_SUBST(FFMPEG_LIBDIR) -SPICE_REQUIRES+=" libavcodec libavutil" +AC_MSG_CHECKING(for ffmpeg-spice) +PKG_CHECK_EXISTS(libavcodec-spice libavutil-spice, [use_ffmpeg_spice=yes], [use_ffmpeg_spice=no]) +AC_MSG_RESULT($use_ffmpeg_spice) +AC_MSG_CHECKING(for ffmpeg) +PKG_CHECK_EXISTS(libavcodec libavutil, [use_ffmpeg=yes], [use_ffmpeg=no]) +AC_MSG_RESULT($use_ffmpeg) +if test "$use_ffmpeg_spice" = "yes"; then + PKG_CHECK_MODULES(FFMPEG, libavcodec-spice libavutil-spice) + FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil-spice` +elif test "$use_ffmpeg" = "yes"; then + PKG_CHECK_MODULES(FFMPEG, libavcodec libavutil) + FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil` +else + echo "please install ffmpeg-spice or ffmpeg devel package" + exit 1 +fi saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:24
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit bfba2971bc3363ad6bd1dfeea5ce002b93431db7 Author: Uri Lublin <ur...@re...> Date: Tue Jan 5 22:44:11 2010 +0200 spice: client: Makefile.am: add missing files to file-list (subdir config) The follwing files exist in client directory but not in RED_COMMON_SRCS, thus they are not part of distribution tarball (make dist). Adding them fixes building the spice client out of a distribution tarball. Those files are: icon.h process_loop.h red_gdi_canvas.cpp red_gdi_canvas.h red_pixmap_gdi.h gdi_canvas.cpp Similarly, the following files were added to spicec_SOURCES in client/x11/Makefile.am: event_sources_p.h diff --git a/client/Makefile.am b/client/Makefile.am index cb80895..f30408c 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -48,6 +48,7 @@ RED_COMMON_SRCS = \ platform.h \ playback_channel.cpp \ process_loop.cpp \ + process_loop.h \ quic.cpp \ read_write_mutex.h \ record_channel.cpp \ @@ -77,6 +78,12 @@ RED_COMMON_SRCS = \ threads.h \ utils.cpp \ utils.h \ + icon.h \ + event_sources.h \ + red_gdi_canvas.cpp \ + red_gdi_canvas.h \ + red_pixmap_gdi.h \ + gdi_canvas.cpp \ $(NULL) EXTRA_DIST = $(RED_COMMON_SRCS) diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am index d8c8363..d497a7b 100644 --- a/client/x11/Makefile.am +++ b/client/x11/Makefile.am @@ -108,6 +108,7 @@ bin_PROGRAMS = spicec spicec_SOURCES = \ atomic_count.h \ event_sources_p.cpp \ + event_sources_p.h \ main.cpp \ named_pipe.h \ named_pipe.cpp \ |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:17
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 203c85c4ffaabf4e2d3c897144e03082681d97e3 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 09:04:06 2010 +0200 client: remove '../common' from #include directive (subdir config) We compile with -I$(COMMON_DIR) (which currently is ../common), so there is no need for that. Later we would like to be able to have a different COMMON_DIR. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/cairo_canvas.cpp b/client/cairo_canvas.cpp index 54211e4..3b6f71f 100644 --- a/client/cairo_canvas.cpp +++ b/client/cairo_canvas.cpp @@ -20,5 +20,5 @@ #define CANVAS_ERROR(format, ...) THROW(format, ## __VA_ARGS__) -#include "../common/cairo_canvas.c" +#include "cairo_canvas.c" diff --git a/client/canvas_utils.cpp b/client/canvas_utils.cpp index 3210187..0a8a458 100644 --- a/client/canvas_utils.cpp +++ b/client/canvas_utils.cpp @@ -21,5 +21,5 @@ #define CANVAS_ERROR(format, ...) THROW(format, ## __VA_ARGS__) -#include "../common/canvas_utils.c" +#include "canvas_utils.c" diff --git a/client/gdi_canvas.cpp b/client/gdi_canvas.cpp index f8aaaef..a05f89f 100644 --- a/client/gdi_canvas.cpp +++ b/client/gdi_canvas.cpp @@ -20,5 +20,5 @@ #define CANVAS_ERROR(format, ...) THROW(format, ## __VA_ARGS__) -#include "../common/gdi_canvas.c" +#include "gdi_canvas.c" diff --git a/client/gl_canvas.cpp b/client/gl_canvas.cpp index e66be86..c8e6509 100644 --- a/client/gl_canvas.cpp +++ b/client/gl_canvas.cpp @@ -17,5 +17,5 @@ #define GL_GLEXT_PROTOTYPES #include "common.h" -#include "../common/gl_canvas.c" +#include "gl_canvas.c" diff --git a/client/glc.cpp b/client/glc.cpp index 5a8e599..cf818ca 100644 --- a/client/glc.cpp +++ b/client/glc.cpp @@ -17,5 +17,5 @@ #define GL_GLEXT_PROTOTYPES #include "common.h" -#include "../common/glc.c" +#include "glc.c" diff --git a/client/lz.cpp b/client/lz.cpp index 9f104df..e42b4d3 100644 --- a/client/lz.cpp +++ b/client/lz.cpp @@ -16,5 +16,5 @@ */ #include "common.h" -#include "../common/lz.c" +#include "lz.c" diff --git a/client/quic.cpp b/client/quic.cpp index f992e50..17a1e50 100644 --- a/client/quic.cpp +++ b/client/quic.cpp @@ -16,5 +16,5 @@ */ #include "common.h" -#include "../common/quic.c" +#include "quic.c" diff --git a/client/region.cpp b/client/region.cpp index dc0373c..a881b6e 100644 --- a/client/region.cpp +++ b/client/region.cpp @@ -16,5 +16,5 @@ */ #include "common.h" -#include "../common/region.c" +#include "region.c" diff --git a/client/rop3.cpp b/client/rop3.cpp index 5e5b481..e9c95a2 100644 --- a/client/rop3.cpp +++ b/client/rop3.cpp @@ -16,5 +16,5 @@ */ #include "common.h" -#include "../common/rop3.c" +#include "rop3.c" |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:45:08
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit abe5233ca391086c4361acf27b3a88fb1083aa97 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 09:04:06 2010 +0200 Add common/configure.ac (subdir config) Enables running ./configure in common/ (as well as autoreconf or autogen.sh) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/common/configure.ac b/common/configure.ac new file mode 100644 index 0000000..c375809 --- /dev/null +++ b/common/configure.ac @@ -0,0 +1,27 @@ +AC_PREREQ([2.57]) + +m4_define([SPICE_MAJOR], 0) +m4_define([SPICE_MINOR], 4) +m4_define([SPICE_MICRO], 1) + +AC_INIT(spice-common, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-common) + +AC_CONFIG_MACRO_DIR([m4]) + +m4_include(../configure.ac.shared) + +AC_CONFIG_FILES([Makefile linux/ffmpeg_inc.h]) +AC_OUTPUT + +dnl ========================================================================== +echo " + + Spice Common $VERSION + ============== + + prefix: ${prefix} + c compiler: ${CC} + c++ compiler: ${CXX} + + Now type 'make' to build $PACKAGE +" |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:59
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit f82bb9cc0c1a0940a930ad0db740b030009a3a29 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 09:04:06 2010 +0200 Add client/configure.ac (subdir config) Enables running ./configure in client/ (as well as autoreconf or autogen.sh) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/configure.ac b/client/configure.ac new file mode 100644 index 0000000..c1fd5b7 --- /dev/null +++ b/client/configure.ac @@ -0,0 +1,78 @@ +AC_PREREQ([2.57]) + +m4_define([SPICE_MAJOR], 0) +m4_define([SPICE_MINOR], 4) +m4_define([SPICE_MICRO], 1) + +AC_INIT(spice-client, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-client) + +AC_CONFIG_MACRO_DIR([m4]) + +# Define default SPICE_COMMON_SRCDIR +# Maybe overwritten by ../configure.ac.shared +SPICE_COMMON_SRCDIR='$(top_srcdir)'/../common + +m4_include(../configure.ac.shared) + + +dnl ================ +dnl Check platform +dnl ================ +if test "$platform_win32" = yes; then + red_target=windows +else + red_target=x11 +fi +AC_SUBST(red_target) + +dnl ================= +dnl Check deps +dnl ================= + + +PKG_CHECK_MODULES(XRANDR, xrandr) +AC_SUBST(XRANDR_CFLAGS) +AC_SUBST(XRANDR_LIBS) +SPICE_REQUIRES+=" xrandr" + +PKG_CHECK_MODULES(XRANDR12, + xrandr >= 1.2, + have_xrandr12=yes, + have_xrandr12=no) + +AM_CONDITIONAL([HAVE_XRANDR12], [test "x$have_xrandr12" = "xyes"]) +if test "x$have_xrandr12" = "xyes" ; then + AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12]) +fi + + +PKG_CHECK_MODULES(LOG4CPP, log4cpp) +AC_SUBST(LOG4CPP_CFLAGS) +AC_SUBST(LOG4CPP_LIBS) +SPICE_REQUIRES+=" log4cpp" + + +AC_SUBST(SPICE_COMMON_SRCDIR) +AC_SUBST(SPICE_REQUIRES) +AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) +AC_SUBST(SPICE_NONPKGCONFIG_LIBS) + +AC_CONFIG_FILES([Makefile x11/Makefile x11/images/Makefile]) +AC_OUTPUT + +dnl ========================================================================== +echo " + + Spice Client $VERSION + ============== + + prefix: ${prefix} + c compiler: ${CC} + c++ compiler: ${CXX} + + Have XRANDR 1.2: ${have_xrandr12} + + Red target: ${red_target} + + Now type 'make' to build $PACKAGE +" |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:52
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 5e5ad018c2af62113714240ced216095b8647a03 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 09:04:06 2010 +0200 Add server/configure.ac (subdir config) Enables running ./configure in server/ (as well as autoreconf or autogen.sh) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/server/configure.ac b/server/configure.ac new file mode 100644 index 0000000..254341e --- /dev/null +++ b/server/configure.ac @@ -0,0 +1,50 @@ +AC_PREREQ([2.57]) + +m4_define([SPICE_MAJOR], 0) +m4_define([SPICE_MINOR], 4) +m4_define([SPICE_MICRO], 1) + +AC_INIT(spice-server, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-server) + +AC_CONFIG_MACRO_DIR([m4]) + +# Define default SPICE_COMMON_SRCDIR +# Maybe overwritten by ../configure.ac.shared +SPICE_COMMON_SRCDIR='$(top_srcdir)'/../common + +m4_include(../configure.ac.shared) + +AC_PROG_LIBTOOL + +SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_MAJOR, SPICE_MINOR, SPICE_MICRO) +AC_SUBST(SPICE_LT_VERSION) + +# Support only x86_64 arch +echo " ************** host cpu is $host_cpu " +if test $host_cpu != x86_64; then + echo "Only x86_64 arch is supported" + exit 1 +fi + + +AC_SUBST(SPICE_COMMON_SRCDIR) +AC_SUBST(SPICE_REQUIRES) +AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) +AC_SUBST(SPICE_NONPKGCONFIG_LIBS) + +AC_CONFIG_FILES([Makefile]) +#AC_CONFIG_FILES([Makefile spice.pc]) +AC_OUTPUT + +dnl ========================================================================== +echo " + + Spice Server $VERSION + ============== + + prefix: ${prefix} + c compiler: ${CC} + c++ compiler: ${CXX} + + Now type 'make' to build $PACKAGE +" |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:46
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit ae9a42d6c4c83518276d017f7dcf170f68116063 Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 configure.ac: client: replace $(top_srcdir) in x11/Makefile.am (subdir config) Replace all "$(top_srcdir)/common" with "$(SPICE_COMMON_DIR)" and all "$(top_srcdir)/client" with ".." (relative to x11) This would (after following patches) enables building the client from either spice/ (top directory) or spice/client. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am index d229ca9..d8c8363 100644 --- a/client/x11/Makefile.am +++ b/client/x11/Makefile.am @@ -1,5 +1,8 @@ NULL = +COMMON_DIR=$(SPICE_COMMON_SRCDIR) +CLIENT_DIR=.. + SUBDIRS = images INCLUDES = \ @@ -11,9 +14,9 @@ INCLUDES = \ -DUSE_OGL \ -I. \ -I.. \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/common/linux \ - -I$(top_srcdir)/client \ + -I$(COMMON_DIR) \ + -I$(COMMON_DIR)/linux \ + -I$(CLIENT_DIR) \ $(GL_CFLAGS) \ $(ALSA_CFLAGS) \ $(FFMPEG_CFLAGS) \ @@ -27,77 +30,77 @@ INCLUDES = \ RED_COMMON_SRCS = \ - $(top_srcdir)/client/application.cpp \ - $(top_srcdir)/client/application.h \ - $(top_srcdir)/client/audio_channels.h \ - $(top_srcdir)/client/audio_devices.h \ - $(top_srcdir)/client/cache.hpp \ - $(top_srcdir)/client/cairo_canvas.cpp \ - $(top_srcdir)/client/canvas.cpp \ - $(top_srcdir)/client/canvas.h \ - $(top_srcdir)/client/canvas_utils.cpp \ - $(top_srcdir)/client/red_cairo_canvas.cpp \ - $(top_srcdir)/client/red_cairo_canvas.h \ - $(top_srcdir)/client/cmd_line_parser.cpp \ - $(top_srcdir)/client/cmd_line_parser.h \ - $(top_srcdir)/client/common.h \ - $(top_srcdir)/client/cursor_channel.cpp \ - $(top_srcdir)/client/cursor_channel.h \ - $(top_srcdir)/client/cursor.cpp \ - $(top_srcdir)/client/cursor.h \ - $(top_srcdir)/client/debug.h \ - $(top_srcdir)/client/display_channel.cpp \ - $(top_srcdir)/client/display_channel.h \ - $(top_srcdir)/client/red_gl_canvas.cpp \ - $(top_srcdir)/client/red_gl_canvas.h \ - $(top_srcdir)/client/gl_canvas.cpp \ - $(top_srcdir)/client/glc.cpp \ - $(top_srcdir)/client/glz_decoded_image.h \ - $(top_srcdir)/client/glz_decoder_config.h \ - $(top_srcdir)/client/glz_decoder.cpp \ - $(top_srcdir)/client/glz_decoder.h \ - $(top_srcdir)/client/glz_decoder_window.cpp \ - $(top_srcdir)/client/glz_decoder_window.h \ - $(top_srcdir)/client/inputs_channel.cpp \ - $(top_srcdir)/client/inputs_channel.h \ - $(top_srcdir)/client/inputs_handler.h \ - $(top_srcdir)/client/lz.cpp \ - $(top_srcdir)/client/monitor.cpp \ - $(top_srcdir)/client/monitor.h \ - $(top_srcdir)/client/menu.cpp \ - $(top_srcdir)/client/menu.h \ - $(top_srcdir)/client/pixels_source.h \ - $(top_srcdir)/client/platform.h \ - $(top_srcdir)/client/playback_channel.cpp \ - $(top_srcdir)/client/process_loop.cpp \ - $(top_srcdir)/client/quic.cpp \ - $(top_srcdir)/client/record_channel.cpp \ - $(top_srcdir)/client/red_channel.cpp \ - $(top_srcdir)/client/red_channel.h \ - $(top_srcdir)/client/red_client.cpp \ - $(top_srcdir)/client/red_client.h \ - $(top_srcdir)/client/red_drawable.h \ - $(top_srcdir)/client/red_key.h \ - $(top_srcdir)/client/red_peer.cpp \ - $(top_srcdir)/client/red_peer.h \ - $(top_srcdir)/client/red_pixmap_cairo.h \ - $(top_srcdir)/client/red_pixmap_gl.h \ - $(top_srcdir)/client/red_pixmap.h \ - $(top_srcdir)/client/red_types.h \ - $(top_srcdir)/client/red_window.h \ - $(top_srcdir)/client/region.cpp \ - $(top_srcdir)/client/rop3.cpp \ - $(top_srcdir)/client/screen.cpp \ - $(top_srcdir)/client/screen.h \ - $(top_srcdir)/client/screen_layer.cpp \ - $(top_srcdir)/client/screen_layer.h \ - $(top_srcdir)/client/shared_cache.hpp \ - $(top_srcdir)/client/hot_keys.cpp \ - $(top_srcdir)/client/hot_keys.h \ - $(top_srcdir)/client/threads.cpp \ - $(top_srcdir)/client/utils.cpp \ - $(top_srcdir)/client/utils.h \ - $(top_srcdir)/client/icon.h \ + $(CLIENT_DIR)/application.cpp \ + $(CLIENT_DIR)/application.h \ + $(CLIENT_DIR)/audio_channels.h \ + $(CLIENT_DIR)/audio_devices.h \ + $(CLIENT_DIR)/cache.hpp \ + $(CLIENT_DIR)/cairo_canvas.cpp \ + $(CLIENT_DIR)/canvas.cpp \ + $(CLIENT_DIR)/canvas.h \ + $(CLIENT_DIR)/canvas_utils.cpp \ + $(CLIENT_DIR)/red_cairo_canvas.cpp \ + $(CLIENT_DIR)/red_cairo_canvas.h \ + $(CLIENT_DIR)/cmd_line_parser.cpp \ + $(CLIENT_DIR)/cmd_line_parser.h \ + $(CLIENT_DIR)/common.h \ + $(CLIENT_DIR)/cursor_channel.cpp \ + $(CLIENT_DIR)/cursor_channel.h \ + $(CLIENT_DIR)/cursor.cpp \ + $(CLIENT_DIR)/cursor.h \ + $(CLIENT_DIR)/debug.h \ + $(CLIENT_DIR)/display_channel.cpp \ + $(CLIENT_DIR)/display_channel.h \ + $(CLIENT_DIR)/red_gl_canvas.cpp \ + $(CLIENT_DIR)/red_gl_canvas.h \ + $(CLIENT_DIR)/gl_canvas.cpp \ + $(CLIENT_DIR)/glc.cpp \ + $(CLIENT_DIR)/glz_decoded_image.h \ + $(CLIENT_DIR)/glz_decoder_config.h \ + $(CLIENT_DIR)/glz_decoder.cpp \ + $(CLIENT_DIR)/glz_decoder.h \ + $(CLIENT_DIR)/glz_decoder_window.cpp \ + $(CLIENT_DIR)/glz_decoder_window.h \ + $(CLIENT_DIR)/inputs_channel.cpp \ + $(CLIENT_DIR)/inputs_channel.h \ + $(CLIENT_DIR)/inputs_handler.h \ + $(CLIENT_DIR)/lz.cpp \ + $(CLIENT_DIR)/monitor.cpp \ + $(CLIENT_DIR)/monitor.h \ + $(CLIENT_DIR)/menu.cpp \ + $(CLIENT_DIR)/menu.h \ + $(CLIENT_DIR)/pixels_source.h \ + $(CLIENT_DIR)/platform.h \ + $(CLIENT_DIR)/playback_channel.cpp \ + $(CLIENT_DIR)/process_loop.cpp \ + $(CLIENT_DIR)/quic.cpp \ + $(CLIENT_DIR)/record_channel.cpp \ + $(CLIENT_DIR)/red_channel.cpp \ + $(CLIENT_DIR)/red_channel.h \ + $(CLIENT_DIR)/red_client.cpp \ + $(CLIENT_DIR)/red_client.h \ + $(CLIENT_DIR)/red_drawable.h \ + $(CLIENT_DIR)/red_key.h \ + $(CLIENT_DIR)/red_peer.cpp \ + $(CLIENT_DIR)/red_peer.h \ + $(CLIENT_DIR)/red_pixmap_cairo.h \ + $(CLIENT_DIR)/red_pixmap_gl.h \ + $(CLIENT_DIR)/red_pixmap.h \ + $(CLIENT_DIR)/red_types.h \ + $(CLIENT_DIR)/red_window.h \ + $(CLIENT_DIR)/region.cpp \ + $(CLIENT_DIR)/rop3.cpp \ + $(CLIENT_DIR)/screen.cpp \ + $(CLIENT_DIR)/screen.h \ + $(CLIENT_DIR)/screen_layer.cpp \ + $(CLIENT_DIR)/screen_layer.h \ + $(CLIENT_DIR)/shared_cache.hpp \ + $(CLIENT_DIR)/hot_keys.cpp \ + $(CLIENT_DIR)/hot_keys.h \ + $(CLIENT_DIR)/threads.cpp \ + $(CLIENT_DIR)/utils.cpp \ + $(CLIENT_DIR)/utils.h \ + $(CLIENT_DIR)/icon.h \ $(NULL) bin_PROGRAMS = spicec |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:36
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit c854259ba4e841ff6ee7294267423c44919a1f9a Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 configure.ac: use SPICE_COMMON_SRCDIR in server/Makefile.am (subdir config) Replace all $(top_srcdir)/common. This would (after following patches) enables building the server from either spice/ (top directory) or spice/server. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/server/Makefile.am b/server/Makefile.am index 2731efc..63d88e1 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -1,9 +1,11 @@ NULL = +COMMON_DIR=$(SPICE_COMMON_SRCDIR) + INCLUDES = \ -I. \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/common/linux \ + -I$(COMMON_DIR) \ + -I$(COMMON_DIR)/linux \ $(FFMPEG_CFLAGS) \ $(QCAIRO_CFLAGS) \ $(GL_CFLAGS) \ @@ -16,16 +18,16 @@ INCLUDES = \ $(VISIBILITY_HIDDEN_CFLAGS) \ $(NULL) -COMMON_SRCS = \ - $(top_srcdir)/common/cairo_canvas.c \ - $(top_srcdir)/common/gl_canvas.c \ - $(top_srcdir)/common/region.c \ - $(top_srcdir)/common/glc.c \ - $(top_srcdir)/common/ogl_ctx.c \ - $(top_srcdir)/common/rop3.c \ - $(top_srcdir)/common/quic.c \ - $(top_srcdir)/common/lz.c \ - $(top_srcdir)/common/canvas_utils.c \ +COMMON_SRCS = \ + $(COMMON_DIR)/cairo_canvas.c \ + $(COMMON_DIR)/gl_canvas.c \ + $(COMMON_DIR)/region.c \ + $(COMMON_DIR)/glc.c \ + $(COMMON_DIR)/ogl_ctx.c \ + $(COMMON_DIR)/rop3.c \ + $(COMMON_DIR)/quic.c \ + $(COMMON_DIR)/lz.c \ + $(COMMON_DIR)/canvas_utils.c \ $(NULL) lib_LTLIBRARIES = libspice.la |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:29
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 5e079451771864ad977aaa187570d3ea62ea6360 Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 configure.ac: define SPICE_COMMON_SRCDIR, to be used by Makefile.am (subdir config) Note that SPICE_COMMON_SRCDIR may be overwritten by configure.ac.shared Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac b/configure.ac index 7b2b2d5..ec2d99f 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,10 @@ AC_INIT(spice, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice) AC_CONFIG_MACRO_DIR([m4]) +# Define default SPICE_COMMON_SRCDIR +# Maybe overwritten by ./configure.ac.shared +SPICE_COMMON_SRCDIR='$(top_srcdir)'/common + m4_include(configure.ac.shared) AC_PROG_LIBTOOL @@ -67,7 +71,7 @@ fi AC_MSG_RESULT($have_gcc4) AC_SUBST(VISIBILITY_HIDDEN_CFLAGS) - +AC_SUBST(SPICE_COMMON_SRCDIR) AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) @@ -92,7 +96,7 @@ echo " prefix: ${prefix} c compiler: ${CC} c++ compiler: ${CXX} - + Have XRANDR 1.2: ${have_xrandr12} Red target: ${red_target} |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:19
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit ee242fbd81143c3c9afd01afe91089ef14dd6dac Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 configure.ac: check for (and require) cairo-spice instead of qspice Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac.shared b/configure.ac.shared index 93ad689..88bc8be 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -86,12 +86,12 @@ AC_SUBST(LIBRT) SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT" -PKG_CHECK_MODULES(QCAIRO, qcairo >= 1.4.6) +PKG_CHECK_MODULES(QCAIRO, cairo-spice >= 1.4.6) AC_SUBST(QCAIRO_CFLAGS) AC_SUBST(QCAIRO_LIBS) -QCAIRO_LIBDIR=`pkg-config --variable=libdir qcairo` +QCAIRO_LIBDIR=`pkg-config --variable=libdir cairo-spice` AC_SUBST(QCAIRO_LIBDIR) -SPICE_REQUIRES+=" qcairo >= 1.4.6" +SPICE_REQUIRES+=" cairo-spice >= 1.4.6" PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1) AC_SUBST(CELT051_CFLAGS) |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:12
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit c3418952ebd29aff612ee8dd96af5bdd9c5dad7a Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 configure.ac: move most checks to configure.ac.shared (subdir config) ... and m4_include it in configure.ac Later all configure.ac in subdirs will m4_include it too. This patch changes nothing really, just moves lines from one file to another. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac b/configure.ac index 43b8ec6..7b2b2d5 100644 --- a/configure.ac +++ b/configure.ac @@ -7,72 +7,15 @@ m4_define([SPICE_MICRO], 1) AC_INIT(spice, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice) AC_CONFIG_MACRO_DIR([m4]) -AM_CONFIG_HEADER([config.h]) -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([dist-bzip2]) -AM_MAINTAINER_MODE +m4_include(configure.ac.shared) -AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes]) -AC_PROG_CC -AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes]) -AC_PROG_CXX -AC_PROG_INSTALL -AC_CANONICAL_HOST AC_PROG_LIBTOOL -AM_PROG_CC_C_O SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_MAJOR, SPICE_MINOR, SPICE_MICRO) AC_SUBST(SPICE_LT_VERSION) -# Check for the CPU we are using -# -AC_MSG_CHECKING(for x86 or x86-64 platform) -case $host_cpu in - i386|i486|i586|i686|i786|k6|k7) - variant=32 - ;; - x86_64) - variant=64 - ;; - *) - AC_MSG_RESULT(no) - echo Only x86 and x86-64 are supported - exit 1 -esac -AC_MSG_RESULT($variant bit) -AM_CONDITIONAL([X86_64], [test "$variant" = 64]) -AC_MSG_CHECKING([for native Win32]) -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -AC_MSG_RESULT([$os_win32]) - -case $host in - *-*-linux*) - os_linux=yes - ;; -esac - -dnl ========================================================================= -dnl Check OS target - -AC_MSG_CHECKING([for some Win32 platform]) -case "$host" in - *-*-mingw*|*-*-cygwin*) - platform_win32=yes - ;; - *) - platform_win32=no - ;; -esac -AC_MSG_RESULT([$platform_win32]) if test "$platform_win32" = yes; then red_target=windows else @@ -80,84 +23,9 @@ else fi AC_SUBST(red_target) -AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") -AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes") -AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes") - dnl ========================================================================= dnl Check deps -AC_CHECK_LIBM -AC_SUBST(LIBM) - -AC_CHECK_LIB(rt, clock_gettime, - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()]) - LIBRT=-lrt - ) -AC_SUBST(LIBRT) - -SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT" - -SPICE_REQUIRES="" - -PKG_CHECK_MODULES(LOG4CPP, log4cpp) -AC_SUBST(LOG4CPP_CFLAGS) -AC_SUBST(LOG4CPP_LIBS) -SPICE_REQUIRES+=" log4cpp" - -PKG_CHECK_MODULES(QCAIRO, qcairo >= 1.4.6) -AC_SUBST(QCAIRO_CFLAGS) -AC_SUBST(QCAIRO_LIBS) -QCAIRO_LIBDIR=`pkg-config --variable=libdir qcairo` -AC_SUBST(QCAIRO_LIBDIR) -SPICE_REQUIRES+=" qcairo >= 1.4.6" - -PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1) -AC_SUBST(CELT051_CFLAGS) -AC_SUBST(CELT051_LIBS) -AC_SUBST(CELT051_LIBDIR) -SPICE_REQUIRES+=" celt051 >= 0.5.1.1" - -PKG_CHECK_MODULES(FFMPEG, libavcodec libavutil) -AC_SUBST(FFMPEG_CFLAGS) -AC_SUBST(FFMPEG_LIBS) -FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil` -AC_SUBST(FFMPEG_LIBDIR) -SPICE_REQUIRES+=" libavcodec libavutil" - -saved_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" -AC_CHECK_HEADER(avcodec.h, AVCODEC_PREFIX="", AVCODEC_PREFIX="libavcodec/") -CPPFLAGS="$saved_CPPFLAGS" -AC_SUBST([AVCODEC_PREFIX]) - -PKG_CHECK_MODULES(ALSA, alsa) -AC_SUBST(ALSA_CFLAGS) -AC_SUBST(ALSA_LIBS) -SPICE_REQUIRES+=" alsa" - -PKG_CHECK_MODULES(SSL, openssl) -AC_SUBST(SSL_CFLAGS) -AC_SUBST(SSL_LIBS) -SPICE_REQUIRES+=" openssl" - -# These are commented out because the gl libraries on RHEL 5 do not have pkgconfig files -# -# PKG_CHECK_MODULES(GL, gl glu) -# AC_SUBST(GL_CFLAGS) -# AC_SUBST(GL_LIBS) -# SPICE_REQUIRES+=" gl glu" - -have_gl=yes -AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", have_gl=no) -AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", have_gl=no) - -if test "x$have_gl" = "xno"; then - AC_MSG_ERROR([GL libraries not available]) -fi - -AC_SUBST(GL_LIBS) -SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS" PKG_CHECK_MODULES(XRANDR, xrandr) AC_SUBST(XRANDR_CFLAGS) @@ -174,103 +42,11 @@ if test "x$have_xrandr12" = "xyes" ; then AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12]) fi -# Add parameter for (partial) static linkage of spice client. -# this is used to achive single binary package for all (?) distros. -AC_ARG_ENABLE(static-linkage, - [ --enable-static-linkage will generate spice client binary with static linkage to external libraries ], - [SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"]; - SPICEC_STATIC_LINKAGE_BDYNAMIC=["-Wl,-Bdynamic"]]) - - -AS_IF([test "$_cflags_is_set" = "yes"], [], [ - CFLAGS="-g -O3" -]) - - -AS_IF([test "$_cxxflags_is_set" = "yes"], [], [ - CXXFLAGS="-g -O3" -]) - - -dnl =========================================================================== -dnl check compiler flags - -AC_DEFUN([SPICE_CC_TRY_FLAG], [ - AC_MSG_CHECKING([whether $CC supports $1]) - - spice_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - - AC_COMPILE_IFELSE([ ], [spice_cc_flag=yes], [spice_cc_flag=no]) - CFLAGS="$spice_save_CFLAGS" - - if test "x$spice_cc_flag" = "xyes"; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi - AC_MSG_RESULT([$spice_cc_flag]) -]) - - -dnl Use lots of warning flags with with gcc and compatible compilers - -dnl Note: if you change the following variable, the cache is automatically -dnl skipped and all flags rechecked. So there's no need to do anything -dnl else. If for any reason you need to force a recheck, just change -dnl MAYBE_WARN in an ignorable way (like adding whitespace) - -dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" - -MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" - - -# invalidate cached value if MAYBE_WARN has changed -if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then - unset spice_cv_warn_cflags -fi -AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [ - echo - WARN_CFLAGS="" - - # Some warning options are not supported by all versions of - # gcc, so test all desired options against the current - # compiler. - # - # Note that there are some order dependencies - # here. Specifically, an option that disables a warning will - # have no net effect if a later option then enables that - # warnings, (perhaps implicitly). So we put some grouped - # options (-Wall and -Wextra) up front and the -Wno options - # last. - - for W in $MAYBE_WARN; do - SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) - done - - spice_cv_warn_cflags=$WARN_CFLAGS - spice_cv_warn_maybe=$MAYBE_WARN - - AC_MSG_CHECKING([which warning flags were supported])]) -WARN_CFLAGS="$spice_cv_warn_cflags" -SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" -# We only wish to enable attribute(warn_unused_result) if we can prevent -# gcc from generating thousands of warnings about the misapplication of the -# attribute to void functions and variables. -AC_MSG_CHECKING([how to enable unused result warnings]) -warn_unused_result="" -if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then - AC_TRY_COMPILE([__attribute__((__warn_unused_result__)) - int f (int i) { return i; }], [], - [warn_unused_result="__attribute__((__warn_unused_result__))"]) -fi -AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$warn_unused_result], - [Define to the value your compiler uses to support the warn-unused-result attribute]) -AC_MSG_RESULT([$warn_unused_result]) - -AC_SUBST(WARN_CFLAGS) -AC_SUBST(CFLAGS_CFLAGS) +PKG_CHECK_MODULES(LOG4CPP, log4cpp) +AC_SUBST(LOG4CPP_CFLAGS) +AC_SUBST(LOG4CPP_LIBS) +SPICE_REQUIRES+=" log4cpp" dnl ========================================================================= dnl -fvisibility stuff @@ -296,9 +72,6 @@ AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) -AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC]) -AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC]) - AC_OUTPUT([ Makefile spice.pc diff --git a/configure.ac.shared b/configure.ac.shared new file mode 100644 index 0000000..93ad689 --- /dev/null +++ b/configure.ac.shared @@ -0,0 +1,245 @@ +dnl +dnl this file is shared by all spice configure.ac files, that +dnl m4_include(<myname>) +dnl + +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR(.) + +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_MAINTAINER_MODE + +AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes]) +AC_PROG_CC +AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes]) +AC_PROG_CXX +AC_PROG_INSTALL +AC_CANONICAL_HOST +AM_PROG_CC_C_O + +# Check for the CPU we are using +# +AC_MSG_CHECKING(for x86 or x86-64 platform) +case $host_cpu in + i386|i486|i586|i686|i786|k6|k7) + variant=32 + ;; + x86_64) + variant=64 + ;; + *) + AC_MSG_RESULT(no) + echo Only x86 and x86-64 are supported + exit 1 +esac +AC_MSG_RESULT($variant bit) +AM_CONDITIONAL([X86_64], [test "$variant" = 64]) + +AC_MSG_CHECKING([for native Win32]) +case "$host" in + *-*-mingw*) + os_win32=yes + ;; + *) + os_win32=no + ;; +esac +AC_MSG_RESULT([$os_win32]) + +case $host in + *-*-linux*) + os_linux=yes + ;; +esac + +dnl ========================================================================= +dnl Check OS target + +AC_MSG_CHECKING([for some Win32 platform]) +case "$host" in + *-*-mingw*|*-*-cygwin*) + platform_win32=yes + ;; + *) + platform_win32=no + ;; +esac +AC_MSG_RESULT([$platform_win32]) + +AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") +AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes") +AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes") + +dnl ========================================================================= +dnl Check Dependencies + +SPICE_REQUIRES="" + +AC_CHECK_LIBM +AC_SUBST(LIBM) + +AC_CHECK_LIB(rt, clock_gettime, + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()]) + LIBRT=-lrt + ) +AC_SUBST(LIBRT) + +SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT" + +PKG_CHECK_MODULES(QCAIRO, qcairo >= 1.4.6) +AC_SUBST(QCAIRO_CFLAGS) +AC_SUBST(QCAIRO_LIBS) +QCAIRO_LIBDIR=`pkg-config --variable=libdir qcairo` +AC_SUBST(QCAIRO_LIBDIR) +SPICE_REQUIRES+=" qcairo >= 1.4.6" + +PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1) +AC_SUBST(CELT051_CFLAGS) +AC_SUBST(CELT051_LIBS) +AC_SUBST(CELT051_LIBDIR) +SPICE_REQUIRES+=" celt051 >= 0.5.1.1" + +PKG_CHECK_MODULES(FFMPEG, libavcodec libavutil) +AC_SUBST(FFMPEG_CFLAGS) +AC_SUBST(FFMPEG_LIBS) +FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil` +AC_SUBST(FFMPEG_LIBDIR) +SPICE_REQUIRES+=" libavcodec libavutil" + +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" +AC_CHECK_HEADER(avcodec.h, AVCODEC_PREFIX="", AVCODEC_PREFIX="libavcodec/") +CPPFLAGS="$saved_CPPFLAGS" +AC_SUBST([AVCODEC_PREFIX]) + +PKG_CHECK_MODULES(ALSA, alsa) +AC_SUBST(ALSA_CFLAGS) +AC_SUBST(ALSA_LIBS) +SPICE_REQUIRES+=" alsa" + +PKG_CHECK_MODULES(SSL, openssl) +AC_SUBST(SSL_CFLAGS) +AC_SUBST(SSL_LIBS) +SPICE_REQUIRES+=" openssl" + +# These are commented out because the gl libraries on RHEL 5 do not have pkgconfig files +# +# PKG_CHECK_MODULES(GL, gl glu) +# AC_SUBST(GL_CFLAGS) +# AC_SUBST(GL_LIBS) +# SPICE_REQUIRES+=" gl glu" + +have_gl=yes +AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", have_gl=no) +AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", have_gl=no) + +if test "x$have_gl" = "xno"; then + AC_MSG_ERROR([GL libraries not available]) +fi + +AC_SUBST(GL_LIBS) +SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS" + + + +dnl ========================================================================= +dnl configure arguments + +# Add parameter for (partial) static linkage of spice client. +# this is used to achive single binary package for all (?) distros. +AC_ARG_ENABLE(static-linkage, + [ --enable-static-linkage will generate spice client binary with static linkage to external libraries ], + [SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"]; + SPICEC_STATIC_LINKAGE_BDYNAMIC=["-Wl,-Bdynamic"]]) + +AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC]) +AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC]) + + +dnl =========================================================================== +dnl check compiler flags + +AS_IF([test "$_cflags_is_set" = "yes"], [], [ + CFLAGS="-g -O3" +]) + +AS_IF([test "$_cxxflags_is_set" = "yes"], [], [ + CXXFLAGS="-g -O3" +]) + +AC_DEFUN([SPICE_CC_TRY_FLAG], [ + AC_MSG_CHECKING([whether $CC supports $1]) + + spice_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_COMPILE_IFELSE([ ], [spice_cc_flag=yes], [spice_cc_flag=no]) + CFLAGS="$spice_save_CFLAGS" + + if test "x$spice_cc_flag" = "xyes"; then + ifelse([$2], , :, [$2]) + else + ifelse([$3], , :, [$3]) + fi + AC_MSG_RESULT([$spice_cc_flag]) +]) + + +dnl Use lots of warning flags with with gcc and compatible compilers + +dnl Note: if you change the following variable, the cache is automatically +dnl skipped and all flags rechecked. So there's no need to do anything +dnl else. If for any reason you need to force a recheck, just change +dnl MAYBE_WARN in an ignorable way (like adding whitespace) + +dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" + +MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" + + +# invalidate cached value if MAYBE_WARN has changed +if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then + unset spice_cv_warn_cflags +fi +AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [ + echo + WARN_CFLAGS="" + + # Some warning options are not supported by all versions of + # gcc, so test all desired options against the current + # compiler. + # + # Note that there are some order dependencies + # here. Specifically, an option that disables a warning will + # have no net effect if a later option then enables that + # warnings, (perhaps implicitly). So we put some grouped + # options (-Wall and -Wextra) up front and the -Wno options + # last. + + for W in $MAYBE_WARN; do + SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) + done + + spice_cv_warn_cflags=$WARN_CFLAGS + spice_cv_warn_maybe=$MAYBE_WARN + + AC_MSG_CHECKING([which warning flags were supported])]) +WARN_CFLAGS="$spice_cv_warn_cflags" +SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" + +# We only wish to enable attribute(warn_unused_result) if we can prevent +# gcc from generating thousands of warnings about the misapplication of the +# attribute to void functions and variables. +AC_MSG_CHECKING([how to enable unused result warnings]) +warn_unused_result="" +if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then + AC_TRY_COMPILE([__attribute__((__warn_unused_result__)) + int f (int i) { return i; }], [], + [warn_unused_result="__attribute__((__warn_unused_result__))"]) +fi +AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$warn_unused_result], + [Define to the value your compiler uses to support the warn-unused-result attribute]) +AC_MSG_RESULT([$warn_unused_result]) + +AC_SUBST(WARN_CFLAGS) +AC_SUBST(CFLAGS_CFLAGS) |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:44:08
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit b298008eaccf9afc418e486b012f7f023d5e0867 Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 autogen: run "do_cmd auto*" for subdirs too (subdir config) subdirs are defined in configure.ac Note we also mkdir m4 (just in case) And touch some needed files (README NEWS ...) to prevent warnings/errors. It may be better to add those files and commit them, or copy from parent dir. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/autogen.sh b/autogen.sh index 2619803..140a31d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -154,11 +154,35 @@ do_cmd() { # Run for top level directory printbold "Setting up $PACKAGE toplevel" -do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS -do_cmd $ACLOCAL $ACLOCAL_FLAGS -do_cmd $AUTOHEADER -do_cmd $AUTOMAKE $AUTOMAKE_FLAGS -do_cmd $AUTOCONF + +config_specific_directory () +{ + local d=${1:-.} + local cur=$(pwd) + if [ "$d" != "." ]; then + cd $d + printbold " ----- Entering $d -----" + fi + touch NEWS README AUTHORS ChangeLog ### ToDo: define those. + mkdir -p m4 + do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS + do_cmd $ACLOCAL $ACLOCAL_FLAGS + do_cmd $AUTOHEADER + do_cmd $AUTOMAKE $AUTOMAKE_FLAGS + do_cmd $AUTOCONF --force + if [ "$d" != "." ]; then + cd $cur + printbold " ----- Exiting $d -----" + fi +} + +subdirs=$(grep '^AC_CONFIG_SUBDIRS' configure.ac | \ + sed 's/AC_CONFIG_SUBDIRS(\[\(.*\)\]) *$/\1/') +printbold "subdirs are $subdirs" + +for sd in $subdirs .; do + config_specific_directory $sd +done cd $ORIGDIR || exit $? rm -f config.cache |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:43:58
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 17dd5f047e9ae0fd95a9d22503138174efb80239 Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 autogen: exit upon errors (subdir config) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/autogen.sh b/autogen.sh index d004e93..2619803 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,7 @@ #! /bin/sh +set -e # exit on errors + # FIXME: can replace this entire script with # the following line if we can require autoconf 2.60: # autoreconf -v --force --install || exit 1 |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:43:56
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 594d940f39fa3a70a7ddc5188a71d8e16718f8f3 Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 autogen: add possibly missing AUTOMAKE definition (subdir config) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/autogen.sh b/autogen.sh index 3a9b993..d004e93 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,6 +10,7 @@ ACLOCAL_FLAGS="" LIBTOOLIZE=${LIBTOOLIZE-libtoolize} LIBTOOLIZE_FLAGS="--copy --force" AUTOHEADER=${AUTOHEADER-autoheader} +AUTOMAKE=${AUTOMAKE-automake} AUTOMAKE_FLAGS="--add-missing --gnu" AUTOCONF=${AUTOCONF-autoconf} |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:43:43
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 09edf10262712f9503b0e65335316c1fa135181a Author: Uri Lublin <ur...@re...> Date: Wed Dec 30 15:34:56 2009 +0200 autogen: remove copied code - srcdir and ORIGDIR (subdir config) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/autogen.sh b/autogen.sh index 9bba4d7..3a9b993 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,11 +1,5 @@ #! /bin/sh -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -ORIGDIR=`pwd` -cd $srcdir - # FIXME: can replace this entire script with # the following line if we can require autoconf 2.60: # autoreconf -v --force --install || exit 1 @@ -39,6 +33,7 @@ srcdir=`dirname $ARGV0` test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` +cd $srcdir # Not all echo versions allow -n, so we check what is possible. This test is # based on the one in autoconf. @@ -156,7 +151,6 @@ do_cmd() { # Run for top level directory printbold "Setting up $PACKAGE toplevel" -cd $srcdir do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS do_cmd $ACLOCAL $ACLOCAL_FLAGS do_cmd $AUTOHEADER |
From: Yaniv K. <yk...@re...> - 2010-01-10 11:41:43
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 461b04793d5001b55fa1e52851e7048d521258bf Author: Yaniv Kamay <yk...@re...> Date: Sun Jan 10 13:37:05 2010 +0200 client: change rerror code to be positive diff --git a/common/red_error_codes.h b/common/red_error_codes.h index 0c06899..bff53dd 100644 --- a/common/red_error_codes.h +++ b/common/red_error_codes.h @@ -31,21 +31,21 @@ #ifndef RED_ERROR_CODES_H #define RED_ERROR_CODES_H -#define SPICEC_ERROR_CODE_SUCCESS (0) -#define SPICEC_ERROR_CODE_ERROR (-1) -#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED (-2) -#define SPICEC_ERROR_CODE_CONNECT_FAILED (-3) -#define SPICEC_ERROR_CODE_SOCKET_FAILED (-4) -#define SPICEC_ERROR_CODE_SEND_FAILED (-5) -#define SPICEC_ERROR_CODE_RECV_FAILED (-6) -#define SPICEC_ERROR_CODE_SSL_ERROR (-7) -#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY (-8) -#define SPICEC_ERROR_CODE_AGENT_TIMEOUT (-9) -#define SPICEC_ERROR_CODE_AGENT_ERROR (-10) -#define SPICEC_ERROR_CODE_VERSION_MISMATCH (-11) -#define SPICEC_ERROR_CODE_PERMISSION_DENIED (-12) -#define SPICEC_ERROR_CODE_INVALID_ARG (-13) -#define SPICEC_ERROR_CODE_CMD_LINE_ERROR (-14) +#define SPICEC_ERROR_CODE_SUCCESS 0 +#define SPICEC_ERROR_CODE_ERROR 1 +#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED 2 +#define SPICEC_ERROR_CODE_CONNECT_FAILED 3 +#define SPICEC_ERROR_CODE_SOCKET_FAILED 4 +#define SPICEC_ERROR_CODE_SEND_FAILED 5 +#define SPICEC_ERROR_CODE_RECV_FAILED 6 +#define SPICEC_ERROR_CODE_SSL_ERROR 7 +#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY 8 +#define SPICEC_ERROR_CODE_AGENT_TIMEOUT 9 +#define SPICEC_ERROR_CODE_AGENT_ERROR 10 +#define SPICEC_ERROR_CODE_VERSION_MISMATCH 11 +#define SPICEC_ERROR_CODE_PERMISSION_DENIED 12 +#define SPICEC_ERROR_CODE_INVALID_ARG 13 +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR 14 #endif |
From: Yaniv K. <yk...@re...> - 2010-01-10 11:41:18
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 6d9026c4b4620b4f65d172522b7b3a7aed4a94df Author: Yaniv Kamay <yk...@re...> Date: Sat Jan 9 23:06:00 2010 +0200 client: add Platform::term_printf Platform::term_printf is a variant of printf that on windows dynamically opens console in order to have visible output during command line processing. diff --git a/client/application.cpp b/client/application.cpp index 1405c70..33cc947 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1448,7 +1448,8 @@ static inline int str_to_port(const char *str) return port; } -bool Application::set_channels_security(CmdLineParser& parser, bool on, char *val) +bool Application::set_channels_security(CmdLineParser& parser, bool on, char *val, + const char* arg0) { RedPeer::ConnectionOptions::Type option; option = (on) ? RedPeer::ConnectionOptions::CON_OP_SECURE : @@ -1465,7 +1466,8 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { - std::cout << "\"all\" is exclusive in secure-channels\n"; + Platform::term_printf("%s: \"all\" is exclusive in secure-channels\n", arg0); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } PeerConnectionOptMap::iterator iter = _peer_con_opt.begin(); @@ -1478,7 +1480,8 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va do { ChannelsNamesMap::iterator iter = channels_names.find(val); if (iter == channels_names.end()) { - std::cout << "bad channel name \"" << val << "\" in secure-channels\n"; + Platform::term_printf("%s: bad channel name \"%s\" in secure-channels\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _peer_con_opt[(*iter).second] = option; @@ -1486,7 +1489,7 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va return true; } -bool Application::set_canvas_option(CmdLineParser& parser, char *val) +bool Application::set_canvas_option(CmdLineParser& parser, char *val, const char* arg0) { typedef std::map< std::string, CanvasOption> CanvasNamesMap; CanvasNamesMap canvas_types; @@ -1500,19 +1503,23 @@ bool Application::set_canvas_option(CmdLineParser& parser, char *val) canvas_types["gl_pbuff"] = CANVAS_OPTION_OGL_PBUFF; #endif _canvas_types.clear(); + do { CanvasNamesMap::iterator iter = canvas_types.find(val); if (iter == canvas_types.end()) { - std::cout << "bad canvas type \"" << val << "\"\n"; + Platform::term_printf("%s: bad canvas type \"%s\"\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _canvas_types.resize(_canvas_types.size() + 1); _canvas_types[_canvas_types.size() - 1] = (*iter).second; } while ((val = parser.next_argument())); + return true; } -bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char *val) +bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char *val, + const char* arg0) { typedef std::map< std::string, int> ChannelsNamesMap; ChannelsNamesMap channels_names; @@ -1524,7 +1531,8 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { - std::cout << "\"all\" is exclusive\n"; + Platform::term_printf("%s: \"all\" is exclusive\n", arg0); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } for (unsigned int i = 0; i < _enabled_channels.size(); i++) { @@ -1536,14 +1544,22 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * do { ChannelsNamesMap::iterator iter = channels_names.find(val); if (iter == channels_names.end()) { - std::cout << "bad channel name \"" << val << "\"\n"; + Platform::term_printf("%s: bad channel name \"%s\"\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _enabled_channels[(*iter).second] = enable; } while ((val = parser.next_argument())); + return true; } +void Application::on_cmd_line_invalid_arg(const char* arg0, const char* what, const char* val) +{ + Platform::term_printf("%s: invalid %s value %s\n", arg0, what, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; +} + bool Application::process_cmd_line(int argc, char** argv) { std::string host; @@ -1616,16 +1632,14 @@ bool Application::process_cmd_line(int argc, char** argv) break; case SPICE_OPT_PORT: { if ((port = str_to_port(val)) == -1) { - std::cout << "invalid port " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "port", val); return false; } break; } case SPICE_OPT_SPORT: { if ((sport = str_to_port(val)) == -1) { - std::cout << "invalid secure port " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "secure port", val); return false; } break; @@ -1633,8 +1647,7 @@ bool Application::process_cmd_line(int argc, char** argv) case SPICE_OPT_FULL_SCREEN: if (val) { if (strcmp(val, "auto-conf")) { - std::cout << "invalid full screen mode " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "full screen mode", val); return false; } auto_display_res = true; @@ -1645,33 +1658,27 @@ bool Application::process_cmd_line(int argc, char** argv) password = val; break; case SPICE_OPT_SECURE_CHANNELS: - if (!set_channels_security(parser, true, val)) { + if (!set_channels_security(parser, true, val, argv[0])) { return false; } break; case SPICE_OPT_UNSECURE_CHANNELS: - if (!set_channels_security(parser, false, val)) { + if (!set_channels_security(parser, false, val, argv[0])) { return false; } break; case SPICE_OPT_ENABLE_CHANNELS: - if (!set_enable_channels(parser, true, val)) { - std::cout << "invalid channels " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_enable_channels(parser, true, val, argv[0])) { return false; } break; case SPICE_OPT_DISABLE_CHANNELS: - if (!set_enable_channels(parser, false, val)) { - std::cout << "invalid channels " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_enable_channels(parser, false, val, argv[0])) { return false; } break; case SPICE_OPT_CANVAS_TYPE: - if (!set_canvas_option(parser, val)) { - std::cout << "invalid canvas option " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_canvas_option(parser, val, argv[0])) { return false; } break; @@ -1679,14 +1686,16 @@ bool Application::process_cmd_line(int argc, char** argv) parser.show_help(); return false; case CmdLineParser::OPTION_ERROR: + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; default: - throw Exception("cmd line error"); + throw Exception("cmd line error", SPICEC_ERROR_CODE_CMD_LINE_ERROR); } } if (parser.is_set(SPICE_OPT_SECURE_CHANNELS) && !parser.is_set(SPICE_OPT_SPORT)) { - std::cout << "missing --secure-port\n"; + Platform::term_printf("%s: missing --secure-port\n", argv[0]); + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; } @@ -1714,7 +1723,9 @@ bool Application::process_cmd_line(int argc, char** argv) (*iter).second = RedPeer::ConnectionOptions::CON_OP_SECURE; continue; } - std::cout << "missing --port or --sport\n"; + + Platform::term_printf("%s: missing --port or --sport\n", argv[0]); + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; } diff --git a/client/application.h b/client/application.h index 3c0297f..27701eb 100644 --- a/client/application.h +++ b/client/application.h @@ -165,9 +165,10 @@ public: static int main(int argc, char** argv, const char* version_str); private: - bool set_channels_security(CmdLineParser& parser, bool on, char *val); - bool set_enable_channels(CmdLineParser& parser, bool enable, char *val); - bool set_canvas_option(CmdLineParser& parser, char *val); + bool set_channels_security(CmdLineParser& parser, bool on, char *val, const char* arg0); + bool set_enable_channels(CmdLineParser& parser, bool enable, char *val, const char* arg0); + bool set_canvas_option(CmdLineParser& parser, char *val, const char* arg0); + void on_cmd_line_invalid_arg(const char* arg0, const char* what, const char* val); bool process_cmd_line(int argc, char** argv); void abort(); void init_scan_code(int index); diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp index 65ae404..caa4b03 100644 --- a/client/cmd_line_parser.cpp +++ b/client/cmd_line_parser.cpp @@ -344,7 +344,7 @@ int CmdLineParser::get_option(char** val) int name_pos = (opt_obj->type == REQUIRED_ARGUMENT) ? optind - 2 : optind - 1; std::string cmd_name(_argv[name_pos] + 2); if (cmd_name.find(opt_obj->name) != 0) { - std::cout << _argv[0] << ": invalid option '--" << cmd_name << "'\n"; + Platform::term_printf("%s: invalid option '--%s'\n", _argv[0], cmd_name.c_str()); return OPTION_ERROR; } #endif @@ -360,11 +360,11 @@ int CmdLineParser::get_option(char** val) case -1: { *val = NULL; if (!_positional_args && optind != _argc) { - std::cout << _argv[0] << ": unexpected positional arguments\n"; + Platform::term_printf("%s: unexpected positional arguments\n", _argv[0]); return OPTION_ERROR; } if ((opt_obj = find_missing_opt())) { - std::cout << _argv[0] << ": option --" << opt_obj->name << " is required\n"; + Platform::term_printf("%s: option --%s is required\n", _argv[0], opt_obj->name.c_str()); return OPTION_ERROR; } _done = true; @@ -378,18 +378,19 @@ int CmdLineParser::get_option(char** val) #ifdef DISABLE_ABBREVIATE std::string cmd_name(_argv[optind - 1] + 2); if (cmd_name.find(opt_obj->name) != 0) { - std::cout << _argv[0] << ": invalid option '--" << cmd_name << "'\n"; + Platform::term_printf("%s: invalid option '--%s'\n", _argv[0], cmd_name.c_str()); return OPTION_ERROR; } #endif - std::cout << _argv[0] << ": option --" << opt_obj->name << " requires an argument\n"; + Platform::term_printf("%s: option --%s requires an argument\n", + _argv[0], opt_obj->name.c_str()); } else if (optopt == 0) { - std::cout << _argv[0] << ": invalid option '" << _argv[optind - 1] << "'\n"; + Platform::term_printf("%s: invalid option '%s'\n", _argv[0], _argv[optind - 1]); } else if ((opt_obj = find((char)optopt))) { - std::cout << _argv[0] << ": option '-" << opt_obj->short_name << - "' requires an argument\n"; + Platform::term_printf("%s: option '-%c' requires an argument\n", + _argv[0], opt_obj->short_name); } else { - std::cout << _argv[0] << ": invalid option '-" << char(optopt) << "'\n"; + Platform::term_printf("%s: invalid option '-%c'\n", _argv[0], char(optopt)); } return OPTION_ERROR; default: @@ -447,13 +448,13 @@ void CmdLineParser::show_help() { static const int HELP_START_POS = 30; static const int HELP_WIDTH = 80 - HELP_START_POS; + std::ostringstream os; - std::cout << basename(_argv[0]) << " - " << _description.c_str() << "\n\noptions:\n\n"; + os << basename(_argv[0]) << " - " << _description.c_str() << "\n\noptions:\n\n"; Options::iterator iter = _options.begin(); for (; iter != _options.end(); ++iter) { CmdLineParser::Option* opt = *iter; - std::ostringstream os; if (opt->short_name) { os << " -" << opt->short_name << ", "; @@ -516,9 +517,9 @@ void CmdLineParser::show_help() line.clear(); } } while (line.size() || std::getline(is, line)); - - std::cout << os.str(); } - std::cout << "\n"; + + os << "\n"; + Platform::term_printf(os.str().c_str()); } diff --git a/client/platform.h b/client/platform.h index a36cdc5..50db153 100644 --- a/client/platform.h +++ b/client/platform.h @@ -42,6 +42,7 @@ public: static void path_append(std::string& path, const std::string& partial_path); static uint64_t get_process_id(); static uint64_t get_thread_id(); + static void term_printf(const char* format, ...); static const MonitorsList& init_monitors(); static void destroy_monitors(); diff --git a/client/windows/main.cpp b/client/windows/main.cpp index a1575e9..afc98c9 100644 --- a/client/windows/main.cpp +++ b/client/windows/main.cpp @@ -22,12 +22,6 @@ extern "C" { #include "pthread.h" } -//#define OPEN_CONSOLE -#ifdef OPEN_CONSOLE -#include <io.h> -#include <conio.h> -#endif - #include "application.h" #include "debug.h" #include "utils.h" @@ -83,23 +77,6 @@ int WINAPI WinMain(HINSTANCE hInstance, try { init_version_string(); -#ifdef OPEN_CONSOLE - AllocConsole(); - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - int hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - FILE * fp = _fdopen(hConHandle, "w"); - *stdout = *fp; - - h = GetStdHandle(STD_INPUT_HANDLE); - hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - fp = _fdopen(hConHandle, "r"); - *stdin = *fp; - - h = GetStdHandle(STD_ERROR_HANDLE); - hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - fp = _fdopen(hConHandle, "w"); - *stderr = *fp; -#endif pthread_win32_process_attach_np(); init_winsock(); exit_val = Application::main(__argc, __argv, version_string); @@ -114,11 +91,10 @@ int WINAPI WinMain(HINSTANCE hInstance, LOG_ERROR("unhandled exception"); exit_val = SPICEC_ERROR_CODE_ERROR; } + log4cpp::Category::shutdown(); -#ifdef OPEN_CONSOLE - _getch(); -#endif pthread_win32_process_detach_np(); + return exit_val; } diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index dcdb84e..d5ff0f0 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -18,6 +18,8 @@ #include "common.h" #include <shlobj.h> +#include <io.h> +#include <conio.h> #include "platform.h" #include "win_platform.h" @@ -740,3 +742,65 @@ void WinPlatform::exit_modal_loop() KillTimer(paltform_win, MODAL_LOOP_TIMER_ID); modal_loop_active = false; } + +static bool has_console = false; + +static void create_console() +{ + static Mutex console_mutex; + + Lock lock(console_mutex); + + if (has_console) { + return; + } + + AllocConsole(); + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + int hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + FILE * fp = _fdopen(hConHandle, "w"); + *stdout = *fp; + + h = GetStdHandle(STD_INPUT_HANDLE); + hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + fp = _fdopen(hConHandle, "r"); + *stdin = *fp; + + h = GetStdHandle(STD_ERROR_HANDLE); + hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + fp = _fdopen(hConHandle, "w"); + *stderr = *fp; + + has_console = true; + + HWND consol_window = GetConsoleWindow(); + + if (consol_window) { + SetForegroundWindow(consol_window); + } +} + +class ConsoleWait { +public: + ~ConsoleWait() + { + if (has_console) { + Platform::term_printf("\n\nPress any key to exit..."); + _getch(); + } + } + +} console_wait; + + +void Platform::term_printf(const char* format, ...) +{ + if (!has_console) { + create_console(); + } + + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); +} diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 1bedb22..bceae05 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -252,6 +252,14 @@ void Platform::yield() pthread_yield(); } +void Platform::term_printf(const char* format, ...) +{ + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); +} + void Platform::set_thread_priority(void* thread, Platform::ThreadPriority in_priority) { ASSERT(thread == NULL); diff --git a/common/red_error_codes.h b/common/red_error_codes.h index c08fd51..0c06899 100644 --- a/common/red_error_codes.h +++ b/common/red_error_codes.h @@ -45,6 +45,7 @@ #define SPICEC_ERROR_CODE_VERSION_MISMATCH (-11) #define SPICEC_ERROR_CODE_PERMISSION_DENIED (-12) #define SPICEC_ERROR_CODE_INVALID_ARG (-13) +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR (-14) #endif |
From: Yaniv K. <yk...@re...> - 2010-01-10 11:41:04
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 0bd3b58bc916525f957994acda875f96c7a036dc Author: Yaniv Kamay <yk...@re...> Date: Sat Jan 9 15:54:33 2010 +0200 client: fix logger init mix-up enable log rotate in case RED_DEBUG is not defined and disable log rotate in case RED_DEBUG is defined diff --git a/client/application.cpp b/client/application.cpp index d429ad3..1405c70 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1771,12 +1771,12 @@ void Application::init_logger() #ifdef RED_DEBUG root.setPriority(log4cpp::Priority::DEBUG); root.removeAllAppenders(); - ::close(fd); - root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); + root.addAppender(new log4cpp::FileAppender("_", fd)); #else root.setPriority(log4cpp::Priority::INFO); root.removeAllAppenders(); - root.addAppender(new log4cpp::FileAppender("_", fd)); + ::close(fd); + root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); #endif } diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index f92f2cc..dcdb84e 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -430,24 +430,7 @@ bool Platform::is_monitors_pos_valid() return true; } -/* -void Platform::get_spice_config_dir(std::string& path) -{ - char app_data_path[MAX_PATH]; - HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path); - if (res != S_OK) { - throw Exception("get user app data dir failed"); - } - - path = app_data_path; - if (strcmp((app_data_path + strlen(app_data_path) - 2), "\\") != 0) { - path += "\\"; - } - path += SPICE_CONFIG_DIR; -} -*/ - -static void Platform::get_app_data_dir(std::string& path, const std::string& app_name); +void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { char app_data_path[MAX_PATH]; HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path); @@ -458,12 +441,12 @@ static void Platform::get_app_data_dir(std::string& path, const std::string& app path = app_data_path; path_append(path, app_name); - if (!CreateDirectory(path.c_str()) && GetLastError() != ERROR_ALREADY_EXISTS) { + if (!CreateDirectoryA(path.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) { throw Exception("create user app data dir failed"); } } -static void Platform::path_append(std::string& path, const std::string& partial_path) +void Platform::path_append(std::string& path, const std::string& partial_path) { path += "\\"; path += partial_path; diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 473ba89..1bedb22 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -1899,11 +1899,17 @@ void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { const char* home_dir = getenv("HOME"); - if (!home_dir) { + if (!home_dir || strlen(home_dir) == 0) { throw Exception("get home dir failed"); } path = home_dir; + std::string::iterator end = path.end(); + + while (end != path.begin() && *(end - 1) == '/') { + path.erase(--end); + } + path += "/."; path += app_name; |
From: Yaniv K. <yk...@re...> - 2010-01-10 11:40:41
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit db5375a5f898c396fc7e66abf1bb761b16c5a684 Author: Yaniv Kamay <yk...@re...> Date: Sat Jan 9 15:49:44 2010 +0200 client: move log file to spicec appdata dir diff --git a/client/application.cpp b/client/application.cpp index 3566adb..d429ad3 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -55,6 +55,8 @@ mutex_t cairo_surface_user_data_mutex; #endif +static const char* app_name = "spicec"; + void ConnectedEvent::response(AbstractProcessLoop& events_loop) { static_cast<Application*>(events_loop.get_owner())->on_connected(); @@ -1600,8 +1602,8 @@ bool Application::process_cmd_line(int argc, char** argv) _host_auth_opt.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_NAME; - Platform::get_spice_config_dir(_host_auth_opt.CA_file); - _host_auth_opt.CA_file += CA_FILE_NAME; + Platform::get_app_data_dir(_host_auth_opt.CA_file, app_name); + Platform::path_append(_host_auth_opt.CA_file, CA_FILE_NAME); parser.begin(argc, argv); @@ -1754,15 +1756,17 @@ bool Application::process_cmd_line(int argc, char** argv) void Application::init_logger() { - std::string temp_dir_name; - Platform::get_temp_dir(temp_dir_name); - std::string log_file_name = temp_dir_name + "spicec.log"; + std::string log_file_name; + Platform::get_app_data_dir(log_file_name, app_name); + Platform::path_append(log_file_name, "spicec.log"); int fd = ::open(log_file_name.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0644); + if (fd == -1) { log4cpp::BasicConfigurator::configure(); return; } + log4cpp::Category& root = log4cpp::Category::getRoot(); #ifdef RED_DEBUG root.setPriority(log4cpp::Priority::DEBUG); diff --git a/client/platform.h b/client/platform.h index f0ffc0d..a36cdc5 100644 --- a/client/platform.h +++ b/client/platform.h @@ -38,6 +38,8 @@ public: static void yield(); static uint64_t get_monolithic_time(); static void get_temp_dir(std::string& path); + static void get_app_data_dir(std::string& path, const std::string& app_name); + static void path_append(std::string& path, const std::string& partial_path); static uint64_t get_process_id(); static uint64_t get_thread_id(); @@ -47,8 +49,6 @@ public: static void send_quit_request(); - static void get_spice_config_dir(std::string& path); - enum ThreadPriority { PRIORITY_INVALID, PRIORITY_TIME_CRITICAL, diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index f8465c2..f92f2cc 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -30,8 +30,6 @@ #include "cursor.h" #include "named_pipe.h" -#define SPICE_CONFIG_DIR "spicec\\" - int gdi_handlers = 0; extern HINSTANCE instance; @@ -432,6 +430,7 @@ bool Platform::is_monitors_pos_valid() return true; } +/* void Platform::get_spice_config_dir(std::string& path) { char app_data_path[MAX_PATH]; @@ -446,6 +445,29 @@ void Platform::get_spice_config_dir(std::string& path) } path += SPICE_CONFIG_DIR; } +*/ + +static void Platform::get_app_data_dir(std::string& path, const std::string& app_name); +{ + char app_data_path[MAX_PATH]; + HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path); + if (res != S_OK) { + throw Exception("get user app data dir failed"); + } + + path = app_data_path; + path_append(path, app_name); + + if (!CreateDirectory(path.c_str()) && GetLastError() != ERROR_ALREADY_EXISTS) { + throw Exception("create user app data dir failed"); + } +} + +static void Platform::path_append(std::string& path, const std::string& partial_path) +{ + path += "\\"; + path += partial_path; +} void Platform::init() { diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index cff2289..473ba89 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -64,8 +64,6 @@ #define USE_XRANDR_1_2 #endif -#define SPICE_CONFIG_DIR ".spicec/" - static Display* x_display = NULL; static bool x_shm_avail = false; static XVisualInfo **vinfo = NULL; @@ -1897,16 +1895,27 @@ bool Platform::is_monitors_pos_valid() return (ScreenCount(x_display) == 1); } -void Platform::get_spice_config_dir(std::string& path) +void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { - char* home_dir = getenv("HOME"); + const char* home_dir = getenv("HOME"); + if (!home_dir) { throw Exception("get home dir failed"); } path = home_dir; + path += "/."; + path += app_name; + + if (mkdir(path.c_str(), 0700) == -1 && errno != EEXIST) { + throw Exception("create appdata dir failed"); + } +} + +void Platform::path_append(std::string& path, const std::string& partial_path) +{ path += "/"; - path += SPICE_CONFIG_DIR; + path += partial_path; } static void root_win_proc(XEvent& event) |
From: Yaniv K. <yk...@re...> - 2010-01-07 11:53:50
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit dcf326cfd523c135bd0be8f9a4bc2da6c78b2d23 Author: Arnon Gilboa <ag...@re...> Date: Thu Jan 7 11:02:50 2010 +0200 spice: menu additons -functions: set_name, remove_command, remove_sub, clear -item state & enum -add state support in RedWindow insert_command & insert_menu diff --git a/client/menu.cpp b/client/menu.cpp index 343818c..d260f3a 100644 --- a/client/menu.cpp +++ b/client/menu.cpp @@ -20,7 +20,6 @@ #include "utils.h" #include "debug.h" - Menu::Menu(CommandTarget& target, const std::string& name) : _refs (1) , _target (target) @@ -30,13 +29,7 @@ Menu::Menu(CommandTarget& target, const std::string& name) Menu::~Menu() { - for (unsigned int i = 0; i < _items.size(); i++) { - if (_items[i].type == MENU_ITEM_TYPE_COMMAND) { - delete (MenuCommand*)_items[i].obj; - } else if (_items[i].type == MENU_ITEM_TYPE_MENU) { - ((Menu*)_items[i].obj)->unref(); - } - } + clear(); } void Menu::add_item(MenuItem& item) @@ -46,9 +39,9 @@ void Menu::add_item(MenuItem& item) _items[pos] = item; } -void Menu::add_command(const std::string& name, int cmd_id) +void Menu::add_command(const std::string& name, int cmd_id, int state) { - MenuCommand* cmd = new MenuCommand(name, cmd_id); + MenuCommand* cmd = new MenuCommand(name, cmd_id, state); MenuItem item; item.type = MENU_ITEM_TYPE_COMMAND; item.obj = cmd; @@ -72,6 +65,29 @@ void Menu::add_sub(Menu* menu) add_item(item); } +void Menu::remove_command(int cmd_id) +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_COMMAND && + ((MenuCommand*)_items[i].obj)->get_cmd_id() == cmd_id) { + delete (MenuCommand*)_items[i].obj; + _items.erase(_items.begin() + i); + return; + } + } +} + +void Menu::remove_sub(Menu* menu) +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_MENU && (Menu*)_items[i].obj == menu) { + ((Menu*)_items[i].obj)->unref(); + _items.erase(_items.begin() + i); + return; + } + } +} + Menu::ItemType Menu::item_type_at(int pos) { if (pos >= (int)_items.size()) { @@ -80,7 +96,7 @@ Menu::ItemType Menu::item_type_at(int pos) return _items[pos].type; } -void Menu::command_at(int pos, std::string& name, int& cmd_id) +void Menu::command_at(int pos, std::string& name, int& cmd_id, int& state) { if (_items[pos].type != MENU_ITEM_TYPE_COMMAND) { THROW("incorrect item type"); @@ -88,6 +104,7 @@ void Menu::command_at(int pos, std::string& name, int& cmd_id) MenuCommand* cmd = (MenuCommand*)_items[pos].obj; name = cmd->get_name(); cmd_id = cmd->get_cmd_id(); + state = cmd->get_state(); } Menu* Menu::sub_at(int pos) @@ -98,3 +115,14 @@ Menu* Menu::sub_at(int pos) return ((Menu*)_items[pos].obj)->ref(); } +void Menu::clear() +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_COMMAND) { + delete (MenuCommand*)_items[i].obj; + } else if (_items[i].type == MENU_ITEM_TYPE_MENU) { + ((Menu*)_items[i].obj)->unref(); + } + } + _items.clear(); +} diff --git a/client/menu.h b/client/menu.h index b908e54..ee3c9ec 100644 --- a/client/menu.h +++ b/client/menu.h @@ -35,37 +35,51 @@ public: MENU_ITEM_TYPE_SEPARATOR, }; + enum ItemState { + MENU_ITEM_STATE_CHECKED = 1 << 0, + MENU_ITEM_STATE_DIM = 1 << 1, + }; + Menu* ref() { _refs++; return this;} void unref() { if (!--_refs) delete this;} + void set_name(const std::string& name) { _name = name;} const std::string& get_name() { return _name;} CommandTarget& get_target() { return _target;} - void add_command(const std::string& name, int cmd_id); + void add_command(const std::string& name, int cmd_id, int state = 0); void add_separator(); void add_sub(Menu* sub); + void remove_command(int cmd_id); + void remove_sub(Menu* menu); + ItemType item_type_at(int pos); - void command_at(int pos, std::string& name, int& cmd_id); + void command_at(int pos, std::string& name, int& cmd_id, int& state); Menu* sub_at(int pos); + void clear(); + private: virtual ~Menu(); class MenuCommand { public: - MenuCommand(const std::string& name, int cmd_id) + MenuCommand(const std::string& name, int cmd_id, int state) : _name (name) , _cmd_id (cmd_id) + , _state (state) { } const std::string& get_name() { return _name;} int get_cmd_id() { return _cmd_id;} + int get_state() { return _state;} private: std::string _name; int _cmd_id; + int _state; }; struct MenuItem { diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp index 4746719..2d415d1 100644 --- a/client/windows/red_window.cpp +++ b/client/windows/red_window.cpp @@ -906,17 +906,24 @@ static void utf8_to_wchar(const std::string& src, std::wstring& dest) MultiByteToWideChar(CP_UTF8, 0, src.c_str(), -1, (wchar_t *)dest.c_str(), len); } -static void insert_command(HMENU menu, const std::string& name, int id) +static void insert_command(HMENU menu, const std::string& name, int id, int state) { MENUITEMINFO item_info; item_info.cbSize = sizeof(item_info); - item_info.fMask = MIIM_TYPE | MIIM_ID; + item_info.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE; item_info.fType = MFT_STRING; std::wstring wname; utf8_to_wchar(name, wname); item_info.cch = wname.size(); item_info.dwTypeData = (wchar_t *)wname.c_str(); item_info.wID = id; + item_info.fState = MFS_ENABLED; + if (state & Menu::MENU_ITEM_STATE_CHECKED) { + item_info.fState |= MFS_CHECKED; + } + if (state & Menu::MENU_ITEM_STATE_DIM) { + item_info.fState |= MFS_DISABLED; + } InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &item_info); } @@ -969,10 +976,11 @@ static void insert_menu(Menu* menu, HMENU native, CommandMap& _commands_map) case Menu::MENU_ITEM_TYPE_COMMAND: { std::string name; int command_id; - menu->command_at(pos, name, command_id); + int state; + menu->command_at(pos, name, command_id, state); int sys_command = alloc_sys_cmd_id(); _commands_map[sys_command] = CommandInfo(menu, command_id); - insert_command(native, name, sys_command); + insert_command(native, name, sys_command, state); break; } case Menu::MENU_ITEM_TYPE_MENU: { |
From: Yaniv K. <yk...@re...> - 2010-01-07 11:09:35
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 15fff174ebe05d34541a28769686f860fa9adbb3 Author: Arnon Gilboa <ag...@re...> Date: Thu Jan 7 11:02:50 2010 +0200 spice: menu additons -functions: set_name, remove_command, remove_sub, clear -item state & enum -add state support in RedWindow insert_command & insert_menu diff --git a/client/menu.cpp b/client/menu.cpp index 343818c..d260f3a 100644 --- a/client/menu.cpp +++ b/client/menu.cpp @@ -20,7 +20,6 @@ #include "utils.h" #include "debug.h" - Menu::Menu(CommandTarget& target, const std::string& name) : _refs (1) , _target (target) @@ -30,13 +29,7 @@ Menu::Menu(CommandTarget& target, const std::string& name) Menu::~Menu() { - for (unsigned int i = 0; i < _items.size(); i++) { - if (_items[i].type == MENU_ITEM_TYPE_COMMAND) { - delete (MenuCommand*)_items[i].obj; - } else if (_items[i].type == MENU_ITEM_TYPE_MENU) { - ((Menu*)_items[i].obj)->unref(); - } - } + clear(); } void Menu::add_item(MenuItem& item) @@ -46,9 +39,9 @@ void Menu::add_item(MenuItem& item) _items[pos] = item; } -void Menu::add_command(const std::string& name, int cmd_id) +void Menu::add_command(const std::string& name, int cmd_id, int state) { - MenuCommand* cmd = new MenuCommand(name, cmd_id); + MenuCommand* cmd = new MenuCommand(name, cmd_id, state); MenuItem item; item.type = MENU_ITEM_TYPE_COMMAND; item.obj = cmd; @@ -72,6 +65,29 @@ void Menu::add_sub(Menu* menu) add_item(item); } +void Menu::remove_command(int cmd_id) +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_COMMAND && + ((MenuCommand*)_items[i].obj)->get_cmd_id() == cmd_id) { + delete (MenuCommand*)_items[i].obj; + _items.erase(_items.begin() + i); + return; + } + } +} + +void Menu::remove_sub(Menu* menu) +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_MENU && (Menu*)_items[i].obj == menu) { + ((Menu*)_items[i].obj)->unref(); + _items.erase(_items.begin() + i); + return; + } + } +} + Menu::ItemType Menu::item_type_at(int pos) { if (pos >= (int)_items.size()) { @@ -80,7 +96,7 @@ Menu::ItemType Menu::item_type_at(int pos) return _items[pos].type; } -void Menu::command_at(int pos, std::string& name, int& cmd_id) +void Menu::command_at(int pos, std::string& name, int& cmd_id, int& state) { if (_items[pos].type != MENU_ITEM_TYPE_COMMAND) { THROW("incorrect item type"); @@ -88,6 +104,7 @@ void Menu::command_at(int pos, std::string& name, int& cmd_id) MenuCommand* cmd = (MenuCommand*)_items[pos].obj; name = cmd->get_name(); cmd_id = cmd->get_cmd_id(); + state = cmd->get_state(); } Menu* Menu::sub_at(int pos) @@ -98,3 +115,14 @@ Menu* Menu::sub_at(int pos) return ((Menu*)_items[pos].obj)->ref(); } +void Menu::clear() +{ + for (unsigned int i = 0; i < _items.size(); i++) { + if (_items[i].type == MENU_ITEM_TYPE_COMMAND) { + delete (MenuCommand*)_items[i].obj; + } else if (_items[i].type == MENU_ITEM_TYPE_MENU) { + ((Menu*)_items[i].obj)->unref(); + } + } + _items.clear(); +} diff --git a/client/menu.h b/client/menu.h index b908e54..ee3c9ec 100644 --- a/client/menu.h +++ b/client/menu.h @@ -35,37 +35,51 @@ public: MENU_ITEM_TYPE_SEPARATOR, }; + enum ItemState { + MENU_ITEM_STATE_CHECKED = 1 << 0, + MENU_ITEM_STATE_DIM = 1 << 1, + }; + Menu* ref() { _refs++; return this;} void unref() { if (!--_refs) delete this;} + void set_name(const std::string& name) { _name = name;} const std::string& get_name() { return _name;} CommandTarget& get_target() { return _target;} - void add_command(const std::string& name, int cmd_id); + void add_command(const std::string& name, int cmd_id, int state = 0); void add_separator(); void add_sub(Menu* sub); + void remove_command(int cmd_id); + void remove_sub(Menu* menu); + ItemType item_type_at(int pos); - void command_at(int pos, std::string& name, int& cmd_id); + void command_at(int pos, std::string& name, int& cmd_id, int& state); Menu* sub_at(int pos); + void clear(); + private: virtual ~Menu(); class MenuCommand { public: - MenuCommand(const std::string& name, int cmd_id) + MenuCommand(const std::string& name, int cmd_id, int state) : _name (name) , _cmd_id (cmd_id) + , _state (state) { } const std::string& get_name() { return _name;} int get_cmd_id() { return _cmd_id;} + int get_state() { return _state;} private: std::string _name; int _cmd_id; + int _state; }; struct MenuItem { diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp index 0d4c4a5..51a21de 100644 --- a/client/windows/red_window.cpp +++ b/client/windows/red_window.cpp @@ -844,17 +844,24 @@ static void utf8_to_wchar(const std::string& src, std::wstring& dest) MultiByteToWideChar(CP_UTF8, 0, src.c_str(), -1, (wchar_t *)dest.c_str(), len); } -static void insert_command(HMENU menu, const std::string& name, int id) +static void insert_command(HMENU menu, const std::string& name, int id, int state) { MENUITEMINFO item_info; item_info.cbSize = sizeof(item_info); - item_info.fMask = MIIM_TYPE | MIIM_ID; + item_info.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE; item_info.fType = MFT_STRING; std::wstring wname; utf8_to_wchar(name, wname); item_info.cch = wname.size(); item_info.dwTypeData = (wchar_t *)wname.c_str(); item_info.wID = id; + item_info.fState = MFS_ENABLED; + if (state & Menu::MENU_ITEM_STATE_CHECKED) { + item_info.fState |= MFS_CHECKED; + } + if (state & Menu::MENU_ITEM_STATE_DIM) { + item_info.fState |= MFS_DISABLED; + } InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &item_info); } @@ -907,10 +914,11 @@ static void insert_menu(Menu* menu, HMENU native, CommandMap& _commands_map) case Menu::MENU_ITEM_TYPE_COMMAND: { std::string name; int command_id; - menu->command_at(pos, name, command_id); + int state; + menu->command_at(pos, name, command_id, state); int sys_command = alloc_sys_cmd_id(); _commands_map[sys_command] = CommandInfo(menu, command_id); - insert_command(native, name, sys_command); + insert_command(native, name, sys_command, state); break; } case Menu::MENU_ITEM_TYPE_MENU: { |
From: Yaniv K. <yk...@re...> - 2010-01-06 17:09:11
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 358cb4197113a64b9eddf9807245668f32142346 Author: Yaniv Kamay <yk...@re...> Date: Wed Jan 6 19:03:25 2010 +0200 server: add new vd interface QTerm2Interface diff --git a/server/reds.c b/server/reds.c index ddf1fe4..d1f3ba1 100644 --- a/server/reds.c +++ b/server/reds.c @@ -378,6 +378,21 @@ void (*log_proc)(CoreInterface *core, LogLevel level, const char* component, } \ } +static int args_is_empty(const VDICmdArg* args) +{ + return !args || args[0].descriptor.type == ARG_TYPE_INVALID; +} + +const int args_is_string(const VDICmdArg* args) +{ + return !args_is_empty(args) && args->descriptor.type == ARG_TYPE_STRING; +} + +const int args_is_int(const VDICmdArg* args) +{ + return !args_is_empty(args) && args->descriptor.type == ARG_TYPE_INT; +} + static ChannelSecurityOptions *find_channel_security(int id) { ChannelSecurityOptions *now = channels_security; @@ -505,6 +520,16 @@ static void reds_do_disable_ticketing(void) core->term_printf(core, "Ticketing is now disabled.\n"); } +static void reds_do_disable_ticketing_2(const VDICmdArg* args) +{ + if (!args_is_empty(args)) { + red_printf("invalid args"); + return; + } + + reds_do_disable_ticketing(); +} + static char *base64decode(const char *input, int length) { BIO *b64; @@ -629,6 +654,16 @@ static void do_reset_statistics() } } +static void do_reset_statistics_2(const VDICmdArg* args) +{ + if (!args_is_empty(args)) { + red_printf("invalid args"); + return; + } + + do_reset_statistics(); +} + void insert_stat_node(StatNodeRef parent, StatNodeRef ref) { StatNode *node = &reds->stat->nodes[ref]; @@ -1153,6 +1188,31 @@ static void do_ping_client(const char *opt, int has_interval, int interval) } } +static void do_ping_client_2(const VDICmdArg* args) +{ + if (args_is_empty(args)) { + do_ping_client(NULL, FALSE, 0); + return; + } + + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + if (args_is_empty(&args[1])) { + do_ping_client(args[0].string_val, FALSE, 0); + return; + } + + if (!args_is_int(&args[1])) { + red_printf("invalid args"); + return; + } + + do_ping_client(args[0].string_val, TRUE, args[1].int_val); +} + static void ping_timer_cb() { if (!reds->peer) { @@ -3442,6 +3502,26 @@ error: free(local_args); } +static void reds_do_set_ticket_2(const VDICmdArg *args) +{ + const char *arg2 = NULL; + + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + if (!args_is_empty(&args[1])) { + if (!args_is_string(&args[1])) { + red_printf("invalid args"); + return; + } + arg2 = args[1].string_val; + } + + reds_do_set_ticket(args[0].string_val, arg2); +} + static void reds_do_set_ticket64(const char *password64, const char *args) { char *password; @@ -3461,6 +3541,26 @@ static void reds_do_set_ticket64(const char *password64, const char *args) free(password); } +static void reds_do_set_ticket64_2(const VDICmdArg *args) +{ + const char *arg2 = NULL; + + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + if (!args_is_empty(&args[1])) { + if (!args_is_string(&args[1])) { + red_printf("invalid args"); + return; + } + arg2 = args[1].string_val; + } + + reds_do_set_ticket64(args[0].string_val, arg2); +} + static void reds_do_info_spice() { core->term_printf(core, "spice info:"); @@ -3556,6 +3656,16 @@ static void reds_do_set_image_compression(const char *val) set_image_compression(real_val); } +static void reds_do_set_image_compression_2(const VDICmdArg *args) +{ + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + reds_do_set_image_compression(args[0].string_val); +} + static int reds_get_streaming_video(const char *val) { if (strcmp(val, "on") == 0) { @@ -3586,6 +3696,16 @@ static void reds_do_set_streaming_video(const char *val) red_dispatcher_on_sv_change(); } +static void reds_do_set_streaming_video_2(const VDICmdArg *args) +{ + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + reds_do_set_streaming_video(args[0].string_val); +} + static void reds_do_set_agent_mouse(const char *val) { int new_val; @@ -3604,6 +3724,16 @@ static void reds_do_set_agent_mouse(const char *val) reds_update_mouse_mode(); } +static void reds_do_set_agent_mouse_2(const VDICmdArg *args) +{ + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + reds_do_set_agent_mouse(args[0].string_val); +} + static void reds_do_set_playback_compression(const char *val) { int on; @@ -3618,6 +3748,16 @@ static void reds_do_set_playback_compression(const char *val) snd_set_playback_compression(on); } +static void reds_do_set_playback_compression_2(const VDICmdArg *args) +{ + if (!args_is_string(args)) { + red_printf("invalid args"); + return; + } + + reds_do_set_playback_compression(args[0].string_val); +} + static OptionsMap _spice_options[] = { {"port", SPICE_OPTION_PORT}, {"sport", SPICE_OPTION_SPORT}, @@ -4819,7 +4959,7 @@ static void add_monitor_action_commands(QTermInterface *mon) mon->add_action_command_handler(mon, "spice", "set_ticket64", "ss?", reds_do_set_ticket64, "<password> [expiration=<seconds>]" - " [,connected=keep|disconnect|fail]", + "[,connected=keep|disconnect|fail]", "set the spice connection ticket"); mon->add_action_command_handler(mon, "spice", "disable_ticketing", "", reds_do_disable_ticketing, @@ -4841,6 +4981,74 @@ static void add_monitor_action_commands(QTermInterface *mon) #endif } +static void add_monitor_action_commands_2(QTerm2Interface *mon) +{ + VDIArgDescriptor s[] = { + { "arg1", ARG_TYPE_STRING, FALSE}, + { NULL, 0, 0}, + }; + + VDIArgDescriptor empty[] = { + { NULL, 0, 0} + }; + + VDIArgDescriptor s_s_o[] = { + { "arg1", ARG_TYPE_STRING, FALSE}, + { "arg2", ARG_TYPE_STRING, TRUE}, + { NULL, 0, 0} + }; + + VDIArgDescriptor s_o_i_o[] = { + { "arg1", ARG_TYPE_STRING, TRUE}, + { "arg2", ARG_TYPE_INT, TRUE}, + { NULL, 0, 0} + }; + + mon->add_action_command_handler(mon, "spice", "set_image_compression", s, + reds_do_set_image_compression_2, + "<[on|auto_glz|auto_lz|quic|glz|lz|off]>", + ""); + + mon->add_action_command_handler(mon, "spice", "set_streaming_video", s, + reds_do_set_streaming_video_2, + "<on|filter|all|off>", + ""); + + mon->add_action_command_handler(mon, "spice", "set_playback_compression", s, + reds_do_set_playback_compression_2, + "<on|off>", + ""); + + mon->add_action_command_handler(mon, "spice", "set_ticket", s_s_o, + reds_do_set_ticket_2, + "<password> [expiration=<seconds>]" + "[,connected=keep|disconnect|fail]", + "set the spice connection ticket"); + mon->add_action_command_handler(mon, "spice", "set_ticket64", s_s_o, + reds_do_set_ticket64_2, + "<password> [expiration=<seconds>]" + "[,connected=keep|disconnect|fail]", + "set the spice connection ticket"); + mon->add_action_command_handler(mon, "spice", "disable_ticketing", empty, + reds_do_disable_ticketing_2, + "", + "entirely disables OTP"); + mon->add_action_command_handler(mon, "spice", "set_agent_mouse", s, + reds_do_set_agent_mouse_2, + "<on|off>", + ""); +#ifdef RED_STATISTICS + mon->add_action_command_handler(mon, "spice", "reset_stat", empty, + do_reset_statistics_2, + "", + "reset spice statistics"); + mon->add_action_command_handler(mon, "spice", "ping_client", s_o_i_o, + do_ping_client_2, + "[on [interval]|off]", + "ping spice client to measure roundtrip"); +#endif +} + static void add_monitor_info_commands(QTermInterface *mon) { mon->add_info_command_handler(mon, "spice", "state", @@ -4859,6 +5067,24 @@ static void add_monitor_info_commands(QTermInterface *mon) #endif } +static void add_monitor_info_commands_2(QTerm2Interface *mon) +{ + mon->add_info_command_handler(mon, "spice", "state", + reds_do_info_spice, + "show spice state"); + mon->add_info_command_handler(mon, "spice", "ticket", + reds_do_info_ticket, + "show ticket"); +#ifdef RED_STATISTICS + mon->add_info_command_handler(mon, "spice", "stat", + do_info_statistics, + "show spice statistics"); + mon->add_info_command_handler(mon, "spice", "rtt_client", + do_info_rtt_client, + "show rtt to spice client"); +#endif +} + static void attach_to_red_agent(VDIPortInterface *interface) { VDIPortState *state = &reds->agent_state; @@ -4957,6 +5183,20 @@ static void interface_change_notifier(void *opaque, VDInterface *interface, } add_monitor_action_commands((QTermInterface *)interface); add_monitor_info_commands((QTermInterface *)interface); + } else if (strcmp(interface->type, VD_INTERFACE_QTERM2) == 0) { + static int was_here = FALSE; + red_printf("VD_INTERFACE_QTERM2"); + if (was_here) { + return; + } + was_here = TRUE; + if (interface->major_version != VD_INTERFACE_QTERM2_MAJOR || + interface->minor_version < VD_INTERFACE_QTERM2_MINOR) { + red_printf("unsuported qterm interface"); + return; + } + add_monitor_action_commands_2((QTerm2Interface *)interface); + add_monitor_info_commands_2((QTerm2Interface *)interface); } else if (strcmp(interface->type, VD_INTERFACE_TABLET) == 0) { red_printf("VD_INTERFACE_TABLET"); if (tablet) { diff --git a/server/vd_interface.h b/server/vd_interface.h index 932c0b1..d4765c8 100644 --- a/server/vd_interface.h +++ b/server/vd_interface.h @@ -253,6 +253,56 @@ struct QTermInterface { void (*remove_info_command_handler)(QTermInterface *term, VDObjectRef obj); }; +#define VD_INTERFACE_QTERM2 "qemu_terminal_2" +#define VD_INTERFACE_QTERM2_MAJOR 1 +#define VD_INTERFACE_QTERM2_MINOR 0 +typedef struct QTerm2Interface QTerm2Interface; + +enum VDIArgType{ + ARG_TYPE_INVALID, + ARG_TYPE_INT, + ARG_TYPE_STRING, +}; + +typedef struct VDIArgDescriptor { + char* name; + int type; + int optional; +} VDIArgDescriptor; + +typedef struct VDICmdArg { + VDIArgDescriptor descriptor; + union { + uint64_t int_val; + const char *string_val; + }; +} VDICmdArg; + +typedef void (*VDICmdHandler)(const VDICmdArg* args); +typedef void (*VDIInfoCmdHandler)(void); + +struct QTerm2Interface { + VDInterface base; + + VDObjectRef (*add_action_command_handler)(QTerm2Interface *term, + const char *module_name, + const char *command_name, + const VDIArgDescriptor *args_type, + VDICmdHandler handler, + const char *params_text, + const char *help_text); + + void (*remove_action_command_handler)(QTerm2Interface *term, VDObjectRef obj); + + VDObjectRef (*add_info_command_handler)(QTerm2Interface *term, + const char *module_name, + const char *command_name, + VDIInfoCmdHandler handler, + const char *help_text); + + void (*remove_info_command_handler)(QTerm2Interface *term, VDObjectRef obj); +}; + #define VD_INTERFACE_PLAYBACK "playback" #define VD_INTERFACE_PLAYBACK_MAJOR 1 #define VD_INTERFACE_PLAYBACK_MINOR 1 |