212 lines · 4.2 KB · Text
RawDownload
.TH MOUSE 3.SH NAMEmouse, cursor \- kernel mouse interface.SH SYNOPSIS.nf.B bind -a #m /dev .B /dev/mouse.B /dev/mousein.B /dev/mousectl.B /dev/cursor.fi.SH DESCRIPTIONThe.I mousedevice provides an interface to the mouse.There is also a cursor associated with the screen;it is always displayed at the current mouse position..PPReading the.B mousefile returns the mouse status: its position and button state.The read blocks until the state has changed since the last read.The read returns 49 bytes: the letter.B mfollowed by four decimal strings, each 11 characterswide followed by a blank:.I xand.IR y ,coordinates of the mouse position in the screen image;.IR buttons ,a bitmask with the1, 2, and 4 bits set when themouse's left, middle, and right buttons,respectively, are down;and.IR msec ,a time stamp, in units of milliseconds..PPWriting the.B mousefile, in the same format,causes the mouse cursor to move to the position specified by the.I xand.I ycoordinates of the message.The.I buttonsand.I msecfields are ignored and may be omitted..PPWrites to the.B mouseinfile are processed as if they were generated by themouse hardware itself,as extra mouse events to be processed and passed back viathe.B mousefile.The.B mouseinfile, which is exclusive-use and may be openedonly by the host owner, is intended for controlling devices, such as USB mice,that are managed by user-level software.Each event should consist ofthe letter.B mfollowed by delta.IR x ,delta.IR y ,and.IR buttonsas space-separated decimal numbers..PPWriting to the.B mousectlfile configures and controls the mouse.The messages are:.TF ps2intellimouse.TP.B "serial\fI n\fP"sets serial port.I nto be the mouse port..TP.B ps2sets the PS2 port to be the mouse port..TP.B intellimouseuses the wheel on a Microsoft Intellimouseas the middle button..TP.B ps2intellimouseis equivalent to a write of.B ps2followed by a write of.BR intellimouse ..TP.B "accelerated\fI [n]\fP"turns on mouse acceleration..I Nis an optional acceleration factor..TP.B linearturns off mouse acceleration..TP.B "res\fI n\fR"sets mouse resolution to a setting between 0 and3 inclusive..TP.B "hwaccel\fI on/off\fP"sets whether acceleration is done in hardware orsoftware.By default, PS2 mice use hardware and serial mice usesoftware.Some laptops (notably the IBM Thinkpad T23) don'timplement hardware acceleration for external mice..TP.B swapswaps the left and right buttons on the mouse..TP.B "buttonmap\fI xyz\fP"numbers the left, middle, and right mouse buttons.IR x ,.IR y ,and.IR z ,respectively.If.I xyzis omitted, the default map, 123, is used.Thus in the default state writing.B "buttonmap 321swaps left and right buttonsand writing.B "buttonmap 123or just.B buttonmaprestores their usual meaning.Note that.B buttonmapmessages are idempotent,unlike.BR swap ..TP.B resetclears the mouseto its default state..PD.PPNot all mice interpret all messages; with some devices,some of the messages may be no-ops..PPCursors are described in.IR graphics (2).When read or written from or to the.B cursorfile, they are represented in a 72-byte binary format.The first and second four bytes are little endian32-bit numbers specifying the.I xand.I ycoordinates of the cursor.IR offset ;the next 32 bytes are the.B clrbitmask,and the last 32 bytes the.B setbitmask..PPReading from the.B cursorfile returns the current cursor information.Writing to the.B cursorfile sets the current cursor information.A write of fewer than 72 bytes sets thecursor to the default, an arrow..PPThe.B mouseand.B cursorfiles are multiplexed by.IR rio (1)to give the illusion of a private mouse to each of its clients.The semantics are otherwise the same except that notificationof a window resize is passed to the application using a.B mousemessage beginning with.B rrather than.BR m ;see.IR rio (4)for details..PPTo cope with pointing devices with only two buttons, when theshift key is pressed, the right mouse button generates middle-button events..SH SOURCE.B /sys/src/9/port/devmouse.c.SH "SEE ALSO.IR rio (4).SH BUGSThe cursor format is big endian while therest of the graphics interface is little endian.