Compare commits
8 Commits
v2.10.1
...
xtext-cair
Author | SHA1 | Date | |
---|---|---|---|
218ad519e9 | |||
7769de4018 | |||
c1d9aad546 | |||
3cd8556c54 | |||
9c981cfc6b | |||
11e3ecc739 | |||
5849a0588e | |||
b8c02f71d9 |
@ -207,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 **************************************************
|
||||
|
@ -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 */
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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,7 +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)..\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"
|
||||
|
||||
|
@ -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>
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#include "../../config-win32.h"
|
||||
#include "../../config.h"
|
||||
#ifdef USE_IPV6
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -460,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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 ());
|
||||
}
|
||||
|
||||
|
@ -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))))
|
||||
|
@ -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"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <winver.h>
|
||||
#include "../../config-win32.h"
|
||||
#include "../../config.h"
|
||||
|
||||
#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
|
||||
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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user