22 Commits

Author SHA1 Message Date
deepend-tildeclub
b8a7ccf005 Merge pull request #277 from ZoiteChat/fix-window-restore
Defer topic relayout after restore-down
2026-06-05 09:15:10 -06:00
68fc53585e Defer topic relayout after restore-down 2026-06-04 15:24:37 -06:00
deepend-tildeclub
090b39f78b Merge pull request #266 from ZoiteChat/network-meter-alignment
Align text network meter columns
2026-06-02 15:41:57 -06:00
3722de6b13 Align text network meter columns 2026-06-02 14:49:29 -06:00
deepend-tildeclub
d93c9aa780 Merge pull request #255 from ZoiteChat/kde-dialog-native-controls
Use native file chooser dialogs everywhere
2026-05-26 13:14:24 -06:00
ea56504aee Use native file chooser dialogs everywhere 2026-05-26 02:24:06 -06:00
46b91edfdf Bundle Perl paths into AppImage runtime 2026-05-25 23:08:41 -06:00
deepend-tildeclub
d2dfde519d Merge pull request #253 from ZoiteChat/timedate-tooltop
Add timestamp/date hover tooltips
2026-05-25 15:58:40 -06:00
1eac56f22c Add timestamp/date hover tooltips 2026-05-25 14:49:30 -06:00
deepend-tildeclub
fb491a6bb2 Merge pull request #249 from ZoiteChat/lost-connection-fixes
Add configurable stale-link ping checks
2026-05-25 12:21:45 -06:00
3da7c89b66 Add configurable stale-link ping checks 2026-05-25 11:43:10 -06:00
deepend-tildeclub
e842cf3a57 Merge pull request #248 from ZoiteChat/scroll-speed-fix
Fix xtext wheel scroll speed handling + prefs slider
2026-05-25 10:29:40 -06:00
85b0e8f1a6 Fix xtext wheel scroll speed handling + prefs slider 2026-05-25 09:45:22 -06:00
deepend-tildeclub
b8e03ff6c1 Merge pull request #247 from ZoiteChat/fishlim-fixes
Fix FiSHLiM OpenSSL provider/context init issues
2026-05-25 02:24:32 -06:00
54b1703d67 Make FiSHLiM OpenSSL provider loading non-fatal 2026-05-25 02:13:24 -06:00
15d647a0ec Fix detached tab reattach UAF crash path 2026-05-22 14:50:44 -06:00
deepend-tildeclub
353558ddb3 Merge pull request #243 from sney/project-readme
Project readme updates
2026-05-22 09:24:37 -06:00
Jesse Rhodes
9f58d30050 Add more short description. 2026-05-22 09:47:13 -04:00
Jesse Rhodes
4f0632cdf1 Update existing links. 2026-05-22 09:44:29 -04:00
Jesse Rhodes
ff8ba71948 Remove link to incomplete/outdated (?) troubleshooting guide. 2026-05-22 09:41:23 -04:00
Jesse Rhodes
a367591327 Fix download link 404. 2026-05-22 09:38:07 -04:00
Jesse Rhodes
c91925fbc2 Match intro to distro package short descriptions. 2026-05-22 09:36:44 -04:00
16 changed files with 377 additions and 246 deletions

View File

