On Wed, 19 Mar 2008, Simon Kuhnle wrote:
On Tue, Mar 18, 2008 at 10:02:52PM +0100, Markus Hennecke wrote:
[...]
You could manually enable it for your system in that file, but I don't know
what else could break. Another solution would be to handle SIGWINCH in
mcabber itself. I think I will take a look into that.
How hard would it be to do that?
It would be nice to have a somewhat cleaner approach to this problem
than my patch does it ;-)
Could you take a look at the attached patch file and try the port with the
patch applied? For me it will fix the resizing issues. All it does is to
act on the SIGWINCH, read the terminal size via ioctl and tell the ncurses
lib the new terminal size. Keycodes for KEY_RESIZE and ctrl-l are injected
so that the screen is redrawn. I don't think that this hack will make it
upstream, but it is something to start with.
I tried that patch and mcabber built and installed fine for me.
The resizing works too, but only if I resize my terminal a little bit.
But if I shrink and maximize it really fast many times,
I get a segmentation fault.
I rebuilt mcabber with "-O0 -g" again. Here's the backtrace:
Core was generated by `mcabber'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libglib-2.0.so.1400.3...done.
Loaded symbols for /usr/local/lib/libglib-2.0.so.1400.3
Reading symbols from /usr/local/lib/libintl.so.4.0...done.
Loaded symbols for /usr/local/lib/libintl.so.4.0
Reading symbols from /usr/local/lib/libiconv.so.4.0...done.
Loaded symbols for /usr/local/lib/libiconv.so.4.0
Reading symbols from /usr/local/lib/libgpgme.so.17.0...done.
Loaded symbols for /usr/local/lib/libgpgme.so.17.0
Reading symbols from /usr/local/lib/libgpg-error.so.2.0...done.
Loaded symbols for /usr/local/lib/libgpg-error.so.2.0
Reading symbols from /usr/local/lib/libotr.so.3.1...done.
Loaded symbols for /usr/local/lib/libotr.so.3.1
Reading symbols from /usr/lib/libssl.so.11.0...done.
Loaded symbols for /usr/lib/libssl.so.11.0
Reading symbols from /usr/lib/libcrypto.so.13.0...done.
Loaded symbols for /usr/lib/libcrypto.so.13.0
Reading symbols from /usr/lib/libpanel.so.3.0...done.
Loaded symbols for /usr/lib/libpanel.so.3.0
Reading symbols from /usr/lib/libncurses.so.10.0...done.
Loaded symbols for /usr/lib/libncurses.so.10.0
Reading symbols from /usr/lib/libc.so.43.0...done.
Loaded symbols for /usr/lib/libc.so.43.0
Reading symbols from /usr/local/lib/libpcre.so.2.1...done.
Loaded symbols for /usr/local/lib/libpcre.so.2.1
Reading symbols from /usr/local/lib/libgcrypt.so.13.0...done.
Loaded symbols for /usr/local/lib/libgcrypt.so.13.0
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0 0x000000004ee325d4 in TransformLine (lineno=18) at
/usr/src/lib/libcurses/tty/tty_update.c:1244
1244 memcpy(oldLine + firstChar,
(gdb) bt
#0 0x000000004ee325d4 in TransformLine (lineno=18) at
/usr/src/lib/libcurses/tty/tty_update.c:1244
#1 0x000000004ee31c95 in doupdate () at
/usr/src/lib/libcurses/tty/tty_update.c:746
#2 0x00000000004240ef in scr_DoUpdate () at screen.c:3681
#3 0x000000000040a19e in jb_main () at jabglue.c:278
#4 0x000000000040703b in main (argc=1, argv=0x7f7ffffe5320) at main.c:511
I'm running mcabber on amd64, in screen (problem happens without screen, too)
in rxvt
on OpenBSD 4.3-beta (GENERIC) #1346: Thu Feb 21 15:40:59 MST 2008 machine.
Can you reproduce this?
Unfortunately I can't resize the xterms here that fast. But I think the
last patch was not right. Could you retry these two patch files and
report back?
Kind regards,
Markus
$OpenBSD$
--- src/main.c.orig Sun Jan 13 11:36:27 2008
+++ src/main.c Wed Mar 19 18:56:44 2008
@@ -210,6 +210,10 @@ void sig_handler(int signum)
mcabber_terminate("Killed by SIGTERM");
} else if (signum == SIGINT) {
mcabber_terminate("Killed by SIGINT");
+#ifdef __OpenBSD__
+ } else if (signum == SIGWINCH) {
+ ungetch(KEY_RESIZE);
+#endif
} else {
scr_LogPrint(LPRINT_LOGNORM, "Caught signal: %d", signum);
}
@@ -364,6 +368,9 @@ int main(int argc, char **argv)
signal(SIGTERM, sig_handler);
signal(SIGINT, sig_handler);
signal(SIGCHLD, sig_handler);
+#ifdef __OpenBSD__
+ signal(SIGWINCH, sig_handler);
+#endif
signal(SIGPIPE, SIG_IGN);
/* Parse command line options */
$OpenBSD$
--- src/screen.c.orig Wed Mar 19 18:38:32 2008
+++ src/screen.c Wed Mar 19 18:58:50 2008
@@ -29,6 +29,9 @@
#include <config.h>
#include <locale.h>
#include <assert.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <unistd.h>
#ifdef HAVE_LOCALCHARSET_H
# include <localcharset.h>
@@ -3765,7 +3768,18 @@ void process_key(keycode kcode)
scr_handle_CtrlC();
break;
case KEY_RESIZE:
+#ifdef __OpenBSD__
+ {
+ struct winsize size;
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &size) != -1) {
+ resizeterm(size.ws_row, size.ws_col);
+ }
+ }
scr_Resize();
+ process_command(mkcmdstr("screen_refresh"), TRUE);
+#else
+ scr_Resize();
+#endif
break;
default:
display_char = TRUE;