Date: Tue, 30 Nov 1999 15:21:35 -0600 From: Dan Nelson <dnelson@emsphone.com> To: Christian Weisgerber <naddy@mips.rhein-neckar.de> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Accessing sysmouse(4)? Message-ID: <19991130152135.B59749@dan.emsphone.com> In-Reply-To: <821asn$17d7$1@bigeye.rhein-neckar.de>; from "Christian Weisgerber" on Tue Nov 30 21:08:55 GMT 1999 References: <821asn$17d7$1@bigeye.rhein-neckar.de>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Nov 30), Christian Weisgerber said:
> Is there any real documentation or sample code to show how an
> application at the console can access sysmouse(4)?
>
> I'd like to add FreeBSD console mouse support to ports/audio/aumix,
> which already can make use of the mouse in xterm and on the Linux
> console.
The sysmouse manpage seems to be sufficient.
struct vid_info vi;
struct mouse_info mi;
vi.size = sizeof(vi);
if (ioctl(fileno(stdin), CONS_GETINFO, &vi) < 0)
err(1,"CONS_GETINFO");
printf ("%d x %d\n", vi.mv_csz, vi.mv_rsz);
mi.operation = MOUSE_GETINFO;
if (ioctl(fileno(stdin), CONS_MOUSECTL, &mi) < 0)
err(1,"CONS_MOUSECTL");
printf("%d %d %d\n", mi.u.data.x, mi.u.data.y, mi.u.data.buttons);
X and Y are in pixels, though, and I'm not sure how to ask the console
what its current resolution is. The CONS_GETINFO ioctl tells you the
size of the screen in characters (although you can get that info from
curses as well). Characters are always 8 pixels wide, but can be 8,
14, or 16 pixels tall depending on your video mode. I can't seem to
find an ioctl that'll tell me font height.
--
Dan Nelson
dnelson@emsphone.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991130152135.B59749>