@@ -86,11 +86,21 @@ jobs:
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/ cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
fi fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl-base" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl-base AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/ cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/
fi fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl5" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl5 AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/share/perl" ]; then if [ -d "/usr/share/perl" ]; then
install -d AppDir/usr/share install -d AppDir/usr/share
cp -a /usr/share/perl AppDir/usr/share/ cp -a /usr/share/perl AppDir/usr/share/
@@ -100,6 +110,10 @@ jobs:
install -d AppDir/usr/share install -d AppDir/usr/share
cp -a /usr/share/perl5 AppDir/usr/share/ cp -a /usr/share/perl5 AppDir/usr/share/
fi fi
perl -MFile::Spec -e 'print "Build host File::Spec: $INC{\"File/Spec.pm\"}\n"'
find AppDir/usr -path '*/File/Spec.pm' -print -quit | grep -q .
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
install -d AppDir/usr/lib/x86_64-linux-gnu install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/ cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
@@ -162,7 +176,7 @@ jobs:
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}" APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
export PATH="${PATH:-/usr/bin:/bin}:$APPDIR/usr/bin" export PATH="$APPDIR/usr/bin:${PATH:-/usr/bin:/bin}"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}" export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
export GTK_EXE_PREFIX="$APPDIR/usr" export GTK_EXE_PREFIX="$APPDIR/usr"
@@ -211,6 +225,23 @@ jobs:
unset GTK_MODULES unset GTK_MODULES
perl5lib_entries=""
for dir in \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl-base" \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl"/* \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl5"/* \
"$APPDIR/usr/share/perl"/* \
"$APPDIR/usr/share/perl5"
do
if [ -d "$dir" ]; then
perl5lib_entries="${perl5lib_entries:+$perl5lib_entries:}$dir"
fi
done
if [ -n "$perl5lib_entries" ]; then
export PERL5LIB="$perl5lib_entries${PERL5LIB:+:$PERL5LIB}"
fi
export PYTHONHOME="$APPDIR/usr" export PYTHONHOME="$APPDIR/usr"
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)" python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
pythonpath_entries="" pythonpath_entries=""
@@ -256,7 +287,6 @@ jobs:
EOF EOF
chmod +x AppRun chmod +x AppRun
VERSION="$(git describe --tags --always)" VERSION="$(git describe --tags --always)"
./linuxdeploy-x86_64.AppImage \ ./linuxdeploy-x86_64.AppImage \

View File

@@ -91,27 +91,13 @@ static const signed char fish_unbase64[256] = {
#include <openssl/provider.h> #include <openssl/provider.h>
static OSSL_PROVIDER *legacy_provider; static OSSL_PROVIDER *legacy_provider;
static OSSL_PROVIDER *default_provider; static OSSL_PROVIDER *default_provider;
static OSSL_LIB_CTX *ossl_ctx;
#endif #endif
int fish_init(void) int fish_init(void)
{ {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L #if OPENSSL_VERSION_NUMBER >= 0x30000000L
ossl_ctx = OSSL_LIB_CTX_new(); legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
if (!ossl_ctx) default_provider = OSSL_PROVIDER_load(NULL, "default");
return 0;
legacy_provider = OSSL_PROVIDER_load(ossl_ctx, "legacy");
if (!legacy_provider) {
fish_deinit();
return 0;
}
default_provider = OSSL_PROVIDER_load(ossl_ctx, "default");
if (!default_provider) {
fish_deinit();
return 0;
}
#endif #endif
return 1; return 1;
} }
@@ -129,10 +115,6 @@ void fish_deinit(void)
default_provider = NULL; default_provider = NULL;
} }
if (ossl_ctx) {
OSSL_LIB_CTX_free(ossl_ctx);
ossl_ctx = NULL;
}
#endif #endif
} }
@@ -278,7 +260,9 @@ char *fish_cipher(const char *plaintext, size_t plaintext_len, const char *key,
} }
#if OPENSSL_VERSION_NUMBER >= 0x30000000L #if OPENSSL_VERSION_NUMBER >= 0x30000000L
cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-CBC", NULL); cipher = EVP_CIPHER_fetch(NULL, "BF-CBC", NULL);
if (!cipher)
cipher = (EVP_CIPHER *) EVP_bf_cbc();
#else #else
cipher = (EVP_CIPHER *) EVP_bf_cbc(); cipher = (EVP_CIPHER *) EVP_bf_cbc();
#endif #endif
@@ -286,7 +270,9 @@ char *fish_cipher(const char *plaintext, size_t plaintext_len, const char *key,
} else if (mode == EVP_CIPH_ECB_MODE) { } else if (mode == EVP_CIPH_ECB_MODE) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L #if OPENSSL_VERSION_NUMBER >= 0x30000000L
cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-ECB", NULL); cipher = EVP_CIPHER_fetch(NULL, "BF-ECB", NULL);
if (!cipher)
cipher = (EVP_CIPHER *) EVP_bf_ecb();
#else #else
cipher = (EVP_CIPHER *) EVP_bf_ecb(); cipher = (EVP_CIPHER *) EVP_bf_ecb();
#endif #endif

View File

@@ -421,7 +421,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
zoitechat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s%s", sender, pub_key, (mode == FISH_CBC_MODE) ? " CBC" : ""); zoitechat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s%s", sender, pub_key, (mode == FISH_CBC_MODE) ? " CBC" : "");
g_free(pub_key); g_free(pub_key);
} else { } else {
zoitechat_print(ph, "Failed to generate keys"); zoitechat_printf(ph, "Failed to generate keys");
goto cleanup; goto cleanup;
} }
} else if (!strcmp (dh_message, "DH1080_FINISH")) { } else if (!strcmp (dh_message, "DH1080_FINISH")) {
@@ -446,7 +446,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
zoitechat_printf(ph, "Stored new key for %s (%s)", sender, fish_modes[mode]); zoitechat_printf(ph, "Stored new key for %s (%s)", sender, fish_modes[mode]);
g_free(secret_key); g_free(secret_key);
} else { } else {
zoitechat_print(ph, "Failed to create secret key!"); zoitechat_printf(ph, "Failed to create secret key!");
} }
cleanup: cleanup:
@@ -548,7 +548,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
} }
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) { if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
zoitechat_print(ph, "You can only exchange keys with individuals"); zoitechat_printf(ph, "You can only exchange keys with individuals");
return ZOITECHAT_EAT_ALL; return ZOITECHAT_EAT_ALL;
} }
@@ -560,7 +560,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
g_free(pub_key); g_free(pub_key);
} else { } else {
zoitechat_print(ph, "Failed to generate keys"); zoitechat_printf(ph, "Failed to generate keys");
} }
return ZOITECHAT_EAT_ALL; return ZOITECHAT_EAT_ALL;
@@ -577,7 +577,7 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list; GSList *encrypted_list;
if (!*topic) { if (!*topic) {
zoitechat_print(ph, usage_topic); zoitechat_printf(ph, "%s", usage_topic);
return ZOITECHAT_EAT_ALL; return ZOITECHAT_EAT_ALL;
} }
@@ -624,7 +624,7 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list, *encrypted_item; GSList *encrypted_list, *encrypted_item;
if (!*target || !*notice) { if (!*target || !*notice) {
zoitechat_print(ph, usage_notice); zoitechat_printf(ph, "%s", usage_notice);
return ZOITECHAT_EAT_ALL; return ZOITECHAT_EAT_ALL;
} }
@@ -676,7 +676,7 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list, *encrypted_item; GSList *encrypted_list, *encrypted_item;
if (!*target || !*message) { if (!*target || !*message) {
zoitechat_print(ph, usage_msg); zoitechat_printf(ph, "%s", usage_msg);
return ZOITECHAT_EAT_ALL; return ZOITECHAT_EAT_ALL;
} }
@@ -805,11 +805,15 @@ int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
if (!fish_init()) if (!fish_init()) {
zoitechat_printf(ph, "FiSHLiM failed to initialize crypto backend");
return 0; return 0;
}
if (!dh1080_init()) if (!dh1080_init()) {
zoitechat_printf(ph, "FiSHLiM failed to initialize DH1080");
return 0; return 0;
}
pending_exchanges = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); pending_exchanges = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);

View File

@@ -31,12 +31,19 @@
<br /> <br />
ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems. ZoiteChat is a GTK3 IRC client based on HexChat, available for Windows and UNIX-like operating systems.
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
For more information on ZoiteChat please read our [documentation](https://docs.zoitechat.org/):
- [Downloads](https://zoitechat.org/download)
- [Troubleshooting](troubleshooting.md) Features include HexChat-compatible Python, Perl and Lua scripting support, a plugin API,
multiple server/channel windows, spell checking, multiple authentication methods including SASL,
and customizable notifications.
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
For more information on ZoiteChat:
- [Main Documentation](https://docs.zoitechat.org/) and [FAQ](https://docs.zoitechat.org/en/latest/faq.html)
- [Downloads](https://zoitechat.org/download.php)
--- ---

View File

@@ -447,6 +447,7 @@ const struct prefs vars[] =
{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT}, {"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
{"gui_tab_closebuttons", P_OFFINT (hex_gui_tab_closebuttons), TYPE_BOOL}, {"gui_tab_closebuttons", P_OFFINT (hex_gui_tab_closebuttons), TYPE_BOOL},
{"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL}, {"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL},
{"gui_mouse_scroll_speed", P_OFFINT (hex_gui_mouse_scroll_speed), TYPE_INT},
{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT}, {"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
{"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT}, {"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT},
{"gui_tab_scrollchans", P_OFFINT (hex_gui_tab_scrollchans), TYPE_BOOL}, {"gui_tab_scrollchans", P_OFFINT (hex_gui_tab_scrollchans), TYPE_BOOL},
@@ -548,6 +549,10 @@ const struct prefs vars[] =
#endif #endif
{"net_bind_host", P_OFFSET (hex_net_bind_host), TYPE_STR}, {"net_bind_host", P_OFFSET (hex_net_bind_host), TYPE_STR},
{"net_ping_timeout", P_OFFINT (hex_net_ping_timeout), TYPE_INT, zoitechat_reinit_timers}, {"net_ping_timeout", P_OFFINT (hex_net_ping_timeout), TYPE_INT, zoitechat_reinit_timers},
{"net_lag_check", P_OFFINT (hex_net_lag_check), TYPE_INT, zoitechat_reinit_timers},
{"net_keepalive_idle", P_OFFINT (hex_net_keepalive_idle), TYPE_INT},
{"net_keepalive_interval", P_OFFINT (hex_net_keepalive_interval), TYPE_INT},
{"net_keepalive_count", P_OFFINT (hex_net_keepalive_count), TYPE_INT},
{"net_proxy_auth", P_OFFINT (hex_net_proxy_auth), TYPE_BOOL}, {"net_proxy_auth", P_OFFINT (hex_net_proxy_auth), TYPE_BOOL},
{"net_proxy_host", P_OFFSET (hex_net_proxy_host), TYPE_STR}, {"net_proxy_host", P_OFFSET (hex_net_proxy_host), TYPE_STR},
{"net_proxy_pass", P_OFFSET (hex_net_proxy_pass), TYPE_STR}, {"net_proxy_pass", P_OFFSET (hex_net_proxy_pass), TYPE_STR},
@@ -783,6 +788,7 @@ load_default_config(void)
prefs.hex_gui_tab_server = 1; prefs.hex_gui_tab_server = 1;
prefs.hex_gui_tab_sort = 1; prefs.hex_gui_tab_sort = 1;
prefs.hex_gui_tab_scrollchans = 1; prefs.hex_gui_tab_scrollchans = 1;
prefs.hex_gui_mouse_scroll_speed = 10;
prefs.hex_gui_topicbar = 1; prefs.hex_gui_topicbar = 1;
prefs.hex_gui_transparency = 255; prefs.hex_gui_transparency = 255;
prefs.hex_gui_tray = 1; prefs.hex_gui_tray = 1;
@@ -858,6 +864,10 @@ load_default_config(void)
prefs.hex_irc_ban_type = 1; prefs.hex_irc_ban_type = 1;
prefs.hex_irc_join_delay = 5; prefs.hex_irc_join_delay = 5;
prefs.hex_net_ping_timeout = 60; prefs.hex_net_ping_timeout = 60;
prefs.hex_net_lag_check = 60;
prefs.hex_net_keepalive_idle = 60;
prefs.hex_net_keepalive_interval = 20;
prefs.hex_net_keepalive_count = 3;
prefs.hex_net_reconnect_delay = 10; prefs.hex_net_reconnect_delay = 10;
prefs.hex_notify_timeout = 15; prefs.hex_notify_timeout = 15;
prefs.hex_text_max_indent = 256; prefs.hex_text_max_indent = 256;

View File

@@ -34,6 +34,9 @@
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#endif #endif
#define WANTSOCKET #define WANTSOCKET
@@ -43,6 +46,9 @@
#define NETWORK_PRIVATE #define NETWORK_PRIVATE
#include "network.h" #include "network.h"
#include "zoitechat.h"
extern struct zoitechatprefs prefs;
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n))) #define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
@@ -58,6 +64,27 @@ net_set_socket_options (int sok)
setsockopt (sok, SOL_SOCKET, SO_REUSEADDR, (char *) &sw, sizeof (sw)); setsockopt (sok, SOL_SOCKET, SO_REUSEADDR, (char *) &sw, sizeof (sw));
sw = 1; sw = 1;
setsockopt (sok, SOL_SOCKET, SO_KEEPALIVE, (char *) &sw, sizeof (sw)); setsockopt (sok, SOL_SOCKET, SO_KEEPALIVE, (char *) &sw, sizeof (sw));
#ifdef TCP_KEEPIDLE
{
int keepidle = prefs.hex_net_keepalive_idle;
if (keepidle > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPIDLE, (char *) &keepidle, sizeof (keepidle));
}
#endif
#ifdef TCP_KEEPINTVL
{
int keepintvl = prefs.hex_net_keepalive_interval;
if (keepintvl > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPINTVL, (char *) &keepintvl, sizeof (keepintvl));
}
#endif
#ifdef TCP_KEEPCNT
{
int keepcnt = prefs.hex_net_keepalive_count;
if (keepcnt > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPCNT, (char *) &keepcnt, sizeof (keepcnt));
}
#endif
} }
char * char *

View File

@@ -379,6 +379,7 @@ lag_check (void)
char tbuf[128]; char tbuf[128];
time_t now = time (0); time_t now = time (0);
time_t lag; time_t lag;
time_t ping_age;
tim = make_ping_time (); tim = make_ping_time ();
@@ -388,7 +389,7 @@ lag_check (void)
if (serv->connected && serv->end_of_motd) if (serv->connected && serv->end_of_motd)
{ {
lag = now - serv->ping_recv; lag = now - serv->ping_recv;
if (prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0) if (serv->lag_sent && prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0)
{ {
sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) lag); sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) lag);
EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL, EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL,
@@ -398,11 +399,11 @@ lag_check (void)
} }
else else
{ {
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim); ping_age = now - serv->ping_recv;
serv->p_ping (serv, "", tbuf); if (!serv->lag_sent && prefs.hex_net_lag_check > 0 && ping_age >= prefs.hex_net_lag_check)
if (!serv->lag_sent)
{ {
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
serv->p_ping (serv, "", tbuf);
serv->lag_sent = tim; serv->lag_sent = tim;
fe_set_lag (serv, -1); fe_set_lag (serv, -1);
} }
@@ -525,7 +526,7 @@ zoitechat_reinit_timers (void)
if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer) if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer)
&& lag_check_tag == 0) && lag_check_tag == 0)
{ {
lag_check_tag = fe_timeout_add_seconds (30, zoitechat_lag_check, NULL); lag_check_tag = fe_timeout_add_seconds (1, zoitechat_lag_check, NULL);
} }
else if ((!prefs.hex_net_ping_timeout && !prefs.hex_gui_lagometer) else if ((!prefs.hex_net_ping_timeout && !prefs.hex_gui_lagometer)
&& lag_check_tag != 0) && lag_check_tag != 0)

View File

@@ -267,6 +267,7 @@ struct zoitechatprefs
int hex_gui_tab_layout; int hex_gui_tab_layout;
int hex_gui_tab_closebuttons; int hex_gui_tab_closebuttons;
int hex_gui_tab_middleclose; int hex_gui_tab_middleclose;
int hex_gui_mouse_scroll_speed;
int hex_gui_tab_newtofront; int hex_gui_tab_newtofront;
int hex_gui_tab_pos; int hex_gui_tab_pos;
int hex_gui_tab_small; int hex_gui_tab_small;
@@ -289,6 +290,10 @@ struct zoitechatprefs
int hex_irc_join_delay; int hex_irc_join_delay;
int hex_irc_notice_pos; int hex_irc_notice_pos;
int hex_net_ping_timeout; int hex_net_ping_timeout;
int hex_net_lag_check;
int hex_net_keepalive_idle;
int hex_net_keepalive_interval;
int hex_net_keepalive_count;
int hex_net_proxy_port; int hex_net_proxy_port;
int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */ int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */
int hex_net_proxy_use; /* 0=all 1=IRC_ONLY 2=DCC_ONLY */ int hex_net_proxy_use; /* 0=all 1=IRC_ONLY 2=DCC_ONLY */

