Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ncurses - how do you get mousemask working?

16 views
Skip to first unread message

Richard Lyman

unread,
Dec 10, 2005, 3:52:11 PM12/10/05
to
I've tried... and I've looked around.

A few other projects have the line with 'Ncurses::mousemask...' in
them - but it's always commented out... like they couldn't get it
working either.

Is this feature not functional?

I've currently got 'Ncurses::mousemask(Ncurses::ALL_MOUSE_EVENTS,[])'
and the error 'wrong number of arguments (2 for 1)' and as soon as I
drop the second arg I get the error 'oldmask (2nd argument) must be an
empty Array' which is kinda bothersome... :-)

Any hints? Tobias?

-Rich


Paul Duncan

unread,
Dec 12, 2005, 4:36:01 PM12/12/05
to
* Richard Lyman (lym...@gmail.com) wrote:
> I've tried... and I've looked around.
>
> A few other projects have the line with 'Ncurses::mousemask...' in
> them - but it's always commented out... like they couldn't get it
> working either.

They couldn't

> Is this feature not functional?

It's a bug in the method definition; see below.

> I've currently got 'Ncurses::mousemask(Ncurses::ALL_MOUSE_EVENTS,[])'
> and the error 'wrong number of arguments (2 for 1)' and as soon as I
> drop the second arg I get the error 'oldmask (2nd argument) must be an
> empty Array' which is kinda bothersome... :-)

It's a bug in the library. It's been there forever (I came across it
when I was trying to add mouse support to Raggle, then just forgot to
send a patch upstream).

> Any hints? Tobias?

Apply this patch (also attached):

diff -ur ncurses-ruby-0.9.2/ncurses_wrap.c ncurses-ruby-0.9.2-mousemask/ncurses_wrap.c
--- ncurses-ruby-0.9.2/ncurses_wrap.c 2005-12-12 16:33:00.000000000 -0500
+++ ncurses-ruby-0.9.2-mousemask/ncurses_wrap.c 2005-02-26 19:22:13.000000000 -0500
@@ -2387,7 +2387,7 @@
NCFUNC(ungetmouse, 1);
#endif
#ifdef HAVE_MOUSEMASK
- NCFUNC(mousemask, 2);
+ NCFUNC(mousemask, 1);
#endif
#ifdef HAVE_WENCLOSE
rb_define_module_function(mNcurses, "wenclose?",


--
Paul Duncan <pa...@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

ncurses-ruby-0.9.2-mousemask_fix.diff
signature.asc

Paul Duncan

unread,
Dec 12, 2005, 4:43:56 PM12/12/05
to
* Paul Duncan (pa...@pablotron.org) wrote:
> * Richard Lyman (lym...@gmail.com) wrote:
> > I've tried... and I've looked around.
> >
> > A few other projects have the line with 'Ncurses::mousemask...' in
> > them - but it's always commented out... like they couldn't get it
> > working either.
>
> They couldn't
>
> > Is this feature not functional?
>
> It's a bug in the method definition; see below.
>
> > I've currently got 'Ncurses::mousemask(Ncurses::ALL_MOUSE_EVENTS,[])'
> > and the error 'wrong number of arguments (2 for 1)' and as soon as I
> > drop the second arg I get the error 'oldmask (2nd argument) must be an
> > empty Array' which is kinda bothersome... :-)
>
> It's a bug in the library. It's been there forever (I came across it
> when I was trying to add mouse support to Raggle, then just forgot to
> send a patch upstream).
>
> > Any hints? Tobias?

Err, my patch is backwards... Here's the correct one (again, attached):

diff -ur ncurses-ruby-0.9.2/ncurses_wrap.c ncurses-ruby-0.9.2-mousemask_fix/ncurses_wrap.c
--- ncurses-ruby-0.9.2/ncurses_wrap.c 2005-02-26 19:22:13.000000000 -0500
+++ ncurses-ruby-0.9.2-mousemask_fix/ncurses_wrap.c 2005-12-12 16:42:11.000000000 -0500


@@ -2387,7 +2387,7 @@
NCFUNC(ungetmouse, 1);
#endif
#ifdef HAVE_MOUSEMASK

- NCFUNC(mousemask, 1);
+ NCFUNC(mousemask, 2);

ncurses-ruby-0.9.2-mousemask_fix.diff
signature.asc

Richard Lyman

unread,
Dec 13, 2005, 1:12:43 PM12/13/05
to
Thanks for the reply, but I think I'm going to move away from
ncurses... you can't get CTRL-<Arrow> to be unique can you? I haven't
found anywhere in the docs where it allows you to detect the CTRL key
on it's own.

If you can't, then that's the straw that breaks it.

Again - thanks for the reply.

-Rich


Thomas Dickey

unread,
Dec 14, 2005, 6:07:07 AM12/14/05
to
Richard Lyman <lym...@gmail.com> wrote:
> Thanks for the reply, but I think I'm going to move away from
> ncurses... you can't get CTRL-<Arrow> to be unique can you? I haven't
> found anywhere in the docs where it allows you to detect the CTRL key
> on it's own.

That's a terminal-dependent feature. If the terminal supports it,
one can write a terminfo that describes it (as a function-key).
(n)curses supports up to 60 function keys (which you would probably
find too limiting ;-)

bye.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

0 new messages