> On Tuesday, July 17, 2012 9:30:42 AM UTC-4, James McCoy wrote:
>
> > On Jul 17, 2012 6:47 AM, "Brian D. Burns" <bu...@iosctr.com> wrote:
> >
> > I've attached a new patch, with an updated test and Makefile which
> > includes tests using --remote-send and --remote-expr.
> >
> > Also, I've spent some time with gdb looking into this "missing event"
> > issue and I've determined what the root cause is.
> 
> This looks very similar to an issue xscreensaver used to have.  Maybe the 
> solution[0] I found for that can provide some inspiration.
> 
> [0]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486603#45
> 
> Cheers,
> James

Thanks James, it does appear similar.

Given that the current code expects FD_ISSET to be true if events are
waiting, the following should be equivalent to the commented portion:

if (ret >= 0 && xterm_Shell != (Widget)0)
{
    if (XtAppPending(app_context))
    {
        xterm_update();
        if (((ret == 1 && FD_ISSET(ConnectionNumber(xterm_dpy), &rfds))
            || ret == 0) && !input_available())
        {
            finished = FALSE;
        }
    }
}

/*
if (ret > 0 && xterm_Shell != (Widget)0
        && FD_ISSET(ConnectionNumber(xterm_dpy), &rfds))
{
    xterm_update();
    if (--ret == 0 && !input_available())
    {
        finished = FALSE;
    }
}
*/

However, when I use this, and remove the other "fixes":
- XCheckWindowEvent in ServerWait (when localLoop is FALSE)
- XCheckWindowEvent in serverPeekReply
(i.e. letting the call to xterm_update/XtAppPending trigger serverEventProc)
the test passes, but you have to tap ESC or something to get them to continue 
running.
The same is true for several of the other tests.

These are two new backtraces for calls to RealWaitForChar I see when applying 
these changes:

#0  RealWaitForChar (fd=0, msec=4000, check_for_gpm=0x0) at os_unix.c:4917
#1  0x0813f33b in WaitForChar (msec=4000) at os_unix.c:4870
#2  0x0813b5a7 in mch_inchar (buf=0x8245be7 "", maxlen=85, wtime=-1, 
tb_change_cnt=8) at os_unix.c:406
#3  0x081a57ce in ui_inchar (buf=0x8245be7 "", maxlen=85, wtime=-1, 
tb_change_cnt=8) at ui.c:193
#4  0x080d4914 in inchar (buf=0x8245be7 "", maxlen=257, wait_time=-1, 
tb_change_cnt=8) at getchar.c:3025
#5  0x080d45af in vgetorpeek (advance=1) at getchar.c:2800
#6  0x080d2bba in vgetc () at getchar.c:1582
#7  0x080d30d4 in safe_vgetc () at getchar.c:1787
#8  0x08115739 in normal_cmd (oap=0xbfffe968, toplevel=1) at normal.c:665
#9  0x081d5b3a in main_loop (cmdwin=0, noexmode=0) at main.c:1294
#10 0x081d5637 in main (argc=5, argv=0xbfffeb84) at main.c:998

#0  RealWaitForChar (fd=0, msec=-1, check_for_gpm=0x0) at os_unix.c:5244
#1  0x0813f33b in WaitForChar (msec=-1) at os_unix.c:4870
#2  0x0813b614 in mch_inchar (buf=0x8245be6 "", maxlen=86, wtime=-1, 
tb_change_cnt=7) at os_unix.c:436
#3  0x081a57ce in ui_inchar (buf=0x8245be6 "", maxlen=86, wtime=-1, 
tb_change_cnt=7) at ui.c:193
#4  0x080d4914 in inchar (buf=0x8245be6 "", maxlen=258, wait_time=-1, 
tb_change_cnt=7) at getchar.c:3025
#5  0x080d45af in vgetorpeek (advance=1) at getchar.c:2800
#6  0x080d2bba in vgetc () at getchar.c:1582
#7  0x080d30d4 in safe_vgetc () at getchar.c:1787
#8  0x08115739 in normal_cmd (oap=0xbfffe968, toplevel=1) at normal.c:665
#9  0x081d5b3a in main_loop (cmdwin=0, noexmode=0) at main.c:1294
#10 0x081d5637 in main (argc=5, argv=0xbfffeb84) at main.c:998

I'm guessing the extra events being dispatched must be causing this.
Stepping through the test doesn't work too well, but when I use the
commented (i.e. current) code above, along with the "fixes" in
ServerWait and serverPeekReply, I never see RealWaitForChar called with
anything other than msec=0.
The calls look more like this:

#0  RealWaitForChar (fd=0, msec=0, check_for_gpm=0x0) at os_unix.c:5254
#1  0x0813f2af in mch_breakcheck () at os_unix.c:4811
#2  0x081a593d in ui_breakcheck () at ui.c:367
#3  0x080d330d in vgetorpeek (advance=1) at getchar.c:2014
#4  0x080d2bba in vgetc () at getchar.c:1582
#5  0x080d30d4 in safe_vgetc () at getchar.c:1787
#6  0x080b5162 in getcmdline (firstc=58, count=1, indent=0) at ex_getln.c:360
#7  0x080b7fb2 in getexline (c=58, cookie=0x0, indent=0) at ex_getln.c:2155
#8  0x080a239d in do_cmdline (cmdline=0x0, fgetline=0x80b7f7a <getexline>, 
cookie=0x0, flags=0) at ex_docmd.c:1018
#9  0x0811ccb2 in nv_colon (cap=0xbfffe8c0) at normal.c:5404
#10 0x0811620b in normal_cmd (oap=0xbfffe968, toplevel=1) at normal.c:1193
#11 0x081d5b22 in main_loop (cmdwin=0, noexmode=0) at main.c:1294
#12 0x081d561f in main (argc=9, argv=0xbfffeb84) at main.c:998

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui