/soc/2013/ankitkv/gobjectification: a5f26022c3a5: Merged default...

Ankit Vani a at nevitus.org
Fri Apr 25 07:25:51 EDT 2014


Changeset: a5f26022c3a53bff30f38a2d61e2ee0a30f706d3
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-04-22 13:18 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/a5f26022c3a5

Description:

Merged default branch

diffstat:

 configure.ac                 |   10 +++-
 finch/Makefile.am            |    5 ++
 finch/finch.c                |    2 +
 finch/gntblist.h             |    1 +
 finch/gntdebug.c             |    2 +-
 finch/gntidle.c              |    1 +
 finch/gntpounce.c            |    4 +
 finch/gntsound.c             |    4 +-
 finch/libfinch.c             |    2 +-
 finch/libgnt/gnt.h           |   14 +++++
 finch/libgnt/gntbindable.h   |    1 -
 finch/libgnt/gntcolors.c     |    4 -
 finch/libgnt/gntinternal.h   |    4 +-
 finch/libgnt/gntkeys.h       |   67 +++++++++++++++++++++++++--
 finch/libgnt/gntmain.c       |  103 +++++++++++++++++++++++++++++++++++++++++-
 finch/libgnt/gntwidget.c     |    1 -
 finch/libgnt/gntwidget.h     |    1 -
 finch/plugins/gntclipboard.c |    1 +
 pidgin/plugins/cap/cap.c     |    2 +-
 19 files changed, 206 insertions(+), 23 deletions(-)

diffs (truncated from 552 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -816,10 +816,18 @@ if test "x$enable_consoleui" = "xyes"; t
 	AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"],
 	    [enable_consoleui=no], [$GNT_LIBS])
 
+	if test "x$is_win32" = "xyes" ; then
+		ncurses_sys_prefix="/usr/$host/sys-root/$host"
+	else
+		ncurses_sys_prefix="/usr"
+	fi
+
+	ncurses_sys_dirs="$ncurses_sys_prefix/include/ncursesw $ncurses_sys_prefix/include"
+
 	if test "x$enable_consoleui" = "xyes"; then
 		dnl # Some distros put the headers in ncursesw/, some don't
 		found_ncurses_h=no
-		for location in $ac_ncurses_includes $NCURSES_HEADERS /usr/include/ncursesw /usr/include
+		for location in $ac_ncurses_includes $NCURSES_HEADERS $ncurses_sys_dirs
 		do
 			f="$location/ncurses.h"
 			orig_CFLAGS="$CFLAGS"
diff --git a/finch/Makefile.am b/finch/Makefile.am
--- a/finch/Makefile.am
+++ b/finch/Makefile.am
@@ -85,6 +85,11 @@ libfinch_la_LIBADD = \
 	./libgnt/libgnt.la \
 	$(top_builddir)/libpurple/libpurple.la
 
+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)
diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -28,7 +28,9 @@
 
 int main(int argc, char *argv[])
 {
+#ifndef _WIN32
 	signal(SIGPIPE, SIG_IGN);
+#endif
 
 #if !GLIB_CHECK_VERSION(2, 32, 0)
 	/* GLib threading system is automaticaly initialized since 2.32.
diff --git a/finch/gntblist.h b/finch/gntblist.h
--- a/finch/gntblist.h
+++ b/finch/gntblist.h
@@ -29,6 +29,7 @@
  */
 
 #include "buddylist.h"
+#include "gnt.h"
 #include "gnttree.h"
 
 #define FINCH_TYPE_BLIST_MANAGER (finch_blist_manager_get_type())
diff --git a/finch/gntdebug.c b/finch/gntdebug.c
--- a/finch/gntdebug.c
+++ b/finch/gntdebug.c
@@ -72,7 +72,7 @@ handle_fprintf_stderr(gboolean stop)
 		}
 		return;
 	}
-	if (pipe(pipes)) {
+	if (purple_input_pipe(pipes)) {
 		readhandle = -1;
 		return;
 	};
diff --git a/finch/gntidle.c b/finch/gntidle.c
--- a/finch/gntidle.c
+++ b/finch/gntidle.c
@@ -25,6 +25,7 @@
 
 #include "finch.h"
 #include "gntidle.h"
+#include "gnt.h"
 #include "gntwm.h"
 
 #include "idle.h"
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -882,6 +882,9 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 	if (purple_pounce_action_is_enabled(pounce, "execute-command"))
 	{
+#ifdef _WIN32
+		purple_debug_error("gntpounce", "execute-command is not supported on this OS");
+#else
 		const char *command;
 
 		command = purple_pounce_action_get_attribute(pounce,
@@ -911,6 +914,7 @@ pounce_cb(PurplePounce *pounce, PurplePo
 				g_free(localecmd);
 			}
 		}
+#endif
 	}
 
 	if (purple_pounce_action_is_enabled(pounce, "play-beep"))
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -423,7 +423,7 @@ finch_sound_uninit(void)
 	purple_signals_disconnect_by_handle(finch_sound_get_handle());
 }
 