View File

@@ -305,12 +305,14 @@ static gboolean
tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv) tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
{ {
int direction = cv_scroll_direction (event); int direction = cv_scroll_direction (event);
int i;
if (prefs.hex_gui_tab_scrollchans) if (prefs.hex_gui_tab_scrollchans)
{ {
if (direction != 0) if (direction != 0)
{ {
mg_switch_page (1, direction); for (i = 0; i < cv_scroll_step_count (); i++)
mg_switch_page (1, direction);
return TRUE; return TRUE;
} }
} }
@@ -318,12 +320,14 @@ tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
{ {
if (direction < 0) if (direction < 0)
{ {
tab_scroll_left_up_clicked (widget, cv); for (i = 0; i < cv_scroll_step_count (); i++)
tab_scroll_left_up_clicked (widget, cv);
return TRUE; return TRUE;
} }
else if (direction > 0) else if (direction > 0)
{ {
tab_scroll_right_down_clicked (widget, cv); for (i = 0; i < cv_scroll_step_count (); i++)
tab_scroll_right_down_clicked (widget, cv);
return TRUE; return TRUE;
} }
} }

View File

@@ -112,9 +112,11 @@ cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user
if (prefs.hex_gui_tab_scrollchans) if (prefs.hex_gui_tab_scrollchans)
{ {
int direction = cv_scroll_direction (event); int direction = cv_scroll_direction (event);
int i;
if (direction != 0) if (direction != 0)
mg_switch_page (1, direction); for (i = 0; i < cv_scroll_step_count (); i++)
mg_switch_page (1, direction);
return direction != 0; return direction != 0;
} }

View File

@@ -126,6 +126,15 @@ cv_scroll_direction (GdkEventScroll *event)
} }
} }
static int
cv_scroll_step_count (void)
{
int speed = prefs.hex_gui_mouse_scroll_speed;
if (speed < 1)
speed = 1;
return (speed + 9) / 10;
}
/* ======= TABS ======= */ /* ======= TABS ======= */

View File

@@ -272,13 +272,6 @@ gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
theme_manager_apply_palette_widget (widget, bg, fg, font_desc); theme_manager_apply_palette_widget (widget, bg, fg, font_desc);
} }
static void
gtkutil_file_req_destroy (GtkWidget * wid, struct file_req *freq)
{
freq->callback (freq->userdata, NULL);
g_free (freq);
}
static void static void
gtkutil_check_file (char *filename, struct file_req *freq) gtkutil_check_file (char *filename, struct file_req *freq)
{ {
@@ -390,26 +383,6 @@ gtkutil_file_req_done_chooser (GtkFileChooser *fs, struct file_req *freq)
} }
static void
gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq)
{
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq);
gtk_widget_destroy (freq->dialog);
}
static void
gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
{
if (res == GTK_RESPONSE_ACCEPT)
{
gtkutil_file_req_done (dialog, freq);
return;
}
gtk_widget_destroy (dialog);
}
#ifdef WIN32
static gboolean static gboolean
gtkutil_native_dialog_unref_idle (gpointer native) gtkutil_native_dialog_unref_idle (gpointer native)
{ {
@@ -423,27 +396,16 @@ gtkutil_native_file_req_response (GtkNativeDialog *dialog, gint res, struct file
if (res == GTK_RESPONSE_ACCEPT) if (res == GTK_RESPONSE_ACCEPT)
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq); gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq);
/* Match gtk dialog flow by always sending NULL to indicate completion. */
freq->callback (freq->userdata, NULL); freq->callback (freq->userdata, NULL);
g_free (freq); g_free (freq);
/*
* Defer unref until idle to avoid disposing the native chooser while
* still in the button-release signal stack on Windows.
*/
g_idle_add (gtkutil_native_dialog_unref_idle, dialog); g_idle_add (gtkutil_native_dialog_unref_idle, dialog);
} }
#endif
void void
gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions, gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
int flags) int flags)
{ {
struct file_req *freq; struct file_req *freq;
GtkWidget *dialog;
GtkFileFilter *filefilter;
char *token;
char *tokenbuffer;
const char *xdir; const char *xdir;
GtkWindow *effective_parent = parent; GtkWindow *effective_parent = parent;
@@ -453,7 +415,6 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
xdir = get_xdir (); xdir = get_xdir ();
#ifdef WIN32
{ {
GtkFileChooserNative *native = gtk_file_chooser_native_new ( GtkFileChooserNative *native = gtk_file_chooser_native_new (
title, title,
@@ -529,107 +490,7 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native)); gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
return; return;
} }
#endif
if (flags & FRF_WRITE)
{
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
if (!(flags & FRF_NOASKOVERWRITE))
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
}
else
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_ACCEPT,
NULL);
theme_manager_attach_window (dialog);
if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
{
if (flags & FRF_WRITE)
{
char temp[1024];
path_part (filter, temp, sizeof (temp));
if (temp[0] && g_file_test (temp, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
}
else
{
if (g_file_test (filter, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
}
else if (!(flags & FRF_RECENTLYUSED))
{
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
if (flags & FRF_MULTIPLE)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
if (flags & FRF_CHOOSEFOLDER)
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if ((flags & FRF_EXTENSIONS || flags & FRF_MIMETYPES) && extensions != NULL)
{
filefilter = gtk_file_filter_new ();
tokenbuffer = g_strdup (extensions);
token = strtok (tokenbuffer, ";");
while (token != NULL)
{
if (flags & FRF_EXTENSIONS)
gtk_file_filter_add_pattern (filefilter, token);
else
gtk_file_filter_add_mime_type (filefilter, token);
token = strtok (NULL, ";");
}
g_free (tokenbuffer);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
}
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
{
GError *shortcut_error = NULL;
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), xdir, &shortcut_error);
if (shortcut_error)
g_error_free (shortcut_error);
}
freq = g_new (struct file_req, 1);
freq->dialog = dialog;
freq->flags = flags;
freq->callback = callback;
freq->userdata = userdata;
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (gtkutil_file_req_response), freq);
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
if (effective_parent)
gtk_window_set_transient_for (GTK_WINDOW (dialog), effective_parent);
if (flags & FRF_MODAL)
{
g_assert (effective_parent);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
}
gtk_widget_show (dialog);
} }
static gboolean static gboolean

View File

@@ -872,6 +872,10 @@ fe_set_title (session *sess)
static void static void
mg_topicbar_update_height (GtkWidget *topic); mg_topicbar_update_height (GtkWidget *topic);
static void
mg_topicbar_queue_relayout (GtkWidget *topic);
static void
mg_queue_window_relayout (GtkWidget *window);
static session * static session *
mg_session_from_window (GtkWidget *wid) mg_session_from_window (GtkWidget *wid)
@@ -891,6 +895,57 @@ mg_session_from_window (GtkWidget *wid)
return current_sess; return current_sess;
} }
static gboolean
mg_window_relayout_idle_cb (gpointer userdata)
{
GtkWidget *window = GTK_WIDGET (userdata);
session *sess;
g_object_set_data (G_OBJECT (window), "mg-window-relayout-source", NULL);
sess = mg_session_from_window (window);
if (sess && sess->gui)
{
if (GTK_IS_WIDGET (sess->gui->topic_entry))
mg_topicbar_queue_relayout (sess->gui->topic_entry);
if (GTK_IS_XTEXT (sess->gui->xtext))
{
gtk_xtext_refresh (GTK_XTEXT (sess->gui->xtext));
gtk_widget_queue_resize (sess->gui->xtext);
gtk_widget_queue_draw (sess->gui->xtext);
}
if (GTK_IS_WIDGET (sess->gui->window))
{
gtk_widget_queue_resize (sess->gui->window);
gtk_widget_queue_draw (sess->gui->window);
}
}
g_object_unref (window);
return G_SOURCE_REMOVE;
}
static void
mg_queue_window_relayout (GtkWidget *window)
{
guint source_id;
if (!window || !GTK_IS_WIDGET (window))
return;
if (g_object_get_data (G_OBJECT (window), "mg-window-relayout-source") != NULL)
return;
source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
mg_window_relayout_idle_cb,
g_object_ref (window),
NULL);
g_object_set_data (G_OBJECT (window), "mg-window-relayout-source",
GUINT_TO_POINTER (source_id));
}
static gboolean static gboolean
mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata) mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata)
{ {
@@ -939,18 +994,10 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
} }
sess = mg_session_from_window (GTK_WIDGET (wid)); sess = mg_session_from_window (GTK_WIDGET (wid));
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->topic_entry))
{
mg_topicbar_update_height (sess->gui->topic_entry);
gtk_widget_queue_draw (sess->gui->topic_entry);
}
if (sess && sess->gui && GTK_IS_XTEXT (sess->gui->xtext))
{
gtk_xtext_refresh (GTK_XTEXT (sess->gui->xtext));
gtk_widget_queue_draw (sess->gui->xtext);
}
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window)) if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window))
gtk_widget_queue_draw (sess->gui->window); mg_queue_window_relayout (sess->gui->window);
else
mg_queue_window_relayout (GTK_WIDGET (wid));
if (current_sess && current_sess->gui) if (current_sess && current_sess->gui)
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen); menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
@@ -1050,21 +1097,10 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
} }
target_sess = mg_session_from_window (wid); target_sess = mg_session_from_window (wid);
if (target_sess && target_sess->gui) if (target_sess && target_sess->gui && GTK_IS_WIDGET (target_sess->gui->window))
{ mg_queue_window_relayout (target_sess->gui->window);
if (GTK_IS_WIDGET (target_sess->gui->topic_entry)) else
{ mg_queue_window_relayout (wid);
mg_topicbar_update_height (target_sess->gui->topic_entry);
gtk_widget_queue_draw (target_sess->gui->topic_entry);
}
if (GTK_IS_XTEXT (target_sess->gui->xtext))
{
gtk_xtext_refresh (GTK_XTEXT (target_sess->gui->xtext));
gtk_widget_queue_draw (target_sess->gui->xtext);
}
if (GTK_IS_WIDGET (target_sess->gui->window))
gtk_widget_queue_draw (target_sess->gui->window);
}
return FALSE; return FALSE;
} }
@@ -2705,7 +2741,6 @@ mg_changui_destroy (session *sess)
/* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */ /* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */
/* assertion `GDK_IS_COLORMAP (cmap)' failed */ /* assertion `GDK_IS_COLORMAP (cmap)' failed */
ret = sess->gui->window; ret = sess->gui->window;
g_free (sess->gui);
sess->gui = NULL; sess->gui = NULL;
} }
return ret; return ret;
@@ -2727,13 +2762,17 @@ mg_link_irctab (session *sess, int focus)
return; return;
} }
session_gui *old_gui;
mg_unpopulate (sess); mg_unpopulate (sess);
old_gui = sess->gui;
win = mg_changui_destroy (sess); win = mg_changui_destroy (sess);
mg_changui_new (sess, sess->res, 1, focus); mg_changui_new (sess, sess->res, 1, focus);
/* the buffer is now attached to a different widget */ /* the buffer is now attached to a different widget */
((xtext_buffer *)sess->res->buffer)->xtext = (GtkXText *)sess->gui->xtext; ((xtext_buffer *)sess->res->buffer)->xtext = (GtkXText *)sess->gui->xtext;
if (win) if (win)
gtk_widget_destroy (win); gtk_widget_destroy (win);
g_free (old_gui);
} }
void void
@@ -3108,33 +3147,51 @@ mg_create_dialogbuttons (GtkWidget *box)
static void static void
mg_topicbar_update_height (GtkWidget *topic) mg_topicbar_update_height (GtkWidget *topic)
{ {
GtkWidget *scroller; GtkWidget *parent;
GtkWidget *grandparent;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter start; GtkTextIter start;
GtkTextIter end; GtkTextIter end;
GtkTextView *view;
PangoLayout *layout; PangoLayout *layout;
char *text; char *text;
int width; int width;
int line_height; int line_height;
int line_count; int line_count;
int target_height; int target_height;
int margin_left;
int margin_right;
int margin_top;
int margin_bottom;
int old_height;
PangoContext *context; PangoContext *context;
PangoFontMetrics *metrics; PangoFontMetrics *metrics;
if (!topic || !GTK_IS_TEXT_VIEW (topic)) if (!topic || !GTK_IS_TEXT_VIEW (topic))
return; return;
scroller = gtk_widget_get_parent (topic); view = GTK_TEXT_VIEW (topic);
parent = gtk_widget_get_parent (topic);
grandparent = parent ? gtk_widget_get_parent (parent) : NULL;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (topic)); margin_left = gtk_text_view_get_left_margin (view);
margin_right = gtk_text_view_get_right_margin (view);
margin_top = gtk_text_view_get_top_margin (view);
margin_bottom = gtk_text_view_get_bottom_margin (view);
buffer = gtk_text_view_get_buffer (view);
gtk_text_buffer_get_bounds (buffer, &start, &end); gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
layout = gtk_widget_create_pango_layout (topic, text && text[0] ? text : " "); layout = gtk_widget_create_pango_layout (topic, text && text[0] ? text : " ");
g_free (text); g_free (text);
width = gtk_widget_get_allocated_width (topic) - 8; width = gtk_widget_get_allocated_width (topic);
if (width > 0) if (width <= 1 && parent)
pango_layout_set_width (layout, width * PANGO_SCALE); width = gtk_widget_get_allocated_width (parent);
width -= margin_left + margin_right;
if (width < 1)
width = 1;
pango_layout_set_width (layout, width * PANGO_SCALE);
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
context = gtk_widget_get_pango_context (topic); context = gtk_widget_get_pango_context (topic);
@@ -3146,44 +3203,95 @@ mg_topicbar_update_height (GtkWidget *topic)
pango_font_metrics_unref (metrics); pango_font_metrics_unref (metrics);
if (line_height <= 0) if (line_height <= 0)
line_height = 16; line_height = 16;
line_count = pango_layout_get_line_count (layout); line_count = pango_layout_get_line_count (layout);
if (line_count <= 0) if (line_count <= 0)
line_count = 1; line_count = 1;
target_height = line_height * line_count;
if (target_height < line_height)
target_height = line_height;
gtk_widget_set_size_request (topic, -1, target_height); target_height = (line_height * line_count) + margin_top + margin_bottom;
if (scroller && GTK_IS_SCROLLED_WINDOW (scroller)) if (target_height < line_height + margin_top + margin_bottom)
target_height = line_height + margin_top + margin_bottom;
old_height = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (topic),
"mg-topicbar-target-height"));
if (old_height != target_height)
{ {
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), -1); g_object_set_data (G_OBJECT (topic), "mg-topicbar-target-height",
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), -1); GINT_TO_POINTER (target_height));
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), target_height); gtk_widget_set_size_request (topic, -1, target_height);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), target_height);
gtk_widget_set_size_request (scroller, -1, target_height); if (parent && GTK_IS_SCROLLED_WINDOW (parent))
gtk_widget_queue_resize (scroller); {
} gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), -1);
else gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), -1);
{ gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
gtk_widget_queue_resize (topic); gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
gtk_widget_set_size_request (parent, -1, target_height);
}
} }
gtk_widget_queue_resize (topic);
if (parent)
gtk_widget_queue_resize (parent);
if (grandparent)
gtk_widget_queue_resize (grandparent);
gtk_widget_queue_draw (topic); gtk_widget_queue_draw (topic);
g_object_unref (layout); g_object_unref (layout);
} }
static gboolean
mg_topicbar_relayout_idle_cb (gpointer userdata)
{
GtkWidget *topic = GTK_WIDGET (userdata);
g_object_set_data (G_OBJECT (topic), "mg-topicbar-relayout-source", NULL);
mg_topicbar_update_height (topic);
g_object_unref (topic);
return G_SOURCE_REMOVE;
}
static void
mg_topicbar_queue_relayout (GtkWidget *topic)
{
guint source_id;
if (!topic || !GTK_IS_TEXT_VIEW (topic))
return;
if (g_object_get_data (G_OBJECT (topic), "mg-topicbar-relayout-source") != NULL)
return;
source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
mg_topicbar_relayout_idle_cb,
g_object_ref (topic),
NULL);
g_object_set_data (G_OBJECT (topic), "mg-topicbar-relayout-source",
GUINT_TO_POINTER (source_id));
}
static void static void
mg_topicbar_buffer_changed_cb (GtkTextBuffer *buffer, gpointer userdata) mg_topicbar_buffer_changed_cb (GtkTextBuffer *buffer, gpointer userdata)
{ {
(void) buffer; (void) buffer;
mg_topicbar_update_height (GTK_WIDGET (userdata)); mg_topicbar_queue_relayout (GTK_WIDGET (userdata));
} }
static void static void
mg_topicbar_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer userdata) mg_topicbar_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer userdata)
{ {
(void) allocation; int old_width;
(void) userdata; (void) userdata;
mg_topicbar_update_height (widget);
old_width = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"mg-topicbar-allocated-width"));
if (allocation->width == old_width)
return;
g_object_set_data (G_OBJECT (widget), "mg-topicbar-allocated-width",
GINT_TO_POINTER (allocation->width));
mg_topicbar_queue_relayout (widget);
} }
void void
@@ -3468,7 +3576,7 @@ mg_create_infoframe (GtkWidget *box)
frame = gtk_frame_new (0); frame = gtk_frame_new (0);
gtk_frame_set_shadow_type ((GtkFrame*)frame, GTK_SHADOW_OUT); gtk_frame_set_shadow_type ((GtkFrame*)frame, GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 0);
hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0); hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_container_add (GTK_CONTAINER (frame), hbox);
@@ -3489,7 +3597,7 @@ mg_create_meters (session_gui *gui, GtkWidget *parent_box)
if ((prefs.hex_gui_lagometer & 2) || (prefs.hex_gui_throttlemeter & 2)) if ((prefs.hex_gui_lagometer & 2) || (prefs.hex_gui_throttlemeter & 2))
{ {
infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0); infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), infbox, 0, 0, 0); gtk_box_pack_start (GTK_BOX (box), infbox, 0, 0, 0);
} }

