From: <sa...@us...> - 2006-09-02 06:24:56
|
Revision: 17125 http://svn.sourceforge.net/gaim/?rev=17125&view=rev Author: sadrul Date: 2006-09-01 23:24:50 -0700 (Fri, 01 Sep 2006) Log Message: ----------- This should fix the problem where multi-column characters would screw up a window-title. Modified Paths: -------------- trunk/configure.ac trunk/console/libgnt/configure.ac trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntutils.c Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-09-02 05:31:10 UTC (rev 17124) +++ trunk/configure.ac 2006-09-02 06:24:50 UTC (rev 17125) @@ -820,6 +820,7 @@ fi AC_SUBST(GNT_LIBS) AM_CONDITIONAL(ENABLE_GNT, test "x$enable_gnt" = "xyes") +AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])]) dnl ####################################################################### dnl # Look for startup-notification, evolution integration, X-libraries, Modified: trunk/console/libgnt/configure.ac =================================================================== --- trunk/console/libgnt/configure.ac 2006-09-02 05:31:10 UTC (rev 17124) +++ trunk/console/libgnt/configure.ac 2006-09-02 06:24:50 UTC (rev 17125) @@ -198,6 +198,7 @@ AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h) AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h) AC_CHECK_HEADERS(termios.h) +AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])]) #AC_VAR_TIMEZONE_EXTERNALS AC_CHECK_LIB(ncursesw, initscr, , [AC_MSG_ERROR([ Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-09-02 05:31:10 UTC (rev 17124) +++ trunk/console/libgnt/gntbox.c 2006-09-02 06:24:50 UTC (rev 17125) @@ -1,4 +1,5 @@ #include "gntbox.h" +#include "gntutils.h" #include <string.h> @@ -28,26 +29,14 @@ get_title_thingies(GntBox *box, char *title, int *p, int *r) { GntWidget *widget = GNT_WIDGET(box); - int pos = g_utf8_strlen(title, -1), right; - - if (pos >= widget->priv.width - 4) - { - g_utf8_strncpy(title, title, widget->priv.width - 4); - pos = 2; - right = pos + g_utf8_strlen(title, -1); - } - else - { - /* XXX: Position of the title might be configurable */ - right = pos; - pos = (widget->priv.width - pos) / 2; - right += pos; - } - + int len; + char *end = gnt_util_onscreen_width_to_pointer(title, widget->priv.width - 4, &len); + if (p) - *p = pos; + *p = (widget->priv.width - len) / 2; if (r) - *r = right; + *r = (widget->priv.width + len) / 2; + *end = '\0'; } static void Modified: trunk/console/libgnt/gntutils.c =================================================================== --- trunk/console/libgnt/gntutils.c 2006-09-02 05:31:10 UTC (rev 17124) +++ trunk/console/libgnt/gntutils.c 2006-09-02 06:24:50 UTC (rev 17125) @@ -4,7 +4,9 @@ #include <string.h> #include <wchar.h> -#ifndef __USE_XOPEN +#include "config.h" + +#ifndef HAVE_WCWIDTH #define wcwidth(X) 1 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |