From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19386 invoked from network); 5 Dec 2007 14:58:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Dec 2007 14:58:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 57319 invoked from network); 5 Dec 2007 14:58:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Dec 2007 14:58:07 -0000 Received: (qmail 26428 invoked by alias); 5 Dec 2007 14:58:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24161 Received: (qmail 26409 invoked from network); 5 Dec 2007 14:58:02 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Dec 2007 14:58:02 -0000 Received: (qmail 56900 invoked from network); 5 Dec 2007 14:58:02 -0000 Received: from cluster-g.mailcontrol.com (85.115.41.190) by a.mx.sunsite.dk with SMTP; 5 Dec 2007 14:57:55 -0000 Received: from rly18g.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly18g.srv.mailcontrol.com (MailControl) with ESMTP id lB5EvkQX011813 for ; Wed, 5 Dec 2007 14:57:47 GMT Received: from submission.mailcontrol.com (submission.mailcontrol.com [86.111.216.190]) by rly18g.srv.mailcontrol.com (MailControl) id lB5EuqDF006402 for zsh-workers@sunsite.dk; Wed, 5 Dec 2007 14:56:52 GMT Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly18g-eth0.srv.mailcontrol.com (envelope-sender Peter.Stephenson@csr.com) (MIMEDefang) with ESMTP id lB5EsDZY025780; Wed, 05 Dec 2007 14:56:52 +0000 (GMT) Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Wed, 5 Dec 2007 14:56:28 +0000 Date: Wed, 5 Dec 2007 14:56:27 +0000 From: Peter Stephenson To: nico@codernet.org (Nico R. Wohlgemuth), zsh-workers@sunsite.dk Subject: Re: Strange bug with tiling wm, urxvt and zsh Message-ID: <20071205145627.71476067@news01> In-Reply-To: <20071205141643.GA19714@codernet.org> References: <20071205141643.GA19714@codernet.org> Organization: CSR X-Mailer: Claws Mail 3.0.2 (GTK+ 2.10.14; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Dec 2007 14:56:28.0253 (UTC) FILETIME=[039B90D0:01C8374F] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.71.1.128 On Wed, 5 Dec 2007 15:16:44 +0100 nico@codernet.org (Nico R. Wohlgemuth) wrote: > Everytime I open a window it gets resized to fit the screen (which is > the job of a tiling wm). Now, If I open a terminal window, dwm resizes it > directly to fit the screen - after that the first prompt I get is > 'unusable'. ... > I have tested a bit around and someone from #zsh gave me a dirty hack to > bypass this behaviour: "sleep 0.1 && kill -SIGWINCH $$" at the end of the > .zshrc - which works but is very dirty and only a termporaly solution for > this. (Moved to zsh-workers; I don't think there are any user-serviceable parts inside.) If this fixes the problem, it means zsh isn't receiving or (more likely) handling a SIGWINCH generated while it's starting up which is when the window is resized. Can you try the following patch? I'm not entirely sure of its possible ramifications (though it doesn't look like it should cause new problems) but it would at least be useful to find out if it helps. Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.172 diff -u -r1.172 utils.c --- Src/utils.c 3 Dec 2007 22:46:11 -0000 1.172 +++ Src/utils.c 5 Dec 2007 14:48:44 -0000 @@ -1506,12 +1506,12 @@ /* check the size of the window and adjust if necessary. * * The value of from: * * 0: called from update_job or setupvals * - * 1: called from the SIGWINCH handler * + * 1: called from the SIGWINCH handler (or faked) * * 2: called from the LINES parameter callback * * 3: called from the COLUMNS parameter callback */ /**/ -void +mod_export void adjustwinsize(int from) { static int getwinsz = 1; Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.100 diff -u -r1.100 zle_main.c --- Src/Zle/zle_main.c 19 Oct 2007 01:33:09 -0000 1.100 +++ Src/Zle/zle_main.c 5 Dec 2007 14:48:44 -0000 @@ -1106,6 +1106,22 @@ if (termflags & TERM_UNKNOWN) init_term(); } +#ifdef TIOCGWINSZ + { + struct winsize winsize; + /* + * We may not handle window changes that happened while the + * shell was starting up. Just before we draw the prompt, + * do this fairly cheap test to see if we need to fake a + * SIGWINCH. + */ + if (ioctl(SHTTY, TIOCGWINSZ, (char *)&winsize) == 0) { + if (shttyinfo.winsize.ws_row != winsize.ws_row || + shttyinfo.winsize.ws_col != winsize.ws_col) + adjustwinsize(1); + } + } +#endif fflush(shout); fflush(stderr); -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070