On Wed, 2006-03-22 at 11:29 -0800, Alan Coopersmith wrote:
> Erast Benson wrote:
> > This is a nice feature. But this is not what I wanted. I'd like to have
> > some way to distribute "cooked" mouse events to text only applications,
> > like screen, ncurses-based apps, generic console, etc.
>
> You'ld just need to put code into curses or another library to read the
> VUID events from /dev/mouse, which are pretty cooked already. All the
> details of handling USB vs. PS2 vs. SPARC serial mouse are hidden in the
> kernel modules, as is handling multiple mice in S10U1 & Nevada, and all
> you need to know is to open /dev/mouse and read the motion and button
> events.
>
> For example, if you look in Xorg 6.9's Solaris mouse code in
> xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c
> the event decoding is simply reading from /dev/mouse in chunks
> the size of the Firm_event defined in <sys/vuid_event.h> and
> parsing the simple event types:
>
> if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <=
> BUT_LAST)
> { /* button */
> int butnum = pVuidMse->event.id - BUT_FIRST;
>
> if (butnum < 3)
> butnum = 2 - butnum;
> if (!pVuidMse->event.value)
> buttons &= ~(1 << butnum);
> else
> buttons |= (1 << butnum);
> } else if (pVuidMse->event.id >= VLOC_FIRST &&
> pVuidMse->event.id <= VLOC_LAST) {
> /* axis */
> int delta = pVuidMse->event.value;
> switch(pVuidMse->event.id) {
> case LOC_X_DELTA:
> dx += delta;
> break;
> case LOC_Y_DELTA:
> dy -= delta;
> break;
> case LOC_X_ABSOLUTE:
> if (absXset) {
> vuidFlushAbsEvents(pInfo, absX, absY, &absXset,
> &absYset);
> }
> absX = delta;
> absXset = TRUE;
> break;
> case LOC_Y_ABSOLUTE:
> if (absYset) {
> vuidFlushAbsEvents(pInfo, absX, absY, &absXset,
> &absYset);
> }
> absY = delta;
> absYset = TRUE;
> break;
> }
> }
>
> Should be trivial to translate into the appropriate code in curses or similar
> libraries. There's even events for wheels on wheel mice.
Thanks a lot for explanation of implementation internals!
It seems like to make majority of console applications happy and avoid
their code modifications, we might want to add solaris support to gpm or
moused package.
Is somebody on the list willing to hack on it? I will be happy to try to
push a proposed solution to the next release of NexentaOS.
--
Erast
_______________________________________________
opensolaris-discuss mailing list
[email protected]