Ncurses - how do you get mousemask working?

R

Richard Lyman

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
 
P

Paul Duncan

--7lMq7vMTJT4tNk0a
Content-Type: multipart/mixed; boundary="7cm2iqirTL37Ot+N"
Content-Disposition: inline


--7cm2iqirTL37Ot+N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Richard Lyman ([email protected]) said:
I've tried... and I've looked around.
=20
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/ncu=
rses_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.0000000=
00 -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?",


--=20
Paul Duncan <[email protected]> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

--7cm2iqirTL37Ot+N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ncurses-ruby-0.9.2-mousemask_fix.diff"

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?",

--7cm2iqirTL37Ot+N--

--7lMq7vMTJT4tNk0a
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFDne05zdlT34LClWIRAg85AKDBHg57UPStksVrCH9L1UQB5ENr5QCfXSeA
4tfdjRUtEnIHSA1oF/FfalY=
=WzOs
-----END PGP SIGNATURE-----

--7lMq7vMTJT4tNk0a--
 
P

Paul Duncan

--CxDuMX1Cv2n9FQfo
Content-Type: multipart/mixed; boundary="o7gdRJTuwFmWapyH"
Content-Disposition: inline


--o7gdRJTuwFmWapyH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Paul Duncan ([email protected]) said:
* Richard Lyman ([email protected]) said:
I've tried... and I've looked around.
=20
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.
=20
They couldn't
=20
Is this feature not functional?
=20
It's a bug in the method definition; see below.
=20
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... :)
=20
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).
=20
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.000=
000000 -0500
@@ -2387,7 +2387,7 @@
NCFUNC(ungetmouse, 1);
#endif
#ifdef HAVE_MOUSEMASK
- NCFUNC(mousemask, 1);
+ NCFUNC(mousemask, 2);
#endif
#ifdef HAVE_WENCLOSE
rb_define_module_function(mNcurses, "wenclose?",
Apply this patch (also attached):
=20
diff -ur ncurses-ruby-0.9.2/ncurses_wrap.c ncurses-ruby-0.9.2-mousemask/n= curses_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.00000= 0000 -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?",
=20
=20
--=20
Paul Duncan <[email protected]> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562
diff -ur ncurses-ruby-0.9.2/ncurses_wrap.c ncurses-ruby-0.9.2-mousemask/n= curses_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.00000= 0000 -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?",




--=20
Paul Duncan <[email protected]> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

--o7gdRJTuwFmWapyH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ncurses-ruby-0.9.2-mousemask_fix.diff"

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);
#endif
#ifdef HAVE_WENCLOSE
rb_define_module_function(mNcurses, "wenclose?",

--o7gdRJTuwFmWapyH--

--CxDuMX1Cv2n9FQfo
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFDne8VzdlT34LClWIRAiJPAJ0UVgMRIAzGIqZP7nAnfv1q614+qwCfUwlW
JatCBQt38SWXpeZ0YBlUQrg=
=Hsul
-----END PGP SIGNATURE-----

--CxDuMX1Cv2n9FQfo--
 
R

Richard Lyman

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
 
T

Thomas Dickey

Richard Lyman said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,048
Members
47,646
Latest member
xayaci5906

Latest Threads

Top