<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!-- lifted from troff+man by doclifter -->
<refentry id='xmblstrman'>
<!-- '\" t -->
<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium -->
<!--  Copyright \(co 2000  The XFree86 Project, Inc. -->

<!--  Permission is hereby granted, free of charge, to any person obtaining -->
<!--  a copy of this software and associated documentation files (the -->
<!--  "Software"), to deal in the Software without restriction, including -->
<!--  without limitation the rights to use, copy, modify, merge, publish, -->
<!--  distribute, sublicense, and/or sell copies of the Software, and to -->
<!--  permit persons to whom the Software is furnished to do so, subject to -->
<!--  the following conditions: -->

<!--  The above copyright notice and this permission notice shall be included -->
<!--  in all copies or substantial portions of the Software. -->

<!--  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -->
<!--  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!--  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -->
<!--  IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR -->
<!--  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -->
<!--  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -->
<!--  OTHER DEALINGS IN THE SOFTWARE. -->

<!--  Except as contained in this notice, the name of the X Consortium shall -->
<!--  not be used in advertising or otherwise to promote the sale, use or -->
<!--  other dealings in this Software without prior written authorization -->
<!--  from the X Consortium. -->

<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by -->
<!--  Digital Equipment Corporation -->

<!--  Portions Copyright \(co 1990, 1991 by -->
<!--  Tektronix, Inc. -->

<!--  Permission to use, copy, modify and distribute this documentation for -->
<!--  any purpose and without fee is hereby granted, provided that the above -->
<!--  copyright notice appears in all copies and that both that copyright notice -->
<!--  and this permission notice appear in all copies, and that the names of -->
<!--  Digital and Tektronix not be used in in advertising or publicity pertaining -->
<!--  to this documentation without specific, written prior permission. -->
<!--  Digital and Tektronix makes no representations about the suitability -->
<!--  of this documentation for any purpose. -->
<!--  It is provided ``as is'' without express or implied warranty. -->

<!--  $XFree86: xc/doc/man/X11/XmbLStr.man,v 1.4 2003/04/28 22:17:58 herrb Exp $ -->
<!--   -->
<!-- .na -->
<!-- Ds listing suppressed (not used) -->
<!-- De listing suppressed (not used) -->
<!-- FD listing suppressed (not used) -->
<!-- FN listing suppressed (not used) -->
<!-- IN listing suppressed (not used) -->
<!-- C{ listing suppressed (not used) -->
<!-- C} listing suppressed (not used) -->
<!-- Pn listing suppressed (not used) -->
<!-- hN listing suppressed (not used) -->
<!-- .		\" Note End \-\- doug kraft 3/85 -->
<!-- .ny0 -->
<!-- '\" t -->
<refmeta>
<refentrytitle>XmbLookupString</refentrytitle>
<manvolnum>3X11</manvolnum>
<refmiscinfo class='date'>__xorgversion__</refmiscinfo>
<refmiscinfo class='source'>XLIB FUNCTIONS</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>XmbLookupString</refname>
<refname>XwcLookupString</refname>
<refname>Xutf8LookupString</refname>
<refpurpose>obtain composed input from an input method</refpurpose>
</refnamediv>
<!-- body begins here -->

<refsect1 id='syntax'><title>SYNTAX</title>

<para>int XmbLookupString&hairsp;(&hairsp;XIC <emphasis remap='I'>ic</emphasis>&hairsp;, XKeyPressedEvent *<emphasis remap='I'>event</emphasis>, char
*<emphasis remap='I'>buffer_return</emphasis>&hairsp;, int <emphasis remap='I'>bytes_buffer</emphasis>&hairsp;, KeySym
*<emphasis remap='I'>keysym_return</emphasis>&hairsp;, Status *<emphasis remap='I'>status_return</emphasis>&hairsp;);</para> 

<para>int XwcLookupString&hairsp;(&hairsp;XIC <emphasis remap='I'>ic</emphasis>&hairsp;, XKeyPressedEvent *<emphasis remap='I'>event</emphasis>&hairsp;,
wchar_t *<emphasis remap='I'>buffer_return</emphasis>&hairsp;, int <emphasis remap='I'>wchars_buffer</emphasis>&hairsp;, KeySym
*<emphasis remap='I'>keysym_return</emphasis>&hairsp;, Status *<emphasis remap='I'>status_return</emphasis>&hairsp;);</para> 

<para>int Xutf8LookupString&hairsp;(&hairsp;XIC <emphasis remap='I'>ic</emphasis>&hairsp;, XKeyPressedEvent *<emphasis remap='I'>event</emphasis>, char
*<emphasis remap='I'>buffer_return</emphasis>&hairsp;, int <emphasis remap='I'>bytes_buffer</emphasis>&hairsp;, KeySym
*<emphasis remap='I'>keysym_return</emphasis>&hairsp;, Status *<emphasis remap='I'>status_return</emphasis>&hairsp;);</para> 
</refsect1>

<refsect1 id='arguments'><title>ARGUMENTS</title>
<variablelist remap='IP'>
  <varlistentry>
  <term><emphasis remap='I'>buffer_return</emphasis></term>
  <listitem>
<para>Returns a multibyte string or wide character string (if any)
from the input method.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>bytes_buffer</emphasis></term>
<!-- .br -->
<!-- .ns -->
  <term><emphasis remap='I'>wchars_buffer</emphasis></term>
  <listitem>
<para>Specifies space available in the return buffer.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>event</emphasis></term>
  <listitem>
<para>Specifies the key event to be used.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>ic</emphasis></term>
  <listitem>
<para>Specifies the input context.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>keysym_return</emphasis></term>
  <listitem>
<para>Returns the KeySym computed from the event if this argument is not NULL.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>status_return</emphasis></term>
  <listitem>
<para>Returns a value indicating what kind of data is returned.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='description'><title>DESCRIPTION</title>
<para>The
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
functions return the string from the input method specified
in the buffer_return argument.
If no string is returned,
the buffer_return argument is unchanged.</para>

<para>The KeySym into which the KeyCode from the event was mapped is returned
in the keysym_return argument if it is non-NULL and the status_return
argument indicates that a KeySym was returned.
If both a string and a KeySym are returned,
the KeySym value does not necessarily correspond to the string returned.</para>

<para><emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
return the length of the string in bytes, and
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
returns the length of the string in characters.
Both
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
return text in the encoding of the locale bound to the input method
of the specified input context, and
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
returns text in UTF-8 encoding.</para>

<para>Each string returned by
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
begins in the initial state of the encoding of the locale
(if the encoding of the locale is state-dependent).</para>
<!-- .ne 7  IGNORED -->

<!-- .TB -->
<!-- .ce  IGNORED -->
<para>Note</para>

<!-- .in +5n  IGNORED -->
<!-- .ll \-5n  IGNORED -->
<para>To ensure proper input processing,
it is essential that the client pass only 
<emphasis remap='I'>&hairsp;KeyPress&hairsp;</emphasis>
events to
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>.
Their behavior when a client passes a 
<emphasis remap='I'>&hairsp;KeyRelease&hairsp;</emphasis>
event is undefined.</para>
<!-- .ce 0  IGNORED -->
<!-- .in \-5n  IGNORED -->
<!-- .ll +5n  IGNORED -->


<para>Clients should check the status_return argument before
using the other returned values.
These three functions each return a value to status_return 
that indicates what has been returned in the other arguments.
The possible values returned are:</para>


<informaltable pgwide='0' frame='none'>
  <tgroup cols='2' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <tbody>
      <row>
        <entry align='left'>T{
.ZN XBufferOverflow</entry>
        <entry align='left'>The input string to be returned is too large for the supplied buffer_return.
The required size (for
.ZN XmbLookupString ,
.ZN Xutf8LookupString
in bytes; for
.ZN XwcLookupString
in characters) is returned as the value of the function,
and the contents of buffer_return and keysym_return are not modified.
The client should recall the function with the same event
and a buffer of adequate size to obtain the string.</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN XLookupNone</entry>
        <entry align='left'>No consistent input has been composed so far.
The contents of buffer_return and keysym_return are not modified, 
and the function returns zero.</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN XLookupChars</entry>
        <entry align='left'>Some input characters have been composed.
They are placed in the buffer_return argument, using the encoding
described above,
and the string length is returned as the value of the function.
The content of the keysym_return argument is not modified.</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN XLookupKeySym</entry>
        <entry align='left'>A KeySym has been returned instead of a string
and is returned in keysym_return.
The content of the buffer_return argument is not modified,
and the function returns zero.</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN XLookupBoth</entry>
        <entry align='left'>Both a KeySym and a string are returned;
.ZN XLookupChars
and
.ZN XLookupKeySym
occur simultaneously.</entry>
      </row>
    </tbody>
  </tgroup>
</informaltable>



<para>It does not make any difference if the input context passed as an argument to
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
is the one currently in possession of the focus or not.
Input may have been composed within an input context before it lost the focus,
and that input may be returned on subsequent calls to
<emphasis remap='I'>&hairsp;XmbLookupString&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;XwcLookupString&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
even though it does not have any more keyboard focus.</para>

<para>The function
<emphasis remap='I'>&hairsp;Xutf8LookupString&hairsp;</emphasis>
is an XFree86 extension introduced in XFree86 4.0.2. Its presence is
indicated by the macro
<emphasis remap='I'>&hairsp;X_HAVE_UTF8_STRING&hairsp;</emphasis>.</para>
</refsect1>

<refsect1 id='see_also'><title>SEE ALSO</title>
<para>XLookupKeysym(3X11)
<!-- .br -->
<userinput>Xlib - C Language X Interface</userinput></para>
</refsect1>
</refentry>

