aboutsummaryrefslogtreecommitdiff
path: root/man/man3/mouse.html
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-14 03:45:44 +0000
committerrsc <devnull@localhost>2005-01-14 03:45:44 +0000
commit78e51a8c6678b6e3dff3d619aa786669f531f4bc (patch)
tree015e00fde4fc837fd31b705e18d17dc913829388 /man/man3/mouse.html
parent2634795b5f0053bc0ff08e5d7bbc0eda8efea061 (diff)
downloadplan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.gz
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.bz2
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.zip
checkpoint
Diffstat (limited to 'man/man3/mouse.html')
-rw-r--r--man/man3/mouse.html249
1 files changed, 249 insertions, 0 deletions
diff --git a/man/man3/mouse.html b/man/man3/mouse.html
new file mode 100644
index 00000000..5e2b278d
--- /dev/null
+++ b/man/man3/mouse.html
@@ -0,0 +1,249 @@
+<head>
+<title>mouse(3) - Plan 9 from User Space</title>
+<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
+</head>
+<body bgcolor=#ffffff>
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=10><td>
+<tr><td width=20><td>
+<tr><td width=20><td><b>MOUSE(3)</b><td align=right><b>MOUSE(3)</b>
+<tr><td width=20><td colspan=2>
+ <br>
+<p><font size=+1><b>NAME </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ initmouse, readmouse, closemouse, moveto, cursorswitch, getrect,
+ drawgetrect, menuhit, setcursor &ndash; mouse control<br>
+
+</table>
+<p><font size=+1><b>SYNOPSIS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>#include &lt;u.h&gt;<br>
+ #include &lt;libc.h&gt;<br>
+ #include &lt;draw.h&gt;<br>
+ #include &lt;thread.h&gt;<br>
+ #include &lt;mouse.h&gt;<br>
+ #include &lt;cursor.h&gt;<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>Mousectl &nbsp;&nbsp;&nbsp;*initmouse(char *file, Image *i)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readmouse(Mousectl *mc)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;atomouse();<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closemouse(Mousectl *mc)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;moveto(Mousectl *mc, Point pt)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setcursor(Mousectl *mc, Cursor *c)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>Rectangle getrect(int but, Mousectl *mc)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;drawgetrect(Rectangle r, int up)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;menuhit(int but, Mousectl *mc, Menu *menu, Screen *scr)<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>DESCRIPTION </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ These functions access and control a mouse in a multi-threaded
+ environment. They use the message-passing <tt><font size=+1>Channel</font></tt> interface in
+ the threads library (see <a href="../man3/thread.html"><i>thread</i>(3)</a>); programs that wish a more
+ event-driven, single-threaded approach should use <a href="../man3/event.html"><i>event</i>(3)</a>.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ The state of the mouse is recorded in a structure, <tt><font size=+1>Mouse</font></tt>, defined
+ in <tt><font size=+1>&lt;mouse.h&gt;</font></tt>:<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>typedef struct Mouse Mouse;<br>
+ struct Mouse<br>
+ {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buttons; &nbsp;&nbsp;&nbsp;&nbsp;/* bit array: LMR=124 */<br>
+ Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xy;<br>
+ ulong &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msec;<br>
+
+ </table>
+ };<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ The <tt><font size=+1>Point xy</font></tt> records the position of the cursor, <tt><font size=+1>buttons</font></tt> the state
+ of the buttons (three bits representing, from bit 0 up, the buttons
+ from left to right, 0 if the button is released, 1 if it is pressed),
+ and <tt><font size=+1>msec</font></tt>, a millisecond time stamp.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ The routine <tt><font size=+1>initmouse</font></tt> returns a structure through which one may
+ access the mouse:<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>typedef struct Mousectl Mousectl;<br>
+ struct Mousectl<br>
+ {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ Mouse;<br>
+ Channel &nbsp;&nbsp;&nbsp;&nbsp;*c; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* chan(Mouse)[16] */<br>
+ Channel &nbsp;&nbsp;&nbsp;&nbsp;*resizec; &nbsp;&nbsp;&nbsp;/* chan(int)[2] */<br>
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*file;<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mfd; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* to mouse file */<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cfd; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* to cursor file */<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pid; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* of slave proc */<br>
+ Image* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* of associated window/display */<br>
+
+ </table>
+ };<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ The arguments to <i>initmouse</i> are a <i>file</i> naming the device file connected
+ to the mouse and an <i>Image</i> (see <a href="../man3/draw.html"><i>draw</i>(3)</a>) on which the mouse will
+ be visible. Typically the file is nil, which requests the default
+ <tt><font size=+1>/dev/mouse</font></tt>; and the image is the window in which the program is
+ running, held in the variable <tt><font size=+1>screen</font></tt> after a call
+ to <i>initdraw</i>.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ Once the <tt><font size=+1>Mousectl</font></tt> is set up, mouse motion will be reported by
+ messages of type <tt><font size=+1>Mouse</font></tt> sent on the <tt><font size=+1>Channel Mousectl.c</font></tt>. Typically,
+ a message will be sent every time a read of <tt><font size=+1>/dev/mouse</font></tt> succeeds,
+ which is every time the state of the mouse changes.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ When the window is resized, a message is sent on <tt><font size=+1>Mousectl.resizec</font></tt>.
+ The actual value sent may be discarded; the receipt of the message
+ tells the program that it should call <tt><font size=+1>getwindow</font></tt> (see <a href="../man3/graphics.html"><i>graphics</i>(3)</a>)
+ to reconnect to the window.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Readmouse</i> updates the <tt><font size=+1>Mouse</font></tt> structure held in the <tt><font size=+1>Mousectl</font></tt>, blocking
+ if the state has not changed since the last <i>readmouse</i> or message
+ sent on the channel. It calls <tt><font size=+1>flushimage</font></tt> (see <a href="../man3/graphics.html"><i>graphics</i>(3)</a>) before
+ blocking, so any buffered graphics requests are displayed.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Closemouse</i> closes the file descriptors associated with the mouse,
+ kills the slave processes, and frees the <tt><font size=+1>Mousectl</font></tt> structure.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Moveto</i> moves the mouse cursor on the display to the position specified
+ by <i>pt</i>.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Setcursor</i> sets the image of the cursor to that specified by <i>c</i>.
+ If <i>c</i> is nil, the cursor is set to the default. The format of the
+ cursor data is spelled out in <tt><font size=+1>&lt;cursor.h&gt;</font></tt> and described in <a href="../man3/graphics.html"><i>graphics</i>(3)</a>.
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Getrect</i> returns the dimensions of a rectangle swept by the user,
+ using the mouse, in the manner <a href="../man1/rio.html"><i>rio</i>(1)</a> or <a href="../man1/sam.html"><i>sam</i>(1)</a> uses to create
+ a new window. The <i>but</i> argument specifies which button the user
+ must press to sweep the window; any other button press cancels
+ the action. The returned rectangle is all zeros if the user
+ cancels.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Getrect</i> uses successive calls to <i>drawgetrect</i> to maintain the red
+ rectangle showing the sweep-in-progress. The rectangle to be drawn
+ is specified by <i>rc</i> and the <i>up</i> parameter says whether to draw (1)
+ or erase (0) the rectangle.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Menuhit</i> provides a simple menu mechanism. It uses a <tt><font size=+1>Menu</font></tt> structure
+ defined in <tt><font size=+1>&lt;mouse.h&gt;</font></tt>:<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>typedef struct Menu Menu;<br>
+ struct Menu<br>
+ {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**item;<br>
+ char &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(*gen)(int);<br>
+ int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lasthit;<br>
+
+ </table>
+ };<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ <i>Menuhit</i> behaves the same as its namesake <i>emenuhit</i> described in
+ <a href="../man3/event.html"><i>event</i>(3)</a>, with two exceptions. First, it uses a <tt><font size=+1>Mousectl</font></tt> to access
+ the mouse rather than using the event interface; and second, it
+ creates the menu as a true window on the <tt><font size=+1>Screen</font></tt> <i>scr</i> (see <a href="../man3/window.html"><i>window</i>(3)</a>),
+ permitting the menu to be displayed in parallel
+ with other activities on the display. If <i>scr</i> is null, <i>menuhit</i>
+ behaves like <i>emenuhit</i>, creating backing store for the menu, writing
+ the menu directly on the display, and restoring the display when
+ the menu is removed.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+
+</table>
+<p><font size=+1><b>SOURCE </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>/usr/local/plan9/src/libdraw<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>SEE ALSO </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <a href="../man3/graphics.html"><i>graphics</i>(3)</a>, <a href="../man3/draw.html"><i>draw</i>(3)</a>, <a href="../man3/event.html"><i>event</i>(3)</a>, <a href="../man3/keyboard.html"><i>keyboard</i>(3)</a>, <a href="../man3/thread.html"><i>thread</i>(3)</a>.<br>
+
+</table>
+
+<td width=20>
+<tr height=20><td>
+</table>
+<!-- TRAILER -->
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=15><td width=10><td><td width=10>
+<tr><td><td>
+<center>
+<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
+</center>
+</table>
+<!-- TRAILER -->
+</body></html>