groff 1.23.0 added .MR to its -man macro package. The NEWS file states
that the inclusion of the macro "was prompted by its introduction to
Plan 9 from User Space's troff in August 2020." From d32deab it seems
that the name for Plan 9 from User Space's implementation was suggested
by groff maintainer G. Brandon Robinson.
Not sure if the intention was to make these definitions compatible, but
it would be nice if they were.
Currently, Plan 9 from User Space's .MR expects its second argument to
be parenthesized. groff's .MR does not. This results in extra
parentheses appearing in manual references when viewing Plan 9 from User
Space's manual pages on a system using groff.
97 lines
1.9 KiB
Groff
97 lines
1.9 KiB
Groff
.TH KEYBOARD 3
|
|
.SH NAME
|
|
initkeyboard, ctlkeyboard, closekeyboard \- keyboard control
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B
|
|
#include <u.h>
|
|
.B
|
|
#include <libc.h>
|
|
.B
|
|
#include <thread.h>
|
|
.B
|
|
#include <keyboard.h>
|
|
.PP
|
|
.B
|
|
Keyboardctl *initkeyboard(char *file)
|
|
.PP
|
|
.B
|
|
int ctlkeyboard(Keyboardctl *kc, char *msg)
|
|
.PP
|
|
.B
|
|
void closekeyboard(Keyboard *kc)
|
|
.SH DESCRIPTION
|
|
These functions access and control a keyboard interface
|
|
for character-at-a-time I/O in a multi-threaded environment, usually in combination with
|
|
.MR mouse 3 .
|
|
They use the message-passing
|
|
.B Channel
|
|
interface in the threads library
|
|
(see
|
|
.MR thread 3 );
|
|
programs that wish a more event-driven, single-threaded approach should use
|
|
.MR event 3 .
|
|
.PP
|
|
.I Initkeyboard
|
|
opens a connection to the keyboard and returns a
|
|
.B Keyboardctl
|
|
structure:
|
|
.IP
|
|
.EX
|
|
.ta 6n +\w'Channel 'u +\w'consfd; 'u
|
|
typedef struct Keyboardct Keyboardctl;
|
|
struct Keyboardctl
|
|
{
|
|
Channel *c; /* chan(Rune[20]) */
|
|
|
|
char *file;
|
|
int consfd; /* to cons file */
|
|
int ctlfd; /* to ctl file */
|
|
int pid; /* of slave proc */
|
|
};
|
|
.EE
|
|
.PP
|
|
The argument to
|
|
.I initkeyboard
|
|
is ignored
|
|
(on Plan 9, it is the name of the keyboard device).
|
|
.PP
|
|
Once the
|
|
.B Keyboardctl
|
|
is set up a
|
|
message containing a
|
|
.BR Rune
|
|
will be sent on the
|
|
.B Channel
|
|
.B Keyboardctl.c
|
|
to report each character read from the device.
|
|
.PP
|
|
.I Ctlkeyboard
|
|
is used to set the state of the interface, typically to turn raw mode on and off.
|
|
.\" (see
|
|
.\" .IR cons (3)).
|
|
It writes the string
|
|
.I msg
|
|
to the control file associated with the device, which is assumed to be the regular device file name
|
|
with the string
|
|
.B ctl
|
|
appended.
|
|
.PP
|
|
.I Closekeyboard
|
|
closes the file descriptors associated with the keyboard, kills the slave processes,
|
|
and frees the
|
|
.B Keyboardctl
|
|
structure.
|
|
.PP
|
|
.SH SOURCE
|
|
.B \*9/src/libdraw
|
|
.SH SEE ALSO
|
|
.MR graphics 3 ,
|
|
.MR draw 3 ,
|
|
.MR event 3 ,
|
|
.MR thread 3 .
|
|
.SH BUGS
|
|
Because the interface delivers complete runes,
|
|
there is no way to report lesser actions such as
|
|
shift keys or even individual bytes.
|