bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read mouse position beyond column 256 ?


From: Patrick
Subject: Re: read mouse position beyond column 256 ?
Date: Wed, 01 Oct 2014 22:51:08 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Hi

I am just digging up an old thread I started this past February.

I am badly overloaded and I don't want to make promises I can't keep but I was just wondering....

I was thinking that if it was not too hard I could to modify ncurses to read beyond row-col 223. Is this code in lib_mouse ? I don't understand the code but it's just over 1500 lines, so it's in the range of possibility for me. Is the ncurses codebase very intertwined or is it fairly easy to understand files like this without understanding the whole codebase?

Would this pretty much be a case of changing a short to an int and than compensating for the change elsewhere ?

-Patrick





On 14-02-20 09:37 AM, Egmont Koblinger wrote:
Hi Patrick,

I guess with most terminals the limit is the 223rd row-column.  (It
might be 255 with certain terminals, I'm not sure.)  This is due to
the limitations of the legacy mouse protocol used by the terminals
(row and column encoded in single bytes).

The recent SGR 1006 mouse extension allows arbitrary coordinates to be
reported.  Most terminal emulators already support it, and so do quite
a few applications (vim, emacs, tmux, mc, links, ...).  They handle
mouse their own way, rather than via getmouse().  Unfortunately, the
ncurses library doesn't support this extension yet.

I've already asked Thomas to implement it, it must be somewhere on his
TODO list.  When enabling mouse with ncurses, it should also
automatically transparently enable the extension.  Terminals that
don't support it will silently ignore this request and keep reporting
the coordinates using the old method.  Terminals that do support it
will report coordinates using the new method.  The old and new methods
are perfectly distinguishable, so it'll work no matter if the terminal
supports the extension or not.  (Of course, if it doesn't support it,
you'll get coordinates up to 223 only.)  This change would be totally
transparent towards ncurses applications (no API/ABI change), and
would automatically fix mouse handling in all applications that use
getmouse() (like htop, lynx, and probably many more).


egmont

On Thu, Feb 20, 2014 at 3:22 PM, Patrick <address@hidden> wrote:
Hi Everyone

I am trying to read the co-ordinates of a graphics tablet. I could read the
X Y position with a GUi toolkit but I would strongly prefer ncurses.

I can't seem to read past 250 something or so. I am guessing that the
locations may be stored as short types

At the end of the email is a sample program from Gookin's Programmers Guide
To Ncurses.

I changed the #include to link to ncursesw in the hopes that it would
support columns beyond 256 but it does not seem to.

I compiled it with this:

gcc mevent.c -o debug `ncursesw5-config --cflags --libs`

If anyone could lend a hand I would really appreciate it-Patrick



#include <ncursesw/ncurses.h>

int main(void)
{
     MEVENT mwhat;
     int ch;

     initscr();
     noecho();
     keypad(stdscr,TRUE);

     mousemask(ALL_MOUSE_EVENTS,NULL);

     while(1)
     {
         ch = getch();
         if( ch == KEY_MOUSE )
         {
             getmouse(&mwhat);
             move(0,0);
             clrtoeol();
             printw("%2d %2d",mwhat.y,mwhat.x);
             refresh();
             continue;
         }
         if( ch == '\n' )
             break;
     }

     endwin();


     return 0;
}

_______________________________________________
Bug-ncurses mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-ncurses




reply via email to

[Prev in Thread] Current Thread [Next in Thread]