84 lines
14 KiB
HTML
84 lines
14 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - System Overview - The Input Server</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInputServer_Overview.html" title="The Input Server" /><link rel="prev" href="BInputServerFilter_Overview.html" title="BInputServerFilter" /><link rel="next" href="TheInterfaceKit_Overview.html" title="The Interface Kit" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BInputServerFilter_Overview.html" title="BInputServerFilter"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInputServer_Overview.html" title="The Input Server"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="TheInterfaceKit_Overview.html" title="The Interface Kit"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - System Overview - The Input Server</div></div><div id="headerB">Prev: <a href="BInputServerFilter_Overview.html">BInputServerFilter</a> Up: <a href="TheInputServer_Overview.html">The Input Server</a> Next: <a href="TheInterfaceKit_Overview.html">The Interface Kit</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BInputServerMethod_Overview"></a>BInputServerMethod</h2></div></div></div><p><a class="link" href="BInputServerMethod.html" title="BInputServerMethod"><code class="classname">BInputServerMethod</code></a>
|
||
is a base class for input methods; these are instances
|
||
of <a class="link" href="BInputServerMethod.html" title="BInputServerMethod"><code class="classname">BInputServerMethod</code></a>
|
||
that act as an interface between the user and
|
||
languages using character sets that can't be easily represented on
|
||
standard keyboards, such as the Japanese input method that comes with
|
||
BeOS.</p><p>Input methods generally handle <code class="constant">B_KEY_DOWN</code>
|
||
messages in their
|
||
<a class="link" href="BInputServerFilter.html#BInputServerFilter_Filter" title="Filter()"><code class="methodname">Filter()</code></a>
|
||
function (see
|
||
<a class="link" href="BInputServerFilter.html" title="BInputServerFilter"><code class="classname">BInputServerFilter</code></a>),
|
||
keeping some sort of state around to translate these standard
|
||
keyboard messages into new <code class="constant">B_KEY_DOWN</code> messages
|
||
representing another character set. An input method can handle any input
|
||
event, they're not limited to keyboard events.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>Writing an input method is an involved process, even though the
|
||
<code class="classname">BInputServerMethod</code>
|
||
protocol is relatively simple. If you're working on an input
|
||
method, please feel free to contact Be Developer Technical Support
|
||
(devsupport@be.com) for additional information.</p></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BInputServerMethod_InputMethodEvents"></a>Input Method Events</h3></div></div></div><p>Input methods insert <code class="constant">B_INPUT_METHOD_EVENT</code> messages (using their
|
||
<a class="link" href="BInputServerMethod.html#BInputServerMethod_EnqueueMessage" title="EnqueueMessage()"><code class="methodname">EnqueueMessage()</code></a>
|
||
function) into the Input Server's event stream. These
|
||
messages let <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>
|
||
subclasses work together with your input method to
|
||
create a seamless experience for the user.</p><p>Each <code class="constant">B_INPUT_METHOD_EVENT</code> message contains a
|
||
<code class="varname">be:opcode</code> field (an <span class="type">int32</span>
|
||
value) indicating the kind of event:</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_INPUT_METHOD_STARTED</code></span></p></td><td><p>Indicates that a new input transaction has begun.
|
||
Add a <a class="link" href="BMessenger.html" title="BMessenger"><code class="classname">BMessenger</code></a>
|
||
in the <code class="varname">be:reply_to</code> field; the receiver of the message
|
||
will use this messenger to communicate with you during the transaction.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_INPUT_METHOD_STOPPED</code></span></p></td><td><p>Indicates that the transaction is over.</p></td></tr></tbody></table><p>In between the <code class="constant">B_INPUT_METHOD_STARTED</code> and <code class="constant">B_INPUT_METHOD_STOPPED</code>
|
||
messages, you'll send <code class="constant">B_INPUT_METHOD_CHANGED</code> and
|
||
<code class="constant">B_INPUT_METHOD_LOCATION_REQUEST</code> messages as the transaction proceeds.</p><p><code class="constant">B_INPUT_METHOD_CHANGED</code> does most of the work in
|
||
an input transaction; add the following important fields:</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Entry</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">be:string</code></td><td><code class="constant">B_STRING_TYPE</code></td><td>The text the user is currently entering; the
|
||
receiver will display it at the current insertion point.
|
||
<a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>
|
||
also highlights the text in blue to show that it's part of a transitory
|
||
transaction.</td></tr><tr><td><code class="varname">be:selection</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>A pair of B_INT32_TYPE offsets into the
|
||
<code class="varname">be:string</code> if part of <code class="varname">be:string</code> is
|
||
current selected. <a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>
|
||
highlights this selection in red instead of drawing it in blue.</td></tr><tr><td><code class="varname">be:clause_start</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>Zero or more offsets into the <code class="varname">be:string</code> for
|
||
handling languages (such as Japanese) that separate a sentence or phrase
|
||
into numerous clauses. An equal number of <code class="varname">be:clause_start</code> and
|
||
<code class="varname">be:clause_end</code> pairs delimit these clauses;
|
||
<a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a> separates the
|
||
blue/red highlighting wherever there is a clause boundary.</td></tr><tr><td><code class="varname">be:clause_end</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>Zero or more offsets into <code class="varname">be:string</code>; there
|
||
must be as many <code class="varname">be:clause_end</code> entries
|
||
as there are <code class="varname">be:clause_start</code>.</td></tr><tr><td><code class="varname">be:confirmed</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td>True when the user has entered and "confirmed"
|
||
the current string and wishes to end the transaction.
|
||
<a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>
|
||
unhighlights the blue/red text and waits for a <code class="constant">B_INPUT_METHOD_STOPPED</code> (to
|
||
close the transaction) or another <code class="constant">B_INPUT_METHOD_CHANGED</code> (to start a new
|
||
transaction immediately).</td></tr></tbody></table></div><p><code class="constant">B_INPUT_METHOD_LOCATION_REQUEST</code> is the input method's way of asking for
|
||
the on-screen location of each character in <code class="varname">be:string</code>. This information
|
||
can be used by the input method to pop up additional windows giving the
|
||
user an opportunity to select characters from a list or anything else
|
||
that makes sense. When you send a <code class="constant">B_INPUT_METHOD_LOCATION_REQUEST</code>, the
|
||
receiver will reply to the <code class="varname">be:reply_to</code> messenger (that you sent in your
|
||
<code class="constant">B_INPUT_METHOD_STARTED</code> message) with a <code class="constant">B_INPUT_METHOD_EVENT</code> message,
|
||
filling in the following fields:</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Entry</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">be:opcode</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>Set to <code class="constant">B_INPUT_METHOD_LOCATION_REQUEST</code>.</td></tr><tr><td><code class="varname">be:location_reply</code></td><td><code class="constant">B_POINT_TYPE</code></td><td>The co-ordinates of each character (there
|
||
should be one <code class="varname">be:location_reply</code> for every
|
||
character in <code class="varname">be:string</code>)
|
||
relative to the display (not your view or your window).</td></tr><tr><td><code class="varname">be:height_reply</code></td><td><code class="constant">B_FLOAT_TYPE</code></td><td>The height of each character in <code class="varname">be:string</code>.</td></tr></tbody></table></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BInputServerMethod_Creating"></a>Creating</h3></div></div></div><p>To create a new input method, you must:</p><ul class="itemizedlist"><li><p>Create a subclass of
|
||
<a class="link" href="BInputServerMethod.html" title="BInputServerMethod"><code class="classname">BInputServerMethod</code></a></p></li><li><p>Implement the <code class="function">instantiate_input_method()</code> C function to create an
|
||
instance of your
|
||
<a class="link" href="BInputServerMethod.html" title="BInputServerMethod"><code class="classname">BInputServerMethod</code></a>
|
||
subclass</p></li><li><p>Compile the class and function as an add-on</p></li><li><p>Install the add-on in one of the input method directories</p></li></ul><p>At boot time (or whenever the Input Server is restarted; see "Dynamic
|
||
Loading"), the Input Server loads the add-ons it finds in the input
|
||
method directories. For each add-on it finds, the Server invokes
|
||
<code class="function">instantiate_input_method()</code> to get a pointer to the add-on's
|
||
<code class="classname">BInputServerMethod</code> object. After constructing the object, the Server
|
||
calls <code class="methodname">InitCheck()</code> to give the add-on a chance to bail out if the
|
||
constructor failed.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BInputServerMethod_InstallingAnInputMethod"></a>Installing an Input Method</h3></div></div></div><p>The input server looks for input methods in the "input_server/methods"
|
||
subdirectories of <code class="constant">B_BEOS_ADDONS_DIRECTORY</code>,
|
||
<code class="constant">B_COMMON_ADDONS_DIRECTORY</code>, and
|
||
<code class="constant">B_USER_ADDONS_DIRECTORY</code>.</p><ul class="itemizedlist"><li><p>You can install your input devices in the latter two
|
||
directories—i.e. those under <code class="constant">B_COMMON_ADDONS_DIRECTORY</code>, and
|
||
<code class="constant">B_USER_ADDONS_DIRECTORY</code>.</p></li><li><p>The <code class="constant">B_BEOS_ADDONS_DIRECTORY</code> is reserved for add-ons that are supplied
|
||
by the BeOS.</p></li></ul></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BInputServerFilter_Overview.html">BInputServerFilter</a> Up: <a href="TheInputServer_Overview.html">The Input Server</a> Next: <a href="TheInterfaceKit_Overview.html">The Interface Kit</a> </div><div id="footerB"><div id="footerBL"><a href="BInputServerFilter_Overview.html" title="BInputServerFilter"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInputServer_Overview.html" title="The Input Server"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="TheInterfaceKit_Overview.html" title="The Interface Kit"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|