Compare commits

...

21 Commits

Author SHA1 Message Date
218ad519e9 Initial work replacing dnd's gdk drawing with cairo 2014-06-04 17:49:15 -04:00
7769de4018 xtext: Use cairo to draw everything 2014-06-04 16:17:29 -04:00
c1d9aad546 win32: Fix path in installer project 2014-06-04 14:07:43 -04:00
3cd8556c54 Use GDir instead of dirent 2014-06-04 13:56:33 -04:00
9c981cfc6b Fix warning 2014-06-04 13:47:09 -04:00
11e3ecc739 Stop hardcoding plugin extensions everywhere 2014-06-04 11:15:35 -04:00
5849a0588e Use glib to parse and launch commands for util_exec
Fixes #958
2014-06-04 10:38:23 -04:00
b8c02f71d9 win32: Use config.h instead of config-win32.h 2014-06-04 10:30:18 -04:00
806b98dfc2 Update server list
Removed any server that could not be connected to atm

Closes #666
2014-06-03 17:20:01 -04:00
518669de80 Remove random ifndef WIN32
I never found a reason for it existing, but it also never affected much anyway.
2014-06-03 10:02:19 -04:00
8538dd1a49 win32: Don't auto-generate version.txt 2014-06-03 09:43:14 -04:00
a918ec2236 Fix scrolling the chanview on Unix
Fixes #948
2014-06-03 08:39:37 -04:00
af7e6d3e20 fishlim: Fix filename in error messages 2014-06-02 18:28:35 -04:00
7c52e29e6e Handle a special character before "+OK", e.g. identify-msg + or - 2014-06-02 23:52:34 +02:00
d59acc2789 Use path to HexChat instead of XChat in the test program
Note that this affects the test program only. It doesn't affect users
of FiSHLiM. The reason for this change is that XChat doesn't seem to be
maintained any longer.
2014-06-02 23:51:58 +02:00
33b01b720c Add missing include in the test program 2014-06-02 23:51:04 +02:00
d190773d09 Fix memory leak in the test program 2014-06-02 23:49:42 +02:00
d8c80cd277 Fix undefined behaviour in left shift
This is not a problem with a usual compiler configuration, but LLVM/clang
detects it when compiled with:

-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv
2014-06-02 23:47:27 +02:00
3fb04bee85 Update translations 2014-06-02 22:18:25 +02:00
8578a9d52d Always use GModule for plugin support
Also cleans up some dead code
2014-06-02 05:38:13 -04:00
0b492d32b3 Add missing files to POTFILES.in 2014-06-01 17:19:09 -04:00
47 changed files with 17759 additions and 18084 deletions

View File

@ -185,9 +185,10 @@ fi
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0], [], [AC_MSG_ERROR(Cannot find gobject-2.0!)])
PKG_CHECK_MODULES([GIO], [gio-2.0], [], [AC_MSG_ERROR(Cannot find gio-2.0!)])
PKG_CHECK_MODULES([GMODULE], [gmodule-2.0], [], [AC_MSG_ERROR(Cannot find gmodule-2.0!)])
COMMON_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS $GOBJECT_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
COMMON_LIBS="$GLIB_LIBS $GIO_LIBS $GOBJECT_LIBS -lgmodule-2.0"
COMMON_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
COMMON_LIBS="$GLIB_LIBS $GIO_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
dnl *********************************************************************
dnl ** GTK **************************************************************
@ -206,7 +207,7 @@ if test "$gtkfe" = yes ; then
fi
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED"
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
dnl *********************************************************************
dnl ** MAC_INTEGRATION **************************************************
@ -426,29 +427,7 @@ dnl ** PLUGIN ***********************************************************
dnl *********************************************************************
if test "$plugin" = yes; then
AC_CHECK_FUNCS(dlopen, have_dl=yes)
if test "$have_dl" != yes; then
AC_CHECK_LIB(dl, dlopen, have_dl=yes)
if test "$have_dl" = yes; then
LIBS="$LIBS -ldl"
fi
fi
if test "$have_dl" = yes; then
AC_DEFINE(USE_PLUGIN)
dnl we just need the -Wl,--export-dynamic, but not -lgmodule-2.0
RDYNAMIC_FLAGS="`$PKG_CONFIG gmodule-2.0 --libs | $sedpath 's/ -lgmodule-2.0//'`"
LIBS="$LIBS $RDYNAMIC_FLAGS"
if test "$LD" = ""; then
VS="`ld --help | grep version-script 2> /dev/null`"
else
VS="`$LD --help | grep version-script 2> /dev/null`"
fi
if test "$VS" != ""; then
GUI_LIBS="$GUI_LIBS -Wl,--version-script,\$(srcdir)/../version-script"
fi
else
plugin=no
fi
AC_DEFINE(USE_PLUGIN)
fi
dnl *********************************************************************

View File