-#ifdef USE_GSTREAMER
+#if defined(USE_GSTREAMER) && !defined(_WIN32)
 static gboolean
 bus_call (GstBus *bus, GstMessage *msg, gpointer data)
 {
@@ -456,7 +456,7 @@ static void
 finch_sound_play_file(const char *filename)
 {
 	const char *method;
-#ifdef USE_GSTREAMER
+#if defined(USE_GSTREAMER) && !defined(_WIN32)
 	float volume;
 	char *uri;
 	GstElement *sink = NULL;
diff --git a/finch/libfinch.c b/finch/libfinch.c
--- a/finch/libfinch.c
+++ b/finch/libfinch.c
@@ -174,7 +174,7 @@ static gboolean purple_gnt_io_invoke(GIO
 
 #ifdef _WIN32
 	if(! purple_cond) {
-#if DEBUG
+#if 0
 		purple_debug_misc("gnt_eventloop",
 			   "CLOSURE received GIOCondition of 0x%x, which does not"
 			   " match 0x%x (READ) or 0x%x (WRITE)\n",
diff --git a/finch/libgnt/gnt.h b/finch/libgnt/gnt.h
--- a/finch/libgnt/gnt.h
+++ b/finch/libgnt/gnt.h
@@ -30,6 +30,20 @@
  */
 
 #include <glib.h>
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+#ifdef _WIN32
+#  undef KEY_EVENT
+#endif
+#ifdef NO_WIDECHAR
+#  define NCURSES_WIDECHAR 0
+#else
+#  define NCURSES_WIDECHAR 1
+#endif
+#include <ncurses.h>
+
 #include "gntwidget.h"
 #include "gntclipboard.h"
 #include "gntcolors.h"
diff --git a/finch/libgnt/gntbindable.h b/finch/libgnt/gntbindable.h
--- a/finch/libgnt/gntbindable.h
+++ b/finch/libgnt/gntbindable.h
@@ -32,7 +32,6 @@
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
-#include <ncurses.h>
 
 #define GNT_TYPE_BINDABLE				(gnt_bindable_get_type())
 #define GNT_BINDABLE(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
diff --git a/finch/libgnt/gntcolors.c b/finch/libgnt/gntcolors.c
--- a/finch/libgnt/gntcolors.c
+++ b/finch/libgnt/gntcolors.c
@@ -20,10 +20,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 
-#include "config.h"
-
-#include <ncurses.h>
-
 #include "gntinternal.h"
 #undef GNT_LOG_DOMAIN
 #define GNT_LOG_DOMAIN "Colors"
diff --git a/finch/libgnt/gntinternal.h b/finch/libgnt/gntinternal.h
--- a/finch/libgnt/gntinternal.h
+++ b/finch/libgnt/gntinternal.h
@@ -19,7 +19,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#include <glib.h>
+
+#include "gnt.h"
+
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "Gnt"
 
diff --git a/finch/libgnt/gntkeys.h b/finch/libgnt/gntkeys.h
--- a/finch/libgnt/gntkeys.h
+++ b/finch/libgnt/gntkeys.h
@@ -29,7 +29,6 @@
  * @title: Keys API
  */
 
-#include <curses.h>
 #include <term.h>
 
 /*
@@ -44,6 +43,54 @@ extern char *gnt_key_cright;
 
 #define SAFE(x)   ((cur_term && (x)) ? (x) : "")
 
+/* This is needed so that g-ir-scanner does not take GNT_KEY_CTRL_* as
+   constants -- because if it does, the .gir contains the following invalid XML
+   characters, and parsing explodes */
+#define CONST(x) x
+
+#ifdef _WIN32
+
+/* XXX: \xe1 is a hacky alias for \x00 key code */
+
+#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_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_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_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")
+
+#else
+
 #define GNT_KEY_POPUP   SAFE(key_f16)   /* Apparently */
 
 /* Arrow keys */
@@ -69,10 +116,20 @@ extern char *gnt_key_cright;
 #define GNT_KEY_INS    SAFE(key_ic)
 #define GNT_KEY_BACK_TAB ((cur_term && back_tab) ? back_tab : SAFE(key_btab))
 
-/* This is needed so that g-ir-scanner does not take GNT_KEY_CTRL_* as
-   constants -- because if it does, the .gir contains the following invalid XML
-   characters, and parsing explodes */
-#define CONST(x) x
+#define GNT_KEY_F1         SAFE(key_f1)
+#define GNT_KEY_F2         SAFE(key_f2)
+#define GNT_KEY_F3         SAFE(key_f3)
+#define GNT_KEY_F4         SAFE(key_f4)
+#define GNT_KEY_F5         SAFE(key_f5)
+#define GNT_KEY_F6         SAFE(key_f6)
+#define GNT_KEY_F7         SAFE(key_f7)
+#define GNT_KEY_F8         SAFE(key_f8)
+#define GNT_KEY_F9         SAFE(key_f9)
+#define GNT_KEY_F10        SAFE(key_f10)
+#define GNT_KEY_F11        SAFE(key_f11)
+#define GNT_KEY_F12        SAFE(key_f12)
+
+#endif
 
 #define GNT_KEY_CTRL_A     CONST("\001")
 #define GNT_KEY_CTRL_B     CONST("\002")
diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c
--- a/finch/libgnt/gntmain.c
+++ b/finch/libgnt/gntmain.c
@@ -30,7 +30,9 @@
 #include <gmodule.h>
 
 #include <sys/types.h>



More information about the Commits mailing list