diff options
84 files changed, 856 insertions, 259 deletions
@@ -134,6 +134,9 @@ pidgin/win32/nsis/pidgin-translations.nsh$ pidgin/win32/nsis/translations pidgin/win32/pidgin_dll_rc.rc$ pidgin/win32/pidgin_exe_rc.rc$ +finch/finch_winres.rc$ +finch/libfinch_winres.rc$ +finch/libgnt/libgnt_winres.rc$ po/Makefile.in.in po/POTFILES$ po/missing diff --git a/config.h.mingw b/config.h.mingw index 89048c7028..515e3e7757 100644 --- a/config.h.mingw +++ b/config.h.mingw @@ -406,10 +406,10 @@ */ #define HAVE_VSNPRINTF 1 -#define FINCH_LIBDIR wpurple_lib_dir() -#define PIDGIN_LIBDIR wpurple_lib_dir() -#define PURPLE_DATADIR wpurple_install_dir() -#define PURPLE_LIBDIR wpurple_lib_dir() +#define FINCH_LIBDIR wpurple_lib_dir(NULL) +#define PIDGIN_LIBDIR wpurple_lib_dir(NULL) +#define PURPLE_DATADIR wpurple_bin_dir() +#define PURPLE_LIBDIR wpurple_lib_dir(NULL) #define PURPLE_LOCALEDIR wpurple_locale_dir() #define PURPLE_SYSCONFDIR wpurple_sysconf_dir() diff --git a/configure.ac b/configure.ac index 7edca7c3e3..d138ed8c60 100644 --- a/configure.ac +++ b/configure.ac @@ -52,10 +52,12 @@ m4_define([purple_version], [purple_major_version.purple_minor_version.purple_micro_version]) m4_define([purple_display_version], purple_version[]m4_ifdef([purple_version_suffix],[purple_version_suffix])) -m4_define([gnt_lt_current], [8]) +# the last version for Finch 2 was 2.8.10, +# the first version for Finch 3 was 2.9.0 +m4_define([gnt_lt_current], [9]) m4_define([gnt_major_version], [2]) -m4_define([gnt_minor_version], [8]) -m4_define([gnt_micro_version], [10]) +m4_define([gnt_minor_version], [9]) +m4_define([gnt_micro_version], [0]) m4_define([gnt_version_suffix], [devel]) m4_define([gnt_version], [gnt_major_version.gnt_minor_version.gnt_micro_version]) @@ -82,10 +84,12 @@ PURPLE_MAJOR_VERSION=purple_major_version PURPLE_MINOR_VERSION=purple_minor_version PURPLE_MICRO_VERSION=purple_micro_version PURPLE_VERSION=purple_display_version +PURPLE_API_VERSION=$((purple_lt_current - purple_minor_version)) AC_SUBST(PURPLE_MAJOR_VERSION) AC_SUBST(PURPLE_MINOR_VERSION) AC_SUBST(PURPLE_MICRO_VERSION) AC_SUBST(PURPLE_VERSION) +AC_SUBST(PURPLE_API_VERSION) PURPLE_LT_VERSION_INFO="purple_lt_current:purple_micro_version:purple_minor_version" AC_SUBST(PURPLE_LT_VERSION_INFO) @@ -94,10 +98,12 @@ GNT_MAJOR_VERSION=gnt_major_version GNT_MINOR_VERSION=gnt_minor_version GNT_MICRO_VERSION=gnt_micro_version GNT_VERSION=gnt_display_version +GNT_API_VERSION=$((gnt_lt_current - gnt_minor_version)) AC_SUBST(GNT_MAJOR_VERSION) AC_SUBST(GNT_MINOR_VERSION) AC_SUBST(GNT_MICRO_VERSION) AC_SUBST(GNT_VERSION) +AC_SUBST(GNT_API_VERSION) GNT_LT_VERSION_INFO="gnt_lt_current:gnt_micro_version:gnt_minor_version" AC_SUBST(GNT_LT_VERSION_INFO) @@ -125,6 +131,7 @@ dnl Check for Win32 case "$host" in *-*-mingw* | *-*-cygwin*) is_win32="yes" + is_not_win32="no" LIBS="$LIBS -lws2_32" DNSAPI_LIBS="-ldnsapi" PLUGIN_LDFLAGS="-avoid-version -no-undefined" @@ -135,9 +142,12 @@ case "$host" in cross-compiling) for windows. It's a temporary hack to remain non-autotools win32 build working. Drop it when we fully switch our win32 build to autotools.]) + AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, + [Define to 1, to build faster for win32.]) ;; *) is_win32="no" + is_not_win32="yes" PLUGIN_LDFLAGS="-avoid-version" AC_CHECK_HEADERS(signal.h) ;; @@ -167,12 +177,46 @@ AC_CHECK_SIZEOF(time_t, ,[ AC_C_BIGENDIAN +AC_ARG_WITH(win32-dirs, [AS_HELP_STRING([--with-win32-dirs=<classic|fhs>], + [use win32 classic (Program Files-like) or FHS (unix-like) directory structure (default: classic)])], [ + if test "x$withval" != "xclassic" -a "x$withval" != "xfhs" ; then + AC_MSG_ERROR([Unsupported win32-dirs option. Please choose "classic" or "fhs".]) + fi + with_win32_dirs="$withval" + ], with_win32_dirs="classic") +if test "x$is_win32" = "xyes" -a "x$with_win32_dirs" = "xfhs" ; then + AC_DEFINE(USE_WIN32_FHS, 1, [Define to 1, to use FHS on win32.]) +fi + dnl Check for directories if test "x$is_win32" = "xyes" ; then - purple_datadir="wpurple_install_dir()" - purple_libdir="wpurple_lib_dir()" - pidgin_libdir="wpurple_lib_dir()" - finch_libdir="wpurple_lib_dir()" + if test "x$with_win32_dirs" = "xfhs" ; then + AS_AC_EXPAND(win32_fhs_bindir, "$bindir") + AC_DEFINE_UNQUOTED([WIN32_FHS_BINDIR], ["$win32_fhs_bindir"], + [bindir, as defined by configure]) + AS_AC_EXPAND(win32_fhs_libdir, "$libdir") + AC_DEFINE_UNQUOTED([WIN32_FHS_LIBDIR], ["$win32_fhs_libdir"], + [libdir, as defined by configure]) + AS_AC_EXPAND(win32_fhs_datadir, "$datadir") + AC_DEFINE_UNQUOTED([WIN32_FHS_DATADIR], ["$win32_fhs_datadir"], + [datadir, as defined by configure]) + AS_AC_EXPAND(win32_fhs_sysconfdir, "$sysconfdir") + AC_DEFINE_UNQUOTED([WIN32_FHS_SYSCONFDIR], ["$win32_fhs_sysconfdir"], + [sysconfdir, as defined by configure]) + AS_AC_EXPAND(win32_fhs_localedir, "$localedir") + AC_DEFINE_UNQUOTED([WIN32_FHS_LOCALEDIR], ["$win32_fhs_localedir"], + [localedir, as defined by configure]) + + purple_libdir="wpurple_lib_dir(\"purple-$PURPLE_MAJOR_VERSION\")" + pidgin_libdir="wpurple_lib_dir(\"pidgin-$PURPLE_MAJOR_VERSION\")" + finch_libdir="wpurple_lib_dir(\"finch-$PURPLE_MAJOR_VERSION\")" + else + purple_libdir="wpurple_lib_dir(NULL)" + pidgin_libdir="wpurple_lib_dir(NULL)" + finch_libdir="wpurple_lib_dir(NULL)" + fi + + purple_datadir="wpurple_data_dir()" purple_sysconfdir="wpurple_sysconf_dir()" purple_localedir="wpurple_locale_dir()" else @@ -185,8 +229,8 @@ else AS_AC_EXPAND(common_libdir, "$libdir") purple_libdir="\"$common_libdir/purple-$PURPLE_MAJOR_VERSION\"" - pidgin_libdir="\"$common_libdir/pidgin\"" - finch_libdir="\"$common_libdir/finch\"" + pidgin_libdir="\"$common_libdir/pidgin-$PURPLE_MAJOR_VERSION\"" + finch_libdir="\"$common_libdir/finch-$PURPLE_MAJOR_VERSION\"" fi AC_DEFINE_UNQUOTED([PURPLE_DATADIR], [$purple_datadir], [datadir to use, may expand into a function call that returns const char *]) @@ -201,6 +245,13 @@ AC_DEFINE_UNQUOTED([PURPLE_SYSCONFDIR], [$purple_sysconfdir], AC_DEFINE_UNQUOTED([PURPLE_LOCALEDIR], [$purple_localedir], [localedir to use, may expand into a function call that returns const char *]) +PURPLE_PLUGINDIR="\$(libdir)/purple-$PURPLE_MAJOR_VERSION" +AC_SUBST([PURPLE_PLUGINDIR]) +PIDGIN_PLUGINDIR="\$(libdir)/pidgin-$PURPLE_MAJOR_VERSION" +AC_SUBST([PIDGIN_PLUGINDIR]) +FINCH_PLUGINDIR="\$(libdir)/finch-$PURPLE_MAJOR_VERSION" +AC_SUBST([FINCH_PLUGINDIR]) + dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_STRFTIME @@ -459,7 +510,7 @@ AC_ARG_ENABLE(missing-dependencies, [AS_HELP_STRING([--disable-missing-dependenc force_deps="$enableval", force_deps="yes") AC_ARG_WITH(x, [], - with_x="$withval", with_x="yes") + with_x="$withval", with_x="$is_not_win32") AC_ARG_ENABLE(gtkui, [AS_HELP_STRING([--disable-gtkui], [compile without GTK+ user interface])], enable_gtkui="$enableval", enable_gtkui="yes") @@ -469,6 +520,9 @@ AC_ARG_WITH(gtk, [AS_HELP_STRING([--with-gtk=<version>], AC_ARG_ENABLE(consoleui, [AS_HELP_STRING([--disable-consoleui], [compile without console user interface])], [enable_consoleui=$enableval force_finch=$enableval], [enable_consoleui=yes force_finch=no]) +AC_ARG_ENABLE(gstreamer, + [AS_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])], + enable_gst="$enableval", enable_gst="yes") dnl ####################################################################### dnl # Check for GTK+ 2.18 and other things used by the GTK UI @@ -539,9 +593,13 @@ Pidgin. If you want to build only Finch then specify --disable-gtkui when running configure. ])]) elif test "x$with_gtk" = "xauto"; then - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], [with_gtk=3], [ + if test "x$enable_gst" != "xno"; then + gst10_pkg="gstreamer-1.0" + gst010_pkg="gstreamer-0.10" + fi + PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0 $gst10_pkg], [with_gtk=3], [ AC_MSG_RESULT(no) - PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.18.0], [with_gtk=2], [ + PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.18.0 $gst010_pkg], [with_gtk=2], [ AC_MSG_RESULT(no) AC_MSG_ERROR([ You must have GTK+ 2.18.0 or newer development headers installed to compile @@ -950,13 +1008,17 @@ AM_GCONF_SOURCE_2 dnl ####################################################################### dnl # Check for GStreamer dnl ####################################################################### -AC_ARG_ENABLE(gstreamer, - [AS_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])], - enable_gst="$enableval", enable_gst="yes") + +dnl AC_ARG_ENABLE is declared near GTK2/3 configuration AC_ARG_WITH(gstreamer, [AS_HELP_STRING([--with-gstreamer=<version>], [compile with GStreamer 0.10 or 1.0 interface (default: auto)])], with_gstreamer="$withval", with_gstreamer="auto") if test "x$enable_gst" != "xno"; then + if test "x$with_gstreamer" == "xauto" -a "x$with_gtk" = "x3"; then + with_gstreamer="1.0" + elif test "x$with_gstreamer" == "xauto" -a "x$with_gtk" = "x2"; then + with_gstreamer="0.10" + fi if test "x$with_gstreamer" == "xauto"; then PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [ AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds]) @@ -1173,7 +1235,10 @@ AC_ARG_ENABLE(avahi, [compile without avahi (required for Bonjour support)])], enable_avahi="$enableval", enable_avahi="yes") -if test "x$enable_avahi" = "xyes"; then +if test "x$enable_avahi" = "xyes" -a "x$is_win32" = "xyes" ; then + avahiincludes="yes" + avahilibs="yes" +elif test "x$enable_avahi" = "xyes"; then AC_ARG_WITH(avahi-client-includes, [AS_HELP_STRING([--with-avahi-client-includes=DIR], [compile the Bonjour plugin against the Avahi Client includes in DIR])], [ac_avahi_client_includes="$withval"], [ac_avahi_client_includes="no"]) AC_ARG_WITH(avahi-client-libs, [AS_HELP_STRING([--with-avahi-client-libs=DIR], [compile the Bonjour plugin against the Avahi Client libs in DIR])], [ac_avahi_client_libs="$withval"], [ac_avahi_client_libs="no"]) AVAHI_CFLAGS="" @@ -1655,8 +1720,13 @@ dnl ####################################################################### dnl # Check for D-Bus libraries dnl ####################################################################### -AC_ARG_ENABLE(dbus, [AS_HELP_STRING([--disable-dbus], [disable D-Bus support])], , enable_dbus=yes) -AC_ARG_ENABLE(nm, [AS_HELP_STRING([--disable-nm], [disable NetworkManager support (requires D-Bus)])], enable_nm=$enableval, enable_nm=yes) +# dbus doesn't compile for win32 at the moment +AC_ARG_ENABLE(dbus, + [AS_HELP_STRING([--disable-dbus], [disable D-Bus support])], , + enable_dbus="$is_not_win32") +AC_ARG_ENABLE(nm, + [AS_HELP_STRING([--disable-nm], [disable NetworkManager support (requires D-Bus)])], + enable_nm=$enableval, enable_nm="$is_not_win32") if test "x$enable_dbus" = "xyes" ; then AC_CHECK_PROG(enable_dbus, dbus-binding-tool, yes, no) @@ -1739,7 +1809,9 @@ dnl ####################################################################### dnl # Check for GNOME Keyring headers dnl ####################################################################### -AC_ARG_ENABLE(gnome-keyring, [AC_HELP_STRING([--disable-gnome-keyring], [disable GNOME Keyring support])], enable_gnome_keyring="$enableval", enable_gnome_keyring=yes) +AC_ARG_ENABLE(gnome-keyring, + [AC_HELP_STRING([--disable-gnome-keyring], [disable GNOME Keyring support])], + enable_gnome_keyring="$enableval", enable_gnome_keyring="$is_not_win32") if test "x$enable_gnome_keyring" = "xyes" ; then PKG_CHECK_MODULES(GNOMEKEYRING, [gnome-keyring-1], [ @@ -1764,7 +1836,9 @@ dnl ####################################################################### dnl # Check for KWallet headers dnl ####################################################################### -AC_ARG_ENABLE(kwallet, [AC_HELP_STRING([--disable-kwallet], [disable KWallet support])], enable_kwallet="$enableval", enable_kwallet=yes) +AC_ARG_ENABLE(kwallet, + [AC_HELP_STRING([--disable-kwallet], [disable KWallet support])], + enable_kwallet="$enableval", enable_kwallet="$is_not_win32") AC_ARG_WITH(kwallet-includes, [AC_HELP_STRING([--with-kwallet-includes=DIR], [compile the KWallet plugin against includes in DIR])], [ac_kwallet_includes="$withval"], [ac_kwallet_includes="no"]) AC_ARG_WITH(kwallet-libs, [AC_HELP_STRING([--with-kwallet-libs=DIR], [compile the KWallet plugin against the KWallet libs in DIR])], [ac_kwallet_libs="$withval"], [ac_kwallet_libs="no"]) @@ -1923,19 +1997,25 @@ AC_ARG_WITH([python], PYTHON=$withval) if test "x$enable_dbus" = "xyes" || test "x$enable_consoleui" = "xyes" ; then - if test -z "$PYTHON" -o "x$PYTHON" = "xyes"; then + if test -z "$PYTHON" -a "x$is_win32" = "xyes" ; then + dnl there are problems with include files when cross compiling + dnl feel free to fix it, if you want + PYTHON=no + elif test -z "$PYTHON" -o "x$PYTHON" = "xyes"; then AC_PATH_PROG([PYTHON], [python], [no]) fi - if test x"$PYTHON" = x"no" ; then + if test x"$PYTHON" = x"no" -a "x$is_win32" != "xyes" ; then AC_MSG_WARN([python interpreter not found in your path]) enable_dbus=no fi + if test "x$PYTHON" != "xno" ; then if $PYTHON -c "import sys; sys.exit(sys.version[[:3]] >= '2.4')" ; then AC_MSG_WARN([python version >= 2.4 required]) enable_dbus=no fi + fi fi dnl ########################################################################### @@ -2754,9 +2834,12 @@ AC_CONFIG_FILES([Makefile share/sounds/Makefile share/ca-certs/Makefile finch/finch.pc + finch/finch_winres.rc + finch/libfinch_winres.rc finch/Makefile finch/libgnt/Makefile finch/libgnt/gnt.pc + finch/libgnt/libgnt_winres.rc finch/libgnt/wms/Makefile finch/plugins/Makefile po/Makefile.in @@ -2814,6 +2897,12 @@ echo Build with KWallet............ : $enable_kwallet echo echo Build with plugin support..... : $enable_plugins echo Enable Introspection...........: $enable_introspection + +if test "x$is_win32" = "xyes" ; then + echo + echo Win32 directory structure..... : $with_win32_dirs +fi + echo echo Print debugging messages...... : $enable_debug echo Generate documentation........ : $enable_gtk_doc diff --git a/doc/reference/libpurple/Makefile.am b/doc/reference/libpurple/Makefile.am index 086ebb1331..7d5741d489 100644 --- a/doc/reference/libpurple/Makefile.am +++ b/doc/reference/libpurple/Makefile.am @@ -56,7 +56,10 @@ CFILE_GLOB=$(top_srcdir)/$(DOC_MODULE)/*.c # Extra header to include when scanning, which are not under DOC_SOURCE_DIR # e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= +# TODO: those files are not properly scanned when building out-of-tree +EXTRA_HFILES = \ + $(top_builddir)/$(DOC_MODULE)/version.h \ + $(top_builddir)/$(DOC_MODULE)/purple.h # Header files or dirs to ignore when scanning. Use base file/dir names # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code @@ -74,7 +77,7 @@ IGNORE_HFILES=\ internal.h \ marshallers.h \ purple-client.h \ - purple-client-bindings.h + purple-client-bindings.h \ valgrind.h # Images to copy into HTML directory. diff --git a/finch/Makefile.am b/finch/Makefile.am index f1a3b497fe..1062c4aef8 100644 --- a/finch/Makefile.am +++ b/finch/Makefile.am @@ -71,7 +71,8 @@ libfinchinclude_HEADERS = \ $(libfinch_la_headers) libfinch_la_DEPENDENCIES = @LIBOBJS@ -libfinch_la_LDFLAGS = -export-dynamic -no-undefined +libfinch_la_LDFLAGS = -export-dynamic -no-undefined \ + -version-info $(PURPLE_LT_VERSION_INFO) libfinch_la_LIBADD = \ @LIBOBJS@ \ $(DBUS_LIBS) \ @@ -85,14 +86,26 @@ libfinch_la_LIBADD = \ ./libgnt/libgnt.la \ $(top_builddir)/libpurple/libpurple.la +finch_DEPENDENCIES = $(builddir)/libfinch.la +finch_LDFLAGS = -export-dynamic +finch_LDADD = $(builddir)/libfinch.la $(libfinch_la_LIBADD) + if IS_WIN32 libfinch_la_LIBADD += \ -lwinmm -endif -finch_DEPENDENCIES = $(builddir)/libfinch.la -finch_LDFLAGS = -export-dynamic -finch_LDADD = $(builddir)/libfinch.la $(libfinch_la_LIBADD) +.rc.o: %.rc + $(AM_V_GEN)$(WINDRES) -i $< -o $@ + +FINCH_WIN32RES = finch_winres.o +finch_DEPENDENCIES += $(FINCH_WIN32RES) +finch_LDFLAGS += -Wl,$(FINCH_WIN32RES) + +LIBFINCH_WIN32RES = libfinch_winres.o +libfinch_la_DEPENDENCIES += $(LIBFINCH_WIN32RES) +libfinch_la_LDFLAGS += -Wl,$(LIBFINCH_WIN32RES) + +endif AM_CPPFLAGS = \ -DSTANDALONE \ diff --git a/finch/finch.pc.in b/finch/finch.pc.in index 6deccbc45a..080de731f9 100644 --- a/finch/finch.pc.in +++ b/finch/finch.pc.in @@ -11,4 +11,4 @@ Description: Finch is an instant messenger application that uses libpurple for p Version: @VERSION@ Requires: gnt purple Cflags: -I${includedir}/finch - +Libs: -L${libdir} -lfinch diff --git a/finch/finch_winres.rc.in b/finch/finch_winres.rc.in new file mode 100644 index 0000000000..9ecf482901 --- /dev/null +++ b/finch/finch_winres.rc.in @@ -0,0 +1,30 @@ +#include <winver.h> + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + PRODUCTVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "The Pidgin developer community" + VALUE "FileDescription", "Finch instant messenger" + VALUE "FileVersion", "@PURPLE_VERSION@" + VALUE "InternalName", "finch" + VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." + VALUE "OriginalFilename", "finch.exe" + VALUE "ProductName", "Finch" + VALUE "ProductVersion", "@PURPLE_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/finch/gntui.c b/finch/gntui.c index 45475224d7..deadfde50f 100644 --- a/finch/gntui.c +++ b/finch/gntui.c @@ -47,8 +47,12 @@ void finch_ui_init() { #ifdef STANDALONE +#ifdef _WIN32 /* TODO: don't change it when using FHS under win32 */ + gnt_set_config_dir(purple_user_dir()); +#endif /* _WIN32 */ + gnt_init(); -#endif +#endif /* STANDALONE */ purple_prefs_add_none("/purple/gnt"); @@ -147,6 +151,9 @@ void finch_ui_uninit() #endif gnt_quit(); -#endif -} +#ifdef _WIN32 + gnt_set_config_dir(NULL); +#endif /* _WIN32 */ +#endif /* STANDALONE */ +} diff --git a/finch/libfinch_winres.rc.in b/finch/libfinch_winres.rc.in new file mode 100644 index 0000000000..04af8966f6 --- /dev/null +++ b/finch/libfinch_winres.rc.in @@ -0,0 +1,30 @@ +#include <winver.h> + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + PRODUCTVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "The Pidgin developer community" + VALUE "FileDescription", "Finch UI library" + VALUE "FileVersion", "@PURPLE_VERSION@" + VALUE "InternalName", "libfinch" + VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." + VALUE "OriginalFilename", "libfinch-@PURPLE_API_VERSION@.dll" + VALUE "ProductName", "Finch" + VALUE "ProductVersion", "@PURPLE_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/finch/libgnt/Makefile.am b/finch/libgnt/Makefile.am index 9aea013711..be6268464f 100644 --- a/finch/libgnt/Makefile.am +++ b/finch/libgnt/Makefile.am @@ -92,6 +92,17 @@ libgnt_la_LIBADD = \ $(INTROSPECTION_LIBS) \ $(PY_LIBS) +if IS_WIN32 + +.rc.o: %.rc + $(AM_V_GEN)$(WINDRES) -i $< -o $@ + +LIBGNT_WIN32RES = libgnt_winres.o +libgnt_la_DEPENDENCIES += $(LIBGNT_WIN32RES) +libgnt_la_LDFLAGS += -Wl,$(LIBGNT_WIN32RES) + +endif + AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GNT_CFLAGS) \ diff --git a/finch/libgnt/gnt.h b/finch/libgnt/gnt.h index c69d31749f..be66f29b17 100644 --- a/finch/libgnt/gnt.h +++ b/finch/libgnt/gnt.h @@ -57,6 +57,17 @@ void gnt_init(void); /** + * gnt_set_config_dir: + * @config_dir: the path to a configuration directory, may be %NULL. + * + * Change directory to store gnt configuration files (default is ~). + * + * You have to call this before #gnt_init. You might want to call this + * with %NULL, to free the resources, but not before a call to #gnt_quit. + */ +void gnt_set_config_dir(const gchar *config_dir); + +/** * gnt_main: * * Start running the mainloop for gnt. diff --git a/finch/libgnt/gntinternal.h b/finch/libgnt/gntinternal.h index caa4de2f91..7f65a65d47 100644 --- a/finch/libgnt/gntinternal.h +++ b/finch/libgnt/gntinternal.h @@ -44,4 +44,4 @@ extern int gnt_need_conversation_to_locale; extern const char *C_(const char *x); - +const gchar *gnt_get_config_dir(void); diff --git a/finch/libgnt/gntkeys.c b/finch/libgnt/gntkeys.c index 22c6290497..c2607f8550 100644 --- a/finch/libgnt/gntkeys.c +++ b/finch/libgnt/gntkeys.c @@ -51,6 +51,12 @@ void gnt_init_keys() term = ""; /* Just in case */ } +#ifdef _WIN32 + gnt_key_cup = GNT_KEY_CTRL_UP; + gnt_key_cdown = GNT_KEY_CTRL_DOWN; + gnt_key_cright = GNT_KEY_CTRL_RIGHT; + gnt_key_cleft = GNT_KEY_CTRL_LEFT; +#else if (strstr(term, "xterm") == term || strcmp(term, "rxvt") == 0) { gnt_key_cup = "\033" "[1;5A"; gnt_key_cdown = "\033" "[1;5B"; @@ -62,6 +68,7 @@ void gnt_init_keys() gnt_key_cright = "\033" "Oc"; gnt_key_cleft = "\033" "Od"; } +#endif specials = g_hash_table_new(g_str_hash, g_str_equal); @@ -141,7 +148,7 @@ void gnt_init_keys() } } c = 0; - for (a = 0; alts[a]; a++) { + for (a = 0; alts[a]; a++) { /* XXX: is that loop necessary? */ /* Upper-case alphabets */ for (ch = 0; ch < 26; ch++) { char str[2] = {'A' + ch, 0}, code[] = {'\033', 'A' + ch, 0}; diff --git a/finch/libgnt/gntkeys.h b/finch/libgnt/gntkeys.h index 43a006d36c..45dd447c23 100644 --- a/finch/libgnt/gntkeys.h +++ b/finch/libgnt/gntkeys.h @@ -54,40 +54,40 @@ extern char *gnt_key_cright; #define GNT_KEY_POPUP CONST("") /* not supported? */ -#define GNT_KEY_UP CONST("\xe0\x48") -#define GNT_KEY_DOWN CONST("\xe0\x50") -#define GNT_KEY_LEFT CONST("\xe0\x4B") -#define GNT_KEY_RIGHT CONST("\xe0\x4D") +#define GNT_KEY_UP CONST("\033\xe0\x48") +#define GNT_KEY_DOWN CONST("\033\xe0\x50") +#define GNT_KEY_LEFT CONST("\033\xe0\x4B") +#define GNT_KEY_RIGHT CONST("\033\xe0\x4D") -#define GNT_KEY_CTRL_UP CONST("\xe0\x8d") -#define GNT_KEY_CTRL_DOWN CONST("\xe0\x91") -#define GNT_KEY_CTRL_LEFT CONST("\xe0\x73") -#define GNT_KEY_CTRL_RIGHT CONST("\xe0\x74") +#define GNT_KEY_CTRL_UP CONST("\033\xe0\x8d") +#define GNT_KEY_CTRL_DOWN CONST("\033\xe0\x91") +#define GNT_KEY_CTRL_LEFT CONST("\033\xe0\x73") +#define GNT_KEY_CTRL_RIGHT CONST("\033\xe0\x74") -#define GNT_KEY_PGUP CONST("\xe0\x49") -#define GNT_KEY_PGDOWN CONST("\xe0\x51") -#define GNT_KEY_HOME CONST("\xe0\x47") -#define GNT_KEY_END CONST("\xe0\x4f") +#define GNT_KEY_PGUP CONST("\033\xe0\x49") +#define GNT_KEY_PGDOWN CONST("\033\xe0\x51") +#define GNT_KEY_HOME CONST("\033\xe0\x47") +#define GNT_KEY_END CONST("\033\xe0\x4f") #define GNT_KEY_ENTER CONST("\x0d") #define GNT_KEY_BACKSPACE CONST("\x08") -#define GNT_KEY_DEL CONST("\xe0\x53") -#define GNT_KEY_INS CONST("\xe0\x52") -#define GNT_KEY_BACK_TAB CONST("\xe1\x94") - -#define GNT_KEY_F1 CONST("\xe1\x3b") -#define GNT_KEY_F2 CONST("\xe1\x3c") -#define GNT_KEY_F3 CONST("\xe1\x3d") -#define GNT_KEY_F4 CONST("\xe1\x3e") -#define GNT_KEY_F5 CONST("\xe1\x3f") -#define GNT_KEY_F6 CONST("\xe1\x40") -#define GNT_KEY_F7 CONST("\xe1\x41") -#define GNT_KEY_F8 CONST("\xe1\x42") -#define GNT_KEY_F9 CONST("\xe1\x43") -#define GNT_KEY_F10 CONST("\xe1\x44") -#define GNT_KEY_F11 CONST("\xe0\x85") -#define GNT_KEY_F12 CONST("\xe0\x86") +#define GNT_KEY_DEL CONST("\033\xe0\x53") +#define GNT_KEY_INS CONST("\033\xe0\x52") +#define GNT_KEY_BACK_TAB CONST("\033\xe1\x94") + +#define GNT_KEY_F1 CONST("\033\xe1\x3b") +#define GNT_KEY_F2 CONST("\033\xe1\x3c") +#define GNT_KEY_F3 CONST("\033\xe1\x3d") +#define GNT_KEY_F4 CONST("\033\xe1\x3e") +#define GNT_KEY_F5 CONST("\033\xe1\x3f") +#define GNT_KEY_F6 CONST("\033\xe1\x40") +#define GNT_KEY_F7 CONST("\033\xe1\x41") +#define GNT_KEY_F8 CONST("\033\xe1\x42") +#define GNT_KEY_F9 CONST("\033\xe1\x43") +#define GNT_KEY_F10 CONST("\033\xe1\x44") +#define GNT_KEY_F11 CONST("\033\xe0\x85") +#define GNT_KEY_F12 CONST("\033\xe0\x86") #else diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c index 7a3b89597c..5a5a1e1ecf 100644 --- a/finch/libgnt/gntmain.c +++ b/finch/libgnt/gntmain.c @@ -66,6 +66,7 @@ #ifdef _WIN32 #undef _getch #undef getch +#include <windows.h> #include <conio.h> #endif @@ -92,6 +93,8 @@ static GntClipboard *clipboard; int gnt_need_conversation_to_locale; +static gchar *custom_config_dir = NULL; + #define HOLDING_ESCAPE (escape_stuff.timer != 0) static struct { @@ -106,6 +109,25 @@ escape_timeout(gpointer data) return FALSE; } +void +gnt_set_config_dir(const gchar *config_dir) +{ + if (channel) { + gnt_warning("gnt_set_config_dir failed: %s", + "gnt already initialized"); + } + free(custom_config_dir); + custom_config_dir = g_strdup(config_dir); +} + +const gchar * +gnt_get_config_dir(void) +{ + if (custom_config_dir) + return custom_config_dir; + return g_get_home_dir(); +} + #ifndef _WIN32 /** * detect_mouse_action: @@ -247,22 +269,38 @@ static gboolean io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) { #ifdef _WIN32 + /* We need: + * - 1 for escape prefix + * - 6 for gunichar-to-gchar conversion (see g_unichar_to_utf8) + * - 1 for the terminating NUL + * or: + * - 1 for escape prefix + * - 1 for special key prefix + * - 1 for the key + * - 1 for the terminating NUL + */ gchar keys[8]; gchar *k = keys; int ch; gboolean is_special = FALSE; + gboolean is_escape = FALSE; if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD) return FALSE; if (HOLDING_ESCAPE) { - *k = '\033'; - k++; + is_escape = TRUE; g_source_remove(escape_stuff.timer); escape_stuff.timer = 0; + } else if (GetAsyncKeyState(VK_LMENU)) { /* left-ALT key */ + is_escape = TRUE; + } + if (is_escape) { + *k = '\033'; + k++; } - ch = _getch(); /* we could use _getch_nolock */ + ch = _getwch(); /* we could use _getwch_nolock */ /* a small hack - we don't want to put NUL anywhere */ if (ch == 0x00) @@ -270,14 +308,16 @@ io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) if (ch == 0xE0 || ch == 0xE1) { is_special = TRUE; + if (!is_escape) { + *k = '\033'; + k++; + } *k = ch; k++; - ch = _getch(); + ch = _getwch(); } - k[0] = ch; - k[1] = '\0'; - if (ch == 0x1B && !is_special) { /* ESC */ + if (ch == 0x1B && !is_special) { /* ESC key */ escape_stuff.timer = g_timeout_add(250, escape_timeout, NULL); return TRUE; } @@ -285,16 +325,26 @@ io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) if (wm) gnt_wm_set_event_stack(wm, TRUE); - if (!is_special) { - gchar *converted; - gsize converted_len = 0; - - converted = g_locale_to_utf8(k, 1, NULL, &converted_len, NULL); - if (converted_len > 0 && converted_len <= 4) { - memcpy(k, converted, converted_len); - k[converted_len] = '\0'; + if (is_special) { + if (ch > 0xFF) { + gnt_warning("a special key out of gchar range (%d)", ch); + return TRUE; } + *k = ch; + k++; + } else { + gint result_len; + + result_len = g_unichar_to_utf8(ch, k); + k += result_len; } + *k = '\0'; + +#if 0 + gnt_warning("a key: [%s] %#x %#x %#x %#x %#x %#x", keys, + (guchar)keys[0], (guchar)keys[1], (guchar)keys[2], + (guchar)keys[3], (guchar)keys[4], (guchar)keys[5]); +#endif /* TODO: we could call detect_mouse_action here, but no * events are triggered (yet?) for mouse on win32. @@ -554,6 +604,12 @@ void gnt_init() if (channel) return; +#ifdef _WIN32 + /* UTF-8 for input */ + /* TODO: check it with NO_WIDECHAR. */ + SetConsoleCP(65001); +#endif + locale = setlocale(LC_ALL, ""); setup_io(); @@ -578,7 +634,7 @@ void gnt_init() gnt_init_keys(); gnt_init_styles(); - filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); + filename = g_build_filename(gnt_get_config_dir(), ".gntrc", NULL); gnt_style_read_configure_file(filename); g_free(filename); diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c index f818509077..18cc499aaa 100644 --- a/finch/libgnt/gntwm.c +++ b/finch/libgnt/gntwm.c @@ -331,7 +331,7 @@ static void read_window_positions(GntWM *wm) { GKeyFile *gfile = g_key_file_new(); - char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); + char *filename = g_build_filename(gnt_get_config_dir(), ".gntpositions", NULL); GError *error = NULL; char **keys; gsize nk; @@ -427,7 +427,7 @@ switch_window(GntWM *wm, int direction, gboolean urgent) w = wm->cws->ordered->data; orgpos = pos = g_list_index(wm->cws->list, w); - g_return_if_fail(pos < 0); + g_return_if_fail(pos >= 0); do { pos += direction; @@ -2120,7 +2120,7 @@ write_already(gpointer data) FILE *file; char *filename; - filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); + filename = g_build_filename(gnt_get_config_dir(), ".gntpositions", NULL); file = fopen(filename, "wb"); if (file == NULL) { diff --git a/finch/libgnt/libgnt_winres.rc.in b/finch/libgnt/libgnt_winres.rc.in new file mode 100644 index 0000000000..55b831b947 --- /dev/null +++ b/finch/libgnt/libgnt_winres.rc.in @@ -0,0 +1,30 @@ +#include <winver.h> + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @GNT_MAJOR_VERSION@,@GNT_MINOR_VERSION@,@GNT_MICRO_VERSION@,0 + PRODUCTVERSION @GNT_MAJOR_VERSION@,@GNT_MINOR_VERSION@,@GNT_MICRO_VERSION@,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "The Pidgin developer community" + VALUE "FileDescription", "Glib ncurses toolkit" + VALUE "FileVersion", "@GNT_VERSION@" + VALUE "InternalName", "libgnt" + VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." + VALUE "OriginalFilename", "libgnt-@GNT_API_VERSION@.dll" + VALUE "ProductName", "libgnt" + VALUE "ProductVersion", "@GNT_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/finch/plugins/Makefile.am b/finch/plugins/Makefile.am index c1ad60c3be..f187b0dff3 100644 --- a/finch/plugins/Makefile.am +++ b/finch/plugins/Makefile.am @@ -15,7 +15,7 @@ plugin_LTLIBRARIES = \ gnttinyurl.la \ grouping.la -plugindir = $(libdir)/finch +plugindir = @FINCH_PLUGINDIR@ gntclipboard_la_SOURCES = gntclipboard.c gntgf_la_SOURCES = gntgf.c diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am index 302d31b3a0..75a7b78c5a 100644 --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -221,7 +221,7 @@ purple_coreheaders += \ win32/wpurpleerror.h .rc.o: %.rc - $(AM_V_GEN)$(WINDRES) -I$(top_srcdir)/libpurple -i $< -o $@ + $(AM_V_GEN)$(WINDRES) -i $< -o $@ LIBPURPLE_WIN32RES = win32/libpurplerc.o LIBPURPLE_WIN32RES_LDFLAGS = -Wl,$(LIBPURPLE_WIN32RES) @@ -248,17 +248,17 @@ purple_cipherheaders = \ purple_builtheaders = purple.h version.h enums.h marshallers.h purple_enumheaders = \ - account.h \ - cipher.h \ - connection.h \ - conversation.h \ - conversationtypes.h \ - plugins.h \ - protocol.h \ - protocols.h \ - roomlist.h \ - status.h \ - xfer.h + $(srcdir)/account.h \ + $(srcdir)/cipher.h \ + $(srcdir)/connection.h \ + $(srcdir)/conversation.h \ + $(srcdir)/conversationtypes.h \ + $(srcdir)/plugins.h \ + $(srcdir)/protocol.h \ + $(srcdir)/protocols.h \ + $(srcdir)/roomlist.h \ + $(srcdir)/status.h \ + $(srcdir)/xfer.h marshallers.h: marshallers.list $(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --header > marshallers.h @@ -267,11 +267,11 @@ marshallers.c: marshallers.list marshallers.h $(AM_V_GEN)echo "#include \"marshallers.h\"" > marshallers.c $(AM_V_at)$(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --body >> marshallers.c -enums.h: enums.h.in $(purple_enumheaders) - $(AM_V_GEN)$(GLIB_MKENUMS) --template enums.h.in $(purple_enumheaders) > $@ +enums.h: $(srcdir)/enums.h.in $(purple_enumheaders) + $(AM_V_GEN)$(GLIB_MKENUMS) --template $(srcdir)/enums.h.in $(purple_enumheaders) > $@ -enums.c: enums.c.in $(purple_enumheaders) - $(AM_V_GEN)$(GLIB_MKENUMS) --template enums.c.in $(purple_enumheaders) > $@ +enums.c: $(srcdir)/enums.c.in $(purple_enumheaders) + $(AM_V_GEN)$(GLIB_MKENUMS) --template $(srcdir)/enums.c.in $(purple_enumheaders) > $@ CLEANFILES = \ enums.c \ diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw index 59a8e4fa22..3f66edd6e8 100644 --- a/libpurple/Makefile.mingw +++ b/libpurple/Makefile.mingw @@ -210,6 +210,10 @@ install: install_shallow all ./win32/libpurplerc.rc: ./win32/libpurplerc.rc.in $(PIDGIN_TREE_TOP)/VERSION @echo -e " GEN\t$@" @sed -e 's/@PURPLE_VERSION@/$(PURPLE_VERSION)/g' \ + -e 's/@PURPLE_MAJOR_VERSION@/$(PURPLE_MAJOR_VERSION)/g' \ + -e 's/@PURPLE_MINOR_VERSION@/$(PURPLE_MINOR_VERSION)/g' \ + -e 's/@PURPLE_MICRO_VERSION@/$(PURPLE_MICRO_VERSION)/g' \ + -e 's/@PURPLE_API_VERSION@/$(PURPLE_API_VERSION)/g' \ $@.in > $@ $(OBJECTS): $(PURPLE_CONFIG_H) $(PURPLE_VERSION_H) $(PURPLE_PURPLE_H) diff --git a/libpurple/certificate.c b/libpurple/certificate.c index a60b25a329..39425bb030 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -922,7 +922,7 @@ x509_ca_init(void) x509_ca_paths = g_list_append(x509_ca_paths, g_strdup(SSL_CERTIFICATES_DIR)); #endif -#ifdef _WIN32 +#if defined(_WIN32) && !defined(USE_WIN32_FHS) x509_ca_paths = g_list_append(x509_ca_paths, g_build_filename( PURPLE_DATADIR, "ca-certs", NULL)); #else diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c index 784743c2a2..0addd7e4c5 100644 --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -431,8 +431,10 @@ resolve(int in, int out) srvres = g_new0(PurpleSrvResponse, 1); if (strlen(name) > sizeof(srvres->hostname) - 1) { - purple_debug_error("dnssrv", "hostname is longer than available buffer ('%s', %zd bytes)!", - name, strlen(name)); + purple_debug_error("dnssrv", "hostname is " + "longer than available buffer ('%s', %" + G_GSIZE_FORMAT " bytes)!", + name, strlen(name)); } g_strlcpy(srvres->hostname, name, sizeof(srvres->hostname)); srvres->pref = pref; diff --git a/libpurple/plugins/Makefile.am b/libpurple/plugins/Makefile.am index f8b1c0448f..b60412b1d9 100644 --- a/libpurple/plugins/Makefile.am +++ b/libpurple/plugins/Makefile.am @@ -8,7 +8,7 @@ SUBDIRS = \ ssl \ keyrings -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ autoaccept_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ buddynote_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/libpurple/plugins/keyrings/Makefile.am b/libpurple/plugins/keyrings/Makefile.am index c0cba7dc2e..d780a91d3e 100644 --- a/libpurple/plugins/keyrings/Makefile.am +++ b/libpurple/plugins/keyrings/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = \ wincred.c CLEANFILES = -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ internalkeyring_la_CFLAGS = $(AM_CPPFLAGS) internalkeyring_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/libpurple/plugins/mono/Makefile.am b/libpurple/plugins/mono/Makefile.am index 6e334828e7..b9ee99681f 100644 --- a/libpurple/plugins/mono/Makefile.am +++ b/libpurple/plugins/mono/Makefile.am @@ -5,7 +5,7 @@ mono_sources = GetBuddyBack.cs \ EXTRA_DIST = $(mono_sources) -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +monodir = @PURPLE_PLUGINDIR@ mono_SCRIPTS = MPlugin.dll GetBuddyBack.dll mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) diff --git a/libpurple/plugins/mono/api/Makefile.am b/libpurple/plugins/mono/api/Makefile.am index 6af08dfc6e..3122fc5924 100644 --- a/libpurple/plugins/mono/api/Makefile.am +++ b/libpurple/plugins/mono/api/Makefile.am @@ -1,4 +1,4 @@ -monodir=$(libdir)/purple-$(PURPLE_MAJOR_VERSION) +monodir=@PURPLE_PLUGINDIR@ mono_sources = \ BlistNode.cs \ diff --git a/libpurple/plugins/mono/loader/Makefile.am b/libpurple/plugins/mono/loader/Makefile.am index fe0d4f3c3b..51fadc46cf 100644 --- a/libpurple/plugins/mono/loader/Makefile.am +++ b/libpurple/plugins/mono/loader/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ plugin_LTLIBRARIES = mono.la diff --git a/libpurple/plugins/perl/Makefile.am b/libpurple/plugins/perl/Makefile.am index 1438bc9b70..b2e5633f53 100644 --- a/libpurple/plugins/perl/Makefile.am +++ b/libpurple/plugins/perl/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ perl_dirs = common diff --git a/libpurple/plugins/ssl/Makefile.am b/libpurple/plugins/ssl/Makefile.am index 7959706c2f..a23d7049a0 100644 --- a/libpurple/plugins/ssl/Makefile.am +++ b/libpurple/plugins/ssl/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ ssl_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ ssl_gnutls_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/libpurple/plugins/tcl/Makefile.am b/libpurple/plugins/tcl/Makefile.am index 5076fd2ec4..09422a1844 100644 --- a/libpurple/plugins/tcl/Makefile.am +++ b/libpurple/plugins/tcl/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +plugindir = @PURPLE_PLUGINDIR@ tcl_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/libpurple/protocols/bonjour/Makefile.am b/libpurple/protocols/bonjour/Makefile.am index ddadeef589..bded182cb5 100644 --- a/libpurple/protocols/bonjour/Makefile.am +++ b/libpurple/protocols/bonjour/Makefile.am @@ -1,10 +1,11 @@ EXTRA_DIST = \ + mdns_avahi.c \ mdns_win32.c \ dns_sd_proxy.c \ dns_sd_proxy.h \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ BONJOURSOURCES = \ bonjour.c \ @@ -13,7 +14,6 @@ BONJOURSOURCES = \ buddy.h \ jabber.c \ jabber.h \ - mdns_avahi.c \ mdns_common.c \ mdns_common.h \ mdns_interface.h \ @@ -23,6 +23,15 @@ BONJOURSOURCES = \ bonjour_ft.c \ bonjour_ft.h +if IS_WIN32 +BONJOURSOURCES += \ + dns_sd_proxy.c \ + mdns_win32.c +else +BONJOURSOURCES += \ + mdns_avahi.c +endif + AM_CFLAGS = $(st) libbonjour_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ @@ -44,6 +53,10 @@ endif libbonjour_la_LIBADD = @PURPLE_LIBS@ $(LIBXML_LIBS) $(AVAHI_LIBS) +if IS_WIN32 +libbonjour_la_LIBADD += -lnetapi32 +endif + AM_CPPFLAGS = \ -I$(top_srcdir)/libpurple \ -I$(top_builddir)/libpurple \ diff --git a/libpurple/protocols/bonjour/dns_sd_proxy.c b/libpurple/protocols/bonjour/dns_sd_proxy.c index f1189063ed..f146223adb 100644 --- a/libpurple/protocols/bonjour/dns_sd_proxy.c +++ b/libpurple/protocols/bonjour/dns_sd_proxy.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. */ -#include "win32dep.h" +#include "internal.h" #include "dns_sd_proxy.h" #ifndef LINK_DNS_SD_DIRECTLY diff --git a/libpurple/protocols/bonjour/dns_sd_proxy.h b/libpurple/protocols/bonjour/dns_sd_proxy.h index 27df91baa1..b658ec825e 100644 --- a/libpurple/protocols/bonjour/dns_sd_proxy.h +++ b/libpurple/protocols/bonjour/dns_sd_proxy.h @@ -21,17 +21,107 @@ #ifndef _DNS_SD_PROXY #define _DNS_SD_PROXY +#include <config.h> #ifndef _MSC_VER #include <stdint.h> #endif -/* fixup to make pidgin compile against win32 bonjour */ -#if defined(_WIN32) && !defined(_MSC_VER) -#define _MSL_STDINT_H -#endif +#ifdef IS_WIN32_CROSS_COMPILED -#include <dns_sd.h> +/* I'm not sure, if we really need to include this for the following definitions + * modeled after Apple's dns_sd.h file. + * + * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +# if defined(_WIN32) && !defined(EFI32) && !defined(EFI64) +# define DNSSD_API __stdcall +# else +# define DNSSD_API +# endif + +# define kDNSServiceInterfaceIndexAny 0 +# define kDNSServiceMaxDomainName 1009 + +typedef gint32 DNSServiceErrorType; +typedef guint32 DNSServiceFlags; +typedef struct _DNSServiceRef_t *DNSServiceRef; +typedef struct _DNSRecordRef_t *DNSRecordRef; +typedef guint32 DNSServiceProtocol; + +typedef union _TXTRecordRef_t { + gchar PrivateData[16]; + gchar *ForceNaturalAlignment; +} TXTRecordRef; + +typedef void (DNSSD_API *DNSServiceBrowseReply)(); +typedef void (DNSSD_API *DNSServiceGetAddrInfoReply)(); +typedef void (DNSSD_API *DNSServiceQueryRecordReply)( + DNSServiceRef sdRef, DNSServiceFlags flags, guint32 interfaceIndex, + DNSServiceErrorType errorCode, const gchar *fullname, + guint16 rrtype, guint16 rrclass, guint16 rdlen, const void *rdata, + guint32 ttl, void *context); +typedef void (DNSSD_API *DNSServiceRegisterReply)(); +typedef void (DNSSD_API *DNSServiceResolveReply)( + DNSServiceRef sdRef, DNSServiceFlags flags, guint32 interfaceIndex, + DNSServiceErrorType errorCode, const gchar *fullname, + const gchar *hosttarget, guint16 port, guint16 txtLen, + const guchar *txtRecord, void *context); + +enum { + kDNSServiceErr_NoError = 0, + kDNSServiceErr_Unknown = -65537, +}; + +enum { + kDNSServiceFlagsAdd = 0x2, + kDNSServiceFlagsLongLivedQuery = 0x100, +}; + +enum { + kDNSServiceType_NULL = 10, + kDNSServiceType_TXT = 16, +}; + +enum { + kDNSServiceClass_IN = 1, +}; + +enum { + kDNSServiceProtocol_IPv4 = 0x01, +}; + +#else +/* fixup to make pidgin compile against win32 bonjour */ +# if defined(_WIN32) && !defined(_MSC_VER) +# define _MSL_STDINT_H +# endif +# include <dns_sd.h> +#endif /* IS_WIN32_CROSS_COMPILED */ gboolean dns_sd_available(void); diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index d0e0da7ebc..19c47068e9 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -28,8 +28,6 @@ #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> -#else -#include "libc_interface.h" #endif #include <sys/types.h> diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am index b3870fe778..4af8920d7e 100644 --- a/libpurple/protocols/gg/Makefile.am +++ b/libpurple/protocols/gg/Makefile.am @@ -3,7 +3,7 @@ GADU_EXTRA = #GADU_EXTRA += -Werror -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ EXTRA_DIST = \ account.c \ diff --git a/libpurple/protocols/irc/Makefile.am b/libpurple/protocols/irc/Makefile.am index 56cc6cfcf4..d47b761791 100644 --- a/libpurple/protocols/irc/Makefile.am +++ b/libpurple/protocols/irc/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ IRCSOURCES = \ cmds.c \ diff --git a/libpurple/protocols/jabber/Makefile.am b/libpurple/protocols/jabber/Makefile.am index 46ffc66b27..e73ce52fc0 100644 --- a/libpurple/protocols/jabber/Makefile.am +++ b/libpurple/protocols/jabber/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = \ win32/posix.uname.c \ win32/utsname.h -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ JABBERSOURCES = \ adhoccommands.c \ diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index c0abbf0af5..254b0d4f04 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3889,7 +3889,7 @@ jabber_do_init(void) if (!sasl_initialized) { sasl_initialized = TRUE; #ifdef _WIN32 - sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL); + sasldir = g_build_filename(wpurple_bin_dir(), "sasl2", NULL); sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir); g_free(sasldir); /* Suppress error popups for failing to load sasl plugins */ diff --git a/libpurple/protocols/msn/Makefile.am b/libpurple/protocols/msn/Makefile.am index ece1829df8..0f4ffc6bed 100644 --- a/libpurple/protocols/msn/Makefile.am +++ b/libpurple/protocols/msn/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = \ directconn.h \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ MSNSOURCES = \ cmdproc.c \ diff --git a/libpurple/protocols/mxit/Makefile.am b/libpurple/protocols/mxit/Makefile.am index 7bb427f9d0..34bb82a39a 100644 --- a/libpurple/protocols/mxit/Makefile.am +++ b/libpurple/protocols/mxit/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ MXITSOURCES = \ actions.c \ diff --git a/libpurple/protocols/novell/Makefile.am b/libpurple/protocols/novell/Makefile.am index 92853576c5..4756c0e3f0 100644 --- a/libpurple/protocols/novell/Makefile.am +++ b/libpurple/protocols/novell/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ NOVELLSOURCES = \ nmfield.h \ diff --git a/libpurple/protocols/null/Makefile.am b/libpurple/protocols/null/Makefile.am index 9a5dacf94c..fc5a221a54 100644 --- a/libpurple/protocols/null/Makefile.am +++ b/libpurple/protocols/null/Makefile.am @@ -2,7 +2,7 @@ EXTRA_DIST = \ Makefile.mingw \ README -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ NULLSOURCES = \ nullprpl.h \ diff --git a/libpurple/protocols/oscar/Makefile.am b/libpurple/protocols/oscar/Makefile.am index f0d4ef51f2..ecf3ae5ca8 100644 --- a/libpurple/protocols/oscar/Makefile.am +++ b/libpurple/protocols/oscar/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = \ AUTHORS \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ OSCARSOURCES = \ authorization.c \ diff --git a/libpurple/protocols/sametime/Makefile.am b/libpurple/protocols/sametime/Makefile.am index abbb811034..5af763c389 100644 --- a/libpurple/protocols/sametime/Makefile.am +++ b/libpurple/protocols/sametime/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ noinst_HEADERS = sametime.h diff --git a/libpurple/protocols/silc/Makefile.am b/libpurple/protocols/silc/Makefile.am index 83d94c96bb..fea0b7daa2 100644 --- a/libpurple/protocols/silc/Makefile.am +++ b/libpurple/protocols/silc/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = \ README \ TODO -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ SILCSOURCES = \ buddy.c \ diff --git a/libpurple/protocols/simple/Makefile.am b/libpurple/protocols/simple/Makefile.am index 715f5a2a0e..18a31dc2b0 100644 --- a/libpurple/protocols/simple/Makefile.am +++ b/libpurple/protocols/simple/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ SIMPLESOURCES = \ simple.c \ diff --git a/libpurple/protocols/yahoo/Makefile.am b/libpurple/protocols/yahoo/Makefile.am index 08d7705364..ce4f709357 100644 --- a/libpurple/protocols/yahoo/Makefile.am +++ b/libpurple/protocols/yahoo/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ YAHOOSOURCES = \ util.c \ diff --git a/libpurple/protocols/zephyr/Makefile.am b/libpurple/protocols/zephyr/Makefile.am index 5797c89294..07a795f19e 100644 --- a/libpurple/protocols/zephyr/Makefile.am +++ b/libpurple/protocols/zephyr/Makefile.am @@ -1,4 +1,4 @@ -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) +pkgdir = @PURPLE_PLUGINDIR@ ZEPHYRSOURCES = \ ZAsyncLocate.c \ diff --git a/libpurple/win32/giowin32.c b/libpurple/win32/giowin32.c index 18fba16a79..fd96ceed15 100644 --- a/libpurple/win32/giowin32.c +++ b/libpurple/win32/giowin32.c @@ -32,7 +32,7 @@ /* Define this to get (very) verbose logging of all channels */ /* #define G_IO_WIN32_DEBUG */ -/* #include "config.h" */ +#include <config.h> #include <glib.h> diff --git a/libpurple/win32/global.mak b/libpurple/win32/global.mak index 2b68c59563..d5aeb8a595 100644 --- a/libpurple/win32/global.mak +++ b/libpurple/win32/global.mak @@ -8,6 +8,13 @@ #include optional $(PIDGIN_TREE_TOP)/local.mak to allow overriding of any definitions -include $(PIDGIN_TREE_TOP)/local.mak +# TODO: we should do parsing like for PURPLE_VERSION, if we won't drop +# Makefile.mingw files before 3.0.0 release +PURPLE_MAJOR_VERSION := 3 +PURPLE_MINOR_VERSION := 0 +PURPLE_MICRO_VERSION := 0 +PURPLE_API_VERSION := 20 + # Locations of our various dependencies WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev GTKSPELL_TOP ?= $(WIN32_DEV_TOP)/gtkspell-2.0 diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c index a75667de2e..fc4e171940 100644 --- a/libpurple/win32/libc_interface.c +++ b/libpurple/win32/libc_interface.c @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ + +#include <config.h> + #include <winsock2.h> #include <ws2tcpip.h> #include <io.h> @@ -28,7 +31,6 @@ #include <sys/stat.h> #include <time.h> #include <glib.h> -#include "config.h" #include "debug.h" #include "libc_internal.h" #include <glib/gstdio.h> diff --git a/libpurple/win32/libc_interface.h b/libpurple/win32/libc_interface.h index e2745ab6ad..011d178d51 100644 --- a/libpurple/win32/libc_interface.h +++ b/libpurple/win32/libc_interface.h @@ -22,6 +22,9 @@ */ #ifndef _LIBC_INTERFACE_H_ #define _LIBC_INTERFACE_H_ + +#include <config.h> + #include <winsock2.h> #include <ws2tcpip.h> #include <io.h> @@ -133,7 +136,8 @@ wpurple_gethostname( name, size ) wpurple_gettimeofday( timeval, timezone ) /* stdio.h */ -#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 +#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 || \ + !defined(IS_WIN32_CROSS_COMPILED) # undef snprintf # define snprintf _snprintf # undef vsnprintf diff --git a/libpurple/win32/libpurplerc.rc.in b/libpurple/win32/libpurplerc.rc.in index 7a5299a201..26441110b7 100644 --- a/libpurple/win32/libpurplerc.rc.in +++ b/libpurple/win32/libpurplerc.rc.in @@ -1,9 +1,8 @@ #include <winver.h> -#include "version.h" VS_VERSION_INFO VERSIONINFO - FILEVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 - PRODUCTVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 + FILEVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + PRODUCTVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -19,7 +18,7 @@ VS_VERSION_INFO VERSIONINFO VALUE "FileVersion", "@PURPLE_VERSION@" VALUE "InternalName", "libpurple" VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." - VALUE "OriginalFilename", "libpurple.dll" + VALUE "OriginalFilename", "libpurple-@PURPLE_API_VERSION@.dll" VALUE "ProductName", "libpurple" VALUE "ProductVersion", "@PURPLE_VERSION@" END diff --git a/libpurple/win32/win32dep.c b/libpurple/win32/win32dep.c index 226d92a353..4617b8a018 100644 --- a/libpurple/win32/win32dep.c +++ b/libpurple/win32/win32dep.c @@ -22,7 +22,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ -#define _WIN32_IE 0x501 #include "internal.h" #include <winuser.h> @@ -30,10 +29,12 @@ #include "glibcompat.h" #include "notify.h" +#define MAX_PATH_LEN 2048 + /* * LOCALS */ -static char *app_data_dir = NULL, *install_dir = NULL, +static char *app_data_dir = NULL, *bin_dir = NULL, *data_dir = NULL, *lib_dir = NULL, *locale_dir = NULL, *sysconf_dir = NULL; static HINSTANCE libpurpledll_hInstance = NULL; @@ -129,12 +130,17 @@ gchar *wpurple_get_special_folder(int folder_type) { return retval; } -const char *wpurple_install_dir(void) { +const char *wpurple_bin_dir(void) { static gboolean initialized = FALSE; if (!initialized) { char *tmp = NULL; wchar_t winstall_dir[MAXPATHLEN]; + + /* We might use g_win32_get_package_installation_directory_of_module + * here, but we won't because this routine strips bin or lib + * part of the path. + */ if (GetModuleFileNameW(libpurpledll_hInstance, winstall_dir, MAXPATHLEN) > 0) { tmp = g_utf16_to_utf8(winstall_dir, -1, @@ -148,42 +154,138 @@ const char *wpurple_install_dir(void) { g_free(tmp); return NULL; } else { - install_dir = g_path_get_dirname(tmp); + bin_dir = g_path_get_dirname(tmp); g_free(tmp); initialized = TRUE; } } - return install_dir; + return bin_dir; +} + +#ifdef USE_WIN32_FHS +static gchar * +wpurple_install_relative_path(const gchar *abspath) +{ + const gchar *bindir = WIN32_FHS_BINDIR; + const gchar *relpath; + int i, last_dirsep = -1, bin_esc_cnt; + gchar *ret; + GString *bin_esc; + + g_return_val_if_fail(bindir != NULL, NULL); + g_return_val_if_fail(bindir[0] != '\0', NULL); + g_return_val_if_fail(abspath != NULL, NULL); + g_return_val_if_fail(abspath[0] != '\0', NULL); + + /* let's find the common prefix of those paths */ + for (i = 0; bindir[i] == abspath[i]; i++) { + if (bindir[i] == '\0') + break; + if (bindir[i] == '\\' || bindir[i] == '/') + last_dirsep = i; + } + if (bindir[i] == '\0' && (abspath[i] == '\\' || abspath[i] == '/')) + last_dirsep = i; + if (abspath[i] == '\0' && (bindir[i] == '\\' || bindir[i] == '/')) + last_dirsep = i; + + /* there is no common prefix, return absolute path */ + if (last_dirsep == -1) + return g_strdup(abspath); + + /* let's check, how many dirs we need to go up to the common prefix */ + bin_esc_cnt = 0; + for (i = last_dirsep; bindir[i]; i++) { + if (bindir[i] != '\\' && bindir[i] != '/') + continue; + if (bindir[i + 1] == '\0') /* trailing dir separator */ + break; + bin_esc_cnt++; + } + bin_esc = g_string_new(""); + for (i = 0; i < bin_esc_cnt; i++) + g_string_append(bin_esc, ".." G_DIR_SEPARATOR_S); + + /* now, we need to go back deeper into the directory tree */ + relpath = &abspath[last_dirsep]; + if (relpath[0] != '\0') + relpath++; + + /* - enter bin dir + * - escape it to the common prefix + * - dive into the abspath dir + */ + ret = g_build_filename(wpurple_bin_dir(), bin_esc->str, relpath, NULL); + g_string_free(bin_esc, TRUE); + + purple_debug_misc("wpurple", "wpurple_install_relative_path(%s) = %s", + abspath, ret); + + return ret; +} +#endif + +const char * +wpurple_data_dir(void) { +#ifdef USE_WIN32_FHS + static gboolean initialized = FALSE; + if (initialized) + return data_dir; + data_dir = wpurple_install_relative_path(WIN32_FHS_DATADIR); + initialized = TRUE; + + return data_dir; +#else + return wpurple_bin_dir(); +#endif } -const char *wpurple_lib_dir(void) { + +const char *wpurple_lib_dir(const char *subdir) +{ static gboolean initialized = FALSE; + static gchar subpath[MAX_PATH_LEN]; if (!initialized) { - const char *inst_dir = wpurple_install_dir(); +#ifdef USE_WIN32_FHS + lib_dir = wpurple_install_relative_path(WIN32_FHS_LIBDIR); + initialized = TRUE; +#else + const char *inst_dir = wpurple_bin_dir(); if (inst_dir != NULL) { lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir); initialized = TRUE; } else { return NULL; } +#endif } - return lib_dir; + if (subdir == NULL) + return lib_dir; + + g_snprintf(subpath, sizeof(subpath), + "%s" G_DIR_SEPARATOR_S "%s", lib_dir, subdir); + return subpath; } const char *wpurple_locale_dir(void) { static gboolean initialized = FALSE; if (!initialized) { - const char *inst_dir = wpurple_install_dir(); +#ifdef USE_WIN32_FHS + locale_dir = wpurple_install_relative_path(WIN32_FHS_LOCALEDIR); + initialized = TRUE; +#else + const char *inst_dir = wpurple_bin_dir(); if (inst_dir != NULL) { locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir); initialized = TRUE; } else { return NULL; } +#endif } return locale_dir; @@ -213,7 +315,11 @@ const char *wpurple_sysconf_dir(void) static gboolean initialized = FALSE; if (!initialized) { +#ifdef USE_WIN32_FHS + sysconf_dir = wpurple_install_relative_path(WIN32_FHS_SYSCONFDIR); +#else sysconf_dir = wpurple_get_special_folder(CSIDL_COMMON_APPDATA); +#endif initialized = TRUE; } @@ -541,13 +647,15 @@ void wpurple_cleanup(void) { WSACleanup(); g_free(app_data_dir); - g_free(install_dir); + g_free(bin_dir); + g_free(data_dir); g_free(lib_dir); g_free(locale_dir); g_free(sysconf_dir); app_data_dir = NULL; - install_dir = NULL; + bin_dir = NULL; + data_dir = NULL; lib_dir = NULL; locale_dir = NULL; sysconf_dir = NULL; diff --git a/libpurple/win32/win32dep.h b/libpurple/win32/win32dep.h index 9a83dc5a05..c4c7d4cb81 100644 --- a/libpurple/win32/win32dep.h +++ b/libpurple/win32/win32dep.h @@ -22,6 +22,9 @@ */ #ifndef _WIN32DEP_H_ #define _WIN32DEP_H_ + +#include <config.h> + #include <winsock2.h> #include <windows.h> #include <shlobj.h> @@ -66,8 +69,9 @@ int wpurple_input_pipe(int pipefd[2]); /* Determine Purple paths */ gchar *wpurple_get_special_folder(int folder_type); /* needs to be g_free'd */ -const char *wpurple_install_dir(void); -const char *wpurple_lib_dir(void); +const char *wpurple_bin_dir(void); +const char *wpurple_data_dir(void); +const char *wpurple_lib_dir(const char *subdir); const char *wpurple_locale_dir(void); const char *wpurple_home_dir(void); const char *wpurple_sysconf_dir(void); diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index b859e61595..ae143babdb 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -167,7 +167,7 @@ libpidgin_la_headers += \ win32/wspell.h .rc.o: %.rc - $(AM_V_GEN)$(WINDRES) -I$(top_srcdir)/libpurple -i $< -o $@ + $(AM_V_GEN)$(WINDRES) -I $(srcdir)/win32 -I $(srcdir) -i $< -o $@ LIBPIDGIN_WIN32RES = win32/pidgin_dll_rc.o LIBPIDGIN_WIN32RES_LDFLAGS = -Wl,$(LIBPIDGIN_WIN32RES) @@ -191,7 +191,8 @@ CLEANFILES = gtkdebug.html.h gtkdebug.c: gtkdebug.html.h libpidgin_la_DEPENDENCIES = @LIBOBJS@ $(LIBPIDGIN_WIN32RES) -libpidgin_la_LDFLAGS = -export-dynamic -no-undefined $(LIBPIDGIN_WIN32RES_LDFLAGS) +libpidgin_la_LDFLAGS = -export-dynamic -no-undefined \ + -version-info $(PURPLE_LT_VERSION_INFO) $(LIBPIDGIN_WIN32RES_LDFLAGS) libpidgin_la_LIBADD = \ @LIBOBJS@ \ $(GLIB_LIBS) \ diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index cf3744a470..bbda6dfe8d 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -153,6 +153,10 @@ gtkdialogs.c: $(PIDGIN_REVISION_H) win32/pidgin_exe_rc.rc: win32/pidgin_exe_rc.rc.in $(PIDGIN_TREE_TOP)/VERSION @echo -e " GEN\t$@" @sed -e 's/@PURPLE_VERSION@/$(PIDGIN_VERSION)/g' \ + -e 's/@PURPLE_MAJOR_VERSION@/$(PURPLE_MAJOR_VERSION)/g' \ + -e 's/@PURPLE_MINOR_VERSION@/$(PURPLE_MINOR_VERSION)/g' \ + -e 's/@PURPLE_MICRO_VERSION@/$(PURPLE_MICRO_VERSION)/g' \ + -e 's/@PURPLE_API_VERSION@/$(PURPLE_API_VERSION)/g' \ $@.in > $@ install_shallow: $(PIDGIN_INSTALL_DIR) $(EXE_TARGET).exe $(PIDGIN_TARGET).dll @@ -168,6 +172,10 @@ install: install_shallow all win32/pidgin_dll_rc.rc: win32/pidgin_dll_rc.rc.in $(PIDGIN_TREE_TOP)/VERSION @echo -e " GEN\t$@" @sed -e 's/@PURPLE_VERSION@/$(PIDGIN_VERSION)/g' \ + -e 's/@PURPLE_MAJOR_VERSION@/$(PURPLE_MAJOR_VERSION)/g' \ + -e 's/@PURPLE_MINOR_VERSION@/$(PURPLE_MINOR_VERSION)/g' \ + -e 's/@PURPLE_MICRO_VERSION@/$(PURPLE_MICRO_VERSION)/g' \ + -e 's/@PURPLE_API_VERSION@/$(PURPLE_API_VERSION)/g' \ $@.in > $@ $(EXE_OBJECTS) $(PIDGIN_OBJECTS): $(PIDGIN_CONFIG_H) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index b1a99fa0ac..48a1c75526 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -125,7 +125,7 @@ get_template_path(const char *dir) if (!g_file_test(file, G_FILE_TEST_EXISTS)) { g_free(file); -#ifdef _WIN32 +#if defined(_WIN32) && !defined(USE_WIN32_FHS) file = g_build_filename(PURPLE_DATADIR, "theme", "Template.html", NULL); #else diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 705db8b830..481dabfe88 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -140,9 +140,12 @@ enum { #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue))) -/* From http://www.w3.org/TR/AERT#color-contrast */ -#define MIN_BRIGHTNESS_CONTRAST 75 -#define MIN_COLOR_CONTRAST 200 +/* From http://www.w3.org/TR/AERT#color-contrast + * Range for color difference is 500 + * Range for brightness is 125 + */ +#define MIN_BRIGHTNESS_CONTRAST 85 +#define MIN_COLOR_CONTRAST 250 #define NICK_COLOR_GENERATE_COUNT 220 static GArray *generated_nick_colors = NULL; @@ -217,35 +220,13 @@ static void pidgin_conv_set_position_size(PidginConvWindow *win, int x, int y, int width, int height); static gboolean pidgin_conv_xy_to_right_infopane(PidginConvWindow *win, int x, int y); -static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) +static const GdkColor * +get_nick_color(PidginConversation *gtkconv, const gchar *name) { -#if GTK_CHECK_VERSION(3,0,0) - GtkStyleContext *style = gtk_widget_get_style_context(gtkconv->webview); - GdkRGBA rgba; -#else - GtkStyle *style = gtk_widget_get_style(gtkconv->webview); -#endif static GdkColor col; - float scale; - - col = g_array_index(gtkconv->nick_colors, GdkColor, g_str_hash(name) % gtkconv->nick_colors->len); - - g_return_val_if_fail(style != NULL, &col); -#if GTK_CHECK_VERSION(3,0,0) - gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &rgba); - scale = (1 - LUMINANCE(rgba)) * ((float)0xffff / MAX(MAX(col.red, col.blue), col.green)); -#else - scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) * - (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green))); -#endif - - /* The colors are chosen to look fine on white; we should never have to darken */ - if (scale > 1) { - col.red *= scale; - col.green *= scale; - col.blue *= scale; - } + col = g_array_index(gtkconv->nick_colors, GdkColor, + g_str_hash(name) % gtkconv->nick_colors->len); return &col; } @@ -8958,7 +8939,7 @@ pidgin_conversations_init(void) PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL); purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL)); -#ifdef _WIN32 +#if defined(_WIN32) && !defined(USE_WIN32_FHS) theme_dir = g_build_filename(PURPLE_DATADIR, "theme", NULL); #else theme_dir = g_build_filename(PURPLE_DATADIR, "pidgin", "theme", NULL); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 64b670de5b..cc88369d69 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -25,9 +25,8 @@ #include "pidgin.h" #ifdef _WIN32 -# ifdef small # undef small -# endif +# include <shellapi.h> #endif /*_WIN32*/ #ifdef USE_GTKSPELL diff --git a/pidgin/gtkxfer.c b/pidgin/gtkxfer.c index 6e1bb0c22e..73d566efbb 100644 --- a/pidgin/gtkxfer.c +++ b/pidgin/gtkxfer.c @@ -32,6 +32,10 @@ #include "pidginstock.h" #include "gtkutils.h" +#ifdef _WIN32 +# include <shellapi.h> +#endif + /* the maximum size of files we will try to make a thumbnail for */ #define PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL 10 * 1024 * 1024 diff --git a/pidgin/pidgin-3.pc.in b/pidgin/pidgin-3.pc.in index e0fe9ef569..3ce9fd67c1 100644 --- a/pidgin/pidgin-3.pc.in +++ b/pidgin/pidgin-3.pc.in @@ -13,3 +13,4 @@ Description: Pidgin is a GTK2-based instant messenger application. Version: @VERSION@ Requires: @GTK_PC_MODULE@ @WEBKIT_PC_MODULE@ purple-3 Cflags: -I${includedir} +Libs: -L${libdir} -lpidgin diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index a30391cea3..f873fe7fb6 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -30,7 +30,7 @@ SUBDIRS += \ win32/transparency endif -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ contact_priority_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ extplacement_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/cap/Makefile.am b/pidgin/plugins/cap/Makefile.am index 3c15dfd6f8..d187c60f7c 100644 --- a/pidgin/plugins/cap/Makefile.am +++ b/pidgin/plugins/cap/Makefile.am @@ -1,4 +1,4 @@ -capdir = $(libdir)/pidgin +capdir = @PIDGIN_PLUGINDIR@ cap_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/crazychat/Makefile.am b/pidgin/plugins/crazychat/Makefile.am index d2f0798ca4..9f21c3d9a5 100644 --- a/pidgin/plugins/crazychat/Makefile.am +++ b/pidgin/plugins/crazychat/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ if ENABLE_DEBUG DEBUG_CPPFLAGS = -g -pg diff --git a/pidgin/plugins/disco/Makefile.am b/pidgin/plugins/disco/Makefile.am index 3432826b65..02cb85ca07 100644 --- a/pidgin/plugins/disco/Makefile.am +++ b/pidgin/plugins/disco/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ xmppdisco_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/gestures/Makefile.am b/pidgin/plugins/gestures/Makefile.am index 94e4b61a6e..320905f5f5 100644 --- a/pidgin/plugins/gestures/Makefile.am +++ b/pidgin/plugins/gestures/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ gestures_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/gevolution/Makefile.am b/pidgin/plugins/gevolution/Makefile.am index 2f1772f930..a5ab6cd597 100644 --- a/pidgin/plugins/gevolution/Makefile.am +++ b/pidgin/plugins/gevolution/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ gevolution_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/musicmessaging/Makefile.am b/pidgin/plugins/musicmessaging/Makefile.am index b71f47a7fe..2ea0c459cc 100644 --- a/pidgin/plugins/musicmessaging/Makefile.am +++ b/pidgin/plugins/musicmessaging/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ music.png -musicmessagingdir = $(libdir)/pidgin +musicmessagingdir = @PIDGIN_PLUGINDIR@ musicmessaging_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/perl/common/Makefile.PL.in b/pidgin/plugins/perl/common/Makefile.PL.in index 7a005e6a35..496d73a5a0 100644 --- a/pidgin/plugins/perl/common/Makefile.PL.in +++ b/pidgin/plugins/perl/common/Makefile.PL.in @@ -16,7 +16,7 @@ WriteMakefile( # 'OPTIMIZE' => '-g', # For debugging. 'INSTALLDIRS' => 'vendor', 'INSTALL_BASE' => '$(prefix)', - 'INSTALLVENDORARCH' => '$(libdir)/pidgin/perl', + 'INSTALLVENDORARCH' => '$(libdir)/pidgin-$(PURPLE_MAJOR_VERSION)/perl', 'INSTALLVENDORMAN3DIR' => '$(mandir)/man3', 'macro' => { 'prefix' => '@prefix@', diff --git a/pidgin/plugins/ticker/Makefile.am b/pidgin/plugins/ticker/Makefile.am index 9820a5a31d..4084d06df9 100644 --- a/pidgin/plugins/ticker/Makefile.am +++ b/pidgin/plugins/ticker/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = \ Makefile.mingw -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ ticker_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ diff --git a/pidgin/plugins/win32/transparency/Makefile.am b/pidgin/plugins/win32/transparency/Makefile.am index cff2417933..ad97d98504 100644 --- a/pidgin/plugins/win32/transparency/Makefile.am +++ b/pidgin/plugins/win32/transparency/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ plugin_LTLIBRARIES = win2ktrans.la diff --git a/pidgin/plugins/win32/transparency/win2ktrans.c b/pidgin/plugins/win32/transparency/win2ktrans.c index 50b2f2bb34..9ccb903422 100644 --- a/pidgin/plugins/win32/transparency/win2ktrans.c +++ b/pidgin/plugins/win32/transparency/win2ktrans.c @@ -79,7 +79,7 @@ static GSList *window_list = NULL; static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled, gboolean always_on_top) { - HWND hWnd = GDK_WINDOW_HWND(window->window); + HWND hWnd = GDK_WINDOW_HWND(gtk_widget_get_window(window)); LONG style = GetWindowLong(hWnd, GWL_EXSTYLE); if (enabled) { style |= WS_EX_LAYERED; @@ -175,10 +175,10 @@ static GtkWidget *wintrans_slider(GtkWidget *win) { slider = gtk_hscale_new_with_range(50, 255, 1); gtk_range_set_value(GTK_RANGE(slider), imalpha); - gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); + gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1); /* On slider val change, update window's transparency level */ - g_signal_connect(GTK_OBJECT(slider), "value-changed", + g_signal_connect(G_OBJECT(slider), "value-changed", G_CALLBACK(change_alpha), win); gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); @@ -256,7 +256,7 @@ static void add_slider(GtkWidget *win) { GTK_CONTAINER(win)); wl != NULL; wl = wl->next) { - if (GTK_IS_VBOX(GTK_OBJECT(wl->data))) + if (GTK_IS_VBOX(G_OBJECT(wl->data))) vbox = GTK_WIDGET(wl->data); else { purple_debug_error(WINTRANS_PLUGIN_ID, @@ -502,7 +502,7 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { imtransbox = pidgin_make_frame(ret, _("IM Conversation Windows")); button = pidgin_prefs_checkbox(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_ENABLED); @@ -511,12 +511,12 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); gtk_widget_show(trans_box); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), trans_box); button = pidgin_prefs_checkbox(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_SLIDER); @@ -526,7 +526,7 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP, trans_box); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_ONTOP); @@ -541,11 +541,11 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { slider = gtk_hscale_new_with_range(50, 255, 1); gtk_range_set_value(GTK_RANGE(slider), purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA)); - gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); + gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1); - g_signal_connect(GTK_OBJECT(slider), "value-changed", + g_signal_connect(G_OBJECT(slider), "value-changed", G_CALLBACK(alpha_change), NULL); - g_signal_connect(GTK_OBJECT(slider), "focus-out-event", + g_signal_connect(G_OBJECT(slider), "focus-out-event", G_CALLBACK(alpha_pref_set_int), (gpointer) OPT_WINTRANS_IM_ALPHA); @@ -559,7 +559,7 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { bltransbox = pidgin_make_frame (ret, _("Buddy List Window")); button = pidgin_prefs_checkbox(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_blist_trans), (gpointer) OPT_WINTRANS_BL_ENABLED); @@ -567,14 +567,14 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { if (!purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); gtk_widget_show(trans_box); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), trans_box); button = pidgin_prefs_checkbox( _("Remove Buddy List window transparency on focus"), OPT_WINTRANS_BL_ONFOCUS, trans_box); button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP, trans_box); - g_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_blist_trans), (gpointer) OPT_WINTRANS_BL_ONTOP); gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); @@ -589,11 +589,11 @@ static GtkWidget *get_config_frame(PurplePlugin *plugin) { gtk_range_set_value(GTK_RANGE(slider), purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA)); - gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); + gtk_widget_set_size_request(GTK_WIDGET(slider), 200, -1); - g_signal_connect(GTK_OBJECT(slider), "value-changed", + g_signal_connect(G_OBJECT(slider), "value-changed", G_CALLBACK(bl_alpha_change), NULL); - g_signal_connect(GTK_OBJECT(slider), "focus-out-event", + g_signal_connect(G_OBJECT(slider), "focus-out-event", G_CALLBACK(alpha_pref_set_int), (gpointer) OPT_WINTRANS_BL_ALPHA); diff --git a/pidgin/plugins/win32/winprefs/Makefile.am b/pidgin/plugins/win32/winprefs/Makefile.am index 3cfba73609..3e46d8541d 100644 --- a/pidgin/plugins/win32/winprefs/Makefile.am +++ b/pidgin/plugins/win32/winprefs/Makefile.am @@ -1,4 +1,4 @@ -plugindir = $(libdir)/pidgin +plugindir = @PIDGIN_PLUGINDIR@ plugin_LTLIBRARIES = winprefs.la diff --git a/pidgin/plugins/win32/winprefs/gtkappbar.c b/pidgin/plugins/win32/winprefs/gtkappbar.c index a63124abc9..b3a81c627b 100644 --- a/pidgin/plugins/win32/winprefs/gtkappbar.c +++ b/pidgin/plugins/win32/winprefs/gtkappbar.c @@ -43,6 +43,12 @@ typedef BOOL WINAPI purple_GetMonitorInfo(HMONITOR, LPMONITORINFO); static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side); +static inline HWND +appbar_get_handle(GtkAppBar *ab) +{ + return GDK_WINDOW_HWND(gtk_widget_get_window(ab->win)); +} + /* Retrieve the rectangular display area from the specified monitor * Return TRUE if successful, otherwise FALSE */ @@ -358,7 +364,7 @@ static void show_hide(GtkAppBar *ab, gboolean hide) { if (hide) { purple_debug_info("gtkappbar", "hidden\n"); - gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window)); + gtk_appbar_unregister(ab, appbar_get_handle(ab)); ab->docked = TRUE; ab->iconized = TRUE; } else { @@ -457,7 +463,7 @@ static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) { if(msg->wParam == SIZE_MINIMIZED) { purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "Minimize\n"); if(ab->docked) { - gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window)); + gtk_appbar_unregister(ab, appbar_get_handle(ab)); ab->docked = TRUE; } } @@ -600,21 +606,21 @@ static void gtk_appbar_do_dock(GtkAppBar *ab, UINT side) { purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "gtk_appbar_do_dock\n"); - if(!ab || !IsWindow(GDK_WINDOW_HWND(ab->win->window))) - return; + if (!ab || !IsWindow(appbar_get_handle(ab))) + return; ab->side = side; - get_window_normal_rc(GDK_WINDOW_HWND(ab->win->window), &(ab->docked_rect)); + get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect)); CopyRect(&orig, &(ab->docked_rect)); - get_rect_of_window(GDK_WINDOW_HWND(ab->win->window), &windowRect); - gtk_appbar_querypos(ab, GDK_WINDOW_HWND(ab->win->window), windowRect); + get_rect_of_window(appbar_get_handle(ab), &windowRect); + gtk_appbar_querypos(ab, appbar_get_handle(ab), windowRect); if(EqualRect(&orig, &(ab->docked_rect)) == 0) - MoveWindow(GDK_WINDOW_HWND(ab->win->window), + MoveWindow(appbar_get_handle(ab), ab->docked_rect.left, ab->docked_rect.top, ab->docked_rect.right - ab->docked_rect.left, ab->docked_rect.bottom - ab->docked_rect.top, TRUE); - gtk_appbar_setpos(ab, GDK_WINDOW_HWND(ab->win->window)); + gtk_appbar_setpos(ab, appbar_get_handle(ab)); ab->docked = TRUE; } @@ -623,7 +629,7 @@ void gtk_appbar_dock(GtkAppBar *ab, UINT side) { g_return_if_fail(ab != NULL); - hwnd = GDK_WINDOW_HWND(ab->win->window); + hwnd = appbar_get_handle(ab); g_return_if_fail(IsWindow(hwnd)); @@ -654,10 +660,10 @@ GtkAppBar *gtk_appbar_add(GtkWidget *win) { ab->win = win; /* init docking coords */ - get_window_normal_rc(GDK_WINDOW_HWND(win->window), &(ab->docked_rect)); + get_window_normal_rc(appbar_get_handle(ab), &(ab->docked_rect)); /* Add main window filter */ - gdk_window_add_filter(win->window, + gdk_window_add_filter(gtk_widget_get_window(win), gtk_appbar_event_filter, ab); return ab; @@ -670,8 +676,8 @@ void gtk_appbar_remove(GtkAppBar *ab) { if(!ab) return; - hwnd = GDK_WINDOW_HWND(ab->win->window); - gdk_window_remove_filter(ab->win->window, + hwnd = appbar_get_handle(ab); + gdk_window_remove_filter(gtk_widget_get_window(ab->win), gtk_appbar_event_filter, ab); if(ab->docked) { diff --git a/pidgin/plugins/win32/winprefs/winprefs.c b/pidgin/plugins/win32/winprefs/winprefs.c index 688ed99446..6493b85005 100644 --- a/pidgin/plugins/win32/winprefs/winprefs.c +++ b/pidgin/plugins/win32/winprefs/winprefs.c @@ -165,7 +165,7 @@ static void blist_create_cb(PurpleBuddyList *purple_blist, void *data) { blist_set_dockable(TRUE); if(purple_prefs_get_bool(PREF_DBLIST_DOCKED)) { blist_ab->undocked_height = purple_prefs_get_int(PREF_DBLIST_HEIGHT); - if(!(gdk_window_get_state(blist->window) + if(!(gdk_window_get_state(gtk_widget_get_window(blist)) & GDK_WINDOW_STATE_WITHDRAWN)) { gtk_appbar_dock(blist_ab, purple_prefs_get_int(PREF_DBLIST_SIDE)); @@ -190,7 +190,7 @@ winprefs_set_autostart(GtkWidget *w) { char *runval = NULL; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) - runval = g_strdup_printf("\"%s" G_DIR_SEPARATOR_S "pidgin.exe\"", wpurple_install_dir()); + runval = g_strdup_printf("\"%s" G_DIR_SEPARATOR_S "pidgin.exe\"", wpurple_bin_dir()); if(!wpurple_write_reg_string(HKEY_CURRENT_USER, RUNKEY, "Pidgin", runval) /* For Win98 */ diff --git a/pidgin/themes/Template.html b/pidgin/themes/Template.html index 7c25e56722..1c436fc4fa 100644 --- a/pidgin/themes/Template.html +++ b/pidgin/themes/Template.html @@ -214,12 +214,78 @@ } } + var SCROLLMODE_UNKNOWN = 0; + var SCROLLMODE_WEBKIT1 = 1; + var SCROLLMODE_WEBKIT2 = 2; + var scroll_mode = SCROLLMODE_UNKNOWN; + + function detectWebkitScrolling() { + if (scroll_mode != SCROLLMODE_UNKNOWN) + return scroll_mode; + if (document.body.scrollTop > 0) + scroll_mode = SCROLLMODE_WEBKIT1; + if (document.documentElement.scrollTop > 0) + scroll_mode = SCROLLMODE_WEBKIT2; + return scroll_mode; + } + + var stickyscroll_just_scrolled = false; + var stickyscroll_just_scrolled_more = false; + var stickyscroll_to_bottom = true; + var stickyscroll_to_bottom_new = true; + + function windowDidScroll(ev) { + if (stickyscroll_just_scrolled) { + stickyscroll_just_scrolled_more = true; + return; + } + + stickyscroll_just_scrolled = true; + var update_to_bottom = function() { + stickyscroll_to_bottom = stickyscroll_to_bottom_new; + + var mode = detectWebkitScrolling(); + if (mode == SCROLLMODE_UNKNOWN || mode == SCROLLMODE_WEBKIT1) { + stickyscroll_to_bottom_new = ( document.body.scrollTop >= + ( document.body.offsetHeight - (window.innerHeight + 20) ) ); + } else { /* SCROLLMODE_WEBKIT2 */ + stickyscroll_to_bottom_new = ( document.documentElement.scrollTop >= + ( document.documentElement.offsetHeight - (window.innerHeight + 20) ) ); + } + + if (stickyscroll_just_scrolled_more) { + stickyscroll_just_scrolled_more = false; + setTimeout(update_to_bottom, 10); + } else { + stickyscroll_just_scrolled = false; + } + }; + setTimeout(update_to_bottom, 10); + } + //Auto-scroll to bottom. Use nearBottom to determine if a scrollToBottom is desired. function nearBottom() { - return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) ); + return stickyscroll_to_bottom; } function scrollToBottom() { - document.body.scrollTop = document.body.offsetHeight; + var mode = detectWebkitScrolling(); + + var scrollfunc; + if (mode == SCROLLMODE_UNKNOWN || mode == SCROLLMODE_WEBKIT1) { + scrollfunc = function() { + document.body.scrollTop = document.body.offsetHeight; + }; + } else { /* SCROLLMODE_WEBKIT2 */ + scrollfunc = function() { + document.documentElement.scrollTop = + document.documentElement.offsetHeight; + window.scrollTo(0, document.body.scrollHeight); + }; + } + + scrollfunc(); + /* wait for content to load and scroll again */ + setTimeout(scrollfunc, 10); } //Dynamically exchange the active stylesheet @@ -242,8 +308,6 @@ return; scrollToBottom(); - /* wait for images to load and scroll again */ - setTimeout(scrollToBottom, 10); } function remoteImageIsReady(id) { @@ -272,13 +336,15 @@ } window.onresize = function windowDidResize(){ - alignChat(true/*nearBottom()*/); //nearBottom buggy with inactive tabs + alignChat(nearBottom()); } function initStyle() { alignChat(true); if(!coalescedHTML) coalescedHTML = new CoalescedHTML(); + + window.addEventListener('scroll', windowDidScroll); } </script> diff --git a/pidgin/win32/gtkdocklet-win32.c b/pidgin/win32/gtkdocklet-win32.c index 1f277a2a85..63916a427f 100644 --- a/pidgin/win32/gtkdocklet-win32.c +++ b/pidgin/win32/gtkdocklet-win32.c @@ -21,7 +21,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02111-1301, USA. */ -#define _WIN32_IE 0x0500 + +#include <config.h> + #include <windows.h> #include <gdk/gdkwin32.h> #include <gdk/gdk.h> diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c index a2503bc7df..3c3372933c 100644 --- a/pidgin/win32/gtkwin32dep.c +++ b/pidgin/win32/gtkwin32dep.c @@ -21,17 +21,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ -#define _WIN32_IE 0x500 -#ifndef WINVER -#define WINVER 0x0500 /* W2K */ -#endif - #include "internal.h" #include <io.h> #include <stdlib.h> #include <stdio.h> #include <winuser.h> +#include <shellapi.h> #include <glib.h> #include <glib/gstdio.h> @@ -400,7 +396,7 @@ void winpidgin_init(void) { if (purple_debug_is_verbose()) purple_debug_misc("winpidgin", "winpidgin_init start\n"); - exchndl_dll_path = g_build_filename(wpurple_install_dir(), "exchndl.dll", NULL); + exchndl_dll_path = g_build_filename(wpurple_bin_dir(), "exchndl.dll", NULL); MySetLogFile = (LPFNSETLOGFILE) wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile"); g_free(exchndl_dll_path); exchndl_dll_path = NULL; diff --git a/pidgin/win32/gtkwin32dep.h b/pidgin/win32/gtkwin32dep.h index 682c0a6b28..cfc7027d79 100644 --- a/pidgin/win32/gtkwin32dep.h +++ b/pidgin/win32/gtkwin32dep.h @@ -22,6 +22,9 @@ */ #ifndef _GTKWIN32DEP_H_ #define _GTKWIN32DEP_H_ + +#include <config.h> + #include <windows.h> #include <gtk/gtk.h> #include "conversation.h" diff --git a/pidgin/win32/pidgin_dll_rc.rc.in b/pidgin/win32/pidgin_dll_rc.rc.in index 9fd203e553..5b0bc6bae2 100644 --- a/pidgin/win32/pidgin_dll_rc.rc.in +++ b/pidgin/win32/pidgin_dll_rc.rc.in @@ -1,10 +1,9 @@ #include <winver.h> -#include "version.h" #include "resource.h" VS_VERSION_INFO VERSIONINFO - FILEVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 - PRODUCTVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 + FILEVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + PRODUCTVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -20,7 +19,7 @@ VS_VERSION_INFO VERSIONINFO VALUE "FileVersion", "@PURPLE_VERSION@" VALUE "InternalName", "libpidgin" VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." - VALUE "OriginalFilename", "pidgin.dll" + VALUE "OriginalFilename", "libpidgin-@PURPLE_API_VERSION@.dll" VALUE "ProductName", "Pidgin" VALUE "ProductVersion", "@PURPLE_VERSION@" END diff --git a/pidgin/win32/pidgin_exe_rc.rc.in b/pidgin/win32/pidgin_exe_rc.rc.in index cfa34d15d4..d357496c72 100644 --- a/pidgin/win32/pidgin_exe_rc.rc.in +++ b/pidgin/win32/pidgin_exe_rc.rc.in @@ -1,10 +1,9 @@ #include <winver.h> #include "resource.h" -#include "version.h" VS_VERSION_INFO VERSIONINFO - FILEVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 - PRODUCTVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0 + FILEVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 + PRODUCTVERSION @PURPLE_MAJOR_VERSION@,@PURPLE_MINOR_VERSION@,@PURPLE_MICRO_VERSION@,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -16,7 +15,7 @@ VS_VERSION_INFO VERSIONINFO BLOCK "040904B0" BEGIN VALUE "CompanyName", "The Pidgin developer community" - VALUE "FileDescription", "Pidgin" + VALUE "FileDescription", "Pidgin instant messenger" VALUE "FileVersion", "@PURPLE_VERSION@" VALUE "InternalName", "pidgin" VALUE "LegalCopyright", "Copyright (C) 1998-2014 The Pidgin developer community (See the COPYRIGHT file in the source distribution)." diff --git a/pidgin/win32/winpidgin.c b/pidgin/win32/winpidgin.c index f0c23d0669..71d6632ac5 100644 --- a/pidgin/win32/winpidgin.c +++ b/pidgin/win32/winpidgin.c @@ -28,6 +28,7 @@ #include "config.h" #include <windows.h> +#include <shellapi.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> @@ -156,6 +157,7 @@ static void common_dll_prep(const wchar_t *path) { * MAX_PATH + 1 */ wchar_t set_path[MAX_PATH + 24]; + wchar_t *fslash, *bslash; if (!check_for_gtk(path)) { const wchar_t *winpath = _wgetenv(L"PATH"); @@ -193,7 +195,12 @@ static void common_dll_prep(const wchar_t *path) { wcsncpy(tmp_path, path, MAX_PATH); tmp_path[MAX_PATH] = L'\0'; - wcsrchr(tmp_path, L'\\')[0] = L'\0'; + bslash = wcsrchr(tmp_path, L'\\'); + fslash = wcsrchr(tmp_path, L'/'); + if (bslash && bslash > fslash) + bslash[0] = L'\0'; + else if (fslash && fslash > bslash) + fslash[0] = L'\0'; /* tmp_path now contains \path\to\Pidgin\Gtk */ _snwprintf(set_path, sizeof(set_path) / sizeof(wchar_t), @@ -280,6 +287,7 @@ static void common_dll_prep(const wchar_t *path) { } } +#ifndef IS_WIN32_CROSS_COMPILED static void dll_prep(const wchar_t *pidgin_dir) { wchar_t path[MAX_PATH + 1]; path[0] = L'\0'; @@ -291,6 +299,7 @@ static void dll_prep(const wchar_t *pidgin_dir) { common_dll_prep(path); } +#endif static void portable_mode_dll_prep(const wchar_t *pidgin_dir) { /* need to be able to fit MAX_PATH + "PURPLEHOME=" in path2 */ @@ -865,8 +874,10 @@ WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, if (portable_mode) portable_mode_dll_prep(pidgin_dir); +#ifndef IS_WIN32_CROSS_COMPILED else if (!getenv("PIDGIN_NO_DLL_CHECK")) dll_prep(pidgin_dir); +#endif winpidgin_set_locale(); diff --git a/pidgin/win32/wspell.c b/pidgin/win32/wspell.c index 4fd8d3f558..dba963f52c 100644 --- a/pidgin/win32/wspell.c +++ b/pidgin/win32/wspell.c @@ -79,7 +79,7 @@ static void load_gtkspell() { gchar *tmp, *tmp2; const char *path = g_getenv("PATH"); - tmp = g_build_filename(wpurple_install_dir(), "spellcheck", NULL); + tmp = g_build_filename(wpurple_bin_dir(), "spellcheck", NULL); tmp2 = g_strdup_printf("%s%s%s", tmp, (path ? G_SEARCHPATH_SEPARATOR_S : ""), (path ? path : "")); |