@ -136,7 +136,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) {
for (i = 0; i < 12; i++) {
d = fish_unbase64[(const unsigned char)*(data++)];
if (d == IB) goto decrypt_end;
binary[word] |= d << bit;
binary[word] |= (unsigned long)d << bit;
bit += 6;
if (i == 5) {
bit = 0;

View File

@ -40,7 +40,7 @@
static const char plugin_name[] = "FiSHLiM";
static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!";
static const char plugin_version[] = "0.0.16";
static const char plugin_version[] = "0.0.17";
static const char usage_setkey[] = "Usage: SETKEY [<nick or #channel>] <password>, sets the key for a channel or nick";
static const char usage_delkey[] = "Usage: DELKEY <nick or #channel>, deletes the key for a channel or nick";
@ -119,6 +119,7 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) {
size_t ew;
size_t uw;
size_t length;
char prefix_char = 0;
if (!irc_parse_message((const char **)word, &prefix, &command, &w))
return HEXCHAT_EAT_NONE;
@ -129,6 +130,8 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) {
// Look for encrypted data
for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) {
const char *s = (ew == w+1 ? word[ew]+1 : word[ew]);
if (*s && (s[1] == '+' || s[1] == 'm')) { prefix_char = *(s++); }
else { prefix_char = 0; }
if (strcmp(s, "+OK") == 0 || strcmp(s, "mcps") == 0) goto has_encrypted_data;
}
return HEXCHAT_EAT_NONE;
@ -163,6 +166,11 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) {
if (!append(&message, &length, ":")) goto decrypt_error;
}
if (prefix_char) {
char prefix_str[2] = { prefix_char, '\0' };
if (!append(&message, &length, prefix_str)) goto decrypt_error;
}
} else {
// Add unencrypted data (for example, a prefix from a bouncer or bot)
peice = word[uw];
@ -213,7 +221,7 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
if (keystore_store_key(nick, key)) {
hexchat_printf(ph, "Stored key for %s\n", nick);
} else {
hexchat_printf(ph, "\00305Failed to store key in blow.ini\n", nick, key);
hexchat_printf(ph, "\00305Failed to store key in addon_fishlim.conf\n", nick, key);
}
return HEXCHAT_EAT_HEXCHAT;
@ -237,7 +245,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
if (keystore_delete_nick(nick)) {
hexchat_printf(ph, "Deleted key for %s\n", nick);
} else {
hexchat_printf(ph, "\00305Failed to delete key in blow.ini!\n", nick);
hexchat_printf(ph, "\00305Failed to delete key in addon_fishlim.conf!\n", nick);
}
return HEXCHAT_EAT_HEXCHAT;

View File

@ -24,13 +24,14 @@
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fish.h"
// We can't use the HexChat plugin API from here...
gchar *get_config_filename() {
const gchar *homedir = g_get_home_dir();
return g_build_filename(homedir, ".xchat2", "blow.ini", NULL);
return g_build_filename(homedir, ".config", "hexchat", "blow.ini", NULL);
}
@ -46,6 +47,7 @@ static int decrypt(int nick_count, char *nicks[]) {
return 1;
success:
fprintf(stderr, "Decrypted text >>>%s<<<\n", msg);
free(msg);
}
return 0;
}
@ -62,6 +64,7 @@ static int encrypt(int nick_count, char *nicks[]) {
char *encrypted = fish_encrypt_for_nick(nicks[i], message);
if (encrypted) {
fprintf(stderr, "Encrypted [%s]: >>>%s<<<\n", nicks[i], encrypted);
free(encrypted);
} else {
error = true;
}

View File

@ -32,11 +32,8 @@
#endif
#undef PACKAGE
#ifdef WIN32
#include "../../config-win32.h" /* for #define OLD_PERL */
#else
#include "../../config.h"
#endif
#include "hexchat-plugin.h"
static hexchat_plugin *ph; /* plugin handle */

View File

@ -52,20 +52,19 @@
*/
#include <glib.h>
#include <glib/gstdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef WIN32
#include <direct.h>
#include <glib/gstdio.h>
#include "../../src/dirent/dirent-win32.h"
#include "../../config-win32.h"
#else
#include <unistd.h>
#include <dirent.h>
#endif
#include "../../config.h"
#include "hexchat-plugin.h"
#undef _POSIX_C_SOURCE /* Avoid warning: also in /usr/include/features.h from glib.h */
#include <Python.h>
@ -459,26 +458,31 @@ Util_BuildEOLList(char *word[])
static void
Util_Autoload_from (const char *dir_name)
{
#ifndef PATH_MAX
#define PATH_MAX 1024 /* Hurd doesn't define it */
#endif
char oldcwd[PATH_MAX];
struct dirent *ent;
DIR *dir;
if (getcwd(oldcwd, PATH_MAX) == NULL)
gchar *oldcwd;
const char *entry_name;
GDir *dir;
oldcwd = g_get_current_dir ();
if (oldcwd == NULL)
return;
if (chdir(dir_name) != 0)
if (g_chdir(dir_name) != 0)
{
g_free (oldcwd);
return;
dir = opendir(".");
if (dir == NULL)
return;
while ((ent = readdir(dir))) {
int len = strlen(ent->d_name);
if (len > 3 && strcmp(".py", ent->d_name+len-3) == 0)
Command_PyLoad(ent->d_name);
}
closedir(dir);
chdir(oldcwd);
dir = g_dir_open (".", 0, NULL);
if (dir == NULL)
{
g_free (oldcwd);
return;
}
while ((entry_name = g_dir_read_name (dir)))
{
if (g_str_has_suffix (entry_name, ".py"))
Command_PyLoad((char*)entry_name);
}
g_dir_close (dir);
g_chdir (oldcwd);
}
static void
@ -486,7 +490,7 @@ Util_Autoload()
{
const char *xdir;
char *sub_dir;
/* we need local filesystem encoding for chdir, opendir etc */
/* we need local filesystem encoding for g_chdir, g_dir_open etc */
xdir = hexchat_get_info(ph, "configdir");

View File

@ -2,9 +2,11 @@ data/misc/hexchat.appdata.xml.in
data/misc/hexchat.desktop.in
data/misc/htm.desktop.in
src/common/cfgfiles.c
src/common/chanopt.c
src/common/dcc.c
src/common/hexchat.c
src/common/ignore.c
src/common/inbound.c
src/common/notify.c
src/common/outbound.c
src/common/plugin.c
@ -37,3 +39,4 @@ src/fe-gtk/sexy-spell-entry.c
src/fe-gtk/textgui.c
src/fe-gtk/urlgrab.c
src/fe-gtk/userlistgui.c
src/fe-text/fe-text.c

3546
po/de.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3380
po/es.po

File diff suppressed because it is too large Load Diff

3380
po/fr.po

File diff suppressed because it is too large Load Diff

3379
po/it.po

File diff suppressed because it is too large Load Diff

4817
po/ko.po

File diff suppressed because it is too large Load Diff

3493
po/pl.po

File diff suppressed because it is too large Load Diff

4597
po/sq.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -77,8 +77,8 @@
<ClCompile Include="hexchat.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\config-win32.h.tt" />
<ClInclude Include="..\..\config-win32.h" />
<None Include="..\..\win32\config.h.tt" />
<ClInclude Include="..\..\config.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
@ -160,10 +160,7 @@
<PreBuildEvent>
<Command><![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
powershell -File "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\config-win32.h.tt" "$(SolutionDir)..\config-win32.h"
powershell -File "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\win32\version.txt.tt" "$(SolutionDir)..\win32\version.txt.tmp"
REM version.txt must be in UTF-8 without trailing newline
powershell "[string] $content = Get-Content '$(SolutionDir)..\win32\version.txt.tmp' -Encoding UTF8; [System.IO.File]::WriteAllText('$(SolutionDir)..\win32\version.txt', $content); Remove-Item '$(SolutionDir)..\win32\version.txt.tmp';"
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(SolutionDir)..\config.h"
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.h"
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.c"

View File

@ -104,7 +104,7 @@
<ClInclude Include="hexchat-plugin.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\config-win32.h">
<ClInclude Include="..\..\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="typedef.h">
@ -195,6 +195,6 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\config-win32.h.tt" />
<None Include="..\..\win32\config.h.tt" />
</ItemGroup>
</Project>

View File

@ -991,47 +991,12 @@ hexchat_exit (void)
fe_exit ();
}
#ifndef WIN32
static int
child_handler (gpointer userdata)
{
int pid = GPOINTER_TO_INT (userdata);
if (waitpid (pid, 0, WNOHANG) == pid)
return 0; /* remove timeout handler */
return 1; /* keep the timeout handler */
}
#endif
void
hexchat_exec (const char *cmd)
{
#ifdef WIN32
util_exec (cmd);
#else
int pid = util_exec (cmd);
if (pid != -1)
/* zombie avoiding system. Don't ask! it has to be like this to work
with zvt (which overrides the default handler) */
fe_timeout_add (1000, child_handler, GINT_TO_POINTER (pid));
#endif
}
void
hexchat_execv (char * const argv[])
{
#ifdef WIN32
util_execv (argv);
#else
int pid = util_execv (argv);
if (pid != -1)
/* zombie avoiding system. Don't ask! it has to be like this to work
with zvt (which overrides the default handler) */
fe_timeout_add (1000, child_handler, GINT_TO_POINTER (pid));
#endif
}
static void
set_locale (void)

View File

@ -17,11 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WIN32
#include "../../config-win32.h"
#else
#include "../../config.h"
#endif
#include <glib.h>
#include <glib/gstdio.h>

View File

@ -57,6 +57,5 @@ void session_free (session *killsess);
void lag_check (void);
void hexchat_exit (void);
void hexchat_exec (const char *cmd);
void hexchat_execv (char * const argv[]);
#endif

View File

@ -47,7 +47,7 @@
#else
#include "../../config-win32.h"
#include "../../config.h"
#ifdef USE_IPV6
#include <winsock2.h>
#include <ws2tcpip.h>

View File

@ -861,9 +861,7 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data)
serv->have_whox = TRUE;
} else if (strcmp (word[w], "EXCEPTS") == 0)
{
#ifndef WIN32
serv->have_except = TRUE;
#endif
} else if (strcmp (word[w], "INVEX") == 0)
{
/* supports mode letter +I, default channel invite */

View File

@ -23,12 +23,10 @@
#include <stdio.h>
#include <glib.h>
#ifdef WIN32
#include "../../config-win32.h" /* grab USE_IPV6 and LOOKUPD defines */
#else
#ifndef WIN32
#include <unistd.h>
#include "../../config.h"
#endif
#include "../../config.h"
#define WANTSOCKET
#define WANTARPA

View File

@ -1841,8 +1841,10 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
char **argv;
int argc;
my_poptParseArgvString (cmd, &argc, &argv);
g_shell_parse_argv (cmd, &argc, &argv, NULL);
execvp (argv[0], argv);
g_strfreev (argv);
}
/* not reached unless error */
/*printf("exec error\n");*/
@ -2539,7 +2541,6 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
char *file, *buf;
#ifdef USE_PLUGIN
char *error, *arg;
int len;
#endif
if (!word[2][0])
@ -2560,16 +2561,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
}
#ifdef USE_PLUGIN
len = strlen (word[2]);
#ifdef WIN32
if (len > 4 && g_ascii_strcasecmp (".dll", word[2] + len - 4) == 0)
#else
#if defined(__hpux)
if (len > 3 && g_ascii_strcasecmp (".sl", word[2] + len - 3) == 0)
#else
if (len > 3 && g_ascii_strcasecmp (".so", word[2] + len - 3) == 0)
#endif
#endif
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
{
arg = NULL;
if (word_eol[3][0])
@ -3565,18 +3557,9 @@ static int
cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
#ifdef USE_PLUGIN
int len, by_file = FALSE;
gboolean by_file = FALSE;
len = strlen (word[2]);
#ifdef WIN32
if (len > 4 && g_ascii_strcasecmp (word[2] + len - 4, ".dll") == 0)
#else
#if defined(__hpux)
if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".sl") == 0)
#else
if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".so") == 0)
#endif
#endif
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
by_file = TRUE;
switch (plugin_kill (word[2], by_file))
@ -3599,18 +3582,9 @@ static int
cmd_reload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
#ifdef USE_PLUGIN
int len, by_file = FALSE;
gboolean by_file = FALSE;
len = strlen (word[2]);
#ifdef WIN32
if (len > 4 && g_ascii_strcasecmp (word[2] + len - 4, ".dll") == 0)
#else
#if defined(__hpux)
if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".sl") == 0)
#else
if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".so") == 0)
#endif
#endif
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
by_file = TRUE;
switch (plugin_reload (sess, word[2], by_file))

View File

@ -52,11 +52,7 @@ typedef struct session hexchat_context;
/* the USE_PLUGIN define only removes libdl stuff */
#ifdef USE_PLUGIN
#ifdef USE_GMODULE
#include <gmodule.h>
#else
#include <dlfcn.h>
#endif
#endif
#define DEBUG(x) {x;}
@ -159,11 +155,7 @@ plugin_free (hexchat_plugin *pl, int do_deinit, int allow_refuse)
#ifdef USE_PLUGIN
if (pl->handle)
#ifdef USE_GMODULE
g_module_close (pl->handle);
#else
dlclose (pl->handle);
#endif
#endif
xit:
@ -378,21 +370,16 @@ plugin_load (session *sess, char *filename, char *arg)
char *filepart;
hexchat_init_func *init_func;
hexchat_deinit_func *deinit_func;
#ifndef USE_GMODULE
char *error;
#else
char *pluginpath;
#endif
/* get the filename without path */
filepart = file_part (filename);
#ifdef USE_GMODULE
/* load the plugin */
if (!g_ascii_strcasecmp (filepart, filename))
{
/* no path specified, it's just the filename, try to load from config dir */
pluginpath = g_build_filename (get_xdir (), filename, NULL);
pluginpath = g_build_filename (get_xdir (), "addons", filename, NULL);
handle = g_module_open (pluginpath, 0);
g_free (pluginpath);
}
@ -416,43 +403,6 @@ plugin_load (session *sess, char *filename, char *arg)
if (!g_module_symbol (handle, "hexchat_plugin_deinit", (gpointer *)&deinit_func))
deinit_func = NULL;
#else
/* OpenBSD lacks this! */
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
/* load the plugin */
if (filepart &&
/* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */
(strstr (filepart, "local") || strncmp (filepart, "libxsys-1", 9) == 0)
)
handle = dlopen (filename, RTLD_NOW);
else
handle = dlopen (filename, RTLD_GLOBAL | RTLD_NOW);
if (handle == NULL)
return (char *)dlerror ();
dlerror (); /* Clear any existing error */
/* find the init routine hexchat_plugin_init */
init_func = dlsym (handle, "hexchat_plugin_init");
error = (char *)dlerror ();
if (error != NULL)
{
dlclose (handle);
return _("No hexchat_plugin_init symbol; is this really a HexChat plugin?");
}
/* find the plugin's deinit routine, if any */
deinit_func = dlsym (handle, "hexchat_plugin_deinit");
error = (char *)dlerror ();
#endif
/* add it to our linked list */
plugin_add (sess, filename, handle, init_func, deinit_func, arg, FALSE);
@ -466,11 +416,6 @@ plugin_auto_load_cb (char *filename)
{
char *pMsg;
#ifndef WIN32 /* black listed */
if (!strcmp (file_part (filename), "dbus.so"))
return;
#endif
pMsg = plugin_load (ps, filename, NULL);
if (pMsg)
{
@ -515,17 +460,11 @@ plugin_auto_load (session *sess)
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
for_files (lib_dir, "hcwinamp.dll", plugin_auto_load_cb);
for_files (lib_dir, "hcsysinfo.dll", plugin_auto_load_cb);
#else
for_files (lib_dir, "*."G_MODULE_SUFFIX, plugin_auto_load_cb);
#endif
for_files (sub_dir, "*.dll", plugin_auto_load_cb);
#else
#if defined(__hpux)
for_files (lib_dir, "*.sl", plugin_auto_load_cb);
for_files (sub_dir, "*.sl", plugin_auto_load_cb);
#else
for_files (lib_dir, "*.so", plugin_auto_load_cb);
for_files (sub_dir, "*.so", plugin_auto_load_cb);
#endif
#endif
for_files (sub_dir, "*."G_MODULE_SUFFIX, plugin_auto_load_cb);
g_free (sub_dir);
}
@ -1180,7 +1119,11 @@ hexchat_get_info (hexchat_plugin *ph, const char *id)
switch (hash)
{
case 0x325acab5: /* libdirfs */
#ifdef USE_PLUGIN
return plugin_get_libdir ();
#else
return NULL;
#endif
case 0x14f51cd8: /* version */
return PACKAGE_VERSION;

View File

@ -53,8 +53,8 @@ static const struct defaultserver def[] =
{0, "irc.2600.net"},
{"2ch", 0, 0, "iso-2022-jp", 0, 0},
{0, "irc.2ch.net"},
{0, "irc2.2ch.net"},
{0, "irc.2ch.sc"},
{0, "irc.nurs.or.jp"},
{0, "irc.juggler.jp"},
{"AccessIRC", 0},
@ -76,14 +76,10 @@ static const struct defaultserver def[] =
#ifdef USE_OPENSSL
{0, "irc.data.lt/+6668"},
{0, "irc-ssl.omnitel.net/+6668"},
{0, "irc-ssl.le.lt/+9999"},
#endif
{0, "irc.data.lt"},
{0, "irc.omnitel.net"},
{0, "irc.ktu.lt"},
{0, "irc.le.lt"},
{0, "irc.takas.lt"},
{0, "irc.5ci.net"},
{0, "irc.kis.lt"},
{"AlphaChat", 0, 0, 0, LOGIN_SASL},
@ -117,15 +113,11 @@ static const struct defaultserver def[] =
{"AustNet", 0},
{0, "au.austnet.org"},
{0, "us.austnet.org"},
{0, "ca.austnet.org"},
{"AzzurraNet", 0},
{0, "irc.azzurra.org"},
{0, "crypto.azzurra.org"},
{"Beirut", 0},
{0, "irc.beirut.com"},
{"Canternet", 0, 0, 0, LOGIN_SASL},
#ifdef USE_OPENSSL
{0, "irc.canternet.org/+6697"},
@ -147,7 +139,6 @@ static const struct defaultserver def[] =
{"ChatNet", 0},
{0, "US.ChatNet.Org"},
{0, "EU.ChatNet.Org"},
{"ChatSpike", 0},
{0, "irc.chatspike.net"},
@ -164,7 +155,6 @@ static const struct defaultserver def[] =
{0, "irc.d-t-net.de"},
{0, "bw.d-t-net.de"},
{0, "nc.d-t-net.de"},
{0, "wakka.d-t-net.de"},
{"DarkMyst", 0, 0, 0, LOGIN_SASL},
{0, "irc.darkmyst.org"},
@ -180,10 +170,7 @@ static const struct defaultserver def[] =
{0, "irc.Prison.NET"},
{0, "irc.Qeast.net"},
{0, "irc.efnet.pl"},
{0, "efnet.demon.co.uk"},
{0, "irc.lightning.net"},
{0, "irc.mindspring.com"},
{0, "irc.easynews.com"},
{0, "irc.servercentral.net"},
{"ElectroCode", 0},
@ -221,7 +208,6 @@ static const struct defaultserver def[] =
{0, "irc.ffm.de.euirc.net"},
{0, "irc.bre.de.euirc.net"},
{0, "irc.hes.de.euirc.net"},
{0, "irc.vie.at.euirc.net"},
{0, "irc.inn.at.euirc.net"},
{0, "irc.bas.ch.euirc.net"},
@ -234,8 +220,6 @@ static const struct defaultserver def[] =
{"FEFNet", 0, 0, 0, LOGIN_SASL},
{0, "irc.fef.net"},
{0, "irc.ggn.net"},
{0, "irc.vendetta.com"},
{"freenode", 0, 0, 0, LOGIN_SASL},
#ifdef USE_OPENSSL
@ -251,9 +235,6 @@ static const struct defaultserver def[] =
#endif
{0, "irc.furnet.org"},
{"Fusion Latina", 0},
{0, "irc.fusionlatina.org/2012"},
{"GalaxyNet", 0},
{0, "irc.galaxynet.org"},
@ -270,7 +251,6 @@ static const struct defaultserver def[] =
{"GIMPNet", 0},
{0, "irc.gimp.org"},
{0, "irc.gnome.org"},
{0, "irc.us.gimp.org"},
{"Hashmark", 0},
{0, "irc.hashmark.net"},
@ -343,14 +323,6 @@ static const struct defaultserver def[] =
{"Moznet", 0},
{0, "irc.mozilla.org"},
{"NeverNET", 0},
{0, "irc.nevernet.net"},
{0, "imagine.nevernet.net"},
{0, "dimension.nevernet.net"},
{0, "universe.nevernet.net"},
{0, "wayland.nevernet.net"},
{0, "forte.nevernet.net"},
{"ObsidianIRC", 0},
{0, "irc.obsidianirc.net"},
@ -394,7 +366,6 @@ static const struct defaultserver def[] =
{0, "irc.fi.quakenet.org"},
{0, "irc.be.quakenet.org"},
{0, "irc.uk.quakenet.org"},
{0, "irc.de.quakenet.org"},
{0, "irc.it.quakenet.org"},
{"Rizon", 0},
@ -402,7 +373,6 @@ static const struct defaultserver def[] =
{"RusNet", 0, 0, "KOI8-R (Cyrillic)"},
{0, "irc.tomsk.net"},
{0, "irc.rinet.ru"},
{0, "irc.run.net"},
{0, "irc.ru"},
{0, "irc.lucky.net"},
@ -510,25 +480,17 @@ static const struct defaultserver def[] =
{"UnderNet", 0, 0, 0, LOGIN_CUSTOM, "MSG x@channels.undernet.org login %u %p"},
{0, "us.undernet.org"},
{0, "eu.undernet.org"},
{"UniBG", 0, 0, 0, LOGIN_CUSTOM, "MSG NS IDENTIFY %p"},
{0, "irc.lirex.com"},
{0, "irc.naturella.com"},
{0, "irc.spnet.net"},
{0, "irc.techno-link.com"},
{0, "irc.telecoms.bg"},
{0, "irc.tu-varna.edu"},
{"ValleyNode", 0, 0, 0, LOGIN_SASL},
{0, "irc.valleynode.net"},
{"Whiffle", 0},
{0, "irc.whiffle.org"},
{"Worldnet", 0},
{0, "irc.worldnet.net"},
{0, "irc.fr.worldnet.net"},
{"Windfyre", 0},
#ifdef USE_OPENSSL

View File

@ -27,10 +27,8 @@
#include <openssl/err.h> /* ERR_() */
#ifdef WIN32
#include <openssl/rand.h> /* RAND_seed() */
#include "../../config-win32.h" /* HAVE_SNPRINTF */
#else
#include "../../config.h"
#endif
#include "../../config.h"
#include <time.h> /* asctime() */
#include <string.h> /* strncpy() */
#include "ssl.h" /* struct cert_info */

View File

@ -34,17 +34,14 @@
#include <process.h>
#include <io.h>
#include <VersionHelpers.h>
#include "../dirent/dirent-win32.h"
#include "../../config-win32.h"
#else
#include <unistd.h>
#include <pwd.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <dirent.h>
#include "../../config.h"
#endif
#include "../../config.h"
#include <fcntl.h>
#include <errno.h>
#include "hexchat.h"
@ -935,27 +932,26 @@ break_while:
void
for_files (char *dirname, char *mask, void callback (char *file))
{
DIR *dir;
struct dirent *ent;
GDir *dir;
const gchar *entry_name;
char *buf;
dir = opendir (dirname);
dir = g_dir_open (dirname, 0, NULL);
if (dir)
{
while ((ent = readdir (dir)))
while ((entry_name = g_dir_read_name (dir)))
{
if (strcmp (ent->d_name, ".") && strcmp (ent->d_name, ".."))
if (strcmp (entry_name, ".") && strcmp (entry_name, ".."))
{
if (match (mask, ent->d_name))
if (match (mask, entry_name))
{
buf = malloc (strlen (dirname) + strlen (ent->d_name) + 2);
sprintf (buf, "%s" G_DIR_SEPARATOR_S "%s", dirname, ent->d_name);
buf = g_build_filename (dirname, entry_name, NULL);
callback (buf);
free (buf);
g_free (buf);
}
}
}
closedir (dir);
g_dir_close (dir);
}
}
@ -1299,171 +1295,10 @@ country_search (char *pattern, void *ud, void (*print)(void *, char *, ...))
}
}
/* I think gnome1.0.x isn't necessarily linked against popt, ah well! */
/* !!! For now use this inlined function, or it would break fe-text building */
/* .... will find a better solution later. */
/*#ifndef USE_GNOME*/
/* this is taken from gnome-libs 1.2.4 */
#define POPT_ARGV_ARRAY_GROW_DELTA 5
int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
char * buf, * bufStart, * dst;
const char * src;
char quote = '\0';
int argvAlloced = POPT_ARGV_ARRAY_GROW_DELTA;
char ** argv = malloc(sizeof(*argv) * argvAlloced);
const char ** argv2;
int argc = 0;
int i, buflen;
buflen = strlen(s) + 1;
/* bufStart = buf = alloca(buflen);*/
bufStart = buf = malloc (buflen);
memset(buf, '\0', buflen);
src = s;
argv[argc] = buf;
while (*src) {
if (quote == *src) {
quote = '\0';
} else if (quote) {
if (*src == '\\') {
src++;
if (!*src) {
free(argv);
free(bufStart);
return 1;
}
if (*src != quote) *buf++ = '\\';
}
*buf++ = *src;
/*} else if (isspace((unsigned char) *src)) {*/
} else if (*src == ' ') {
if (*argv[argc]) {
buf++, argc++;
if (argc == argvAlloced) {
char **temp;
argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA;
temp = realloc(argv, sizeof(*argv) * argvAlloced);
if (temp)
argv = temp;
else
{
free(argv);
free(bufStart);
return 1;
}
}
argv[argc] = buf;
}
} else switch (*src) {
case '"':
case '\'':
quote = *src;
break;
case '\\':
src++;
if (!*src) {
free(argv);
free(bufStart);
return 1;
}
/* fallthrough */
default:
*buf++ = *src;
}
src++;
}
if (strlen(argv[argc])) {
argc++, buf++;
}
dst = malloc((argc + 1) * sizeof(*argv) + (buf - bufStart));
argv2 = (void *) dst;
dst += (argc + 1) * sizeof(*argv);
memcpy((void *)argv2, argv, argc * sizeof(*argv));
argv2[argc] = NULL;
memcpy(dst, bufStart, buf - bufStart);
for (i = 0; i < argc; i++) {
argv2[i] = dst + (argv[i] - bufStart);
}
free(argv);
*argvPtr = (char **)argv2; /* XXX don't change the API */
*argcPtr = argc;
free (bufStart);
return 0;
}
int
void
util_exec (const char *cmd)
{
char **argv;
int argc;
#ifndef WIN32
int pid;
int fd;
#endif
if (my_poptParseArgvString (cmd, &argc, &argv) != 0)
return -1;
#ifndef WIN32
pid = fork ();
if (pid == -1)
{
free (argv);
return -1;
}
if (pid == 0)
{
/* Now close all open file descriptors except stdin, stdout and stderr */
for (fd = 3; fd < 1024; fd++) close(fd);
execvp (argv[0], argv);
_exit (0);
} else
{
free (argv);
return pid;
}
#else
spawnvp (_P_DETACH, argv[0], argv);
free (argv);
return 0;
#endif
}
int
util_execv (char * const argv[])
{
#ifndef WIN32
int pid, fd;
pid = fork ();
if (pid == -1)
return -1;
if (pid == 0)
{
/* Now close all open file descriptors except stdin, stdout and stderr */
for (fd = 3; fd < 1024; fd++) close(fd);
execv (argv[0], argv);
_exit (0);
} else
{
return pid;
}
#else
spawnv (_P_DETACH, argv[0], argv);
return 0;
#endif
g_spawn_command_line_async (cmd, NULL);
}
unsigned long

