Compare commits
8 Commits
2.10
...
xtext-cair
Author | SHA1 | Date | |
---|---|---|---|
![]() |
218ad519e9 | ||
![]() |
7769de4018 | ||
![]() |
c1d9aad546 | ||
![]() |
3cd8556c54 | ||
![]() |
9c981cfc6b | ||
![]() |
11e3ecc739 | ||
![]() |
5849a0588e | ||
![]() |
b8c02f71d9 |
@@ -207,7 +207,7 @@ if test "$gtkfe" = yes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
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 *********************************************************************
|
||||||
dnl ** MAC_INTEGRATION **************************************************
|
dnl ** MAC_INTEGRATION **************************************************
|
||||||
|
@@ -32,11 +32,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
#ifdef WIN32
|
|
||||||
#include "../../config-win32.h" /* for #define OLD_PERL */
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
|
||||||
#include "hexchat-plugin.h"
|
#include "hexchat-plugin.h"
|
||||||
|
|
||||||
static hexchat_plugin *ph; /* plugin handle */
|
static hexchat_plugin *ph; /* plugin handle */
|
||||||
|
@@ -52,20 +52,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <glib/gstdio.h>
|
|
||||||
#include "../../src/dirent/dirent-win32.h"
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
#include "hexchat-plugin.h"
|
#include "hexchat-plugin.h"
|
||||||
#undef _POSIX_C_SOURCE /* Avoid warning: also in /usr/include/features.h from glib.h */
|
#undef _POSIX_C_SOURCE /* Avoid warning: also in /usr/include/features.h from glib.h */
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
@@ -459,26 +458,31 @@ Util_BuildEOLList(char *word[])
|
|||||||
static void
|
static void
|
||||||
Util_Autoload_from (const char *dir_name)
|
Util_Autoload_from (const char *dir_name)
|
||||||
{
|
{
|
||||||
#ifndef PATH_MAX
|
gchar *oldcwd;
|
||||||
#define PATH_MAX 1024 /* Hurd doesn't define it */
|
const char *entry_name;
|
||||||
#endif
|
GDir *dir;
|
||||||
char oldcwd[PATH_MAX];
|
|
||||||
struct dirent *ent;
|
oldcwd = g_get_current_dir ();
|
||||||
DIR *dir;
|
if (oldcwd == NULL)
|
||||||
if (getcwd(oldcwd, PATH_MAX) == NULL)
|
|
||||||
return;
|
return;
|
||||||
if (chdir(dir_name) != 0)
|
if (g_chdir(dir_name) != 0)
|
||||||
|
{
|
||||||
|
g_free (oldcwd);
|
||||||
return;
|
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);
|
dir = g_dir_open (".", 0, NULL);
|
||||||
chdir(oldcwd);
|
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
|
static void
|
||||||
@@ -486,7 +490,7 @@ Util_Autoload()
|
|||||||
{
|
{
|
||||||
const char *xdir;
|
const char *xdir;
|
||||||
char *sub_dir;
|
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");
|
xdir = hexchat_get_info(ph, "configdir");
|
||||||
|
|
||||||
|
@@ -77,8 +77,8 @@
|
|||||||
<ClCompile Include="hexchat.c" />
|
<ClCompile Include="hexchat.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\config-win32.h.tt" />
|
<None Include="..\..\win32\config.h.tt" />
|
||||||
<ClInclude Include="..\..\config-win32.h" />
|
<ClInclude Include="..\..\config.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
|
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command><![CDATA[
|
<Command><![CDATA[
|
||||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||||
powershell -File "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\config-win32.h.tt" "$(SolutionDir)..\config-win32.h"
|
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 --header "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.h"
|
||||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.c"
|
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.c"
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@
|
|||||||
<ClInclude Include="hexchat-plugin.h">
|
<ClInclude Include="hexchat-plugin.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\config-win32.h">
|
<ClInclude Include="..\..\config.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="typedef.h">
|
<ClInclude Include="typedef.h">
|
||||||
@@ -195,6 +195,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\config-win32.h.tt" />
|
<None Include="..\..\win32\config.h.tt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@@ -991,47 +991,12 @@ hexchat_exit (void)
|
|||||||
fe_exit ();
|
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
|
void
|
||||||
hexchat_exec (const char *cmd)
|
hexchat_exec (const char *cmd)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
util_exec (cmd);
|
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
|
static void
|
||||||
set_locale (void)
|
set_locale (void)
|
||||||
|
@@ -17,11 +17,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
@@ -57,6 +57,5 @@ void session_free (session *killsess);
|
|||||||
void lag_check (void);
|
void lag_check (void);
|
||||||
void hexchat_exit (void);
|
void hexchat_exit (void);
|
||||||
void hexchat_exec (const char *cmd);
|
void hexchat_exec (const char *cmd);
|
||||||
void hexchat_execv (char * const argv[]);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "../../config-win32.h"
|
#include "../../config.h"
|
||||||
#ifdef USE_IPV6
|
#ifdef USE_IPV6
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
@@ -23,12 +23,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifndef WIN32
|
||||||
#include "../../config-win32.h" /* grab USE_IPV6 and LOOKUPD defines */
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "../../config.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
#define WANTSOCKET
|
#define WANTSOCKET
|
||||||
#define WANTARPA
|
#define WANTARPA
|
||||||
|
@@ -1841,8 +1841,10 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
|||||||
char **argv;
|
char **argv;
|
||||||
int argc;
|
int argc;
|
||||||
|
|
||||||
my_poptParseArgvString (cmd, &argc, &argv);
|
g_shell_parse_argv (cmd, &argc, &argv, NULL);
|
||||||
execvp (argv[0], argv);
|
execvp (argv[0], argv);
|
||||||
|
|
||||||
|
g_strfreev (argv);
|
||||||
}
|
}
|
||||||
/* not reached unless error */
|
/* not reached unless error */
|
||||||
/*printf("exec error\n");*/
|
/*printf("exec error\n");*/
|
||||||
@@ -2539,7 +2541,6 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
|||||||
char *file, *buf;
|
char *file, *buf;
|
||||||
#ifdef USE_PLUGIN
|
#ifdef USE_PLUGIN
|
||||||
char *error, *arg;
|
char *error, *arg;
|
||||||
int len;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!word[2][0])
|
if (!word[2][0])
|
||||||
@@ -2560,16 +2561,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_PLUGIN
|
#ifdef USE_PLUGIN
|
||||||
len = strlen (word[2]);
|
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
if (word_eol[3][0])
|
if (word_eol[3][0])
|
||||||
@@ -3565,18 +3557,9 @@ static int
|
|||||||
cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||||
{
|
{
|
||||||
#ifdef USE_PLUGIN
|
#ifdef USE_PLUGIN
|
||||||
int len, by_file = FALSE;
|
gboolean by_file = FALSE;
|
||||||
|
|
||||||
len = strlen (word[2]);
|
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
|
||||||
#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
|
|
||||||
by_file = TRUE;
|
by_file = TRUE;
|
||||||
|
|
||||||
switch (plugin_kill (word[2], by_file))
|
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[])
|
cmd_reload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
|
||||||
{
|
{
|
||||||
#ifdef USE_PLUGIN
|
#ifdef USE_PLUGIN
|
||||||
int len, by_file = FALSE;
|
gboolean by_file = FALSE;
|
||||||
|
|
||||||
len = strlen (word[2]);
|
if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
|
||||||
#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
|
|
||||||
by_file = TRUE;
|
by_file = TRUE;
|
||||||
|
|
||||||
switch (plugin_reload (sess, word[2], by_file))
|
switch (plugin_reload (sess, word[2], by_file))
|
||||||
|
@@ -460,17 +460,11 @@ plugin_auto_load (session *sess)
|
|||||||
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
|
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
|
||||||
for_files (lib_dir, "hcwinamp.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);
|
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);
|
for_files (sub_dir, "*."G_MODULE_SUFFIX, 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
|
|
||||||
|
|
||||||
g_free (sub_dir);
|
g_free (sub_dir);
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,8 @@
|
|||||||
#include <openssl/err.h> /* ERR_() */
|
#include <openssl/err.h> /* ERR_() */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <openssl/rand.h> /* RAND_seed() */
|
#include <openssl/rand.h> /* RAND_seed() */
|
||||||
#include "../../config-win32.h" /* HAVE_SNPRINTF */
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
#include "../../config.h"
|
||||||
#include <time.h> /* asctime() */
|
#include <time.h> /* asctime() */
|
||||||
#include <string.h> /* strncpy() */
|
#include <string.h> /* strncpy() */
|
||||||
#include "ssl.h" /* struct cert_info */
|
#include "ssl.h" /* struct cert_info */
|
||||||
|
@@ -34,17 +34,14 @@
|
|||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <VersionHelpers.h>
|
#include <VersionHelpers.h>
|
||||||
#include "../dirent/dirent-win32.h"
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <dirent.h>
|
|
||||||
#include "../../config.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "hexchat.h"
|
#include "hexchat.h"
|
||||||
@@ -935,27 +932,26 @@ break_while:
|
|||||||
void
|
void
|
||||||
for_files (char *dirname, char *mask, void callback (char *file))
|
for_files (char *dirname, char *mask, void callback (char *file))
|
||||||
{
|
{
|
||||||
DIR *dir;
|
GDir *dir;
|
||||||
struct dirent *ent;
|
const gchar *entry_name;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
dir = opendir (dirname);
|
dir = g_dir_open (dirname, 0, NULL);
|
||||||
if (dir)
|
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);
|
buf = g_build_filename (dirname, entry_name, NULL);
|
||||||
sprintf (buf, "%s" G_DIR_SEPARATOR_S "%s", dirname, ent->d_name);
|
|
||||||
callback (buf);
|
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! */
|
void
|
||||||
/* !!! 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
|
|
||||||
util_exec (const char *cmd)
|
util_exec (const char *cmd)
|
||||||
{
|
{
|
||||||
char **argv;
|
g_spawn_command_line_async (cmd, NULL);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
extern const unsigned char rfc_tolowertab[];
|
extern const unsigned char rfc_tolowertab[];
|
||||||
|
|
||||||
int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr);
|
|
||||||
char *expand_homedir (char *file);
|
char *expand_homedir (char *file);
|
||||||
void path_part (char *file, char *path, int pathlen);
|
void path_part (char *file, char *path, int pathlen);
|
||||||
int match (const char *mask, const char *string);
|
int match (const char *mask, const char *string);
|
||||||
@@ -50,8 +49,7 @@ char *nocasestrstr (const char *text, const char *tofind);
|
|||||||
char *country (char *);
|
char *country (char *);
|
||||||
void country_search (char *pattern, void *ud, void (*print)(void *, char *, ...));
|
void country_search (char *pattern, void *ud, void (*print)(void *, char *, ...));
|
||||||
char *get_sys_str (int with_cpu);
|
char *get_sys_str (int with_cpu);
|
||||||
int util_exec (const char *cmd);
|
void util_exec (const char *cmd);
|
||||||
int util_execv (char * const argv[]);
|
|
||||||
#define STRIP_COLOR 1
|
#define STRIP_COLOR 1
|
||||||
#define STRIP_ATTRIB 2
|
#define STRIP_ATTRIB 2
|
||||||
#define STRIP_HIDDEN 4
|
#define STRIP_HIDDEN 4
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
#include <canberra.h>
|
#include <canberra.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GdkPixmap *channelwin_pix;
|
GdkPixbuf *channelwin_pix;
|
||||||
|
|
||||||
#ifdef USE_LIBCANBERRA
|
#ifdef USE_LIBCANBERRA
|
||||||
static ca_context *ca_con;
|
static ca_context *ca_con;
|
||||||
@@ -296,7 +296,7 @@ fe_init (void)
|
|||||||
#ifdef HAVE_GTK_MAC
|
#ifdef HAVE_GTK_MAC
|
||||||
gtkosx_application_set_dock_icon_pixbuf (osx_app, pix_hexchat);
|
gtkosx_application_set_dock_icon_pixbuf (osx_app, pix_hexchat);
|
||||||
#endif
|
#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 ());
|
input_style = create_input_style (gtk_style_new ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,11 +20,7 @@
|
|||||||
#ifndef HEXCHAT_FE_GTK_H
|
#ifndef HEXCHAT_FE_GTK_H
|
||||||
#define HEXCHAT_FE_GTK_H
|
#define HEXCHAT_FE_GTK_H
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DISPLAY_NAME "HexChat"
|
#define DISPLAY_NAME "HexChat"
|
||||||
|
|
||||||
@@ -197,7 +193,7 @@ typedef struct session_gui
|
|||||||
|
|
||||||
} session_gui;
|
} session_gui;
|
||||||
|
|
||||||
extern GdkPixmap *channelwin_pix;
|
extern GdkPixbuf *channelwin_pix;
|
||||||
extern GdkPixmap *dialogwin_pix;
|
extern GdkPixmap *dialogwin_pix;
|
||||||
|
|
||||||
#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e))))
|
#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e))))
|
||||||
|
@@ -99,7 +99,7 @@
|
|||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command><![CDATA[
|
<Command><![CDATA[
|
||||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
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
|
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'"
|
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"
|
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir "$(DataDir)" --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include <winver.h>
|
#include <winver.h>
|
||||||
#include "../../config-win32.h"
|
#include "../../config.h"
|
||||||
|
|
||||||
#define COMMA_VERSION <#= [string]::Join(',', $versionParts) #>,0
|
#define COMMA_VERSION <#= [string]::Join(',', $versionParts) #>,0
|
||||||
|
|
||||||
|
@@ -3842,18 +3842,17 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
|
|||||||
gboolean
|
gboolean
|
||||||
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
cairo_t *cr;
|
||||||
GdkColor col;
|
|
||||||
GdkGCValues val;
|
|
||||||
int half, width, height;
|
int half, width, height;
|
||||||
int ox, oy;
|
int ox, oy;
|
||||||
GdkDrawable *draw;
|
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
|
||||||
/* ignore file drops */
|
/* ignore file drops */
|
||||||
if (!mg_is_gui_target (context))
|
if (!mg_is_gui_target (context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
gtk_widget_set_app_paintable (widget, TRUE);
|
||||||
|
|
||||||
if (scbar) /* scrollbar */
|
if (scbar) /* scrollbar */
|
||||||
{
|
{
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
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;
|
oy = allocation.y;
|
||||||
width = allocation.width;
|
width = allocation.width;
|
||||||
height = allocation.height;
|
height = allocation.height;
|
||||||
draw = gtk_widget_get_window (widget);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ox = oy = 0;
|
ox = oy = 0;
|
||||||
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
||||||
height = gdk_window_get_height (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;
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
val.graphics_exposures = 0;
|
cairo_set_source_rgb (cr, 0, 0, 1.0);
|
||||||
val.function = GDK_XOR;
|
cairo_set_line_width (cr, 0.1);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
half = height / 2;
|
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)
|
if (y < half)
|
||||||
{
|
cairo_rectangle (cr, ox, oy, width, 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);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
cairo_rectangle (cr, ox, half + oy, width, half);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (gc);
|
cairo_stroke (cr);
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
|
gtk_widget_queue_draw_area (widget, ox, oy, width, height);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -403,8 +403,10 @@ toggle_cb (GtkWidget *item, char *pref_name)
|
|||||||
static int
|
static int
|
||||||
is_in_path (char *cmd)
|
is_in_path (char *cmd)
|
||||||
{
|
{
|
||||||
char *prog = strdup (cmd + 1); /* 1st char is "!" */
|
char *prog = g_strdup (cmd + 1); /* 1st char is "!" */
|
||||||
char *space, *path, *orig;
|
char *path, *orig;
|
||||||
|
char **argv;
|
||||||
|
int argc;
|
||||||
|
|
||||||
orig = prog; /* save for free()ing */
|
orig = prog; /* save for free()ing */
|
||||||
/* special-case these default entries. */
|
/* special-case these default entries. */
|
||||||
@@ -413,17 +415,18 @@ is_in_path (char *cmd)
|
|||||||
/* don't check for gnome-terminal, but the thing it's executing! */
|
/* don't check for gnome-terminal, but the thing it's executing! */
|
||||||
prog += 18;
|
prog += 18;
|
||||||
|
|
||||||
space = strchr (prog, ' '); /* this isn't 100% but good enuf */
|
if (g_shell_parse_argv (prog, &argc, &argv, NULL))
|
||||||
if (space)
|
{
|
||||||
*space = 0;
|
path = g_find_program_in_path (argv[0]);
|
||||||
|
|
||||||
path = g_find_program_in_path (prog);
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_free (orig);
|
g_free (orig);
|
||||||
|
g_strfreev (argv);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
g_strfreev (argv);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (orig);
|
g_free (orig);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -161,11 +161,7 @@ plugingui_load (void)
|
|||||||
sub_dir = g_build_filename (get_xdir(), "addons", NULL);
|
sub_dir = g_build_filename (get_xdir(), "addons", NULL);
|
||||||
|
|
||||||
gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
|
gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
|
||||||
#ifdef WIN32
|
sub_dir, "*."G_MODULE_SUFFIX";*.lua;*.pl;*.py;*.tcl;*.js", FRF_FILTERISINITIAL|FRF_EXTENSIONS);
|
||||||
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
|
|
||||||
|
|
||||||
g_free (sub_dir);
|
g_free (sub_dir);
|
||||||
}
|
}
|
||||||
@@ -179,7 +175,6 @@ plugingui_loadbutton_cb (GtkWidget * wid, gpointer unused)
|
|||||||
static void
|
static void
|
||||||
plugingui_unload (GtkWidget * wid, gpointer unused)
|
plugingui_unload (GtkWidget * wid, gpointer unused)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
char *modname, *file, *buf;
|
char *modname, *file, *buf;
|
||||||
GtkTreeView *view;
|
GtkTreeView *view;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@@ -189,16 +184,7 @@ plugingui_unload (GtkWidget * wid, gpointer unused)
|
|||||||
FILE_COLUMN, &file, -1))
|
FILE_COLUMN, &file, -1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = strlen (file);
|
if (g_str_has_suffix (file, "."G_MODULE_SUFFIX))
|
||||||
#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 (plugin_kill (modname, FALSE) == 2)
|
if (plugin_kill (modname, FALSE) == 2)
|
||||||
fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR);
|
fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR);
|
||||||
|
@@ -2032,7 +2032,7 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout)
|
|||||||
{
|
{
|
||||||
if (channelwin_pix)
|
if (channelwin_pix)
|
||||||
g_object_unref (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);
|
input_style = create_input_style (input_style);
|
||||||
|
@@ -22,12 +22,7 @@
|
|||||||
#include "sexy-iso-codes.h"
|
#include "sexy-iso-codes.h"
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ISO_639_DOMAIN "iso_639"
|
#define ISO_639_DOMAIN "iso_639"
|
||||||
#define ISO_3166_DOMAIN "iso_3166"
|
#define ISO_3166_DOMAIN "iso_3166"
|
||||||
|
@@ -153,11 +153,8 @@ initialize_enchant ()
|
|||||||
GModule *enchant;
|
GModule *enchant;
|
||||||
gpointer funcptr;
|
gpointer funcptr;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
enchant = g_module_open("libenchant.dll", 0);
|
enchant = g_module_open("libenchant."G_MODULE_SUFFIX, 0);
|
||||||
#else
|
|
||||||
enchant = g_module_open("libenchant", 0);
|
|
||||||
#endif
|
|
||||||
if (enchant == NULL)
|
if (enchant == NULL)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
*
|
*
|
||||||
* xtext, the text widget used by X-Chat.
|
* xtext, the text widget used by X-Chat.
|
||||||
* By Peter Zelezny <zed@xchat.org>.
|
* By Peter Zelezny <zed@xchat.org>.
|
||||||
|
* Includes work from Conspire and xchat-gnome
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -31,12 +32,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "../../config-win32.h"
|
|
||||||
#else
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../common/hexchat.h"
|
#include "../common/hexchat.h"
|
||||||
#include "../common/fe.h"
|
#include "../common/fe.h"
|
||||||
#include "../common/util.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 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);
|
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 */
|
static inline void
|
||||||
#if 0
|
xtext_set_source_color (cairo_t *cr, GdkColor *color, gdouble alpha)
|
||||||
/* 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)
|
|
||||||
{
|
{
|
||||||
int width = 0;
|
cairo_set_source_rgba (cr, color->red / 65535.0, color->green / 65535.0,
|
||||||
|
color->blue / 65535.0, alpha);
|
||||||
while (len)
|
|
||||||
{
|
|
||||||
width += xtext->fontwidth[*str];
|
|
||||||
str++;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return width;
|
|
||||||
}
|
}
|
||||||
#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 ============ */
|
/* ============ PANGO BACKEND ============ */
|
||||||
@@ -354,77 +377,50 @@ backend_get_text_width_slp (GtkXText *xtext, guchar *str, GSList *slp)
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* simplified version of gdk_draw_layout_line_with_colors() */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xtext_draw_layout_line (GdkDrawable *drawable,
|
backend_draw_text_emph (GtkXText *xtext, gboolean dofill, int x, int y, char *str, int len, int str_width, int emphasis)
|
||||||
GdkGC *gc,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
PangoLayoutLine *line)
|
|
||||||
{
|
{
|
||||||
GSList *tmp_list = line->runs;
|
cairo_t *cr;
|
||||||
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)
|
|
||||||
{
|
|
||||||
GdkGCValues val;
|
|
||||||
GdkColor col;
|
|
||||||
PangoLayoutLine *line;
|
PangoLayoutLine *line;
|
||||||
|
|
||||||
|
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
|
||||||
|
|
||||||
pango_layout_set_attributes (xtext->layout, attr_lists[emphasis]);
|
pango_layout_set_attributes (xtext->layout, attr_lists[emphasis]);
|
||||||
pango_layout_set_text (xtext->layout, str, len);
|
pango_layout_set_text (xtext->layout, str, len);
|
||||||
|
|
||||||
if (dofill)
|
if (dofill)
|
||||||
{
|
{
|
||||||
gdk_gc_get_values (gc, &val);
|
xtext_draw_rectangle (xtext, cr, &xtext->bgc, x, y - xtext->font->ascent,
|
||||||
col.pixel = val.background.pixel;
|
str_width, xtext->fontsize);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
static inline void
|
||||||
xtext_set_fg (GtkXText *xtext, GdkGC *gc, int index)
|
xtext_set_fg (GtkXText *xtext, int index)
|
||||||
{
|
{
|
||||||
gdk_gc_set_foreground (gc, &xtext->palette[index]);
|
xtext->fgc = xtext->palette[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static inline void
|
||||||
xtext_set_bg (GtkXText *xtext, GdkGC *gc, int index)
|
xtext_set_bg (GtkXText *xtext, int index)
|
||||||
{
|
{
|
||||||
gdk_gc_set_background (gc, &xtext->palette[index]);
|
xtext->bgc = xtext->palette[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_xtext_init (GtkXText * xtext)
|
gtk_xtext_init (GtkXText * xtext)
|
||||||
{
|
{
|
||||||
xtext->pixmap = NULL;
|
xtext->pixbuf = NULL;
|
||||||
xtext->io_tag = 0;
|
xtext->io_tag = 0;
|
||||||
xtext->add_io_tag = 0;
|
xtext->add_io_tag = 0;
|
||||||
xtext->scroll_tag = 0;
|
xtext->scroll_tag = 0;
|
||||||
@@ -439,8 +435,6 @@ gtk_xtext_init (GtkXText * xtext)
|
|||||||
xtext->layout = NULL;
|
xtext->layout = NULL;
|
||||||
xtext->jump_out_offset = 0;
|
xtext->jump_out_offset = 0;
|
||||||
xtext->jump_in_offset = 0;
|
xtext->jump_in_offset = 0;
|
||||||
xtext->ts_x = 0;
|
|
||||||
xtext->ts_y = 0;
|
|
||||||
xtext->clip_x = 0;
|
xtext->clip_x = 0;
|
||||||
xtext->clip_x2 = 1000000;
|
xtext->clip_x2 = 1000000;
|
||||||
xtext->clip_y = 0;
|
xtext->clip_y = 0;
|
||||||
@@ -580,10 +574,10 @@ gtk_xtext_destroy (GtkObject * object)
|
|||||||
xtext->io_tag = 0;
|
xtext->io_tag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xtext->pixmap)
|
if (xtext->pixbuf)
|
||||||
{
|
{
|
||||||
g_object_unref (xtext->pixmap);
|
g_object_unref (xtext->pixbuf);
|
||||||
xtext->pixmap = NULL;
|
xtext->pixbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xtext->font)
|
if (xtext->font)
|
||||||
@@ -601,42 +595,6 @@ gtk_xtext_destroy (GtkObject * object)
|
|||||||
xtext->adj = NULL;
|
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)
|
if (xtext->hand_cursor)
|
||||||
{
|
{
|
||||||
gdk_cursor_unref (xtext->hand_cursor);
|
gdk_cursor_unref (xtext->hand_cursor);
|
||||||
@@ -676,8 +634,6 @@ gtk_xtext_realize (GtkWidget * widget)
|
|||||||
{
|
{
|
||||||
GtkXText *xtext;
|
GtkXText *xtext;
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
GdkGCValues val;
|
|
||||||
GdkColor col;
|
|
||||||
GdkColormap *cmap;
|
GdkColormap *cmap;
|
||||||
|
|
||||||
gtk_widget_set_realized (widget, TRUE);
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
@@ -705,59 +661,12 @@ gtk_xtext_realize (GtkWidget * widget)
|
|||||||
|
|
||||||
xtext->depth = gdk_window_get_visual (widget->window)->depth;
|
xtext->depth = gdk_window_get_visual (widget->window)->depth;
|
||||||
|
|
||||||
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
|
xtext_set_fg (xtext, XTEXT_FG);
|
||||||
val.graphics_exposures = 0;
|
xtext_set_bg (xtext, XTEXT_BG);
|
||||||
|
|
||||||
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->hand_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_HAND1);
|
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);
|
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);
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||||
|
|
||||||
backend_init (xtext);
|
backend_init (xtext);
|
||||||
@@ -964,13 +873,17 @@ static void
|
|||||||
gtk_xtext_draw_sep (GtkXText * xtext, int y)
|
gtk_xtext_draw_sep (GtkXText * xtext, int y)
|
||||||
{
|
{
|
||||||
int x, height;
|
int x, height;
|
||||||
GdkGC *light, *dark;
|
GdkColor light, dark, thin;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
if (y == -1)
|
if (y == -1)
|
||||||
{
|
{
|
||||||
y = 0;
|
y = 0;
|
||||||
height = GTK_WIDGET (xtext)->allocation.height;
|
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
|
||||||
} else
|
height = allocation.height;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
height = xtext->fontsize;
|
height = xtext->fontsize;
|
||||||
}
|
}
|
||||||
@@ -978,31 +891,38 @@ gtk_xtext_draw_sep (GtkXText * xtext, int y)
|
|||||||
/* draw the separator line */
|
/* draw the separator line */
|
||||||
if (xtext->separator && xtext->buffer->indent)
|
if (xtext->separator && xtext->buffer->indent)
|
||||||
{
|
{
|
||||||
light = xtext->light_gc;
|
thin.red = 0x8e38; thin.green = 0x8e38; thin.blue = 0x9f38;
|
||||||
dark = xtext->dark_gc;
|
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);
|
x = xtext->buffer->indent - ((xtext->space_width + 1) / 2);
|
||||||
if (x < 1)
|
if (x < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
|
||||||
|
|
||||||
if (xtext->thinline)
|
if (xtext->thinline)
|
||||||
{
|
{
|
||||||
if (xtext->moving_separator)
|
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
|
||||||
|
xtext_draw_line (xtext, cr, &thin, x, y, x, y + height);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gdk_draw_line (xtext->draw_buf, xtext->thin_gc, x, y, x, y + height);
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
if (xtext->moving_separator)
|
if (xtext->moving_separator)
|
||||||
{
|
{
|
||||||
gdk_draw_line (xtext->draw_buf, light, x - 1, y, x - 1, y + height);
|
xtext_draw_line (xtext, cr, &light, x - 1, y, x - 1, y + height);
|
||||||
gdk_draw_line (xtext->draw_buf, dark, x, y, x, y + height);
|
xtext_draw_line (xtext, cr, &dark, x, y, x, y + height);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
gdk_draw_line (xtext->draw_buf, dark, x - 1, y, x - 1, y + height);
|
xtext_draw_line (xtext, cr, &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, &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)
|
gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
|
||||||
{
|
{
|
||||||
int x, width, render_y;
|
int x, width, render_y;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
if (!xtext->marker) return;
|
if (!xtext->marker) return;
|
||||||
|
|
||||||
@@ -1023,15 +945,21 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
|
|||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
x = 0;
|
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
|
||||||
width = GTK_WIDGET (xtext)->allocation.width;
|
|
||||||
|
|
||||||
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)))))
|
if (gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))))
|
||||||
{
|
{
|
||||||
xtext->buffer->marker_seen = TRUE;
|
xtext->buffer->marker_seen = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1408,6 +1336,7 @@ gtk_xtext_timeout_ms (GtkXText *xtext, int pixes)
|
|||||||
if (apixes < 20) return 20;
|
if (apixes < 20) return 20;
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_xtext_scrolldown_timeout (GtkXText * xtext)
|
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);
|
new_value = xtext->adj->value - (xtext->adj->page_increment / 10);
|
||||||
if (new_value < xtext->adj->lower)
|
if (new_value < xtext->adj->lower)
|
||||||
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 */
|
else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */
|
||||||
{
|
{
|
||||||
new_value = xtext->adj->value + (xtext->adj->page_increment / 10);
|
new_value = xtext->adj->value + (xtext->adj->page_increment / 10);
|
||||||
if (new_value > (xtext->adj->upper - xtext->adj->page_size))
|
if (new_value > (xtext->adj->upper - xtext->adj->page_size))
|
||||||
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;
|
return FALSE;
|
||||||
@@ -2519,11 +2448,14 @@ gtk_xtext_text_width (GtkXText *xtext, unsigned char *text, int len)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
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;
|
int dest_x, dest_y;
|
||||||
GdkDrawable *pix = NULL;
|
int str_width;
|
||||||
int dest_x = 0, dest_y = 0;
|
gboolean dofill = TRUE;
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
|
dest_x = dest_y = 0;
|
||||||
|
|
||||||
if (xtext->dont_render || len < 1 || xtext->hidden)
|
if (xtext->dont_render || len < 1 || xtext->hidden)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2533,7 +2465,7 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
|||||||
if (xtext->dont_render2)
|
if (xtext->dont_render2)
|
||||||
return str_width;
|
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)
|
if (x > xtext->clip_x2 || x + str_width < xtext->clip_x)
|
||||||
return str_width;
|
return str_width;
|
||||||
if (y - xtext->font->ascent > xtext->clip_y2 || (y - xtext->font->ascent) + xtext->fontsize < xtext->clip_y)
|
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? */
|
if (!xtext->in_hilight) /* is it a hilight prefix? */
|
||||||
return str_width;
|
return str_width;
|
||||||
if (!xtext->un_hilight) /* doing a hilight? no need to draw the text */
|
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;
|
cr = gdk_cairo_create (gtk_widget_get_window (&xtext->widget));
|
||||||
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
|
|
||||||
{
|
|
||||||
y++;
|
y++;
|
||||||
dest_x = x;
|
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;
|
return str_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2628,9 +2551,9 @@ gtk_xtext_reset (GtkXText * xtext, int mark, int attribs)
|
|||||||
{
|
{
|
||||||
xtext->backcolor = FALSE;
|
xtext->backcolor = FALSE;
|
||||||
if (xtext->col_fore != XTEXT_FG)
|
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)
|
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_fore = XTEXT_FG;
|
||||||
xtext->col_back = XTEXT_BG;
|
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 */
|
/* 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
|
static int
|
||||||
gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
||||||
unsigned char *str, int len, int win_width, int indent,
|
unsigned char *str, int len, int win_width, int indent,
|
||||||
int line, int left_only, int *x_size_ret, int *emphasis)
|
int line, int left_only, int *x_size_ret, int *emphasis)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
|
||||||
int i = 0, x = indent, j = 0;
|
int i = 0, x = indent, j = 0;
|
||||||
unsigned char *pstr = str;
|
unsigned char *pstr = str;
|
||||||
int col_num, tmp;
|
int col_num, tmp;
|
||||||
@@ -2720,13 +2642,11 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
|
|
||||||
offset = str - ent->str;
|
offset = str - ent->str;
|
||||||
|
|
||||||
gc = xtext->fgc; /* our foreground GC */
|
|
||||||
|
|
||||||
if (ent->mark_start != -1 &&
|
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_bg (xtext, XTEXT_MARK_BG);
|
||||||
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
|
xtext_set_fg (xtext, XTEXT_MARK_FG);
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
mark = TRUE;
|
mark = TRUE;
|
||||||
}
|
}
|
||||||
@@ -2800,7 +2720,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
col_num = col_num % XTEXT_MIRC_COLS;
|
col_num = col_num % XTEXT_MIRC_COLS;
|
||||||
xtext->col_fore = col_num;
|
xtext->col_fore = col_num;
|
||||||
if (!mark)
|
if (!mark)
|
||||||
xtext_set_fg (xtext, gc, col_num);
|
xtext_set_fg (xtext, col_num);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -2830,7 +2750,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
else
|
else
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
if (!mark)
|
if (!mark)
|
||||||
xtext_set_bg (xtext, gc, col_num);
|
xtext_set_bg (xtext, col_num);
|
||||||
xtext->col_back = col_num;
|
xtext->col_back = col_num;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -2840,11 +2760,12 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
if (col_num > XTEXT_MAX_COLOR)
|
if (col_num > XTEXT_MAX_COLOR)
|
||||||
col_num = col_num % XTEXT_MIRC_COLS;
|
col_num = col_num % XTEXT_MIRC_COLS;
|
||||||
if (!mark)
|
if (!mark)
|
||||||
xtext_set_fg (xtext, gc, col_num);
|
xtext_set_fg (xtext, col_num);
|
||||||
xtext->col_fore = col_num;
|
xtext->col_fore = col_num;
|
||||||
}
|
}
|
||||||
xtext->parsing_backcolor = FALSE;
|
xtext->parsing_backcolor = FALSE;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* got a \003<non-digit>... i.e. reset colors */
|
/* got a \003<non-digit>... i.e. reset colors */
|
||||||
RENDER_FLUSH;
|
RENDER_FLUSH;
|
||||||
@@ -2864,14 +2785,14 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
{
|
{
|
||||||
if (k & GTK_MATCH_CUR)
|
if (k & GTK_MATCH_CUR)
|
||||||
{
|
{
|
||||||
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
|
xtext_set_bg (xtext, XTEXT_MARK_BG);
|
||||||
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
|
xtext_set_fg (xtext, XTEXT_MARK_FG);
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
srch_mark = TRUE;
|
srch_mark = TRUE;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
xtext_set_bg (xtext, gc, xtext->col_back);
|
xtext_set_bg (xtext, xtext->col_back);
|
||||||
xtext_set_fg (xtext, gc, xtext->col_fore);
|
xtext_set_fg (xtext, xtext->col_fore);
|
||||||
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
|
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
|
||||||
srch_mark = 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;
|
xtext->underline = (k & GTK_MATCH_CUR)? TRUE: FALSE;
|
||||||
if (k & (GTK_MATCH_START | GTK_MATCH_MID))
|
if (k & (GTK_MATCH_START | GTK_MATCH_MID))
|
||||||
{
|
{
|
||||||
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
|
xtext_set_bg (xtext, XTEXT_MARK_BG);
|
||||||
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
|
xtext_set_fg (xtext, XTEXT_MARK_FG);
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
srch_mark = TRUE;
|
srch_mark = TRUE;
|
||||||
}
|
}
|
||||||
if (k & GTK_MATCH_END)
|
if (k & GTK_MATCH_END)
|
||||||
{
|
{
|
||||||
xtext_set_bg (xtext, gc, xtext->col_back);
|
xtext_set_bg (xtext, xtext->col_back);
|
||||||
xtext_set_fg (xtext, gc, xtext->col_fore);
|
xtext_set_fg (xtext, xtext->col_fore);
|
||||||
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
|
xtext->backcolor = (xtext->col_back != XTEXT_BG)? TRUE: FALSE;
|
||||||
srch_mark = FALSE;
|
srch_mark = FALSE;
|
||||||
xtext->underline = FALSE;
|
xtext->underline = FALSE;
|
||||||
@@ -2912,8 +2833,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
xtext->col_back = tmp;
|
xtext->col_back = tmp;
|
||||||
if (!mark)
|
if (!mark)
|
||||||
{
|
{
|
||||||
xtext_set_fg (xtext, gc, xtext->col_fore);
|
xtext_set_fg (xtext, xtext->col_fore);
|
||||||
xtext_set_bg (xtext, gc, xtext->col_back);
|
xtext_set_bg (xtext, xtext->col_back);
|
||||||
}
|
}
|
||||||
if (xtext->col_back != XTEXT_BG)
|
if (xtext->col_back != XTEXT_BG)
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
@@ -2994,7 +2915,7 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
/* have we been told to stop rendering at this point? */
|
/* have we been told to stop rendering at this point? */
|
||||||
if (xtext->jump_out_offset > 0 && xtext->jump_out_offset <= (i + offset))
|
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. */
|
ret = 0; /* skip the rest of the lines, we're done. */
|
||||||
j = 0;
|
j = 0;
|
||||||
break;
|
break;
|
||||||
@@ -3028,8 +2949,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
RENDER_FLUSH;
|
RENDER_FLUSH;
|
||||||
pstr += j;
|
pstr += j;
|
||||||
j = 0;
|
j = 0;
|
||||||
xtext_set_bg (xtext, gc, XTEXT_MARK_BG);
|
xtext_set_bg (xtext, XTEXT_MARK_BG);
|
||||||
xtext_set_fg (xtext, gc, XTEXT_MARK_FG);
|
xtext_set_fg (xtext, XTEXT_MARK_FG);
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
if (srch_underline)
|
if (srch_underline)
|
||||||
{
|
{
|
||||||
@@ -3044,8 +2965,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
RENDER_FLUSH;
|
RENDER_FLUSH;
|
||||||
pstr += j;
|
pstr += j;
|
||||||
j = 0;
|
j = 0;
|
||||||
xtext_set_bg (xtext, gc, xtext->col_back);
|
xtext_set_bg (xtext, xtext->col_back);
|
||||||
xtext_set_fg (xtext, gc, xtext->col_fore);
|
xtext_set_fg (xtext, xtext->col_fore);
|
||||||
if (xtext->col_back != XTEXT_BG)
|
if (xtext->col_back != XTEXT_BG)
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
else
|
else
|
||||||
@@ -3060,8 +2981,8 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent,
|
|||||||
|
|
||||||
if (mark || srch_mark)
|
if (mark || srch_mark)
|
||||||
{
|
{
|
||||||
xtext_set_bg (xtext, gc, xtext->col_back);
|
xtext_set_bg (xtext, xtext->col_back);
|
||||||
xtext_set_fg (xtext, gc, xtext->col_fore);
|
xtext_set_fg (xtext, xtext->col_fore);
|
||||||
if (xtext->col_back != XTEXT_BG)
|
if (xtext->col_back != XTEXT_BG)
|
||||||
xtext->backcolor = TRUE;
|
xtext->backcolor = TRUE;
|
||||||
else
|
else
|
||||||
@@ -3395,11 +3316,9 @@ gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[])
|
|||||||
|
|
||||||
if (gtk_widget_get_realized (GTK_WIDGET(xtext)))
|
if (gtk_widget_get_realized (GTK_WIDGET(xtext)))
|
||||||
{
|
{
|
||||||
xtext_set_fg (xtext, xtext->fgc, XTEXT_FG);
|
xtext_set_fg (xtext, XTEXT_FG);
|
||||||
xtext_set_bg (xtext, xtext->fgc, XTEXT_BG);
|
xtext_set_bg (xtext, XTEXT_BG);
|
||||||
xtext_set_fg (xtext, xtext->bgc, XTEXT_BG);
|
xtext_set_fg (xtext, XTEXT_BG);
|
||||||
|
|
||||||
gdk_gc_set_foreground (xtext->marker_gc, &xtext->palette[XTEXT_MARKER]);
|
|
||||||
}
|
}
|
||||||
xtext->col_fore = XTEXT_FG;
|
xtext->col_fore = XTEXT_FG;
|
||||||
xtext->col_back = XTEXT_BG;
|
xtext->col_back = XTEXT_BG;
|
||||||
@@ -3485,38 +3404,14 @@ gtk_xtext_set_font (GtkXText *xtext, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
xtext->pixbuf = pixbuf;
|
||||||
{
|
|
||||||
g_object_unref (xtext->pixmap);
|
|
||||||
xtext->pixmap = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dontscroll (xtext->buffer);
|
/* TODO: redraw */
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -3759,20 +3654,20 @@ gtk_xtext_render_page (GtkXText * xtext)
|
|||||||
int height;
|
int height;
|
||||||
int subline;
|
int subline;
|
||||||
int startline = xtext->adj->value;
|
int startline = xtext->adj->value;
|
||||||
int pos, overlap;
|
|
||||||
|
|
||||||
if(!gtk_widget_get_realized(GTK_WIDGET(xtext)))
|
if (!gtk_widget_get_realized (GTK_WIDGET (xtext)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xtext->buffer->indent < MARGIN)
|
if (xtext->buffer->indent < MARGIN)
|
||||||
xtext->buffer->indent = MARGIN; /* 2 pixels is our left 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)
|
if (width < 34 || height < xtext->fontsize || width < xtext->buffer->indent + 32)
|
||||||
return;
|
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;
|
subline = line = 0;
|
||||||
ent = xtext->buffer->text_first;
|
ent = xtext->buffer->text_first;
|
||||||
@@ -3784,50 +3679,6 @@ gtk_xtext_render_page (GtkXText * xtext)
|
|||||||
xtext->buffer->pagetop_subline = subline;
|
xtext->buffer->pagetop_subline = subline;
|
||||||
xtext->buffer->pagetop_line = startline;
|
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;
|
width -= MARGIN;
|
||||||
lines_max = ((height + xtext->pixel_offset) / xtext->fontsize) + 1;
|
lines_max = ((height + xtext->pixel_offset) / xtext->fontsize) + 1;
|
||||||
|
|
||||||
@@ -3845,7 +3696,7 @@ gtk_xtext_render_page (GtkXText * xtext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
line = (xtext->fontsize * line) - xtext->pixel_offset;
|
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);
|
xtext_draw_bg (xtext, 0, line, width + MARGIN, height - line);
|
||||||
|
|
||||||
/* draw the separator line */
|
/* draw the separator line */
|
||||||
|
@@ -129,8 +129,7 @@ struct _GtkXText
|
|||||||
xtext_buffer *selection_buffer;
|
xtext_buffer *selection_buffer;
|
||||||
|
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GdkPixmap *pixmap; /* 0 = use palette[19] */
|
GdkPixbuf *pixbuf; /* 0 = use palette[19] */
|
||||||
GdkDrawable *draw_buf; /* points to ->window */
|
|
||||||
GdkCursor *hand_cursor;
|
GdkCursor *hand_cursor;
|
||||||
GdkCursor *resize_cursor;
|
GdkCursor *resize_cursor;
|
||||||
|
|
||||||
@@ -141,12 +140,8 @@ struct _GtkXText
|
|||||||
int last_win_h;
|
int last_win_h;
|
||||||
int last_win_w;
|
int last_win_w;
|
||||||
|
|
||||||
GdkGC *bgc; /* backing pixmap */
|
GdkColor bgc; /* text background color */
|
||||||
GdkGC *fgc; /* text foreground color */
|
GdkColor fgc; /* text foreground color */
|
||||||
GdkGC *light_gc; /* sep bar */
|
|
||||||
GdkGC *dark_gc;
|
|
||||||
GdkGC *thin_gc;
|
|
||||||
GdkGC *marker_gc;
|
|
||||||
GdkColor palette[XTEXT_COLS];
|
GdkColor palette[XTEXT_COLS];
|
||||||
|
|
||||||
gint io_tag; /* for delayed refresh events */
|
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_out_offset; /* point at which to stop rendering */
|
||||||
int jump_in_offset; /* "" start 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_x; /* clipping (x directions) */
|
||||||
int clip_x2; /* from x to x2 */
|
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,
|
unsigned char *right_text, int right_len,
|
||||||
time_t stamp);
|
time_t stamp);
|
||||||
int gtk_xtext_set_font (GtkXText *xtext, char *name);
|
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_set_palette (GtkXText * xtext, GdkColor palette[]);
|
||||||
void gtk_xtext_clear (xtext_buffer *buf, int lines);
|
void gtk_xtext_clear (xtext_buffer *buf, int lines);
|
||||||
void gtk_xtext_save (GtkXText * xtext, int fh);
|
void gtk_xtext_save (GtkXText * xtext, int fh);
|
||||||
|
@@ -64,7 +64,7 @@
|
|||||||
<Command>
|
<Command>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
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"
|
del "$(OutDir)hexchat.iss"
|
||||||
type hexchat.iss >> "$(OutDir)hexchat.iss"
|
type hexchat.iss >> "$(OutDir)hexchat.iss"
|
||||||
$(IsccPath) /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
|
$(IsccPath) /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
|
||||||
|
Reference in New Issue
Block a user