View File

@@ -193,6 +193,7 @@ static const setting appearance_advanced_settings[] =
{ST_HEADER, N_("Advanced"),0,0,0}, {ST_HEADER, N_("Advanced"),0,0,0},
{ST_EFILE, N_ ("Background image:"), P_OFFSETNL (hex_text_background), 0, 0, sizeof prefs.hex_text_background}, {ST_EFILE, N_ ("Background image:"), P_OFFSETNL (hex_text_background), 0, 0, sizeof prefs.hex_text_background},
{ST_HSCALE, N_("Window opacity:"), P_OFFINTNL(hex_gui_transparency),0,0,0}, {ST_HSCALE, N_("Window opacity:"), P_OFFINTNL(hex_gui_transparency),0,0,0},
{ST_HSCALE, N_("Mouse wheel scroll speed (Slower ← → Faster):"), P_OFFINTNL(hex_gui_mouse_scroll_speed), 0, 0, 100},
{ST_END, 0, 0, 0, 0, 0} {ST_END, 0, 0, 0, 0, 0}
}; };
@@ -582,6 +583,7 @@ static const setting advanced_settings[] =
{ST_TOGGLE, N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0}, {ST_TOGGLE, N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0},
{ST_TOGGLE, N_("Use server time if supported"), P_OFFINTNL(hex_irc_cap_server_time), N_("Display timestamps obtained from server if it supports the time-server extension."), 0, 0}, {ST_TOGGLE, N_("Use server time if supported"), P_OFFINTNL(hex_irc_cap_server_time), N_("Display timestamps obtained from server if it supports the time-server extension."), 0, 0},
{ST_TOGGLE, N_("Automatically reconnect to servers on disconnect"), P_OFFINTNL(hex_net_auto_reconnect), 0, 0, 1}, {ST_TOGGLE, N_("Automatically reconnect to servers on disconnect"), P_OFFINTNL(hex_net_auto_reconnect), 0, 0, 1},
{ST_NUMBER, N_("Lag check interval:"), P_OFFINTNL(hex_net_lag_check), 0, (const char **)N_("seconds."), 9999},
{ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999}, {ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999},
{ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999}, {ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999},
{ST_MENU, N_("Ban Type:"), P_OFFINTNL(hex_irc_ban_type), N_("Attempt to use this banmask when banning or quieting. (requires irc_who_join)"), bantypemenu, 0}, {ST_MENU, N_("Ban Type:"), P_OFFINTNL(hex_irc_ban_type), N_("Attempt to use this banmask when banning or quieting. (requires irc_who_join)"), bantypemenu, 0},
@@ -655,6 +657,11 @@ static const setting network_settings[] =
{ST_MENU, N_("Type:"), P_OFFINTNL(hex_net_proxy_type), 0, proxytypes, 0}, {ST_MENU, N_("Type:"), P_OFFINTNL(hex_net_proxy_type), 0, proxytypes, 0},
{ST_MENU, N_("Use proxy for:"), P_OFFINTNL(hex_net_proxy_use), 0, proxyuse, 0}, {ST_MENU, N_("Use proxy for:"), P_OFFINTNL(hex_net_proxy_use), 0, proxyuse, 0},
{ST_HEADER, N_("Connection Health"), 0, 0, 0, 0},
{ST_NUMBER, N_("TCP keepalive idle:"), P_OFFINTNL(hex_net_keepalive_idle), 0, (const char **)N_("seconds."), 7200},
{ST_NUMBER, N_("TCP keepalive interval:"), P_OFFINTNL(hex_net_keepalive_interval), 0, (const char **)N_("seconds."), 600},
{ST_NUMBER, N_("TCP keepalive probes:"), P_OFFINTNL(hex_net_keepalive_count), 0, 0, 20},
{ST_HEADER, N_("Proxy Authentication"), 0, 0, 0, 0}, {ST_HEADER, N_("Proxy Authentication"), 0, 0, 0, 0},
{ST_TOGGLE, N_("Use authentication (HTTP or SOCKS5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0}, {ST_TOGGLE, N_("Use authentication (HTTP or SOCKS5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0},
{ST_ENTRY, N_("Username:"), P_OFFSETNL(hex_net_proxy_user), 0, 0, sizeof prefs.hex_net_proxy_user}, {ST_ENTRY, N_("Username:"), P_OFFSETNL(hex_net_proxy_user), 0, 0, sizeof prefs.hex_net_proxy_user},

View File

@@ -2300,6 +2300,12 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
xtext->hilight_ent = NULL; xtext->hilight_ent = NULL;
} }
if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
return FALSE; return FALSE;
} }
@@ -2466,7 +2472,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
} }
if (xtext->urlcheck_function == NULL) if (xtext->urlcheck_function == NULL)
return FALSE; goto tooltip_check;
word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len); word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len);
if (word_type > 0) if (word_type > 0)
@@ -2504,6 +2510,46 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
return FALSE; return FALSE;
} }
tooltip_check:
if (xtext->buffer->time_stamp && xtext->buffer->indent > 0 && x >= 0 && x < xtext->stamp_width)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[96];
strftime_utf8 (tooltip, sizeof (tooltip), "%Y-%m-%d", ent->stamp);
gtk_widget_set_tooltip_text (widget, tooltip);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (!xtext->buffer->time_stamp && x >= xtext->buffer->indent)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && ent->stamp && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[128];
char date[64];
char *stamp_text;
strftime_utf8 (date, sizeof (date), "%Y-%m-%d", ent->stamp);
xtext_get_stamp_str (ent->stamp, &stamp_text);
g_snprintf (tooltip, sizeof (tooltip), "%s %s", date, stamp_text);
gtk_widget_set_tooltip_text (widget, tooltip);
g_free (stamp_text);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
gtk_xtext_leave_notify (widget, NULL); gtk_xtext_leave_notify (widget, NULL);
return FALSE; return FALSE;
@@ -2938,19 +2984,41 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
{ {
GtkXText *xtext = GTK_XTEXT (widget); GtkXText *xtext = GTK_XTEXT (widget);
gfloat new_value; gfloat new_value;
gfloat step;
gdouble dx;
gdouble dy;
int direction = 0;
int speed = prefs.hex_gui_mouse_scroll_speed;
if (event->direction == GDK_SCROLL_UP) /* mouse wheel pageUp */ if (speed < 1)
speed = 1;
step = (xtext_adj_get_page_increment (xtext->adj) * speed) / 100.0f;
if (event->direction == GDK_SCROLL_SMOOTH &&
gdk_event_get_scroll_deltas ((GdkEvent *)event, &dx, &dy))
{
if (dy > 0)
direction = 1;
else if (dy < 0)
direction = -1;
}
else if (event->direction == GDK_SCROLL_UP)
direction = -1;
else if (event->direction == GDK_SCROLL_DOWN)
direction = 1;
if (direction < 0)
{ {
new_value = xtext_adj_get_value (xtext->adj) - new_value = xtext_adj_get_value (xtext->adj) -
(xtext_adj_get_page_increment (xtext->adj) / 10); step;
if (new_value < xtext_adj_get_lower (xtext->adj)) if (new_value < xtext_adj_get_lower (xtext->adj))
new_value = xtext_adj_get_lower (xtext->adj); new_value = xtext_adj_get_lower (xtext->adj);
xtext_adj_set_value (xtext->adj, new_value); xtext_adj_set_value (xtext->adj, new_value);
} }
else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */ else if (direction > 0)
{ {
new_value = xtext_adj_get_value (xtext->adj) + new_value = xtext_adj_get_value (xtext->adj) +
(xtext_adj_get_page_increment (xtext->adj) / 10); step;
if (new_value > (xtext_adj_get_upper (xtext->adj) - if (new_value > (xtext_adj_get_upper (xtext->adj) -
xtext_adj_get_page_size (xtext->adj))) xtext_adj_get_page_size (xtext->adj)))
new_value = xtext_adj_get_upper (xtext->adj) - new_value = xtext_adj_get_upper (xtext->adj) -
@@ -2958,7 +3026,7 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
xtext_adj_set_value (xtext->adj, new_value); xtext_adj_set_value (xtext->adj, new_value);
} }
return FALSE; return direction != 0;
} }
static void static void

View File

@@ -190,6 +190,8 @@ struct _GtkXText
textentry *hilight_ent; textentry *hilight_ent;
int hilight_start; int hilight_start;
int hilight_end; int hilight_end;
time_t tooltip_stamp;
unsigned int tooltip_stamp_set:1;
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */ guint16 fontwidth[128]; /* each char's width, only the ASCII ones */