View File

@ -37,7 +37,6 @@
extern const unsigned char rfc_tolowertab[];
int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr);
char *expand_homedir (char *file);
void path_part (char *file, char *path, int pathlen);
int match (const char *mask, const char *string);
@ -50,8 +49,7 @@ char *nocasestrstr (const char *text, const char *tofind);
char *country (char *);
void country_search (char *pattern, void *ud, void (*print)(void *, char *, ...));
char *get_sys_str (int with_cpu);
int util_exec (const char *cmd);
int util_execv (char * const argv[]);
void util_exec (const char *cmd);
#define STRIP_COLOR 1
#define STRIP_ATTRIB 2
#define STRIP_HIDDEN 4

View File

@ -73,8 +73,8 @@ cv_tree_click_cb (GtkTreeView *tree, GdkEventButton *event, chanview *cv)
return ret;
}
static void
cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event)
static gboolean
cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
{
if (prefs.hex_gui_tab_scrollchans)
{
@ -82,7 +82,11 @@ cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event)
mg_switch_page (1, 1);
else if (event->direction == GDK_SCROLL_UP)
mg_switch_page (1, -1);
return TRUE;
}
return FALSE;
}
static void

View File

@ -57,7 +57,7 @@
#include <canberra.h>
#endif
GdkPixmap *channelwin_pix;
GdkPixbuf *channelwin_pix;
#ifdef USE_LIBCANBERRA
static ca_context *ca_con;
@ -296,7 +296,7 @@ fe_init (void)
#ifdef HAVE_GTK_MAC
gtkosx_application_set_dock_icon_pixbuf (osx_app, pix_hexchat);
#endif
channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
channelwin_pix = gdk_pixbuf_new_from_file (prefs.hex_text_background, NULL);
input_style = create_input_style (gtk_style_new ());
}

View File

@ -20,11 +20,7 @@
#ifndef HEXCHAT_FE_GTK_H
#define HEXCHAT_FE_GTK_H
#ifdef WIN32
#include "../../config-win32.h"
#else
#include "../../config.h"
#endif
#define DISPLAY_NAME "HexChat"
@ -197,7 +193,7 @@ typedef struct session_gui
} session_gui;
extern GdkPixmap *channelwin_pix;
extern GdkPixbuf *channelwin_pix;
extern GdkPixmap *dialogwin_pix;
#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e))))

View File

@ -99,7 +99,7 @@
<PreBuildEvent>
<Command><![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
powershell -File "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8"
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8"
REM hexchat.rc needs to be in UCS-2 or Resource Compiler will complain
powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8' | Out-File '$(SolutionDir)..\src\fe-gtk\hexchat.rc'; Remove-Item '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8'"
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir "$(DataDir)" --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"

View File

@ -1,5 +1,5 @@
#include <winver.h>
#include "../../config-win32.h"
#include "../../config.h"
#define COMMA_VERSION <#= [string]::Join(',', $versionParts) #>,0

View File

@ -3842,18 +3842,17 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
gboolean
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
{
GdkGC *gc;
GdkColor col;
GdkGCValues val;
cairo_t *cr;
int half, width, height;
int ox, oy;
GdkDrawable *draw;
GtkAllocation allocation;
/* ignore file drops */
if (!mg_is_gui_target (context))
return FALSE;
gtk_widget_set_app_paintable (widget, TRUE);
if (scbar) /* scrollbar */
{
gtk_widget_get_allocation (widget, &allocation);
@ -3861,55 +3860,28 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
oy = allocation.y;
width = allocation.width;
height = allocation.height;
draw = gtk_widget_get_window (widget);
}
else
{
ox = oy = 0;
width = gdk_window_get_width (gtk_widget_get_window (widget));
height = gdk_window_get_height (gtk_widget_get_window (widget));
draw = gtk_widget_get_window (widget);
}
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
val.graphics_exposures = 0;
val.function = GDK_XOR;
gc = gdk_gc_new_with_values (gtk_widget_get_window (widget), &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION);
col.red = rand() % 0xffff;
col.green = rand() % 0xffff;
col.blue = rand() % 0xffff;
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), &col, FALSE, TRUE);
gdk_gc_set_foreground (gc, &col);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
cairo_set_source_rgb (cr, 0, 0, 1.0);
cairo_set_line_width (cr, 0.1);
half = height / 2;
#if 0
/* are both tree/userlist on the same side? */
paned = (GtkPaned *)widget->parent->parent;
if (paned->child1 != NULL && paned->child2 != NULL)
{
gdk_draw_rectangle (draw, gc, 0, 1, 2, width - 3, height - 4);
gdk_draw_rectangle (draw, gc, 0, 0, 1, width - 1, height - 2);
g_object_unref (gc);
return TRUE;
}
#endif
if (y < half)
{
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, 2 + oy, width - 3, half - 4);
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, 1 + oy, width - 1, half - 2);
gtk_widget_queue_draw_area (widget, ox, half + oy, width, height - half);
}
cairo_rectangle (cr, ox, oy, width, half);
else
{
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, half + 1 + oy, width - 1, half - 2);
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, half + 2 + oy, width - 3, half - 4);
gtk_widget_queue_draw_area (widget, ox, oy, width, half);
}
cairo_rectangle (cr, ox, half + oy, width, half);
g_object_unref (gc);
cairo_stroke (cr);
cairo_destroy (cr);
gtk_widget_queue_draw_area (widget, ox, oy, width, height);
return TRUE;
}

View File

@ -403,8 +403,10 @@ toggle_cb (GtkWidget *item, char *pref_name)
static int
is_in_path (char *cmd)
{
char *prog = strdup (cmd + 1); /* 1st char is "!" */
char *space, *path, *orig;
char *prog = g_strdup (cmd + 1); /* 1st char is "!" */
char *path, *orig;
char **argv;
int argc;
orig = prog; /* save for free()ing */
/* special-case these default entries. */
@ -413,16 +415,17 @@ is_in_path (char *cmd)
/* don't check for gnome-terminal, but the thing it's executing! */
prog += 18;
space = strchr (prog, ' '); /* this isn't 100% but good enuf */
if (space)
*space = 0;
path = g_find_program_in_path (prog);
if (path)
if (g_shell_parse_argv (prog, &argc, &argv, NULL))
{
g_free (path);
g_free (orig);
return 1;
path = g_find_program_in_path (argv[0]);
if (path)
{
g_free (path);
g_free (orig);
g_strfreev (argv);
return 1;
}
g_strfreev (argv);
}
g_free (orig);

View File

@ -161,11 +161,7 @@ plugingui_load (void)
sub_dir = g_build_filename (get_xdir(), "addons", NULL);
gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
#ifdef WIN32
sub_dir, "*.dll;*.lua;*.pl;*.py;*.tcl;*.js", FRF_FILTERISINITIAL|FRF_EXTENSIONS);
#else
sub_dir, "*.so;*.lua;*.pl;*.py;*.tcl;*.js", FRF_FILTERISINITIAL|FRF_EXTENSIONS);
#endif
sub_dir, "*."G_MODULE_SUFFIX";*.lua;*.pl;*.py;*.tcl;*.js", FRF_FILTERISINITIAL|FRF_EXTENSIONS);
g_free (sub_dir);
}
@ -179,7 +175,6 @@ plugingui_loadbutton_cb (GtkWidget * wid, gpointer unused)
static void
plugingui_unload (GtkWidget * wid, gpointer unused)
{
int len;
char *modname, *file, *buf;
GtkTreeView *view;
GtkTreeIter iter;
@ -189,16 +184,7 @@ plugingui_unload (GtkWidget * wid, gpointer unused)
FILE_COLUMN, &file, -1))
return;
len = strlen (file);
#ifdef WIN32
if (len > 4 && g_ascii_strcasecmp (file + len - 4, ".dll") == 0)
#else
#if defined(__hpux)
if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".sl") == 0)
#else
if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".so") == 0)
#endif
#endif
if (g_str_has_suffix (file, "."G_MODULE_SUFFIX))
{
if (plugin_kill (modname, FALSE) == 2)
fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR);

View File

@ -2032,7 +2032,7 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout)
{
if (channelwin_pix)
g_object_unref (channelwin_pix);
channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
channelwin_pix = gdk_pixbuf_new_from_file (prefs.hex_text_background, NULL);
}
input_style = create_input_style (input_style);

View File

@ -22,12 +22,7 @@
#include "sexy-iso-codes.h"
#include <libintl.h>
#include <string.h>
#ifdef G_OS_WIN32
#include "../../config-win32.h"
#else
#include "../../config.h"
#endif
#define ISO_639_DOMAIN "iso_639"
#define ISO_3166_DOMAIN "iso_3166"

View File

