3 mouse, cursor \- kernel mouse interface
16 device provides an interface to the mouse.
17 There is also a cursor associated with the screen;
18 it is always displayed at the current mouse position.
22 file returns the mouse status: its position and button state.
23 The read blocks until the state has changed since the last read.
24 The read returns 49 bytes: the letter
26 followed by four decimal strings, each 11 characters
27 wide followed by a blank:
31 coordinates of the mouse position in the screen image;
34 1, 2, and 4 bits set when the
35 mouse's left, middle, and right buttons,
36 respectively, are down;
39 a time stamp, in units of milliseconds.
43 file, in the same format,
44 causes the mouse cursor to move to the position specified by the
48 coordinates of the message.
53 fields are ignored and may be omitted.
57 file are processed as if they were generated by the
58 mouse hardware itself,
59 as extra mouse events to be processed and passed back via
65 file, which is exclusive-use and may be opened
66 only by the host owner, is intended for controlling devices, such as USB mice,
67 that are managed by user-level software.
68 Each event should consist of
77 as space-separated decimal numbers.
81 file configures and controls the mouse.
91 sets the PS2 port to be the mouse port.
94 uses the wheel on a Microsoft Intellimouse
98 is equivalent to a write of
100 followed by a write of
103 .B "accelerated\fI [n]\fP"
104 turns on mouse acceleration.
106 is an optional acceleration factor.
109 turns off mouse acceleration.
112 sets mouse resolution to a setting between 0 and
115 .B "hwaccel\fI on/off\fP"
116 sets whether acceleration is done in hardware or
118 By default, PS2 mice use hardware and serial mice use
120 Some laptops (notably the IBM Thinkpad T23) don't
121 implement hardware acceleration for external mice.
124 swaps the left and right buttons on the mouse.
126 .B "buttonmap\fI xyz\fP"
127 numbers the left, middle, and right mouse buttons
135 is omitted, the default map, 123, is used.
136 Thus in the default state writing
138 swaps left and right buttons
143 restores their usual meaning.
146 messages are idempotent,
151 inverts the scroll wheel.
155 to its default state.
159 The screen also blanks after 30 minutes of inactivity.
160 The screen can be unblanked by moving the mouse.
162 .BI blanktime " minutes"
163 sets the timeout before the
164 screen blanks; the default is 30 minutes.
167 is zero, blanking is disabled.
170 unblanks the screen and resets the idle timeout as if the
174 Not all mice interpret all messages; with some devices,
175 some of the messages may be no-ops.
177 Cursors are described in
179 When read or written from or to the
181 file, they are represented in a 72-byte binary format.
182 The first and second four bytes are little endian
183 32-bit numbers specifying the
187 coordinates of the cursor
189 the next 32 bytes are the
192 and the last 32 bytes the
198 file returns the current cursor information.
201 file sets the current cursor information.
202 A write of fewer than 72 bytes sets the
203 cursor to the default, an arrow.
209 files are multiplexed by
211 to give the illusion of a private mouse to each of its clients.
212 The semantics are otherwise the same except that notification
213 of a window resize is passed to the application using a
215 message beginning with
223 To cope with pointing devices with only two buttons, when the
224 shift key is pressed, the right mouse button generates middle-button events.
226 .B /sys/src/9/port/devmouse.c
230 The cursor format is big endian while the
231 rest of the graphics interface is little endian.