tmux doesn't support \033[?1001s, adding that may be enough

if not then ncurses needs to tell tmux it is using the mouse like
ncmpcpp is doing, are you sure it isn't sending \033[?1000h? (run one of
the applications in script, or use tmux logging to see)


On Fri, Jun 03, 2011 at 04:08:04PM +0200, marcel partap wrote:
> >haven't got time to look into this really, but it is on the pile in my
> >inbox so if nobody else does I'll get to it after this week
> Ok i have wasted couple of hours investigating this and conclusion
> is as follows.
> If any mouse-interactivity feature (f.e. mouse-select-pane) is
> turned on (and, in this case, multiple panes exists), Tmux checks
> for 'kmous' in the termcap, then directly uses the 'Xterm Control
> Sequences', i.e. it sends f.e. an "enable SET_VT200_MOUSE" escape
> sequence down the iostream as in
> >if (mode & MODE_MOUSE_STANDARD)
> >    tty_puts(tty, "\033[?1000h");
> which tells the terminal emulator to communicate button
> press/release events via special ESC sequences, which tmux in turn
> catches and parses. This however prevents SOME applications running
> inside tmux from doing the same - only when tmux disables mouse
> event tracking
> >if (tty->mode & MODE_MOUSE_STANDARD)
> >    tty_puts(tty, "\033[?1000l");
> >if (tty->mode & MODE_MOUSE_UTF8) // SET_EXT_MODE_MOUSE, uses UTF8 for bigger 
> >[x,y] coordinate space
> >    tty_puts(tty, "\033[?1005l");
> mouse scrolling f.e. in _less_ and _bash_ history does work. For
> those two, i tried to find out HOW they implement mouse support but
> could not find any trace in the code which suggests this magically
> comes 'for free' from _ncurses_ compiled with support for the _gpm_
> console mouse driver, which (just for reference) defines in gpm.h:
> >#define GPM_XTERM_ON \
> >  printf("%c[?1001s",27), fflush(stdout), /* save old hilit tracking */ \
> >  printf("%c[?1000h",27), fflush(stdout)  /* enable mouse tracking */
> 
> The ncurses docs state about mouse support:
> >  Mouse Interfacing
> >
> >   The ncurses library also provides a mouse interface.
> >
> >     NOTE:  this  facility  is  specific  to  ncurses, it is not part of
> >     either  the XSI Curses standard, nor of System V Release 4, nor BSD
> >     curses.  System  V  Release  4  curses  contains  code with similar
> >     interface  definitions, however it is not documented. Other than by
> >     disassembling  the library, we have no way to determine exactly how
> >     that   mouse   code   works.  Thus,  we  recommend  that  you  wrap
> >     mouse-related   code   in   an   #ifdef  using  the  feature  macro
> >     NCURSES_MOUSE_VERSION  so  it  will  not  be compiled and linked on
> >     non-ncurses systems.
> >
> >   Presently, mouse event reporting works in the following environments:
> >     * xterm and similar programs such as rxvt.
> >     * Linux  console,  when  configured with gpm(1), Alessandro Rubini's
> >       mouse server.
> >     * FreeBSD sysmouse (console)
> >     * OS/2 EMX
> >
> >   The  mouse  interface  is  very  simple.  To  activate it, you use the
> >   function  mousemask(),  passing  it  as first argument a bit-mask that
> >   specifies  what  kinds  of  events you want your program to be able to
> >   see.  It  will  return  the  bit-mask  of  events that actually become
> >   visible, which may differ from the argument if the mouse device is not
> >   capable of reporting some of the event types you specify.
> >
> >   Once the mouse is active, your application's command loop should watch
> >   for  a  return  value of KEY_MOUSE from wgetch(). When you see this, a
> >   mouse  event report has been queued. To pick it off the queue, use the
> >   function  getmouse()  (you  must  do  this  before  the next wgetch(),
> >   otherwise  another  mouse  event  might come in and make the first one
> >   inaccessible).
> However, as mentioned, less and bash do not seem to have any code
> explicitly activating ncurses mouse support. And, if tmux is
> tracking mouse events, their mouse scrolling is dead.
> An application that DOES use the above ncurses method is my favorite
> music player [..daemon client..]. From ncmpcpp.cpp:
> >     MEVENT mouse_event;
> >     mouseinterval(0);
> >     if (Config.mouse_support)
> >             mousemask(ALL_MOUSE_EVENTS, 0);
> And this one is able to receive mouse events even when tmux is
> tracking them aswell!
> 
> 
> ...So0Oo.. what do we make from this? Well, firstly, the problem is
> non-trivial ^^
> Secondly, there may be two options: figure out if bash/less mouse
> support can be made more robust like ncmpcpp's and push patches
> upstream. Or to try and add ncurses mouse support
> (http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/mouse.html) to tmux
> and test if that solves the problem.
> And now i definitly should do some work on my engineering project x)
> #regards/marcel.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to