@ -153,11 +153,8 @@ initialize_enchant ()
GModule *enchant;
gpointer funcptr;
#ifdef WIN32
enchant = g_module_open("libenchant.dll", 0);
#else
enchant = g_module_open("libenchant", 0);
#endif
enchant = g_module_open("libenchant."G_MODULE_SUFFIX, 0);
if (enchant == NULL)
{
#ifndef WIN32

View File

@ -18,6 +18,7 @@
*
* xtext, the text widget used by X-Chat.
* By Peter Zelezny <zed@xchat.org>.
* Includes work from Conspire and xchat-gnome
*
*/
@ -31,12 +32,7 @@
#include <stdlib.h>
#include <time.h>
#ifdef WIN32
#include "../../config-win32.h"
#else
#include "../../config.h"
#endif
#include "../common/hexchat.h"
#include "../common/fe.h"
#include "../common/util.h"
@ -144,27 +140,54 @@ static void gtk_xtext_search_textentry_fini (gpointer, gpointer);
static void gtk_xtext_search_fini (xtext_buffer *);
static gboolean gtk_xtext_search_init (xtext_buffer *buf, const gchar *text, gtk_xtext_search_flags flags, GError **perr);
/* Avoid warning messages for this unused function */
#if 0
/* gives width of a 8bit string - with no mIRC codes in it */
static int
gtk_xtext_text_width_8bit (GtkXText *xtext, unsigned char *str, int len)
static inline void
xtext_set_source_color (cairo_t *cr, GdkColor *color, gdouble alpha)
{
int width = 0;
while (len)
{
width += xtext->fontwidth[*str];
str++;
len--;
}
return width;
cairo_set_source_rgba (cr, color->red / 65535.0, color->green / 65535.0,
color->blue / 65535.0, alpha);
}
#endif
#define xtext_draw_bg(xt,x,y,w,h) gdk_draw_rectangle(xt->draw_buf, xt->bgc, 1, x, y, w, h);
static inline void
xtext_draw_rectangle (GtkXText *xtext, cairo_t *cr, GdkColor *color, int x, int y, int width, int height)
{
cairo_save (cr);
xtext_set_source_color (cr, color, 1.0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_rectangle (cr, (double)x, (double)y, (double)width, (double)height);
cairo_fill (cr);
cairo_restore (cr);
}
static inline void
xtext_draw_line (GtkXText *xtext, cairo_t *cr, GdkColor *color, int x1, int y1, int x2, int y2)
{
cairo_save (cr);
/* Disable antialiasing for crispy 1-pixel lines */
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
gdk_cairo_set_source_color (cr, color);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2);
cairo_stroke (cr);
cairo_restore (cr);
}
static inline void
xtext_draw_bg (GtkXText *xtext, int x, int y, int width, int height)
{
cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
xtext_draw_rectangle (xtext, cr, &xtext->palette[XTEXT_BG], x, y, width, height);
cairo_destroy (cr);
}
/* ======================================= */
/* ============ PANGO BACKEND ============ */
@ -354,77 +377,50 @@ backend_get_text_width_slp (GtkXText *xtext, guchar *str, GSList *slp)
return width;
}
/* simplified version of gdk_draw_layout_line_with_colors() */
static void
xtext_draw_layout_line (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
PangoLayoutLine *line)
{
GSList *tmp_list = line->runs;
PangoRectangle logical_rect;
gint x_off = 0;
while (tmp_list)
{
PangoLayoutRun *run = tmp_list->data;
pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
NULL, &logical_rect);
gdk_draw_glyphs (drawable, gc, run->item->analysis.font,
x + x_off / PANGO_SCALE, y, run->glyphs);
x_off += logical_rect.width;
tmp_list = tmp_list->next;
}
}
static void
backend_draw_text_emph (GtkXText *xtext, int dofill, GdkGC *gc, int x, int y,
char *str, int len, int str_width, int emphasis)
backend_draw_text_emph (GtkXText *xtext, gboolean dofill, int x, int y, char *str, int len, int str_width, int emphasis)
{
GdkGCValues val;
GdkColor col;
cairo_t *cr;
PangoLayoutLine *line;
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
pango_layout_set_attributes (xtext->layout, attr_lists[emphasis]);
pango_layout_set_text (xtext->layout, str, len);
if (dofill)
{
gdk_gc_get_values (gc, &val);
col.pixel = val.background.pixel;
gdk_gc_set_foreground (gc, &col);
gdk_draw_rectangle (xtext->draw_buf, gc, 1, x, y -
xtext->font->ascent, str_width, xtext->fontsize);
col.pixel = val.foreground.pixel;
gdk_gc_set_foreground (gc, &col);
xtext_draw_rectangle (xtext, cr, &xtext->bgc, x, y - xtext->font->ascent,
str_width, xtext->fontsize);
}
line = pango_layout_get_lines (xtext->layout)->data;
gdk_cairo_set_source_color (cr, &xtext->fgc);
line = pango_layout_get_line_readonly (xtext->layout, 0);
xtext_draw_layout_line (xtext->draw_buf, gc, x, y, line);
cairo_save (cr);
cairo_move_to (cr, x, y);
pango_cairo_show_layout_line (cr, line);
cairo_restore (cr);
cairo_destroy (cr);
}
static void
xtext_set_fg (GtkXText *xtext, GdkGC *gc, int index)
static inline void
xtext_set_fg (GtkXText *xtext, int index)
{
gdk_gc_set_foreground (gc, &xtext->palette[index]);
xtext->fgc = xtext->palette[index];
}
static void
xtext_set_bg (GtkXText *xtext, GdkGC *gc, int index)
static inline void
xtext_set_bg (GtkXText *xtext, int index)
{
gdk_gc_set_background (gc, &xtext->palette[index]);
xtext->bgc = xtext->palette[index];
}
static void
gtk_xtext_init (GtkXText * xtext)
{
xtext->pixmap = NULL;
xtext->pixbuf = NULL;
xtext->io_tag = 0;
xtext->add_io_tag = 0;
xtext->scroll_tag = 0;
@ -439,8 +435,6 @@ gtk_xtext_init (GtkXText * xtext)
xtext->layout = NULL;
xtext->jump_out_offset = 0;
xtext->jump_in_offset = 0;
xtext->ts_x = 0;
xtext->ts_y = 0;
xtext->clip_x = 0;
xtext->clip_x2 = 1000000;
xtext->clip_y = 0;
@ -580,10 +574,10 @@ gtk_xtext_destroy (GtkObject * object)
xtext->io_tag = 0;
}
if (xtext->pixmap)
if (xtext->pixbuf)
{
g_object_unref (xtext->pixmap);
xtext->pixmap = NULL;
g_object_unref (xtext->pixbuf);
xtext->pixbuf = NULL;
}
if (xtext->font)
@ -601,42 +595,6 @@ gtk_xtext_destroy (GtkObject * object)
xtext->adj = NULL;
}
if (xtext->bgc)
{
g_object_unref (xtext->bgc);
xtext->bgc = NULL;
}
if (xtext->fgc)
{
g_object_unref (xtext->fgc);
xtext->fgc = NULL;
}
if (xtext->light_gc)
{
g_object_unref (xtext->light_gc);
xtext->light_gc = NULL;
}
if (xtext->dark_gc)
{
g_object_unref (xtext->dark_gc);
xtext->dark_gc = NULL;
}
if (xtext->thin_gc)
{
g_object_unref (xtext->thin_gc);
xtext->thin_gc = NULL;
}
if (xtext->marker_gc)
{
g_object_unref (xtext->marker_gc);
xtext->marker_gc = NULL;
}
if (xtext->hand_cursor)
{
gdk_cursor_unref (xtext->hand_cursor);
@ -676,8 +634,6 @@ gtk_xtext_realize (GtkWidget * widget)
{
GtkXText *xtext;
GdkWindowAttr attributes;
GdkGCValues val;
GdkColor col;
GdkColormap *cmap;
gtk_widget_set_realized (widget, TRUE);
@ -705,59 +661,12 @@ gtk_xtext_realize (GtkWidget * widget)
xtext->depth = gdk_window_get_visual (widget->window)->depth;
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
val.graphics_exposures = 0;
xtext->bgc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext->fgc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext->light_gc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext->dark_gc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext->thin_gc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext->marker_gc = gdk_gc_new_with_values (widget->window, &val,
GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
/* for the separator bar (light) */
col.red = 0xffff; col.green = 0xffff; col.blue = 0xffff;
gdk_colormap_alloc_color (cmap, &col, FALSE, TRUE);
gdk_gc_set_foreground (xtext->light_gc, &col);
/* for the separator bar (dark) */
col.red = 0x1111; col.green = 0x1111; col.blue = 0x1111;
gdk_colormap_alloc_color (cmap, &col, FALSE, TRUE);
gdk_gc_set_foreground (xtext->dark_gc, &col);
/* for the separator bar (thinline) */
col.red = 0x8e38; col.green = 0x8e38; col.blue = 0x9f38;
gdk_colormap_alloc_color (cmap, &col, FALSE, TRUE);
gdk_gc_set_foreground (xtext->thin_gc, &col);
/* for the marker bar (marker) */
gdk_gc_set_foreground (xtext->marker_gc, &xtext->palette[XTEXT_MARKER]);
xtext_set_fg (xtext, xtext->fgc, XTEXT_FG);
xtext_set_bg (xtext, xtext->fgc, XTEXT_BG);
xtext_set_fg (xtext, xtext->bgc, XTEXT_BG);
/* draw directly to window */
xtext->draw_buf = widget->window;
if (xtext->pixmap)
{
gdk_gc_set_tile (xtext->bgc, xtext->pixmap);
gdk_gc_set_ts_origin (xtext->bgc, 0, 0);
xtext->ts_x = xtext->ts_y = 0;
gdk_gc_set_fill (xtext->bgc, GDK_TILED);
}
xtext_set_fg (xtext, XTEXT_FG);
xtext_set_bg (xtext, XTEXT_BG);
xtext->hand_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_LEFT_SIDE);
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
widget->style = gtk_style_attach (widget->style, widget->window);
backend_init (xtext);
@ -964,13 +873,17 @@ static void
gtk_xtext_draw_sep (GtkXText * xtext, int y)
{
int x, height;
GdkGC *light, *dark;
GdkColor light, dark, thin;
GtkAllocation allocation;
cairo_t *cr;
if (y == -1)
{
y = 0;
height = GTK_WIDGET (xtext)->allocation.height;
} else
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
height = allocation.height;
}
else
{
height = xtext->fontsize;
}
@ -978,31 +891,38 @@ gtk_xtext_draw_sep (GtkXText * xtext, int y)
/* draw the separator line */
if (xtext->separator && xtext->buffer->indent)
{
light = xtext->light_gc;
dark = xtext->dark_gc;
thin.red = 0x8e38; thin.green = 0x8e38; thin.blue = 0x9f38;
dark.red = 0x1111; dark.green = 0x1111; dark.blue = 0x1111;
light.red = 0xffff; light.green = 0xffff; light.blue = 0xffff;
x = xtext->buffer->indent - ((xtext->space_width + 1) / 2);
if (x < 1)
return;
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
if (xtext->thinline)
{
if (xtext->moving_separator)
gdk_draw_line (xtext->draw_buf, light, x, y, x, y + height);
xtext_draw_line (xtext, cr, &light, x, y, x, y + height);
else
gdk_draw_line (xtext->draw_buf, xtext->thin_gc, x, y, x, y + height);
} else
xtext_draw_line (xtext, cr, &thin, x, y, x, y + height);
}
else
{
if (xtext->moving_separator)
{
gdk_draw_line (xtext->draw_buf, light, x - 1, y, x - 1, y + height);
gdk_draw_line (xtext->draw_buf, dark, x, y, x, y + height);
} else
xtext_draw_line (xtext, cr, &light, x - 1, y, x - 1, y + height);
xtext_draw_line (xtext, cr, &dark, x, y, x, y + height);
}
else
{
gdk_draw_line (xtext->draw_buf, dark, x - 1, y, x - 1, y + height);
gdk_draw_line (xtext->draw_buf, light, x, y, x, y + height);
xtext_draw_line (xtext, cr, &dark, x - 1, y, x - 1, y + height);
xtext_draw_line (xtext, cr, &light, x, y, x, y + height);
}
}
cairo_destroy (cr);
}
}
@ -1010,6 +930,8 @@ static void
gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
{
int x, width, render_y;
GtkAllocation allocation;
cairo_t *cr;
if (!xtext->marker) return;
@ -1023,15 +945,21 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
}
else return;
x = 0;
width = GTK_WIDGET (xtext)->allocation.width;
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
gdk_draw_line (xtext->draw_buf, xtext->marker_gc, x, render_y, x + width, render_y);
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
x = 0;
width = allocation.width;
xtext_draw_line (xtext, cr, &xtext->palette[XTEXT_MARKER], x, render_y, x + width, render_y);
if (gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))))
{
xtext->buffer->marker_seen = TRUE;
}
cairo_destroy (cr);
}
static void
@ -1408,6 +1336,7 @@ gtk_xtext_timeout_ms (GtkXText *xtext, int pixes)
if (apixes < 20) return 20;
return 10;
}
static gint
gtk_xtext_scrolldown_timeout (GtkXText * xtext)
{
@ -2222,14 +2151,14 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
new_value = xtext->adj->value - (xtext->adj->page_increment / 10);
if (new_value < xtext->adj->lower)
new_value = xtext->adj->lower;
gtk_adjustment_set_value (xtext->adj, new_value);
gtk_adjustment_set_value (xtext->adj, (int)new_value);
}
else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */
{
new_value = xtext->adj->value + (xtext->adj->page_increment / 10);
if (new_value > (xtext->adj->upper - xtext->adj->page_size))
new_value = xtext->adj->upper - xtext->adj->page_size;
gtk_adjustment_set_value (xtext->adj, new_value);
gtk_adjustment_set_value (xtext->adj, (int)new_value);
}
return FALSE;
@ -2519,11 +2448,14 @@ gtk_xtext_text_width (GtkXText *xtext, unsigned char *text, int len)
static int
gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
int len, GdkGC *gc, int *emphasis)
int len, int *emphasis)
{
int str_width, dofill;
GdkDrawable *pix = NULL;
int dest_x = 0, dest_y = 0;
int dest_x, dest_y;
int str_width;
gboolean dofill = TRUE;
cairo_t *cr;
dest_x = dest_y = 0;
if (xtext->dont_render || len < 1 || xtext->hidden)
return 0;
@ -2533,7 +2465,7 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
if (xtext->dont_render2)
return str_width;
/* roll-your-own clipping (avoiding XftDrawString is always good!) */
/* roll-your-own clipping */
if (x > xtext->clip_x2 || x + str_width < xtext->clip_x)
return str_width;
if (y - xtext->font->ascent > xtext->clip_y2 || (y - xtext->font->ascent) + xtext->fontsize < xtext->clip_y)
@ -2544,75 +2476,66 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
if (!xtext->in_hilight) /* is it a hilight prefix? */
return str_width;
if (!xtext->un_hilight) /* doing a hilight? no need to draw the text */
goto dounder;
}
pix = gdk_pixmap_new (xtext->draw_buf, str_width, xtext->fontsize, xtext->depth);
if (pix)
{
dest_x = x;
dest_y = y - xtext->font->ascent;
gdk_gc_set_ts_origin (xtext->bgc, xtext->ts_x - x, xtext->ts_y - dest_y);
x = 0;
y = xtext->font->ascent;
xtext->draw_buf = pix;
}
dofill = TRUE;
/* backcolor is always handled by XDrawImageString */
if (!xtext->backcolor && xtext->pixmap)
{
/* draw the background pixmap behind the text - CAUSES FLICKER HERE!! */
xtext_draw_bg (xtext, x, y - xtext->font->ascent, str_width,
xtext->fontsize);
dofill = FALSE; /* already drawn the background */
}
backend_draw_text_emph (xtext, dofill, gc, x, y, str, len, str_width, *emphasis);
if (pix)
{
GdkRectangle clip;
GdkRectangle dest;
gdk_gc_set_ts_origin (xtext->bgc, xtext->ts_x, xtext->ts_y);
xtext->draw_buf = GTK_WIDGET (xtext)->window;
clip.x = xtext->clip_x;
clip.y = xtext->clip_y;
clip.width = xtext->clip_x2 - xtext->clip_x;
clip.height = xtext->clip_y2 - xtext->clip_y;
dest.x = dest_x;
dest.y = dest_y;
dest.width = str_width;
dest.height = xtext->fontsize;
if (gdk_rectangle_intersect (&clip, &dest, &dest))
/* dump the DB to window, but only within the clip_x/x2/y/y2 */
gdk_draw_drawable (xtext->draw_buf, xtext->bgc, pix,
dest.x - dest_x, dest.y - dest_y,
dest.x, dest.y, dest.width, dest.height);
g_object_unref (pix);
}
if (xtext->underline)
{
dounder:
if (pix)
y = dest_y + xtext->font->ascent + 1;
else
{
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
y++;
dest_x = x;
xtext_draw_line (xtext, cr, &xtext->fgc, dest_x + 1, y + 1, dest_x + str_width - 1, y + 1);
cairo_destroy (cr);
return str_width;
}
/* draw directly to window, it's out of the range of our DB */
gdk_draw_line (xtext->draw_buf, gc, dest_x, y, dest_x + str_width - 1, y);
}
if (!xtext->backcolor && xtext->pixbuf)
{
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
gdk_cairo_set_source_pixbuf (cr, xtext->pixbuf, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle (cr, x, y - xtext->font->ascent, str_width, xtext->fontsize);
cairo_fill (cr);
cairo_destroy (cr);
dofill = FALSE;
}
//if (xtext->pixbuf)
//{
// GdkRectangle clip, dest;
// cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
//backend_draw_text_emph (xtext, dofill, gc, x, y, str, len, str_width, *emphasis);
// gdk_cairo_set_source_pixbuf (cr, xtext->pixbuf, 0, 0);
// /* Only redraw what is required */
// clip.x = xtext->clip_x;
// clip.y = xtext->clip_y;
// clip.width = xtext->clip_x2 - xtext->clip_x;
// clip.height = xtext->clip_y2 - xtext->clip_y;
// dest.x = dest_x;
// dest.y = dest_y;
// dest.width = str_width;
// dest.height = xtext->fontsize;
// if (gdk_rectangle_intersect (&clip, &dest, &dest))
// {
// gdk_cairo_rectangle (cr, &dest);
// cairo_clip (cr);
// }
// cairo_paint (cr);
// cairo_destroy (cr);
// dofill = FALSE;
//}
backend_draw_text_emph (xtext, dofill, x, y, (char *)str, len, str_width, *emphasis);
return str_width;
}
@ -2628,9 +2551,9 @@ gtk_xtext_reset (GtkXText * xtext, int mark, int attribs)
{
xtext->backcolor = FALSE;
if (xtext->col_fore != XTEXT_FG)
xtext_set_fg (xtext, xtext->fgc, XTEXT_FG);
xtext_set_fg (xtext, XTEXT_FG);
if (xtext->col_back != XTEXT_BG)
xtext_set_bg (xtext, xtext->fgc, XTEXT_BG);
xtext_set_bg (xtext, XTEXT_BG);
}
xtext->col_fore = XTEXT_FG;
xtext->col_back = XTEXT_BG;
@ -2698,14 +2621,13 @@ gtk_xtext_search_offset (xtext_buffer *buf, textentry *ent, unsigned int off)
/* render a single line, which WONT wrap, and parse mIRC colors */
#define RENDER_FLUSH x += gtk_xtext_render_flush (xtext, x, y, pstr, j, gc, emphasis)
#define RENDER_FLUSH x += gtk_xtext_render_flush (xtext, x, y, pstr, j, emphasis)
static int
gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
unsigned char *str, int len, int win_width, int indent,
int line, int left_only, int *x_size_ret, int *emphasis)
{
GdkGC *gc;
int i = 0, x = indent, j = 0;
unsigned char *pstr = str;
int col_num, tmp;
@ -2720,18 +2642,16 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
offset = str - ent->str;
gc = xtext->fgc; /* our foreground GC */
if (ent->mark_start != -1 &&
ent->mark_start <= i + offset && ent->mark_end > i + offset)
ent->mark_start <= i + offset && ent->mark_end > i + offset)
{
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
xtext_set_bg (xtext, XTEXT_MARK_BG);
xtext_set_fg (xtext, XTEXT_MARK_FG);
xtext->backcolor = TRUE;
mark = TRUE;
}
if (xtext->hilight_ent == ent &&
xtext->hilight_start <= i + offset && xtext->hilight_end > i + offset)
xtext->hilight_start <= i + offset && xtext->hilight_end > i + offset)
{
if (!xtext->un_hilight)
{
@ -2749,7 +2669,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
if (indent > xtext->stamp_width)
{
xtext_draw_bg (xtext, xtext->stamp_width, y - xtext->font->ascent,
indent - xtext->stamp_width, xtext->fontsize);
indent - xtext->stamp_width, xtext->fontsize);
}
} else
{
@ -2757,7 +2677,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
if (indent >= xtext->clip_x)
{
xtext_draw_bg (xtext, 0, y - xtext->font->ascent,
MIN (indent, xtext->clip_x2), xtext->fontsize);
MIN (indent, xtext->clip_x2), xtext->fontsize);
}
}
}
@ -2782,7 +2702,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
}
if ((xtext->parsing_color && isdigit (str[i]) && xtext->nc < 2) ||
(xtext->parsing_color && str[i] == ',' && isdigit (str[i+1]) && xtext->nc < 3 && !xtext->parsing_backcolor))
(xtext->parsing_color && str[i] == ',' && isdigit (str[i+1]) && xtext->nc < 3 && !xtext->parsing_backcolor))
{
pstr++;
if (str[i] == ',')
@ -2800,7 +2720,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
col_num = col_num % XTEXT_MIRC_COLS;
xtext->col_fore = col_num;
if (!mark)
xtext_set_fg (xtext, gc, col_num);
xtext_set_fg (xtext, col_num);
}
} else
{
@ -2830,7 +2750,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
else
xtext->backcolor = TRUE;
if (!mark)
xtext_set_bg (xtext, gc, col_num);
xtext_set_bg (xtext, col_num);
xtext->col_back = col_num;
} else
{
@ -2840,11 +2760,12 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
if (col_num > XTEXT_MAX_COLOR)
col_num = col_num % XTEXT_MIRC_COLS;
if (!mark)
xtext_set_fg (xtext, gc, col_num);
xtext_set_fg (xtext, col_num);
xtext->col_fore = col_num;
}
xtext->parsing_backcolor = FALSE;
} else
}
else
{
/* got a \003<non-digit>... i.e. reset colors */
RENDER_FLUSH;
@ -2855,7 +2776,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
}
if (!left_only && !mark &&
(k = gtk_xtext_search_offset (xtext->buffer, ent, offset + i)))
(k = gtk_xtext_search_offset (xtext->buffer, ent, offset + i)))
{
RENDER_FLUSH;
pstr += j;
@ -2864,14 +2785,14 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
{
if (k & GTK_MATCH_CUR)
{
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
xtext_set_bg (xtext, XTEXT_MARK_BG);
xtext_set_fg (xtext, XTEXT_MARK_FG);
xtext->backcolor = TRUE;
srch_mark = TRUE;
} else
{
xtext_set_bg (xtext, gc, xtext->col_back);
xtext_set_fg (xtext, gc, xtext->col_fore);
xtext_set_bg (xtext, xtext->col_back);
xtext_set_fg (xtext, xtext->col_fore);
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
srch_mark = FALSE;
}
@ -2881,15 +2802,15 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
xtext->underline = (k & GTK_MATCH_CUR)? TRUE: FALSE;
if (k & (GTK_MATCH_START | GTK_MATCH_MID))
{
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
xtext_set_bg (xtext, XTEXT_MARK_BG);
xtext_set_fg (xtext, XTEXT_MARK_FG);
xtext->backcolor = TRUE;
srch_mark = TRUE;
}
if (k & GTK_MATCH_END)
{
xtext_set_bg (xtext, gc, xtext->col_back);
xtext_set_fg (xtext, gc, xtext->col_fore);
xtext_set_bg (xtext, xtext->col_back);
xtext_set_fg (xtext, xtext->col_fore);
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
srch_mark = FALSE;
xtext->underline = FALSE;
@ -2901,7 +2822,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
switch (str[i])
{
case '\n':
/*case ATTR_BEEP:*/
/*case ATTR_BEEP:*/
break;
case ATTR_REVERSE:
RENDER_FLUSH;
@ -2912,8 +2833,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
xtext->col_back = tmp;
if (!mark)
{
xtext_set_fg (xtext, gc, xtext->col_fore);
xtext_set_bg (xtext, gc, xtext->col_back);
xtext_set_fg (xtext, xtext->col_fore);
xtext_set_bg (xtext, xtext->col_back);
}
if (xtext->col_back != XTEXT_BG)
xtext->backcolor = TRUE;
@ -2971,9 +2892,9 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
i = len;
/* Separate the left part, the space and the right part
into separate runs, and reset bidi state inbetween.
Perform this only on the first line of the message.
*/
into separate runs, and reset bidi state inbetween.
Perform this only on the first line of the message.
*/
if (offset == 0)
{
/* we've reached the end of the left part? */
@ -2994,7 +2915,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
/* have we been told to stop rendering at this point? */
if (xtext->jump_out_offset > 0 && xtext->jump_out_offset <= (i + offset))
{
gtk_xtext_render_flush (xtext, x, y, pstr, j, gc, emphasis);
gtk_xtext_render_flush (xtext, x, y, pstr, j, emphasis);
ret = 0; /* skip the rest of the lines, we're done. */
j = 0;
break;
@ -3028,8 +2949,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
RENDER_FLUSH;
pstr += j;
j = 0;
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
xtext_set_bg (xtext, XTEXT_MARK_BG);
xtext_set_fg (xtext, XTEXT_MARK_FG);
xtext->backcolor = TRUE;
if (srch_underline)
{
@ -3044,8 +2965,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
RENDER_FLUSH;
pstr += j;
j = 0;
xtext_set_bg (xtext, gc, xtext->col_back);
xtext_set_fg (xtext, gc, xtext->col_fore);
xtext_set_bg (xtext, xtext->col_back);
xtext_set_fg (xtext, xtext->col_fore);
if (xtext->col_back != XTEXT_BG)
xtext->backcolor = TRUE;
else
@ -3060,8 +2981,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
if (mark || srch_mark)
{
xtext_set_bg (xtext, gc, xtext->col_back);
xtext_set_fg (xtext, gc, xtext->col_fore);
xtext_set_bg (xtext, xtext->col_back);
xtext_set_fg (xtext, xtext->col_fore);
if (xtext->col_back != XTEXT_BG)
xtext->backcolor = TRUE;
else
@ -3078,10 +2999,10 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
int xx = MAX (x, xtext->clip_x);
xtext_draw_bg (xtext,
xx, /* x */
y - xtext->font->ascent, /* y */
xx, /* x */
y - xtext->font->ascent, /* y */
MIN (xtext->clip_x2 - xx, (win_width + MARGIN) - xx), /* width */
xtext->fontsize); /* height */
xtext->fontsize); /* height */
}
}
@ -3395,11 +3316,9 @@ gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[])
if (gtk_widget_get_realized (GTK_WIDGET(xtext)))
{
xtext_set_fg (xtext, xtext->fgc, XTEXT_FG);
xtext_set_bg (xtext, xtext->fgc, XTEXT_BG);
xtext_set_fg (xtext, xtext->bgc, XTEXT_BG);
gdk_gc_set_foreground (xtext->marker_gc, &xtext->palette[XTEXT_MARKER]);
xtext_set_fg (xtext, XTEXT_FG);
xtext_set_bg (xtext, XTEXT_BG);
xtext_set_fg (xtext, XTEXT_BG);
}
xtext->col_fore = XTEXT_FG;
xtext->col_back = XTEXT_BG;
@ -3485,38 +3404,14 @@ gtk_xtext_set_font (GtkXText *xtext, char *name)
}
void
gtk_xtext_set_background (GtkXText * xtext, GdkPixmap * pixmap)
gtk_xtext_set_background (GtkXText *xtext, GdkPixbuf *pixbuf)
{
GdkGCValues val;
if (xtext->pixbuf && (xtext->pixbuf != pixbuf))
g_object_unref (xtext->pixbuf);
if (xtext->pixmap)
{
g_object_unref (xtext->pixmap);
xtext->pixmap = NULL;
}
xtext->pixbuf = pixbuf;
dontscroll (xtext->buffer);
xtext->pixmap = pixmap;
if (pixmap != 0)
{
g_object_ref (pixmap);
if (gtk_widget_get_realized (GTK_WIDGET(xtext)))
{
gdk_gc_set_tile (xtext->bgc, pixmap);
gdk_gc_set_ts_origin (xtext->bgc, 0, 0);
xtext->ts_x = xtext->ts_y = 0;
gdk_gc_set_fill (xtext->bgc, GDK_TILED);
}
} else if (gtk_widget_get_realized (GTK_WIDGET(xtext)))
{
g_object_unref (xtext->bgc);
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
val.graphics_exposures = 0;
xtext->bgc = gdk_gc_new_with_values (GTK_WIDGET (xtext)->window,
&val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW);
xtext_set_fg (xtext, xtext->bgc, XTEXT_BG);
}
/* TODO: redraw */
}
void
@ -3759,20 +3654,20 @@ gtk_xtext_render_page (GtkXText * xtext)
int height;
int subline;
int startline = xtext->adj->value;
int pos, overlap;
if(!gtk_widget_get_realized(GTK_WIDGET(xtext)))
return;
if (!gtk_widget_get_realized (GTK_WIDGET (xtext)))
return;
if (xtext->buffer->indent < MARGIN)
xtext->buffer->indent = MARGIN; /* 2 pixels is our left margin */
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
width = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (xtext)));
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
if (width < 34 || height < xtext->fontsize || width < xtext->buffer->indent + 32)
return;
xtext->pixel_offset = (xtext->adj->value - startline) * xtext->fontsize;
xtext->pixel_offset = (gtk_adjustment_get_value (xtext->adj) - startline) * xtext->fontsize;
subline = line = 0;
ent = xtext->buffer->text_first;
@ -3784,50 +3679,6 @@ gtk_xtext_render_page (GtkXText * xtext)
xtext->buffer->pagetop_subline = subline;
xtext->buffer->pagetop_line = startline;
if (xtext->buffer->num_lines <= xtext->adj->page_size)
dontscroll (xtext->buffer);
pos = xtext->adj->value * xtext->fontsize;
overlap = xtext->buffer->last_pixel_pos - pos;
xtext->buffer->last_pixel_pos = pos;
#ifndef __APPLE__
if (!xtext->pixmap && abs (overlap) < height)
{
GdkRectangle area;
/* so the obscured regions are exposed */
gdk_gc_set_exposures (xtext->fgc, TRUE);
if (overlap < 1) /* DOWN */
{
int remainder;
gdk_draw_drawable (xtext->draw_buf, xtext->fgc, xtext->draw_buf,
0, -overlap, 0, 0, width, height + overlap);
remainder = ((height - xtext->font->descent) % xtext->fontsize) +
xtext->font->descent;
area.y = (height + overlap) - remainder;
area.height = remainder - overlap;
} else
{
gdk_draw_drawable (xtext->draw_buf, xtext->fgc, xtext->draw_buf,
0, 0, 0, overlap, width, height - overlap);
area.y = 0;
area.height = overlap;
}
gdk_gc_set_exposures (xtext->fgc, FALSE);
if (area.height > 0)
{
area.x = 0;
area.width = width;
gtk_xtext_paint (GTK_WIDGET (xtext), &area);
}
return;
}
#endif
width -= MARGIN;
lines_max = ((height + xtext->pixel_offset) / xtext->fontsize) + 1;
@ -3835,7 +3686,7 @@ gtk_xtext_render_page (GtkXText * xtext)
{
gtk_xtext_reset (xtext, FALSE, TRUE);
line += gtk_xtext_render_line (xtext, ent, line, lines_max,
subline, width);
subline, width);
subline = 0;
if (line >= lines_max)
@ -3845,7 +3696,7 @@ gtk_xtext_render_page (GtkXText * xtext)
}
line = (xtext->fontsize * line) - xtext->pixel_offset;
/* fill any space below the last line with our background GC */
/* fill any space below the last line with our background */
xtext_draw_bg (xtext, 0, line, width + MARGIN, height - line);
/* draw the separator line */

View File

@ -129,8 +129,7 @@ struct _GtkXText
xtext_buffer *selection_buffer;
GtkAdjustment *adj;
GdkPixmap *pixmap; /* 0 = use palette[19] */
GdkDrawable *draw_buf; /* points to ->window */
GdkPixbuf *pixbuf; /* 0 = use palette[19] */
GdkCursor *hand_cursor;
GdkCursor *resize_cursor;
@ -141,12 +140,8 @@ struct _GtkXText
int last_win_h;
int last_win_w;
GdkGC *bgc; /* backing pixmap */
GdkGC *fgc; /* text foreground color */
GdkGC *light_gc; /* sep bar */
GdkGC *dark_gc;
GdkGC *thin_gc;
GdkGC *marker_gc;
GdkColor bgc; /* text background color */
GdkColor fgc; /* text foreground color */
GdkColor palette[XTEXT_COLS];
gint io_tag; /* for delayed refresh events */
@ -196,9 +191,6 @@ struct _GtkXText
int jump_out_offset; /* point at which to stop rendering */
int jump_in_offset; /* "" start rendering */
int ts_x; /* ts origin for ->bgc GC */
int ts_y;
int clip_x; /* clipping (x directions) */
int clip_x2; /* from x to x2 */
@ -257,7 +249,7 @@ void gtk_xtext_append_indent (xtext_buffer *buf,
unsigned char *right_text, int right_len,
time_t stamp);
int gtk_xtext_set_font (GtkXText *xtext, char *name);
void gtk_xtext_set_background (GtkXText * xtext, GdkPixmap * pixmap);
void gtk_xtext_set_background (GtkXText * xtext, GdkPixbuf * pixbuf);
void gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[]);
void gtk_xtext_clear (xtext_buffer *buf, int lines);
void gtk_xtext_save (GtkXText * xtext, int fh);

View File

@ -1,6 +1,5 @@
#define LOCALEDIR ".\\share\\locale"
#define ENABLE_NLS
#define USE_GMODULE
#define USE_PLUGIN
#define USE_OPENSSL
#define USE_IPV6

View File

@ -64,7 +64,7 @@
<Command>
<![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
powershell -File "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\win32\installer\hexchat.iss.tt" "$(SolutionDir)..\win32\installer\hexchat.iss"
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\installer\hexchat.iss.tt" "$(SolutionDir)..\win32\installer\hexchat.iss"
del "$(OutDir)hexchat.iss"
type hexchat.iss >> "$(OutDir)hexchat.iss"
$(IsccPath) /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"

View File

@ -1 +0,0 @@
<#= [string]::Join('.', $versionParts) #>