From d2758df0a0091496717fe7a65c3e7563e7c82785 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 2 Aug 2010 08:29:58 +0000 Subject: xserver libX11 libXdmcp git update 2-8-2010 --- libX11/configure.ac | 5 +- libX11/man/Compose.man | 316 +- libX11/nls/en_US.UTF-8/Compose.pre | 2 +- libX11/specs/Makefile.am | 27 +- libX11/specs/XIM/Makefile.am | 20 +- libX11/specs/XIM/dynamicflow.svg | 294 ++ libX11/specs/XIM/dynamicflowsampleseq.svg | 436 ++ libX11/specs/XIM/eventflow.svg | 314 ++ libX11/specs/XIM/sampleprotocolflow1.svg | 939 +++++ libX11/specs/XIM/sampleprotocolflow2.svg | 997 +++++ libX11/specs/XIM/staticflow.svg | 278 ++ libX11/specs/XIM/staticflowsampleseq.svg | 400 ++ libX11/specs/XIM/xim.ms | 4299 -------------------- libX11/specs/XIM/xim.xml | 3918 ++++++++++++++++++ libX11/specs/i18n/Framework.ms | 1564 ------- libX11/specs/i18n/LocaleDB.ms | 499 --- libX11/specs/i18n/Makefile.am | 8 +- libX11/specs/i18n/Trans.ms | 1146 ------ libX11/specs/i18n/framework/Makefile.am | 32 + libX11/specs/i18n/framework/framework.svg | 703 ++++ libX11/specs/i18n/framework/framework.xml | 1620 ++++++++ libX11/specs/i18n/localedb/Makefile.am | 32 + libX11/specs/i18n/localedb/localedb.xml | 777 ++++ libX11/specs/i18n/trans/Makefile.am | 32 + libX11/specs/i18n/trans/trans.xml | 1979 +++++++++ libX11/specs/libX11/Makefile.am | 2 +- libX11/specs/libX11/glossary.xml | 266 +- libX11/specs/macros.t | 225 - libX11/specs/troffrules.in | 93 - libXdmcp/Makefile.am | 2 + libXdmcp/configure.ac | 5 + libXdmcp/doc/Makefile.am | 64 + libXdmcp/doc/xdmcp.xml | 3895 ++++++++++++++++++ xorg-server/configure.ac | 8 +- xorg-server/doc/xml/Makefile.am | 2 + xorg-server/doc/xml/Xserver-spec.xml | 8 +- xorg-server/doc/xml/dtrace/Makefile.am | 36 + xorg-server/doc/xml/dtrace/Xserver-DTrace.xml | 579 +++ xorg-server/doc/xml/xmlrules.in | 10 +- xorg-server/hw/xfree86/ddc/ddc.c | 7 +- xorg-server/hw/xquartz/GL/indirect.c | 5 +- xorg-server/hw/xquartz/pbproxy/main.m | 328 +- .../xkeyboard-config/tests/genLists4Comparizon.sh | 43 + xorg-server/xkeyboard-config/tests/listCI2.xsl | 21 + xorg-server/xkeyboard-config/tests/listCIs.xsl | 20 + .../xkeyboard-config/tests/mxkbledpanel/Imakefile | 8 + .../tests/mxkbledpanel/mxkbledpanel.c | 605 +++ .../tests/mxkbledpanel/mxkbledpanel.man | 0 xorg-server/xkeyboard-config/tests/ruby/README | 3 + .../xkeyboard-config/tests/ruby/find_fragments.rb | 52 + .../xkeyboard-config/tests/ruby/find_match.rb | 42 + xorg-server/xkeyboard-config/tests/ruby/utils.rb | 64 + .../xkeyboard-config/tests/ruby/xkbparser.rb | 185 + xorg-server/xkeyboard-config/tests/testLayouts.pl | 17 + xorg-server/xkeyboard-config/tests/testModels.pl | 15 + xorg-server/xkeyboard-config/tests/testOptions.pl | 15 + .../xkeyboard-config/tests/testShortDescriptions | 6 + xorg-server/xkeyboard-config/tests/xkbTestFunc.pm | 164 + xorg-server/xkeyboard-config/xslt/reg2ll.xsl | 23 + xorg-server/xkeyboard-config/xslt/xfree86.xsl | 50 + 60 files changed, 19197 insertions(+), 8308 deletions(-) create mode 100644 libX11/specs/XIM/dynamicflow.svg create mode 100644 libX11/specs/XIM/dynamicflowsampleseq.svg create mode 100644 libX11/specs/XIM/eventflow.svg create mode 100644 libX11/specs/XIM/sampleprotocolflow1.svg create mode 100644 libX11/specs/XIM/sampleprotocolflow2.svg create mode 100644 libX11/specs/XIM/staticflow.svg create mode 100644 libX11/specs/XIM/staticflowsampleseq.svg delete mode 100644 libX11/specs/XIM/xim.ms create mode 100644 libX11/specs/XIM/xim.xml delete mode 100644 libX11/specs/i18n/Framework.ms delete mode 100644 libX11/specs/i18n/LocaleDB.ms delete mode 100644 libX11/specs/i18n/Trans.ms create mode 100644 libX11/specs/i18n/framework/Makefile.am create mode 100644 libX11/specs/i18n/framework/framework.svg create mode 100644 libX11/specs/i18n/framework/framework.xml create mode 100644 libX11/specs/i18n/localedb/Makefile.am create mode 100644 libX11/specs/i18n/localedb/localedb.xml create mode 100644 libX11/specs/i18n/trans/Makefile.am create mode 100644 libX11/specs/i18n/trans/trans.xml delete mode 100644 libX11/specs/macros.t delete mode 100644 libX11/specs/troffrules.in create mode 100644 libXdmcp/doc/Makefile.am create mode 100644 libXdmcp/doc/xdmcp.xml create mode 100644 xorg-server/doc/xml/dtrace/Makefile.am create mode 100644 xorg-server/doc/xml/dtrace/Xserver-DTrace.xml create mode 100644 xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh create mode 100644 xorg-server/xkeyboard-config/tests/listCI2.xsl create mode 100644 xorg-server/xkeyboard-config/tests/listCIs.xsl create mode 100644 xorg-server/xkeyboard-config/tests/mxkbledpanel/Imakefile create mode 100644 xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.c create mode 100644 xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.man create mode 100644 xorg-server/xkeyboard-config/tests/ruby/README create mode 100644 xorg-server/xkeyboard-config/tests/ruby/find_fragments.rb create mode 100644 xorg-server/xkeyboard-config/tests/ruby/find_match.rb create mode 100644 xorg-server/xkeyboard-config/tests/ruby/utils.rb create mode 100644 xorg-server/xkeyboard-config/tests/ruby/xkbparser.rb create mode 100644 xorg-server/xkeyboard-config/tests/testLayouts.pl create mode 100644 xorg-server/xkeyboard-config/tests/testModels.pl create mode 100644 xorg-server/xkeyboard-config/tests/testOptions.pl create mode 100644 xorg-server/xkeyboard-config/tests/testShortDescriptions create mode 100644 xorg-server/xkeyboard-config/tests/xkbTestFunc.pm create mode 100644 xorg-server/xkeyboard-config/xslt/reg2ll.xsl create mode 100644 xorg-server/xkeyboard-config/xslt/xfree86.xsl diff --git a/libX11/configure.ac b/libX11/configure.ac index 9f749aae1..831f5f184 100644 --- a/libX11/configure.ac +++ b/libX11/configure.ac @@ -30,8 +30,6 @@ XORG_ENABLE_SPECS XORG_WITH_XMLTO(0.0.20) XORG_WITH_FOP XORG_CHECK_SGML_DOCTOOLS(1.5) -XORG_WITH_GROFF -XORG_WITH_PS2PDF # Checks for programs. AC_PROG_LIBTOOL @@ -539,6 +537,9 @@ AC_OUTPUT([Makefile nls/zh_TW.UTF-8/Makefile specs/Makefile specs/i18n/Makefile + specs/i18n/framework/Makefile + specs/i18n/localedb/Makefile + specs/i18n/trans/Makefile specs/libX11/Makefile specs/XIM/Makefile x11.pc diff --git a/libX11/man/Compose.man b/libX11/man/Compose.man index db48cc4f4..7925d0862 100644 --- a/libX11/man/Compose.man +++ b/libX11/man/Compose.man @@ -1,158 +1,158 @@ -.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved. -.\" -.\" 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 (including the next -.\" paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. -.\" -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.ds xL Xlib \- C Language X Interface -.TH Compose __filemansuffix__ __vendorversion__ -.SH NAME -Compose \- X client mappings for multi-key input sequences -.SH DESCRIPTION -The X library, libX11, provides a simple input method for characters -beyond those represented on typical keyboards using sequences of key -strokes that are combined to enter a single character. -.PP -The compose file is searched for in the following order: -.IP - -If the environment variable -.B $XCOMPOSEFILE -is set, its value is used as the name of the Compose file. -.IP - -If the user's home directory has a file named -.IR .XCompose , -it is used as the Compose file. -.IP - -The system provided compose file is used by mapping the locale to a compose -file from the list in -.IR __xlocaledir__/compose.dir . -.PP -Compose files can use an -.RB \*q include \*q -instruction. This allows local modifications to be made to existing compose -files without including all of the content directly. For example, the -system's iso8859-1 compose file can be included with a line like this: -.RS 4 -.BI "include \*q" %S/iso8859-1/Compose \*q -.RE -.PP -There are several substitutions that can be made in the file name of the -include instruction: -.TP 4 -.I %H -expands to the user's home directory (the -.B $HOME -environment variable) -.TP 4 -.I %L -expands to the name of the locale specific Compose file (i.e., -.RI \*q __xlocaledir__//Compose \*q) -.TP 4 -.I %S -expands to the name of the system directory for Compose files (i.e., -.RI \*q __xlocaledir__ \*q) -.PP -For example, you can include in your compose file the default Compose file -by using: -.RS -.B "include \*q%L\*q" -.RE -and then rewrite only the few rules that you need to change. New -compose rules can be added, and previous ones replaced. -.SH FILE FORMAT -.\" Based on grammar description in modules/im/ximcp/imLcPrs.c -Compose files are plain text files, with a separate line for each compose -sequence. Comments begin with \fB#\fP characters. Each compose sequence -specifies one or more events and a resulting input sequence, with an optional -comment at the end of the line: -.RS -\fIEVENT\fP [\fIEVENT\fP...] \fB:\fP \fIRESULT\fP [\fB#\fP \fICOMMENT\fP] -.RE -.PP -Each event consists of a specified input keysym, and optional modifier states: -.RS -[\fIMODIFIER_LIST\fP] \fB<\fP\fIkeysym\fP\fB>\fP -.RE -.PP -Each modifier consists of a specified modifier and a state: -.RS -(\fB!\fP \fIMODIFIER\fP ) | \fBNone\fP -.RE -Modifiers may be preceded by a -.RB \*q "~" \*q -character to indicate that the modifier must not be present. -.PP -The result specifies a string, keysym, or both, that the X client receives -as input when the sequence of events is input: -.RS -\fB\*q\fP\fISTRING\fP\fB\*q\fP | \fIkeysym\fP | \fB\*q\fP\fISTRING\fP\fB\*q\fP \fIkeysym\fP -.RE -.PP -Keysyms are specified without the \fBXK_\fP prefix. -.PP -Strings may be direct text encoded in the locale for which the compose file is -to be used, or an escaped octal or hexadecimal character code. Octal codes -are specified as \fB\*q\\123\*q\fP and hexadecimal codes as -\fB\*q\\0x123a\*q\fP. -It is not necessary to specify in the right part of a rule a locale encoded -string in addition to the keysym name. If the string is omitted, Xlib -figures it out from the keysym according to the current locale. -I.e., if a rule looks like: -.RS -\fB : \*q\\300\*q Agrave\fP -.RE -the result of the composition is always the letter with the "\\300" -code. But if the rule is: -.RS -\fB : Agrave\fP -.RE -the result depends on how Agrave is mapped in the current locale. -.SH ENVIRONMENT -.TP -.B XCOMPOSEFILE -File to use for compose sequences. -.TP -.B XCOMPOSECACHE -Directory to use for caching compiled compose files. -.SH FILES -.TP -.I $HOME/.Xcompose -User default compose file if XCOMPOSEFILE is not set. -.TP -.I __xlocaledir__/compose.dir -File listing the compose file path to use for each locale. -.TP -.I __xlocaledir__//Compose -System default compose file for the locale, mapped via compose.dir. -.TP -.I /var/cache/libx11/compose/ -System-wide cache directory for compiled compose files. -.TP -.I $HOME/.compose-cache/ -Per-user cache directory for compiled compose files. -.SH SEE ALSO -.BR XLookupString (__libmansuffix__), -.BR XmbLookupString (__libmansuffix__), -.BR XwcLookupString (__libmansuffix__), -.BR Xutf8LookupString (__libmansuffix__), -.BR mkcomposecache (__appmansuffix__), -.BR locale (__miscmansuffix__). -.br -\fI\*(xL\fP +.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved. +.\" +.\" 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 (including the next +.\" paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +.\" +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.ds xL Xlib \- C Language X Interface +.TH Compose __filemansuffix__ __vendorversion__ +.SH NAME +Compose \- X client mappings for multi-key input sequences +.SH DESCRIPTION +The X library, libX11, provides a simple input method for characters +beyond those represented on typical keyboards using sequences of key +strokes that are combined to enter a single character. +.PP +The compose file is searched for in the following order: +.IP - +If the environment variable +.B $XCOMPOSEFILE +is set, its value is used as the name of the Compose file. +.IP - +If the user's home directory has a file named +.IR .XCompose , +it is used as the Compose file. +.IP - +The system provided compose file is used by mapping the locale to a compose +file from the list in +.IR __xlocaledir__/compose.dir . +.PP +Compose files can use an +.RB \*q include \*q +instruction. This allows local modifications to be made to existing compose +files without including all of the content directly. For example, the +system's iso8859-1 compose file can be included with a line like this: +.RS 4 +.BI "include \*q" %S/iso8859-1/Compose \*q +.RE +.PP +There are several substitutions that can be made in the file name of the +include instruction: +.TP 4 +.I %H +expands to the user's home directory (the +.B $HOME +environment variable) +.TP 4 +.I %L +expands to the name of the locale specific Compose file (i.e., +.RI \*q __xlocaledir__//Compose \*q) +.TP 4 +.I %S +expands to the name of the system directory for Compose files (i.e., +.RI \*q __xlocaledir__ \*q) +.PP +For example, you can include in your compose file the default Compose file +by using: +.RS +.B "include \*q%L\*q" +.RE +and then rewrite only the few rules that you need to change. New +compose rules can be added, and previous ones replaced. +.SH FILE FORMAT +.\" Based on grammar description in modules/im/ximcp/imLcPrs.c +Compose files are plain text files, with a separate line for each compose +sequence. Comments begin with \fB#\fP characters. Each compose sequence +specifies one or more events and a resulting input sequence, with an optional +comment at the end of the line: +.RS +\fIEVENT\fP [\fIEVENT\fP...] \fB:\fP \fIRESULT\fP [\fB#\fP \fICOMMENT\fP] +.RE +.PP +Each event consists of a specified input keysym, and optional modifier states: +.RS +[\fIMODIFIER_LIST\fP] \fB<\fP\fIkeysym\fP\fB>\fP +.RE +.PP +Each modifier consists of a specified modifier and a state: +.RS +(\fB!\fP \fIMODIFIER\fP ) | \fBNone\fP +.RE +Modifiers may be preceded by a +.RB \*q "~" \*q +character to indicate that the modifier must not be present. +.PP +The result specifies a string, keysym, or both, that the X client receives +as input when the sequence of events is input: +.RS +\fB\*q\fP\fISTRING\fP\fB\*q\fP | \fIkeysym\fP | \fB\*q\fP\fISTRING\fP\fB\*q\fP \fIkeysym\fP +.RE +.PP +Keysyms are specified without the \fBXK_\fP prefix. +.PP +Strings may be direct text encoded in the locale for which the compose file is +to be used, or an escaped octal or hexadecimal character code. Octal codes +are specified as \fB\*q\\123\*q\fP and hexadecimal codes as +\fB\*q\\0x123a\*q\fP. +It is not necessary to specify in the right part of a rule a locale encoded +string in addition to the keysym name. If the string is omitted, Xlib +figures it out from the keysym according to the current locale. +I.e., if a rule looks like: +.RS +\fB : \*q\\300\*q Agrave\fP +.RE +the result of the composition is always the letter with the "\\300" +code. But if the rule is: +.RS +\fB : Agrave\fP +.RE +the result depends on how Agrave is mapped in the current locale. +.SH ENVIRONMENT +.TP +.B XCOMPOSEFILE +File to use for compose sequences. +.TP +.B XCOMPOSECACHE +Directory to use for caching compiled compose files. +.SH FILES +.TP +.I $HOME/.XCompose +User default compose file if XCOMPOSEFILE is not set. +.TP +.I __xlocaledir__/compose.dir +File listing the compose file path to use for each locale. +.TP +.I __xlocaledir__//Compose +System default compose file for the locale, mapped via compose.dir. +.TP +.I /var/cache/libx11/compose/ +System-wide cache directory for compiled compose files. +.TP +.I $HOME/.compose-cache/ +Per-user cache directory for compiled compose files. +.SH SEE ALSO +.BR XLookupString (__libmansuffix__), +.BR XmbLookupString (__libmansuffix__), +.BR XwcLookupString (__libmansuffix__), +.BR Xutf8LookupString (__libmansuffix__), +.BR mkcomposecache (__appmansuffix__), +.BR locale (__miscmansuffix__). +.br +\fI\*(xL\fP diff --git a/libX11/nls/en_US.UTF-8/Compose.pre b/libX11/nls/en_US.UTF-8/Compose.pre index 142adab2e..e26ef2be6 100644 --- a/libX11/nls/en_US.UTF-8/Compose.pre +++ b/libX11/nls/en_US.UTF-8/Compose.pre @@ -211,7 +211,7 @@ XCOMM Other symbols : "№" numerosign # NUMERO SIGN : "№" numerosign # NUMERO SIGN - : "‽" U203D # INTERROBANG + : "⸘" U2E18 # INVERTED INTERROBANG : "‽" U203D # INTERROBANG

: "☭" U262D # HAMMER AND SICKLE diff --git a/libX11/specs/Makefile.am b/libX11/specs/Makefile.am index 4a51cae70..e2ff4117e 100644 --- a/libX11/specs/Makefile.am +++ b/libX11/specs/Makefile.am @@ -1,3 +1,24 @@ -SUBDIRS=libX11 i18n XIM - -EXTRA_DIST=troffrules.in macros.t +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +SUBDIRS=libX11 i18n XIM diff --git a/libX11/specs/XIM/Makefile.am b/libX11/specs/XIM/Makefile.am index b9bb42fec..c3e191716 100644 --- a/libX11/specs/XIM/Makefile.am +++ b/libX11/specs/XIM/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -21,8 +21,20 @@ # DEALINGS IN THE SOFTWARE. # -# Based on xc/doc/specs/XIM/Makefile from X11R6.9 +if ENABLE_SPECS -doc_sources = xim.ms +specdir = $(docdir)/$(subdir) +doc_sources = xim.xml +dist_spec_DATA = \ + $(doc_sources) \ + dynamicflowsampleseq.svg \ + dynamicflow.svg \ + eventflow.svg \ + sampleprotocolflow1.svg \ + sampleprotocolflow2.svg \ + staticflowsampleseq.svg \ + staticflow.svg -include $(top_srcdir)/specs/troffrules.in +include $(top_srcdir)/specs/xmlrules.in + +endif ENABLE_SPECS diff --git a/libX11/specs/XIM/dynamicflow.svg b/libX11/specs/XIM/dynamicflow.svg new file mode 100644 index 000000000..54fea7d6b --- /dev/null +++ b/libX11/specs/XIM/dynamicflow.svg @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + IM Library + IM Server + Keys in the on-key-list + event mask is changedto deselect the event + event mask is changedto select the event + XIM_EXT_SET_EVENT_MASK + intercept-event-mask is set + XIM_EXT_SET_EVENT_MASK + select-event-mask is set + event mask is changedto select the event + X events directly cometo the IM Server + when preediting is turned off + event mask is changedto deselect the event + + + + + + XIM_TRIGGER_NOTIFY + XIM_TRIGGER_NOTIFY_REPLY + + + + + diff --git a/libX11/specs/XIM/dynamicflowsampleseq.svg b/libX11/specs/XIM/dynamicflowsampleseq.svg new file mode 100644 index 000000000..b3839bcce --- /dev/null +++ b/libX11/specs/XIM/dynamicflowsampleseq.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + IM Library + IM Server + Keys in the on-key-list + XIM_EXT_SET_EVENT_MASK + intercept-event-mask is set + XIM_EXT_SET_EVENT_MASK + select-event-mask is set + + + + + + XIM_TRIGGER_NOTIFY + + + the specified eventsare being filtered + Keys in the off-key-list + the specified eventsare being processed + Keys in the on-key-list + the specified eventsare being processed + Keys in the off-key-list + the specified eventsare being discarded + + + XIM_TRIGGER_NOTIFY_REPLY + + + diff --git a/libX11/specs/XIM/eventflow.svg b/libX11/specs/XIM/eventflow.svg new file mode 100644 index 000000000..13886477b --- /dev/null +++ b/libX11/specs/XIM/eventflow.svg @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + X Server + Backend Method(Core) + Frontend Method(Extension) + IM Server + Library + Application + + diff --git a/libX11/specs/XIM/sampleprotocolflow1.svg b/libX11/specs/XIM/sampleprotocolflow1.svg new file mode 100644 index 000000000..622f9eed7 --- /dev/null +++ b/libX11/specs/XIM/sampleprotocolflow1.svg @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + Key event + Key event + Xib API + IM library + XNextEvent + XFilterEvent + XNextEvent + XFilterEvent + XNextEvent + XFilterEvent(returns False) + XmbLookupString + XIM_FORWARD_EVENT + XIM_FORWARD_EVENTor XIM_COMMIT(synchronous) + XIM_FORWARD_EVENT + XIM_SYNC + XIM_SYNC_REPLY + XIM_SET_IC_FOCUS + XIM_SYNC_REPLY asa reply of the XIM_FORWARD_EVENT + IM Server + synchronousrequest + processed(The focusedIC is changed) + processed + processed + + + XSetICFocus + XNextEvent + + + + + Application movesthe focus + + Pending + + + + + + + + + + + + + diff --git a/libX11/specs/XIM/sampleprotocolflow2.svg b/libX11/specs/XIM/sampleprotocolflow2.svg new file mode 100644 index 000000000..ddc866b5a --- /dev/null +++ b/libX11/specs/XIM/sampleprotocolflow2.svg @@ -0,0 +1,997 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + Key event + Key event + Xib API + IM library + XNextEvent + XFilterEvent + XNextEvent + XFilterEvent + XNextEvent + XFilterEvent(returns False) + XmbLookupString + XSetICFocus + + + XIM_FORWARD_EVENT + XIM_FORWARD_EVENTor XIM_COMMIT(synchronous) + XIM_FORWARD_EVENT + XIM_SYNC + XIM_SYNC_REPLY + XIM_SET_IC_FOCUS ispend because another sync cycle is startedby XIM_COMMIT + XIM_SET_IC_FOCUS + XIM_SYNC_REPLY asa reply of the XIM_FORWARD_EVENT + XIM_SET_IC_FOCUS + XIM_FORWARD_EVENT + IM Server + synchronousrequest + Pending + processed(The focusedIC is changed) + processed + processed + processed + + + + + + + + + XSetICFocus + Pending untilsync cycle is done + Button press causesfocus change + Key event + XNextEvent + XFilterEvent + + + + + + + + + Application movesthe focus + + + + + + + Pending + + diff --git a/libX11/specs/XIM/staticflow.svg b/libX11/specs/XIM/staticflow.svg new file mode 100644 index 000000000..43f536425 --- /dev/null +++ b/libX11/specs/XIM/staticflow.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + IM Library + IM Server + Keys in the on-key-list + event mask is changedto deselect the event + event mask is changedto select the event + XIM_FORWARD_EVENT + XIM_EXT_SET_EVENT_MASK + intercept-event-mask is set + XIM_EXT_SET_EVENT_MASK + select-event-mask is set + event mask is changedto select the event + X events directly cometo the IM Server + when preediting is turned off + event mask is changedto deselect the event + + + + + + + + + diff --git a/libX11/specs/XIM/staticflowsampleseq.svg b/libX11/specs/XIM/staticflowsampleseq.svg new file mode 100644 index 000000000..3b49716ff --- /dev/null +++ b/libX11/specs/XIM/staticflowsampleseq.svg @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + IM Library + IM Server + Keys in the on-key-list + XIM_EXT_SET_EVENT_MASK + intercept-event-mask is set + XIM_EXT_SET_EVENT_MASK + select-event-mask is set + + + + + + XIM_FORWARD_EVENT + + + the specified eventsare being filtered + Keys in the off-key-list + the specified eventsare being processed + Keys in the on-key-list + the specified eventsare being processed + Keys in the off-key-list + the specified eventsare being discarded + + + + diff --git a/libX11/specs/XIM/xim.ms b/libX11/specs/XIM/xim.ms deleted file mode 100644 index 08bf637b4..000000000 --- a/libX11/specs/XIM/xim.ms +++ /dev/null @@ -1,4299 +0,0 @@ -.\" To print this out, type tbl macros.t ThisFile | troff -ms -.EH '''' -.OH '''' -.EF '''' -.OF '''' -.ps 11 -.nr PS 11 -\& -.sp 8 -.TL -\s+3\fBThe Input Method Protocol\fP\s-3 -.sp -\fBVersion 1.0\fP -.sp -\fBX Consortium Standard\fP -.sp -\fBX Version 11, Release 7\fP -.sp -\fB\*(xV\fP -.sp 3 -.AU -Masahiko Narita -.AI -FUJITSU Limited. -.AU -Hideki Hiura -.AI -SunSoft, Inc. -.sp 3 -.AB -.LP -This specifies a protocol between IM library and IM (Input Method) -Server for internationalized text input, which is independent from -any specific language, any specific input method and the transport layer -used in communication between the IM library and the IM Server, and uses -a client-server model. -This protocol allows user to use his/her favorite input method for all -applications within the stand-alone distributed environment. -.AE -.ce 0 -.br -\& -.LP -.ps 11 -.nr PS 11 -.bp -\& -.ps 9 -.nr PS 9 -.sp 8 -.LP -.DS C -X Window System is a trademark of X Consortium, Inc. -.sp -Copyright \(co 1993, 1994 by X Consortium, Inc. -.DE -.sp 2 -.LP -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: -.LP -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. -.LP -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. -.LP -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. -.sp 3 -.DS C -Copyright \(co 1993, 1994 by FUJITSU LIMITED -.DE -.sp 2 -.LP -Permission to use, copy, modify, and distribute this documentation -for any purpose and without fee is hereby granted, provided -that the above copyright notice and this permission -notice appear in all copies. -Fujitsu and Sun Microsystems make no representations -about the suitability for any purpose of the information in this document. -This documentation is provided as is without express or implied warranty. -.sp 3 -.DS C -Copyright \(co 1993, 1994 by Sun Microsystems, Inc. -.DE -.sp 2 -.LP -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: -.LP -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. -.LP -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 AUTHORS OR COPYRIGHT HOLDERS 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. -.ps 11 -.nr PS 11 -.bp 1 -.EH '\fBX Input Method Protocol\fP''\fB\*(xV\fP' -.OH '\fBX Input Method Protocol\fP''\fB\*(xV\fP' -.EF ''\fB % \fP'' -.OF ''\fB % \fP'' -.NH 1 -Introduction -.XS -\*(SN Introduction -.XE -.NH 2 -Scope -.XS -\*(SN Scope -.XE -.LP -The internationalization in the -X Window System -Version 11, Release 5 (X11R5) provides a common API which application -developers can use to create portable internationalized programs and to -adapt them to the requirements of different native languages, local customs, -and character string encodings (this is called ``localization''). -As one of its internationalization mechanisms X11R5 has defined a functional -interface for internationalized text input, called XIM (X Input Method). -.LP -When a client-server model is used with an IM (Input Method) implementation, -a protocol must be established between the client and the server. -However, the protocol used to interface Input Method Servers (IM Servers) -with the Input Method libraries (IM libraries) to which applications are -linked was not addressed in X11R5. -This led application developers to depend on vendor-specific input methods, -decreased the user's choice of available input methods, and made it more -difficult for developers to create portable applications. This paper describes -the Input Method Protocol developed for X11R6 to resolve the above problems -and to address the requirements of existing and future input methods. -.LP -The Input Method Protocol is independent from the transport layer used in -communication between the IM library and the IM Server. -Thus, the input method protocol can be built on any inter-process -communication mechanism, such as TCP/IP or the X protocol. -.LP -In addition, the protocol provides for future extensions such as differing -input model types. -.LP -.NH 2 -Background -.XS -\*(SN Background -.XE -.LP -Text input is much more simple for some languages than -others. English, for instance, uses an alphabet of a manageable size, -and input consists of pressing the corresponding key on a keyboard, -perhaps in combination with a shift key for capital letters or special -characters. -.LP -Some languages have larger alphabets, or modifiers such as accents, -which require the addition of special key combinations in order to enter -text. These input methods may require ``dead-keys'' or ``compose-keys'' -which, when followed by different combinations of key strokes, -generate different characters. -.LP -Text input for ideographic languages is much less simple. In these -languages, characters represent actual objects rather than phonetic -sounds used in pronouncing a word, and the number of characters -in these languages may continue to grow. In Japanese, for instance, most -text input methods involve entering characters in a phonetic alphabet, -after which the input method searches a dictionary for possible -ideographic equivalents (of which there may be many). The input method then -presents the candidate characters for the user to choose from. -.LP -In Japanese, either Kana (phonetic symbols) or Roman letters are -typed and then a region is selected for conversion to Kanji. Several -Kanji characters may have the same phonetic representation. If that -is the case with the string entered, a menu of characters is presented -and the user must choose the appropriate one. If no choice is necessary -or a preference has been established, the input method does the -substitution directly. -.LP -These complicated input methods must present state information (Status Area), -text entry and edit space (Preedit Area), and menu/choice presentations -(Auxiliary Area). Much of the protocol between the IM library and the IM -Server involves managing these IM areas. -Because of the size and complexity of these input methods, and because -of how widely they vary from one language or locale to another, they are -usually implemented as separate processes which can serve many client -processes on the same computer or network. -.LP -.NH 2 -Input Method Styles -.XS -\*(SN Input Method Styles -.XE -.LP -X11 internationalization support includes the following four types of -input method: -.RS -.IP "- on-the-spot:" 20 -The client application is directed by the IM Server to display all -pre-edit data at the site of text insertion. The client registers -callbacks invoked by the input method during pre-editing. -.IP "- off-the-spot:" 20 -The client application provides display windows for the pre-edit data -to the input method which displays into them directly. -.IP "- over-the-spot:" 20 -The input method displays pre-edit data in a window which it brings up -directly over the text insertion position. -.IP "- root-window:" 20 -The input method displays all pre-edit data in a separate area of the -screen in a window specific to the input method. -.RE -.LP -Client applications must choose from the available input methods -supported by the IM Server and provide the display areas and callbacks -required by the input method. -.LP -.NH 1 -Architecture -.XS -\*(SN Architecture -.XE -.NH 2 -Implementation Model -.XS -\*(SN Implementation Model -.XE -.LP -Within the X Window System environment, the following two typical -architectural models can be used as an input method's implementation -model. -.RS -.IP "- Client/Server model:" 20 -A separate process, the IM Server, processes input and handles preediting, -converting, and committing. The IM library within the application, acting -as client to the IM Server, simply receives the committed string from the -IM Server. -.IP "- Library model:" 20 -All input is handled by the IM library within the application. The -event process is closed within the IM library and a separate IM Server -process may not be required. -.RE -.LP -Most languages which need complex preediting, such as Asian languages, -are implemented using the Client/Server IM model. Other languages -which need only dead key or compose key processing, such as European -languages, are implemented using the Library model. -.LP -In this paper, we discuss mainly the Client/Server IM model and the -protocol used in communication between the IM library (client) and the IM -Server. -.LP -.NH 2 -Structure of IM -.XS -\*(SN Structure of IM -.XE -.LP -When the client connects or disconnects to the IM Server, an open or close -operation occurs between the client and the IM Server. -.LP -The IM can be specified at the time of XOpenIM() by setting the locale -of the client and a locale modifier. Since the IM remembers -the locale at the time of creation XOpenIM() can be called -multiple times (with the -setting for the locale and the locale modifier changed) to support -multiple languages. -.LP -In addition, the supported IM type can be obtained using XGetIMValues(). -.LP -The client usually holds multiple input (text) fields. Xlib provides a -value type called the ``Input Context'' (IC) to manage each individual -input field. An IC can be created by specifying XIM using XCreateIC(), -and it can be destroyed using XDestroyIC(). -.LP -The IC can specify the type of IM which is supported by XIM for each -input field, so each input field can handle a different type of IM. -.LP -Most importantly information such as the committed string sent from -the IM Server to the client, is exchanged based on each IC. -.LP -Since each IC corresponds to an input field, the focused input field -should be announced to the IM Server using XSetICFocus(). (XUnsetICFocus() -can also be used to change the focus.) -.LP -.NH 2 -Event Handling Model -.XS -\*(SN Event Handling Model -.XE -.LP -Existing input methods support either the FrontEnd method, the BackEnd method, -or both. This protocol specifically supports the BackEnd method as -the default method, but also supports the FrontEnd method as an optional -IM Server extension. -.LP -The difference between the FrontEnd and BackEnd methods is in how -events are delivered to the IM Server. (Fig. 1) -.LP -.NH 3 -BackEnd Method -.XS -\*(SN BackEnd Method -.XE -.LP -In the BackEnd method, client window input events are always delivered -to the IM library, which then passes them to the IM Server. Events are -handled serially in the order delivered, and therefore there is no -synchronization problem between the IM library and the IM Server. -.LP -Using this method, the IM library forwards all KeyPress and KeyRelease -events to the IM Server (as required by the Event Flow Control model -described in section 2.4. ``Event Flow Control''), and synchronizes -with the IM Server (as described in section 4.16. ``Filtering Events''). -.LP -.NH 3 -FrontEnd Method -.XS -\*(SN FrontEnd Method -.XE -.LP -In the FrontEnd method, client window input events are delivered by the -X server directly to both the IM Server and the IM library. Therefore this -method provides much better interactive performance while preediting -(particularly in cases such as when the IM Server is running locally on -the user's workstation and the client application is running on another -workstation over a relatively slow network). -.LP -However, the FrontEnd model may have synchronization problems between -the key events handled in the IM Server and other events handled in the -client, and these problems could possibly cause the loss or duplication -of key events. For this reason, the BackEnd method is the core method -supported, and the FrontEnd method is made available as an extension for -performance purposes. (Refer to Appendix A for more information.) -.LP -.LP -.bp -\^... 0.05 6.513 4.737 10.45 -\^... 0.000i 3.937i 4.687i 0.000i -.nr 00 \n(.u -.nf -.PS 3.937i 4.687i -.br -.ps -.ps 10 -\h'3.687i'\v'3.437i'\v'-.13m'\L'-0.500i\(br'\v'.13m' -.sp -1 -\h'3.712i'\v'3.037i'\D'l-0.025i -0.100i' -.sp -1 -\h'3.687i'\v'2.937i'\D'l-0.025i 0.100i' -.sp -1 -\h'2.187i'\v'1.938i'\v'-.13m'\L'-0.750i\(br'\v'.13m' -.sp -1 -\h'2.187i'\v'1.188i'\l'0.750i' -.sp -1 -\h'2.937i'\v'1.188i'\v'-.13m'\L'1.250i\(br'\v'.13m' -.sp -1 -\h'2.912i'\v'2.338i'\D'l0.025i 0.100i' -.sp -1 -\h'2.937i'\v'2.438i'\D'l0.025i -0.100i' -.sp -1 -\h'2.187i'\v'3.437i'\v'-.13m'\L'-1.499i\(br'\v'.13m' -.sp -1 -\h'2.212i'\v'2.038i'\D'l-0.025i -0.100i' -.sp -1 -\h'2.187i'\v'1.938i'\D'l-0.025i 0.100i' -.sp -1 -\h'1.938i'\v'3.437i'\l'1.999i' -.sp -1 -\h'3.937i'\v'3.437i'\v'-.13m'\L'0.500i\(br'\v'.13m' -.sp -1 -\h'3.937i'\v'3.937i'\l'-1.999i' -.sp -1 -\h'1.938i'\v'3.937i'\v'-.13m'\L'-0.500i\(br'\v'.13m' -.sp -1 -\h'2.562i'\v'2.438i'\l'2.125i' -.sp -1 -\h'4.687i'\v'2.438i'\v'-.13m'\L'0.499i\(br'\v'.13m' -.sp -1 -\h'4.687i'\v'2.937i'\l'-2.125i' -.sp -1 -\h'2.562i'\v'2.937i'\v'-.13m'\L'-0.499i\(br'\v'.13m' -.sp -1 -\h'2.562i'\v'1.438i'\l'1.313i' -.sp -1 -\h'3.875i'\v'1.438i'\v'-.13m'\L'0.437i\(br'\v'.13m' -.sp -1 -\h'3.875i'\v'1.875i'\l'-1.313i' -.sp -1 -\h'2.562i'\v'1.875i'\v'-.13m'\L'-0.437i\(br'\v'.13m' -.sp -1 -\h'1.938i'\v'0.438i'\l'1.999i' -.sp -1 -\h'3.937i'\v'0.438i'\v'-.13m'\L'1.500i\(br'\v'.13m' -.sp -1 -\h'3.937i'\v'1.938i'\l'-1.999i' -.sp -1 -\h'1.938i'\v'1.938i'\v'-.13m'\L'-1.500i\(br'\v'.13m' -.sp -1 -\D'l0.000i 0.000i' -.sp -1 -.ps -.ps 12 -\h'3.812i'\v'3.217i'\h'-0.0m'\v'0.2m'FrontEnd Method (Extension) -.sp -1 -\h'0.813i'\v'3.217i'\h'-0.0m'\v'0.2m'BackEnd Method (Core) -.sp -1 -\h'2.562i'\v'3.779i'\h'-0.0m'\v'0.2m'X Server -.sp -1 -\h'3.062i'\v'2.779i'\h'-0.0m'\v'0.2m'IM Server -.sp -1 -\h'3.062i'\v'1.717i'\h'-0.0m'\v'0.2m'Library -.sp -1 -\h'2.187i'\v'0.904i'\h'-0.0m'\v'0.2m'Application -.sp -1 -.ps -.ft -.sp 1+3.937i -.PE -.if \n(00 .fi -.ce -.sp -Fig.1 The Flow of Events -.LP -.NH 2 -Event Flow Control -.XS -\*(SN Event Flow Control -.XE -.LP -This protocol supports two event flow models for communication between the -IM library and the IM Server (Static and Dynamic). -.LP -Static Event Flow requires that input events always be sent to the IM -Server from the client. -.LP -Dynamic Event Flow, however, requires only that those input events which -need to be processed (converted) be sent to the IM Server from the client. -.LP -For instance, in the case of inputing a combination of ASCII characters -and Chinese characters, ASCII characters do not need to be processed in -the IM Server, so their key events do not have to be sent to the IM -Server. On the other hand, key events necessary for composing Chinese -characters must be sent to the IM Server. -.LP -Thus, by adopting the Dynamic Event Flow, the number of requests among the -X Server, the client, and the IM Server is significantly reduced, and the -number of context switches is also reduced, resulting in improved performance. -The IM Server can send -.PN XIM_REGISTER_TRIGGERKEYS -message in order to switch the event flow in the Dynamic Event Flow. -.LP -The protocol for this process is described in section 4.5. ``Event Flow -Control''. -.LP -.NH 1 -Default Preconnection Convention -.XS -\*(SN Default Preconnection Convention -.XE -.LP -IM Servers are strongly encouraged to register their symbolic -names as the ATOM names into the IM Server directory property, -.PN XIM_SERVERS, -on the root window of the screen_number 0. -This property can contain a list of ATOMs, and the each ATOM represents -each possible IM Server. -IM Server names are restricted to POSIX Portable Filename Character Set. -To discover if the IM Server is active, see if there is an owner for -the selection with that atom name. To learn the address of that IM Server, -convert the selection target -.PN TRANSPORT, -which will return a string form of the transport address(es). -To learn the supported locales of that IM Server, convert the selection target -.PN LOCALES, -which will return a set of names of the supported locales in the syntax -X/Open defines. -.LP -The basic semantics to determine the IM Server if there are -multiple ATOMs are found in -.PN XIM_SERVERS -property, is first fit if the IM Server name is not given as -a X modifier's category -.PN im. -.LP -The address information retrievable from the -.PN TRANSPORT -target is a transport-specific name. -The preregistered formats for transport-specific names are listed in Appendix B. -Additional transport-specific names may be registered with X Consortium. -.LP -For environments that lack X connections, or for IM Servers which -do not use the X Window System, the preconnection convention with IM Server -may be given outside the X Window system (e.g. using a Name Service). -.LP -.NH 1 -Protocol -.XS -\*(SN Protocol -.XE -.LP -The protocol described below uses the bi-directional -synchronous/asynchronous request/reply/error model and is specified -using the same conventions outlined in Section 2 of the core X Window -System protocol [1]: -.LP -.NH 2 -Basic Requests Packet Format -.XS -\*(SN Basic Requests Packet Format -.XE -.LP -This section describes the requests that may be exchanged between the client -and the IM Server. -.LP -The basic request packet header format is as follows. -.RS -.DS - major-opcode: CARD8 - minor-opcode: CARD8 - length: CARD16 -.DE -.RE -The MAJOR-OPCODE specifies which core request or extension package this -packet represents. If the MAJOR-OPCODE corresponds to a core request, -the MINOR-OPCODE contains 8 bits of request-specific data. -(If the MINOR-OPCODE is not used, it is 0.) -Otherwise, the MAJOR-OPCODE and the MINOR-OPCODE are specified by -.PN XIM_QUERY_EXTENSION -message. (Refer to 4.7. Query the supported extension protocol list.) -The LENGTH field specifies the number of 4 bytes elements following the -header. If no additional data is followed by the header, the LENGTH field -will be 0. -.LP -.NH 2 -Data Types -.XS -\*(SN Data Types -.XE -.LP -The following data types are used in the core X IM Server protocol: -.LP -.nf -.ta .2i .5i 2.0i -BITMASK16 - CARD16 -.sp -BITMASK32 - CARD32 -.sp -PADDING FORMAT - Where N is some expression, and Pad(N) is the number of bytes needed to round N up to a - multiple of four. - Pad(N) = (4 - (N mod 4)) mod 4 -.sp -LPCE - 1 A character from the4 X Portable Character Set in Latin Portable - Character Encoding -.bp -STRING - 2 n length of string in bytes - n LISTofLPCE string - p unused, p=Pad(2+n) -.sp -STR - 1 n length of name in bytes - n STRING8 name -.sp -XIMATTR - 2 CARD16 attribute ID (*1) - 2 CARD16 type of the value (*2) - 2 n length of im-attribute - n STRING8 im-attribute - p unused, p = Pad(2+n) -.sp -The im-attribute argument specifies XIM values such as XNQueryInputStyle. -.sp -XICATTR - 2 CARD16 attribute ID (*1) - 2 CARD16 type of the value (*2) - 2 n length of ic-attribute - n STRING8 ic-attribute - p unused, p = Pad(2+n) -.LP -.IP (*1) -XIMATTR and XICATTR are used during the setup stage and XIMATTRIBUTE and -XICATTRIBUTE are used after each attribute ID has been recognized by -the IM Server and the IM library. -.sp -.IP (*2) -The value types are defined as follows: -.TS H -tab(:); -l l l s s -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l l l -l l l s s -l l l s s -l l l s s -l l l s s -l l l s s -l l l l l. -_ -.sp 6p -.B -values:data:format -.sp 6p -_ -.sp 6p -.TH -.R -#0:Separator of NestedList:----- (*3) -#1:byte data:CARD8 -#2:word data:CARD16 -#3:long data:CARD32 -#4:char data:STRING8 -#5:Window:CARD32 -#10:XIMStyles:2:n:number of XIMStyle list -::2::unused -::n:CARD32:XIMStyle list -#11:XRectangle:2:INT16:X -::2:INT16:Y -::2:CARD16:width -::2:CARD16:height -#12:XPoint:2:INT16:X -::2:INT16:Y -#13:XFontSet:2:n:length of Base font name -::n:STRING8:Base font name list -::p::unused, p = Pad(2+n) -#15:XIMHotKeyTriggers:4:n:T{ -number of XIMTRIGGERKEY list (*4) -T} -::n:XIMTRIGGERKEY:XIMHotkeyTrigger list -#16:XIMHotKeyState::XIMHOTKEYSTATE:T{ -HotKey processing state -T} -#17:XIMStringConversion:XIMSTRCONVTEXT -#18:XIMPreeditState:XIMPREEDITSTATE -#19:XIMResetState:XIMRESETSTATE -#x7fff:NestedList:----- -.sp 6p -_ -.TE -.LP -.IP (*3) -The IC value for the separator of NestedList is defined as follows, -.br - #define XNSeparatorofNestedList ``separatorofNestedList'' -.br -, which is registered in X Consortium and cannot be used for any -other purpose. -.sp -.IP (*4) -LISTofFOO -.RS -A Type name of the form LISTof FOO means a counted list of elements of -type FOO. -The size of the length field may vary (it is not necessarily the same -size as a FOO), and in some cases, it may be implicit. -.RE -.sp -.LP -.nf -.ta .2i .5i 2.0i -XIMTRIGGERKEY - 4 CARD32 keysym - 4 CARD32 modifier - 4 CARD32 modifier mask -.sp -ENCODINGINFO - 2 n length of encoding info - n STRING8 encoding info - p unused, p=Pad(2+n) -.sp -EXT - 1 CARD8 extension major-opcode - 1 CARD8 extension minor-opcode - 2 n length of extension name - n STRING8 extension name - p unused, p = Pad(n) -.sp -XIMATTRIBUTE - 2 CARD16 attribute ID - 2 n value length - n value - p unused, p = Pad(n) -.sp -XICATTRIBUTE - 2 CARD16 attribute ID - 2 n value length - n value - p unused, p = Pad(n) -.sp -.bp -.ta .2i .5i 3.0i -XIMSTRCONVTEXT - 2 CARD16 XIMStringConversionFeedback - #x0000001 XIMStringConversionLeftEdge - #x0000002 XIMStringConversionRightEdge - #x0000004 XIMStringConversionTopEdge - #x0000008 XIMStringConversionBottomEdge - #x0000010 XIMStringConversionConvealed - #x0000020 XIMStringConversionWrapped - 2 n byte length of the retrieved string - n STRING8 retrieved string - p unused, p = Pad(n) - 2 m byte length of feedback array - 2 unused - m LISTofXIMSTRCONVFEEDBACK feedback array(*1) -.IP (*1) -This field is reserved for future use. -.sp -.LP -.nf -.ta .2i .5i 2.0i -XIMFEEDBACK - 4 CARD32 XIMFeedback - #x000001 XIMReverse - #x000002 XIMUnderline - #x000004 XIMHighlight - #x000008 XIMPrimary - #x000010 XIMSecondary - #x000020 XIMTertiary - #x000040 XIMVisibleToForward - #x000080 XIMVisibleToBackward - #x000100 XIMVisibleCenter -.sp -XIMHOTKEYSTATE - 4 CARD32 XIMHotKeyState - #x0000001 XIMHotKeyStateON - #x0000002 XIMHotKeyStateOFF -.sp -XIMPREEDITSTATE - 4 CARD32 XIMPreeditState - #x0000001 XIMPreeditEnable - #x0000002 XIMPreeditDisable -.sp -XIMRESETSTATE - 4 CARD32 XIMResetState - #x0000001 XIMInitialState - #x0000002 XIMPreserveState -.LP -.NH 2 -Error Notification -.XS -\*(SN Error Notification -.XE -.LP -Both the IM Server and the IM library return -.PN XIM_ERROR -messages instead of the corresponding reply messages if any errors occur -during data processing. -.LP -At most one error is generated per request. If more than one error condition -is encountered in processing a request, the choice of which error is returned -is implementation-dependent. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_ERROR (IM Server \(<-\(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:BITMASK16:flag (*1) -::#0000:Both Input-Method-ID and Input-Context-ID are invalid -::#0001:Input-Method-ID is valid -::#0002:Input-Context-ID is valid -:2:CARD16:Error Code -::#1:BadAlloc -::#2:BadStyle -::#3:BadClientWindow -::#4:BadFocusWindow -::#5:BadArea -::#6:BadSpotLocation -::#7:BadColormap -::#8:BadAtom -::#9:BadPixel -::#10:BadPixmap -::#11:BadName -::#12:BadCursor -::#13:BadProtocol -::#14:BadForeground -::#15:BadBackground -::#16:LocaleNotSupported -::#999:BadSomething (*2) -:2:n:byte length of error detail. -:2:CARD16:type of error detail (*3) -:n:STRING8:error detail (*4) -:p::unused, p = Pad(n) -.TE -.LP -.IP (*1) -Before an IM is created, both Input-Method-ID and -Input-Context-ID are invalid. -Before an IC is created, only Input-Method-ID is valid. -After that, both of Input-Method-ID and Input-Context-ID are valid. -.IP (*2) -Unspecific error, for example ``language engine died'' -.IP (*3) -This field is reserved for future use. -.IP (*4) -Vendor defined detail error message -.RE -.LP -.NH 2 -Connection Establishment -.XS -\*(SN Connection Establishment -.XE -.LP -.PN XIM_CONNECT -message requests to establish a connection over a mutually-understood virtual -stream. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CONNECT (IM library \(-> IM Server) -.sp 6p -:1::byte order -::#x42 MSB first -::#x6c LSB first -:1::unused -:2:CARD16:client-major-protocol-version (*1) -:2:CARD16:client-minor-protocol-version (*1) -:2:CARD16:number of client-auth-protocol-names -:n:LISTofSTRING:client-auth-protocol-names -.TE -.LP -.IP (*1) -Specify the version of IM Protocol that the client supports. -.RE -.sp -.LP -A client must send -.PN XIM_CONNECT -message as the first message on the connection. -The list specifies the names of authentication protocols the sending -IM Server is willing to perform. -(If the client need not authenticate, the list may be omited.) -.LP -.PN XIM_AUTH_REQUIRED -message is used to send the authentication protocol name and protocol-specific -data. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_AUTH_REQUIRED (IM library \(<-\(-> IM Server) -.sp 6p -:1:CARD8:auth-protocol-index -:3::unused -:2:n:length of authentication data -:2::unused -:n::data -:p::unused, p = Pad(n) -.TE -.RE -.LP -The auth-protocol is specified by an index into the list of names -given in the -.PN XIM_CONNECT -or -.PN XIM_AUTH_SETUP -message. Any protocol-specific data that might be required is also sent. -.LP -The IM library sends -.PN XIM_AUTH_REPLY -message as the reply to -.PN XIM_AUTH_REQUIRED -message, if the IM Server is authenticated. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_AUTH_REPLY (IM library \(-> IM Server) -.sp 6p -:2:n:length of authentication data -:2::unused -:2:n:length of authentication data -:2::unused -:n::data -:p::unused, p = Pad(n) -.TE -.RE -.LP -The auth data is specific to the authentication protocol in use. -.LP -.PN XIM_AUTH_NEXT -message requests to send more auth data. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_AUTH_NEXT (IM library \(<-\(-> IM Server) -.sp 6p -:2:n:length of authentication data -:2::unused -:n::data -:p::unused, p = Pad(n) -.TE -.RE -.LP -The auth data is specific to the authentication protocol in use. -.LP -The IM Server sends -.PN XIM_AUTH_SETUP -message to authenticate the client. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_AUTH_SETUP (IM Server \(-> IM library) -.sp 6p -:2:CARD16:number of client-auth-protocol-names -:2::unused -:n:LISTofSTRING:server-auth-protocol-names -.TE -.RE -.LP -The list specifies the names of authentication protocols the -client is willing to perform. -.LP -.PN XIM_AUTH_NG -message requests to give up the connection. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_AUTH_NG (IM library \(<-\(-> IM Server) -.TE -.RE -.LP -The IM Server sends -.PN XIM_CONNECT_REPLY -message as the reply to -.PN XIM_CONNECT -or -.PN XIM_AUTH_REQUIRED -message. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CONNECT_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:server-major-protocol-version (*1) -:2:CARD16:server-minor-protocol-version (*1) -.TE -.LP -.IP (*1) -Specify the version of IM Protocol that the IM Server supports. -This document specifies major version one, minor version zero. -.RE -.sp -.LP -Here are the state diagrams for the client and the IM Server. -.sp -.B -State transitions for the client -.R -.RS -.LP -\fIinit_status\fP: -.RS -Use authorization function \(-> \fIclient_ask\fP -.br -Not use authorization function \(-> \fIclient_no_check\fP -.RE -.sp -.LP -\fIstart\fP: -.RS -Send -.PN XIM_CONNECT -.RS -If \fIclient_ask\fP \(-> \fIclient_wait1\fP -.br -If \fIclient_no_check\fP, client-auth-protocol-names may be omited \(-> \fIclient_wait2\fP -.RE -.RE -.sp -.LP -\fIclient_wait1\fP: -.RS -Receive -.PN XIM_AUTH_REQUIRED -\(-> \fIclient_check\fP -.br -Receive \(-> \fIclient_NG\fP -.RE -.sp -.LP -\fIclient_check\fP: -.RS -If no more auth needed, send -.PN XIM_AUTH_REPLY -\(-> \fIclient_wait2\fP -.br -If good auth data, send -.PN XIM_AUTH_NEXT -\(-> \fIclient_wait1\fP -.br -If bad auth data, send -.PN XIM_AUTH_NG -\(-> give up on this protocol -.RE -.sp -.LP -\fIclient_wait2\fP: -.RS -Receive -.PN XIM_CONNECT_REPLY -\(-> connect -.br -Receive -.PN XIM_AUTH_SETUP -\(-> \fIclient_more\fP -.br -Receive -.PN XIM_AUTH_NEXT -\(-> \fIclient_more\fP -.br -Receive -.PN XIM_AUTH_NG -\(-> give up on this protocol -.br -Receive \(-> \fIclient_NG\fP -.RE -.sp -.LP -\fIclient_more\fP: -.RS -Send -.PN XIM_AUTH_REQUIRED -\(-> \fIclient_wait2\fP -.RE -.sp -.LP -\fIclient_NG\fP: -.RS -Send -.PN XIM_AUTH_NG -\(-> give up on this protocol -.RE -.RE -.sp -.LP -.B -State transitions for the IM Server -.R -.RS -.LP -\fIinit-status\fP: -.RS -Use authorization function \(-> \fIserver_ask\fP -.br -Not use authorization function \(-> \fIserver_no_check\fP -.RE -.sp -.LP -\fIstart\fP: -.RS -Receive -.PN XIM_CONNECT -\(-> \fIstart2\fP -.br -Receive \(-> \fIserver_NG\fP -.RE -.sp -.LP -\fIstart2\fP: -.RS -If \fIclient_ask\fP, send -.PN XIM_AUTH_REQUIRED -\(-> \fIserver_wait1\fP -.br -If \fIclient_no_check\fP and \fIserver_ask\fP, send -.PN XIM_AUTH_SETUP -\(-> \fIserver_wait2\fP -.br -If \fIclient_no_check\fP and \fIserver_no_check\fP, send -.PN XIM_CONNECT_REPLY -\(-> connect -.RE -.sp -.LP -\fIserver_wait1\fP: -.RS -Receive -.PN XIM_AUTH_REPLY -\(-> \fIserver2\fP -.br -Receive -.PN XIM_AUTH_NEXT -\(-> \fIserver_more\fP -.br -Receive \(-> \fIserver_NG\fP -.RE -.sp -.LP -\fIserver_more\fP -.RS -Send -.PN XIM_AUTH_REQUIRED -\(-> \fIserver_wait1\fP -.RE -.sp -.LP -\fIserver2\fP -.RS -If \fIserver_ask\fP, send -.PN XIM_AUTH_SETUP -\(-> \fIserver_wait2\fP -.br -If \fIserver_no_check\fP, send -.PN XIM_CONNECT_REPLY -\(-> connect -.RE -.sp -.LP -\fIserver_wait2\fP -.RS -Receive -.PN XIM_AUTH_REQUIRED -\(-> \fIserver_check\fP -.br -Receive \(-> \fIserver_NG\fP -.RE -.sp -.LP -\fIserver_check\fP -.RS -If no more auth data, send -.PN XIM_CONNECT_REPLY -\(-> connect -.br -If bad auth data, send -.PN XIM_AUTH_NG -\(-> give up on this protocol -.br -If good auth data, send -.PN XIM_AUTH_NEXT -\(-> \fIserver_wait2\fP -.RE -.sp -.LP -\fIserver_NG\fP -.RS -Send -.PN XIM_AUTH_NG -\(-> give up on this protocol -.RE -.RE -.sp -.LP -.PN XIM_DISCONNECT -message requests to shutdown the connection over a mutually-understood -virtual stream. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_DISCONNECT (IM library \(-> IM Server) -.TE -.RE -.LP -.PN XIM_DISCONNECT -is a synchronous request. The IM library should wait until it receives -either an -.PN XIM_DISCONNECT_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_DISCONNECT_REPLY (IM Server \(-> IM library) -.TE -.RE -.LP -.PN XIM_OPEN -requests to establish a logical connection between the IM library and the IM -Server. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_OPEN (IM library \(-> IM Server) -.sp 6p -:n:STR:locale name -:p::unused, p = Pad(n) -.TE -.RE -.LP -.PN XIM_OPEN -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_OPEN_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_OPEN_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of IM attributes supported -:n:LISTofXIMATTR:IM attributes supported -:2:m:byte length of IC attributes supported -:2:CARD16:unused -:m:LISTofXICATTR: IC attributes supported -.TE -.RE -.LP -.PN XIM_OPEN_REPLY -message returns all supported IM and IC attributes in LISTofXIMATTR and -LISTofXICATTR. These IM and IC attribute IDs are used to reduce the amount -of data which must be transferred via the network. In addition, this -indicates to the IM library what kinds of IM/IC attributes can be used -in this session, and what types of data will be exchanged. This allows -the IM Server provider and application writer to support IM system -enhancements with new IM/IC attributes, without modifying Xlib. -The IC value for the separator of NestedList must be included in the -LISTofXICATTR. -.LP -.PN XIM_CLOSE -message requests to shutdown the logical connection between the IM library -and the IM Server. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CLOSE (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2::unused -.TE -.RE -.LP -.PN XIM_CLOSE -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_CLOSE_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CLOSE_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2::unused -.TE -.RE -.LP -.NH 2 -Event Flow Control -.XS -\*(SN Event Flow Control -.XE -.LP -An IM Server must send -.PN XIM_SET_EVENT_MASK -message to the IM library in order for events to be forwarded to the IM -Server, since the IM library initially doesn't forward any events to the -IM Server. In the protocol, the IM Server will specify masks of X events -to be forwarded and which need to be synchronized by the IM library. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_EVENT_MASK (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:EVENTMASK:forward-event-mask (*1) -:4:EVENTMASK:synchronous-event-mask (*2) -.TE -.LP -.IP (*1) -Specify all the events to be forwarded to the IM Server by the IM library. -.IP (*2) -Specify the events to be forwarded with synchronous flag on by the IM library. -.RE -.sp -.LP -.PN XIM_SET_EVENT_MASK -is an asynchronous request. The event masks are valid immediately after -they are set until changed by another -.PN XIM_SET_EVENT_MASK -message. If input-context-ID is set to zero, the default value of the -input-method-ID will be changed to the event masks specified in the request. -That value will be used for the IC's which have no individual values. -.LP -Using the Dynamic Event Flow model, an IM Server sends -.PN XIM_REGISTER_TRIGGERKEYS -message to the IM library before sending -.PN XIM_OPEN_REPLY -message. -Or the IM library may suppose that the IM Server uses the Static Event Flow -model. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_REGISTER_TRIGGERKEYS (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2::unused -:4:n:byte length of on-keys -:n:LISTofXIMTRIGGERKEY:on-keys list -:4:m:byte length of off-keys -:m:LISTofXIMTRIGGERKEY:off-keys list -.TE -.RE -.LP -.PN XIM_REGISTER_TRIGGERKEYS -is an asynchronous request. -The IM Server notifys the IM library of on-keys and off-keys lists with -this message. -.LP -The IM library notifys the IM Server with -.PN XIM_TRIGGER_NOTIFY -message that a key event matching either on-keys or off-keys has been occurred. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_TRIGGER_NOTIFY (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:CARD32:flag -::#0:on-keys list -::#1:off-keys list -:4:CARD32:index of keys list -:4:EVENTMASK:client-select-event-mask (*1) -.TE -.LP -.IP (*1) -Specify the events currently selected by the IM library with XSelectInput. -.RE -.sp -.LP -.PN XIM_TRIGGER_NOTIFY -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_TRIGGER_NOTIFY_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_TRIGGER_NOTIFY_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.NH 2 -Encoding Negotiation -.XS -\*(SN Encoding Negotiation -.XE -.LP -.PN XIM_ENCODING_NEGOTIATION -message requests to decide which encoding to be sent across the wire. -When the negotiation fails, the fallback default encoding is Portable -Character Encoding. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_ENCODING_NEGOTIATION (IM library \(-> IM Server).sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of encodings listed by name -:n:LISTofSTR:list of encodings supported in the IM library. -:p::unused, p = Pad(n) -:2:m:byte length of encodings listed by detailed data -:2::unused -:m:LISTofENCODINGINFO:list of encordings supported in the IM library -.TE -.RE -.LP -The IM Server must choose one encoding from the list sent by the IM library. -If index of the encording determined is -1 to indicate that the negotiation -is failed, the fallback default encoding is used. -The message must be issued after sending -.PN XIM_OPEN -message via XOpenIM(). -The name of encoding may be registered with X Consortium. -.LP -.PN XIM_ENCODING_NEGOTIATION -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_ENCODING_NEGOTIATION_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_ENCODING_NEGOTIATION_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:category of the encoding determined. -::#0:name -::#1:detailed data -:2:INT16:index of the encoding determinated. -:2::unused -.TE -.RE -.LP -.NH 2 -Query the supported extension protocol list -.XS -\*(SN Query the supported extension protocol list -.XE -.LP -.PN XIM_QUERY_EXTENSION -message requests to query the IM extensions supported by the IM Server to -which the client is being connected. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_QUERY_EXTENSION (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:n:T{ -byte length of extensions supported by the IM library -T} -:n:LISTofSTR:extensions supported by the IM library -:p::unused, p = Pad(n) -.TE -.RE -.LP -An example of a supported extension is FrontEnd. -The message must be issued after sending -.PN XIM_OPEN -message via XOpenIM(). -.LP -If n is 0, the IM library queries the IM Server for all extensions. -.LP -If n is not 0, the IM library queries whether the IM Server supports the -contents specified in the list. -.LP -If a client uses an extension request without previously having issued a -.PN XIM_QUERY_EXTENSION -message for that extension, the IM Server responds with a -.PN BadProtocol -error. If the IM Server encounters a request with an unknown MAJOR-OPCODE -or MINOR-OPCODE, it responds with a -.PN BadProtocol -error. -.LP -.PN XIM_QUERY_EXTENSION -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_QUERY_EXTENSION_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_QUERY_EXTENSION_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:n:T{ -byte length of extensions supported by both the IM library and the IM Server -T} -:n:LISTofEXT:T{ -list of extensions supported by both the IM library and the IM Server -T} -.TE -.RE -.LP -.PN XIM_QUERY_EXTENSION_REPLY -message returns the list of extensions supported by both the IM library and -the IM Server. If the list passed in -.PN XIM_QUERY_EXTENSION -message is NULL, the IM Server returns the full list of extensions supported -by the IM Server. If the list is not NULL, the IM Server returns the -extensions in the list that are supported by the IM Server. -.LP -A zero-length string is not a valid extension name. The IM library should -disregard any zero-length strings that are returned in the extension list. -The IM library does not use the requests which are not supported by the IM -Server. -.LP -.NH 2 -Setting IM Values -.XS -\*(SN Setting IM Values -.XE -.LP -.PN XIM_SET_IM_VALUES -requests to set attributes to the IM. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_IM_VALUES (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of im-attribute -:n:LISTofXIMATTRIBUTE:im-attributes -.TE -.RE -.LP -The im-attributes in -.PN XIM_SET_IM_VALUES -message are specified as a LISTofXIMATTRIBUTE, specifying the attributes -to be set. Attributes other than the ones returned by -.PN XIM_OPEN_REPLY -message should not be specified. -.LP -.PN XIM_SET_IM_VALUES -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_SET_IM_VALUES_REPLY -packet or an -.PN XIM_ERROR -packet, because it must receive the error attribute if -.PN XIM_ERROR -message is returned. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_IM_VALUES_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2::unused -.TE -.RE -.LP -.PN XIM_SET_IM_VALUES_REPLY -message returns the input-method-ID to distinguish replies from multiple IMs. -.LP -.NH 2 -Getting IM Values -.XS -\*(SN getting IM Values -.XE -.LP -.PN XIM_GET_IM_VALUES -requests to query IM values supported by the IM Server currently being -connected. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_GET_IM_VALUES (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of im-attribute-id -:n:LISTofCARD16:im-attribute-id -:p::unused, p=Pad(n) -.TE -.RE -.LP -.PN XIM_GET_IM_VALUES -is a synchronous request. The IM library should wait until it receives -either an -.PN XIM_GET_IM_VALUES_REPLY -packet or an -.PN XIM_ERROR -packet. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_GET_IM_VALUES_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of im-attributes returned -:n:LISTofXIMATTRIBUTE:im-attributes returned -.TE -.RE -.LP -The IM Server returns IM values with -.PN XIM_GET_IM_VALUES_REPLY -message. The order of the returned im-attribute values corresponds directly -to that of the list passed with the -.PN XIM_GET_IM_VALUES -message. -.LP -.NH 2 -Creating an IC -.XS -\*(SN Creating an IC -.XE -.LP -.PN XIM_CREATE_IC -message requests to create an IC. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CREATE_IC (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:n:byte length of ic-attributes -:n:LISTofXICATTRIBUTE:ic-attributes -.TE -.RE -.LP -The input-context-id is specified by the IM Server to identify the client -(IC). (It is not specified by the client in -.PN XIM_CREATE_IC -message.), and it should not be set to zero. -.LP -.PN XIM_CREATE_IC -is a synchronous request which returns the input-context-ID. -The IM library should wait until it receives either an -.PN XIM_CREATE_IC_REPLY -packet or an -.PN XIM_ERROR -packet. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_CREATE_IC_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.NH 2 -Destroying the IC -.XS -\*(SN Destroying the IC -.XE -.LP -.PN XIM_DESTROY_IC -message requests to destroy the IC. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_DESTROY_IC (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.PN XIM_DESTROY_IC -is a synchronous request. The IM library should not free its resources -until it receives an -.PN XIM_DESTROY_IC_REPLY -message because -.PN XIM_DESTROY_IC -message may result in Callback packets such as -.PN XIM_PREEDIT_DRAW -and -.PN XIM_PREEDIT_DONE. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_DESTROY_IC_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.NH 2 -Setting IC Values -.XS -\*(SN Setting IC Values -.XE -.LP -.PN XIM_SET_IC_VALUES -messages requests to set attributes to the IC. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_IC_VALUES (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:n:byte length of ic-attributes -:2::unused -:n:LISTofXICATTRIBUTE:ic-attributes -.TE -.RE -.LP -The ic-attributes in -.PN XIM_SET_IC_VALUES -message are specified as a LISTofXICATTRIBUTE, specifying the attributes -to be set. Attributes other than the ones returned by -.PN XIM_OPEN_REPLY -message should not be specified. -.LP -.PN XIM_SET_IC_VALUES -is a synchronous request. The IM library should wait until receiving -either an -.PN XIM_SET_IC_VALUES_REPLY -packet or an -.PN XIM_ERROR -packet, because it must receive the error attribute if -.PN XIM_ERROR -message is returned. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_IC_VALUES_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.NH 2 -Getting IC Values -.XS -\*(SN Getting IC Values -.XE -.LP -.PN XIM_GET_IC_VALUES -message requests to query IC values supported by the IM Server currently -being connected. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_GET_IC_VALUES (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:n:byte length of ic-attribute-id -:n:LISTofCARD16:ic-attribute-id -:p::unused, p=Pad(2+n) -.TE -.RE -.LP -In LISTofCARD16, the appearance of the ic-attribute-id for the separator -of NestedList shows the end of the heading nested list. -.LP -.PN XIM_GET_IC_VALUES -is a synchronous request and returns each attribute with its values to -show the correspondence. The IM library should wait until receiving -either an -.PN XIM_GET_IC_VALUES_REPLY -packet or an -.PN XIM_ERROR -packet. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_GET_IC_VALUES_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:n:byte length of ic-attribute -:2::unused -:n:LISTofXICATTRIBUTE:ic-attribute -.TE -.RE -.LP -.NH 2 -Setting IC Focus -.XS -\*(SN Setting IC Focus -.XE -.LP -.PN XIM_SET_IC_FOCUS -message requests to set the focus to the IC. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SET_IC_FOCUS (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.PN XIM_SET_IC_FOCUS -is an asynchronous request. -.LP -.NH 2 -Unsetting IC Focus -.XS -\*(SN Unsetting IC Focus -.XE -.LP -.PN XIM_UNSET_IC_FOCUS -message requests to unset the focus to the focused IC. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_UNSET_IC_FOCUS (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.PN XIM_UNSET_IC_FOCUS -is an asynchronous request. -.LP -.NH 2 -Filtering Events -.XS -\*(SN Filtering Events -.XE -.LP -Event filtering is mainly provided for BackEnd method to allow input method -to capture X events transparently to clients. -.LP -X Events are forwarded by -.PN XIM_FORWARD_EVENT -message. -This message can be operated both synchronously and asynchronously. -If the requester sets the synchronous flag, the receiver must send -.PN XIM_SYNC_REPLY -message back to the requester when all the data processing is done. -.sp -.B -Protocol flow of BackEnd model -.R -.LP -.LP -With BackEnd method, the protocol flow can be classified into two -methods in terms of synchronization, depending on the synchronous-eventmask -of -.PN XIM_SET_EVENT_MASK -message. One can be called on-demand-synchronous method and another -can be called as full-synchronous method. -.LP -In on-demand-synchronous method, the IM library always receives -.PN XIM_FORWARD_EVENT -or -.PN XIM_COMMIT -message as a synchronous request. Also, the IM Server needs to synchronously -process the correspondent reply from the IM library and the following -.PN XIM_FORWARD_EVENT -message sent from the IM library when any of the event causes the IM Server -to send -.PN XIM_FORWARD_EVENT -or -.PN XIM_COMMIT -message to the IM library, so that the input service is consistent. If the -IM library gets the control back from the application after receiving the -synchronous request, the IM library replies for the synchronous request before -processing any of the events. In this time, the IM Server blocks -.PN XIM_FORWARD_EVENT -message which is sent by the IM library, and handles it after receiving the -reply. However, the IM Server handles the other protocols at any time. -.LP -In full-synchronous method, the IM library always sends -.PN XIM_FORWARD_EVENT -message to the IM Server as a synchronous request. Therefore, the reply to it -from the IM Server will be put between the -.PN XIM_FORWARD_EVENT -message and its -.PN XIM_SYNC_REPLY -message. -In case of sending -.PN XIM_FORWARD_EVENT -or -.PN XIM_COMMIT -message, the IM Server should set the synchronous flag off. Because the -synchronization can be done by the following -.PN XIM_SYNC_REPLY -message. -.sp -.LP -.B -Sample Protocol flow chart 1 -.R -.LP -Following chart shows one of the simplest protocol flow which only -deals with keyevents for preediting operation. -.LP -.\"====================== event flow figure start ===================== -\^... 0.425 6.888 6.3 10.296 -\^... 0.000i 3.408i 5.875i 0.000i -.nr 00 \n(.u -.nf -.PS 3.408i 5.875i -.br -.ps 11 -\h'3.125i'\v'0.496i'\D'l1.625i 0.250i' -.sp -1 -\h'4.647i'\v'0.756i'\D'l0.103i -0.010i' -.sp -1 -\h'4.655i'\v'0.706i'\D'l0.095i 0.040i' -.sp -1 -\h'3.125i'\v'1.221i'\D'l1.687i 0.188i' -.sp -1 -\h'4.710i'\v'1.423i'\D'l0.102i -0.014i' -.sp -1 -\h'4.715i'\v'1.373i'\D'l0.097i 0.036i' -.sp -1 -\h'4.750i'\v'0.971i'\D'l-1.625i 0.438i' -.sp -1 -\h'3.215i'\v'1.359i'\D'l-0.090i 0.050i' -.sp -1 -\h'3.228i'\v'1.407i'\D'l-0.103i 0.002i' -.sp -1 -\h'2.000i'\v'0.409i'\D'l1.000i 0.062i' -.sp -1 -\h'2.899i'\v'0.490i'\D'l0.101i -0.019i' -.sp -1 -\h'2.902i'\v'0.440i'\D'l0.098i 0.031i' -.sp -1 -\h'2.000i'\v'1.034i'\D'l1.000i 0.125i' -.sp -1 -\h'2.898i'\v'1.171i'\D'l0.102i -0.012i' -.sp -1 -\h'2.904i'\v'1.122i'\D'l0.096i 0.037i' -.sp -1 -\h'3.000i'\v'1.409i'\D'l-1.000i 0.062i' -.sp -1 -\h'2.098i'\v'1.440i'\D'l-0.098i 0.031i' -.sp -1 -\h'2.101i'\v'1.490i'\D'l-0.101i -0.019i' -.sp -1 -\h'1.125i'\v'1.846i'\l'-0.500i' -.sp -1 -\h'0.725i'\v'1.821i'\D'l-0.100i 0.025i' -.sp -1 -\h'0.725i'\v'1.871i'\D'l-0.100i -0.025i' -.sp -1 -\h'0.688i'\v'0.159i'\l'0.437i' -.sp -1 -\h'1.025i'\v'0.184i'\D'l0.100i -0.025i' -.sp -1 -\h'1.025i'\v'0.134i'\D'l0.100i 0.025i' -.sp -1 -\h'0.688i'\v'0.846i'\l'0.437i' -.sp -1 -\h'1.025i'\v'0.871i'\D'l0.100i -0.025i' -.sp -1 -\h'1.025i'\v'0.821i'\D'l0.100i 0.025i' -.sp -1 -\h'5.562i'\v'1.409i'\l'0.313i' -.sp -1 -\h'5.875i'\v'1.409i'\v'-.13m'\L'1.937i\(br'\v'.13m' -.sp -1 -\h'5.875i'\v'3.346i'\D'l-0.250i 0.000i' -.sp -1 -\h'5.725i'\v'3.321i'\D'l-0.100i 0.025i' -.sp -1 -\h'5.725i'\v'3.371i'\D'l-0.100i -0.025i' -.sp -1 -\h'2.062i'\v'2.096i'\l'0.875i' -.sp -1 -\h'2.837i'\v'2.121i'\D'l0.100i -0.025i' -.sp -1 -\h'2.837i'\v'2.071i'\D'l0.100i 0.025i' -.sp -1 -\h'3.000i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'4.875i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'2.013i'\v'2.871i'\D'l0.937i 0.250i' -.sp -1 -\h'2.847i'\v'3.119i'\D'l0.103i 0.002i' -.sp -1 -\h'2.860i'\v'3.071i'\D'l0.090i 0.050i' -.sp -1 -\h'3.062i'\v'3.134i'\D'l1.688i 0.187i' -.sp -1 -\h'4.648i'\v'3.335i'\D'l0.102i -0.014i' -.sp -1 -\h'4.653i'\v'3.285i'\D'l0.097i 0.036i' -.sp -1 -\h'3.062i'\v'2.533i'\D'l1.750i 0.213i' -.sp -1 -\h'4.710i'\v'2.759i'\D'l0.102i -0.013i' -.sp -1 -\h'4.716i'\v'2.709i'\D'l0.096i 0.037i' -.sp -1 -\h'3.062i'\v'2.096i'\l'1.750i' -.sp -1 -\h'4.712i'\v'2.121i'\D'l0.100i -0.025i' -.sp -1 -\h'4.712i'\v'2.071i'\D'l0.100i 0.025i' -.sp -1 -\h'4.812i'\v'2.284i'\l'-1.750i' -.sp -1 -\h'3.162i'\v'2.259i'\D'l-0.100i 0.025i' -.sp -1 -\h'3.162i'\v'2.309i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.250i'\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'0.381i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent\fP -.sp -1 -\h'1.250i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'1.068i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent\fP -.sp -1 -\h'1.250i'\v'1.506i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'1.881i'\h'-0.0m'\v'0.2m'\s10\fRXmbLookupString\fP -.sp -1 -\h'4.875i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'2.437i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\h'1.250i'\v'1.693i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent (returns False) \fP -.sp -1 -\v'2.168i'\h'-0.0m'\v'0.2m'\s10\fRthe focus\fP -.sp -1 -\h'1.250i'\h'-0.0m'\v'0.2m'\s12\fRXlib API\fP -.sp -1 -\v'2.006i'\h'-0.0m'\v'0.2m'\s10\fRApplication moves\fP -.sp -1 -\h'3.187i'\v'0.443i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'3.187i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'3.187i'\v'1.631i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'3.187i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRor XIM_COMMIT\fP -.sp -1 -\h'5.000i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRsynchronous \fP -.sp -1 -\h'5.000i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRrequest\fP -.sp -1 -\h'0.062i'\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRKey event\fP -.sp -1 -\h'0.062i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRKey event\fP -.sp -1 -\h'3.187i'\v'1.131i'\h'-0.0m'\v'0.2m'\s10\fR(synchronous) \fP -.sp -1 -\h'5.000i'\v'1.443i'\h'-0.0m'\v'0.2m'\s10\fRPending\fP -.sp -1 -\h'5.000i'\v'2.381i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'5.000i'\v'2.506i'\h'-0.0m'\v'0.2m'\s10\fR(The focused\fP -.sp -1 -\h'5.000i'\v'2.631i'\h'-0.0m'\v'0.2m'\s10\fRIC is changed) \fP -.sp -1 -\h'5.000i'\v'2.881i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'1.250i'\v'2.131i'\h'-0.0m'\v'0.2m'\s10\fRXSetICFocus\fP -.sp -1 -\h'3.125i'\v'2.881i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC_REPLY as a reply\fP -.sp -1 -\h'3.125i'\v'3.043i'\h'-0.0m'\v'0.2m'\s10\fRof the XIM_FORWARD_EVENT\fP -.sp -1 -\h'1.250i'\v'2.881i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'3.312i'\v'2.506i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SET_IC_FOCUS\fP -.sp -1 -\h'3.312i'\v'2.006i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC\fP -.sp -1 -\h'3.312i'\v'2.193i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC_REPLY\fP -.sp -1 -\h'5.000i'\v'3.381i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -.sp 1+3.408i -.PE -.if \n(00 .fi - -.\"====================== event flow figure end ======================= -.ce -.sp -Fig.2 Sample Protocol Flow -.sp -.LP -.B -Sample Protocol flow chart 2 -.R -.LP -Following chart shows one of the complex protocol flow, which deals -with multiple focus windows and button press event as well as keyevent, -and the focus is moved by the application triggered by both of keyevent -and button press event. -.LP -.bp -.\"====================== event2 flow figure start ===================== -\^... 0.425 5.575 6.3 10.296 -\^... 0.000i 4.721i 5.875i 0.000i -.nr 00 \n(.u -.nf -.PS 4.721i 5.875i -.br -.ps 11 -\h'3.125i'\v'0.496i'\D'l1.625i 0.163i' -.sp -1 -\h'4.648i'\v'0.674i'\D'l0.102i -0.015i' -.sp -1 -\h'4.653i'\v'0.624i'\D'l0.097i 0.035i' -.sp -1 -\h'2.000i'\v'0.409i'\D'l1.000i 0.062i' -.sp -1 -\h'2.899i'\v'0.490i'\D'l0.101i -0.019i' -.sp -1 -\h'2.902i'\v'0.440i'\D'l0.098i 0.031i' -.sp -1 -\h'0.688i'\v'0.159i'\l'0.437i' -.sp -1 -\h'1.025i'\v'0.184i'\D'l0.100i -0.025i' -.sp -1 -\h'1.025i'\v'0.134i'\D'l0.100i 0.025i' -.sp -1 -\h'1.250i'\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'0.381i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent\fP -.sp -1 -\h'3.187i'\v'0.443i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'0.062i'\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRKey event\fP -.sp -1 -\h'3.125i'\v'1.221i'\D'l1.687i 0.125i' -.sp -1 -\h'4.710i'\v'1.364i'\D'l0.102i -0.018i' -.sp -1 -\h'4.714i'\v'1.314i'\D'l0.098i 0.032i' -.sp -1 -\h'4.750i'\v'0.971i'\D'l-1.625i 0.750i' -.sp -1 -\h'3.205i'\v'1.656i'\D'l-0.080i 0.065i' -.sp -1 -\h'3.226i'\v'1.702i'\D'l-0.101i 0.019i' -.sp -1 -\h'2.000i'\v'1.034i'\D'l1.000i 0.125i' -.sp -1 -\h'2.898i'\v'1.171i'\D'l0.102i -0.012i' -.sp -1 -\h'2.904i'\v'1.122i'\D'l0.096i 0.037i' -.sp -1 -\h'0.688i'\v'0.846i'\l'0.437i' -.sp -1 -\h'1.025i'\v'0.871i'\D'l0.100i -0.025i' -.sp -1 -\h'1.025i'\v'0.821i'\D'l0.100i 0.025i' -.sp -1 -\h'3.000i'\v'0.034i'\v'-.13m'\L'4.687i\(br'\v'.13m' -.sp -1 -\h'0.750i'\v'1.346i'\l'0.313i' -.sp -1 -\h'0.963i'\v'1.371i'\D'l0.100i -0.025i' -.sp -1 -\h'0.963i'\v'1.321i'\D'l0.100i 0.025i' -.sp -1 -\h'3.125i'\v'1.509i'\D'l1.687i 0.125i' -.sp -1 -\h'4.710i'\v'1.652i'\D'l0.102i -0.018i' -.sp -1 -\h'4.714i'\v'1.602i'\D'l0.098i 0.032i' -.sp -1 -\h'4.812i'\v'1.721i'\D'l-1.687i 0.188i' -.sp -1 -\h'3.222i'\v'1.873i'\D'l-0.097i 0.036i' -.sp -1 -\h'3.227i'\v'1.923i'\D'l-0.102i -0.014i' -.sp -1 -\h'2.937i'\v'1.971i'\D'l-0.937i 0.188i' -.sp -1 -\h'2.093i'\v'2.115i'\D'l-0.093i 0.044i' -.sp -1 -\h'2.103i'\v'2.164i'\D'l-0.103i -0.005i' -.sp -1 -\h'1.125i'\v'2.533i'\l'-0.500i' -.sp -1 -\h'0.725i'\v'2.508i'\D'l-0.100i 0.025i' -.sp -1 -\h'0.725i'\v'2.558i'\D'l-0.100i -0.025i' -.sp -1 -\h'5.562i'\v'1.346i'\l'0.313i' -.sp -1 -\h'5.875i'\v'1.346i'\v'-.13m'\L'2.687i\(br'\v'.13m' -.sp -1 -\h'5.875i'\v'4.033i'\D'l-0.250i 0.000i' -.sp -1 -\h'5.725i'\v'4.008i'\D'l-0.100i 0.025i' -.sp -1 -\h'5.725i'\v'4.058i'\D'l-0.100i -0.025i' -.sp -1 -\h'2.013i'\v'3.559i'\D'l0.937i 0.250i' -.sp -1 -\h'2.847i'\v'3.807i'\D'l0.103i 0.002i' -.sp -1 -\h'2.860i'\v'3.759i'\D'l0.090i 0.050i' -.sp -1 -\h'3.062i'\v'3.821i'\D'l1.688i 0.188i' -.sp -1 -\h'4.648i'\v'4.023i'\D'l0.102i -0.014i' -.sp -1 -\h'4.653i'\v'3.973i'\D'l0.097i 0.036i' -.sp -1 -\h'2.000i'\v'1.358i'\D'l1.000i 0.126i' -.sp -1 -\h'2.898i'\v'1.496i'\D'l0.102i -0.012i' -.sp -1 -\h'2.904i'\v'1.447i'\D'l0.096i 0.037i' -.sp -1 -\h'3.062i'\v'2.159i'\D'l-0.250i 0.000i' -.sp -1 -\h'2.812i'\v'2.159i'\v'-.13m'\L'1.812i\(br'\v'.13m' -.sp -1 -\h'2.812i'\v'3.971i'\D'l0.125i 0.125i' -.sp -1 -\h'2.849i'\v'4.043i'\D'l0.088i 0.053i' -.sp -1 -\h'2.884i'\v'4.008i'\D'l0.053i 0.088i' -.sp -1 -\h'2.062i'\v'2.783i'\l'0.875i' -.sp -1 -\h'2.837i'\v'2.808i'\D'l0.100i -0.025i' -.sp -1 -\h'2.837i'\v'2.758i'\D'l0.100i 0.025i' -.sp -1 -\h'2.062i'\v'3.783i'\D'l0.813i 0.438i' -.sp -1 -\h'2.775i'\v'4.196i'\D'l0.100i 0.025i' -.sp -1 -\h'2.799i'\v'4.152i'\D'l0.076i 0.069i' -.sp -1 -\h'0.625i'\v'3.533i'\l'0.438i' -.sp -1 -\h'0.963i'\v'3.558i'\D'l0.100i -0.025i' -.sp -1 -\h'0.963i'\v'3.508i'\D'l0.100i 0.025i' -.sp -1 -\h'3.062i'\v'4.346i'\D'l1.625i 0.163i' -.sp -1 -\h'4.585i'\v'4.524i'\D'l0.102i -0.015i' -.sp -1 -\h'4.590i'\v'4.474i'\D'l0.097i 0.035i' -.sp -1 -\h'4.875i'\v'0.034i'\v'-.13m'\L'4.687i\(br'\v'.13m' -.sp -1 -\h'3.062i'\v'4.146i'\D'l1.688i 0.187i' -.sp -1 -\h'4.648i'\v'4.347i'\D'l0.102i -0.014i' -.sp -1 -\h'4.653i'\v'4.297i'\D'l0.097i 0.036i' -.sp -1 -\h'3.062i'\v'2.871i'\D'l1.750i 0.212i' -.sp -1 -\h'4.710i'\v'3.096i'\D'l0.102i -0.013i' -.sp -1 -\h'4.716i'\v'3.046i'\D'l0.096i 0.037i' -.sp -1 -\h'1.250i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'1.068i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent\fP -.sp -1 -\h'4.875i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'2.437i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\h'1.250i'\h'-0.0m'\v'0.2m'\s12\fRXlib API\fP -.sp -1 -\h'3.187i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'5.000i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRsynchronous \fP -.sp -1 -\h'5.000i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRrequest\fP -.sp -1 -\h'0.062i'\v'0.881i'\h'-0.0m'\v'0.2m'\s10\fRKey event\fP -.sp -1 -\h'3.187i'\v'1.131i'\h'-0.0m'\v'0.2m'\s10\fR(synchronous) \fP -.sp -1 -\h'0.062i'\v'1.256i'\h'-0.0m'\v'0.2m'\s10\fRButton press causes\fP -.sp -1 -\h'0.062i'\v'1.381i'\h'-0.0m'\v'0.2m'\s10\fRfocus change\fP -.sp -1 -\h'1.250i'\v'1.381i'\h'-0.0m'\v'0.2m'\s10\fRXSetICFocus\fP -.sp -1 -\h'3.250i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRor XIM_COMMIT\fP -.sp -1 -\h'3.187i'\v'1.443i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'3.687i'\v'1.693i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC\fP -.sp -1 -\h'3.375i'\v'2.006i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC_REPLY\fP -.sp -1 -\h'1.250i'\v'2.193i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'1.250i'\v'2.568i'\h'-0.0m'\v'0.2m'\s10\fRXmbLookupString\fP -.sp -1 -\h'1.250i'\v'2.381i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent (returns False) \fP -.sp -1 -\v'2.856i'\h'-0.0m'\v'0.2m'\s10\fRthe focus\fP -.sp -1 -\v'2.693i'\h'-0.0m'\v'0.2m'\s10\fRApplication moves\fP -.sp -1 -\h'5.000i'\v'3.068i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'5.000i'\v'3.193i'\h'-0.0m'\v'0.2m'\s10\fR(The focused\fP -.sp -1 -\h'5.000i'\v'3.318i'\h'-0.0m'\v'0.2m'\s10\fRIC is changed) \fP -.sp -1 -\h'5.000i'\v'3.568i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'3.125i'\v'3.568i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SYNC_REPLY as a reply\fP -.sp -1 -\h'3.125i'\v'3.731i'\h'-0.0m'\v'0.2m'\s10\fRof the XIM_FORWARD_EVENT\fP -.sp -1 -\h'1.250i'\v'3.568i'\h'-0.0m'\v'0.2m'\s10\fRXNextEvent\fP -.sp -1 -\h'5.000i'\v'4.068i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'5.000i'\v'1.381i'\h'-0.0m'\v'0.2m'\s10\fRPending\fP -.sp -1 -\h'5.000i'\v'4.256i'\h'-0.0m'\v'0.2m'\s10\fRprocessed\fP -.sp -1 -\h'1.250i'\v'2.818i'\h'-0.0m'\v'0.2m'\s10\fRXSetICFocus\fP -.sp -1 -\h'3.125i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRis started by XIM_COMMIT\fP -.sp -1 -\h'3.125i'\v'2.193i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SET_IC_FOCUS is\fP -.sp -1 -\h'3.125i'\v'2.318i'\h'-0.0m'\v'0.2m'\s10\fRpend because another sync cycle\fP -.sp -1 -\h'2.062i'\v'1.693i'\h'-0.0m'\v'0.2m'\s10\fRsync cycle is done\fP -.sp -1 -\h'2.062i'\v'1.568i'\h'-0.0m'\v'0.2m'\s10\fRPending until\fP -.sp -1 -\v'3.568i'\h'-0.0m'\v'0.2m'\s10\fRKey event\fP -.sp -1 -\h'1.250i'\v'3.756i'\h'-0.0m'\v'0.2m'\s10\fRXFilterEvent\fP -.sp -1 -\h'3.125i'\v'4.631i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -\h'3.375i'\v'4.131i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SET_IC_FOCUS\fP -.sp -1 -\h'3.250i'\v'2.818i'\h'-0.0m'\v'0.2m'\s10\fRXIM_SET_IC_FOCUS\fP -.sp -1 -.sp 1+4.721i -.PE -.if \n(00 .fi - -.\"====================== event2 flow figure end ======================= -.ce -.sp -Fig.3 Sample Protocol Flow chart -.LP -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_FORWARD_EVENT (IM library \(<-\(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:BITMASK16:flag -::#0001:synchronous -::#0002:request filtering (*1) -::#0004:request lookupstring (*2) -:2:CARD16:serial number -::XEVENT:X event -.TE -.LP -.IP (*1) -Indicate the receiver should filter events and possible preedit may be invoked. -.IP (*2) -Indicate the receiver should only do lookup string. The IM Server is expected -to just do a conversion of the key event to the best candidate. This bit may -affect the state of the preedit state (e.g. compose of dead key sequences). -.RE -.LP -XEVENT format is same as the X Protocol event format(xEvent). -As the value of xEvent's sequenceNumber is the bottom of 16 bit of XEvent's -xany.serial, the top of 16 bit is sent by serial number(INT16). -.LP -.PN XIM_FORWARD_EVENT -message is used for forwarding the events from the IM library to the IM Server -in order for IM to be able to filter the event. On the other hand, this -message is also used for forwarding the events from the IM Server to the IM -library if the event forwarded from the IM library is not filtered. -The IM Server, which receives -.PN XIM_FORWARD_EVENT -message without synchronous bit, should set synchronous bit. -If both ``request event filtering'' and ``request lookupstring'' flag are -set, then both filtering and lookup should be done for the same event. -.LP -.NH 2 -Synchronizing with the IM Server -.XS -\*(SN Synchronizing with the IM Server -.XE -.LP -.PN XIM_SYNC -message requests to synchronize the IM library and the IM Server. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SYNC (IM library \(<-\(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -This synchronization can be started either on the IM library side or on the -IM Server side. The side which receives -.PN XIM_SYNC -message should process all XIM requests before replying. The input-context-ID -is necessary to distinguish the IC with which the IM library and the IM -Server are synchronized. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_SYNC_REPLY (IM Server \(<-\(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -The side which receives -.PN XIM_FORWARD_EVENT, -.PN XIM_COMMIT -or any other message with synchronous bit, should process all XIM request -before replying, and send -.PN XIM_SYNC_REPLY -message as the reply to the previous message. -.LP -.NH 2 -Sending a committed string -.XS -\*(SN Sending a committed string -.XE -.LP -When the IM Server commits a string, the IM Server sends either the committed -string or list of KeySym, or both, by -.PN XIM_COMMIT -message. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_COMMIT (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:BITMASK16:flag -::#0001:synchronous -::#0002:XLookupChars -::#0004:XLookupKeySym -::#0006: XLookupBoth = XLookupChars | XLookupKeySym -.TE -.LP -If flag is XLookupKeySym, the arguments continue as follows: -.TS -tab(:); -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -:2::unused -:4:KEYSYM:KeySym -.TE -.LP -If flag is XLookupChars, the arguments continue as follows: -.TS -tab(:); -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -:2:m:byte length of committed string -:m:LISTofBYTE:committed string -:p::unused, p = Pad(m) -.TE -.LP -If flag is XLookupBoth, the arguments continue as follows: -.TS -tab(:); -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -:2::unused -:4:KEYSYM:KeySym -:2:n:byte length of committed string -:n:LISTofBYTE:committed string -:p::unused, p = Pad(2+n) -.TE -.RE -.LP -The IM Server which receives -.PN XIM_COMMIT -message without synchronous bit should set synchronous bit. -.LP -.NH 2 -Reset IC -.XS -\*(SN Reset IC -.XE -.LP -.PN XIM_RESET_IC -message requests to reset the status of IC in the IM Server. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_RESET_IC (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.PN XIM_RESET_IC -is a synchronous request. The IM library should wait until receiving either an -.PN XIM_RESET_IC_REPLY -packet or an -.PN XIM_ERROR -packet. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_RESET_IC_REPLY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:n:byte length of preedit string -:n:LISTofBYTE:preedit string -:p::unused, p = Pad(2+n) -.TE -.RE -.LP -.PN XIM_RESET_IC_REPLY -message returns the input-context-ID to distinguish replies from multiple ICs. -.LP -.\"============================== Callbacks =============================== -.NH 2 -Callbacks -.XS -\*(SN Callbacks -.XE -.LP -If XIMStyle has XIMPreeditArea or XIMStatusArea set, XIMGeometryCallback -may be used, and if XIMPreeditCallback and/or XIMStatusCallback are set, -corresponding callbacks may be used. -.LP -Any callback request may be sent from an IM Server to an IM client -asynchronously in response to any request previously sent by the IM client -to the IM Server. -.LP -When an IM Server needs to send a callback request synchronously with -the request previously sent by an IM client, the IM Server sends it -before replying to the previous request. -.LP -.NH 3 -Negotiating geometry -.XS -\*(SN Negotiating geometry -.XE -.LP -The IM Server sends -.PN XIM_GEOMETRY -message to start geometry negotiation, if XIMStyle has XIMPreeditArea or -XIMStatusArea set. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_GEOMETRY (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -There is always a single Focus Window, even if some input fields have only -one IC. -.LP -.NH 3 -Converting a string -.XS -\*(SN Converting a string -.XE -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_STR_CONVERSION (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:CARD16:XIMStringConversionPosition -:2::unused -:4:CARD32:XIMCaretDirection -::#0:XIMForwardChar -::#1:XIMBackwardChar -::#2:XIMForwardWord -::#3:XIMBackwardWord -::#4:XIMCaretUp -::#5:XIMCaretDown -::#6:XIMNextLine -::#7:XIMCPreviousLine -::#8:XIMLineStart -::#9:XIMLineEnd -::#10:XIMAbsolutePosition -::#11:XIMDontChange -:2:CARD16:factor -:2:CARD16:XIMStringConversionOperation -::#0001:XIMStringConversionSubstitution -::#0002:XIMStringConversionRetrieval -:2:INT16:T{ -byte length to multiply the XIMStringConversionType -T} -.TE -.RE -.sp -.LP -.PN XIM_STR_CONVERSION -message may be used to start the string conversion from the IM -Server. -.LP -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_STR_CONVERSION_REPLY (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:CARD32:XIMStringConversionFeedback -::XIMSTRCONVTEXT:XIMStringConversionText -.sp -.TE -.RE -.LP -.PN XIM_STR_CONVERSION_REPLY -message returns the string to be converted and the feedback information array. -.LP -.NH 3 -Preedit Callbacks -.XS -\*(SN Preedit Callbacks -.XE -.LP -The IM Server sends -.PN XIM_PREEDIT_START -message to call the XIMPreeditStartCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_START (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -The reply to this message must be sent synchronously. The reply forwards -the return value from the callback function to the IM Server. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_START_REPLY (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:INT32:return value -.TE -.RE -.LP -.PN XIM_PREEDIT_START_REPLY -message returns the input-context-ID to distinguish replies from multiple -IC's. The return value contains the return value of the function -XIMPreeditStartCallback. -.LP -The IM Server sends -.PN XIM_PREEDIT_DRAW -message to call the XIMPreeditDrawCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_DRAW (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:INT32:caret -:4:INT32:chg_first -:4:INT32:chg_length -:4:BITMASK32:status -::#x0000001:no string -::#x0000002:no feedback -:2:n:length of preedit string -:n:STRING8:preedit string -:p::unused, p = Pad(2+n) -:2:m:byte length of feedback array -:2::unused -:m:LISTofXIMFEEDBACK:feedback array -.TE -.RE -.LP -The fields ``caret'', ``chg_first'' and ``chg_length'' correspond to the -fields of XIMPreeditDrawCallbackStruct. -When the ``no string'' bit of the status field is set, the text field of -XIMPreeditDrawCallbackStruct is NULL. -When the ``no feedback'' bit of the status field is set, the text feedback -field of XIMPreeditDrawCallbackStruct is NULL. -When the above bits are not set, ``preedit string'' contains the preedit -string to be displayed, and the feedback array contains feedback information. -.LP -The IM Server sends -.PN XIM_PREEDIT_CARET -message to call the PreeditCaretCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_CARET (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:INT32:position -:4:CARD32:direction -::#0:XIMForwardChar -::#1:XIMBackwardChar -::#2:XIMForwardWord -::#3:XIMBackwardWord -::#4:XIMCaretUp -::#5:XIMCaretDown -::#6:XIMNextLine -::#7:XIMCPreviousLine -::#8:XIMLineStart -::#9:XIMLineEnd -::#10:XIMAbsolutePosition -::#11:XIMDontChange -:4:CARD32:style -::#0:XIMInvisible -::#1:XIMCPrimary -::#2:XIMSecondary -.TE -.RE -.LP -Each entry corresponds to a field of XIMPreeditCaretCallbackStruct. -Since this callback sets the caret position, its reply must be sent -synchronously. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_CARET_REPLY (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:CARD32:position -.TE -.RE -.LP -The position is the value returned by the callback function after it -has been called. -.LP -The IM Server sends -.PN XIM_PREEDIT_DONE -message to call the XIMPreeditDoneCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDIT_DONE (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.NH 3 -Preedit state notify -.XS -\*(SN Preedit state notify -.XE -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_PREEDITSTATE (IM Server \(-> IM Library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:BITMASK32:XIMPreeditState -::#x0000000:XIMPreeditUnknown -::#x0000001:XIMPreeditEnable -::#x0000002:XIMPreeditDisable -.TE -.sp -.TE -.RE -.LP -.PN XIM_PREEDITSTATE -message is used to call the XIMPreeditStateNotifyCallback function. -.LP -.NH 3 -Status Callbacks -.XS -\*(SN Status Callbacks -.XE -.LP -The IM Server sends -.PN XIM_STATUS_START -message to call the XIMStatusStartCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_STATUS_START (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -The IM Server sends -.PN XIM_STATUS_DRAW -message to call the XIMStatusDrawCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_STATUS_DRAW (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:CARD32:type -::#0:XIMTextType -::#1:XIMBitmapType -.TE -.LP -If type is XIMTextType, the arguments continue as follows. -.TS -tab(:); -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -:4:BITMASK32:status -::#x0000001:no string -::#x0000002:no feedback -:2:n:length of status string -:n:STRING8:status string -:p::unused, p = Pad(2+n) -:2:m:byte length of feedback array -:2::unused -:m:LISTofXIMFEEDBACK:feedback array -.TE -.LP -If type is XIMBitmapType, the arguments continue as follows. -.TS -tab(:); -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -:4:PIXMAP:pixmap data -.TE -.RE -.LP -The field ``type'' corresponds to the field in XIMStatusDrawCallbackStruct. -.LP -The IM Server sends -.PN XIM_STATUS_DONE -message to call the XIMStatusDoneCallback function. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_STATUS_DONE (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -.TE -.RE -.LP -.bp -.NH 1 -Acknowledgements -.XS -\*(SN Acknowledgements -.XE -.LP -This document represents the culmination of several years of debate and -experiments done under the auspices of the MIT X Consortium i18n working -group. Although this was a group effort, the author remains responsible -for any errors or omissions. -.LP -We would like to thank to all members of this group. -And we would like to make special thanks to the following people -(in alphabetical order) for their participation in the IM Protocol -design, -Hector Chan, Takashi Fujiwara, Yoshio Horiuchi, Makoto Inada, -Hiromu Inukai, Mickael Kung, Seiji Kuwari, Franky Ling, Hiroyuki Machida, -Hiroyuki Miyamoto, Frank Rojas, Bob Scheifler, Makiko Shimamura, -Shoji Sugiyama, Hidetoshi Tajima, Masaki Takeuchi, Makoto Wakamatsu, -Masaki Wakao, Nobuyuki Tanaka, Shigeru Yamada, Katsuhisa Yano, Jinsoo Yoon. -.LP -.NH 1 -References -.XS -\*(SN References -.XE -.LP -All of the following documents are X Consortium standards available from MIT: -.LP -[1] Scheifler, Robert W., \fI``X Window System Protocol Version 11''\fP -.LP -[2] Scheifler, Robert W. etc., \fI``Xlib \- C Language X Interface''\fP -.LP -.bp -.XS -Appendix A \- Common Extensions -.XE -.ce 10 -.sp 5 -\s+2\fBAppendix A\fP\s-2 -.sp -\s+1\fBCommon Extensions\fP\s-1 -.ce 0 -.sp -.LP -Extension opcodes and packet names (e.g. -.PN XIM_EXT_SET_EVENT_MASK -) for additional extensions may be registered with X Consortium. -The following is a commonly well-known extended packet. -.LP -.LP -.IP \fB(1) -Extension to manipulate the event handling\fP -.LP -.PN XIM_EXT_SET_EVENT_MASK -message specifies the set of event masks that the IM library should manipulate. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_EXT_SET_EVENT_MASK (IM Server \(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:4:EVENTMASK:filter-event-mask (*1) -:4:EVENTMASK:intercept-event-mask (*2) -:4:EVENTMASK:select-event-mask (*3) -:4:EVENTMASK:forward-event-mask (*4) -:4:EVENTMASK:synchronous-event-mask (*5) -.TE -.IP (*1) -Specify the events to be neglected by the IM library via XFilterEvent. -.IP (*2) -Specify the events to be deselected by the IM library with XSelectInput. -.IP (*3) -Specify the events to be selected by the IM library with XSelectInput. -.IP (*4) -Specify all the events to be forwarded to the IM Server by the IM library. -.IP (*5) -Specify the events to be forwarded with synchronous flag on by the IM library. -.RE -.LP -The IM library must reply -.PN XIM_SYNC_REPLY -message to the IM Server. This request is valid after the ic is created. -.LP -.sp -.IP \fB(2) -Extension for improvement of performance\fR -.LP -The following requests may be used for improvement of performance. -.LP -.PN XIM_EXT_FORWARD_KEYEVENT -message may be used instead of -.PN XIM_FORWARD_EVENT -message. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_EXT_FORWARD_KEYEVENT (IM Server \(<-\(-> IM library) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:BITMASK16:flag -::#0001:synchronous -:2:CARD16:sequence number -:1:BYTE:xEvent.u.u.type -:1:BYTE:keycode -:2:CARD16:state -:4:CARD32:time -:4:CARD32:window -.TE -.RE -.LP -.bp -.PN XIM_EXT_MOVE -message may be used to change the spot location instead of -.PN -XIM_SET_IC_VALUES -message. -It is effective only if the client specified XIMPreeditPosition. -.RS -.TS -tab(:); -lfB s s s -lw(.25i) lw(.25i) lw(1.75i) lw(3.5i). -XIM_EXT_MOVE (IM library \(-> IM Server) -.sp 6p -:2:CARD16:input-method-ID -:2:CARD16:input-context-ID -:2:INT16:X -:2:INT16:Y -.TE -.RE -.LP -.PN XIM_EXT_MOVE -message is a asynchronous request. -.LP -.bp -.XS -Appendix B \- The list of transport specific IM Server names registered -.XE -.ce 10 -.sp 5 -\s+2\fBAppendix B\fP\s-2 -.sp -\s+1\fBThe list of transport specific IM Server address format registered\fP\s-1 -.ce 0 -.sp -.LP -The following format represents the ATOM contained in -.PN XIM_SERVERS -property and the string returned from the request converting -selection target LOCALES and TRANSPORT. -.DS - ``{@\^\fIcategory\fP\^=[\^\fIvalue\fP,...]}...'' -.DE -.LP -The following categories are currently registered. -.RS -.TS -tab(;); -l l. -\fBserver\fP;: IM Server name (used for XIM_SERVERS) -\fBlocale\fP;: XPG4 locale name (LOCALES) -\fBtransport\fP;: transport-specific name (TRANSPORT) -.TE -.RE -.LP -The preregistered formats for transport-specific names are as follows: -.RS -.LP -\fBTCP/IP Names\fP -.LP -.RS -The following syntax should be used for system internal domain names: -.DS -<\fIlocal name\fP> ::= ``local/''<\fIhostname\fP>``:''<\fIpathname\fP> -.DE -.LP -Where <\fIpathname\fP> is a path name of socket address. -.LP -IM Server's name should be set to <\fIpathname\fP> to run multiple IM Server -at the same time -.LP -The following syntax should be used for Internet domain names: -.DS -<\fITCP name\fP> ::= ``tcp/''<\fIhostname\fP>``:''<\fIipportnumber\fP> -.DE -where <\fIhostname\fP> is either symbolic (such as expo.lcs.mit.edu) or -numeric decimal (such as 18.30.0.212). The <\fIipportnumber\fP> is the -port on which the IM Server is listening for connections. -For example: -.DS -tcp/expo.lcs.mit.edu:8012 -tcp/18.30.0.212:7890 -.DE -.RE -.LP -\fBDECnet Names\fP -.LP -.RS -The following syntax should be used for DECnet names: -.DS -<\fIDECnet name\fP> ::= ``decnet/''<\fInodename\fP>``::IMSERVER$''<\fIobjname\fP> -.DE -where <\fInodename\fP> is either symbolic (such as SRVNOD) or the numeric -decimal form of the DECnet address (such as 44.70). The <\fIobjname\fP> -is normal, case-insensitive DECnet object name. For example: -.DS -DECNET/SRVNOD::IMSERVER$DEFAULT -decnet/44.70::IMSERVER$other -.DE -.RE -.LP -\fBX Names\fP -.LP -.RS -The following syntax should be used for X names: -.DS -<\fIX name\fP> ::= ``X/'' -.DE -.RE -.RE -.LP -If a given category has multiple values, the value is evaluated in order of -setting. -.bp -.XS -Appendix C \- Protocol number -.XE -.ce 10 -.sp 5 -\s+2\fBAppendix C\fP\s-2 -.sp -\s+1\fBProtocol number\fP\s-1 -.ce 0 -.sp -.LP -\fBMajor Protocol number\fP -.TS -center, tab(:); -lw(9c) l. -XIM_CONNECT:#001 -XIM_CONNECT_REPLY:#002 -XIM_DISCONNECT:#003 -XIM_DISCONNECT_REPLY:#004 - -XIM_AUTH_REQUIRED:#010 -XIM_AUTH_REPLY:#011 -XIM_AUTH_NEXT:#012 -XIM_AUTH_SETUP:#013 -XIM_AUTH_NG:#014 - -XIM_ERROR:#020 - -XIM_OPEN:#030 -XIM_OPEN_REPLY:#031 -XIM_CLOSE:#032 -XIM_CLOSE_REPLY:#033 -XIM_REGISTER_TRIGGERKEYS:#034 -XIM_TRIGGER_NOTIFY:#035 -XIM_TRIGGER_NOTIFY_REPLY:#036 -XIM_SET_EVENT_MASK:#037 -XIM_ENCODING_NEGOTIATION:#038 -XIM_ENCODING_NEGOTIATION_REPLY:#039 -XIM_QUERY_EXTENSION:#040 -XIM_QUERY_EXTENSION_REPLY:#041 -XIM_SET_IM_VALUES:#042 -XIM_SET_IM_VALUES_REPLY:#043 -XIM_GET_IM_VALUES:#044 -XIM_GET_IM_VALUES_REPLY:#045 - -XIM_CREATE_IC:#050 -XIM_CREATE_IC_REPLY:#051 -XIM_DESTROY_IC:#052 -XIM_DESTROY_IC_REPLY:#053 -XIM_SET_IC_VALUES:#054 -XIM_SET_IC_VALUES_REPLY:#055 -XIM_GET_IC_VALUES:#056 -XIM_GET_IC_VALUES_REPLY:#057 -XIM_SET_IC_FOCUS:#058 -XIM_UNSET_IC_FOCUS:#059 -XIM_FORWARD_EVENT:#060 -XIM_SYNC:#061 -XIM_SYNC_REPLY:#062 -XIM_COMMIT:#063 -XIM_RESET_IC:#064 -XIM_RESET_IC_REPLY:#065 - -XIM_GEOMETRY:#070 -XIM_STR_CONVERSION:#071 -XIM_STR_CONVERSION_REPLY:#072 -XIM_PREEDIT_START:#073 -XIM_PREEDIT_START_REPLY:#074 -XIM_PREEDIT_DRAW:#075 -XIM_PREEDIT_CARET:#076 -XIM_PREEDIT_CARET_REPLY:#077 -XIM_PREEDIT_DONE:#078 -XIM_STATUS_START:#079 -XIM_STATUS_DRAW:#080 -XIM_STATUS_DONE:#081 -XIM_PREEDITSTATE:#082 -.TE -.sp -(*) The IM Server's extension protocol number should be more than #128. -.bp -.XS -Appendix D \- Implementation Tips -.XE -.ce 10 -.sp 5 -\s+2\fBAppendix D\fP\s-2 -.sp -\s+1\fBImplementation Tips\fP\s-1 -.ce 0 -.sp -.LP -.B -.IP \fB(1) -FrontEnd Method\fP -.LP -FrontEnd method is recognized as a performance acceleration by the -trade off of the variety of the reliability. -.LP -In order to use the FrontEnd method, the IM library must query the IM -Server to see if the FrontEnd extension is available. The query is -made by using the -.PN XIM_QUERY_EXTENSION -message. The IM Server may send -.PN XIM_EXT_SET_EVENT_MASK -message with intercept-event-mask, forward-event-mask, and -synchronous-event-mask values set after replying -.PN XIM_QUERY_EXTENSION_REPLY -message. -.LP -FrontEnd method can be implemented in a couple of ways depending on -how the IM Server utilize -.PN XIM_EXT_SET_EVENT_MASK -message. -.LP -One approach is to update both of the input mask and the filter-event-mask -depending on the preeidting state. The sample protocol sequence using the -static event flow is as follows: -.LP -.\"=================================================================== -.sp -\^... 1.675 6.888 6.237 10.296 -\^... 0.000i 3.408i 4.562i 0.000i -.nr 00 \n(.u -.nf -.PS 3.408i 4.562i -.br -.ps 11 -\h'3.750i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'3.912i'\v'1.384i'\D'l-0.100i 0.025i' -.sp -1 -\h'3.912i'\v'1.434i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.812i'\v'1.409i'\l'0.750i' -.sp -1 -\h'3.750i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'3.812i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'3.812i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRto select the event\fP -.sp -1 -\h'3.875i'\v'2.381i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'3.875i'\v'2.568i'\h'-0.0m'\v'0.2m'\s10\fRto deselect the event\fP -.sp -1 -\h'3.875i'\v'1.631i'\h'-0.0m'\v'0.2m'\s10\fRX events directly come\fP -.sp -1 -\h'3.875i'\v'1.756i'\h'-0.0m'\v'0.2m'\s10\fRto the IM Server.\fP -.sp -1 -\h'3.875i'\v'2.006i'\h'-0.0m'\v'0.2m'\s10\fRwhen preediting is turning off\fP -.sp -1 -\h'0.625i'\v'0.284i'\l'0.875i' -.sp -1 -\h'1.400i'\v'0.309i'\D'l0.100i -0.025i' -.sp -1 -\h'1.400i'\v'0.259i'\D'l0.100i 0.025i' -.sp -1 -\h'1.750i'\v'0.346i'\l'1.687i' -.sp -1 -\h'3.337i'\v'0.371i'\D'l0.100i -0.025i' -.sp -1 -\h'3.337i'\v'0.321i'\D'l0.100i 0.025i' -.sp -1 -\h'1.850i'\v'2.134i'\D'l-0.100i 0.025i' -.sp -1 -\h'1.850i'\v'2.184i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.750i'\v'2.159i'\l'1.687i' -.sp -1 -\h'1.562i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'1.850i'\v'0.446i'\D'l-0.100i 0.025i' -.sp -1 -\h'1.850i'\v'0.496i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.750i'\v'0.471i'\l'1.687i' -.sp -1 -\h'1.687i'\v'0.631i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'1.875i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRintercept-event-mask is set\fP -.sp -1 -\h'1.687i'\v'2.318i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'1.875i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRselect-event-mask is set\fP -.sp -1 -\h'0.937i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'0.250i'\v'2.318i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'0.250i'\v'2.506i'\h'-0.0m'\v'0.2m'\s10\fRto select the event\fP -.sp -1 -\h'0.250i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRto deselect the event\fP -.sp -1 -\h'0.250i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'1.812i'\v'0.256i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -.sp 1+3.408i -.PE -.if \n(00 .fi -.sp -.\"=================================================================== -.LP -To pursuit a maximum performance regardless of the preediting mode, -the IM Server may use the dynamic event flow with the following -sample protocol sequence. -.bp -.LP -.\"=================================================================== -\^... 1.675 6.888 6.237 10.296 -\^... 0.000i 3.408i 4.562i 0.000i -.nr 00 \n(.u -.nf -.PS 3.408i 4.562i -.br -.ps 11 -\h'3.750i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'3.912i'\v'1.384i'\D'l-0.100i 0.025i' -.sp -1 -\h'3.912i'\v'1.434i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.812i'\v'1.409i'\l'0.750i' -.sp -1 -\h'3.750i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'3.812i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'3.812i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRto select the event\fP -.sp -1 -\h'3.875i'\v'2.381i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'3.875i'\v'2.568i'\h'-0.0m'\v'0.2m'\s10\fRto deselect the event\fP -.sp -1 -\h'3.875i'\v'1.631i'\h'-0.0m'\v'0.2m'\s10\fRX events directly come\fP -.sp -1 -\h'3.875i'\v'1.756i'\h'-0.0m'\v'0.2m'\s10\fRto the IM Server.\fP -.sp -1 -\h'3.875i'\v'2.006i'\h'-0.0m'\v'0.2m'\s10\fRwhen preediting is turning off\fP -.sp -1 -\h'0.625i'\v'0.284i'\l'0.875i' -.sp -1 -\h'1.400i'\v'0.309i'\D'l0.100i -0.025i' -.sp -1 -\h'1.400i'\v'0.259i'\D'l0.100i 0.025i' -.sp -1 -\h'1.750i'\v'0.346i'\l'1.687i' -.sp -1 -\h'3.337i'\v'0.371i'\D'l0.100i -0.025i' -.sp -1 -\h'3.337i'\v'0.321i'\D'l0.100i 0.025i' -.sp -1 -\h'1.850i'\v'1.196i'\D'l-0.100i 0.025i' -.sp -1 -\h'1.850i'\v'1.246i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.750i'\v'1.221i'\l'1.687i' -.sp -1 -\h'1.850i'\v'2.134i'\D'l-0.100i 0.025i' -.sp -1 -\h'1.850i'\v'2.184i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.750i'\v'2.159i'\l'1.687i' -.sp -1 -\h'1.562i'\v'0.034i'\v'-.13m'\L'3.374i\(br'\v'.13m' -.sp -1 -\h'1.850i'\v'0.446i'\D'l-0.100i 0.025i' -.sp -1 -\h'1.850i'\v'0.496i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.750i'\v'0.471i'\l'1.687i' -.sp -1 -\h'1.812i'\v'0.256i'\h'-0.0m'\v'0.2m'\s10\fRXIM_TRIGGER_NOTIFY\fP -.sp -1 -\h'1.687i'\v'1.068i'\h'-0.0m'\v'0.2m'\s10\fRXIM_TRIGGER_NOTIFY_REPLY\fP -.sp -1 -\h'1.687i'\v'0.631i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'1.875i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRintercept-event-mask is set\fP -.sp -1 -\h'1.687i'\v'2.318i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'1.875i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRselect-event-mask is set\fP -.sp -1 -\h'0.937i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\v'0.193i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'0.250i'\v'2.318i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -\h'0.250i'\v'2.506i'\h'-0.0m'\v'0.2m'\s10\fRto select the event\fP -.sp -1 -\h'0.250i'\v'1.006i'\h'-0.0m'\v'0.2m'\s10\fRto deselect the event\fP -.sp -1 -\h'0.250i'\v'0.818i'\h'-0.0m'\v'0.2m'\s10\fRevent mask is changed\fP -.sp -1 -.sp 1+3.408i -.PE -.if \n(00 .fi -.\"=================================================================== -.LP -This method can reduce the XIM protocol traffic dramatically -by updating intercept-event-mask and select-event-mask accordingly. -The tradeoff of this performance improvement is that the key -events may be lost or disordered in some particular situation, such as -when the user types the keyboard in following sequence really fast: -.sp 6p -.RS -``some strings''``another string'' -.RE -.sp 6p -Since this method requires the input mask updates to the both the IM Server -and Xlib when turning on and off the preediting, and there is a time lag -till the requests take effect when two client issues the input mask updates -simultaneously. -.LP -Another approach of the FrontEnd method is to update the filter-event-mask -depending on the preediting state and not to update the input mask. -The IM Server must register both of the preediting on key list and off key -list by -.PN XIM_REGISTER_TRIGGERKEYS -message. -In this method, Both the IM Server and the IM client select the same -events on the same client's window, so that the events are delivered -to both of the IM Server and the client. The preediting on and off -states are expressed by whether the key events are filtered or not. -The sample protocol sequence are as follows: -.LP -.bp -<> -.LP -.\"==================================================================== -.sp -\^... 1.488 7.325 6.487 10.358 -\^... 0.000i 3.033i 4.999i 0.000i -.nr 00 \n(.u -.nf -.PS 3.033i 4.999i -.br -.ps 11 -\h'4.099i'\v'0.383i'\D'l-0.100i 0.025i' -.sp -1 -\h'4.099i'\v'0.433i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.999i'\v'0.408i'\l'1.000i' -.sp -1 -\h'4.099i'\v'1.696i'\D'l-0.100i 0.025i' -.sp -1 -\h'4.099i'\v'1.746i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.999i'\v'1.721i'\l'1.000i' -.sp -1 -\h'3.937i'\v'0.096i'\v'-.13m'\L'2.937i\(br'\v'.13m' -.sp -1 -\h'3.937i'\v'0.062i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'4.062i'\v'0.755i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'4.062i'\v'0.943i'\h'-0.0m'\v'0.2m'\s10\fRare being processed\fP -.sp -1 -\h'4.062i'\v'2.255i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'4.062i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRare being discarded\fP -.sp -1 -\h'4.249i'\v'1.568i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the off-key-list\fP -.sp -1 -\h'4.187i'\v'0.318i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'0.812i'\v'0.346i'\l'0.875i' -.sp -1 -\h'1.587i'\v'0.371i'\D'l0.100i -0.025i' -.sp -1 -\h'1.587i'\v'0.321i'\D'l0.100i 0.025i' -.sp -1 -\h'1.937i'\v'0.408i'\l'1.687i' -.sp -1 -\h'3.524i'\v'0.433i'\D'l0.100i -0.025i' -.sp -1 -\h'3.524i'\v'0.383i'\D'l0.100i 0.025i' -.sp -1 -\h'1.749i'\v'0.096i'\v'-.13m'\L'2.937i\(br'\v'.13m' -.sp -1 -\h'2.037i'\v'0.508i'\D'l-0.100i 0.025i' -.sp -1 -\h'2.037i'\v'0.558i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.937i'\v'0.533i'\l'1.687i' -.sp -1 -\h'0.812i'\v'1.721i'\l'0.875i' -.sp -1 -\h'1.587i'\v'1.746i'\D'l0.100i -0.025i' -.sp -1 -\h'1.587i'\v'1.696i'\D'l0.100i 0.025i' -.sp -1 -\h'2.099i'\v'1.758i'\D'l-0.100i 0.025i' -.sp -1 -\h'2.099i'\v'1.808i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.999i'\v'1.783i'\l'1.688i' -.sp -1 -\h'1.874i'\v'0.693i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\v'0.255i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'2.062i'\v'0.880i'\h'-0.0m'\v'0.2m'\s10\fRfilter-event-mask is set\fP -.sp -1 -\h'0.624i'\v'0.755i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'0.624i'\v'0.943i'\h'-0.0m'\v'0.2m'\s10\fRare being filtered\fP -.sp -1 -\h'1.937i'\v'1.943i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'2.124i'\v'2.068i'\h'-0.0m'\v'0.2m'\s10\fRfilter-event-mask is set\fP -.sp -1 -\h'0.062i'\v'1.568i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the off-key-list\fP -.sp -1 -\h'1.062i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\h'0.624i'\v'2.255i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'0.624i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRare being processed\fP -.sp -1 -\h'1.999i'\v'0.318i'\h'-0.0m'\v'0.2m'\s10\fRXIM_FORWARD_EVENT\fP -.sp -1 -.sp 1+3.033i -.PE -.if \n(00 .fi -.\"==================================================================== -.LP -<> -.LP -.\"==================================================================== -\^... 1.488 7.325 6.487 10.358 -\^... 0.000i 3.033i 4.999i 0.000i -.nr 00 \n(.u -.nf -.PS 3.033i 4.999i -.br -.ps 11 -\h'4.099i'\v'0.383i'\D'l-0.100i 0.025i' -.sp -1 -\h'4.099i'\v'0.433i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.999i'\v'0.408i'\l'1.000i' -.sp -1 -\h'4.099i'\v'1.696i'\D'l-0.100i 0.025i' -.sp -1 -\h'4.099i'\v'1.746i'\D'l-0.100i -0.025i' -.sp -1 -\h'3.999i'\v'1.721i'\l'1.000i' -.sp -1 -\h'3.937i'\v'0.096i'\v'-.13m'\L'2.937i\(br'\v'.13m' -.sp -1 -\h'3.937i'\v'0.062i'\h'-0.0m'\v'0.2m'\s12\fRIM Server\fP -.sp -1 -\h'4.062i'\v'0.755i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'4.062i'\v'0.943i'\h'-0.0m'\v'0.2m'\s10\fRare being processed\fP -.sp -1 -\h'4.062i'\v'2.255i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'4.062i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRare being discarded\fP -.sp -1 -\h'4.249i'\v'1.568i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the off-key-list\fP -.sp -1 -\h'4.187i'\v'0.318i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'0.812i'\v'0.346i'\l'0.875i' -.sp -1 -\h'1.587i'\v'0.371i'\D'l0.100i -0.025i' -.sp -1 -\h'1.587i'\v'0.321i'\D'l0.100i 0.025i' -.sp -1 -\h'1.937i'\v'0.408i'\l'1.687i' -.sp -1 -\h'3.524i'\v'0.433i'\D'l0.100i -0.025i' -.sp -1 -\h'3.524i'\v'0.383i'\D'l0.100i 0.025i' -.sp -1 -\h'2.037i'\v'1.258i'\D'l-0.100i 0.025i' -.sp -1 -\h'2.037i'\v'1.308i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.937i'\v'1.283i'\l'1.687i' -.sp -1 -\h'1.749i'\v'0.096i'\v'-.13m'\L'2.937i\(br'\v'.13m' -.sp -1 -\h'2.037i'\v'0.508i'\D'l-0.100i 0.025i' -.sp -1 -\h'2.037i'\v'0.558i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.937i'\v'0.533i'\l'1.687i' -.sp -1 -\h'0.812i'\v'1.721i'\l'0.875i' -.sp -1 -\h'1.587i'\v'1.746i'\D'l0.100i -0.025i' -.sp -1 -\h'1.587i'\v'1.696i'\D'l0.100i 0.025i' -.sp -1 -\h'2.099i'\v'1.758i'\D'l-0.100i 0.025i' -.sp -1 -\h'2.099i'\v'1.808i'\D'l-0.100i -0.025i' -.sp -1 -\h'1.999i'\v'1.783i'\l'1.688i' -.sp -1 -\h'1.999i'\v'0.318i'\h'-0.0m'\v'0.2m'\s10\fRXIM_TRIGGER_NOTIFY\fP -.sp -1 -\h'1.874i'\v'1.130i'\h'-0.0m'\v'0.2m'\s10\fRXIM_TRIGGER_NOTIFY_REPLY\fP -.sp -1 -\h'1.874i'\v'0.693i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\v'0.255i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the on-key-list\fP -.sp -1 -\h'2.062i'\v'0.880i'\h'-0.0m'\v'0.2m'\s10\fRfilter-event-mask is set\fP -.sp -1 -\h'0.624i'\v'0.755i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'0.624i'\v'0.943i'\h'-0.0m'\v'0.2m'\s10\fRare being filtered\fP -.sp -1 -\h'1.937i'\v'1.943i'\h'-0.0m'\v'0.2m'\s10\fRXIM_EXT_SET_EVENT_MASK\fP -.sp -1 -\h'2.124i'\v'2.068i'\h'-0.0m'\v'0.2m'\s10\fRfilter-event-mask is set\fP -.sp -1 -\h'0.062i'\v'1.568i'\h'-0.0m'\v'0.2m'\s10\fRKeys in the off-key-list\fP -.sp -1 -\h'1.062i'\h'-0.0m'\v'0.2m'\s12\fRIM library\fP -.sp -1 -\h'0.624i'\v'2.255i'\h'-0.0m'\v'0.2m'\s10\fRthe specified events\fP -.sp -1 -\h'0.624i'\v'2.443i'\h'-0.0m'\v'0.2m'\s10\fRare being processed\fP -.sp -1 -.sp 1+3.033i -.PE -.if \n(00 .fi - -.\"==================================================================== -.LP -This method does not have the problem of the time lag when going across -the preediting on and off mode, however, the amount of the performance -acceleration is not as good as the method described above. -.LP -In general, the FrontEnd method requires some synchronization to some -of the X protocols, such as the ChangeWindowAttribute protocol for the -event mask change or the GrabKey protocol, since it relies on the X's -principal event dispatching mechanism. Any X protocol bindings do not -consider the synchronization might cause some mis-synchronization -between the IM clients and the IM Server. -.LP -.bp -.IP \fB(2) -Transport Layer\fP -.LP -The Xlib XIM implementation is layered into three functions, a protocol -layer, an interface layer and a transport layer. The purpose of this -layering is to make the protocol independent of transport implementation. -Each function of these layers are: -.RS 3 -.IP "\fIThe protocol layer\fP" -.br -implements overall function of XIM and calls the interface layer -functions when it needs to communicate to IM Server. -.IP "\fIThe interface layer\fP" -.br -separates the implementation of the transport layer from the protocol -layer, in other words, it provides implementation independent hook for -the transport layer functions. -.IP "\fIThe transport layer\fP" -.br -handles actual data communication with IM Server. It is done by a set -of several functions named transporters. -.RE -.LP -The interface layer and the transport layer make various communication -channels usable such as X Protocol, TCP/IP, DECnet or STREAM. -The following is a sample implementation for the transporter using -the X connection. -Refer to "xtrans" for the transporter using Socket Transport. -.LP -At the beginning of the X Transport connection for the XIM transport -mechanism, two different windows must be created either in an Xlib XIM -or in an IM Server, with which the Xlib and the IM Server exchange the -XIM transports by using the ClientMessage events and Window Properties. -In the following, the window created by the Xlib is referred as the -"client communication window", and on the other hand, the window created -by the IM Server is referred as the "IMS communication window". -.LP -.B -Connection -.LP -.RS -In order to establish a connection, a communication window is created. -A ClientMessage in the following event's format is sent to the owner -window of XIM_SERVER selection, which the IM Server has created. -.LP -Refer to "The Input Method Protocol" for the XIM_SERVER atom. -.LP -.ce -Table D-1; The ClientMessage sent to the IMS window. -.TS H -tab(:); -l s|l -l l|l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:IMS Window ID -Atom:message_type:XInternAtom(display, ``_XIM_XCONNECT'', False) -int:format:32 -long:data.l[0]:client communication window ID -long:data.l[1]:client-major-transport-version (*1) -long:data.l[2]:client-major-transport-version (*1) -.sp 6p -_ -.TE -.LP -In order to establish the connection (to notify the IM Server communication -window), the IM Server sends a ClientMessage in the following event's -format to the client communication window. -.LP -.bp -.ce -Table D-2; The ClientMessage sent by IM Server. -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:client communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_XCONNECT'', False) -int:format:32 -long:data.l[0]:IMS communication window ID -long:data.l[1]:server-major-transport-version (*1) -long:data.l[2]:server-minor-transport-version (*1) -long:data.l[3]:dividing size between ClientMessage and Property (*2) -.sp 6p -_ -.TE -.LP -.IP (*1) -major/minor-transport-version -.RS -The read/write method is decided by the combination of -major/minor-transport-version, as follows: -.LP -.ce -Table D-3; The read/write method and the major/minor-transport-version -.TS -center, tab(:); -| c s | l | -| c | c | l |. -_ -.sp 6p -.B -Transport-version:read/write -.sp 6p -_ -.sp 6p -major:minor: -.sp 6p -_ -.sp 6p -.R -0:0:only-CM & Property-with-CM -:1:only-CM & multi-CM -:2:only-CM & multi-CM & Property-with-CM -.sp 6p -_ -.sp 6p -1:0:PropertyNotify -.sp 6p -_ -.sp 6p -2:0:only-CM & PropertyNotify -:1:only-CM & multi-CM & PropertyNotify -.sp 6p -_ -.TE -.LP -.RS -.TS -center, tab(;); -l n l. -only-CM;:;data is sent via a ClientMessage -multi-CM;:;data is sent via multiple ClientMessages -Property-with-CM;:;T{ -data is written in Property, and its Atom is send via ClientMessage -T} -PropertyNotify;:;T{ -data is written in Property, and its Atom is send via PropertyNotify -T} -.TE -.RE -.LP -The method to decide major/minor-transport-version is as follows: -.LP -.IP (1) -The client sends 0 as major/minor-transport-version to the IM Server. -The client must support all methods in Table D-3. -The client may send another number as major/minor-transport-version to -use other method than the above in the future. -.IP (2) -The IM Server sends its major/minor-transport-version number to -the client. The client sends data using the method specified by the -IM Server. -.IP (3) -If major/minor-transport-version number is not available, it is regarded -as 0. -.RE -.LP -.IP (*2) -dividing size between ClientMessage and Property -.RS -If data is sent via both of multi-CM and Property, specify the dividing -size between ClientMessage and Property. The data, which is smaller than -this size, is sent via multi-CM (or only-CM), and the data, which is -lager than this size, is sent via Property. -.RE -.RE -.LP -.sp -.LP -.B -read/write -.LP -.RS -The data is transferred via either ClientMessage or Window Property in -the X Window System. -.LP -.B -Format for the data from the Client to the IM Server -.LP -.RS -.B -ClientMessage -.LP -If data is sent via ClientMessage event, the format is as follows: -.LP -.ce -Table D-4; The ClientMessage event's format (first or middle) -.TS -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event;Set by the X Window System -Display;*display;The display to which connects -Window;window;IMS communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_MOREDATA'', False) -int;format;8 -char;data.b[20];(read/write DATA : 20 byte) -.sp 6p -_ -.TE -.LP -.ce -Table D-5; The ClientMessage event's format (only or last) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event;Set by the X Window System -Display;*display;The display to which connects -Window;window;IMS communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_PROTOCOL'', False) -int;format;8 -char;data.b[20];(read/write DATA : MAX 20 byte) (*1) -.sp 6p -_ -.TE -.IP (*1) -If the data is smaller than 20 byte, all data other than available data -must be 0. -.RE -.LP -.RS -.B -Property -.LP -In the case of large data, data will be sent via the Window Property -for the efficiency. There are the following two methods to notify -Property, and transport-version is decided which method is used. -.LP -.IP (1) -The XChangeProperty function is used to store data in the client -communication window, and Atom of the stored data is notified to the -IM Server via ClientMessage event. -.IP (2) -The XChangeProperty function is used to store data in the client -communication window, and Atom of the stored data is notified to the -IM Server via PropertyNotify event. -.LP -The arguments of the XChangeProperty are as follows: -.LP -.bp -.ce -Table D-6; The XChangeProperty event's format -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Argument:Contents -.sp 6p -_ -.sp 6p -.TH -.R -Display:*display:The display to which connects -Window:window:IMS communication window ID -Atom:property:read/write property Atom (*1) -Atom:type:XA_STRING -int:format:8 -int:mode:PropModeAppend -u_char:*data:read/write DATA -int:nelements:length of DATA -.sp 6p -_ -.TE -.LP -.IP (*1) -The read/write property ATOM allocates the following strings by -\fBXInternAtom\fP. -.RS -``_clientXXX'' -.RE -.LP -The client changes the property with the mode of PropModeAppend and -the IM Server will read it with the delete mode i.e. (delete = True). -.LP -If Atom is notified via ClientMessage event, the format of the ClientMessage -is as follows: -.LP -.ce -Table D-7; The ClientMessage event's format to send Atom of property -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:IMS communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_PROTOCOL'', False) -int:format:32 -long:data.l[0]:length of read/write property Atom -long:data.l[1]:read/write property Atom -.sp 6p -_ -.TE -.RE -.LP -.B -Format for the data from the IM Server to the Client -.LP -.RS -.B -ClientMessage -.LP -The format of the ClientMessage is as follows: -.LP -.ce -Table D-8; The ClientMessage event's format (first or middle) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event ;Set by the X Window System -Display;*display;The display to which connects -Window;window;client communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_MOREDATA'', False) -int;format;8 -char;data.b[20];(read/write DATA : 20 byte) -.sp 6p -_ -.TE -.LP -.bp -.ce -Table D-9; The ClientMessage event's format (only or last) -.TS -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event ;Set by the X Window System -Display;*display;The display to which connects -Window;window;client communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_PROTOCOL'', False) -int;format;8 -char;data.b[20];(read/write DATA : MAX 20 byte) (*1) -.sp 6p -_ -.TE -.LP -.IP (*1) -If the data size is smaller than 20 bytes, all data other than available -data must be 0. -.LP -.B -Property -.LP -In the case of large data, data will be sent via the Window Property -for the efficiency. There are the following two methods to notify -Property, and transport-version is decided which method is used. -.LP -.IP (1) -The XChangeProperty function is used to store data in the IMS -communication window, and Atom of the property is sent via the -ClientMessage event. -.IP (2) -The XChangeProperty function is used to store data in the IMS -communication window, and Atom of the property is sent via -PropertyNotify event. -.LP -The arguments of the XChangeProperty are as follows: -.LP -.ce -Table D-10; The XChangeProperty event's format -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Argument:Contents -.sp 6p -_ -.sp 6p -.TH -.R -Display:*display:The display which to connects -Window:window:client communication window ID -Atom:property:read/write property Atom (*1) -Atom:type:XA_STRING -int:format:8 -int:mode:PropModeAppend -u_char:*data:read/write DATA -int:nelements:length of DATA -.sp 6p -_ -.TE -.LP -.IP (*1) -The read/write property ATOM allocates some strings, which are not -allocated by the client, by \fBXInternAtom\fP. -.LP -The IM Server changes the property with the mode of PropModeAppend and -the client reads it with the delete mode, i.e. (delete = True). -.LP -If Atom is notified via ClientMessage event, the format of the ClientMessage -is as follows: -.LP -.bp -.ce -Table D-11; The ClientMessage event's format to send Atom of property -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:client communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_PROTOCOL'', False) -int:format:32 -long:data.l[0]:length of read/write property ATOM -long:data.l[1]:read/write property ATOM -.sp 6p -_ -.TE -.RE -.RE -.LP -.B -Closing Connection -.RS -.LP -If the client disconnect with the IM Server, shutdown function should -free the communication window properties and etc.. -.RE -.LP -.bp -.EH '''' -.OH '''' -.EF '''' -.OF '''' -.TC - diff --git a/libX11/specs/XIM/xim.xml b/libX11/specs/XIM/xim.xml new file mode 100644 index 000000000..66d559b07 --- /dev/null +++ b/libX11/specs/XIM/xim.xml @@ -0,0 +1,3918 @@ + + + + + + + + + The Input Method Protocol + X Consortium Standard + X Version 11, Release 6.4 + + + MasahikoNarita + FUJITSU Limited. + + + HidekiHiura + SunSoft, Inc. + + + X Consortium Standard + 1993X Consortium + 1994X Consortium + 1993FUJITSU LIMITED + 1994FUJITSU LIMITED + 1993Sun Microsystems + 1994Sun Microsystems + Version 1.0 + X Consortium + X Version 11, Release 7 + + + +This specifies a protocol between IM library and IM (Input Method) Server for internationalized text input, which is indepedent from any specific language, any specific input method and the transport layer used in communication between the IM library and the IM Server, and uses a client-server model. This protocol allows user to use his/her favorite method for all applications within the stand-along distrubuted environment. + + + + +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. + +X Window System is a trademark of The Open Group. + +Permission to use,copy and distribute this documetation for any purpose and without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. Fujitsu and Sun Microsystems make no representation about the suitability for any purpose of the information in this documen. This documentation is provided as is without express implied warranty. + + + + + + +TITLE + +Introduction + +Scope + + + + + +The internationalization in the +X Window System +Version 11, Release 5 (X11R5) provides a common API which application +developers can use to create portable internationalized programs and to +adapt them to the requirements of different native languages, local customs, +and character string encodings (this is called "localization"). +As one of its internationalization mechanisms X11R5 has defined a functional +interface for internationalized text input, called XIM (X Input Method). + + + +When a client-server model is used with an IM (Input Method) implementation, +a protocol must be established between the client and the server. +However, the protocol used to interface Input Method Servers (IM Servers) +with the Input Method libraries (IM libraries) to which applications are +linked was not addressed in X11R5. +This led application developers to depend on vendor-specific input methods, +decreased the user's choice of available input methods, and made it more +difficult for developers to create portable applications. This paper describes +the Input Method Protocol developed for X11R6 to resolve the above problems +and to address the requirements of existing and future input methods. + + + +The Input Method Protocol is independent from the transport layer used in +communication between the IM library and the IM Server. +Thus, the input method protocol can be built on any inter-process +communication mechanism, such as TCP/IP or the X protocol. + + +In addition, the protocol provides for future extensions such as differing +input model types. + + + + +Background + + + + + +Text input is much more simple for some languages than +others. English, for instance, uses an alphabet of a manageable size, +and input consists of pressing the corresponding key on a keyboard, +perhaps in combination with a shift key for capital letters or special +characters. + + + +Some languages have larger alphabets, or modifiers such as accents, +which require the addition of special key combinations in order to enter +text. These input methods may require "dead-keys" or "compose-keys" +which, when followed by different combinations of key strokes, +generate different characters. + + + +Text input for ideographic languages is much less simple. In these +languages, characters represent actual objects rather than phonetic +sounds used in pronouncing a word, and the number of characters +in these languages may continue to grow. In Japanese, for instance, most +text input methods involve entering characters in a phonetic alphabet, +after which the input method searches a dictionary for possible +ideographic equivalents (of which there may be many). The input method then +presents the candidate characters for the user to choose from. + + + +In Japanese, either Kana (phonetic symbols) or Roman letters are +typed and then a region is selected for conversion to Kanji. Several +Kanji characters may have the same phonetic representation. If that +is the case with the string entered, a menu of characters is presented +and the user must choose the appropriate one. If no choice is necessary +or a preference has been established, the input method does the +substitution directly. + + + +These complicated input methods must present state information (Status Area), +text entry and edit space (Preedit Area), and menu/choice presentations +(Auxiliary Area). Much of the protocol between the IM library and the IM +Server involves managing these IM areas. +Because of the size and complexity of these input methods, and because +of how widely they vary from one language or locale to another, they are +usually implemented as separate processes which can serve many client +processes on the same computer or network. + + + + + + +Input Method Styles + + + + + +X11 internationalization support includes the following four types of +input method: + + + + + + - on-the-spot: + + +The client application is directed by the IM Server to display all +pre-edit data at the site of text insertion. The client registers +callbacks invoked by the input method during pre-editing. + + + + + - off-the-spot: + + +The client application provides display windows for the pre-edit data +to the input method which displays into them directly. + + + + + - over-the-spot: + + +The input method displays pre-edit data in a window which it brings up +directly over the text insertion position. + + + + + - root-window: + + +The input method displays all pre-edit data in a separate area of the +screen in a window specific to the input method. + + + + + + +Client applications must choose from the available input methods +supported by the IM Server and provide the display areas and callbacks +required by the input method. + + + + + +Architecture + + + + +Implementation Model + + + + + +Within the X Window System environment, the following two typical +architectural models can be used as an input method's implementation +model. + + + + + - Client/Server model: + + +A separate process, the IM Server, processes input and handles preediting, +converting, and committing. The IM library within the application, acting +as client to the IM Server, simply receives the committed string from the +IM Server. + + + + + - Library model: + + +All input is handled by the IM library within the application. The +event process is closed within the IM library and a separate IM Server +process may not be required. + + + + + + + +Most languages which need complex preediting, such as Asian languages, +are implemented using the Client/Server IM model. Other languages +which need only dead key or compose key processing, such as European +languages, are implemented using the Library model. + + + +In this paper, we discuss mainly the Client/Server IM model and the +protocol used in communication between the IM library (client) and the IM +Server. + + + + +Structure of IM + + + + + +When the client connects or disconnects to the IM Server, an open or close +operation occurs between the client and the IM Server. + + + +The IM can be specified at the time of XOpenIM() by setting the locale +of the client and a locale modifier. Since the IM remembers +the locale at the time of creation XOpenIM() can be called +multiple times (with the +setting for the locale and the locale modifier changed) to support +multiple languages. + + + +In addition, the supported IM type can be obtained using XGetIMValues(). + + + +The client usually holds multiple input (text) fields. Xlib provides a +value type called the "Input Context" (IC) to manage each individual +input field. An IC can be created by specifying XIM using XCreateIC(), +and it can be destroyed using XDestroyIC(). + + + +The IC can specify the type of IM which is supported by XIM for each +input field, so each input field can handle a different type of IM. + + + +Most importantly information such as the committed string sent from +the IM Server to the client, is exchanged based on each IC. + + + +Since each IC corresponds to an input field, the focused input field +should be announced to the IM Server using XSetICFocus(). (XUnsetICFocus() +can also be used to change the focus.) + + + + + + +Event Handling Model + + + + + +Existing input methods support either the FrontEnd method, the BackEnd method, +or both. This protocol specifically supports the BackEnd method as +the default method, but also supports the FrontEnd method as an optional +IM Server extension. + + + +The difference between the FrontEnd and BackEnd methods is in how +events are delivered to the IM Server. (Fig. 1) + + + +BackEnd Method + + + + + +In the BackEnd method, client window input events are always delivered +to the IM library, which then passes them to the IM Server. Events are +handled serially in the order delivered, and therefore there is no +synchronization problem between the IM library and the IM Server. + + + +Using this method, the IM library forwards all KeyPress and KeyRelease +events to the IM Server (as required by the Event Flow Control model +described in + +) +and synchronizes with the IM Server (as described in + +). + + + + + +FrontEnd Method + + + + + +In the FrontEnd method, client window input events are delivered by the +X server directly to both the IM Server and the IM library. Therefore this +method provides much better interactive performance while preediting +(particularly in cases such as when the IM Server is running locally on +the user's workstation and the client application is running on another +workstation over a relatively slow network). + + + +However, the FrontEnd model may have synchronization problems between +the key events handled in the IM Server and other events handled in the +client, and these problems could possibly cause the loss or duplication +of key events. For this reason, the BackEnd method is the core method +supported, and the FrontEnd method is made available as an extension for +performance purposes. (Refer to + + +for more information.) + + + + + + + The flow of events + + + + + + + + +Event Flow Control + + + + + +This protocol supports two event flow models for communication between the +IM library and the IM Server (Static and Dynamic). + + + +Static Event Flow requires that input events always be sent to the IM +Server from the client. + + + +Dynamic Event Flow, however, requires only that those input events which +need to be processed (converted) be sent to the IM Server from the client. + + + +For instance, in the case of inputing a combination of ASCII characters +and Chinese characters, ASCII characters do not need to be processed in +the IM Server, so their key events do not have to be sent to the IM +Server. On the other hand, key events necessary for composing Chinese +characters must be sent to the IM Server. + + + +Thus, by adopting the Dynamic Event Flow, the number of requests among the +X Server, the client, and the IM Server is significantly reduced, and the +number of context switches is also reduced, resulting in improved performance. +The IM Server can send +XIM_REGISTER_TRIGGERKEYS +message in order to switch the event flow in the Dynamic Event Flow. + + + +The protocol for this process is described in + +. + + + + + +Default Preconnection Convention + + + + + +IM Servers are strongly encouraged to register their symbolic +names as the ATOM names into the IM Server directory property, +XIM_SERVERS, +on the root window of the screen_number 0. +This property can contain a list of ATOMs, and the each ATOM represents +each possible IM Server. +IM Server names are restricted to POSIX Portable Filename Character Set. +To discover if the IM Server is active, see if there is an owner for +the selection with that atom name. To learn the address of that IM Server, +convert the selection target +TRANSPORT, +which will return a string form of the transport address(es). +To learn the supported locales of that IM Server, convert the selection target +LOCALES, +which will return a set of names of the supported locales in the syntax +X/Open defines. + + + +The basic semantics to determine the IM Server if there are +multiple ATOMs are found in +XIM_SERVERS +property, is first fit if the IM Server name is not given as +a X modifier's category +im. + + + +The address information retrievable from the +TRANSPORT +target is a transport-specific name. +The preregistered formats for transport-specific names are listed in + +. +Additional transport-specific names may be registered with X Consortium. + + + +For environments that lack X connections, or for IM Servers which +do not use the X Window System, the preconnection convention with IM Server +may be given outside the X Window system (e.g. using a Name Service). + + + + +Protocol + + + + + +The protocol described below uses the bi-directional +synchronous/asynchronous request/reply/error model and is specified +using the same conventions outlined in Section 2 of the core X Window +System protocol [1]: + + + +Basic Requests Packet Format + + + + + +This section describes the requests that may be exchanged between the client +and the IM Server. + + + +The basic request packet header format is as follows. + + + major-opcode: CARD8 + minor-opcode: CARD8 + length: CARD16 + + + +The MAJOR-OPCODE specifies which core request or extension package this +packet represents. If the MAJOR-OPCODE corresponds to a core request, +the MINOR-OPCODE contains 8 bits of request-specific data. +(If the MINOR-OPCODE is not used, it is 0.) +Otherwise, the MAJOR-OPCODE and the MINOR-OPCODE are specified by +XIM_QUERY_EXTENSION +message. (Refer to 4.7. Query the supported extension protocol list.) +The LENGTH field specifies the number of 4 bytes elements following the +header. If no additional data is followed by the header, the LENGTH field +will be 0. + + + + +Data Types + + + + +The following data types are used in the core X IM Server protocol: + + + +BITMASK16 + CARD16 +BITMASK32 + CARD32 +PADDING FORMAT + Where N is some expression, and Pad(N) is the number of bytes needed to round N up to a + + Pad(N) = (4 - (N mod 4)) mod 4 + +LPCE + 1 A character from the4 X Portable Character Set in Latin Portable + Character Encoding + +STRING + 2 n length of string in bytes + n LISTofLPCE string + p unused, p=Pad(2+n) + +STR + 1 n length of name in bytes + n STRING8 name + +XIMATTR + 2 CARD16 attribute ID (*1) + 2 CARD16 type of the value (*2) + 2 n length of im-attribute + n STRING8 im-attribute + p unused, p = Pad(2+n) + +The im-attribute argument specifies XIM values such as XNQueryInputStyle. + +XICATTR + 2 CARD16 attribute ID (*1) + 2 CARD16 type of the value (*2) + 2 n length of ic-attribute + n STRING8 ic-attribute + p unused, p = Pad(2+n) + +(*1) XIMATTR and XICATTR are used during the setup stage and XIMATTRIBUTE and + XICATTRIBUTE are used after each attribute ID has been recognized by + the IM Server and the IM library. + +(*2) The value types are defined as follows: + + + + + + + + + + + + values + data + format + + + + + + #0 + Separator of NestedList + -----(*3) + + + #1 + byte data + CARD8 + + + #2 + word data + CARD16 + + + #3 + long data + CARD32 + + + #4 + char data + STRING8 + + + #5 + Window + CARD32 + + + #10 + XIMStyles + 2 + n + number of XIMStyle list + + + + + 2 + + unused + + + + + n + CARD32 + XIMStyle list + + + #11 + XRectangle + 2 + INT16 + X + + + + + 2 + INT16 + Y + + + + + 2 + CARD16 + width + + + + + 2 + CARD16 + height + + + #12 + XPoint + 2 + INT16 + X + + + + + 2 + INT16 + Y + + + #13 + XFontSet + 2 + n + length of Base font name + + + + + n + STRING8 + Base font name list + + + + + p + + unused, p = Pad(2+n) + + + #15 + XIMHotKeyTriggers + 4 + n + number of XIMTRIGGERKEY list (*4) + + + + + n + XIMTRIGGERKEY + XIMHotkeyTrigger list + + + + + n + XIMHOTKEYSTATE + HotKey processing state + + + #17 + XIMStringConversion + XIMSTRCONVTEXT + + + + + #18 + XIMPreeditState + XIMPREEDITSTATE + + + #19 + XIMResetState + XIMRESETSTATE + + + #x7fff + NestedList + ----- + + + + + + +(*3) The IC value for the separator of NestedList is defined as follows, + #define XNSeparatorofNestedList "separatorofNestedList" + , which is registered in X Consortium and cannot be used for any other purpose. + +(*4) LISTofFOO + A Type name of the form LISTof FOO means a counted list of elements of type FOO. + The size of the length field may vary (it is not necessarily the same + size as a FOO), and in some cases, it may be implicit. +XIMTRIGGERKEY + 4 CARD32 keysym + 4 CARD32 modifier + 4 CARD32 modifier mask + +ENCODINGINFO + 2 n length of encoding info + n STRING8 encoding info + p unused, p=Pad(2+n) + + + 1 CARD8 extension major-opcode + 1 CARD8 extension minor-opcode + 2 n length of extension name + n STRING8 extension name + p unused, p = Pad(n) + +XIMATTRIBUTE + 2 CARD16 attribute ID + 2 n value length + n value + p unused, p = Pad(n) + +XICATTRIBUTE + 2 CARD16 attribute ID + 2 n value length + n value + p unused, p = Pad(n) + + + +XIMSTRCONVTEXT + 2 CARD16 XIMStringConversionFeedback + #x0000001 XIMStringConversionLeftEdge + #x0000002 XIMStringConversionRightEdge + #x0000004 XIMStringConversionTopEdge + #x0000008 XIMStringConversionBottomEdge + #x0000010 XIMStringConversionConvealed + #x0000020 XIMStringConversionWrapped + 2 n byte length of the retrieved string + n STRING8 retrieved string + p unused, p = Pad(n) + 2 m byte length of feedback array + 2 unused + m LISTofXIMSTRCONVFEEDBACK feedback array(*1) + +(*1) This field is reserved for future use. + +XIMFEEDBACK + 4 CARD32 XIMFeedback + #x000001 XIMReverse + #x000002 XIMUnderline + #x000004 XIMHighlight + #x000008 XIMPrimary + #x000010 XIMSecondary + #x000020 XIMTertiary + #x000040 XIMVisibleToForward + #x000080 XIMVisibleToBackward + #x000100 XIMVisibleCenter + +XIMHOTKEYSTATE + 4 CARD32 XIMHotKeyState + #x0000001 XIMHotKeyStateON + #x0000002 XIMHotKeyStateOFF + +XIMPREEDITSTATE + 4 CARD32 XIMPreeditState + #x0000001 XIMPreeditEnable + #x0000002 XIMPreeditDisable + +XIMRESETSTATE + 4 CARD32 XIMResetState + #x0000001 XIMInitialState + #x0000002 XIMPreserveState + + + + +Error Notification + + + + +Both the IM Server and the IM library return +XIM_ERROR +messages instead of the corresponding reply messages if any errors occur +during data processing. + + + +At most one error is generated per request. If more than one error condition +is encountered in processing a request, the choice of which error is returned +is implementation-dependent. + + + +XIM_ERROR (IM Server <--> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 BITMASK16 flag (*1) + #0000 Both Input-Method-ID and Input-Context-ID are invalid + #0001 Input-Method-ID is valid + #0002 Input-Context-ID is valid + 2 CARD16 Error Code + #1 BadAlloc + #2 BadStyle + #3 BadClientWindow + #4 BadFocusWindow + #5 BadArea + #6 BadSpotLocation + #7 BadColormap + #8 BadAtom + #9 BadPixel + #10 BadPixmap + #11 BadName + #12 BadCursor + #13 BadProtocol + #14 BadForeground + #15 BadBackground + #16 LocaleNotSupported + #999 BadSomething (*2) + 2 n byte length of error detail. + 2 CARD16 type of error detail (*3) + n STRING8 error detail (*4) + p unused, p = Pad(n) + +(*1) Before an IM is created, both Input-Method-ID and + Input-Context-ID are invalid. + Before an IC is created, only Input-Method-ID is valid. + After that, both of Input-Method-ID and Input-Context-ID are valid. + +(*2) Unspecific error, for example "language engine died" + +(*3) This field is reserved for future use. + +(*4) Vendor defined detail error message + + + + +Connection Establishment + + + + +XIM_CONNECT +message requests to establish a connection over a mutually-understood virtual +stream. + + + +XIM_CONNECT (IM library -> IM Server) + 1 byte order + #x42 MSB first + #x6c LSB first + 1 unused + 2 CARD16 client-major-protocol-version (*1) + 2 CARD16 client-minor-protocol-version (*1) + 2 CARD16 number of client-auth-protocol-names + n LISTofSTRING client-auth-protocol-names + +(*1) Specify the version of IM Protocol that the client supports. + + + +A client must send +XIM_CONNECT +message as the first message on the connection. +The list specifies the names of authentication protocols the sending +IM Server is willing to perform. +(If the client need not authenticate, the list may be omited.) + + + +XIM_AUTH_REQUIRED +message is used to send the authentication protocol name and protocol-specific +data. + + + +XIM_AUTH_REQUIRED (IM library <--> IM Server) + + 1 CARD8 auth-protocol-index + 3 unused + 2 n length of authentication data + 2 unused + n <varies> data + p unused, p = Pad(n) + + + +The auth-protocol is specified by an index into the list of names +given in the +XIM_CONNECT +or +XIM_AUTH_SETUP +message. Any protocol-specific data that might be required is also sent. + + + +The IM library sends +XIM_AUTH_REPLY +message as the reply to +XIM_AUTH_REQUIRED +message, if the IM Server is authenticated. + + + +XIM_AUTH_REPLY (IM library -> IM Server) + 2 n length of authentication data + 2 unused + 2 n length of authentication data + 2 unused + n <varies> data + p unused, p = Pad(n) + + + +The auth data is specific to the authentication protocol in use. + + + +XIM_AUTH_NEXT +message requests to send more auth data. + + + +XIM_AUTH_NEXT (IM library <--> IM Server) + 2 n length of authentication data + 2 unused + n <varies> data + p unused, p = Pad(n) + + +The auth data is specific to the authentication protocol in use. + + + + +The IM Server sends +XIM_AUTH_SETUP +message to authenticate the client. + + + +XIM_AUTH_SETUP (IM Server -> IM library) + 2 CARD16 number of client-auth-protocol-names + 2 unused + n LISTofSTRING server-auth-protocol-names + + + +The list specifies the names of authentication protocols the +client is willing to perform. + + + +XIM_AUTH_NG +message requests to give up the connection. + + + +XIM_AUTH_NG (IM library <--> IM Server) + + + +The IM Server sends +XIM_CONNECT_REPLY +message as the reply to +XIM_CONNECT +or +XIM_AUTH_REQUIRED +message. + + + +XIM_CONNECT_REPLY (IM Server -> IM library) + 2 CARD16 server-major-protocol-version (*1) + 2 CARD16 server-minor-protocol-version (*1) + +(*1) Specify the version of IM Protocol that the IM Server supports. +This document specifies major version one, minor version zero. + + + +Here are the state diagrams for the client and the IM Server. + + + +State transitions for the client + + + + + init_status: + + +Use authorization function -> client_ask + + +Not use authorization function -> client_no_check + + + + + start: + + +Send XIM_CONNECT + + +If client_ask -> client_wait1 + + +If client_no_check, +client-auth-protocol-names may be omited -> client_wait2 + + + + + client_wait1: + + +Receive XIM_AUTH_REQUIRED +-> client_check + + +Receive <other> -> client_NG + + + + + client_check: + + +If no more auth needed, send XIM_AUTH_REPLY +-> client_wait2 + + +If good auth data, send XIM_AUTH_NEXT +-> client_wait1 + + +If bad auth data, send XIM_AUTH_NG +-> give up on this protocol + + + + + client_wait2: + + +Receive XIM_CONNECT_REPLY +-> connect Receive +XIM_AUTH_SETUP +-> client_more + + +Receive XIM_AUTH_NEXT +-> client_more + + +Receive XIM_AUTH_NG +-> give up on this protocol + + +Receive <other> -> client_NG + + + + + client_more: + + +Send XIM_AUTH_REQUIRED +-> client_wait2 + + + + + client_NG: + + +Send XIM_AUTH_NG +-> give up on this protocol + + + + + + +State transitions for the IM Server + + + + + init_status: + + +Use authorization function -> server_ask + + +Not use authorization function -> server_no_check + + + + + start: + + +Receive XIM_CONNECT + + +-> start2 +Receive <other> -> server_NG + + + + + start2: + + +If client_ask, send +XIM_AUTH_REQUIRED +-> server_wait1 + + +If client_no_check and +server_ask, send +XIM_AUTH_SETUP +-> server_wait2 + + +If client_no_check and +server_no_check, send +XIM_CONNECT_REPLY +-> connect + + + + + server_wait1: + + +Receive +XIM_AUTH_REPLY +-> server2 + + +Receive +XIM_AUTH_NEXT +-> server_more + + +Receive <other> -> server_NG + + + + + server_more + + +Send +XIM_AUTH_REQUIRED +-> server_wait1 + + + + + server2 + + +If server_ask, send +XIM_AUTH_SETUP +-> server_wait2 + + +If server_no_check, send +XIM_CONNECT_REPLY +-> connect + + + + + server_wait2 + + +Receive +XIM_AUTH_REQUIRED +-> server_check + + +Receive <other> -> server_NG + + + + + server_check + + +If no more auth data, send +XIM_CONNECT_REPLY +-> connect + + +If bad auth data, send +XIM_AUTH_NG +-> give up on this protocol + + +If good auth data, send +XIM_AUTH_NEXT +-> server_wait2 + + + + + server_NG + + +Send +XIM_AUTH_NG +-> give up on this protocol + + + + + + +XIM_DISCONNECT +message requests to shutdown the connection over a mutually-understood +virtual stream. + + + +XIM_DISCONNECT (IM library -> IM Server) + + + +XIM_DISCONNECT +is a synchronous request. The IM library should wait until it receives +either an +XIM_DISCONNECT_REPLY +packet or an XIM_ERROR packet. + + + +XIM_DISCONNECT_REPLY (IM Server -> IM library) + + + +XIM_OPEN +requests to establish a logical connection between the IM library and the IM +Server. + + + +XIM_OPEN (IM library -> IM Server) + n STR locale name + p unused, p = Pad(n) + + + +XIM_OPEN +is a synchronous request. The IM library should wait until receiving +either an XIM_OPEN_REPLY +packet or an XIM_ERROR packet. + + + +XIM_OPEN_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 n byte length of IM attributes supported + n LISTofXIMATTR IM attributes supported + 2 m byte length of IC attributes supported + 2 CARD16 unused + m LISTofXICATTR IC attributes supported + + + +XIM_OPEN_REPLY +message returns all supported IM and IC attributes in LISTofXIMATTR and +LISTofXICATTR. These IM and IC attribute IDs are used to reduce the amount +of data which must be transferred via the network. In addition, this +indicates to the IM library what kinds of IM/IC attributes can be used +in this session, and what types of data will be exchanged. This allows +the IM Server provider and application writer to support IM system +enhancements with new IM/IC attributes, without modifying Xlib. +The IC value for the separator of NestedList must be included in the +LISTofXICATTR. + + + +XIM_CLOSE +message requests to shutdown the logical connection between the IM library +and the IM Server. + + + +XIM_CLOSE (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 unused + + + +XIM_CLOSE +is a synchronous request. The IM library should wait until receiving +either an XIM_CLOSE_REPLY +packet or an XIM_ERROR packet. + + + +XIM_CLOSE_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 unused + + + + + +Event Flow Control + + + + + +An IM Server must send +XIM_SET_EVENT_MASK +message to the IM library in order for events to be forwarded to the IM +Server, since the IM library initially doesn't forward any events to the +IM Server. In the protocol, the IM Server will specify masks of X events +to be forwarded and which need to be synchronized by the IM library. + + + +XIM_SET_EVENT_MASK (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 EVENTMASK forward-event-mask (*1) + 4 EVENTMASK synchronous-event-mask (*2) + +(*1) Specify all the events to be forwarded to the IM Server by the IM library. +(*2) Specify the events to be forwarded with synchronous flag on by the IM library. + + + +XIM_SET_EVENT_MASK +is an asynchronous request. The event masks are valid immediately after +they are set until changed by another +XIM_SET_EVENT_MASK +message. If input-context-ID is set to zero, the default value of the +input-method-ID will be changed to the event masks specified in the request. +That value will be used for the IC's which have no individual values. + + + +Using the Dynamic Event Flow model, an IM Server sends +XIM_REGISTER_TRIGGERKEYS +message to the IM library before sending +XIM_OPEN_REPLY +message. +Or the IM library may suppose that the IM Server uses the Static Event Flow +model. + + + +XIM_REGISTER_TRIGGERKEYS (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 unused + 4 n byte length of on-keys + n LISTofXIMTRIGGERKEY on-keys list + 4 m byte length of off-keys + m LISTofXIMTRIGGERKEY off-keys list + + + +XIM_REGISTER_TRIGGERKEYS +is an asynchronous request. +The IM Server notifys the IM library of on-keys and off-keys lists with +this message. + + + +The IM library notifys the IM Server with +XIM_TRIGGER_NOTIFY +message that a key event matching either on-keys or off-keys has been occurred. + + + +XIM_TRIGGER_NOTIFY (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 CARD32 flag + #0 on-keys list + #1 off-keys list + 4 CARD32 index of keys list + 4 EVENTMASK client-select-event-mask (*1) + +(*1) Specify the events currently selected by the IM library with XSelectInput. + + + + +XIM_TRIGGER_NOTIFY +is a synchronous request. The IM library should wait until receiving +either an XIM_TRIGGER_NOTIFY_REPLY +packet or an XIM_ERROR packet. + + + +XIM_TRIGGER_NOTIFY_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + + +Encoding Negotiation + +XIM_ENCODING_NEGOTIATION +message requests to decide which encoding to be sent across the wire. +When the negotiation fails, the fallback default encoding is Portable +Character Encoding. + + + +XIM_ENCODING_NEGOTIATION (IM library -> IM Server).sp 6p + 2 CARD16 input-method-ID + 2 n byte length of encodings listed by name + n LISTofSTR list of encodings supported in the IM library. + p unused, p = Pad(n) + 2 m byte length of encodings listed by detailed data + 2 unused + m LISTofENCODINGINFO list of encordings supported in the IM library + + + +The IM Server must choose one encoding from the list sent by the IM library. +If index of the encording determined is -1 to indicate that the negotiation +is failed, the fallback default encoding is used. +The message must be issued after sending +XIM_OPEN message via XOpenIM(). +The name of encoding may be registered with X Consortium. + + + +XIM_ENCODING_NEGOTIATION +is a synchronous request. The IM library should wait until receiving +either an XIM_ENCODING_NEGOTIATION_REPLY +packet or an XIM_ERROR packet. + + + + +XIM_ENCODING_NEGOTIATION_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 category of the encoding determined. + #0 name + #1 detailed data + 2 INT16 index of the encoding determinated. + 2 unused + + + + + +Query the supported extension protocol list + +XIM_QUERY_EXTENSION +message requests to query the IM extensions supported by the IM Server to +which the client is being connected. + + + +XIM_QUERY_EXTENSION (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 n byte length of extensions supported by the IM library + n LISTofSTR extensions supported by the IM library + p unused, p = Pad(n) + + + +An example of a supported extension is FrontEnd. +The message must be issued after sending +XIM_OPEN message via XOpenIM(). + + + +If n is 0, the IM library queries the IM Server for all extensions. + + + +If n is not 0, the IM library queries whether the IM Server supports the +contents specified in the list. + + + +If a client uses an extension request without previously having issued a +XIM_QUERY_EXTENSION +message for that extension, the IM Server responds with a +BadProtocol +error. If the IM Server encounters a request with an unknown MAJOR-OPCODE +or MINOR-OPCODE, it responds with a +BadProtocol error. + + + +XIM_QUERY_EXTENSION +is a synchronous request. The IM library should wait until receiving +either an XIM_QUERY_EXTENSION_REPLY +packet or an XIM_ERROR packet. + + + +XIM_QUERY_EXTENSION_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 n byte length of extensions supported by both the IM library and the IM Server + n LISTofEXT list of extensions supported by both the IM library and the IM Server + + + + +XIM_QUERY_EXTENSION_REPLY +message returns the list of extensions supported by both the IM library and +the IM Server. If the list passed in +XIM_QUERY_EXTENSION +message is NULL, the IM Server returns the full list of extensions supported +by the IM Server. If the list is not NULL, the IM Server returns the +extensions in the list that are supported by the IM Server. + + + + +A zero-length string is not a valid extension name. The IM library should +disregard any zero-length strings that are returned in the extension list. +The IM library does not use the requests which are not supported by the IM +Server. + + + + + +Setting IM Values + +XIM_SET_IM_VALUES +requests to set attributes to the IM. + + + +XIM_SET_IM_VALUES (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 n byte length of im-attribute + n LISTofXIMATTRIBUTE im-attributes + + + +The im-attributes in +XIM_SET_IM_VALUES +message are specified as a LISTofXIMATTRIBUTE, specifying the attributes +to be set. Attributes other than the ones returned by +XIM_OPEN_REPLY +message should not be specified. + + + +XIM_SET_IM_VALUES +is a synchronous request. The IM library should wait until receiving +either an +XIM_SET_IM_VALUES_REPLY +packet or an +XIM_ERROR +packet, because it must receive the error attribute if +XIM_ERROR message is returned. + + + +XIM_SET_IM_VALUES_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 unused + + + +XIM_SET_IM_VALUES_REPLY +message returns the input-method-ID to distinguish replies from multiple IMs. + + + + +Getting IM Values + +XIM_GET_IM_VALUES +requests to query IM values supported by the IM Server currently being +connected. + + + +XIM_GET_IM_VALUES (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 n byte length of im-attribute-id + n LISTofCARD16 im-attribute-id + p unused, p=Pad(n) + + + +XIM_GET_IM_VALUES +is a synchronous request. The IM library should wait until it receives +either an +XIM_GET_IM_VALUES_REPLY +packet or an XIM_ERROR packet. + + + +XIM_GET_IM_VALUES_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 n byte length of im-attributes returned + n LISTofXIMATTRIBUTE im-attributes returned + + + +The IM Server returns IM values with +XIM_GET_IM_VALUES_REPLY +message. The order of the returned im-attribute values corresponds directly +to that of the list passed with the +XIM_GET_IM_VALUES message. + + + + +Creating an IC + +XIM_CREATE_IC message requests to create an IC. + + + +XIM_CREATE_IC (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 n byte length of ic-attributes + n LISTofXICATTRIBUTE ic-attributes + + + +The input-context-id is specified by the IM Server to identify the client +(IC). (It is not specified by the client in +XIM_CREATE_IC +message.), and it should not be set to zero. + + + +XIM_CREATE_IC +is a synchronous request which returns the input-context-ID. +The IM library should wait until it receives either an +XIM_CREATE_IC_REPLY +packet or an +XIM_ERROR +packet. + + + +XIM_CREATE_IC_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + +Destroying the IC + +XIM_DESTROY_IC +message requests to destroy the IC. + + + +XIM_DESTROY_IC (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +XIM_DESTROY_IC +is a synchronous request. The IM library should not free its resources +until it receives an +XIM_DESTROY_IC_REPLY +message because XIM_DESTROY_IC +message may result in Callback packets such as +XIM_PREEDIT_DRAW +and XIM_PREEDIT_DONE. + + + +XIM_DESTROY_IC_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + + +Setting IC Values + +XIM_SET_IC_VALUES +messages requests to set attributes to the IC. + + + + +XIM_SET_IC_VALUES (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 n byte length of ic-attributes + 2 unused + n LISTofXICATTRIBUTE ic-attributes + + + +The ic-attributes in +XIM_SET_IC_VALUES +message are specified as a LISTofXICATTRIBUTE, specifying the attributes +to be set. Attributes other than the ones returned by +XIM_OPEN_REPLY message should not be specified. + + + +XIM_SET_IC_VALUES +is a synchronous request. The IM library should wait until receiving +either an XIM_SET_IC_VALUES_REPLY +packet or an XIM_ERROR +packet, because it must receive the error attribute if +XIM_ERROR message is returned. + + + + +XIM_SET_IC_VALUES_REPLY (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + +Getting IC Values + +XIM_GET_IC_VALUES +message requests to query IC values supported by the IM Server currently +being connected. + + + + +XIM_GET_IC_VALUES (IM library -> IM Server) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 n byte length of ic-attribute-id + n LISTofCARD16 ic-attribute-id + p unused, p=Pad(2+n) + + + +In LISTofCARD16, the appearance of the ic-attribute-id for the separator +of NestedList shows the end of the heading nested list. + + + +XIM_GET_IC_VALUES +is a synchronous request and returns each attribute with its values to +show the correspondence. The IM library should wait until receiving +either an XIM_GET_IC_VALUES_REPLY +packet or an XIM_ERROR packet. + + + +XIM_GET_IC_VALUES_REPLY (IM Server -> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 n byte length of ic-attribute + 2 unused + n LISTofXICATTRIBUTE ic-attribute + + + + +Setting IC Focus + +XIM_SET_IC_FOCUS +message requests to set the focus to the IC. + + + +XIM_SET_IC_FOCUS (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +XIM_SET_IC_FOCUS is an asynchronous request. + + + + +Unsetting IC Focus + +XIM_UNSET_IC_FOCUS +message requests to unset the focus to the focused IC. + + + +XIM_UNSET_IC_FOCUS (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +XIM_UNSET_IC_FOCUS +is an asynchronous request. + + + + + +Filtering Events + +Event filtering is mainly provided for BackEnd method to allow input method +to capture X events transparently to clients. + + + +X Events are forwarded by +XIM_FORWARD_EVENT message. +This message can be operated both synchronously and asynchronously. +If the requester sets the synchronous flag, the receiver must send +XIM_SYNC_REPLY +message back to the requester when all the data processing is done. + + +Protocol flow of BackEnd model + + + +With BackEnd method, the protocol flow can be classified into two +methods in terms of synchronization, depending on the synchronous-eventmask +of XIM_SET_EVENT_MASK +message. One can be called on-demand-synchronous method and another +can be called as full-synchronous method. + + + +In on-demand-synchronous method, the IM library always receives +XIM_FORWARD_EVENT +or +XIM_COMMIT +message as a synchronous request. Also, the IM Server needs to synchronously +process the correspondent reply from the IM library and the following +XIM_FORWARD_EVENT +message sent from the IM library when any of the event causes the IM Server +to send +XIM_FORWARD_EVENT +or +XIM_COMMIT +message to the IM library, so that the input service is consistent. If the +IM library gets the control back from the application after receiving the +synchronous request, the IM library replies for the synchronous request before +processing any of the events. In this time, the IM Server blocks +XIM_FORWARD_EVENT +message which is sent by the IM library, and handles it after receiving the +reply. However, the IM Server handles the other protocols at any time. + + + +In full-synchronous method, the IM library always sends +XIM_FORWARD_EVENT +message to the IM Server as a synchronous request. Therefore, the reply to it +from the IM Server will be put between the +XIM_FORWARD_EVENT message and its +XIM_SYNC_REPLY message. In case of sending +XIM_FORWARD_EVENT or +XIM_COMMIT +message, the IM Server should set the synchronous flag off. Because the +synchronization can be done by the following +XIM_SYNC_REPLY message. + + + +Following chart shows one of the simplest protocol flow which only +deals with keyevents for preediting operation. + + + + + + + Sample Protocol Flow + + + + +Following chart shows one of the complex protocol flow, which deals +with multiple focus windows and button press event as well as keyevent, +and the focus is moved by the application triggered by both of keyevent +and button press event. + + + + + + Sample Protocol Flow 2 + + + +XIM_FORWARD_EVENT (IM library <--> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 BITMASK16 flag + #0001 synchronous + #0002 request filtering (*1) + #0004 request lookupstring (*2) + 2 CARD16 serial number + XEVENT X event + +(*1) Indicate the receiver should filter events and possible preedit may be invoked. + +(*2) Indicate the receiver should only do lookup string. The IM Server is expected +to just do a conversion of the key event to the best candidate. This bit may +affect the state of the preedit state (e.g. compose of dead key sequences). + + + +XEVENT format is same as the X Protocol event format(xEvent). +As the value of xEvent's sequenceNumber is the bottom of 16 bit of XEvent's +xany.serial, the top of 16 bit is sent by serial number(INT16). + + + +XIM_FORWARD_EVENT +message is used for forwarding the events from the IM library to the IM Server +in order for IM to be able to filter the event. On the other hand, this +message is also used for forwarding the events from the IM Server to the IM +library if the event forwarded from the IM library is not filtered. +The IM Server, which receives +XIM_FORWARD_EVENT +message without synchronous bit, should set synchronous bit. +If both "request event filtering" and "request lookupstring" flag are +set, then both filtering and lookup should be done for the same event. + + + + + +Synchronizing with the IM Server + + +XIM_SYNC +message requests to synchronize the IM library and the IM Server. + + + +XIM_SYNC (IM library <--> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +This synchronization can be started either on the IM library side or on the +IM Server side. The side which receives +XIM_SYNC +message should process all XIM requests before replying. The input-context-ID +is necessary to distinguish the IC with which the IM library and the IM +Server are synchronized. + + + +XIM_SYNC_REPLY (IM Server <--> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + + +The side which receives +XIM_FORWARD_EVENT, +XIM_COMMIT +or any other message with synchronous bit, should process all XIM request +before replying, and send +XIM_SYNC_REPLY +message as the reply to the previous message. + + + + + +Sending a committed string + +When the IM Server commits a string, the IM Server sends either the committed +string or list of KeySym, or both, by +XIM_COMMIT +message. + + + +XIM_COMMIT (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 BITMASK16 flag + #0001 synchronous + #0002 XLookupChars + #0004 XLookupKeySym + #0006 XLookupBoth = XLookupChars | XLookupKeySym + + + +If flag is XLookupKeySym, the arguments continue as follows: + + + + 2 unused + 4 KEYSYM KeySym + + + +If flag is XLookupChars, the arguments continue as follows + + + + 2 m byte length of committed string + m LISTofBYTE committed string + p unused, p = Pad(m) + + + +If flag is XLookupBoth, the arguments continue as follows + + + + 2 unused + 4 KEYSYM KeySym + 2 n byte length of committed string + n LISTofBYTE committed string + p unused, p = Pad(2+n) + + + +The IM Server which receives +XIM_COMMIT +message without synchronous bit should set synchronous bit. + + + + + +Reset IC + +XIM_RESET_IC +message requests to reset the status of IC in the IM Server. + + + +XIM_RESET_IC (IM library -> IM Server) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + +XIM_RESET_IC +is a synchronous request. The IM library should wait until receiving either an +XIM_RESET_IC_REPLY packet or an +XIM_ERROR packet. + + + +XIM_RESET_IC_REPLY (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 n byte length of preedit string + n LISTofBYTE preedit string + p unused, p = Pad(2+n) + + + +XIM_RESET_IC_REPLY +message returns the input-context-ID to distinguish replies from multiple ICs. + + + + +Callbacks + +If XIMStyle has XIMPreeditArea or XIMStatusArea set, XIMGeometryCallback +may be used, and if XIMPreeditCallback and/or XIMStatusCallback are set, +corresponding callbacks may be used. + + + +Any callback request may be sent from an IM Server to an IM client +asynchronously in response to any request previously sent by the IM client +to the IM Server. + + + +When an IM Server needs to send a callback request synchronously with +the request previously sent by an IM client, the IM Server sends it +before replying to the previous request. + + + +Negotiating geometry + +The IM Server sends +XIM_GEOMETRY +message to start geometry negotiation, if XIMStyle has XIMPreeditArea or +XIMStatusArea set. + + + + +XIM_GEOMETRY (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +There is always a single Focus Window, even if some input fields have only +one IC. + + + + + +Converting a string + + +XIM_STR_CONVERSION (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 CARD16 XIMStringConversionPosition + 2 unused + 4 CARD32 XIMCaretDirection + #0 XIMForwardChar + #1 XIMBackwardChar + #2 XIMForwardWord + #3 XIMBackwardWord + #4 XIMCaretUp + #5 XIMCaretDown + #6 XIMNextLine + #7 XIMCPreviousLine + #8 XIMLineStart + #9 XIMLineEnd + #10 XIMAbsolutePosition + #11 XIMDontChange + 2 CARD16 factor + 2 CARD16 XIMStringConversionOperation + #0001 XIMStringConversionSubstitution + #0002 XIMStringConversionRetrieval + 2 INT16 byte length to multiply the XIMStringConversionType + + + +XIM_STR_CONVERSION +message may be used to start the string conversion from the IM Server. + + + +XIM_STR_CONVERSION_REPLY (IM library -> IM Server) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 CARD32 XIMStringConversionFeedback + XIMSTRCONVTEXT XIMStringConversionText + + + +XIM_STR_CONVERSION_REPLY +message returns the string to be converted and the feedback information array. + + + + +Preedit Callbacks + + +The IM Server sends +XIM_PREEDIT_START +message to call the XIMPreeditStartCallback function. + + + +XIM_PREEDIT_START (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +The reply to this message must be sent synchronously. The reply forwards +the return value from the callback function to the IM Server. + + + +XIM_PREEDIT_START_REPLY (IM library -> IM Server) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 INT32 return value + + + +XIM_PREEDIT_START_REPLY +message returns the input-context-ID to distinguish replies from multiple +IC's. The return value contains the return value of the function +XIMPreeditStartCallback. + + + +The IM Server sends +XIM_PREEDIT_DRAW +message to call the XIMPreeditDrawCallback function. + + + +XIM_PREEDIT_DRAW (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 INT32 caret + 4 INT32 chg_first + 4 INT32 chg_length + 4 BITMASK32 status + #x0000001 no string + #x0000002 no feedback + 2 n length of preedit string + n STRING8 preedit string + p unused, p = Pad(2+n) + 2 m byte length of feedback array + 2 unused + m LISTofXIMFEEDBACK feedback array + + + +The fields "caret", "chg_first" and "chg_length" correspond to the +fields of XIMPreeditDrawCallbackStruct. +When the "no string" bit of the status field is set, the text field of +XIMPreeditDrawCallbackStruct is NULL. +When the "no feedback" bit of the status field is set, the text feedback +field of XIMPreeditDrawCallbackStruct is NULL. +When the above bits are not set, "preedit string" contains the preedit +string to be displayed, and the feedback array contains feedback information. + + + +The IM Server sends +XIM_PREEDIT_CARET +message to call the PreeditCaretCallback function. + + + +XIM_PREEDIT_CARET (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 INT32 position + 4 CARD32 direction + #0 XIMForwardChar + #1 XIMBackwardChar + #2 XIMForwardWord + #3 XIMBackwardWord + #4 XIMCaretUp + #5 XIMCaretDown + #6 XIMNextLine + #7 XIMCPreviousLine + #8 XIMLineStart + #9 XIMLineEnd + #10 XIMAbsolutePosition + #11 XIMDontChange + 4 CARD32 style + #0 XIMInvisible + #1 XIMCPrimary + #2 XIMSecondary + + + +Each entry corresponds to a field of XIMPreeditCaretCallbackStruct. +Since this callback sets the caret position, its reply must be sent +synchronously. + + + +XIM_PREEDIT_CARET_REPLY (IM library -> IM Server) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 CARD32 position + + + +The position is the value returned by the callback function after it +has been called. + + + +The IM Server sends +XIM_PREEDIT_DONE +message to call the XIMPreeditDoneCallback function. + + + +XIM_PREEDIT_DONE (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + + +Preedit state notify + + +XIM_PREEDITSTATE (IM Server -> IM Library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 BITMASK32 XIMPreeditState + #x0000000 XIMPreeditUnknown + #x0000001 XIMPreeditEnable + #x0000002 XIMPreeditDisable + + + +XIM_PREEDITSTATE +message is used to call the XIMPreeditStateNotifyCallback function. + + + + + +Status Callbacks + + +The IM Server sends +XIM_STATUS_START +message to call the XIMStatusStartCallback function. + + + +XIM_STATUS_START (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + +The IM Server sends +XIM_STATUS_DRAW +message to call the XIMStatusDrawCallback function. + + + +XIM_STATUS_DRAW (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 CARD32 type + #0 XIMTextType + #1 XIMBitmapType + + + +If type is XIMTextType, the arguments continue as follows. + + + + 4 BITMASK32 status + #x0000001 no string + #x0000002 no feedback + 2 n length of status string + n STRING8 status string + p unused, p = Pad(2+n) + 2 m byte length of feedback array + 2 unused + m LISTofXIMFEEDBACK feedback array + + + +If type is XIMBitmapType, the arguments continue as follows. + + + + 4 PIXMAP pixmap data + + + +The field "type" corresponds to the field in XIMStatusDrawCallbackStruct. + + + +The IM Server sends +XIM_STATUS_DONE +message to call the XIMStatusDoneCallback function. + + + +XIM_STATUS_DONE (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + + + + + + + +Acknowledgements + +This document represents the culmination of several years of debate and +experiments done under the auspices of the MIT X Consortium i18n working +group. Although this was a group effort, the author remains responsible +for any errors or omissions. + + + +We would like to thank to all members of this group. +And we would like to make special thanks to the following people +(in alphabetical order) for their participation in the IM Protocol +design, +Hector Chan, Takashi Fujiwara, Yoshio Horiuchi, Makoto Inada, +Hiromu Inukai, Mickael Kung, Seiji Kuwari, Franky Ling, Hiroyuki Machida, +Hiroyuki Miyamoto, Frank Rojas, Bob Scheifler, Makiko Shimamura, +Shoji Sugiyama, Hidetoshi Tajima, Masaki Takeuchi, Makoto Wakamatsu, +Masaki Wakao, Nobuyuki Tanaka, Shigeru Yamada, Katsuhisa Yano, Jinsoo Yoon. + + + + + +References + + X Window System Protocol Version 11 + Robert W.Scheifler + + + + Xlib - C Language X Interface" + Robert W.Scheifler + + + + + +Common Extensions + +Extension opcodes and packet names (e.g. +XIM_EXT_SET_EVENT_MASK +) for additional extensions may be registered with X Consortium. +The following is a commonly well-known extended packet. + + + +(1) Extension to manipulate the event handling\fP + + + + +XIM_EXT_SET_EVENT_MASK +message specifies the set of event masks that the IM library should manipulate. + + + +XIM_EXT_SET_EVENT_MASK (IM Server -> IM library) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 4 EVENTMASK filter-event-mask (*1) + 4 EVENTMASK intercept-event-mask (*2) + 4 EVENTMASK select-event-mask (*3) + 4 EVENTMASK forward-event-mask (*4) + 4 EVENTMASK synchronous-event-mask (*5) + + (*1) Specify the events to be neglected by the IM library via XFilterEvent. + (*2) Specify the events to be deselected by the IM library with XSelectInput. + (*3) Specify the events to be selected by the IM library with XSelectInput. + (*4) Specify all the events to be forwarded to the IM Server by the IM library. + (*5) Specify the events to be forwarded with synchronous flag on by the IM library. + + + + +The IM library must reply +XIM_SYNC_REPLY +message to the IM Server. This request is valid after the ic is created. + + + +(2) Extension for improvement of performance. + + +The following requests may be used for improvement of performance. + + + +XIM_EXT_FORWARD_KEYEVENT +message may be used instead of +XIM_FORWARD_EVENT +message. + + + +XIM_EXT_FORWARD_KEYEVENT (IM Server <--> IM library) + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 BITMASK16 flag + #0001 synchronous + 2 CARD16 sequence number + 1 BYTE xEvent.u.u.type + 1 BYTE keycode + 2 CARD16 state + 4 CARD32 time + 4 CARD32 window + + + +XIM_EXT_MOVE +message may be used to change the spot location instead of + +XIM_SET_IC_VALUES +message. +It is effective only if the client specified XIMPreeditPosition. + + + + +XIM_EXT_MOVE (IM library -> IM Server) + + 2 CARD16 input-method-ID + 2 CARD16 input-context-ID + 2 INT16 X + 2 INT16 Y + + + +XIM_EXT_MOVE +message is a asynchronous request. + + + + +Transport List + + +The list of transport specific IM Server address format registered + + + +The following format represents the ATOM contained in +XIM_SERVERS +property and the string returned from the request converting +selection target LOCALES and TRANSPORT. + + + "{category=[value,...]}..." + + +The following categories are currently registered. + + + +server;: IM Server name (used for XIM_SERVERS) +locale;: XPG4 locale name (LOCALES) +transport;: transport-specific name (TRANSPORT) + + + +The preregistered formats for transport-specific names are as follows: + + + +TCP/IP Names + + + +The following syntax should be used for system internal domain names: + + +<local name> ::= "local/"<hostname>":"<pathname> + + +Where <pathname> is a path name of socket address. + + + +IM Server's name should be set to <pathname> to run multiple IM Server +at the same time + + + +The following syntax should be used for Internet domain names: + + +<TCP name> ::= "tcp/"<hostname>":"<ipportnumber> + + +where <hostname> is either symbolic (such as expo.lcs.mit.edu) or +numeric decimal (such as 18.30.0.212). The <ipportnumber> is the +port on which the IM Server is listening for connections. +For example: + + +tcp/expo.lcs.mit.edu:8012 +tcp/18.30.0.212:7890 + + + +DECnet Names + + + +The following syntax should be used for DECnet names: + + +<DECnet name> ::= "decnet/"<nodename>"::IMSERVER$"<objname> + + +where <nodename> is either +symbolic (such as SRVNOD) or the numeric +decimal form of the DECnet address (such as 44.70). +The <objname> +is normal, case-insensitive DECnet object name. For example: + + + +DECNET/SRVNOD::IMSERVER$DEFAULT +decnet/44.70::IMSERVER$other + + + +X Names + + + +The following syntax should be used for X names: + + +<X name> ::= "X/" + + + +If a given category has multiple values, the value is evaluated in order of +setting. + + + + +Protocol Number + + +Major Protocol number + + + +XIM_CONNECT #001 +XIM_CONNECT_REPLY #002 +XIM_DISCONNECT #003 +XIM_DISCONNECT_REPLY #004 + +XIM_AUTH_REQUIRED #010 +XIM_AUTH_REPLY #011 +XIM_AUTH_NEXT #012 +XIM_AUTH_SETUP #013 +XIM_AUTH_NG #014 + +XIM_ERROR #020 + +XIM_OPEN #030 +XIM_OPEN_REPLY #031 +XIM_CLOSE #032 +XIM_CLOSE_REPLY #033 +XIM_REGISTER_TRIGGERKEYS #034 +XIM_TRIGGER_NOTIFY #035 +XIM_TRIGGER_NOTIFY_REPLY #036 +XIM_SET_EVENT_MASK #037 +XIM_ENCODING_NEGOTIATION #038 +XIM_ENCODING_NEGOTIATION_REPLY #039 +XIM_QUERY_EXTENSION #040 +XIM_QUERY_EXTENSION_REPLY #041 +XIM_SET_IM_VALUES #042 +XIM_SET_IM_VALUES_REPLY #043 +XIM_GET_IM_VALUES #044 +XIM_GET_IM_VALUES_REPLY #045 + +XIM_CREATE_IC #050 +XIM_CREATE_IC_REPLY #051 +XIM_DESTROY_IC #052 +XIM_DESTROY_IC_REPLY #053 +XIM_SET_IC_VALUES #054 +XIM_SET_IC_VALUES_REPLY #055 +XIM_GET_IC_VALUES #056 +XIM_GET_IC_VALUES_REPLY #057 +XIM_SET_IC_FOCUS #058 +XIM_UNSET_IC_FOCUS #059 +XIM_FORWARD_EVENT #060 +XIM_SYNC #061 +XIM_SYNC_REPLY #062 +XIM_COMMIT #063 +XIM_RESET_IC #064 +XIM_RESET_IC_REPLY #065 + +XIM_GEOMETRY #070 +XIM_STR_CONVERSION #071 +XIM_STR_CONVERSION_REPLY #072 +XIM_PREEDIT_START #073 +XIM_PREEDIT_START_REPLY #074 +XIM_PREEDIT_DRAW #075 +XIM_PREEDIT_CARET #076 +XIM_PREEDIT_CARET_REPLY #077 +XIM_PREEDIT_DONE #078 +XIM_STATUS_START #079 +XIM_STATUS_DRAW #080 +XIM_STATUS_DONE #081 +XIM_PREEDITSTATE #082 + +(*) The IM Server's extension protocol number should be more than #128. + + + + + +Implementation Tips + +(1) FrontEnd Method + + + +FrontEnd method is recognized as a performance acceleration by the +trade off of the variety of the reliability. + + + +In order to use the FrontEnd method, the IM library must query the IM +Server to see if the FrontEnd extension is available. The query is +made by using the +XIM_QUERY_EXTENSION +message. The IM Server may send +XIM_EXT_SET_EVENT_MASK +message with intercept-event-mask, forward-event-mask, and +synchronous-event-mask values set after replying +XIM_QUERY_EXTENSION_REPLY +message. + + + +FrontEnd method can be implemented in a couple of ways depending on +how the IM Server utilize +XIM_EXT_SET_EVENT_MASK +message. + + + +One approach is to update both of the input mask and the filter-event-mask +depending on the preeidting state. The sample protocol sequence using the +static event flow is as follows: + + + + + + + The flow of events + + + +To pursuit a maximum performance regardless of the preediting mode, +the IM Server may use the dynamic event flow with the following +sample protocol sequence. + + + + + + + The flow of events + + + +This method can reduce the XIM protocol traffic dramatically +by updating intercept-event-mask and select-event-mask accordingly. +The tradeoff of this performance improvement is that the key +events may be lost or disordered in some particular situation, such as +when the user types the keyboard in following sequence really fast: + + + +<preediting on key>"some strings"<preediting off +key>"another string" + + + +Since this method requires the input mask updates to the both the IM Server +and Xlib when turning on and off the preediting, and there is a time lag +till the requests take effect when two client issues the input mask updates +simultaneously. + + + +Another approach of the FrontEnd method is to update the filter-event-mask +depending on the preediting state and not to update the input mask. +The IM Server must register both of the preediting on key list and off key +list by +XIM_REGISTER_TRIGGERKEYS +message. +In this method, Both the IM Server and the IM client select the same +events on the same client's window, so that the events are delivered +to both of the IM Server and the client. The preediting on and off +states are expressed by whether the key events are filtered or not. +The sample protocol sequence are as follows: + + + +<<Using static event flow>> + + + + + + + The flow of events + + + +<<Using the dynamic event flow>> + + + + + + + The flow of events + + + +This method does not have the problem of the time lag when going across +the preediting on and off mode, however, the amount of the performance +acceleration is not as good as the method described above. + + + +In general, the FrontEnd method requires some synchronization to some +of the X protocols, such as the ChangeWindowAttribute protocol for the +event mask change or the GrabKey protocol, since it relies on the X's +principal event dispatching mechanism. Any X protocol bindings do not +consider the synchronization might cause some mis-synchronization +between the IM clients and the IM Server. + + + +(2) Transport Layer + + + +The Xlib XIM implementation is layered into three functions, a protocol +layer, an interface layer and a transport layer. The purpose of this +layering is to make the protocol independent of transport implementation. +Each function of these layers are: + + + + + The protocol layer + + +implements overall function of XIM and calls the interface layer +functions when it needs to communicate to IM Server. + + + + + The interface layer + + +separates the implementation of the transport layer from the protocol +layer, in other words, it provides implementation independent hook for +the transport layer functions. + + + + + The transport layer + + +handles actual data communication with IM Server. It is done by a set +of several functions named transporters. + + + + + + +The interface layer and the transport layer make various communication +channels usable such as X Protocol, TCP/IP, DECnet or STREAM. +The following is a sample implementation for the transporter using +the X connection. +Refer to "xtrans" for the transporter using Socket Transport. + + + +At the beginning of the X Transport connection for the XIM transport +mechanism, two different windows must be created either in an Xlib XIM +or in an IM Server, with which the Xlib and the IM Server exchange the +XIM transports by using the ClientMessage events and Window Properties. +In the following, the window created by the Xlib is referred as the +"client communication window", and on the other hand, the window created +by the IM Server is referred as the "IMS communication window". + + + +Connection + + + +In order to establish a connection, a communication window is created. +A ClientMessage in the following event's format is sent to the owner +window of XIM_SERVER selection, which the IM Server has created. + + + +Refer to "The Input Method Protocol" for the XIM_SERVER atom. + + + +The ClientMessage sent to the IMS window. + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_XCONNECT", False) + + + int + format + 32 + + + long + data.l[0] + client communication window ID + + + long + data.l[1] + client-major-transport-version (*1) + + + long + data.l[2] + client-major-transport-version (*1) + + + +
+ + +In order to establish the connection (to notify the IM Server communication +window), the IM Server sends a ClientMessage in the following event's +format to the client communication window. + + + +The ClientMessage sent by the IM Server. + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + client communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_XCONNECT", False) + + + int + format + 32 + + + long + data.l[0] + IMS communication window ID + + + long + data.l[1] + server-major-transport-version (*1) + + + long + data.l[2] + server-minor-transport-version (*1) + + + long + data.l[3] + dividing size between ClientMessage and Property (*2) + + + +
+ + +(*1) major/minor-transport-version + + +The read/write method is decided by the combination of +major/minor-transport-version, as follows: + + + + +The read/write method and the major/minor-transport-version + + + + + + + + Transport-version + read/write + + + major + minor + + + + + + 0 + 0 + only-CM & Property-with-CM + + + 1 + only-CM & multi-CM + + + 2 + only-CM & multi-CM & Property-with-CM + + + 1 + 0 + PropertyNotify + + + 2 + 0 + only-CM & PropertyNotify + + + 1 + only-CM & multi-CM & PropertyNotify + + + +
+ + +only-CM : data is sent via a ClientMessage +multi-CM : data is sent via multiple ClientMessages +Property-with-CM : data is written in Property, and its Atom + is send via ClientMessage +PropertyNotify : data is written in Property, and its Atom + is send via PropertyNotify + + + + +The method to decide major/minor-transport-version is as follows: + + + + + +The client sends 0 as major/minor-transport-version to the IM Server. +The client must support all methods in Table D-3. +The client may send another number as major/minor-transport-version to +use other method than the above in the future. + + + + +The IM Server sends its major/minor-transport-version number to +the client. The client sends data using the method specified by the +IM Server. + + + + +If major/minor-transport-version number is not available, it is regarded +as 0. + + + + + + +(*2) dividing size between ClientMessage and Property + + + +If data is sent via both of multi-CM and Property, specify the dividing +size between ClientMessage and Property. The data, which is smaller than +this size, is sent via multi-CM (or only-CM), and the data, which is +lager than this size, is sent via Property. + + + +read/write + + + +The data is transferred via either ClientMessage or Window Property in +the X Window System. + + + +Format for the data from the Client to the IM Server + + + +ClientMessage + + + +If data is sent via ClientMessage event, the format is as follows: + + + + +The ClientMessage event's format (first or middle) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_MOREDATA", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : 20 byte) + + + +
+ + +The ClientMessage event's format (only or last) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : MAX 20 byte) (*1) + + + +
+ + +(*1) If the data is smaller than 20 byte, all data other than available data +must be 0. + + + +Property + + + +In the case of large data, data will be sent via the Window Property +for the efficiency. There are the following two methods to notify +Property, and transport-version is decided which method is used. + + + + + +The XChangeProperty function is used to store data in the client +communication window, and Atom of the stored data is notified to the +IM Server via ClientMessage event. + + + + +The XChangeProperty function is used to store data in the client +communication window, and Atom of the stored data is notified to the +IM Server via PropertyNotify event. + + + + + +The arguments of the XChangeProperty are as follows: + + + +The XChangeProperty event's format + + + + + + + + Argument + Contents + + + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + property + read/write property Atom (*1) + + + Atom + type + XA_STRING + + + int + format + 8 + + + int + mode + PropModeAppend + + + u_char + *data + read/write DATA + + + int + nelements + length of DATA + + + +
+ + +The read/write property ATOM allocates the following strings by +XInternAtom. + + + +"_clientXXX" + + + +The client changes the property with the mode of PropModeAppend and +the IM Server will read it with the delete mode i.e. (delete = True). + + + +If Atom is notified via ClientMessage event, the format of the ClientMessage +is as follows: + + + +The ClientMessage event's format to send Atom of property + + + + + + + + Structure Members + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 32 + + + long + data.l[0] + length of read/write property Atom + + + long + data.l[1] + read/write property Atom + + + +
+ + +Format for the data from the IM Server to the Client + + + + + + +ClientMessage + + + +The format of the ClientMessage is as follows: + + + + + +The ClientMessage event's format (first or middle) + + + + + + + + Structure Members + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + client communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_MOREDATA", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : 20 byte) + + + +
+ + + +The ClientMessage event's format (only or last) + + + + + + + + Structure Members + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + client communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : MAX 20 byte) (*1) + + + +
+ + +(*1) If the data size is smaller than 20 bytes, all data other than available +data must be 0. + + + +Property + + + +In the case of large data, data will be sent via the Window Property +for the efficiency. There are the following two methods to notify +Property, and transport-version is decided which method is used. + + + + + +The XChangeProperty function is used to store data in the IMS +communication window, and Atom of the property is sent via the +ClientMessage event. + + + + +The XChangeProperty function is used to store data in the IMS +communication window, and Atom of the property is sent via +PropertyNotify event. + + + + + +The arguments of the XChangeProperty are as follows: + + + +The XChangeProperty event's format + + + + + + + + Argument + Contents + + + + + Display + *display + The display which to connects + + + Window + window + client communication window ID + + + Atom + property + read/write property Atom (*1) + + + Atom + type + XA_STRING + + + int + format + 8 + + + int + mode + PropModeAppend + + + u_char + *data + read/write DATA + + + int + nelements + length of DATA + + + +
+ + +(*1) The read/write property ATOM allocates some strings, which are not +allocated by the client, by XInternAtom. + + + +The IM Server changes the property with the mode of PropModeAppend and +the client reads it with the delete mode, i.e. (delete = True). + + + +If Atom is notified via ClientMessage event, the format of the ClientMessage +is as follows: + + + + +The ClientMessage event's format to send Atom of property + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + client communication window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 32 + + + long + data.l[0] + length of read/write property ATOM + + + long + data.l[1] + read/write property ATOM + + + +
+ + +Closing Connection + + + +If the client disconnect with the IM Server, shutdown function should +free the communication window properties and etc.. + +
+
diff --git a/libX11/specs/i18n/Framework.ms b/libX11/specs/i18n/Framework.ms deleted file mode 100644 index 98a61f930..000000000 --- a/libX11/specs/i18n/Framework.ms +++ /dev/null @@ -1,1564 +0,0 @@ -.\" To print this out, type tbl macros.t ThisFile | troff -ms -.EH '''' -.OH '''' -.EF '''' -.OF '''' -.ps 11 -.nr PS 11 -\& -.TL -\s+3\fBX11R6 Sample Implementation Frame Work\fP\s-3 -.sp 2 -.AU -Katsuhisa Yano -.AI -TOSHIBA Corporation -.AU -Yoshio Horiuchi -.AI -IBM Japan -.LP -.bp -.br -\& -.sp 15 -.ps 9 -.nr PS 9 -.LP -Copyright \(co 1994 by TOSHIBA Corporation -.br -Copyright \(co 1994 by IBM Corporation -.LP -Permission to use, copy, modify, and distribute this documentation -for any purpose and without fee is hereby granted, provided -that the above copyright notice and this permission notice appear -in all copies. -TOSHIBA Corporation and IBM Corporation make no representations about -the suitability for any purpose of the information in this document. -This documentation is provided as is without express or implied warranty. -.sp 5 -Copyright \(co 1994 X Consortium -.LP -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: -.LP -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -.LP -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. -.LP -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. -.sp 3 -\fIX Window System\fP is a trademark of The Open Group. -.ps 11 -.nr PS 11 -.bp 1 -.EH '\fBSample Implementation Frame Work\fP''\fB\*(xV\fP' -.OH '\fBSample Implementation Frame Work\fP''\fB\*(xV\fP' -.EF ''\fB % \fP'' -.OF ''\fB % \fP'' -.NH 1 -Preface -.XS \*(SN Preface -.XE -.LP -This document proposes to define the structures, methods and their -signatures that are expected to be common to all locale dependent -functions within the Xlib sample implementation. The following -illustration (Fig.1) is proposed to outline the separating of -the components within the sample implementation. -.LP -.\" figure start -.in +1c -\^... 0.237 5.796 5.24 10.14 -\^... 0.000i 4.344i 5.003i 0.000i -.nr 00 \n(.u -.nf -.PS 4.344i 5.003i -.br -.ps 11 -\h'1.753i'\v'2.130i'\v'-.13m'\L'-1.000i\(br'\v'.13m' -.sp -1 -\h'1.753i'\v'1.130i'\l'1.500i' -.sp -1 -\h'3.253i'\v'1.130i'\v'-.13m'\L'1.000i\(br'\v'.13m' -.sp -1 -\h'3.253i'\v'2.130i'\l'-1.500i' -.sp -1 -\h'1.751i'\v'1.628i'\l'1.499i' -.sp -1 -\h'2.500i'\v'1.128i'\v'-.13m'\L'0.500i\(br'\v'.13m' -.sp -1 -\h'1.875i'\v'1.344i'\h'-0.0m'\v'0.2m'\s12\fRInput\fP -.sp -1 -\h'1.875i'\v'1.532i'\h'-0.0m'\v'0.2m'\s12\fRMethod\fP -.sp -1 -\h'2.625i'\v'1.344i'\h'-0.0m'\v'0.2m'\s12\fROutput\fP -.sp -1 -\h'2.625i'\v'1.532i'\h'-0.0m'\v'0.2m'\s12\fRMethod\fP -.sp -1 -\h'1.938i'\v'1.844i'\h'-0.0m'\v'0.2m'\s12\fR\fP -.sp -1 -\h'2.000i'\v'2.032i'\h'-0.0m'\v'0.2m'\s12\fRX Locale Object\fP -.sp -1 -\h'3.503i'\v'1.630i'\v'-.13m'\L'-0.500i\(br'\v'.13m' -.sp -1 -\h'3.503i'\v'1.130i'\l'1.500i' -.sp -1 -\h'5.003i'\v'1.130i'\v'-.13m'\L'0.500i\(br'\v'.13m' -.sp -1 -\h'5.003i'\v'1.630i'\l'-1.500i' -.sp -1 -\h'3.625i'\v'1.344i'\h'-0.0m'\v'0.2m'\s12\fRC Library\fP -.sp -1 -\h'4.250i'\v'1.532i'\h'-0.0m'\v'0.2m'\s12\fRANSI impl.\fP -.sp -1 -\h'0.003i'\v'1.630i'\v'-.13m'\L'-0.500i\(br'\v'.13m' -.sp -1 -\h'0.003i'\v'1.130i'\l'1.500i' -.sp -1 -\h'1.503i'\v'1.130i'\v'-.13m'\L'0.500i\(br'\v'.13m' -.sp -1 -\h'1.503i'\v'1.630i'\l'-1.500i' -.sp -1 -\h'0.125i'\v'1.344i'\h'-0.0m'\v'0.2m'\s12\fRLocale Library\fP -.sp -1 -\h'0.438i'\v'1.507i'\h'-0.0m'\v'0.2m'\s12\fRnon-AnSI impl.\fP -.sp -1 -\h'3.500i'\v'0.782i'\h'-0.0m'\v'0.2m'\s12\fR<< ANSI/MSE API >>\fP -.sp -1 -\h'4.250i'\v'0.969i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fR(X Contrib)\fP'u/2u'\s12\fR(X Contrib)\fP\h'-\w'\s12\fR(X Contrib)\fP'u/2u' -.sp -1 -\h'0.125i'\v'3.094i'\h'-0.0m'\v'0.2m'\s12\fRXLC_XLOCALE\fP -.sp -1 -\h'0.125i'\v'3.282i'\h'-0.0m'\v'0.2m'\s12\fR- MB_CUR_MAX\fP -.sp -1 -\h'0.125i'\v'3.444i'\h'-0.0m'\v'0.2m'\s12\fR- codeset info\fP -.sp -1 -\h'0.125i'\v'3.607i'\h'-0.0m'\v'0.2m'\s12\fRo char/charset\fP -.sp -1 -\h'0.125i'\v'3.769i'\h'-0.0m'\v'0.2m'\s12\fRo conv/charset\fP -.sp -1 -\h'0.003i'\v'3.880i'\v'-.13m'\L'-1.000i\(br'\v'.13m' -.sp -1 -\h'0.003i'\v'2.880i'\l'1.500i' -.sp -1 -\h'1.503i'\v'2.880i'\v'-.13m'\L'1.000i\(br'\v'.13m' -.sp -1 -\h'1.503i'\v'3.880i'\l'-1.500i' -.sp -1 -\h'1.875i'\v'3.094i'\h'-0.0m'\v'0.2m'\s12\fRXLC_FONTSET\fP -.sp -1 -\h'1.875i'\v'3.282i'\h'-0.0m'\v'0.2m'\s12\fR- fonset info\fP -.sp -1 -\h'1.875i'\v'3.444i'\h'-0.0m'\v'0.2m'\s12\fR- charset info\fP -.sp -1 -\h'1.875i'\v'3.607i'\h'-0.0m'\v'0.2m'\s12\fR- font/charset\fP -.sp -1 -\h'1.875i'\v'3.769i'\h'-0.0m'\v'0.2m'\s12\fR- XLFD, GL/GR\fP -.sp -1 -\h'1.753i'\v'3.880i'\v'-.13m'\L'-1.000i\(br'\v'.13m' -.sp -1 -\h'1.753i'\v'2.880i'\l'1.500i' -.sp -1 -\h'3.253i'\v'2.880i'\v'-.13m'\L'1.000i\(br'\v'.13m' -.sp -1 -\h'3.253i'\v'3.880i'\l'-1.500i' -.sp -1 -\h'3.625i'\v'3.444i'\h'-0.0m'\v'0.2m'\s12\fR- codeset info\fP -.sp -1 -\h'3.625i'\v'3.607i'\h'-0.0m'\v'0.2m'\s12\fRo char/charset\fP -.sp -1 -\h'3.625i'\v'3.769i'\h'-0.0m'\v'0.2m'\s12\fRo conv/charset\fP -.sp -1 -\h'3.625i'\v'3.282i'\h'-0.0m'\v'0.2m'\s12\fR- MB_CUR_MAX\fP -.sp -1 -\h'3.625i'\v'3.094i'\h'-0.0m'\v'0.2m'\s12\fRlocaledef DB\fP -.sp -1 -\h'3.503i'\v'3.880i'\v'-.13m'\L'-1.000i\(br'\v'.13m' -.sp -1 -\h'3.503i'\v'2.880i'\l'1.500i' -.sp -1 -\h'5.003i'\v'2.880i'\v'-.13m'\L'1.000i\(br'\v'.13m' -.sp -1 -\h'5.003i'\v'3.880i'\l'-1.500i' -.sp -1 -\h'0.753i'\v'0.250i'\D'l0.000i -0.250i' -.sp -1 -\h'0.753i'\l'3.500i' -.sp -1 -\h'4.253i'\D'l0.000i 0.250i' -.sp -1 -\h'4.253i'\v'0.250i'\l'-3.500i' -.sp -1 -\h'2.500i'\v'0.157i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fRApplication\fP'u/2u'\s12\fRApplication\fP\h'-\w'\s12\fRApplication\fP'u/2u' -.sp -1 -\v'0.782i'\h'-0.0m'\v'0.2m'\s12\fR<< ANSI/MSE API >>\fP -.sp -1 -\h'0.751i'\v'0.969i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fR(X Contrib)\fP'u/2u'\s12\fR(X Contrib)\fP\h'-\w'\s12\fR(X Contrib)\fP'u/2u' -.sp -1 -\h'2.500i'\v'2.128i'\v'-.13m'\L'0.749i\(br'\v'.13m' -.sp -1 -\h'2.475i'\v'2.777i'\D'l0.025i 0.100i' -.sp -1 -\h'2.525i'\v'2.777i'\D'l-0.025i 0.100i' -.sp -1 -\h'2.500i'\v'2.315i'\D'l-0.250i 0.187i' -.sp -1 -\h'2.250i'\v'2.502i'\l'-1.124i' -.sp -1 -\h'1.126i'\v'2.502i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'1.101i'\v'2.777i'\D'l0.025i 0.100i' -.sp -1 -\h'1.151i'\v'2.777i'\D'l-0.025i 0.100i' -.sp -1 -\h'2.500i'\v'2.315i'\D'l0.250i 0.187i' -.sp -1 -\h'2.750i'\v'2.502i'\l'1.125i' -.sp -1 -\h'3.875i'\v'2.502i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'3.850i'\v'2.777i'\D'l0.025i 0.100i' -.sp -1 -\h'3.900i'\v'2.777i'\D'l-0.025i 0.100i' -.sp -1 -\h'0.376i'\v'1.628i'\v'-.13m'\L'1.249i\(br'\v'.13m' -.sp -1 -\h'0.351i'\v'2.777i'\D'l0.025i 0.100i' -.sp -1 -\h'0.401i'\v'2.777i'\D'l-0.025i 0.100i' -.sp -1 -\h'4.625i'\v'1.628i'\v'-.13m'\L'1.249i\(br'\v'.13m' -.sp -1 -\h'4.600i'\v'2.777i'\D'l0.025i 0.100i' -.sp -1 -\h'4.650i'\v'2.777i'\D'l-0.025i 0.100i' -.sp -1 -\h'2.125i'\v'0.253i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'2.100i'\v'0.528i'\D'l0.025i 0.100i' -.sp -1 -\h'2.150i'\v'0.528i'\D'l-0.025i 0.100i' -.sp -1 -\h'2.875i'\v'0.253i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'2.850i'\v'0.528i'\D'l0.025i 0.100i' -.sp -1 -\h'2.900i'\v'0.528i'\D'l-0.025i 0.100i' -.sp -1 -\h'1.126i'\v'0.253i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'1.101i'\v'0.528i'\D'l0.025i 0.100i' -.sp -1 -\h'1.151i'\v'0.528i'\D'l-0.025i 0.100i' -.sp -1 -\h'3.875i'\v'0.253i'\v'-.13m'\L'0.375i\(br'\v'.13m' -.sp -1 -\h'3.850i'\v'0.528i'\D'l0.025i 0.100i' -.sp -1 -\h'3.900i'\v'0.528i'\D'l-0.025i 0.100i' -.sp -1 -\v'4.002i'\D'l0.125i 0.125i' -.sp -1 -\h'0.125i'\v'4.127i'\l'3.000i' -.sp -1 -\h'3.125i'\v'4.127i'\D'l0.125i -0.125i' -.sp -1 -\h'3.500i'\v'4.002i'\D'l0.125i 0.125i' -.sp -1 -\h'3.625i'\v'4.127i'\l'1.250i' -.sp -1 -\h'4.875i'\v'4.127i'\D'l0.125i -0.125i' -.sp -1 -\h'1.626i'\v'4.344i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fRXLocale Source (X Core)\fP'u/2u'\s12\fRXLocale Source (X Core)\fP\h'-\w'\s12\fRXLocale Source (X Core)\fP'u/2u' -.sp -1 -\h'4.250i'\v'4.344i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fRSystem LOcale Source\fP'u/2u'\s12\fRSystem LOcale Source\fP\h'-\w'\s12\fRSystem LOcale Source\fP'u/2u' -.sp -1 -\h'2.500i'\v'0.782i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fRXLib API\fP'u/2u'\s12\fRXLib API\fP\h'-\w'\s12\fRXLib API\fP'u/2u' -.sp -1 -\h'2.500i'\v'0.969i'\h'-0.0m'\v'0.2m'\h'-\w'\s12\fR(X Core)\fP'u/2u'\s12\fR(X Core)\fP\h'-\w'\s12\fR(X Core)\fP'u/2u' -.sp -1 -\h'1.751i'\v'0.782i'\h'-0.0m'\v'0.2m'\s12\fR<<\fP -.sp -1 -\h'3.063i'\v'0.782i'\h'-0.0m'\v'0.2m'\s12\fR>>\fP -.sp -1 -.sp 1+4.344i -.in -1c -.PE -.if \n(00 .fi -.\" figure end -.LP -.ce -.sp 6p -Fig.1 : Frame Work of Locale Service API Proposal -.LP -Generally speaking, the internationalized portion of Xlib (Locale -Dependent X, LDX) consists of three objects; -locale (LC) , input method (IM) and output method (OM). -The LC provides a set of information that depends on user's language -environment. The IM manages text inputing, and the OM manages text -drawing. Both IM and OM highly depend on LC data. -.LP -In X11R5, there are two sample implementations, Ximp and Xsi, for -Xlib internationalization. But in both implementations, IM and OM -actually refer the private extension of LC. It breaks coexistence -of these two sample implementations. For example, if a user creates -a new OM for special purpose as a part of Ximp, it will not work with -Xsi. -.LP -As a solution of this problem, we propose to define the standard -APIs between these three objects, and define the structure that are -common to these objects. -.LP -.NH 1 -Objective -.XS \*(SN Objective -.XE -.LP -.IP \(bu -Explain the current X11R6 sample implementation -.IP \(bu -Document the common set of locale dependent interfaces -.IP \(bu -Provide more flexible pluggable layer -.LP -.NH 1 -Locale Object Binding Functions -.XS \*(SN Locale Object Binding Functions -.XE -.LP -This chapter describes functions related locale object binding for -implementing the pluggable layer. -.LP -A locale loader is an entry point for locale object, which -instantiates XLCd object and binds locale methods with specified -locale name. The behavior of loader is implementation dependent. -And, what kind of loaders are available is also implementation -dependent. -.LP -The loader is called in -.PN _XOpenLC, -but caller of -.PN _XOpenLC -does not need to care about its inside. For example, if the loader is -implemented with dynamic load functions, and the dynamic module is -expected to be unloaded when the corresponding XLCd is freed, -close methods of XLCdMethods should handle unloading. -.LP -.sp -\fBInitializing a locale loader list\fP -.LP -.FD 0 -void _XlcInitLoader() -.FN -The -.PN _XlcInitLoader -function initializes the locale loader list with vendor specific -manner. Each loader is registered with calling -.PN _XlcAddLoader. -The number of loaders and their order in the loader list is -implementation dependent. -.sp -.LP -\fBAdd a loader\fP -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef XLCd (*XLCdLoadProc)(\fIname\fP); - char \fI*name\fP; - -typedef int XlcPosition; -.De -.TS -lw(.5i) lw(2i) lw(2i). -T{ -#define -T} T{ -XlcHead -T} T{ - 0 -T} -T{ -#define -T} T{ -XlcTail -T} T{ --1 -T} -.TE -.LP -.FD 0 -Bool _XlcAddLoader(\fIproc, position\fP) -.br - XLCdLoadProc \fIproc\fP; -.br - XlcPosition \fIposition\fP; -.FN -.LP -The -.PN _XlcAddLoader -function registers the specified locale loader ``\fIproc\fP'' to the -internal loader list. The position specifies that the loader -``\fIproc\fP'' should be placed in the top of the loader list(XlcHead) -or last(XlcTail). -.LP -The object loader is called from the top of the loader list in order, -when calling time. -.sp -.LP -\fBRemove a loader\fP -.LP -.FD 0 -void _XlcRemoveLoader(\fIproc\fP) -.br - XLCdLoadProc \fIproc\fP; -.FN -.LP -The -.PN _XlcRemoveLoader -function removes the locale loader specified by ``\fIproc\fP'' from the -loader list. -.LP -Current implementation provides following locale loaders; -.DS -.PN _XlcDefaultLoader -.PN _XlcGenericLoader -.PN _XlcEucLoader -.PN _XlcSjisLoader -.PN _XlcUtfLoader -.PN _XaixOsDynamicLoad -.DE -.LP -.NH 1 -Locale Method Interface -.XS \*(SN Locale Method Interface -.XE -.LP -This chapter describes the locale method API, which is a set of -accessible functions from both IM and OM parts. -The locale method API provides the functionalities; obtaining locale -dependent information, handling charset, converting text, etc. -.LP -As a result of using these APIs instead of accessing vender private -extension of the locale object, we can keep locale, IM and OM -independently each other. -.LP -.NH 1 -Locale Method Functions -.XS \*(SN Locale Method Functions -.XE -.LP -\fBOpen a Locale Method\fP -.LP -.FD 0 -XLCd _XOpenLC(\fIname\fP) -.br - char \fI*name\fP; -.FN -.LP -The -.PN _XOpenLC -function opens a locale method which corresponds to the -specified locale name. -.PN _XOpenLC -calls a locale object loader, which is registered via -.PN _XlcAddLoader into the internal loader list. If the called loader -is valid and successfully opens a locale, -.PN _XOpenLC -returns the XLCd. If the loader is invalid or failed to open a locale, -.PN _XOpenLC -calls the next loader. If all registered loaders cannot open a locale, -.PN _XOpenLC -returns NULL. -.LP -.FD 0 -XLCd _XlcCurrentLC() -.FN -.LP -The -.PN _XlcCurrentLC -function returns an XLCd that are bound to current locale. -.sp -.LP -\fBClose a Locale Method\fP -.LP -.FD 0 -void _XCloseLC(\fIlcd\fP) -.br - XLCd \fIlcd\fP; -.FN -.LP -The -.PN _XCloseLC -function close a locale method the specified lcd. -.sp -.LP -\fBObtain Locale Method values\fP -.LP -.FD 0 -char * _XGetLCValues(\fIlcd\fP, ...) -.br - XLCd \fIlcd\fP; -.FN -.LP -The -.PN _XGetLCValues -function returns NULL if no error occurred; otherwise, it returns the -name of the first argument that could not be obtained. -The following values are defined as standard arguments. Other values -are implementation dependent. -.LP -.TS H -tab(:); -l l l. -_ -.sp 6p -.B -Name:Type:Description -.sp 6p -_ -.sp 6p -.TH -.R -XlcNCodeset:char*:codeset part of locale name -XlcNDefaultString:char*:XDefaultString() -XlcNEncodingName:char*:encoding name -XlcNLanguage:char*:language part of locale name -XlcNMbCurMax:int:ANSI C MB_CUR_MAX -XlcNStateDependentEncoding:Bool:is state-dependent encoding or not -XlcNTerritory:char*:territory part of locale name -.sp 6p -_ -.TE -.LP -.NH 1 -Charset functions -.XS \*(SN -Charset functions -.XE -.LP -The XlcCharSet is an identifier which represents a subset of characters -(character set) in the locale object. -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef enum { - XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther -} XlcSide; - -typedef struct _XlcCharSetRec *XlcCharSet; - -typedef struct { - char *name; - XPointer value; -} XlcArg, *XlcArgList; - -typedef char* (*XlcGetCSValuesProc)(\fIcharset\fP, \fIargs\fP, \fInum_args\fP); - XlcCharSet \fIcharset\fP; - XlcArgList \fIargs\fP; - int \fInum_args\fP; - -typedef struct _XlcCharSetRec { - char *name; - XrmQuark xrm_name; - char *encoding_name; - XrmQuark xrm_encoding_name; - XlcSide side; - int char_size; - int set_size; - char *ct_sequence; - XlcGetCSValuesProc get_values; -} XlcCharSetRec; -.De -.sp -.LP -\fBGet an XlcCharSet\fP -.LP -.FD 0 -XlcCharSet _XlcGetCharSet(\fIname\fP) -.br - char \fI*name\fP; -.FN -.LP -The -.PN _XlcGetCharSet -function gets an XlcCharSet which corresponds to the charset name -specified by ``\fIname\fP''. -.PN _XlcGetCharSet -returns NULL, if no XlcCharSet bound to specified ``\fIname\fP''. -.LP -The following character sets are pre-registered. -.LP -.TS H -tab(@); -l l. -_ -.sp 6p -.B -Name@Description -.sp 6p -_ -.sp 6p -.TH -.R -ISO8859-1:GL@7-bit ASCII graphics (ANSI X3.4-1968), -@Left half of ISO 8859 sets -JISX0201.1976-0:GL@Left half of JIS X0201-1976 (reaffirmed 1984), -@8-Bit Alphanumeric-Katakana Code -.sp -ISO8859-1:GR@Right half of ISO 8859-1, Latin alphabet No. 1 -ISO8859-2:GR@Right half of ISO 8859-2, Latin alphabet No. 2 -ISO8859-3:GR@Right half of ISO 8859-3, Latin alphabet No. 3 -ISO8859-4:GR@Right half of ISO 8859-4, Latin alphabet No. 4 -ISO8859-7:GR@Right half of ISO 8859-7, Latin/Greek alphabet -ISO8859-6:GR@Right half of ISO 8859-6, Latin/Arabic alphabet -ISO8859-8:GR@Right half of ISO 8859-8, Latin/Hebrew alphabet -ISO8859-5:GR@Right half of ISO 8859-5, Latin/Cyrillic alphabet -ISO8859-9:GR@Right half of ISO 8859-9, Latin alphabet No. 5 -JISX0201.1976-0:GR@Right half of JIS X0201-1976 (reaffirmed 1984), -@8-Bit Alphanumeric-Katakana Code -.sp -GB2312.1980-0:GL@GB2312-1980, China (PRC) Hanzi defined as GL -GB2312.1980-0:GR@GB2312-1980, China (PRC) Hanzi defined as GR -JISX0208.1983-0:GL@JIS X0208-1983, Japanese Graphic Character Set -@defined as GL -JISX0208.1983-0:GR@JIS X0208-1983, Japanese Graphic Character Set -@defined as GR -KSC5601.1987-0:GL@KS C5601-1987, Korean Graphic Character Set -@defined as GL -KSC5601.1987-0:GR@KS C5601-1987, Korean Graphic Character Set -@defined as GR -JISX0212.1990-0:GL@JIS X0212-1990, Japanese Graphic Character Set -@defined as GL -JISX0212.1990-0:GR@JIS X0212-1990, Japanese Graphic Character Set -@defined as GR -.\" CNS11643.1986-0:GL -.\" CNS11643.1986-1:GL -.\" TIS620-0:GR -.sp 6p -_ -.TE -.LP -.sp -\fBAdd an XlcCharSet\fP -.LP -.FD 0 -Bool _XlcAddCharSet(\fIcharset\fP) - XlcCharSet \fIcharset\fP; -.FN -.LP -The -.PN _XlcAddCharSet -function registers XlcCharSet specified by ``\fIcharset\fP''. -.LP -.sp -\fBObtain Character Set values\fP -.LP -.FD 0 -char * _XlcGetCSValues(\fIcharset\fP, ...) -.br - XlcCharSet \fIcharset\fP; -.FN -.LP -The -.PN _XlcGetCSValues -function returns NULL if no error occurred; -otherwise, it returns the name of the first argument that could not -be obtained. The following values are defined as standard arguments. -Other values are implementation dependent. -.LP -.TS H -tab(:); -l l l. -_ -.sp 6p -.B -Name:Type:Description -.sp 6p -_ -.sp 6p -.TH -.R -XlcNName:char*:charset name -XlcNEncodingName:char*:XLFD CharSet Registry and Encoding -XlcNSide:XlcSide:charset side (GL, GR, ...) -XlcNCharSize:int:number of octets per character -XlcNSetSize:int:number of character sets -XlcNControlSequence:char*:control sequence of Compound Text -.sp 6p -_ -.TE -.LP -.NH 1 -Converter Functions -.XS \*(SN Converter Functions -.XE -.LP -We provide a set of the common converter APIs, that are independent -from both of source and destination text type. -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef struct _XlcConvRec *XlcConv; - -typedef void (*XlcCloseConverterProc)(\fIconv\fP); - XlcConv \fIconv\fP; - -typedef int (*XlcConvertProc)(\fIconv\fP, \fIfrom\fP, \fIfrom_left\fP, \fIto\fP, \fIto_left\fP, \fIargs\fP, \fInum_args\fP); - XlcConv \fIconv\fP; - XPointer \fI*from\fP; - int \fI*from_left\fP; - XPointer \fI*to\fP; - int \fI*to_left\fP; - XPointer \fI*args\fP; - int \fInum_args\fP; - -typedef void (*XlcResetConverterProc)(\fIconv\fP); - XlcConv \fIconv\fP; - -typedef struct _XlcConvMethodsRec { - XlcCloseConverterProc close; - XlcConvertProc convert; - XlcResetConverterProc reset; -} XlcConvMethodsRec, *XlcConvMethods; - -typedef struct _XlcConvRec { - XlcConvMethods methods; - XPointer state; -} XlcConvRec; -.De -.LP -.sp -\fBOpen a converter\fP -.LP -.FD 0 -XlcConv _XlcOpenConverter(\fIfrom_lcd\fP, \fIfrom_type\fP, \fIto_lcd\fP, \fIto_type\fP) -.br - XLCd \fIfrom_lcd\fP; -.br - char \fI*from_type\fP; -.br - XLCd \fIto_lcd\fP; -.br - char \fI*to_type\fP; -.FN -.LP -.PN _XlcOpenConverter -function opens the converter which converts a text from specified -``\fIfrom_type\fP'' to specified ``\fIto_type\fP'' encoding. If the -function cannot find proper converter or cannot open a corresponding -converter, it returns NULL. Otherwise, it returns the conversion -descriptor. -.LP -The following types are pre-defined. Other types are implementation -dependent. -.LP -.TS H -tab(:); -l l l l. -_ -.sp 6p -.B -Name:Type:Description:Arguments -.sp 6p -_ -.sp 6p -.TH -.R -XlcNMultiByte:char *:multibyte:- -XlcNWideChar:wchar_t *:wide character:- -XlcNCompoundText:char *:COMPOUND_TEXT:- -XlcNString:char *:STRING:- -XlcNCharSet:char *:per charset:XlcCharSet -XlcNChar:char *:per character:XlcCharSet -.sp 6p -_ -.TE -.LP -.sp -\fBClose a converter\fP -.LP -.FD 0 -void _XlcCloseConverter(\fIconv\fP) -.br - XlcConv \fIconv\fP; -.FN -.LP -The -.PN _XlcCloseConverter -function closes the specified converter ``\fIconv\fP''. -.LP -.sp -\fBCode conversion\fP -.LP -.FD 0 -int _XlcConvert(\fIconv\fP, \fIfrom\fP, \fIfrom_left\fP, \fIto\fP, \fIto_left\fP, \fIargs\fP, \fInum_args\fP) -.br - XlcConv \fIconv\fP; -.br - XPointer \fI*from\fP; -.br - int \fI*from_left\fP; -.br - XPointer \fI*to\fP; -.br - int \fI*to_left\fP; -.br - XPointer \fI*args\fP; -.br - int \fInum_args\fP; -.FN -.LP -The -.PN _XlcConvert -function converts a sequence of characters from one type, in the array -specified by ``\fIfrom\fP'', into a sequence of corresponding characters -in another type, in the array specified by ``\fIto\fP''. The types are -those specified in the -.PN _XlcOpenConverter() -call that returned the conversion descriptor, ``\fIconv\fP''. -The arguments ``\fIfrom\fP'', ``\fIfrom_left\fP'', ``\fIto\fP'' and -``\fIto_left\fP'' have the same specification of XPG4 iconv function. -.LP -For state-dependent encodings, the conversion descriptor ``\fIconv\fP'' -is placed into its initial shift state by a call for which ``\fIfrom\fP'' -is a NULL pointer, or for which ``\fIfrom\fP'' points to a null pointer. -.LP -The following 2 converters prepared by locale returns appropriate -charset (XlcCharSet) in an area pointed by args[0]. -.LP -.TS -tab(:); -l l l. -_ -.sp 6p -.B -From:To:Description -.sp 6p -_ -.sp 6p -.R -XlcNMultiByte:XlcNCharSet:Segmentation (Decomposing) -XlcNWideChar:XlcNCharSet:Segmentation (Decomposing) -.sp 6p -_ -.TE -.LP -The conversion, from XlcNMultiByte/XlcNWideChar to XlcNCharSet, -extracts a segment which has same charset encoding characters. -More than one segment cannot be converted in a call. -.LP -.sp -\fBReset a converter\fP -.LP -.FD 0 -void _XlcResetConverter(\fIconv\fP) -.br - XlcConv \fIconv\fP; -.FN -.LP -The -.PN _XlcResetConverter -function reset the specified converter ``\fIconv\fP''. -.LP -.sp -\fBRegister a converter\fP -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef XlcConv (*XlcOpenConverterProc)(\fIfrom_lcd\fP, \fIfrom_type\fP, \fIto_lcd\fP, \fIto_type\fP); - XLCd \fIfrom_lcd\fP; - char \fI*from_type\fP; - XLCd \fIto_lcd\fP; - char \fI*to_type\fP; -.De -.LP -.FD 0 -Bool _XlcSetConverter(\fIfrom_lcd\fP, \fIfrom\fP, \fIto_lcd\fP, \fIto\fP, \fIconverter\fP) -.br - XLCd \fIfrom_lcd\fP; -.br - char \fI*from\fP; -.br - XLCd \fIto_lcd\fP; -.br - char \fI*to\fP; -.br - XlcOpenConverterProc \fIconverter\fP; -.FN -.LP -The \fBXlcSetConverter\fP function registers a converter which convert -from ``\fIfrom_type\fP'' to ``\fIto_type\fP'' into the converter list -(in the specified XLCd). -.LP -.NH 1 -X Locale Database functions -.XS \*(SN X Locale Database functions -.XE -.LP -X Locale Database contains the subset of user's environment that -depends on language. The following APIs are provided for accessing -X Locale Database and other locale relative files. -.LP -For more detail about X Locale Database, please refer -X Locale Database Definition document. -.LP -.sp -\fBGet a resource from database\fP -.LP -.FD 0 -void _XlcGetResource(\fIlcd\fP, \fIcategory\fP, \fIclass\fP, \fIvalue\fP, \fIcount\fP) -.br - XLCd \fIlcd\fP; -.br - char \fI*category\fP; -.br - char \fI*class\fP; -.br - char \fI***value\fP; -.br - int \fI*count\fP; -.FN -.LP -The -.PN _XlcGetResource -function obtains a locale dependent data which is associated with the -locale of specified ``\fIlcd\fP''. -The locale data is provided by system locale or by X Locale Database -file, and what kind of data is available is implementation dependent. -.LP -The specified ``\fIcategory\fP'' and ``\fIclass\fP'' are used for -finding out the objective locale data. -.LP -The returned value is returned in value argument in string list form, -and the returned count shows the number of strings in the value. -.LP -The returned value is owned by locale method, and should not be modified -or freed by caller. -.LP -.sp -\fBGet a locale relative file name\fP -.LP -.FD 0 -char * _XlcFileName(\fIlcd\fP, \fIcategory\fP) -.br - XLCd \fIlcd\fP; -.br - char \fI*category\fP; -.FN -.LP -The -.PN _XlcFileName -functions returns a file name which is bound to the specified ``\fIlcd\fP'' -and ``\fIcategory\fP'', as a null-terminated string. If no file name can -be found, or there is no readable file for the found file name, -.PN _XlcFileName -returns NULL. The returned file name should be freed by caller. -.LP -The rule for searching a file name is implementation dependent. -In current implementation, -.PN _XlcFileName -uses ``{category}.dir'' file as mapping table, which has pairs of -strings, a full locale name and a corresponding file name. -.LP -.NH 1 -Utility Functions -.XS \*(SN Utility Functions -.XE -.LP -\fBCompare Latin-1 strings\fP -.LP -.FD 0 -int _XlcCompareISOLatin1(\fIstr1\fP, \fIstr2\fP) -.br - char \fI*str1\fP, \fI*str2\fP; -.FN -.FD 0 -int _XlcNCompareISOLatin1(\fIstr1\fP, \fIstr2\fP, \fIlen\fP) -.br - char \fI*str1\fP, \fI*str2\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _XlcCompareIsoLatin1 -function to compares two ISO-8859-1 strings. Bytes representing ASCII lower -case letters are converted to upper case before making the comparison. -The value returned is an integer less than, equal to, or greater than -zero, depending on whether ``\fIstr1\fP'' is lexicographicly less than, -equal to, or greater than ``\fIstr2\fP''. -.LP -The -.PN _XlcNCompareIsoLatin1 -function is identical to -.PN _XlcCompareISOLatin1, -except that at most ``\fIlen\fP'' bytes are compared. -.LP -.sp -\fBResource Utility\fP -.LP -.FD 0 -int XlcNumber(\fIarray\fP) - ArrayType \fIarray\fP; -.FN -.LP -Similar to XtNumber. -.LP -.FD 0 -void _XlcCopyFromArg(\fIsrc\fP, \fIdst\fP, \fIsize\fP) -.br - char \fI*src\fP; -.br - char \fI*dst\fP; -.br - int \fIsize\fP; -.FN -.FD 0 -void _XlcCopyToArg(\fIsrc\fP, \fIdst\fP, \fIsize\fP) -.br - char \fI*src\fP; -.br - char \fI**dst\fP; -.br - int \fIsize\fP; -.FN -.LP -Similar to -.PN _XtCopyFromArg -and -.PN _XtCopyToArg. -.LP -.FD 0 -void _XlcCountVaList(\fIvar\fP, \fIcount_ret\fP) -.br - va_list \fIvar\fP; -.br - int \fI*count_ret\fP; -.FN -.LP -Similar to -.PN _XtCountVaList. -.LP -.FD 0 -void _XlcVaToArgList(\fIvar\fP, \fIcount\fP, \fIargs_ret\fP) -.br - va_list \fIvar\fP; -.br - int \fIcount\fP; -.br - XlcArgList \fI*args_ret\fP; -.FN -.LP -Similar to -.PN _XtVaToArgList. -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef struct _XlcResource { - char *name; - XrmQuark xrm_name; - int size; - int offset; - unsigned long mask; -} XlcResource, *XlcResourceList; -.De -.LP -.TS -lw(.5i) lw(2i) lw(2i). -T{ -#define -T} T{ -XlcCreateMask -T} T{ -(1L<<0) -T} -T{ -#define -T} T{ -XlcDefaultMask -T} T{ -(1L<<1) -T} -T{ -#define -T} T{ -XlcGetMask -T} T{ -(1L<<2) -T} -T{ -#define -T} T{ -XlcSetMask -T} T{ -(1L<<3) -T} -T{ -#define -T} T{ -XlcIgnoreMask -T} T{ -(1L<<4) -T} -.TE -.LP -.FD 0 -void _XlcCompileResourceList(\fIresources\fP, \fInum_resources\fP) -.br - XlcResourceList \fIresources\fP; -.br - int \fInum_resources\fP; -.FN -.LP -Similar to -.PN _XtCompileResourceList. -.LP -.FD 0 -char * _XlcGetValues(\fIbase\fP, \fIresources\fP, \fInum_resources\fP, \fIargs\fP, \fInum_args\fP, \fImask\fP) -.br - XPointer \fIbase\fP; -.br - XlcResourceList \fIresources\fP; -.br - int \fInum_resources\fP; -.br - XlcArgList \fIargs\fP; -.br - int \fInum_args\fP; -.br - unsigned long \fImask\fP; -.FN -.LP -Similar to XtGetSubvalues. -.LP -.FD 0 -char * _XlcSetValues(\fIbase\fP, \fIresources\fP, \fInum_resources\fP, \fIargs\fP, \fInum_args\fP, \fImask\fP) -.br - XPointer \fIbase\fP; -.br - XlcResourceList \fIresources\fP; -.br - int \fInum_resources\fP; -.br - XlcArgList \fIargs\fP; -.br - int \fInum_args\fP; -.br - unsigned long \fImask\fP; -.FN -.LP -Similar to XtSetSubvalues. -.LP -.sp -\fBANSI C Compatible Functions\fP -.LP -The following are ANSI C/MSE Compatible Functions for non-ANSI C environment. -.LP -.FD 0 -int _Xmblen(\fIstr\fP, \fIlen\fP) -.br - char \fI*str\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xmblen -function returns the number of characters pointed to by ``\fIstr\fP''. -Only ``\fIlen\fP'' bytes in ``\fIstr\fP'' are used in determining the -character count returned. ``\fIStr\fP'' may point at characters from -any valid codeset in the current locale. -.LP -The call -.PN _Xmblen -is equivalent to -.RS -_Xmbtowc(_Xmbtowc((\fIwchar_t*\fP)NULL, \fIstr\fP, \fIlen\fP)) -.RE -.LP -.FD 0 -int _Xmbtowc(\fIwstr\fP, \fIstr\fP, \fIlen\fP) -.br - wchar_t \fI*wstr\fP; -.br - char \fI*str\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xmbtowc -function converts the character(s) pointed to by ``\fIstr\fP'' -to their wide character representation(s) pointed to by ``\fIwstr\fP''. -``\fILen\fP'' is the number of bytes in ``\fIstr\fP'' to be converted. -The return value is the number of characters converted. -.LP -The call -.PN _Xmbtowc -is equivalent to -.RS -_Xlcmbtowc((XLCd)NULL, \fIwstr\fP, \fIstr\fP, \fIlen\fP) -.RE -.LP -.FD 0 -int _Xlcmbtowc(\fIlcd\fP, \fIwstr\fP, \fIstr\fP, \fIlen\fP) -.br - XLCd \fIlcd\fP; -.br - wchar_t \fI*wstr\fP; -.br - char \fI*str\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xlcmbtowc -function is identical to -.PN _Xmbtowc, -except that it requires the ``\fIlcd\fP'' argument. If ``\fIlcd\fP'' -is (XLCd) NULL, -.PN _Xlcmbtowc, -calls -.PN _XlcCurrentLC -to determine the current locale. -.LP -.FD 0 -int _Xwctomb(\fIstr\fP, \fIwc\fP) -.br - char \fI*str\fP; -.br - wchar_t \fIwc\fP; -.FN -.LP -The -.PN _Xwctomb -function converts a single wide character pointed to by ``\fIwc\fP'' to -its multibyte representation pointed to by ``\fIstr\fP''. -On success, the return value is 1. -.LP -The call -.PN _Xwctomb -is equivalent to -.RS -_Xlcwctomb((XLCd)NULL, \fIstr\fP, \fIwstr\fP) -.RE -.LP -.FD 0 -int _Xlcwctomb(\fIlcd\fP, \fIstr\fP, \fIwc\fP) -.br - XLCd \fIlcd\fP; -.br - char \fI*str\fP; -.br - wchar_t \fIwc\fP; -.FN -.LP -The -.PN _Xlcwctomb -function is identical to _Xwctomb, except that it requires the -``\fIlcd\fP'' argument. If ``\fIlcd\fP'' is (XLCd) NULL, -.PN _Xlcwctomb, -calls -.PN _XlcCurrentLC -to determine the current locale. -.LP -.FD 0 -int _Xmbstowcs(\fIwstr\fP, \fIstr\fP, \fIlen\fP) -.br - wchar_t \fI*wstr\fP; -.br - char \fI*str\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xmbstowcs -function converts the NULL-terminated string pointed to by ``\fIstr\fP'' -to its wide character string representation pointed to by ``\fIwstr\fP''. -``\fILen\fP'' is the number of characters in ``\fIstr\fP'' to be converted. -.LP -The call -.PN _Xmbstowcs -is equivalent to -.RS -_Xlcmbstowcs((XLCd)NULL, \fIwstr\fP, \fIstr\fP, \fIlen\fP) -.RE -.LP -.FD 0 -int _Xlcmbstowcs(\fIlcd\fP, \fIwstr\fP, \fIstr\fP, \fIlen\fP) -.br - XLCd \fIlcd\fP; -.br - wchar_t \fI*wstr\fP; -.br - char \fI*str\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xlcmbstowcs -function is identical to _Xmbstowcs, except that it requires the -``\fIlcd\fP'' argument. If ``\fIlcd\fP'' is (XLCd) NULL, -.PN _Xlcmbstowcs, -calls -.PN _XlcCurrentLC -to determine the current locale. -.LP -.FD 0 -int _Xwcstombs(\fIstr\fP, \fIwstr\fP, \fIlen\fP) -.br - char \fI*str\fP; -.br - wchar_t \fI*wstr\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xwcstombs -function converts the (wchar_t) NULL terminated wide character string -pointed to by ``\fIwstr\fP'' to the NULL terminated multibyte string -pointed to by ``\fIstr\fP''. -.LP -The call -.PN _Xwcstombs -is equivalent to -.RS -_Xlcwcstombs((XLCd)NULL, \fIstr\fP, \fIwstr\fP, \fIlen\fP) -.RE -.LP -.FD 0 -int _Xlcwcstombs(\fIlcd\fP, \fIstr\fP, \fIwstr\fP, \fIlen\fP) -.br - XLCd \fIlcd\fP; -.br - char \fI*str\fP; -.br - wchar_t \fI*wstr\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xlcwcstombs -function is identical to _Xwcstombs, except that it requires the -``\fIlcd\fP'' argument. If ``\fIlcd\fP'' is (XLCd) NULL, -.PN _Xlcwcstombs, -calls -.PN _XlcCurrentLC -to determine the current locale. -.LP -.FD 0 -int _Xwcslen(\fIwstr\fP) -.br - wchar_t \fI*wstr\fP; -.FN -.LP -The -.PN _Xwcslen -function returns the count of wide characters in the (wchar_t) NULL -terminated wide character string pointed to by ``\fIwstr\fP''. -.LP -.FD 0 -wchar_t * _Xwcscpy(\fIwstr1\fP, \fIwstr2\fP) -.br - wchar_t \fI*wstr1\fP, \fI*wstr2\fP; -.FN -.FD 0 -wchar_t * _Xwcsncpy(\fIwstr1\fP, \fIwstr2\fP, \fIlen\fP) -.br - wchar_t \fI*wstr1\fP, \fI*wstr2\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xwcscpy -function copies the (wchar_t) NULL terminated wide character string -pointed to by ``\fIwstr2\fP'' to the object pointed at by ``\fIwstr1\fP''. -``\fIWstr1\fP'' is (wchar_t) NULL terminated. The return value is a -pointer to ``\fIwstr1\fP''. -.LP -The -.PN _Xwcsncpy -function is identical to -.PN _Xwcscpy, -except that it copies ``\fIlen\fP'' wide characters from the object -pointed to by ``\fIwstr2\fP'' to the object pointed to ``\fIwstr1\fP''. -.LP -.FD 0 -int _Xwcscmp(\fIwstr1\fP, \fIwstr2\fP) -.br - wchar_t \fI*wstr1\fP, \fI*wstr2\fP; -.FN -.FD 0 -int _Xwcsncmp(\fIwstr1\fP, \fIwstr2\fP, \fIlen\fP) -.br - wchar_t \fI*wstr1\fP, \fI*wstr2\fP; -.br - int \fIlen\fP; -.FN -.LP -The -.PN _Xwcscmp -function compares two (wchar_t) NULL terminated wide character strings. -The value returned is an integer less than, equal to, or greater than zero, -depending on whether ``\fIwstr1\fP'' is lexicographicly less then, equal to, -or greater than ``\fIstr2\fP''. -.LP -The -.PN _Xwcsncmp -function is identical to -.PN _XlcCompareISOLatin1, -except that at most ``\fIlen\fP'' wide characters are compared. -.sp -.\" -------------------------------------------------------------------- -.\" .LP -.\" \fBLocale Method Internal Functions\fP -.\" .LP -.\" .FD 0 -.\" XlcCharSet _XlcCreateDefaultCharSet(\fIname\fP, \fIct_sequence\fP) -.\" .br -.\" char \fI*name\fP; -.\" .br -.\" char \fI*ct_sequence\fP; -.\" .FN -.\" .FD 0 -.\" Bool _XlcParseCharSet(\fIcharset\fP) -.\" .br -.\" XlcCharSet \fIcharset\fP; -.\" .FN -.\" .FD 0 -.\" void _XlcGetLocaleDataBase(\fIlcd\fP, \fIcategory\fP, \fIname\fP, \fIvalue\fP, \fIcount\fP) -.\" .br -.\" XLCd \fIlcd\fP; -.\" .br -.\" char \fI*category\fP; -.\" .br -.\" char \fI*name\fP; -.\" .br -.\" char \fI***value\fP; -.\" .br -.\" int \fI*count\fP; -.\" .FN -.\" .FD 0 -.\" void _XlcDestroyLocaleDataBase(\fIlcd\fP) -.\" .br -.\" XLCd \fIlcd\fP; -.\" .FN -.\" .FD 0 -.\" XPointer _XlcCreateLocaleDataBase(\fIlcd\fP) -.\" .br -.\" XLCd \fIlcd\fP; -.\" .FN -.\" .LP -.\" .sp -.\" \fBObtain an locale database path\fP -.\" .LP -.\" .FD 0 -.\" int _XlcResolveI18NPath(\fIdir\fP) -.\" .br -.\" char \fI*dir\fP; -.\" .FN -.\" .LP -.\" The -.\" .PN _XlcResolveI18NPath -.\" function returns path name list that is related to X Locale Database. -.\" The obtained path is stored into the array which is pointed by -.\" specified ``\fIdir\fP''. The path consists of directory paths which -.\" are separated with colon. -.\" If the environment variable XLOCALEDIR is specified, the path -.\" contains its contents. -.\" .LP -.\" The default path of X Locale Database is implementation dependent. -.\" In current implementation, it's determined in build time. -.\" .LP -.\" .PN _XlcResolveI18NPath -.\" does not check overflow of the array to which the ``\fIdir\fP'' -.\" parameter points. Caller should provide enough buffer to store this -.\" string. -.\" .LP -.\" .sp -.\" \fBObtain a full locale name\fP -.\" .LP -.\" .FD 0 -.\" int _XlcResolveLocaleName(\fIlc_name\fP, \fIfull_name\fP, \fIlanguage\fP, \fIterritory\fP, \fIcodeset\fP) -.\" .br -.\" char \fI*lc_name\fP; -.\" .br -.\" char \fI*full_name\fP; -.\" .br -.\" char \fI*language\fP; -.\" .br -.\" char \fI*territory\fP; -.\" .br -.\" char \fI*codeset\fP; -.\" .FN -.\" .LP -.\" The -.\" .PN _XlcResolveLocaleName -.\" function returns a full locale name. -.\" The obtained full locale name is stored into the array which is -.\" pointed by specified ``\fIfull_name\fP''. -.\" The language, territory and codeset part of the full locale name -.\" are copied to the return arguments, ``\fIlanguage\fP'', -.\" ``\fIterritory\fP'' and ``\fIcodeset\fP'', respectively. -.\" NULL can be specified for these arguments. -.\" .LP -.\" The rule for mapping from locale name to full locale name is -.\" implementation dependent. -.\" .LP -.\" .PN _XlcResolveLocaleName -.\" does not check overflow of the array to which -.\" ``\fIfull_name\fP'', ``\fIlanguage\fP'', ``\fIterritory\fP'' and -.\" ``\fIcodeset\fP'' parameter point. -.\" Caller should provide enough buffer to store those string. -.\" .LP -.\" In current implementation, -.\" .PN _XlcResolveLocaleName -.\" uses locale.alias file as mapping table, which has pairs of strings, -.\" a locale name and a full locale name. -.\" .LP -.\" .FD 0 -.\" int _XlcResolveDBName(\fIlc_name\fP, \fIfile_name\fP) -.\" .br -.\" char \fI*lc_name\fP; -.\" .br -.\" char \fI*file_name\fP; -.\" .FN -.\" .FD 0 -.\" XLCd _XlcCreateLC(\fIname\fP, \fImethods\fP) -.\" .br -.\" char \fI*name\fP; -.\" .br -.\" XLCdMethods \fImethods\fP; -.\" .FN -.\" .FD 0 -.\" void _XlcDestroyLC(\fIlcd\fP) -.\" .br -.\" XLCd \fIlcd\fP; -.\" .FN -.\" .LP -.\" - diff --git a/libX11/specs/i18n/LocaleDB.ms b/libX11/specs/i18n/LocaleDB.ms deleted file mode 100644 index 4592879d1..000000000 --- a/libX11/specs/i18n/LocaleDB.ms +++ /dev/null @@ -1,499 +0,0 @@ -.\" To print this out, type tbl macros.t ThisFile | troff -ms -.EH '''' -.OH '''' -.EF '''' -.OF '''' -.ps 11 -.nr PS 11 -\& -.TL -\s+3\fBX Locale Database Definition\fP\s-3 -.sp 2 -.AU -Yoshio Horiuchi -.AI -IBM Japan -.LP -.bp -.br -\& -.ps 9 -.nr PS 9 -.sp 2 -.LP -Copyright \(co IBM Corporation 1994 -.LP -All Rights Reserved -.LP -License to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of IBM not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. -.LP -IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND -NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL -IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. -.sp 5 -Copyright \(co 1994 X Consortium -.LP -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: -.LP -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -.LP -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. -.LP -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. -.sp 3 -\fIX Window System\fP is a trademark of The Open Group. -.LP -.bp 1 -.ps 11 -.nr PS 11 -.EH '\fBX Locale Database Definition\fP''\fB\*(xV\fP' -.OH '\fBX Locale Database Definition\fP''\fB\*(xV\fP' -.EF ''\fB % \fP'' -.OF ''\fB % \fP'' -.NH 1 -General -.XS -\*(SN General -.XE -.LP -An X Locale Database contains the subset of a user's environment that -depends on language, in X Window System. It is made up from one or more -categories. Each category consists of some classes and sub-classes. -.LP -It is provided as a plain ASCII text file, so a user can change its -contents easily. It allows a user to customize the behavior of -internationalized portion of Xlib without changing Xlib itself. -.LP -This document describes; -.RS -.IP -Database Format Definition -.IP -Contents of Database in sample implementation -.RE -.LP -Since it is hard to define the set of required information for all -platforms, only the flexible database format is defined. -The available entries in database are implementation dependent. -.LP -.NH 1 -Database Format Definition -.XS -\*(SN Database Format Definition -.XE -.LP -The X Locale Database contains one or more category definitions. -This section describes the format of each category definition. -.LP -The category definition consists of one or more class definitions. -Each class definition has a pair of class name and class value, or -has several subclasses which are enclosed by the left brace ({) and -the right brace (}). -.LP -Comments can be placed by using the number sign character (#). -Putting the number sign character on the top of the line indicates -that the entire line is comment. Also, putting any whitespace character -followed by the number sign character indicates that a part of the line -(from the number sign to the end of the line) is comment. -A line can be continued by placing backslash (\\) character as the -last character on the line; this continuation character will be -discarded from the input. Comment lines cannot be continued on -a subsequent line using an escaped new line character. -.LP -X Locale Database only accepts XPCS, the X Portable Character Set. -The reserved symbols are; the quotation mark("), the number sign (#), -the semicolon(;), the backslash(\\), the left brace({) and -the right brace(}). -.LP -The format of category definition is; -.RS -.TS -tab(@); -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l l l -l r l -l r l -l l l. -CategoryDefinition@::=@CategoryHeader CategorySpec CategoryTrailer -CategoryHeader@::=@CategoryName NL -CategorySpec@::=@{ ClassSpec } -CategoryTrailer@::=@"END" Delimiter CategoryName NL -CategoryName@::=@String -ClassSpec@::=@ClassName Delimiter ClassValue NL -ClassName@::=@String -ClassValue@::=@ValueList | "{" NL { ClassSpec } "}" -ValueList@::=@Value | Value ";" ValueList -Value@::=@ValuePiece | ValuePiece Value -ValuePiece@::=@String | QuotedString | NumericString -String@::=@Char { Char } -QuotedString@::=@""" QuotedChar { QuotedChar } """ -NumericString@::=@"\\\\o" OctDigit { OctDigit } -@|@"\\\\d" DecDigit { DecDigit } -@|@"\\\\x" HexDigit { HexDigit } -Char@::=@ -QuotedChar@::=@ -OctDigit@::=@ -DecDigit@::=@ -HexDigit@::=@ -Delimiter@::=@ Space { Space } -Space@::=@ | -NL@::=@ -.TE -.RE -.LP -Elements separated by vertical bar (|) are alternatives. Curly -braces ({...}) indicate zero or more repetitions of the enclosed -elements. Square brackets ([...]) indicate that the enclosed element -is optional. Quotes ("...") are used around literal characters. -.LP -The backslash, which is not the top character of the NumericString, is -recognized as an escape character, so that the next one character is -treated as a literal character. For example, the two-character -sequence, ``\\"''(the backslash followed by the quotation mark) is -recognized and replaced with a quotation mark character. -Any whitespace character, that is not the Delimiter, unquoted and -unescaped, is ignored. -.LP -.NH 1 -Contents of Database -.XS -\*(SN Contents of Database -.XE -.LP -The available categories and classes depend on implementation, because -different platform will require different information set. -For example, some platform have system locale but some platform don't. -Furthermore, there might be a difference in functionality even if the -platform has system locale. -.LP -In current sample implementation, categories listed below are available. -.RS -.TS -tab(:); -l l. -XLC_FONTSET:XFontSet relative information -XLC_XLOCALE:Character classification and conversion information -.TE -.RE -.LP -.NH 1 -XLC_FONTSET Category -.XS -\*(SN XLC_FONTSET Category -.XE -.LP -The XLC_FONTSET category defines the XFontSet relative information. -It contains the CHARSET_REGISTRY-CHARSET_ENCODING name and character -mapping side (GL, GR, etc), and is used in Output Method (OM). -.RS -.TS H -tab(:); -lw(1.5i) l l. -_ -.sp 6p -.B -class:super class:description -.sp 6p -_ -.sp 6p -.TH -.R -fsN::Nth fontset (N=0,1,2, ...) -.sp -charset:fsN:list of encoding name -font:fsN:list of font encoding name -.sp 6p -_ -.TE -.RE -.LP -.IP "fsN" -.br -Includes an encoding information for Nth charset, where N is -the index number (0,1,2,...). If there are 4 charsets available -in current locale, 4 fontsets, fs0, fs1, fs2 and fs3, should be -defined. -This class has two subclasses, `charset' and `font'. -.IP "charset" -Specifies an encoding information to be used internally in Xlib -for this fontset. The format of value is; -.RS -.TS -tab(;); -l l l. -EncodingInfo;::=;EncodingName [ ":" EncodingSide ] -EncodingName;::=;CHARSET_REGISTRY-CHARSET_ENCODING -EncodingSide;::=;"GL" | "GR" -.TE -.RE -For detail definition of CHARSET_REGISTRY-CHARSET_ENCODING, refer -"X Logical Font Descriptions" document. -.IP -example: -.br - ISO8859-1:GL -.IP "font" -.br -Specifies a list of encoding information which is used for searching -appropriate font for this fontset. The left most entry has highest -priority. -.LP -.NH 1 -XLC_XLOCALE Category -.XS -\*(SN XLC_XLOCALE Category -.XE -.LP -The XLC_XLOCALE category defines character classification, conversion -and other character attributes. -.RS -.TS H -tab(:); -lw(1.5i) l l. -_ -.sp 6p -.B -class:super class:description -.sp 6p -_ -.sp 6p -.TH -.R -encoding_name::codeset name -mb_cur_max::MB_CUR_MAX -state_depend_encoding::state dependent or not -wc_encoding_mask::for parsing wc string -wc_shift_bits::for conversion between wc and mb -csN::Nth charset (N=0,1,2,...) -.sp -side:csN:mapping side (GL, etc) -length:csN:length of a character -mb_encoding:csN:for parsing mb string -wc_encoding:csN:for parsing wc string -ct_encoding:csN:list of encoding name for ct -.sp 6p -_ -.TE -.RE -.LP -.IP "encoding_name" -Specifies a codeset name of current locale. -.IP "mb_cur_max" -Specifies a maximum allowable number of bytes in a multi-byte character. -It is corresponding to MB_CUR_MAX of "ISO/IEC 9899:1990 C Language Standard". -.IP "state_depend_encoding" -Indicates a current locale is state dependent. The value should be -specified "True" or "False". -.IP "wc_encoding_mask" -Specifies a bit-mask for parsing wide-char string. Each wide character is -applied bit-and operation with this bit-mask, then is classified into -the unique charset, by using `wc_encoding'. -.IP "wc_shift_bits" -Specifies a number of bit to be shifted for converting from a multi-byte -character to a wide character, and vice-versa. -.IP "csN" -.br -Includes a character set information for Nth charset, where N is the -index number (0,1,2,...). If there are 4 charsets available in current -locale, cs0, cs1, cs2 and cs3 should be defined. This class has five -subclasses, `side', `length', `mb_encoding' `wc_encoding' and `ct_encoding'. -.IP "side" -.br -Specifies a mapping side of this charset. The format of this value is; -.RS -.TS -tab(@); -l l l. -Side@::=@EncodingSide [``:Default''] -.TE -.RE -The suffix ":Default" can be specified. It indicates that a character -belongs to the specified side is mapped to this charset in initial state. -.IP "length" -.br -Specifies a number of bytes of a multi-byte character of this charset. -It should not contain the length of any single-shift sequence. -.IP "mb_encoding" -Specifies a list of shift sequence for parsing multi-byte string. -The format of this value is; -.RS -.TS -tab(@); -l l l -l r l -l l l -l l l -l l l -l l l -c l s -c l s. -MBEncoding@::=@ShiftType ShiftSequence -@|@ShiftType ShiftSequence ";" MBEncoding -ShiftType@::=@"" | "" | "" -ShiftSequence@::=@SequenceValue | SequenceValue ShiftSequence -SequenceValue@::=@NumericString -.sp -shift types: -@Indicates single shift sequence -@Indicates locking shift left sequence -@Indicates locking shift right sequence -.TE -.RE -example: -.br - \\x1b \\x28 \\x4a; \\x1b \\x28 \\x42 -.LP -.IP "wc_encoding" -Specifies an integer value for parsing wide-char string. -It is used to determine the charset for each wide character, after -applying bit-and operation using `wc_encoding_mask'. -This value should be unique in all csN classes. -.IP "ct_encoding" -Specifies a list of encoding information that can be used for Compound -Text. -.LP -.NH 1 -Sample of X Locale Database -.XS -\*(SN Sample of X Locale Database -.XE -.LP -The following is sample X Locale Database file. -.LP -.sp -.RS -.nf -# XLocale Database Sample for ja_JP.euc -# - -# -# XLC_FONTSET category -# -XLC_FONTSET -# fs0 class (7 bit ASCII) -fs0 { - charset ISO8859-1:GL - font ISO8859-1:GL; JISX0201.1976-0:GL -} -# fs1 class (Kanji) -fs1 { - charset JISX0208.1983-0:GL - font JISX0208.1983-0:GL -} -# fs2 class (Half Kana) -fs2 { - charset JISX0201.1976-0:GR - font JISX0201.1976-0:GR -} -# fs3 class (User Defined Character) -# fs3 { -# charset JISX0212.1990-0:GL -# font JISX0212.1990-0:GL -# } -END XLC_FONTSET - -# -# XLC_XLOCALE category -# -XLC_XLOCALE - -encoding_name ja.euc -mb_cur_max 3 -state_depend_encoding False - -wc_encoding_mask \\x00008080 -wc_shift_bits 8 - -# cs0 class -cs0 { - side GL:Default - length 1 - wc_encoding \\x00000000 - ct_encoding ISO8859-1:GL; JISX0201.1976-0:GL -} -# cs1 class -cs1 { - side GR:Default - length 2 - - wc_encoding \\x00008080 - - ct_encoding JISX0208.1983-0:GL; JISX0208.1983-0:GR;\\ - JISX0208.1983-1:GL; JISX0208.1983-1:GR -} - -# cs2 class -cs2 { - side GR - length 1 - mb_encoding \\x8e - - wc_encoding \\x00000080 - - ct_encoding JISX0201.1976-0:GR -} - -# cs3 class -# cs3 { -# side GL -# length 2 -# mb_encoding \\x8f -# #if HasWChar32 -# wc_encoding \\x20000000 -# #else -# wc_encoding \\x00008000 -# #endif -# ct_encoding JISX0212.1990-0:GL; JISX0212.1990-0:GR -# } - -END XLC_XLOCALE -.fi -.RE -.LP -.NH 1 -Reference -.XS -\*(SN Reference -.XE -.LP -.XP -[1] \fIISO/IEC 9899:1990 C Language Standard\fP -.XP -[2] \fIX Logical Font Descriptions\fP -.LP diff --git a/libX11/specs/i18n/Makefile.am b/libX11/specs/i18n/Makefile.am index 9f5d51e9a..1fd341f21 100644 --- a/libX11/specs/i18n/Makefile.am +++ b/libX11/specs/i18n/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -21,8 +21,4 @@ # DEALINGS IN THE SOFTWARE. # -# Based on xc/doc/specs/i18n/Makefile from X11R6.9 - -doc_sources = Framework.ms LocaleDB.ms Trans.ms - -include $(top_srcdir)/specs/troffrules.in +SUBDIRS=framework localedb trans diff --git a/libX11/specs/i18n/Trans.ms b/libX11/specs/i18n/Trans.ms deleted file mode 100644 index 1216ef254..000000000 --- a/libX11/specs/i18n/Trans.ms +++ /dev/null @@ -1,1146 +0,0 @@ -.\" To print this out, type tbl macros.t This File | troff -ms -.EH '''' -.OH '''' -.EF '''' -.OF '''' -.ps 11 -.nr PS 11 -.\" .nr PD 1v -.\" .nr DD 1v -\& -.sp 8 -.TL -\s+3\fBThe XIM Transport Specification\s-3\fP -.sp -.sp -\fBRevision 0.1\fP -.sp -\fBX Version 11, Release 7\fP -.sp -\fB\*(xV\fP -.sp 3 -.AU -Takashi Fujiwara -.AI -FUJITSU LIMITED -.sp 3 -.AB -.LP -This specification describes the transport layer interfaces between -Xlib and IM Server, which makes various channels usable such as X -protocol or, TCP/IP, DECnet and etc. -.AE -.ce 0 -.br -.LP -.bp -\& -.ps 9 -.nr PS 9 -.sp 8 -.LP -Copyright \(co 1994 by FUJITSU LIMITED -.LP -Permission to use, copy, modify, and distribute this documentation -for any purpose and without fee is hereby granted, provided -that the above copyright notice and this permission -notice appear in all copies. -Fujitsu makes no representations about the suitability -for any purpose of the information in this document. -This documentation is provided as is without express or implied warranty. -.sp 5 -Copyright \(co 1994 X Consortium -.LP -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: -.LP -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -.LP -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. -.LP -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. -.sp 3 -\fIX Window System\fP is a trademark of The Open Group. -.ps 11 -.nr PS 11 -.bp 1 -.EH '\fBXIM Transport Specification\fP''\fB\*(xV\fP' -.OH '\fBXIM Transport Specification\fP''\fB\*(xV\fP' -.EF ''\fB % \fP'' -.OF ''\fB % \fP'' -.NH 1 -Introduction -.XS -\*(SN Introduction -.XE -.LP -The Xlib XIM implementation is layered into three functions, a protocol -layer, an interface layer and a transport layer. The purpose of this -layering is to make the protocol independent of transport implementation. -Each function of these layers are: -.RS 3 -.IP "\fIThe protocol layer\fP" -.br -implements overall function of XIM and calls the interface layer -functions when it needs to communicate to IM Server. -.IP "\fIThe interface layer\fP" -.br -separates the implementation of the transport layer from the protocol -layer, in other words, it provides implementation independent hook for -the transport layer functions. -.IP "\fIThe transport layer\fP" -.br -handles actual data communication with IM Server. It is done by a set -of several functions named transporters. -.RE -.LP -This specification describes the interface layer and the transport -layer, which makes various communication channels usable such as -X protocol or, TCP/IP, DECnet, STREAM, etc., and provides -the information needed for adding another new transport layer. -In addition, sample implementations for the transporter using the -X connection is described in section 4. -.NH 1 -Initialization -.XS -\*(SN Initialization -.XE -.NH 2 -Registering structure to initialize -.XS -\*(SN Registering structure to initialize -.XE -.LP -The structure typed as TransportSW contains the list of the transport -layer the specific implementations supports. -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -typedef struct { -.br - char *transport_name; -.br - Bool (*config); -} TransportSW; -.De -.LP -.IP "\fItransport_name\fP" 15 -name of transport(*1) -.FS -(*1) Refer to "The Input Method Protocol: Appendix B" -.FE -.IP "\fIconfig\fP" 15 -initial configuration function -.LP -A sample entry for the Xlib supporting transporters is shown below: -.LP -.Ds 0 -.TA .5i 2.5i -.ta .5i 2.5i -TransportSW _XimTransportRec[] = { -.sp 3p -/* char \fI*: -\ * transport_name\fP, Bool \fI(*config)()\fP -\ */ - ``X'', _XimXConf, - ``tcp'', _XimTransConf, - ``local'', _XimTransConf, - ``decnet'', _XimTransConf, - ``streams'', _XimTransConf, - (char *)NULL, (Bool (*)())NULL, -}; -.De -.LP -.NH 2 -Initialization function -.XS -\*(SN Initialization function -.XE -.LP -The following function will be called once when Xlib configures the -transporter functions. -.sp 6p -.FD 0 -Bool (*config)(\fIim\fP, \fItransport_data\fP) -.br - XIM \fIim\fP; -.br - char \fI*transport_data\fP; -.br -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fItransport_data\fP 1i -Specifies the data specific to the transporter, in IM Server address. (*1) -.FS -(*1) Refer to "The Input Method Protocol: Appendix B" -.FE -.sp 6p -.LP -This function must setup the transporter function pointers. -.LP -The actual \fIconfig\fP function will be chosen by IM Server at the -pre-connection time, matching by the \fItransport_name\fP specified -in the \fB_XimTransportRec\fP array; The specific members of XimProto -structure listed below must be initialized so that point they -appropriate transporter functions. -.LP -If the specified transporter has been configured successfully, this -function returns True. There is no Alternative Entry for config -function itself. -.LP -The structure XimProto contains the following function pointers: -.DS -.TA .5i 2.5i -.ta .5i 2.5i -Bool (*connect)(); /* Open connection */ -Bool (*shutdown)(); /* Close connection */ -Bool (*write)(); /* Write data */ -Bool (*read)(); /* Read data */ -Bool (*flush)(); /* Flush data buffer */ -Bool (*register_dispatcher)(); /* Register asynchronous data handler */ -Bool (*call_dispatcher)(); /* Call dispatcher */ -.DE -These functions are called when Xlib needs to communicate the -IM Server. These functions must process the appropriate procedure -described below. -.LP -.NH 1 -The interface/transport layer functions -.XS -\*(SN The interface/transport layer functions -.XE -.LP -Following functions are used for the transport interface. -.LP -.ce -Table 3-1; The Transport Layer Functions. -.SM -.TS -tab(:) center box; -cw(4c) | cw(4c) | c -c | c | c -l | l | c. -.B -Alternative Entry:XimProto member:Section -(Interface Layer):(Transport Layer):\^ -= -.R -\fB_XimConnect\fP:connect:3.1 -_ -\fB_XimShutdown\fP:shutdown:3.2 -_ -\fB_XimWrite\fP:write:3.3 -_ -\fB_XimRead\fP:read:3.4 -_ -\fB_XimFlush\fP:flush:3.5 -_ -\fB_XimRegisterDispatcher\fP:register_dispatcher:3.6 -_ -\fB_XimCallDispatcher\fP:call_dispatcher:3.7 -.TE -.NL -.LP -The Protocol layer calls the above functions using the Alternative -Entry in the left column. The transport implementation defines -XimProto member function in the right column. The Alternative Entry is -provided so as to make easier to implement the Protocol Layer. -.LP -.NH 2 -Opening connection -.XS -\*(SN Opening connection -.XE -.LP -When \fBXOpenIM\fP is called, the following function is called to connect -with the IM Server. -.sp 6p -.FD 0 -Bool (*connect)(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.sp 6p -.LP -This function must establishes the connection to the IM Server. If the -connection is established successfully, this function returns True. -The Alternative Entry for this function is: -.sp 6p -.FD 0 -Bool _XimConnect(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.LP -.NH 2 -Closing connection -.XS -\*(SN Closing connection -.XE -.LP -When \fBXCloseIM\fP is called, the following function is called to -disconnect the connection with the IM Server. The Alternative Entry -for this function is: -.sp 6p -.FD 0 -Bool (*shutdown)(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.sp 6p -.LP -This function must close connection with the IM Server. If the -connection is closed successfully, this function returns True. The -Alternative Entry for this function is: -.sp 6p -.FD 0 -Bool _XimShutdown(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP -Specifies XIM structure address. -.LP -.NH 2 -Writing data -.XS -\*(SN Writing data -.XE -.LP -The following function is called, when Xlib needs to write data to the -IM Server. -.sp 6p -.FD 0 -Bool (*write)(\fIim\fP, \fIlen\fP, \fIdata\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIdata\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIlen\fP 1i -Specifies the length of writing data. -.IP \fIdata\fP 1i -Specifies the writing data. -.sp 6p -.LP -This function writes the \fIdata\fP to the IM Server, regardless -of the contents. The number of bytes is passed to \fIlen\fP. The -writing data is passed to \fIdata\fP. If data is sent successfully, -the function returns True. Refer to "The Input Method Protocol" for -the contents of the writing data. The Alternative Entry for this -function is: -.sp 6p -.FD 0 -Bool _XimWrite(\fIim\fP, \fIlen\fP, \fIdata\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIdata\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIlen\fP 1i -Specifies the length of writing data. -.IP \fIdata\fP 1i -Specifies the writing data. -.LP -.NH 2 -Reading data -.XS -\*(SN Reading data -.XE -.LP -The following function is called when Xlib waits for response from IM -server synchronously. -.sp 6p -.FD 0 -Bool (*read)(\fIim\fP, \fIread_buf\fP, \fIbuf_len\fP, \fIret_len\fP) -.br - XIM \fIim\fP; -.br - XPointer \fIread_buf\fP; -.br - int \fIbuf_len\fP; -.br - int \fI*ret_len\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIread_buf\fP 1i -Specifies the buffer to store data. -.IP \fIbuf_len\fP 1i -Specifies the size of the \fIbuffer\fP -.IP \fIret_len\fP -Specifies the length of stored data. -.sp 6p -.LP -This function stores the read data in \fIread_buf\fP, which size is -specified as \fIbuf_len\fP. The size of data is set to \fIret_len\fP. -This function return True, if the data is read normally or reading -data is completed. -.LP -The Alternative Entry for this function is: -.sp 6p -.FD 0 -Bool _XimRead(\fIim\fP, \fIret_len\fP, \fIbuf\fP, \fIbuf_len\fP, \fIpredicate\fP, \fIpredicate_arg\fP) -.br - XIM \fIim\fP; -.br - INT16 \fI*ret_len\fP; -.br - XPointer \fIbuf\fP; -.br - int \fIbuf_len\fP; -.br - Bool \fI(*predicate)()\fP; -.br - XPointer \fIpredicate_arg\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIret_len\fP 1i -Specifies the size of the \fIdata\fP buffer. -.IP \fIbuf\fP 1i -Specifies the buffer to store data. -.IP \fIbuf_len\fP 1i -Specifies the length of \fIbuffer\fP. -.IP \fIpredicate\fP 1i -Specifies the predicate for the XIM data. -.IP \fIpredicate_arg\fP 1i -Specifies the predicate specific data. -.sp 6p -.LP -The predicate procedure indicates whether the \fIdata\fP is for the -XIM or not. \fIlen\fP -This function stores the read data in \fIbuf\fP, which size is specified -as \fIbuf_len\fP. The size of data is set to \fIret_len\fP. -If \fIpreedicate()\fP returns True, this function returns True. -If not, it calls the registered callback function. -.LP -The procedure and its arguments are: -.LP -.sp 6p -.FD 0 -Bool (*predicate)(\fIim\fP, \fIlen\fP, \fIdata\fP, \fIpredicate_arg\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIdata\fP; -.br - XPointer \fIpredicate_arg\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIlen\fP 1i -Specifies the size of the \fIdata\fP buffer. -.IP \fIdata\fP 1i -Specifies the buffer to store data. -.IP \fIpredicate_arg\fP 1i -Specifies the predicate specific data. -.LP -.NH 2 -Flushing buffer -.XS -\*(SN Flushing buffer -.XE -.LP -The following function is called when Xlib needs to flush the data. -.sp 6p -.FD 0 -void (*flush)(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.sp 6p -.LP -This function must flush the data stored in internal buffer on the -transport layer. If data transfer is completed, the function returns -True. The Alternative Entry for this function is: -.sp 6p -.FD 0 -void _XimFlush(\fIim\fP) -.br - XIM \fIim\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.LP -.NH 2 -Registering asynchronous data handler -.XS -\*(SN Registering asynchronous data handler -.XE -.LP -Xlib needs to handle asynchronous response from IM Server. This is -because some of the XIM data occur asynchronously to X events. -.LP -Those data will be handled in the \fIFilter\fP, and the \fIFilter\fP -will call asynchronous data handler in the protocol layer. Then it -calls dispatchers in the transport layer. The dispatchers are -implemented by the protocol layer. This function must store the -information and prepare for later call of the dispatchers using -\fB_XimCallDispatcher\fP. -.LP -When multiple dispatchers are registered, they will be called -sequentially in order of registration, on arrival of asynchronous -data. The register_dispatcher is declared as following: -.sp 6p -.FD 0 -Bool (*register_dispatcher)(\fIim\fP, \fIdispatcher\fP, \fIcall_data\fP) -.br - XIM \fIim\fP; -.br - Bool \fI(*dispatcher)()\fP; -.br - XPointer \fIcall_data\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIdispatcher\fP 1i -Specifies the dispatcher function to register. -.IP \fIcall_data\fP 1i -Specifies a parameter for the \fIdispatcher\fP. -.LP -The dispatcher is a function of the following type: -.sp 6p -.FD 0 -Bool (*dispatcher)(\fIim\fP, \fIlen\fP, \fIdata\fP, \fIcall_data\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIdata\fP; -.br - XPointer \fIcall_data\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIlen\fP 1i -Specifies the size of the \fIdata\fP buffer. -.IP \fIdata\fP 1i -Specifies the buffer to store data. -.IP \fIcall_data\fP 1i -Specifies a parameter passed to the register_dispatcher. -.sp 6p -.LP -The dispatcher is provided by the protocol layer. They are called once -for every asynchronous data, in order of registration. If the data is -used, it must return True. otherwise, it must return False. -.LP -If the dispatcher function returns True, the Transport Layer assume -that the data has been processed by the upper layer. The Alternative -Entry for this function is: -.sp 6p -.FD 0 -Bool _XimRegisterDispatcher(\fIim\fP, \fIdispatcher\fP, \fIcall_data\fP) -.br - XIM \fIim\fP; -.br - Bool \fI(*dispatcher)()\fP; -.br - XPointer \fIcall_data\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIdispatcher\fP 1i -Specifies the dispatcher function to register. -.IP \fIcall_data\fP 1i -Specifies a parameter for the \fIdispatcher\fP. -.LP -.NH 2 -Calling dispatcher -.XS -\*(SN Calling dispatcher -.XE -.LP -The following function is used to call the registered dispatcher -function, when the asynchronous response from IM Server has arrived. -.sp 6p -.FD 0 -Bool (*call_dispatcher)(\fIim\fP, \fIlen\fP, \fIdata\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIdata\fP; -.FN -.IP \fIim\fP 1i -Specifies XIM structure address. -.IP \fIlen\fP 1i -Specifies the size of \fIdata\fP buffer. -.IP \fIdata\fP 1i -Specifies the buffer to store data. -.LP -The call_dispatcher must call the dispatcher function, in order of -their registration. \fIlen\fP and \fIdata\fP are the data passed to -register_dispatcher. -.LP -The return values are checked at each invocation, and if it finds -True, it immediately return with true for its return value. -.LP -It is depend on the upper layer whether the read data is XIM -Protocol packet unit or not. -The Alternative Entry for this function is: -.sp 6p -.FD 0 -Bool _XimCallDispatcher(\fIim\fP, \fIlen\fP, \fIdata\fP) -.br - XIM \fIim\fP; -.br - INT16 \fIlen\fP; -.br - XPointer \fIcall_data\fP; -.FN -.LP -.bp -.NH 1 -Sample implementations for the Transport Layer -.XS -\*(SN Sample implementations for the Transport Layer -.XE -.LP -Sample implementations for the transporter using the X connection is -described here. -.LP -.NH 2 -X Transport -.XS -\*(SN X Transport -.XE -.LP -At the beginning of the X Transport connection for the XIM transport -mechanism, two different windows must be created either in an Xlib XIM -or in an IM Server, with which the Xlib and the IM Server exchange the -XIM transports by using the ClientMessage events and Window Properties. -In the following, the window created by the Xlib is referred as the -"client communication window", and on the other hand, the window created -by the IM Server is referred as the "IMS communication window". -.LP -.NH 3 -Connection -.XS -\*(SN X Connection -.XE -.LP -In order to establish a connection, a communication window is created. -A ClientMessage in the following event's format is sent to the owner -window of XIM_SERVER selection, which the IM Server has created. -.LP -Refer to "The Input Method Protocol" for the XIM_SERVER atom. -.LP -.ce -Table 4-1; The ClientMessage sent to the IMS window. -.TS H -tab(:); -l s|l -l l|l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:IMS Window ID -Atom:message_type:XInternAtom(display, ``_XIM_XCONNECT'', False) -int:format:32 -long:data.l[0]:client communication window ID -long:data.l[1]:client-major-transport-version (*1) -long:data.l[2]:client-major-transport-version (*1) -.sp 6p -_ -.TE -.LP -In order to establish the connection (to notify the IM Server communication -window), the IM Server sends a ClientMessage in the following event's -format to the client communication window. -.LP -.ce -Table 4-2; The ClientMessage sent by IM Server. -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:client communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_XCONNECT'', False) -int:format:32 -long:data.l[0]:IMS communication window ID -long:data.l[1]:server-major-transport-version (*1) -long:data.l[2]:server-minor-transport-version (*1) -long:data.l[3]:dividing size between ClientMessage and Property (*2) -.sp 6p -_ -.TE -.LP -.IP (*1) -major/minor-transport-version -.RS -The read/write method is decided by the combination of -major/minor-transport-version, as follows: -.LP -.ce -Table 4-3; The read/write method and the major/minor-transport-version -.TS -center, tab(:); -| c s | l | -| c | c | l |. -_ -.sp 6p -.B -Transport-version:read/write -.sp 6p -_ -.sp 6p -major:minor: -.sp 6p -_ -.sp 6p -.R -0:0:only-CM & Property-with-CM -:1:only-CM & multi-CM -:2:only-CM & multi-CM & Property-with-CM -.sp 6p -_ -.sp 6p -1:0:PropertyNotify -.sp 6p -_ -.sp 6p -2:0:only-CM & PropertyNotify -:1:only-CM & multi-CM & PropertyNotify -.sp 6p -_ -.TE -.LP -.RS -.TS -center, tab(;); -l n l. -only-CM;:;data is sent via a ClientMessage -multi-CM;:;data is sent via multiple ClientMessages -Property-with-CM;:;T{ -data is written in Property, and its Atom is send via ClientMessage -T} -PropertyNotify;:;T{ -data is written in Property, and its Atom is send via PropertyNotify -T} -.TE -.RE -.LP -The method to decide major/minor-transport-version is as follows: -.LP -.IP (1) -The client sends 0 as major/minor-transport-version to the IM Server. -The client must support all methods in Table 4-3. -The client may send another number as major/minor-transport-version to -use other method than the above in the future. -.IP (2) -The IM Server sends its major/minor-transport-version number to -the client. The client sends data using the method specified by the -IM Server. -.IP (3) -If major/minor-transport-version number is not available, it is regarded -as 0. -.RE -.LP -.IP (*2) -dividing size between ClientMessage and Property -.RS -If data is sent via both of multi-CM and Property, specify the dividing -size between ClientMessage and Property. The data, which is smaller than -this size, is sent via multi-CM (or only-CM), and the data, which is -lager than this size, is sent via Property. -.RE -.LP -.NH 3 -read/write -.XS -\*(SN read/write -.XE -.LP -The data is transferred via either ClientMessage or Window Property in -the X Window System. -.LP -.NH 4 -Format for the data from the Client to the IM Server -.XS -\*(SN Format for the data from the Client to the IM Server -.XE -.LP -.B -ClientMessage -.LP -.RS -If data is sent via ClientMessage event, the format is as follows: -.LP -.ce -Table 4-4; The ClientMessage event's format (first or middle) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event;Set by the X Window System -Display;*display;The display to which connects -Window;window;IMS communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_MOREDATA'', False) -int;format;8 -char;data.b[20];(read/write DATA : 20 byte) -.sp 6p -_ -.TE -.LP -.ce -Table 4-5; The ClientMessage event's format (only or last) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event;Set by the X Window System -Display;*display;The display to which connects -Window;window;IMS communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_PROTOCOL'', False) -int;format;8 -char;data.b[20];(read/write DATA : MAX 20 byte) (*1) -.sp 6p -_ -.TE -.IP (*1) -If the data is smaller than 20 byte, all data other than available data -must be 0. -.RE -.LP -.B -Property -.LP -.RS -In the case of large data, data will be sent via the Window Property -for the efficiency. There are the following two methods to notify -Property, and transport-version is decided which method is used. -.LP -.IP (1) -The XChangeProperty function is used to store data in the client -communication window, and Atom of the stored data is notified to the -IM Server via ClientMessage event. -.IP (2) -The XChangeProperty function is used to store data in the client -communication window, and Atom of the stored data is notified to the -IM Server via PropertyNotify event. -.LP -The arguments of the XChangeProperty are as follows: -.LP -.ce -Table 4-6; The XChangeProperty event's format -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Argument:Contents -.sp 6p -_ -.sp 6p -.TH -.R -Display:*display:The display to which connects -Window:window:IMS communication window ID -Atom:property:read/write property Atom (*1) -Atom:type:XA_STRING -int:format:8 -int:mode:PropModeAppend -u_char:*data:read/write DATA -int:nelements:length of DATA -.sp 6p -_ -.TE -.LP -.IP (*1) -The read/write property ATOM allocates the following strings by -\fBXInternAtom\fP. -.RS -``_clientXXX'' -.RE -.LP -The client changes the property with the mode of PropModeAppend and -the IM Server will read it with the delete mode i.e. (delete = True). -.LP -If Atom is notified via ClientMessage event, the format of the ClientMessage -is as follows: -.LP -.ce -Table 4-7; The ClientMessage event's format to send Atom of property -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:IMS communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_PROTOCOL'', False) -int:format:32 -long:data.l[0]:length of read/write property Atom -long:data.l[1]:read/write property Atom -.sp 6p -_ -.TE -.RE -.LP -.NH 4 -Format for the data from the IM Server to the Client -.XS -\*(SN Format for the data from the Client to the Client -.XE -.LP -.B -ClientMessage -.LP -.RS -The format of the ClientMessage is as follows: -.LP -.ce -Table 4-8; The ClientMessage event's format (first or middle) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event ;Set by the X Window System -Display;*display;The display to which connects -Window;window;client communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_MOREDATA'', False) -int;format;8 -char;data.b[20];(read/write DATA : 20 byte) -.sp 6p -_ -.TE -.LP -.ce -Table 4-9; The ClientMessage event's format (only or last) -.TS H -tab(;); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member;Contents -.sp 6p -_ -.sp 6p -.TH -.R -int;type;ClientMessage -u_long;serial;Set by the X Window System -Bool;send_event ;Set by the X Window System -Display;*display;The display to which connects -Window;window;client communication window ID -Atom;message_type;XInternAtom(display, ``_XIM_PROTOCOL'', False) -int;format;8 -char;data.b[20];(read/write DATA : MAX 20 byte) (*1) -.sp 6p -_ -.TE -.LP -.IP (*1) -If the data size is smaller than 20 bytes, all data other than available -data must be 0. -.RE -.LP -.B -Property -.LP -.RS -In the case of large data, data will be sent via the Window Property -for the efficiency. There are the following two methods to notify -Property, and transport-version is decided which method is used. -.LP -.IP (1) -The XChangeProperty function is used to store data in the IMS -communication window, and Atom of the property is sent via the -ClientMessage event. -.IP (2) -The XChangeProperty function is used to store data in the IMS -communication window, and Atom of the property is sent via -PropertyNotify event. -.LP -The arguments of the XChangeProperty are as follows: -.LP -.ce -Table 4-10; The XChangeProperty event's format -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Argument:Contents -.sp 6p -_ -.sp 6p -.TH -.R -Display:*display:The display which to connects -Window:window:client communication window ID -Atom:property:read/write property Atom (*1) -Atom:type:XA_STRING -int:format:8 -int:mode:PropModeAppend -u_char:*data:read/write DATA -int:nelements:length of DATA -.sp 6p -_ -.TE -.LP -.IP (*1) -The read/write property ATOM allocates some strings, which are not -allocated by the client, by \fBXInternAtom\fP. -.LP -The IM Server changes the property with the mode of PropModeAppend and -the client reads it with the delete mode, i.e. (delete = True). -.LP -If Atom is notified via ClientMessage event, the format of the ClientMessage -is as follows: -.LP -.ce -Table 4-11; The ClientMessage event's format to send Atom of property -.TS H -tab(:); -l s | l -l l | l. -_ -.sp 6p -.B -Structure Member:Contents -.sp 6p -_ -.sp 6p -.TH -.R -int:type:ClientMessage -u_long:serial:Set by the X Window System -Bool:send_event:Set by the X Window System -Display:*display:The display to which connects -Window:window:client communication window ID -Atom:message_type:XInternAtom(display, ``_XIM_PROTOCOL'', False) -int:format:32 -long:data.l[0]:length of read/write property ATOM -long:data.l[1]:read/write property ATOM -.sp 6p -_ -.TE -.RE -.LP -.NH 3 -Closing Connection -.XS -\*(SN Closing Connection -.XE -.LP -If the client disconnect with the IM Server, shutdown function should -free the communication window properties and etc.. -.LP -.NH 1 -References -.XS -\*(SN References -.XE -.LP -[1] Masahiko Narita and Hideki Hiura, \fI``The Input Method Protocol''\fP -.LP - diff --git a/libX11/specs/i18n/framework/Makefile.am b/libX11/specs/i18n/framework/Makefile.am new file mode 100644 index 000000000..8f6364a03 --- /dev/null +++ b/libX11/specs/i18n/framework/Makefile.am @@ -0,0 +1,32 @@ +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +if ENABLE_SPECS + +specdir = $(docdir)/$(subdir) +doc_sources = framework.xml +dist_spec_DATA = $(doc_sources) framework.svg + +include $(top_srcdir)/specs/xmlrules.in + +endif ENABLE_SPECS diff --git a/libX11/specs/i18n/framework/framework.svg b/libX11/specs/i18n/framework/framework.svg new file mode 100644 index 000000000..7adfc1404 --- /dev/null +++ b/libX11/specs/i18n/framework/framework.svg @@ -0,0 +1,703 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + Application + <<ANSI/MSE API>>(X Contrib) + + <<XLib API>>(X Core) + <<ANSI/MSE API>>(X Contrib) + InputMethod + OutputMethod + <Locl. Serv. API>X Locale Object + C Library + ANSI impl + XLC_XLOCALE- MB_CUR_MAXcodeset infoo char/charseto conv/charset + XLC_FONTSET- fontset info- charset info- font/charset- XLFD,GL/GR + localedef DB- MB_CUR_MAX- codset infoo char/charseto conv/charset + Locale Library + non-ANSI impl. + + + + + + + + XLocale Source (X Core) + System Locale Source + + + + + + + + + + + diff --git a/libX11/specs/i18n/framework/framework.xml b/libX11/specs/i18n/framework/framework.xml new file mode 100644 index 000000000..ab1dac6b6 --- /dev/null +++ b/libX11/specs/i18n/framework/framework.xml @@ -0,0 +1,1620 @@ + + + + + + + X11R6 Sample Implementation Frame Work + X Version 11, Release 7 + + + KatsuhisaYano + TOSHIBA Corporation + + + YoshioHoriuchi + IBM Japan + + + 1994TOSHIBA Corporation + 1994IBM Corporation + + + + +Permission to use, copy, modify, and distribute this documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice and this permission notice appear in all copies. TOSHIBA Corporation and +IBM Corporation make no representations about the suitability for any purpose of the information in this document. +This documentation is provided as is without express or implied warranty. + + + +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 Open Group shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from X Consortium. + + +X Window System is a trademark of The Open Group. + + + + + +Framework + +Preface + +This document proposes to define the structures, methods and their +signatures that are expected to be common to all locale dependent +functions within the Xlib sample implementation. The following +illustration (Fig.1) is proposed to outline the separating of +the components within the sample implementation. + + + +Preface drawing. + + + + + + + Frame work of Locale Service API Proposal + + + +Generally speaking, the internationalized portion of Xlib (Locale +Dependent X, LDX) consists of three objects; +locale (LC) , input method (IM) and output method (OM). +The LC provides a set of information that depends on user's language +environment. The IM manages text inputing, and the OM manages text +drawing. Both IM and OM highly depend on LC data. + + + +In X11R5, there are two sample implementations, Ximp and Xsi, for +Xlib internationalization. But in both implementations, IM and OM +actually refer the private extension of LC. It breaks coexistence +of these two sample implementations. For example, if a user creates +a new OM for special purpose as a part of Ximp, it will not work with +Xsi. + + + +As a solution of this problem, we propose to define the standard +APIs between these three objects, and define the structure that are +common to these objects. + + + + +Objective + + + + +Explain the current X11R6 sample implementation + + + + +Document the common set of locale dependent interfaces + + + + +Provide more flexible pluggable layer + + + + + + +Locale Object Binding Functions + + + +This chapter describes functions related locale object binding for +implementing the pluggable layer. + + + +A locale loader is an entry point for locale object, which +instantiates XLCd object and binds locale methods with specified +locale name. The behavior of loader is implementation dependent. +And, what kind of loaders are available is also implementation +dependent. + + + + +The loader is called in +_XOpenLC, +but caller of +_XOpenLC +does not need to care about its inside. For example, if the loader is +implemented with dynamic load functions, and the dynamic module is +expected to be unloaded when the corresponding XLCd is freed, +close methods of XLCdMethods should handle unloading. + + + +Initializing a locale loader list + + +void _XlcInitLoader + + + +The +_XlcInitLoader +function initializes the locale loader list with vendor specific +manner. Each loader is registered with calling +_XlcAddLoader. +The number of loaders and their order in the loader list is +implementation dependent. + + + +Add a loader + + + +typedef XLCd (*XLCdLoadProc)(name); + char *name; + +typedef int XlcPosition; + +#define XlcHead +#define XlcTail + + + + + Bool _XlcAddLoader + XLCdLoadProc proc + XlcPosition position + + + + +The +_XlcAddLoader +function registers the specified locale loader "proc" to the +internal loader list. The position specifies that the loader +"proc" should be placed in the top of the loader list(XlcHead) +or last(XlcTail). + + + +The object loader is called from the top of the loader list in order, +when calling time. + + + +Remove a loader + + + + + void _XlcRemoveLoader + XLCdLoadProc proc + + + + +The +_XlcRemoveLoader +function removes the locale loader specified by "proc" from the +loader list. + + + +Current implementation provides following locale loaders; + + + +_XlcDefaultLoader +_XlcGenericLoader +_XlcEucLoader +_XlcSjisLoader +_XlcUtfLoader +_XaixOsDynamicLoad + + + + + +Locale Method Interface + + +This chapter describes the locale method API, which is a set of +accessible functions from both IM and OM parts. +The locale method API provides the functionalities; obtaining locale +dependent information, handling charset, converting text, etc. + + + +As a result of using these APIs instead of accessing vender private +extension of the locale object, we can keep locale, IM and OM +independently each other. + + + + + +Locale Method Functions + +Open a Locale Method + + + + + XLCd _XOpenLC + char *name + + + + +The +_XOpenLC +function opens a locale method which corresponds to the +specified locale name. +_XOpenLC +calls a locale object loader, which is registered via +_XlcAddLoader into the internal loader list. If the called loader +is valid and successfully opens a locale, +_XOpenLC +returns the XLCd. If the loader is invalid or failed to open a locale, +_XOpenLC +calls the next loader. If all registered loaders cannot open a locale, +_XOpenLC +returns NULL. + + +XLCd _XlcCurrentLC + + +The +_XlcCurrentLC +function returns an XLCd that are bound to current locale. + + + +Close a Locale Method + + + + + void _XCloseLC + XLCd lcd + + + + + +The +_XCloseLC +function close a locale method the specified lcd. + + + +Obtain Locale Method values + + + + + char *_XGetLCValues + XLCd lcd + + + + +The +_XGetLCValues +function returns NULL if no error occurred; otherwise, it returns the +name of the first argument that could not be obtained. +The following values are defined as standard arguments. Other values +are implementation dependent. + + + + + + + + + + Name + Type + Description + + + + + XlcNCodeset + char* + codeset part of locale name + + + XlcNDefaultString + char* + XDefaultString() + + + XlcNEncodingName + char* + encoding name + + + XlcNLanguage + char* + language part of locale name + + + XlcNMbCurMax + int + ANSI C MB_CUR_MAX + + + XlcNStateDependentEncoding + Bool + is state-dependent encoding or not + + + XlcNTerritory + char* + territory part of locale name + + + + + + + + +Charset functions + +The XlcCharSet is an identifier which represents a subset of characters +(character set) in the locale object. + + + +typedef enum { + XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther +} XlcSide; + +typedef struct _XlcCharSetRec *XlcCharSet; + +typedef struct { + char *name; + XPointer value; +} XlcArg, *XlcArgList; + +typedef char* (*XlcGetCSValuesProc)(charset, args, num_args); + XlcCharSet charset; + XlcArgList args; + int num_args; + +typedef struct _XlcCharSetRec { + char *name; + XrmQuark xrm_name; + char *encoding_name; + XrmQuark xrm_encoding_name; + XlcSide side; + int char_size; + int set_size; + char *ct_sequence; + XlcGetCSValuesProc get_values; +} XlcCharSetRec; + + + +Get an XlcCharSet + + + + + XlcCharSet _XlcGetCharSet + char *name + + + + +The +_XlcGetCharSet +function gets an XlcCharSet which corresponds to the charset name +specified by "name". +_XlcGetCharSet +returns NULL, if no XlcCharSet bound to specified "name". + + + +The following character sets are pre-registered. + + + + + + + + + Name + Description + + + + + ISO8859-1:GL + 7-bit ASCII graphics (ANSI X3.4-1968), + + + + Left half of ISO 8859 sets + + + JISX0201.1976-0:GL + Left half of JIS X0201-1976 (reaffirmed 1984), + + + + 8-Bit Alphanumeric-Katakana Code + + + ISO8859-1:GR + Right half of ISO 8859-1, Latin alphabet No. 1 + + + ISO8859-2:GR + Right half of ISO 8859-2, Latin alphabet No. 2 + + + ISO8859-3:GR + Right half of ISO 8859-3, Latin alphabet No. 3 + + + ISO8859-4:GR + Right half of ISO 8859-4, Latin alphabet No. 4 + + + ISO8859-7:GR + Right half of ISO 8859-7, Latin/Greek alphabet + + + ISO8859-6:GR + Right half of ISO 8859-6, Latin/Arabic alphabet + + + ISO8859-8:GR + Right half of ISO 8859-8, Latin/Hebrew alphabet + + + ISO8859-5:GR + Right half of ISO 8859-5, Latin/Cyrillic alphabet + + + ISO8859-9:GR + Right half of ISO 8859-9, Latin alphabet No. 5 + + + JISX0201.1976-0:GR + Right half of JIS X0201-1976 (reaffirmed 1984), + + + + 8-Bit Alphanumeric-Katakana Code + + + GB2312.1980-0:GL + GB2312-1980, China (PRC) Hanzi defined as GL + + + GB2312.1980-0:GR + GB2312-1980, China (PRC) Hanzi defined as GR + + + JISX0208.1983-0:GL + JIS X0208-1983, Japanese Graphic Character Set + + + + defined as GL + + + JISX0208.1983-0:GR + JIS X0208-1983, Japanese Graphic Character Set + + + + defined as GR + + + KSC5601.1987-0:GL + KS C5601-1987, Korean Graphic Character Set + + + + defined as GL + + + KSC5601.1987-0:GR + KS C5601-1987, Korean Graphic Character Set + + + + defined as GR + + + JISX0212.1990-0:GL + JIS X0212-1990, Japanese Graphic Character Set + + + + defined as GL + + + JISX0212.1990-0:GR + JIS X0212-1990, Japanese Graphic Character Set + + + + defined as GR + + + + + + +Add an XlcCharSet + + + + + Bool _XlcAddCharSet + XlcCharSet charset + + + + +The +_XlcAddCharSet +function registers XlcCharSet specified by "charset". + + + + + +Obtain Character Set values + + + + + char * _XlcGetCSValues + XlcCharSet charset + ... + + + + +The +_XlcGetCSValues +function returns NULL if no error occurred; +otherwise, it returns the name of the first argument that could not +be obtained. The following values are defined as standard arguments. +Other values are implementation dependent. + + + + + + + + + + Name + Type + Description + + + + + XlcNName + char* + charset name + + + XlcNEncodingName + char* + XLFD CharSet Registry and Encoding + + + XlcNSide + XlcSide + charset side (GL, GR, ...) + + + XlcNCharSize + int + number of octets per character + + + XlcNSetSize + int + number of character sets + + + XlcNControlSequence + char* + control sequence of Compound Text + + + + + + + + +Converter Functions + +We provide a set of the common converter APIs, that are independent +from both of source and destination text type. + + + +typedef struct _XlcConvRec *XlcConv; + +typedef void (*XlcCloseConverterProc)(conv); + XlcConv conv; + +typedef int (*XlcConvertProc)(conv, from, from_left, to, to_left, args, num_args); + XlcConv conv; + XPointer *from; + int *from_left; + XPointer *to; + int *to_left; + XPointer *args; + int num_args; + +typedef void (*XlcResetConverterProc)(conv); + XlcConv conv; + +typedef struct _XlcConvMethodsRec { + XlcCloseConverterProc close; + XlcConvertProc convert; + XlcResetConverterProc reset; +} XlcConvMethodsRec, *XlcConvMethods; + +typedef struct _XlcConvRec { + XlcConvMethods methods; + XPointer state; +} XlcConvRec; + + + +Open a converter + + + + + XlcConv _XlcOpenConverter + XLCd from_lcd + char *from_type + XLCd to_lcd + char *to_type + + + + +_XlcOpenConverter +function opens the converter which converts a text from specified +"from_type" to specified "to_type" encoding. If the +function cannot find proper converter or cannot open a corresponding +converter, it returns NULL. Otherwise, it returns the conversion +descriptor. + + + +The following types are pre-defined. Other types are implementation +dependent. + + + + + + + + + + + Name + Type + Description + Arguments + + + + + XlcNMultiByte + char * + multibyte + - + + + XlcNWideChar + wchar_t * + wide character + - + + + XlcNCompoundText + char * + COMPOUND_TEXT + - + + + XlcNString + char * + STRING + - + + + XlcNCharSet + char * + per charset + XlcCharSet + + + XlcNChar + char * + per character + XlcCharSet + + + + + + +Close a converter + + + + + void _XlcCloseConverter + XlcConv conv + + + + +The +_XlcCloseConverter +function closes the specified converter "conv". + + + +Code conversion + + + + + int _XlcConvert + XlcConv conv + XPointer *from + int *from_left + XPointer *to + int *to_left + XPointer *args + int num_args + + + + +The +_XlcConvert +function converts a sequence of characters from one type, in the array +specified by "from", into a sequence of corresponding characters +in another type, in the array specified by "to". The types are +those specified in the +_XlcOpenConverter() +call that returned the conversion descriptor, "conv". +The arguments "from", "from_left", "to" and +"to_left" have the same specification of XPG4 iconv function. + + + +For state-dependent encodings, the conversion descriptor "conv" +is placed into its initial shift state by a call for which "from" +is a NULL pointer, or for which "from" points to a null pointer. + + + +The following 2 converters prepared by locale returns appropriate +charset (XlcCharSet) in an area pointed by args[0]. + + + + + + + + + + From + To + Description + + + + + XlcNMultiByte + XlcNCharSet + Segmentation (Decomposing) + + + XlcNWideChar + XlcNCharSet + Segmentation (Decomposing) + + + + + + +The conversion, from XlcNMultiByte/XlcNWideChar to XlcNCharSet, +extracts a segment which has same charset encoding characters. +More than one segment cannot be converted in a call. + + + +Reset a converter + + + + + void _XlcResetConverter + XlcConv conv + + + + +The +_XlcResetConverter +function reset the specified converter "conv". + + + +Register a converter + + + +typedef XlcConv (*XlcOpenConverterProc)(from_lcd, from_type, to_lcd, to_type); + XLCd from_lcd; + char *from_type; + XLCd to_lcd; + char *to_type; + + + + + Bool _XlcSetConverter + XLCd from_lcd + char *from + XLCd to_lcd + char *to + XlcOpenConverterProc converter + + + + +The XlcSetConverter function registers a converter which convert +from "from_type" to "to_type" into the converter list +(in the specified XLCd). + + + + +X Locale Database functions + +X Locale Database contains the subset of user's environment that +depends on language. The following APIs are provided for accessing +X Locale Database and other locale relative files. + + + +For more detail about X Locale Database, please refer +X Locale Database Definition document. + + + +Get a resource from database + + + + + void _XlcGetResource + XLCd lcd + char *category + char *class + char ***value + int *count + + + + +The +_XlcGetResource +function obtains a locale dependent data which is associated with the +locale of specified "lcd". +The locale data is provided by system locale or by X Locale Database +file, and what kind of data is available is implementation dependent. + + + +The specified "category" and "class" are used for +finding out the objective locale data. + + + +The returned value is returned in value argument in string list form, +and the returned count shows the number of strings in the value. + + + +The returned value is owned by locale method, and should not be modified +or freed by caller. + + + +Get a locale relative file name + + + + + char *_XlcFileName + XLCd lcd + char *category + + + + +The +_XlcFileName +functions returns a file name which is bound to the specified "lcd" +and "category", as a null-terminated string. If no file name can +be found, or there is no readable file for the found file name, +_XlcFileName +returns NULL. The returned file name should be freed by caller. + + + +The rule for searching a file name is implementation dependent. +In current implementation, +_XlcFileName +uses "{category}.dir" file as mapping table, which has pairs of +strings, a full locale name and a corresponding file name. + + + + + +Utility Functions + + +Compare Latin-1 strings + + + + + int _XlcCompareISOLatin1 + char*str1, *str2 + + + + + + int _XlcNCompareISOLatin1 + char*str1, *str2 + int len + + + + +The +_XlcCompareIsoLatin1 +function to compares two ISO-8859-1 strings. Bytes representing ASCII lower +case letters are converted to upper case before making the comparison. +The value returned is an integer less than, equal to, or greater than +zero, depending on whether "str1" is lexicographicly less than, +equal to, or greater than "str2". + + + +The +_XlcNCompareIsoLatin1 +function is identical to +_XlcCompareISOLatin1, +except that at most "len" bytes are compared. + + + +Resource Utility + + + + + int XlcNumber + ArrayType array + + + + +Similar to XtNumber. + + + + + void _XlcCopyFromArg + char *src + char *dst + int size + + + + + + void _XlcCopyToArg + char *src + char **dst + int size + + + + +Similar to +_XtCopyFromArg +and +_XtCopyToArg. + + + + + void _XlcCountVaList + va_list var + int *count_ret + + + + +Similar to +_XtCountVaList. + + + + + void _XlcVaToArgList + va_list var + int count + XlcArgList *args_ret + + + + +Similar to +_XtVaToArgList. + + + +typedef struct _XlcResource { + char *name; + XrmQuark xrm_name; + int size; + int offset; + unsigned long mask; +} XlcResource, *XlcResourceList; + + + +#define XlcCreateMask (1L<<0) +#define XlcDefaultMask (1L<<1) +#define XlcGetMask (1L<<2) +#define XlcSetMask (1L<<3) +#define XlcIgnoreMask (1L<<4) + + + + + void _XlcCompileResourceList + XlcResourceList resources + int num_resources + + + + +Similar to +_XtCompileResourceList. + + + + + char * _XlcGetValues + XPointer base + XlcResourceList resources + int num_resources + XlcArgList args + int num_args + unsignedlong mask + + + + +Similar to XtGetSubvalues. + + + + + char * _XlcSetValues + XPointer base + XlcResourceList resources + int num_resources + XlcArgList args + int num_args + unsignedlong mask + + + + +Similar to XtSetSubvalues. + + + +ANSI C Compatible Functions + + + +The following are ANSI C/MSE Compatible Functions for non-ANSI C environment. + + + + + int _Xmblen + char *str + int len + + + + +The +_Xmblen +function returns the number of characters pointed to by "str". +Only "len" bytes in "str" are used in determining the +character count returned. "Str" may point at characters from +any valid codeset in the current locale. + + + +The call +_Xmblen +is equivalent to +_Xmbtowc(_Xmbtowc((wchar_t*)NULL, str, len)) + + + + + int _Xmbtowc + wchar_t *wstr + char *str + int len + + + + +The +_Xmbtowc +function converts the character(s) pointed to by "str" +to their wide character representation(s) pointed to by "wstr". +"Len" is the number of bytes in "str" to be converted. +The return value is the number of characters converted. + + + +The call +_Xmbtowc +is equivalent to +_Xlcmbtowc((XLCd)NULL, wstr, str, len) + + + + + int _Xlcmbtowc + XLCd lcd + wchar_t *wstr + char *str + int len + + + + +The +_Xlcmbtowc +function is identical to +_Xmbtowc, +except that it requires the "lcd" argument. If "lcd" +is (XLCd) NULL, +_Xlcmbtowc, +calls +_XlcCurrentLC +to determine the current locale. + + + + + int _Xwctomb + char *str + wchar_t wc + + + + +The +_Xwctomb +function converts a single wide character pointed to by "wc" to +its multibyte representation pointed to by "str". +On success, the return value is 1. + + + +The call +_Xwctomb +is equivalent to +_Xlcwctomb((XLCd)NULL, str, wstr) + + + + + int _Xlcwctomb + XLCd lcd + char *str + wchar_t wc + + + + +The +_Xlcwctomb +function is identical to _Xwctomb, except that it requires the +"lcd" argument. If "lcd" is (XLCd) NULL, +_Xlcwctomb, +calls +_XlcCurrentLC +to determine the current locale. + + + + + int _Xmbstowcs + wchar_t *wstr + char *str + int len + + + + +The +_Xmbstowcs +function converts the NULL-terminated string pointed to by "str" +to its wide character string representation pointed to by "wstr". +"Len" is the number of characters in "str" to be converted. + + + +The call +_Xmbstowcs +is equivalent to +_Xlcmbstowcs((XLCd)NULL, wstr, str, len) + + + + + int _Xlcmbstowcs + XLCd lcd + wchar_t *wstr + char *str + int len + + + + +The +_Xlcmbstowcs +function is identical to _Xmbstowcs, except that it requires the +"lcd" argument. If "lcd" is (XLCd) NULL, +_Xlcmbstowcs, +calls +_XlcCurrentLC +to determine the current locale. + + + + + int _Xwcstombs + char *str + wchar_t *wstr + int len + + + + +The +_Xwcstombs +function converts the (wchar_t) NULL terminated wide character string +pointed to by "wstr" to the NULL terminated multibyte string +pointed to by "str". + + + +The call +_Xwcstombs +is equivalent to +_Xlcwcstombs((XLCd)NULL, str, wstr, len) + + + + + int _Xlcwcstombs + XLCd lcd + char *str + wchar_t *wstr + int len + + + + +The +_Xlcwcstombs +function is identical to _Xwcstombs, except that it requires the +"lcd" argument. If "lcd" is (XLCd) NULL, +_Xlcwcstombs, +calls +_XlcCurrentLC +to determine the current locale. + + + + + int _Xwcslen + wchar_t *wstr + + + + +The +_Xwcslen +function returns the count of wide characters in the (wchar_t) NULL +terminated wide character string pointed to by "wstr". + + + + + wchar_t * _Xwcscpy + wchar_t *wstr1 + wchar_t *wstr2 + + + + + + wchar_t * _Xwcsncpy + wchar_t *wstr1 + wchar_t *wstr2 + int len + + + + +The +_Xwcscpy +function copies the (wchar_t) NULL terminated wide character string +pointed to by "wstr2" to the object pointed at by "wstr1". +"Wstr1" is (wchar_t) NULL terminated. The return value is a +pointer to "wstr1". + + + +The +_Xwcsncpy +function is identical to +_Xwcscpy, +except that it copies "len" wide characters from the object +pointed to by "wstr2" to the object pointed to "wstr1". + + + + + int _Xwcscmp + wchar_t*wstr1, *wstr2 + + + + + + int _Xwcsncmp + wchar_t*wstr1, *wstr2 + int len + + + + +The +_Xwcscmp +function compares two (wchar_t) NULL terminated wide character strings. +The value returned is an integer less than, equal to, or greater than zero, +depending on whether "wstr1" is lexicographicly less then, equal to, +or greater than "str2". + + + +The +_Xwcsncmp +function is identical to +_XlcCompareISOLatin1, +except that at most "len" wide characters are compared. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libX11/specs/i18n/localedb/Makefile.am b/libX11/specs/i18n/localedb/Makefile.am new file mode 100644 index 000000000..99b5086da --- /dev/null +++ b/libX11/specs/i18n/localedb/Makefile.am @@ -0,0 +1,32 @@ +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +if ENABLE_SPECS + +specdir = $(docdir)/$(subdir) +doc_sources = localedb.xml +dist_spec_DATA = $(doc_sources) + +include $(top_srcdir)/specs/xmlrules.in + +endif ENABLE_SPECS diff --git a/libX11/specs/i18n/localedb/localedb.xml b/libX11/specs/i18n/localedb/localedb.xml new file mode 100644 index 000000000..e5b96ab84 --- /dev/null +++ b/libX11/specs/i18n/localedb/localedb.xml @@ -0,0 +1,777 @@ + + + + + + + X Locale Database Specification + + + YoshioHoriuchi + IBM Japan + + + 1994IBM Corporation + 1994X Consortium + + + + + +License to use, copy, modify, and distribute this software and its documentation for +any purpose and without fee is hereby granted, provided that the above copyright notice +appear in all copies and that both that copyright notice and this permission notice +appear in supporting documentation, and that the name of IBM not be used in advertising +or publicity pertaining to distribution of the software without specific, written +prior permission. + + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS, +IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + + +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 Open Group shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from X Consortium. + + +X Window System is a trademark of The Open Group. + + + + + +LocaleDB + + +General + +An X Locale Database contains the subset of a user's environment that +depends on language, in X Window System. It is made up from one or more +categories. Each category consists of some classes and sub-classes. + + + +It is provided as a plain ASCII text file, so a user can change its +contents easily. It allows a user to customize the behavior of +internationalized portion of Xlib without changing Xlib itself. + + + +This document describes; + + + + + +Database Format Definition + + + + +Contents of Database in sample implementation + + + + + + +Since it is hard to define the set of required information for all +platforms, only the flexible database format is defined. +The available entries in database are implementation dependent. + + + + +Database Format Definition + +The X Locale Database contains one or more category definitions. +This section describes the format of each category definition. + + + +The category definition consists of one or more class definitions. +Each class definition has a pair of class name and class value, or +has several subclasses which are enclosed by the left brace ({) and +the right brace (}). + + + +Comments can be placed by using the number sign character (#). +Putting the number sign character on the top of the line indicates +that the entire line is comment. Also, putting any whitespace character +followed by the number sign character indicates that a part of the line +(from the number sign to the end of the line) is comment. +A line can be continued by placing backslash (\) character as the +last character on the line; this continuation character will be +discarded from the input. Comment lines cannot be continued on +a subsequent line using an escaped new line character. + + + +X Locale Database only accepts XPCS, the X Portable Character Set. +The reserved symbols are; the quotation mark("), the number sign (#), +the semicolon(;), the backslash(\), the left brace({) and +the right brace(}). + + + +The format of category definition is; + + + + + + + + + + CategoryDefinition + ::= + CategoryHeader CategorySpec CategoryTrailer + + + CategoryHeader + ::= + CategoryName NL + + + CategorySpec + ::= + { ClassSpec } + + + CategoryTrailer + ::= + "END" Delimiter CategoryName NL + + + CategoryName + ::= + String + + + ClassSpec + ::= + ClassName Delimiter ClassValue NL + + + ClassName + ::= + String + + + ClassValue + ::= + ValueList | "{" NL { ClassSpec } "}" + + + ValueList + ::= + Value | Value ";" ValueList + + + Value + ::= + ValuePiece | ValuePiece Value + + + ValuePiece + ::= + String | QuotedString | NumericString + + + String + ::= + Char { Char } + + + QuotedString + ::= + """ QuotedChar { QuotedChar } """ + + + NumericString + ::= + "\\o" OctDigit { OctDigit } + + + + | + "\\d" DecDigit { DecDigit } + + + + | + "\\x" HexDigit { HexDigit } + + + Char + ::= + <XPCS except NL, Space or unescaped reserved symbols> + + + QuotedChar + ::= + <XPCS except unescaped """> + + + OctDigit + ::= + <character in the range of "0" - "7"> + + + DecDigit + ::= + <character in the range of "0" - "9"> + + + HexDigit + ::= + <character in the range of "0" - "9", "a" - "f", "A" - "F"> + + + Delimiter + ::= + Space { Space } + + + Space + ::= + <space> | <horizontal tab> + + + NL + ::= + <newline> + + + + + + +Elements separated by vertical bar (|) are alternatives. Curly +braces ({...}) indicate zero or more repetitions of the enclosed +elements. Square brackets ([...]) indicate that the enclosed element +is optional. Quotes ("...") are used around literal characters. + + + +The backslash, which is not the top character of the NumericString, is +recognized as an escape character, so that the next one character is +treated as a literal character. For example, the two-character +sequence, ""\"""(the backslash followed by the quotation mark) is +recognized and replaced with a quotation mark character. +Any whitespace character, that is not the Delimiter, unquoted and +unescaped, is ignored. + + + + +Contents of Database + +The available categories and classes depend on implementation, because +different platform will require different information set. +For example, some platform have system locale but some platform don't. +Furthermore, there might be a difference in functionality even if the +platform has system locale. + + + +In current sample implementation, categories listed below are available. + + + + + + + + + XLC_FONTSET:XFontSet relative information + + + XLC_XLOCALE:Character classification and conversion information + + + + + + + +XLC_FONTSET Category + +The XLC_FONTSET category defines the XFontSet relative information. +It contains the CHARSET_REGISTRY-CHARSET_ENCODING name and character +mapping side (GL, GR, etc), and is used in Output Method (OM). + + + + + + + + + + class + super class + description + + + + + fsN + + Nth fontset (N=0,1,2, ...) + + + charset + fsN + list of encoding name + + + font + fsN + list of font encoding name + + + + + + + + fsN + + +Includes an encoding information for Nth charset, where N is +the index number (0,1,2,...). If there are 4 charsets available +in current locale, 4 fontsets, fs0, fs1, fs2 and fs3, should be +defined. +This class has two subclasses, 'charset' and 'font'. + + + + + charset + + +Specifies an encoding information to be used internally in Xlib +for this fontset. The format of value is; + + + + + + + + + EncodingInfo + ::= + EncodingName [ ":" EncodingSide ] + + + EncodingName + ::= + CHARSET_REGISTRY-CHARSET_ENCODING + + + EncodingSide + ::= + "GL" | "GR" + + + + + + +For detail definition of CHARSET_REGISTRY-CHARSET_ENCODING, refer +"X Logical Font Descriptions" document. + + +example: + ISO8859-1:GL + + + + + font + + +Specifies a list of encoding information which is used for searching +appropriate font for this fontset. The left most entry has highest +priority. + + + + + + + +XLC_XLOCALE Category + +The XLC_XLOCALE category defines character classification, conversion +and other character attributes. + + + + + + + + + + class + super class + description + + + + + encoding_name + + codeset name + + + mb_cur_max + + MB_CUR_MAX + + + state_depend_encoding + + state dependent or not + + + wc_encoding_mask + + for parsing wc string + + + wc_shift_bits + + for conversion between wc and mb + + + csN + + Nth charset (N=0,1,2,...) + + + side + csN + mapping side (GL, etc) + + + length + csN + length of a character + + + mb_encoding + csN + for parsing mb string + + + wc_encoding + csN + for parsing wc string + + + ct_encoding + csN + list of encoding name for ct + + + + + + + + encoding_name + + +Specifies a codeset name of current locale. + + + + + mb_cur_max + + +Specifies a maximum allowable number of bytes in a multi-byte character. +It is corresponding to MB_CUR_MAX of "ISO/IEC 9899:1990 C Language Standard". + + + + + state_depend_encoding + + +Indicates a current locale is state dependent. The value should be +specified "True" or "False". + + + + + wc_encoding_mask + + +Specifies a bit-mask for parsing wide-char string. Each wide character is +applied bit-and operation with this bit-mask, then is classified into +the unique charset, by using 'wc_encoding'. + + + + + wc_shift_bits + + +Specifies a number of bit to be shifted for converting from a multi-byte +character to a wide character, and vice-versa. + + + + + csN + + + +Includes a character set information for Nth charset, where N is the +index number (0,1,2,...). If there are 4 charsets available in current +locale, cs0, cs1, cs2 and cs3 should be defined. This class has five +subclasses, 'side', 'length', 'mb_encoding' 'wc_encoding' and 'ct_encoding'. + + + + + side + + +Specifies a mapping side of this charset. The format of this value is; + + + Side ::= EncodingSide[":Default"] + + +The suffix ":Default" can be specified. It indicates that a character +belongs to the specified side is mapped to this charset in initial state. + + + + + length + + + +Specifies a number of bytes of a multi-byte character of this charset. +It should not contain the length of any single-shift sequence. + + + + + mb_encoding + + +Specifies a list of shift sequence for parsing multi-byte string. +The format of this value is; + + + + + + + + + MBEncoding + ::= + ShiftType ShiftSequence + + + + | + ShiftType ShiftSequence ";" MBEncoding + + + ShiftType + ::= + "<SS>"|"<LSL>"|"<LSR>" + + + ShiftSequence + ::= + SequenceValue|SequenceValue ShiftSequence + + + SequenceValue + ::= + NumericString + + + + + + +example: + <LSL> \x1b \x28 \x4a; <LSL> \x1b \x28 \x42 + + + + + wc_encoding + + +Specifies an integer value for parsing wide-char string. +It is used to determine the charset for each wide character, after +applying bit-and operation using 'wc_encoding_mask'. +This value should be unique in all csN classes. + + + + + ct_encoding + + +Specifies a list of encoding information that can be used for Compound +Text. + + + + + + + +Sample of X Locale Database + +The following is sample X Locale Database file. + + + +# XLocale Database Sample for ja_JP.euc +# + +# +# XLC_FONTSET category +# +XLC_FONTSET +# fs0 class (7 bit ASCII) +fs0 { + charset ISO8859-1:GL + font ISO8859-1:GL; JISX0201.1976-0:GL +} +# fs1 class (Kanji) +fs1 { + charset JISX0208.1983-0:GL + font JISX0208.1983-0:GL +} +# fs2 class (Half Kana) +fs2 { + charset JISX0201.1976-0:GR + font JISX0201.1976-0:GR +} +# fs3 class (User Defined Character) +# fs3 { +# charset JISX0212.1990-0:GL +# font JISX0212.1990-0:GL +# } +END XLC_FONTSET + +# +# XLC_XLOCALE category +# +XLC_XLOCALE + +encoding_name ja.euc +mb_cur_max 3 +state_depend_encoding False + +wc_encoding_mask \x00008080 +wc_shift_bits 8 + +# cs0 class +cs0 { + side GL:Default + length 1 + wc_encoding \x00000000 + ct_encoding ISO8859-1:GL; JISX0201.1976-0:GL +} +# cs1 class +cs1 { + side GR:Default + length 2 + + wc_encoding \x00008080 + + ct_encoding JISX0208.1983-0:GL; JISX0208.1983-0:GR;\ + JISX0208.1983-1:GL; JISX0208.1983-1:GR +} + +# cs2 class +cs2 { + side GR + length 1 + mb_encoding <SS> \x8e + + wc_encoding \x00000080 + + ct_encoding JISX0201.1976-0:GR +} + +# cs3 class +# cs3 { +# side GL +# length 2 +# mb_encoding <SS> \x8f +# #if HasWChar32 +# wc_encoding \x20000000 +# #else +# wc_encoding \x00008000 +# #endif +# ct_encoding JISX0212.1990-0:GL; JISX0212.1990-0:GR +# } + +END XLC_XLOCALE + + + + +Reference + +[1] ISO/IEC 9899:1990 C Language Standard + + +[2] X Logical Font Descriptions + + + + + diff --git a/libX11/specs/i18n/trans/Makefile.am b/libX11/specs/i18n/trans/Makefile.am new file mode 100644 index 000000000..dfdf34f05 --- /dev/null +++ b/libX11/specs/i18n/trans/Makefile.am @@ -0,0 +1,32 @@ +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +if ENABLE_SPECS + +specdir = $(docdir)/$(subdir) +doc_sources = trans.xml +dist_spec_DATA = $(doc_sources) + +include $(top_srcdir)/specs/xmlrules.in + +endif ENABLE_SPECS diff --git a/libX11/specs/i18n/trans/trans.xml b/libX11/specs/i18n/trans/trans.xml new file mode 100644 index 000000000..9a01d97f6 --- /dev/null +++ b/libX11/specs/i18n/trans/trans.xml @@ -0,0 +1,1979 @@ + + + + + + + The XIM Transport Specification + Revision 0.1 + X Version 11, Release 7 + + + TakashiFujiwara + FUJITSU LIMITED + + + 1994FUJITSU LIMITED + 1994X Consortium + + Revision 0.1 + + + + +This specification describes the transport layer interfaces between Xlib and IM Server, +which makes various channels usable such as X protocol or TCP/IP, DECnet and etc. + + + + + + +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 Open Group shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from X Consortium. + + +X Window System is a trademark of The Open Group. + + + + + +X Transport Specification + + +Introduction + + + + + +The Xlib XIM implementation is layered into three functions, a protocol +layer, an interface layer and a transport layer. The purpose of this +layering is to make the protocol independent of transport implementation. +Each function of these layers are: + + + + + The protocol layer + + +implements overall function of XIM and calls the interface layer +functions when it needs to communicate to IM Server. + + + + + The interface layer + + +separates the implementation of the transport layer from the protocol +layer, in other words, it provides implementation independent hook for +the transport layer functions. + + + + + + The transport layer + + +handles actual data communication with IM Server. It is done by a set +of several functions named transporters. + + + + + + +This specification describes the interface layer and the transport +layer, which makes various communication channels usable such as +X protocol or, TCP/IP, DECnet, STREAM, etc., and provides +the information needed for adding another new transport layer. +In addition, sample implementations for the transporter using the +X connection is described in section 4. + + + + +Initialization + + +Registering structure to initialize + + +The structure typed as TransportSW contains the list of the transport +layer the specific implementations supports. + + + +typedef struct { + char *transport_name; + Bool (*config); +} TransportSW; + + + + + + + + + transport_name + name of transportRefer to "The Input Method Protocol: Appendix B + + + config + initial configuration function + + + + + + +A sample entry for the Xlib supporting transporters is shown below: + + + +TransportSW _XimTransportRec[] = { +/* char *: + * transport_name, Bool (*config)() + */ + "X", _XimXConf, + "tcp", _XimTransConf, + "local", _XimTransConf, + "decnet", _XimTransConf, + "streams", _XimTransConf, + (char *)NULL, (Bool (*)())NULL, +}; + + + + +Initialization function + + + + +The following function will be called once when Xlib configures the +transporter functions. + + + + + Bool (*config) + XIM im + char *transport_data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + transport_data + + + +Specifies the data specific to the transporter, in IM Server address.Refer to "The Input Method Protocol: Appendix B + + + + + + +This function must setup the transporter function pointers. + + + + +The actual config function will be chosen by IM Server at the +pre-connection time, matching by the transport_name specified +in the _XimTransportRec array; The specific members of XimProto +structure listed below must be initialized so that point they +appropriate transporter functions. + + + +If the specified transporter has been configured successfully, this +function returns True. There is no Alternative Entry for config +function itself. + + + +The structure XimProto contains the following function pointers: + + + +Bool (*connect)(); /* Open connection */ +Bool (*shutdown)(); /* Close connection */ +Bool (*write)(); /* Write data */ +Bool (*read)(); /* Read data */ +Bool (*flush)(); /* Flush data buffer */ +Bool (*register_dispatcher)(); /* Register asynchronous data handler */ +Bool (*call_dispatcher)(); /* Call dispatcher */ + + + +These functions are called when Xlib needs to communicate the +IM Server. These functions must process the appropriate procedure +described below. + + + + + +The interface/transport layer functions + +Following functions are used for the transport interface. + + + + The Transport Layer Functions + + + + + + + Alternate Entry (Interface Layer) + XimProto member (Transport Layer) + Section + + + + + _XimConnect + connect + 3.1 + + + _XimShutdown + shutdown + 3.2 + + + _XimWrite + write + 3.3 + + + _XimRead + read + 3.4 + + + _XimFlush + flush + 3.5 + + + _XimRegisterDispatcher + register_dispatcher + 3.6 + + + _XimCallDispatcher + call_dispatcher + 3.7 + + + +
+ + +The Protocol layer calls the above functions using the Alternative +Entry in the left column. The transport implementation defines +XimProto member function in the right column. The Alternative Entry is +provided so as to make easier to implement the Protocol Layer. + + + +Opening connection + + +When XOpenIM is called, the following function is called to connect +with the IM Server. + + + + + Bool (*connect) + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + +This function must establishes the connection to the IM Server. If the +connection is established successfully, this function returns True. +The Alternative Entry for this function is: + + + + + Bool _XimConnect + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + + +Closing connection + + + + + +When XCloseIM is called, the following function is called to +disconnect the connection with the IM Server. The Alternative Entry +for this function is: + + + + + Bool (*shutdown) + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + + +This function must close connection with the IM Server. If the +connection is closed successfully, this function returns True. The +Alternative Entry for this function is: + + + + + Bool _XimShutdown + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + + + +Writing data + +The following function is called, when Xlib needs to write data to the +IM Server. + + + + + Bool _XimWrite + XIM im + INT16 len + XPointer data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + len + + + +Specifies the length of writing data. + + + + + + data + + + +Specifies the writing data. + + + + + + +This function writes the data to the IM Server, regardless +of the contents. The number of bytes is passed to len. The +writing data is passed to data. If data is sent successfully, +the function returns True. Refer to "The Input Method Protocol" for +the contents of the writing data. The Alternative Entry for this +function is: + + + + + Bool _XimWrite + XIM im + INT16 len + XPointer data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + len + + + +Specifies the length of writing data. + + + + + + data + + + +Specifies the writing data. + + + + + + + +Reading data + +The following function is called when Xlib waits for response from IM +server synchronously. + + + + + Bool _XimRead + XIM im + XPointer read_buf + int buf_len + int *ret_len + + + + + + + im + + + +Specifies XIM structure address. + + + + + + read_buf + + + +Specifies the buffer to store data. + + + + + + buf_len + + + +Specifies the size of the buffer + + + + + + ret_len + + + +Specifies the length of stored data. + + + + + + +This function stores the read data in read_buf, which size is +specified as buf_len. The size of data is set to ret_len. +This function return True, if the data is read normally or reading +data is completed. + + +The Alternative Entry for this function is: + + + + + Bool _XimRead + XIM im + INT16 *ret_len + XPointer buf + int buf_len + Bool (*predicate)() + XPointer predicate_arg + + + + + + + im + + + +Specifies XIM structure address. + + + + + + ret_len + + + +Specifies the size of the data buffer. + + + + + + buf + + + +Specifies the buffer to store data. + + + + + + buf_len + + + +Specifies the length of buffer. + + + + + + predicate + + + +Specifies the predicate for the XIM data. + + + + + + predicate_arg + + + +Specifies the predicate specific data. + + + + + + + +The predicate procedure indicates whether the data is for the +XIM or not. len +This function stores the read data in buf, which size +is specified as buf_len. The size of data is set to +ret_len. If preedicate() +returns True, this function returns True. If not, it calls the registered callback function. + + + +The procedure and its arguments are: + + + + + + void (*predicate) + XIM im + INT16 len + XPointer data + XPointer predicate_arg + + + + + + + im + + + +Specifies XIM structure address. + + + + + + len + + + +Specifies the size of the data buffer. + + + + + + data + + + +Specifies the buffer to store data. + + + + + + predicate_arg + + + +Specifies the predicate specific data. + + + + + + + +Flushing buffer + +The following function is called when Xlib needs to flush the data. + + + + + void (*flush) + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + +This function must flush the data stored in internal buffer on the +transport layer. If data transfer is completed, the function returns +True. The Alternative Entry for this function is: + + + + + void _XimFlush + XIM im + + + + + + + im + + + +Specifies XIM structure address. + + + + + + + +Registering asynchronous data handler + +Xlib needs to handle asynchronous response from IM Server. This is +because some of the XIM data occur asynchronously to X events. + + + +Those data will be handled in the Filter, +and the Filter +will call asynchronous data handler in the protocol layer. Then it +calls dispatchers in the transport layer. The dispatchers are +implemented by the protocol layer. This function must store the +information and prepare for later call of the dispatchers using +_XimCallDispatcher. + + + +When multiple dispatchers are registered, they will be called +sequentially in order of registration, on arrival of asynchronous +data. The register_dispatcher is declared as following: + + + + + Bool (*register_dispatcher) + XIM im + Bool (*dispatcher)() + XPointer call_data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + dispatcher + + + +Specifies the dispatcher function to register. + + + + + + call_data + + + +Specifies a parameter for the dispatcher. + + + + + + +The dispatcher is a function of the following type: + + + + + Bool (*dispatcher) + XIM im + INT16 len + XPointer data + XPointer call_data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + len + + + +Specifies the size of the data buffer. + + + + + + data + + + +Specifies the buffer to store data. + + + + + + call_data + + + +Specifies a parameter passed to the register_dispatcher. + + + + + + +The dispatcher is provided by the protocol layer. They are called once +for every asynchronous data, in order of registration. If the data is +used, it must return True. otherwise, it must return False. + + + +If the dispatcher function returns True, the Transport Layer assume +that the data has been processed by the upper layer. The Alternative +Entry for this function is: + + + + + Bool _XimRegisterDispatcher + XIM im + Bool (*dispatcher)() + XPointer call_data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + dispatcher + + + +Specifies the dispatcher function to register. + + + + + + call_data + + + +Specifies a parameter for the dispatcher. + + + + + + + +Calling dispatcher + +The following function is used to call the registered dispatcher +function, when the asynchronous response from IM Server has arrived. + + + + + Bool (*call_dispatcher) + XIM im + INT16 len + XPointer data + + + + + + + im + + + +Specifies XIM structure address. + + + + + + len + + + +Specifies the size of data buffer. + + + + + + data + + + +Specifies the buffer to store data. + + + + + + +The call_dispatcher must call the dispatcher function, in order of +their registration. len and data are the data passed to +register_dispatcher. + + + +The return values are checked at each invocation, and if it finds +True, it immediately return with true for its return value. + + + +It is depend on the upper layer whether the read data is XIM +Protocol packet unit or not. +The Alternative Entry for this function is: + + + + + Bool _XimCallDispatcher + XIM im + INT16 len + XPointer call_data + + + + +
+ +Sample implementations for the Transport Layer + +Sample implementations for the transporter using the X connection is +described here. + + + +X Transport + +At the beginning of the X Transport connection for the XIM transport +mechanism, two different windows must be created either in an Xlib XIM +or in an IM Server, with which the Xlib and the IM Server exchange the +XIM transports by using the ClientMessage events and Window Properties. +In the following, the window created by the Xlib is referred as the +"client communication window", and on the other hand, the window created +by the IM Server is referred as the "IMS communication window". + + + +Connection + +In order to establish a connection, a communication window is created. +A ClientMessage in the following event's format is sent to the owner +window of XIM_SERVER selection, which the IM Server has created. + + + + +Refer to "The Input Method Protocol" for the XIM_SERVER atom. + + + + The ClientMessage sent to the IMS window. + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_CONNECT", false) + + + int + format + 32 + + + long + data.1[0] + client communication window ID + + + long + data.1[1] + client-major-transport-version(*1) + + + long + data.1[2] + client-major-transport-version(*1) + + + +
+ + +In order to establish the connection (to notify the IM Server communication +window), the IM Server sends a ClientMessage in the following event's +format to the client communication window. + + + + The ClientMessage sent by IM Server. + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_CONNECT", false) + + + int + format + 32 + + + long + data.1[0] + client communication window ID + + + long + data.1[1] + client-major-transport-version(*1) + + + long + data.1[2] + client-major-transport-version(*1) + + + long + data.1[3] + dividing size between ClientMessage and Property(*2) + + + +
+ + +(*1) major/minor-transport-version + + + +The read/write method is decided by the combination of +major/minor-transport-version, as follows: + + + +The read/write method and the major/minor-transport-version + + + + + + + + Transport-version + read/write + + + major + minor + + + + + + 0 + 0 + only-CM & Property-with-CM + + + 1 + only-CM & multi-CM + + + 2 + only-CM & multi-CM & Property-with-CM + + + 1 + 0 + PropertyNotify + + + 2 + 0 + only-CM & PropertyNotify + + + 1 + only-CM & multi-CM & PropertyNotify + + + +
+ + +only-CM : data is sent via a ClientMessage +multi-CM : data is sent via multiple ClientMessages +Property-with-CM : data is written in Property, and its Atom + is send via ClientMessage +PropertyNotify : data is written in Property, and its Atom + is send via PropertyNotify + + + + + +The method to decide major/minor-transport-version is as follows: + + + + + +The client sends 0 as major/minor-transport-version to the IM Server. +The client must support all methods in Table 4-3. +The client may send another number as major/minor-transport-version to +use other method than the above in the future. + + + + +The IM Server sends its major/minor-transport-version number to +the client. The client sends data using the method specified by the +IM Server. + + + + +If major/minor-transport-version number is not available, it is regarded +as 0. + + + + + +(*2) dividing size between ClientMessage and Property + + + +If data is sent via both of multi-CM and Property, specify the dividing +size between ClientMessage and Property. The data, which is smaller than +this size, is sent via multi-CM (or only-CM), and the data, which is +lager than this size, is sent via Property. + + +
+ + +read/write + +The data is transferred via either ClientMessage or Window Property in +the X Window System. + + + +Format for the data from the Client to the IM Server + +ClientMessage + + + +If data is sent via ClientMessage event, the format is as follows: + + + + The ClientMessage event's format (first or middle) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_MOREDATA", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : 20 byte) + + + +
+ + + + + The ClientMessage event's format (only or last) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : MAX 20 byte) +If the data is smaller +than 20 bytes, all data other than available data must be 0. + + + + + +
+ + +Property + + + +In the case of large data, data will be sent via the Window Property +for the efficiency. There are the following two methods to notify +Property, and transport-version is decided which method is used. + + + + + +The XChangeProperty function is used to store data in the client +communication window, and Atom of the stored data is notified to the +IM Server via ClientMessage event. + + + + +The XChangeProperty function is used to store data in the client +communication window, and Atom of the stored data is notified to the +IM Server via PropertyNotify event. + + + + + +The arguments of the XChangeProperty are as follows: + + + + + The XChangeProperty event's format + + + + + + + + Argument + Contents + + + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + property + read/write property Atom (*1) + + + int + format + 8 + + + int + mode + PropModeAppend + + + u_char + *data + read/write DATA + + + int + nelements + length of DATA + + + +
+ + +(*1) The read/write property ATOM allocates the following strings by +XInternAtom. +"_clientXXX" + + + +The client changes the property with the mode of PropModeAppend and +the IM Server will read it with the delete mode i.e. (delete = True). + + + +If Atom is notified via ClientMessage event, the format of the ClientMessage +is as follows: + + + + The ClientMessage event's format to send Atom of property + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + long + data.1[0] + length of read/write property Atom + + + long + data.1[1] + read/write property Atom + + + +
+
+ + +Format for the data from the IM Server to the Client + +ClientMessage + + + +The format of the ClientMessage is as follows: + + + + The ClientMessage event's format (first or middle) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_MOREDATA", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : 20 byte) + + + +
+ + + + + + + The ClientMessage event's format (only or last) + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + char + data.b[20] + (read/write DATA : MAX 20 byte) (*1) + + + +
+ + +(*1) If the data size is smaller than 20 bytes, all data other than available +data must be 0. + + + +Property + + + +In the case of large data, data will be sent via the Window Property +for the efficiency. There are the following two methods to notify +Property, and transport-version is decided which method is used. + + + + + +The XChangeProperty function is used to store data in the IMS +communication window, and Atom of the property is sent via the +ClientMessage event. + + + + +The XChangeProperty function is used to store data in the IMS +communication window, and Atom of the property is sent via +PropertyNotify event. + + + + + +The arguments of the XChangeProperty are as follows: + + + + The XChangeProperty event's format + + + + + + + + Argument + Contents + + + + + Display + *display + The display to which connects + + + Window + window + IMS communication window ID + + + Atom + property + read/write property Atom (*1) + + + int + format + 8 + + + int + mode + PropModeAppend + + + u_char + *data + read/write DATA + + + int + nelements + length of DATA + + + +
+ + +(*1) The read/write property ATOM allocates some strings, which are not +allocated by the client, by XInternAtom. + + + +The IM Server changes the property with the mode of PropModeAppend and +the client reads it with the delete mode, i.e. (delete = True). + + + +If Atom is notified via ClientMessage event, the format of the ClientMessage +is as follows: + + + + The ClientMessage event's format to send Atom of property + + + + + + + + Structure Member + Contents + + + + + int + type + ClientMessage + + + u_long + serial + Set by the X Window System + + + Bool + send_event + Set by the X Window System + + + Display + *display + The display to which connects + + + Window + window + IMS Window ID + + + Atom + message_type + XInternAtom(display, "_XIM_PROTOCOL", False) + + + int + format + 8 + + + long + data.1[0] + length of read/write property Atom + + + long + data.1[1] + read/write property Atom + + + +
+ +
+
+ +Closing Connection + + +If the client disconnect with the IM Server, shutdown function should +free the communication window properties and etc.. + + + +
+
+ + +References + +[1] Masahiko Narita and Hideki Hiura, "The Input Method Protocol" + + + +
+
diff --git a/libX11/specs/libX11/Makefile.am b/libX11/specs/libX11/Makefile.am index 76fa0f688..bd51baf1f 100644 --- a/libX11/specs/libX11/Makefile.am +++ b/libX11/specs/libX11/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), diff --git a/libX11/specs/libX11/glossary.xml b/libX11/specs/libX11/glossary.xml index 6f909b2b0..0ad46b73c 100644 --- a/libX11/specs/libX11/glossary.xml +++ b/libX11/specs/libX11/glossary.xml @@ -5,8 +5,8 @@ Glossary Access control list - Access control list + X maintains a list of hosts from which client programs can be run. By default, @@ -22,8 +22,8 @@ protocol name and data received by the server at connection setup. Active grab - Active grab + A grab is active when the pointer or keyboard is actually owned by the single grabbing client. @@ -32,8 +32,8 @@ single grabbing client. Ancestors - Ancestors + If W is an inferior of A, then A is an ancestor of W. @@ -41,8 +41,8 @@ If W is an inferior of A, then A is an ancestor of W. Atom - Atom + An atom is a unique ID corresponding to a string name. Atoms are used to identify properties, types, and selections. @@ -51,8 +51,8 @@ Atoms are used to identify properties, types, and selections. Background - Background + An InputOutput @@ -65,8 +65,8 @@ the server automatically tiles those regions with the background. Backing store - Backing store + When a server maintains the contents of a window, the pixels saved off-screen are known as a backing store. @@ -75,8 +75,8 @@ the pixels saved off-screen are known as a backing store. Base font name - Base font name + A font name used to select a family of fonts whose members may be encoded in various charsets. @@ -104,8 +104,8 @@ to load the fonts required to render text. Bit gravity - Bitgravity + When a window is resized, the contents of the window are not necessarily discarded. @@ -118,8 +118,8 @@ a window is known as bit gravity. Bit plane - Bitplane + When a pixmap or window is thought of as a stack of bitmaps, each bitmap is called a bit plane or plane. @@ -128,8 +128,8 @@ each bitmap is called a bit plane or plane. Bitmap - Bitmap + A bitmap is a pixmap of depth one. @@ -137,8 +137,8 @@ A bitmap is a pixmap of depth o Border - Border + An InputOutput @@ -151,8 +151,8 @@ Exposure events are never generated for border regions. Button grabbing - Buttongrabbing + Buttons on the pointer can be passively grabbed by a client. When the button is pressed, @@ -162,8 +162,8 @@ the pointer is then actively grabbed by the client. Byte order - Byteorder + For image (pixmap/bitmap) data, the server defines the byte order, @@ -177,8 +177,8 @@ and the server swaps bytes as necessary. Character - Character + A member of a set of elements used for the organization, control, or representation of text (ISO2022, as adapted by XPG3). @@ -189,8 +189,8 @@ until it is identified as part of a coded character set. Character glyph - Character glyph + The abstract graphical symbol for a character. Character glyphs may or may not map one-to-one to font glyphs, @@ -201,8 +201,8 @@ Multiple characters may map to a single character glyph. Character set - Character set + A collection of characters. @@ -210,8 +210,8 @@ A collection of characters. Charset - Charset + An encoding with a uniform, state-independent mapping from characters to codepoints. @@ -236,8 +236,8 @@ for example, ISO8859-1. Children - Children + The children of a window are its first-level subwindows. @@ -245,8 +245,8 @@ The children of a window are its first-level subwindows. Class - Class + Windows can be of different classes or types. See the entries for @@ -259,8 +259,8 @@ windows for further information about valid window types. Client - Client + An application program connects to the window system server by some interprocess communication (IPC) path, such as a TCP connection or a @@ -277,8 +277,8 @@ connection lifetimes, not by program lifetimes. Clipping region - Clipping region + In a graphics context, a bitmap or list of rectangles can be specified @@ -289,8 +289,8 @@ The image defined by the bitmap or rectangles is called a clipping region. Coded character - Coded character + A character bound to a codepoint. @@ -298,8 +298,8 @@ A character bound to a codepoint. Coded character set - Coded character set + A set of unambiguous rules that establishes a character set and the one-to-one relationship between each character of the set @@ -312,8 +312,8 @@ codepoints. Codepoint - Codepoint + The coded representation of a single character in a coded character set. @@ -321,8 +321,8 @@ The coded representation of a single character in a coded character set. Colormap - Colormap + A colormap consists of a set of entries defining color values. The colormap associated with a window is used to display the contents of @@ -336,8 +336,8 @@ that windows associated with those maps display with true colors. Connection - Connection + The IPC path between the server and client program is known as a connection. A client program typically (but not necessarily) has one @@ -347,8 +347,8 @@ connection to the server over which requests and events are sent. Containment - Containment + A window contains the pointer if the window is viewable and the hotspot of the cursor is within a visible region of the window or a @@ -361,8 +361,8 @@ but no inferior contains the pointer. Coordinate system - Coordinate system + The coordinate system has X horizontal and Y vertical, with the origin [0, 0] at the upper left. @@ -375,8 +375,8 @@ the origin is inside the border at the inside upper-left corner. Cursor - Cursor + A cursor is the visible shape of the pointer on a screen. It consists of a hotspot, a source bitmap, a shape bitmap, @@ -388,8 +388,8 @@ appearance when the pointer is in that window. Depth - Depth + The depth of a window or pixmap is the number of bits per pixel it has. The depth of a graphics context is the depth of the drawables it can be @@ -399,8 +399,8 @@ used in conjunction with graphics output. Device - Device + Keyboards, mice, tablets, track-balls, button boxes, and so on are all collectively known as input devices. @@ -413,8 +413,8 @@ and the pointer. DirectColor - DirectColor + DirectColor is a class of colormap in which a pixel value is decomposed into three @@ -429,13 +429,13 @@ changed dynamically. Display - Display +Displaystructure + A server, together with its screens and input devices, is called a display. The Xlib Display -Displaystructure structure contains all information about the particular display and its screens as well as the state that Xlib needs to communicate with the display over a particular connection. @@ -444,8 +444,8 @@ particular connection. Drawable - Drawable + Both windows and pixmaps can be used as sources and destinations in graphics operations. @@ -459,8 +459,8 @@ graphics operation. Encoding - Encoding + A set of unambiguous rules that establishes a character set and a relationship between the characters and their representations. @@ -488,8 +488,8 @@ Character Set. Escapement - Escapement + The escapement of a string is the distance in pixels in the primary draw direction from the drawing origin to the origin of the next @@ -499,8 +499,8 @@ character (that is, the one following the given string) to be drawn. Event - Event + Clients are informed of information asynchronously by means of events. These events can be either asynchronously generated from devices or @@ -515,8 +515,8 @@ Events are typically reported relative to a window. Event mask - Eventmask + Events are requested relative to a window. The set of event types a client requests relative to a window is described @@ -526,8 +526,8 @@ by using an event mask. Event propagation - Eventpropagation + Device-related events propagate from the source window to ancestor windows until some client has expressed interest in handling that type @@ -537,8 +537,8 @@ of event or until the event is discarded explicitly. Event source - Eventsource + The deepest viewable window that the pointer is in is called the source of a device-related event. @@ -547,8 +547,8 @@ the source of a device-related event. Event synchronization - Eventsynchronization + There are certain race conditions possible when demultiplexing device events to clients (in particular, deciding where pointer and keyboard @@ -561,8 +561,8 @@ device events. Exposure event - EventExposure + Servers do not guarantee to preserve the contents of windows when windows are obscured or reconfigured. @@ -573,8 +573,8 @@ of windows have been lost. Extension - Extension + Named extensions to the core protocol can be defined to extend the system. Extensions to output requests, resources, and event types are all possible @@ -584,8 +584,8 @@ and expected. Font - Font + A font is an array of glyphs (typically characters). The protocol does no translation or interpretation of character sets. @@ -597,8 +597,8 @@ and interline spacing. Font glyph - Font glyph + The abstract graphical symbol for an index into a font. @@ -606,8 +606,8 @@ The abstract graphical symbol for an index into a font. Frozen events - Frozen events + Clients can freeze event processing during keyboard and pointer grabs. @@ -615,8 +615,8 @@ Clients can freeze event processing during keyboard and pointer grabs. GC - GC + GC is an abbreviation for graphics context. See Graphics context. @@ -625,8 +625,8 @@ See Graphics context. Glyph - Glyph + An identified abstract graphical symbol independent of any actual image. (ISO/IEC/DIS 9541-1) @@ -637,8 +637,8 @@ not bound to a codepoint. Glyph image - Glyph image + An image of a glyph, as obtained from a glyph representation displayed on a presentation surface. @@ -648,8 +648,8 @@ on a presentation surface. Grab - Grab + Keyboard keys, the keyboard, pointer buttons, the pointer, and the server can be grabbed for exclusive use by a client. @@ -662,8 +662,8 @@ styles of user interfaces. Graphics context - Graphics context + Various information for graphics output is stored in a graphics context (GC), such as foreground pixel, background @@ -676,8 +676,8 @@ the graphics context. Gravity - Gravity + The contents of windows and windows themselves have a gravity, which determines how the contents move when a window is resized. @@ -688,8 +688,8 @@ See Bit gravity and GrayScale - GrayScale + GrayScale can be viewed as a degenerate case of @@ -702,8 +702,8 @@ The gray values can be changed dynamically. Host Portable Character Encoding - Host Portable Character Encoding + The encoding of the X Portable Character Set on the host. The encoding itself is not defined by this standard, @@ -716,8 +716,8 @@ in the host encoding. Hotspot - Hotspot + A cursor has an associated hotspot, which defines the point in the cursor corresponding to the coordinates reported for the pointer. @@ -726,8 +726,8 @@ cursor corresponding to the coordinates reported for the pointer. Identifier - Identifier + An identifier is a unique value associated with a resource that clients use to name that resource. @@ -737,8 +737,8 @@ The identifier can be used over any connection to name the resource. Inferiors - Inferiors + The inferiors of a window are all of the subwindows nested below it: the children, the children's children, and so on. @@ -747,8 +747,8 @@ the children, the children's children, and so on. Input focus - Inputfocus + The input focus is usually a window defining the scope for processing of keyboard input. @@ -764,8 +764,8 @@ of whatever screen the pointer is on at each keyboard event. Input manager - Inputmanager + Control over keyboard input is typically provided by an input manager client, which usually is part of a window manager. @@ -774,8 +774,8 @@ client, which usually is part of a window manager. InputOnly window - WindowInputOnly + An InputOnly @@ -792,8 +792,8 @@ windows as inferiors. InputOutput window - WindowInputOutput + An InputOutput @@ -809,8 +809,8 @@ windows as inferiors. Internationalization - Internationalization + The process of making software adaptable to the requirements of different native languages, local customs, and character string encodings. @@ -821,8 +821,8 @@ without program source modifications or recompilation. ISO2022 - ISO2022 + ISO standard for code extension techniques for 7-bit and 8-bit coded character sets. @@ -831,8 +831,8 @@ character sets. Key grabbing - Keygrabbing + Keys on the keyboard can be passively grabbed by a client. When the key is pressed, @@ -842,8 +842,8 @@ the keyboard is then actively grabbed by the client. Keyboard grabbing - Keyboardgrabbing + A client can actively grab control of the keyboard, and key events will be sent to that client rather than the client the events would @@ -853,8 +853,8 @@ normally have been sent to. Keysym - Keysym + An encoding of a symbol on a keycap on a keyboard. @@ -862,8 +862,8 @@ An encoding of a symbol on a keycap on a keyboard. Latin-1 - Latin-1 + The coded character set defined by the ISO8859-1 standard. @@ -871,8 +871,8 @@ The coded character set defined by the ISO8859-1 standard. Latin Portable Character Encoding - Latin Portable Character Encoding + The encoding of the X Portable Character Set using the Latin-1 codepoints plus ASCII control characters. @@ -884,8 +884,8 @@ not all of Latin-1. Locale - Locale + The international environment of a computer program defining the ``localized'' behavior of that program at run-time. @@ -917,8 +917,8 @@ Encoding and decoding for inter-client text communication Locale name - Locale name + The identifier used to select the desired locale for the host C library and X library functions. @@ -931,8 +931,8 @@ function. Localization - Localization + The process of establishing information within a computer system specific to the operation of particular native languages, local customs @@ -943,8 +943,8 @@ and coded character sets. Mapped - Mapped window + A window is said to be mapped if a map call has been performed on it. Unmapped windows and their inferiors are never viewable or visible. @@ -953,8 +953,8 @@ Unmapped windows and their inferiors are never viewable or visible. Modifier keys - Modifier keys + Shift, Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock, ShiftLock, and similar keys are called modifier keys. @@ -963,8 +963,8 @@ ShiftLock, and similar keys are called modifier keys. Monochrome - Monochrome + Monochrome is a special case of StaticGray @@ -974,8 +974,8 @@ in which there are only two colormap entries. Multibyte - Multibyte + A character whose codepoint is stored in more than one byte; any encoding which can contain multibyte characters; @@ -988,8 +988,8 @@ imply only that the strings may contain multibyte Obscure - Obscure + A window is obscured if some other window obscures it. A window can be partially obscured and so still have visible regions. @@ -1005,8 +1005,8 @@ Also note that window borders are included in the calculation. Occlude - Occlude + A window is occluded if some other window occludes it. Window A occludes window B if both are mapped, @@ -1023,8 +1023,8 @@ windows never obscure other windows but can occlude other windows. Padding - Padding + Some padding bytes are inserted in the data stream to maintain alignment of the protocol requests on natural boundaries. @@ -1034,8 +1034,8 @@ This increases ease of portability to some machine architectures. Parent window - Windowparent + If C is a child of P, then P is the parent of C. @@ -1043,8 +1043,8 @@ If C is a child of P, then P is the parent of C. Passive grab - Passive grab + Grabbing a key or button is a passive grab. The grab activates when the key or button is actually pressed. @@ -1053,8 +1053,8 @@ The grab activates when the key or button is actually pressed. Pixel value - Pixel value + A pixel is an N-bit value, where N is the number of bit planes used in a particular window or pixmap @@ -1066,8 +1066,8 @@ displayed. Pixmap - Pixmap + A pixmap is a three-dimensional array of bits. A pixmap is normally thought of as a two-dimensional array of pixels, @@ -1080,8 +1080,8 @@ A pixmap can only be used on the screen that it was created in. Plane - Plane + When a pixmap or window is thought of as a stack of bitmaps, each bitmap is called a plane or bit plane. @@ -1090,8 +1090,8 @@ bitmap is called a plane or bit plane. Plane mask - Planemask + Graphics operations can be restricted to only affect a subset of bit planes of a destination. @@ -1102,8 +1102,8 @@ The plane mask is stored in a graphics context. Pointer - Pointer + The pointer is the pointing device currently attached to the cursor and tracked on the screens. @@ -1112,8 +1112,8 @@ and tracked on the screens. Pointer grabbing - Pointergrabbing + A client can actively grab control of the pointer. Then button and motion events will be sent to that client @@ -1123,8 +1123,8 @@ rather than the client the events would normally have been sent to. Pointing device - Pointing device + A pointing device is typically a mouse, tablet, or some other device with effective dimensional motion. @@ -1135,8 +1135,8 @@ which tracks whatever pointing device is attached as the pointer. POSIX - POSIX + Portable Operating System Interface, ISO/IEC 9945-1 (IEEE Std 1003.1). @@ -1144,8 +1144,8 @@ Portable Operating System Interface, ISO/IEC 9945-1 (IEEE Std 1003.1). POSIX Portable Filename Character Set - POSIX Portable Filename Character Set + The set of 65 characters which can be used in naming files on a POSIX-compliant host that are correctly processed in all locales. @@ -1160,8 +1160,8 @@ a..z A..Z 0..9 ._- Property - Property + Windows can have associated properties that consist of a name, a type, a data format, and some data. @@ -1174,8 +1174,8 @@ hints, program names, and icon formats with a window manager. Property list - Property list + The property list of a window is the list of properties that have been defined for the window. @@ -1184,8 +1184,8 @@ been defined for the window. PseudoColor - PseudoColor + PseudoColor is a class of colormap in which a pixel value indexes the colormap entry to @@ -1197,8 +1197,8 @@ The RGB values can be changed dynamically. Rectangle - Rectangle + A rectangle specified by [x,y,w,h] has an infinitely thin outline path with corners at [x,y], [x+w,y], [x+w,y+h], and [x, y+h]. @@ -1214,8 +1214,8 @@ a single pixel would be drawn. Redirecting control - Redirecting control + Window managers (or client programs) may enforce window layout policy in various ways. @@ -1227,8 +1227,8 @@ rather than the operation actually being performed. Reply - Reply + Information requested by a client program using the X protocol is sent back to the client with a reply. @@ -1240,8 +1240,8 @@ but some requests generate multiple replies. Request - Request + A command to the server is called a request. It is a single block of data sent over a connection. @@ -1250,8 +1250,8 @@ It is a single block of data sent over a connection. Resource - Resource + Windows, pixmaps, cursors, fonts, graphics contexts, and colormaps are known as resources. @@ -1263,8 +1263,8 @@ connection over which the resource was created. RGB values - RGB values + RGB values are the red, green, and blue intensity values that are used to define a color. @@ -1276,8 +1276,8 @@ The X server scales these values to match the display hardware. Root - Root + The root of a pixmap or graphics context is the same as the root of whatever drawable was used when the pixmap or GC was created. @@ -1287,8 +1287,8 @@ The root of a window is the root window under which the window was created. Root window - Windowroot + Each screen has a root window covering it. The root window cannot be reconfigured or unmapped, @@ -1299,8 +1299,8 @@ A root window has no parent. Save set - Save set + The save set of a client is a list of other clients' windows that, if they are inferiors of one of the client's windows at connection @@ -1313,8 +1313,8 @@ lost windows if the manager should terminate abnormally. Scanline - Scanline + A scanline is a list of pixel or bit values viewed as a horizontal row (all values having the same y coordinate) of an image, with the @@ -1324,8 +1324,8 @@ values ordered by increasing the x coordinate. Scanline order - Scanlineorder + An image represented in scanline order contains scanlines ordered by increasing the y coordinate. @@ -1334,8 +1334,10 @@ increasing the y coordinate. Screen - Screen +Screenstructure +Displaystructure + A server can provide several independent screens, which typically have physically independent monitors. @@ -1343,19 +1345,17 @@ This would be the expected configuration when there is only a single keyboard and pointer shared among the screens. A Screen -Screenstructure structure contains the information about that screen and is linked to the Display -Displaystructure structure. Selection - Selection + A selection can be thought of as an indirect property with dynamic type. @@ -1387,8 +1387,8 @@ The protocol does not constrain the semantics. Server - Server + The server, which is also referred to as the X server, provides the basic windowing mechanism. @@ -1400,8 +1400,8 @@ and demultiplexes input back to the appropriate clients. Server grabbing - Servergrabbing + The server can be grabbed by a single client for exclusive use. This prevents processing of any requests from other client connections until @@ -1413,8 +1413,8 @@ pop-up menus, or executing requests indivisibly. Shift sequence - Shift sequence + ISO2022 defines control characters and escape sequences which temporarily (single shift) or permanently (locking shift) cause a @@ -1424,8 +1424,8 @@ different character set to be in effect (``invoking'' a character set). Sibling - Sibling + Children of the same parent window are known as sibling windows. @@ -1433,8 +1433,8 @@ Children of the same parent window are known as sibling windows. Stacking order - Stacking order + Sibling windows, similar to sheets of paper on a desk, can stack on top of each other. @@ -1445,8 +1445,8 @@ The relationship between sibling windows is known as the stacking order. State-dependent encoding - State-dependent encoding + An encoding in which an invocation of a charset can apply to multiple characters in sequence. @@ -1460,8 +1460,8 @@ this means use of locking shifts, not single shifts. State-independent encoding - State-independent encoding + Any encoding in which the invocations of the charsets are fixed, or span only a single character. @@ -1472,8 +1472,8 @@ this means use of at most single shifts, not locking shifts. StaticColor - StaticColor + StaticColor can be viewed as a degenerate case of @@ -1484,8 +1484,8 @@ in which the RGB values are predefined and read-only. StaticGray - StaticGray + StaticGray can be viewed as a degenerate case of @@ -1497,8 +1497,8 @@ The values are typically linear or near-linear increasing ramps. Status - Status + Many Xlib functions return a success status. If the function does not succeed, @@ -1508,8 +1508,8 @@ however, its arguments are not disturbed. Stipple - Stipple + A stipple pattern is a bitmap that is used to tile a region to serve as an additional clip mask for a fill operation with the foreground @@ -1527,9 +1527,9 @@ color. String Equivalence +String Equivalence -String Equivalence Two ISO Latin-1 STRING8 values are considered equal if they are the same length and if corresponding bytes are either equal or are equivalent as follows: decimal values 65 to 90 inclusive (characters ``A'' to ``Z'') are @@ -1545,8 +1545,8 @@ are pairwise equivalent to decimal values 246 to 254 inclusive Tile - Tile + A pixmap can be replicated in two dimensions to tile a region. The pixmap itself is also known as a tile. @@ -1555,8 +1555,8 @@ The pixmap itself is also known as a tile. Timestamp - Timestamp + A timestamp is a time value expressed in milliseconds. It is typically the time since the last server reset. @@ -1574,8 +1574,8 @@ This value is reserved for use in requests to represent the current server time. TrueColor - TrueColor + TrueColor can be viewed as a degenerate case of @@ -1589,8 +1589,8 @@ The values are typically linear or near-linear increasing ramps. Type - Type + A type is an arbitrary atom used to identify the interpretation of property data. @@ -1603,8 +1603,8 @@ and clients also can define new types. Viewable - Viewable + A window is viewable if it and all of its ancestors are mapped. This does not imply that any portion of the window is actually visible. @@ -1616,8 +1616,8 @@ backing store. Visible - Visible + A region of a window is visible if someone looking at the screen can actually see it; that is, the window is viewable and the region is not occluded @@ -1627,8 +1627,8 @@ by any other window. Whitespace - Whitespace + Any spacing character. On implementations that conform to the ANSI C library, @@ -1640,8 +1640,8 @@ returns true. Window gravity - Windowgravity + When windows are resized, subwindows may be repositioned automatically relative to some position in the @@ -1653,8 +1653,8 @@ as window gravity. Window manager - Windowmanager + Manipulation of windows on the screen and much of the user interface (policy) is typically provided by a window manager client. @@ -1663,8 +1663,8 @@ Manipulation of windows on the screen and much of the user interface X Portable Character Set - X Portable Character Set + A basic set of 97 characters which are assumed to exist in all locales supported by Xlib. This set contains the following characters: @@ -1686,8 +1686,8 @@ see the Host Port XLFD - XLFD + The X Logical Font Description Conventions that define a standard syntax for structured font names. @@ -1696,8 +1696,8 @@ for structured font names. XY format - XY format + The data for a pixmap is said to be in XY format if it is organized as a set of bitmaps representing individual bit planes with the planes @@ -1707,8 +1707,8 @@ appearing from most-significant to least-significant bit order. Z format - Z format + The data for a pixmap is said to be in Z format if it is organized as a set of pixel values in scanline order. diff --git a/libX11/specs/macros.t b/libX11/specs/macros.t deleted file mode 100644 index 7d5562f54..000000000 --- a/libX11/specs/macros.t +++ /dev/null @@ -1,225 +0,0 @@ -.\" macros.t -- macros for X Consortium documents -.\" Revised and commented by smarks 93.12.20. -.\" -.\" global setup: set ragged right, assign string variables -.\" -.na -.ie n \{\ -.ds Q \&" -.ds U \&" -.ds - \%-- -.\} -.el \{\ -.ds Q `\h'-\w'\^'u'` -.ds U '\h'-\w'\^'u'' -.ds - \(em -.\} -.\" -.\" --- Ds --- displayed text (like .DS) with no keep -.\" .Ds is obsolete. Change to something from this table: -.\" for this use instead -.\" .Ds .ID -.\" .Ds n .LD (where "n" is a number) -.\" (Numbers don't work in these macros, so ".Ds 5" -.\" comes out the same as ".Ds 0".) -.\" -.de Ds -.nf -.\\$1D \\$2 \\$1 -.ft 1 -.ps \\n(PS -.if \\n(VS>=40 .vs \\n(VSu -.if \\n(VS<=39 .vs \\n(VSp -.. -.de D -.ID \\$1 -.. -.de 0D -.LD -.. -.\" backward compatibility for the Xt spec -.de 5D -.LD -.. -.\" -.\" --- De --- obsolete: use .DE instead -.\" -.de De -.DE -.. -.\" -.\" --- FD --- -.\" -.de FD -.LP -.KS -.TA .5i 3i -.ta .5i 3i -.nf -.. -.\" -.\" --- FN --- -.\" -.de FN -.fi -.KE -.LP -.. -.\" -.\" --- IN --- send an index entry to the stderr -.\" -.de IN -.tm \\n%:\\$1:\\$2:\\$3 -.. -.\" -.\" --- C{ --- -.\" -.de C{ -.KS -.nf -.D -.\" -.\" choose appropriate monospace font -.\" the imagen conditional, 480, -.\" may be changed to L if LB is too -.\" heavy for your eyes... -.\" -.ie "\\*(.T"480" .ft L -.el .ie "\\*(.T"300" .ft L -.el .ie "\\*(.T"202" .ft PO -.el .ie "\\*(.T"aps" .ft CW -.el .ft R -.ps \\n(PS -.ie \\n(VS>40 .vs \\n(VSu -.el .vs \\n(VSp -.. -.\" -.\" --- C} --- -.\" -.de C} -.DE -.R -.. -.\" -.\" --- Pn --- like PN, but use $2; $1 and $3 abut -.\" -.de Pn -.IN \\$2 -.ie t \\$1\fB\^\\$2\^\fR\\$3 -.el \\$1\fI\^\\$2\^\fP\\$3 -.. -.\" -.\" --- PN --- put $1 in boldface and add index entry; $2 abuts -.\" -.de PN -.IN \\$1 -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.\" -.\" --- hI --- add index entry for $1 as header file -.\" -.de hI -.IN <\\$1> -.IN Files <\\$1> -.IN Headers <\\$1> -.. -.\" -.\" --- hN --- put $1 in boldface as header and add index entry; $2 abuts -.\" -.de hN -.hI \\$1 -.ie t <\fB\\$1\fR>\\$2 -.el <\fI\\$1\fP>\\$2 -.. -.\" -.\" --- NT --- -.\" -.de NT -.br -.ne 7 -.ds NO Note -.if \\n(.$ .ds NO \\$1 -.ie n .sp -.el .sp 10p -.ce -\\*(NO -.ie n .sp -.el .sp 5p -.if '\\$1'C' .ce 99 -.if '\\$2'C' .ce 99 -.\" .QS/.QE macros don't exist in older versions of -ms -.ie \\n(GS .QS -.el \{\ -. in +5n -. ll -5n -.\} -.R -.. -.\" -.\" --- NE --- Note End (doug kraft 3/85) -.\" -.de NE -.ce 0 -.ie \\n(GS .QE -.el \{\ -. in -5n -. ll +5n -.\} -.ie n .sp -.el .sp 10p -.. -.\" -.\" --- nH --- numbered header (like NH) but with automatic TOC entry -.\" usage: .nH level "section title, preferable in quotes" -.\" -.de nH -.NH \\$1 -\\$2 -.XS -\\*(SN \\$2 -.XE -.. -.\" -.\" --- sM --- put start-marker in margin -.\" -.de sM -.KS -.sp 1 -\\h'-0.5i'\\L'-1v'\\v'1p'\\l'1v'\\v'1v-1p' -.sp -1 -.. -.\" -.\" --- eM --- put end-marker in margin -.\" -.de eM -.sp -1 -\\h'-0.5i'\\L'-1v'\\v'1v+1p'\\l'1v'\\v'-1p' -.sp 1 -.KE -.. -.\" -.\" --- YZ --- finish up; $1 is the starting page number of the TOC -.\" -.de YZ -. \" Force there to be an even number of pages, so the table of -. \" contents doesn't end up on the back of the last page in -. \" the case of duplex printing. -.if o .bp -. \" Emit a .pn directive with one plus the last page number. - \" This will be the number of the first page of the index. -.nr YZ \\n%+1 -.tm .pn \\n(YZ -. \" Issue the table of contents, setting roman numerals, -. \" and redefining the footer to use them. -.bp \\$1 -.af PN i -.EF ''\\\\\\\\n(PN'' -.OF ''\\\\\\\\n(PN'' -. \" Why all the backslashes? This string is evaluated -. \" three times: 1) during the definition of this macro, -. \" 2) when the .EF and .OF macros are expanded, and 3) -. \" when the bottom-of-page trap is invoked. Thus, -. \" eight backslashes are reduced to one in the final output. -.PX -.. diff --git a/libX11/specs/troffrules.in b/libX11/specs/troffrules.in deleted file mode 100644 index 3e643ecdc..000000000 --- a/libX11/specs/troffrules.in +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# -# 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 (including the next -# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. -# - -# Based on xc/doc/specs/*/Makefile from X11R6.9 - -EXTRA_DIST = $(doc_sources) - -if HAVE_PS2PDF -printable_format = .pdf -else -printable_format = .ps -endif - -if ENABLE_SPECS -if HAVE_GROFF_MS -spec_DATA = $(doc_sources:.ms=.txt) \ - $(doc_sources:.ms=$(printable_format)) \ - $(doc_sources:.ms=.html) -specdir = $(docdir)/$(subdir) -imagesdir = $(specdir)/images - -CLEANFILES = $(spec_DATA) -MOSTLYCLEANFILES = index.* - -# Install html generated images for specs -install-data-local: - test -z "$(imagesdir)" || $(mkdir_p) "$(DESTDIR)$(imagesdir)" - @d="$(srcdir)/images/"; \ - list=`ls $$d`; \ - for p in $$list; do \ - echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(imagesdir)/$$p'"; \ - $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(imagesdir)/$$p"; \ - done; - -uninstall-local: - @if test -n $(DESTDIR)$(imagesdir); then \ - if test -d $(DESTDIR)$(imagesdir); then \ - list=`ls $(DESTDIR)$(imagesdir)`; \ - for p in $$list; do \ - echo " rm -f '$(DESTDIR)$(imagesdir)/$$p'"; \ - rm -f "$(DESTDIR)$(imagesdir)/$$p"; \ - done \ - fi; \ - fi; - -mostlyclean-local: - @rm -fr images - -# Pass version string as a troff string for substitution -GROFF_DEFS = -dxV="$(PACKAGE_STRING)" - -# -e to run through eqn, -t to run through tbl -GROFF_FLAGS = -e -t -ms $(GROFF_DEFS) -I$(srcdir) $(top_srcdir)/specs/macros.t - -SUFFIXES = .ms .ps .txt .html .pdf - -.ms.ps: - -$(AM_V_GEN) $(GROFF) -Tps $(GROFF_FLAGS) $< 2> index.$@.raw > $@ - @if grep '^[^1-9.]' index.$@.raw | grep -v warning; then exit 1; \ - else test $$? -le 1; fi - -.ms.txt: - $(AM_V_GEN) env GROFF_NO_SGR=TRUE $(GROFF) -Tutf8 $(GROFF_FLAGS) \ - $< 2> index.$@.raw > $@ - -.ms.html: - $(AM_V_GEN) $(GROFF) $(GROFF_FLAGS) -Thtml -P-Dimages -P-I$*-image $< 2> index.$@.raw > $@ - -.ps.pdf: - $(AM_V_GEN) $(PS2PDF) $< $@ - -endif HAVE_GROFF_MS -endif ENABLE_SPECS diff --git a/libXdmcp/Makefile.am b/libXdmcp/Makefile.am index 4dfd0453a..118368ee6 100644 --- a/libXdmcp/Makefile.am +++ b/libXdmcp/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS=doc + lib_LTLIBRARIES = libXdmcp.la AM_CPPFLAGS = -I${top_srcdir}/include diff --git a/libXdmcp/configure.ac b/libXdmcp/configure.ac index 1b136320f..a005627ad 100644 --- a/libXdmcp/configure.ac +++ b/libXdmcp/configure.ac @@ -33,6 +33,10 @@ m4_ifndef([XORG_MACROS_VERSION], [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.3) XORG_DEFAULT_OPTIONS +XORG_ENABLE_DOCS +XORG_WITH_XMLTO(0.0.20) +XORG_WITH_FOP +XORG_CHECK_SGML_DOCTOOLS(1.5) AC_PROG_CC AC_PROG_INSTALL @@ -61,4 +65,5 @@ XORG_WITH_LINT XORG_LINT_LIBRARY([Xdmcp]) AC_OUTPUT([Makefile + doc/Makefile xdmcp.pc]) diff --git a/libXdmcp/doc/Makefile.am b/libXdmcp/doc/Makefile.am new file mode 100644 index 000000000..ca5f7c9f3 --- /dev/null +++ b/libXdmcp/doc/Makefile.am @@ -0,0 +1,64 @@ +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +if ENABLE_DOCS +doc_sources = xdmcp.xml +dist_doc_DATA = $(doc_sources) + +if HAVE_XMLTO +doc_DATA = $(doc_sources:.xml=.html) + +if HAVE_FOP +doc_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf) +endif + +if HAVE_XMLTO_TEXT +doc_DATA += $(doc_sources:.xml=.txt) +endif + +if HAVE_STYLESHEETS +XMLTO_FLAGS = -m $(XSL_STYLESHEET) + +doc_DATA += xorg.css +xorg.css: $(STYLESHEET_SRCDIR)/xorg.css + $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@ +endif + +CLEANFILES = $(doc_DATA) + +SUFFIXES = .xml .ps .pdf .txt .html + +.xml.txt: + $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $< + +.xml.html: + $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $< + +.xml.pdf: + $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $< + +.xml.ps: + $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $< + +endif HAVE_XMLTO +endif ENABLE_DOCS diff --git a/libXdmcp/doc/xdmcp.xml b/libXdmcp/doc/xdmcp.xml new file mode 100644 index 000000000..2b08ed7a7 --- /dev/null +++ b/libXdmcp/doc/xdmcp.xml @@ -0,0 +1,3895 @@ + + + + + + + X Display Manager Control Protocol + X.Org Standard + Version 1.1 + + + KeithPackard + +X Consortium, +Laboratory for Computer Science, +Massachusetts Institute of Technology + + + + + 1989The Open Group + 2004The Open Group + X Version 11, Release 6.8 + + + + + + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + + +X Window System is a trademark of The Open Group. + + + + + +TITLE + +Purpose and Goals + + + + + +The purpose of the X Display Manager Control Protocol (XDMCP) +is to provide a uniform mechanism for an autonomous +display to request login service from a remote host. +By autonomous, we mean +the display consists of hardware and processes that are independent of any +particular host where login service is desired. (For example, the server +cannot simply be started by a +fork/exec +sequence on the host.) +An X terminal (screen, keyboard, mouse, processor, network interface) +is a prime example of an autonomous display. + + + +From the point of view of the end user, it is very important to make +autonomous displays as easy to use as traditional hardwired character +terminals. Specifically, you can typically just power on a hardwired +terminal and be greeted with a login prompt. The same should be possible +with autonomous displays. However, in a network environment with multiple +hosts, the end user may want to choose which host(s) to connect to. In an +environment with many displays and many hosts, a site administrator may want +to associate particular collections of hosts with particular displays. We +would like to support the following options: + + + + + +The display has a single, fixed host to which it should connect. It should be +possible to power on the display and receive a login prompt, without user +intervention. + + + + +Any one of several hosts on a network or subnetwork may be acceptable +for accepting login from the display. +(For example, the user's file systems can be mounted onto +any such host, providing comparable environments.) It should be possible +for the display to broadcast to find such hosts and to have the display +either automatically choose a host or present the possible hosts to the +user for selection. + + + + +The display has a fixed set of hosts that it can connect to. It should be +possible for the display to have that set stored in RAM, but it should also be +possible for a site administrator to be able to maintain host sets for a +large number of displays using a centralized facility, without having to +interact (physically or electronically) with each individual display. +Particular hosts should be allowed to refuse login service, based on +whatever local criteria are desired. + + + + + +The control protocol should be designed in such a way that it can be used over +a reasonable variety of communication transport layers. In fact, it is quite +desirable if every major network protocol family that supports the standard X +protocol is also capable of supporting XDMCP, because the end result of XDMCP +negotiation will be standard X protocol connections to the display. +However, because the number of displays per host may be large, +a connection-based protocol appears less desirable +than a connection-less protocol. For this reason the protocol is designed +to use datagram services with the display responsible for sequencing and +retransmission. + + + +To keep the burden on displays at a minimum (because display cost is not +a factor that can be ignored), it is desirable that displays not be required +to maintain permanent state (across power cycles) for the purposes +of the control protocol, +and it is desirable to keep required state at a minimum while the +display is powered on. + + + +Security is an important consideration and must be an integral part of the +design. The important security goals in the context of XDMCP are: + + + + +It should be possible for the display to verify that it is communicating +with a legitimate host login service. Because the user will present +credentials (for example, password) to this service, +it is important to avoid spoof attacks. + + + + +It should be possible for the display and the login service to negotiate the +authorization mechanism to be used for the standard X protocol. + + + + +It should be possible to provide the same level of security in verifying the +login service as is provided by the negotiated authorization mechanism. + + + + +Because there are no firm standards yet in the area of security, +XDMCP must be flexible enough to accomodate a variety of security mechanisms. + + + + + + +Overview of the Protocol + + + + + +XDMCP is designed to provide authenticated access to display management +services for remote displays. A new network server, called a \fIDisplay +Manager\fP, will use XDMCP to communicate with displays to negotiate the +startup of X sessions. The protocol allows the display to authenticate the +manager. It also allows most of the configuration information to be +centralized with the manager and to ease the burden of system administration +in a large network of displays. +The essential goal is to provide plug-and-play +services similar to those provided in the familiar mainframe/terminal world. + + + +Displays may be turned off by the user at any time. Any existing session +running on a display that has been turned off must be identifiable. This +is made possible by requiring a three-way handshake to start a session. If +the handshake succeeds, any existing session is terminated immediately and a +new session started. There is the problem (at least with TCP) that +connections may not be closed when the display is turned off. In most +environments, the manager should reduce this problem by periodically XSync'ing +on its own connection, perhaps every five to ten minutes, and terminating the +session if its own connection ever closes. + + + +Displays should not be required to retain permanent state for purposes of +the control protocol. One solution to packets received out of sequence +would be to use monotonically increasing message identifiers in each message +to allow both sides to ignore messages that arrive out-of-sequence. For +this to work, displays would at a minimum have to increment a stable crash +count each time they are powered on and use that number as part of a +larger sequence number. But if displays cannot retain permanent state this +cannot work. Instead, the manager assumes the responsibility for permanent +state by generating unique numbers that identify a particular session and +the protocol simply ignores packets that correspond to an invalid session. + + + +The Manager must not be responsible for packet reception. To prevent the +Manager from becoming stuck because of a hostile display, no portion of the +protocol requires the Manager to retransmit a packet. Part of this means +that any valid packet that the Manager does receive must be +acknowledged in some way to prevent the display from continuously resending +packets. The display can keep the protocol running as it will always know +when the Manager has received (at least one copy of) a packet. On the +Manager side, this means that any packet may be received more than once (if +the response was lost) and duplicates must be ignored. + + + + +Data Types + + + + + +XDMCP packets contain several types of data. Integer values are always +stored most significant byte first in the packet ("Big Endian" order). +As XDMCP will not be used to transport large quantities of data, this +restriction will not substantially hamper the efficiency of any +implementation. Also, no padding of any sort will occur within the packets. + + + + + + + + + + Type Name + Length (Bytes) + Description + + + + + CARD8 + 1 + A single byte unsigned integer + + + CARD16 + 2 + Two byte unsigned integer + + + CARD32 + 4 + Four byte unsigned integer + + + ARRAY8 + n+2 + +This is actually a CARD16 followed by +a collection of CARD8. The value of the CARD16 +field (n) specifies the number of CARD8 values to follow + + + + ARRAY16 + 2*m+1 + +This is a CARD8 (m) which specifies the +number of CARD16 values to follow + + + + ARRAY32 + 4*l+1 + +This is a CARD8 (l) which specifies the +number of CARD32 values to follow + + + + ARRAYofARRAY8 + ? + +This is a CARD8 which specifies the +number of ARRAY8 values to follow. + + + + + + + + +Packet Format + + + + +All XDMCP packets have the following information: + + + + + + + + + + Length (Bytes) + Field Type + Description + + + + + 2 + CARD16 + version number + + + 2 + CARD16 + opcode packet header + + + 2 + CARD16 + n = length of remaining data in bytes + + + n + ??? + packet-specific data + + + + + + + +The fields are as follows: + + + + + Version number + + +This specifies the version of XDMCP that generated this packet in +case changes in this protocol are required. Displays and +managers may choose to support older versions for compatibility. +This field will initially be one (1). + + + + + Opcode + + +This specifies what step of the protocol this packet represents and should +contain one of the following values (encoding provided in section below): +BroadcastQuery, +Query, +IndirectQuery, +ForwardQuery, +Willing, +Unwilling, +Request, +Accept, +Decline, +Manage, +Refuse, +Failed, +KeepAlive +or +Alive. + + + + + Length of data in bytes + + +This specifies the length of the information following the first 6 bytes. +Each packet-type has a different format and will need to be separately +length-checked against this value. Because every data item has either an +explicit or implicit length, this can be easily accomplished. +Packets that have too little or too much data should be ignored. + + + + + +Packets should be checked to make sure that they satisfy the following +conditions: + + + + + +They must contain valid opcodes. + + + + +The length of the remaining data should correspond to the sum of the +lengths of the individual remaining data items. + + + + +The opcode should be expected (a finite state diagram is given +in a later section). + + + + +If the packet is of type +Manage or +Refuse, +the Session ID should match the value sent in the preceding +Accept packet. + + + + + + +Protocol + + + + +Each of the opcodes is described below. Because a given packet type is only +ever sent one way, each packet description below indicates the direction. +Most of the packets have additional information included beyond the +description above. The additional information is appended to the packet +header in the order described without padding, and the length field is +computed accordingly. + + + + + + + + + + + + + + + + + + + + + + Query + + + BroadcastQuery + + + IndirectQuery + + + + Display -> Manager + + + + Additional Fields: + + + + + +Authentication Names: ARRAYofARRAY8 + + + + + + + +Specifies a list of authentication names that the display supports. The +manager will choose one of these and return it in the +Willing packet. + + + + + + + Semantics + + + + + + + +A Query +packet is sent from the display to a specific host to ask if +that host is willing to provide management services to this display. The +host should respond with +Willing +if it is willing to service the display or +Unwilling +if it is not. + + + +A +BroadcastQuery +packet is similar to the +Query +packet except that it is intended to be received by all hosts on the network +(or subnetwork). However, unlike +Query +requests, hosts that are not willing to service the display +should simply ignore +BroadcastQuery +requests. + + + +An +IndirectQuery +packet is sent to a well known manager that forwards +the request to a larger collection of secondary managers using +ForwardQuery +packets. +In this way, the collection of managers that respond can be grouped +on other than network boundaries; the use of a central manager reduces +system administrative overhead. +The primary manager may also send a +Willing +packet in response to this packet. + + + +Each packet type has slightly different semantics: + + + + + + + + + + +The +Query +packet is destined only for a single host. +If the display is instructed to +Query +multiple managers, it will send multiple +Query +packets. The +Query +packet also demands a response from the manager, either +Willing +or +Unwilling. + + +The +BroadcastQuery +packet is sent to many hosts. +Each manager that receives this packet will not respond with an +Unwilling +packet. + + +The +IndirectQuery +packet is sent to only one manager with the request +that the request be forwarded to a larger list of managers using +ForwardQuery +packets. This list is expected to be maintained at one +central site to reduce administrative overhead. +The function of this packet type is similar to +BroadcastQuery except that +BroadcastQuery +is not forwarded. + + + + + + + + Valid Responses: + + + + + +Willing, +Unwilling + + + + + + + Problems/Solutions: + + + + + Problem: + + + + + + +Not all managers receive the query packet. +Indication: + + + + + + + + +None if +BroadcastQuery +or +IndirectQuery +was sent, else failure to receive +Willing. + + + + + + + Solution: + + + + + + + +Repeatedly send the packet while waiting for user to choose a manager. + + + + + + +Timeout/Retransmission policy: + + + + + + + +An exponential backoff algorithm should be used here to reduce network load +for long-standing idle displays. Start at 2 seconds, back off by factors of +2 to 32 seconds, and discontinue retransmit after 126 seconds. The display +should reset the timeout when user-input is detected. In this way, the +display will wakeup when touched by the user. + + + + +ForwardQuery + + + + + +Primary Manager -> Secondary Manager +Additional Fields: + + + + + + +Client Address: ARRAY8 + + + + + + + +Specifies the network address of the client display. + + + + + + +Client Port: ARRAY8 + + + + + + + +Specifies an identification of the client task on the client display. + + + + + + +Authentication Names: ARRAYofARRAY8 + + + + + + + +Is a duplicate of Authentication Names array that was received +in the +IndirectQuery +packet. + + + + + +Semantics: + + + + + + + +When primary manager receives a +IndirectQuery +packet, it is responsible for sending +ForwardQuery +packets to an appropriate list of +managers that can provide service to the display using the same network +type as the one the original +IndirectQuery +packet was received from. +The Client Address and Client Port fields must contain an +address that the secondary manager can use to reach the display also using +this same network. Each secondary manager sends a +Willing +packet to the display if it is willing to provide service. + + + +ForwardQuery +packets are similar to +BroadcastQuery +packets in that managers that are not willing to service +particular displays should not send a +Unwilling +packet. + + + + + + +Valid Responses: + + + + + + + +Willing + + + + + +Problems/Solutions: + + + + + + +Identical to +BroadcastQuery + + + + + +Timeout/Retransmission policy: + + + + + + +Like all packets sent from a manager, this packet should never be +retransmitted. + + + + + +Willing + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Authentication Name: ARRAY8 + + + + + + + + + +Specifies the authentication method, selected from the list offered in the +Query , +BroadcastQuery , +or +IndirectQuery +packet that the manger expects the display to use in the subsequent +Request +packet. +This choice should remain as constant as feasible so that displays that +send multiple +Query +packets can use the Authentication Name from any +Willing +packet that arrives. + + +The display is free to ignore managers that request an insufficient level +of authentication. + + + + + + + + +Hostname: ARRAY8 + + + + + + + + +Is a human readable string describing the host from which the packet was sent. +The protocol specifies no interpretation of the data in this field. + + + + + + + +Status: ARRAY8 + + + + + + + + +Is a human readable string describing the status of the host. This could +include load average/number of users connected or other information. The +protocol specifies no interpretation of the data in this field. + + + + + + + +Semantics: + + + + + + + +A +Willing +packet is sent by managers that may service connections from +this display. It is sent in response to either a +Query , +BroadcastQuery , +or +ForwardQuery +but does not imply a commitment to provide service +(for example, it may later decide that it has accepted enough +connections already). + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + + +Willing +not received by the display. + + +Indication: + + + + + + + + + + +None if +BroadcastQuery +or +IndirectQuery +was sent, else failure to receive +Willing . + + + + + + + + +Solution: + + + + + + + + + +The display should continue to send the query until a response is received. + + + + + + + + +Timeout/Retransmission policy: + + + + + + + +Like all packets sent from the manager to the display, this packet should +never be retransmitted. + + + + + +Unwilling + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +The Hostname and Status fields as in the +Willing +packet. +The Status field should indicate to the user a reason +for the refusal of service. + + + + + + +Semantics: + + + + + + + +An +Unwilling +packet is sent by managers in response to direct +Query +requests (as opposed to +BroadcastQuery +or +IndirectQuery +requests) if the manager will not accept requests for management. +This is typically sent by managers that wish to only service +particular displays or that handle a limited number of displays at once. + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + + +Unwilling +not received by the display. + + +Indication: + + + + + + + + + + +Display fails to receive +Unwilling . + + + + + + + + +Solution: + + + + + + + + + +The display should continue to send +Query +messages until a response is received. + + + + + + +Timeout/Retransmission policy: + + + + + + + +Like all packets sent from the manager to the display, this packet should +never be retransmitted. + + + + +Request + + + + + + + +Display -> Manager + + +Additional Fields: + + + + + + + + +Display Number: CARD16 + + + + + + + + +Specifies the index of this particular server for the host +on which the display is resident. +This value will be zero for most autonomous displays. + + + + + + + +Connection Types: ARRAY16 + + + + + + + + +Specifies an array indicating the stream services accepted by the display. +If the high-order byte in a particular entry is zero, the low-order byte +corresponds to an X-protocol host family type. + + + + + + + +Connection Addresses: ARRAYofARRAY8 + + + + + + + + +For each connection type in the previous array, the corresponding entry in +this array indicates the network address of the display device. + + + + + + + + +Authentication Name: ARRAY8 + + +Authentication Data: ARRAY8 + + + + + + + + + +Specifies the authentication protocol that the display expects +the manager to validate itself with. The Authentication Data is +expected to contain data that the manager will interpret, modify +and use to authenticate itself. + + + + + + + +Authorization Names: ARRAYofARRAY8 + + + + + + + + +Specifies which types of authorization the display supports. The +manager may decide to reject displays with which it cannot perform +authorization. + + + + + + + +Manufacturer Display ID: ARRAY8 + + + + + + + + +Can be used by the manager to determine how to decrypt the +Authentication Data field in this packet. See the section below on +Manufacturer Display ID Format. + + + + + + +Semantics: + + + + + + + +A +Request +packet is sent by a display to a specific host to request a +session ID in preparation for a establishing a connection. If the manager +is willing to service a connection to this display, it should return an +Accept +packet with a valid session ID and should be ready for a subsequent +Manage +request. Otherwise, it should return a +Decline +packet. + + + + + + +Valid Responses: + + + + + + + +Accept , +Decline + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + +Request not received by manager. + + + + + + + + +Indication: + + + + + + + + + +Display timeout waiting for response. + + + + + + + + +Solution: + + + + + + + + + +Display resends +Request +message. + + + + + + + + + +Problem: + + + + + + + + + +Message received out of order by manager. + + + + + + + + +Indication: + + + + + + + + + +None. + + + + + + + + +Solution: + + + + + + + + + +Each time a +Request +is sent, the manager sends the Session ID +associated with the next session in the +Accept . +If that next session is not yet started, +the manager will simply resend with the same Session ID. +If the session is in progress, the manager will reply +with a new Session ID; in which case, the +Accept +will be discarded by the display. + + + + + + +Timeout/Retransmission policy: + + + + + + + +Timeout after 2 seconds, exponential backoff to 32 seconds. +After no more than 126 seconds, give up and report an error to the user. + + + + + +Accept + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Session ID: CARD32 + + + + + + + + +Identifies the session that can be started by the manager. + + + + + + + + +Authentication Name: ARRAY8 + + +Authentication Data: ARRAY8 + + + + + + + + + +Is the data sent back to the display to authenticate the manager. +If the Authentication Data is not the value expected by the display, it +should terminate the protocol at this point and display an error to the user. + + + + + + + + +Authorization Name: ARRAY8 + + +Authorization Data: ARRAY8 + + + + + + + + + +Is the data sent to the display to indicate the type of authorization the +manager will be using in the first call to +XOpenDisplay +after the +Manage +packet is received. + + + + + + + +Semantics: + + + + + + + + +An +Accept +packet is sent by a manager in response to a +Request +packet if the manager is willing to establish a connection for the display. +The Session ID is used to identify this connection from any preceding +ones and will be used by the display in its subsequent +Manage +packet. +The Session ID is a 32-bit number that is incremented each time an +Accept +packet is sent as it must be unique over a reasonably long period of time. + + +If the authentication information is invalid, a +Decline +packet will be returned with an appropriate +Status +message. + + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + +Accept +or +Decline +not received by display. + + + + + + + + +Indication: + + + + + + + + + +Display timeout waiting for response to +Request . + + + + + + + + +Solution: + + + + + + + + + +Display resends +Request +message. + + + + + + + +Problem: + + + + + + + + +Message received out of order by display. + + + + + + + + +Indication: + + + + + + + + + +Display receives +Accept +after +Manage +has been sent. + + + + + + + + +Solution: + + + + + + + + + +Display discards +Accept +messages after it has sent a +Manage +message. + + + + + + +Timeout/Retransmission policy: + + + + + + + +Like all packets sent from the manager to the display, this packet should +never be retransmitted. + + + + + +Decline + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Status: ARRAY8 + + + + + + + + +Is a human readable string indicating the reason for refusal of +service. + + + + + + + + +Authentication Name: +ARRAY8 + + +Authentication Data: +ARRAY8 + + + + + + + + + +Is the data sent back to the display to authenticate the manager. If the +Authentication Data is not the value expected by the display, it +should terminate the protocol at this point and display an error to the user. + + + + + + +Semantics: + + + + + + + +A +Decline +packet is sent by a manager in response to a +Request +packet if the manager is unwilling to establish a connection for the +display. +This is allowed even if the manager had responded +Willing +to a previous query. + + + + + + +Problems/Solutions: + + + + + + + +Same as for +Accept . + + + + + + +Timeout/Retransmission policy: + + + + + + + +Like all packets sent from a manager to a display, this packet should never +be retransmitted. + + + + + +Manage + + + + + + + +Display -> Manager + + +Additional Fields: + + + + + + + + +Session ID: CARD32 + + + + + + + + +Should contain the nonzero session ID returned in the +Accept +packet. + + + + + + + +Display Number: CARD16 + + + + + + + + +Must match the value sent in the previous +Request +packet. + + + + + + + +Display Class: ARRAY8 + + + + + + + + +Specifies the class of the display. +See the Display Class Format section, +which discusses the format of this field. + + + + + + + +Semantics: + + + + + + + +A +Manage +packet is sent by a display to ask the manager to begin a +session on the display. If the Session ID is correct the manager +should open a connection; otherwise, it should respond with a +Refuse +or +Failed +packet, unless the Session ID matches a currently +running session or a session that has not yet successfully opened the +display but has not given up the attempt. In this latter case, the +Manage +packet should be ignored. +This will work as stream connections give positive success indication +to both halves of the stream, and positive failure indication +to the connection initiator (which will eventually generate a +Failed +packet). + + + + + + +Valid Responses: + + + + + + + +X connection with correct auth info, +Refuse , +Failed . + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + +Manage +not received by manager. + + + + + + + + +Indication: + + + + + + + + + +Display timeout waiting for response. + + + + + + + + +Solution: + + + + + + + + + +Display resends +Manage +message. + + + + + + + + +Problem: + + + + + + + + +Manage +received out of order by manager. + + + + + + + + +Indication: + + + + + + + + + +Session already in progress with matching Session ID. + + + + + + + + +Solution: + + + + + + + + + +Manage +packet ignored. + + + + + + + + +Indication: + + + + + + + + + +Session ID does not match next Session ID. + + + + + + + + +Solution: + + + + + + + + + +Refuse +message is sent. + + + + + + + + +Problem: + + + + + + + + +Display cannot be opened on selected stream. + + + + + + + + +Indication: + + + + + + + + + +Display connection setup fails. + + + + + + + + +Solution: + + + + + + + + + +Failed +message is sent including a human readable reason. + + + + + + + +Problem: + + + + + + + + +Display open does not succeed before a second manage packet is received +because of a timeout occuring in the display. + + + + + + + + +Indication: + + + + + + + + + +Manage +packet received with Session ID matching the session +attempting to connect to the display. + + + + + + + + +Solution: + + + + + + + + + +Manage +packet is ignored. As the stream connection will either +succeed, which will result in an active session, or the stream will +eventually give up hope of connecting and send a +Failed +packet; no response to this +Manage +packet is necessary. + + + + + + +Timeout/Retransmission policy: + + + + + + + +Timeout after 2 seconds, exponential backoff to 32 seconds. After no more +than 126 seconds, give up and report an error to the user. + + + + + +Refuse + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Session ID: CARD32 + + + + + + + + +Should be set to the Session ID received in the +Manage +packet. + + + + + + + +Semantics: + + + + + + + +A +Refuse +packet is sent by a manager when the Session ID received in the +Manage +packet does not match the current Session ID. +The display should assume that it received an old +Accept +packet and should resend its +Request +packet. + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + +Error message is lost. + + + + + + + + +Indication: + + + + + + + + + +Display times out waiting for +new connection, +Refuse +or +Failed . + + + + + + + + +Solution: + + + + + + + + + +Display resends +Manage +message. + + + + + + + + +Timeout/Retransmission policy: + + + + + + + +Like all packets sent from a manager to a display, this packet should never be +retransmitted. + + + + + +Failed + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Session ID: CARD32 + + + + + + + + +Should be set to the Session ID received in the +Manage +packet. + + + + + + + +Status: ARRAY8 + + + + + + + + +Is a human readable string indicating the reason for failure. + + + + + + + +Semantics: + + + + + + + +A +Failed +packet is sent by a manager when it has problems establishing +the initial X connection in response to the +Manage +packet. + + + + + + +Problems/Solutions + + + + + + + +Same as for +Refuse . + + + + + +KeepAlive + + + + + + + +Display -> Manager + + +Additional Fields: + + + + + + + + +Display Number: CARD16 + + + + + + + + +Set to the display index for the display host. + + + + + + + +Session ID: CARD32 + + + + + + + + +Should be set to the Session ID received in the +Manage +packet during the negotiation for the current session. + + + + + + +Sematics: + + + + + + + + +A +KeepAlive +packet can be sent at any time during the session by a +display to discover if the manager is running. +The manager should respond with +Alive +whenever it receives this type of packet. + + +This allows the display to discover when the manager host +is no longer running. +A display is not required to send +KeepAlive +packets and, upon lack of receipt of +Alive +packets, is not required to perform any specific action. + + +The expected use of this packet is to terminate an active session when the +manager host or network link fails. The display should keep track of the +time since any packet has been received from the manager host and use +KeepAlive +packets when a substantial time has elapsed since the +most recent packet. + + + + + + + +Valid Responses: + + + + + + + +Alive + + + + + + +Problems/Solutions: + + + + + + + +Problem: + + + + + + + + +Manager does not receive the packet or display does not receive the response. + + + + + + + + + +Indication: + + + + + + + + + +No +Alive +packet is returned. + + + + + + + + +Solution: + + + + + + + + + +Retransmit the packet with an exponential backoff; start at 2 seconds and +assume the host is not up after no less than 30 seconds. + + + + + +Alive + + + + + + + +Manager -> Display + + +Additional Fields: + + + + + + + + +Session Running: CARD8 + + + + + + + + +Indicates that the session identified by Session ID is +currently active. The value is zero if no session is active +or one if a session +is active. + + + + + + + +Session ID: CARD32 + + + + + + + + +Specifies the ID of the currently running session; if any. +When no session is active this field should be zero. + + + + + + + +Semantics: + + + + + + + +An +Alive +packet is sent in response to a +KeepAlive +request. +If a session is currently active on the display, the manager includes the +Session ID in the packet. The display can use this information to +determine the status of the manager. + + + + + + + + + +Session Termination + +When the session is over, the initial connection with the display (the one +that acknowledges the +Manage +packet) will be closed by the manager. +If only a single session was active on the display, +all other connections should be closed by the display +and the display should be reset. If multiple sessions +are active simultaneously and the display can identify which connections +belong to the terminated sesssion, those connections should be closed. +Otherwise, all connections should be closed and the display reset only when +all sessions have been terminated (that is, all initial connections closed). + + + +The session may also be terminated at any time by the display if the +managing host no longer responds to +KeepAlive +packets. +The exact time-outs for sending +KeepAlive +packets is not specified in this protocol as the trade off +should not be fixed between loading an otherwise idle system with spurious +KeepAlive +packets and not noticing that the manager host is down for a long time. + + + + +State Diagrams + + + + + +The following state diagrams are designed to cover all actions of both +the display and the manager. Any packet that is received out-of-sequence +will be ignored. + + + +Display: + + + + + start: + + +User-requested connect to one host -> query + + +User-requested connect to some host -> broadcast + + +User-requested connect to site host-list -> indirect + + + + + query: + + +Send Query packet +-> collect-query + + + + + collect-query: + + +Receive Willing -> +start-connection + + +Receive Unwilling -> +stop-connection + + +Timeout -> query + + + + + + broadcast: + + +Send BroadcastQuery packet + + +-> collect-broadcast-query + + + + + collect-broadcast-query: + + +Receive Willing -> +update-broadcast-willing + + +User-requested connect to one host -> +start-connection + + +Timeout -> broadcast + + + + + update-broadcast-willing: + + +Add new host to the host list presented to the user + + +-> collect-broadcast-query + + + + + indirect: + + +Send IndirectQuery packet + + +-> collect-indirect-query + + + + + collect-indirect-query: + + +Receive Willing -> +update-indirect-willing + + +User-requested connect to one host -> +start-connection + + +Timeout -> indirect + + + + + update-indirect-willing: + + +Add new host to the host list presented to the user + + +-> collect-indirect-query + + + + + + start-connection: + + +Send Request packet + + +-> await-request-response + + + + + await-request-response: + + +Receive Accept -> +manage + + +Receive Decline -> +stop-connection + + +Timeout -> start-connection + + + + + manage: + + +Save Session ID + + +Send Manage packet with Session ID + + +-> await-manage-response + + + + + await-manage-response: + + +Receive XOpenDisplay : -> +run-session + + +Receive Refuse with matching Session ID +-> start-connection + + +Receive Failed with matching Session ID +-> stop-connection + + +Timeout -> manage + + + + + stop-connection: + + +Display cause of termination to user + + +-> start + + + + + run-session: + + +Decide to send KeepAlive packet -> +keep-alive + + +wait close of first display connection + + +-> reset-display + + + + + keep-alive: + + +Send KeepAlive packet with current Session ID + + +-> await-alive + + + + + await-alive: + + +Receive Alive with matching Session ID -> +run-session + + +Receive Alive with nonmatching Session ID +or FALSE Session Running -> reset-display + + +Final timeout without receiving Alive +packet -> reset-display + + +Timeout -> keep-alive + + + + + reset-display: + + +(if possible) -> close all display connections associated with this session + + +Last session -> close all display connections + + +-> start + + + + + + + +Manager: + + + + + idle: + + +Receive Query -> +query-respond + + +Receive +BroadcastQuery +-> broadcast-respond + + +Receive +IndirectQuery +-> indirect-respond + + +Receive +ForwardQuery +-> forward-respond +Receive + + +Request +-> request-respond + + +Receive +Manage +-> manage + + +An active session terminates +-> finish-session + + +Receive KeepAlive +-> send-alive + + +-> idle + + + + + query-respond: + + +If willing to manage -> send-willing + + +-> send-unwilling + + + + + broadcast-respond: + + +If willing to manage -> send-willing + + +-> idle + + + + + indirect-respond: + + +Send ForwardQuery +packets to all managers on redirect list + + +If willing to manage -> send-willing + + +-> idle + + + + + forward-respond: + + +Decode destination address, if willing to manage -> +send-willing + + +-> idle + + + + + send-willing: + + +Send Willing packet + + +-> idle + + + + + send-unwilling: + + +Send Unwilling packet +-> idle + + + + + request-respond: + + +If manager is willing to allow a session on display +-> accept-session + + +-> decline-session + + + + + accept-session: + + +Generate Session ID and save Session ID, display address, and +display number somewhere + + +Send Accept packet + + +-> idle + + + + + decline-session: + + +Send Decline packet + + +-> idle + + + + + manage: + + +If Session ID matches saved Session ID -> +run-session + + +If Session ID matches Session ID of session in process of +starting up, or currently active session -> +idle + + +-> refuse + + + + + refuse: + + +Send Refuse packet + + +-> idle + + + + + run-session: + + +Terminate any session in progress + + +XOpenDisplay + + +Open display succeeds -> +start-session + + +-> failed + + + + + failed: + + +Send Failed packet + + +-> idle + + + + + start-session: + + +Start a new session + + +-> idle + + + + + finish-session: + + +XCloseDisplay + + +-> idle + + + + + send-alive: + + +Send Alive packet containing current status + + +-> idle + + + + + + + + +Protocol Encoding + +When XDMCP is implemented on top of the Internet User Datagram Protocol (UDP), +port number 177 is to be used. When using UDP over IPv4, Broadcast Query +packets are sent via UDP broadcast. When using UDP over IPv6, Broadcast Query +packets are sent via multicast, either to an address in the IANA registered +XDMCP multicast address range of +FF0X:0:0:0:0:0:0:12B +(where the X is replaced by a valid scope id) +or to a locally assigned +multicast address. The version number in all packets will be 1. +Packet opcodes are 16-bit integers. + + + + + + + + + Packet Name + Encoding + + + + + BroadcastQuery + 1 + + + Query + 2 + + + IndirectQuery + 3 + + + ForwardQuery + 4 + + + Willing + 5 + + + Unwilling + 6 + + + Request + 7 + + + Accept + 8 + + + Decline + 9 + + + Manage + 10 + + + Refuse + 11 + + + Failed + 12 + + + KeepAlive + 13 + +A previous version of this document incorrectly reversed the opcodes of +Alive and +KeepAlive. + + + + + Alive + 14 + +A previous version of this document incorrectly reversed the opcodes of +Alive and +KeepAlive. + + + + + + + + +Per packet information follows: + + + +Query, +BroadcastQuery, +IndirectQuery + + + + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Query, BroadcastQuery or IndirectQuery) + 2 CARD16 length + 1 CARD8 number of Authentication Names sent (m) + 2 CARD16 length of first Authentication Name (m1) + m1 CARD8 first Authentication Name + ... Other Authentication Names + + + +Note that these three packets are identical except for the opcode field. + + + +ForwardQuery + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always ForwardQuery) + 2 CARD16 length + 2 CARD16 length of Client Address (m) + m CARD8 Client Address + 2 CARD16 length of Client Port (n) + n CARD8 Client Port + 1 CARD8 number of Authentication Names sent (o) + 2 CARD16 length of first Authentication Name (o1) + o1 CARD8 first Authentication Name + ... Other Authentication Names + + + +Willing + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Willing) + 2 CARD16 length (6 + m + n + o) + 2 CARD16 Length of Authentication Name (m) + m CARD8 Authentication Name + 2 CARD16 Hostname length (n) + n CARD8 Hostname + 2 CARD16 Status length (o) + o CARD8 Status + + + +Unwilling + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Unwilling) + 2 CARD16 length (4 + m + n) + 2 CARD16 Hostname length (m) + m CARD8 Hostname + 2 CARD16 Status length (n) + n CARD8 Status + + + +Request + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Request) + 2 CARD16 length + 2 CARD16 Display Number + 1 CARD8 Count of Connection Types (m) + 2xm CARD16 Connection Types + 1 CARD8 Count of Connection Addresses (n) + 2 CARD16 Length of first Connection Address (n1) + n1 CARD8 First Connection Address + ... Other connection addresses + 2 CARD16 Length of Authentication Name (o) + o CARD8 Authentication Name + 2 CARD16 Length of Authentication Data (p) + p CARD8 Authentication Data + 1 CARD8 Count of Authorization Names (q) + 2 CARD16 Length of first Authorization Name (q1) + q1 CARD8 First Authorization Name + ... Other authorization names + 2 CARD16 Length of Manufacturer Display ID (r) + r CARD8 Manufacturer Display ID + + + +Accept + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Accept) + 2 CARD16 length (12 + n + m + o + p) + 4 CARD32 Session ID + 2 CARD16 Length of Authentication Name (n) + n CARD8 Authentication Name + 2 CARD16 Length of Authentication Data (m) + m CARD8 Authentication Data + 2 CARD16 Length of Authorization Name (o) + o CARD8 Authorization Name + 2 CARD16 Length of Authorization Data (p) + p CARD8 Authorization Data + + + +Decline + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Decline) + 2 CARD16 length (6 + m + n + o) + 2 CARD16 Length of Status (m) + m CARD8 Status + 2 CARD16 Length of Authentication Name (n) + n CARD8 Authentication Name + 2 CARD16 Length of Authentication Data (o) + o CARD8 Authentication Data + + + +Manage + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Manage) + 2 CARD16 length (8 + m) + 4 CARD32 Session ID + 2 CARD16 Display Number + 2 CARD16 Length of Display Class (m) + m CARD8 Display Class + + + +Refuse + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Refuse) + 2 CARD16 length (4) + 4 CARD32 Session ID + + + +Failed + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Failed) + 2 CARD16 length (6 + m) + 4 CARD32 Session ID + 2 CARD16 Length of Status (m) + m CARD8 Status + + + +KeepAlive + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always KeepAlive) + 2 CARD16 length (6) + 2 CARD16 Display Number + 4 CARD32 Session ID + + + +Alive + 2 CARD16 version number (always 1) + 2 CARD16 opcode (always Alive) + 2 CARD16 length (5) + 1 CARD8 Session Running (0: not running 1: running) + 4 CARD32 Session ID (0: not running) + + + + +Display Class Format + + + + +The Display Class field of the +Manage +packet is used by the display manager to collect common sorts of +displays into manageable groups. This field is a string encoded of +ISO-LATIN-1 characters in the following format: + + + +ManufacturerID-ModelNumber + + + +Both elements of this string must exclude characters of the set +{ -, +., +:, +*, +?, +<space> }. +The ManufacturerID is a string that should be registered +with the X Consortium. +The ModelNumber is designed to identify characteristics of the display +within the manufacturer's product line. +This string should be documented in the users manual for the +particular device and should probably not be specifiable by the +display user to avoid unexpected configuration errors. + + + + +Manufacturer Display ID Format + + + + +To authenticate the manager, the display and manager will share a private +key. +The manager, then, must be able to discover which key to use for a +particular device. +The Manufacturer Display ID field of the +Request +packet is intended for this purpose. Typically, the manager host will +contain a map between this number and the key. This field is intended to be +unique per display, possibly the ethernet address of the display in the form: + + + +-Ethernet-8:0:2b:a:f:d2 + + + +It can also be a string of the form: + + + +ManufacturerID-ModelNumber-SerialNumber + + + +The ManufacturerID, ModelNumber and SerialNumber are encoded using +ISO-LATIN-1 characters, excluding { +-, +., +*, +?, +<space> } + + + +When the display is shipped to a customer, it should include both the +Manufacturer Display ID and the private key in the documentation set. +This information should not be modifiable by the display user. + + + + + +Authentication + + + + +In an environment where authentication is not needed, XDMCP can disable +authentication by having the display send empty Authentication Name +and Authentication Data fields in the +Request +packet. +In this case, the manager will not attempt to authenticate itself. +Other authentication protocols may be developed, depending on local needs. + + + +In an unsecure environment, the display must be able to verify that the +source of the various packets is a trusted manager. These packets will +contain authentication information. As an example of such a system, the +following discussion describes the "XDM-AUTHENTICATION-1" authentication +system. This system uses a 56-bit shared private key, and 64 bits of +authentication data. An associated example X authorization protocol +"XDM-AUTHORIZATION-1" will also be discussed. The 56-bit key is represented +as a 64-bit number in network order (big endian). This means that the first +octet in the representation will be zero. When incrementing a 64-bit value, +the 8 octets of data will be interpreted in network order (big endian). +That is, the last octet will be incremented, subsequent carries propogate +towards the first octet. + + + +Assumptions: + + + + + +The display and manager share a private key. This key could be programmed +into the display by the manufacturer and shipped with the unit. It must not +be available from the display itself, but should allow the value to be +modified in some way. The system administrator would be responsible for +managing a database of terminal keys. + + + + +The display can generate random authentication numbers. + + + + + +Some definitions first: + + + + + + + +{D}= encryption of plain text D by key κ + + + + +{Δ}*κ = decryption of crypto text Δ with key κ + + + + +τ = private key shared by display and manager + + + + +ρ = 64 bit random number generated by display + + + + +α = authentication data in XDMCP packets + + + + +σ = per-session private key, generated by manager + + + + +β = authorization data + + + + + +Encryption will use the Data Encryption Standard (DES, FIPS 46-3); blocks +shorter than 64 bits will be zero-filled +on the right to 64 bits. Blocks longer than 64 bits will use block chaining: + + +{D}κ = {D1 }κ {D2 xor {D1 }κ }κ + + + +The display generates the first authentication data in the +Request +packet: + + + +αRequest = {ρ}τ + + + + +For the Accept +packet, the manager decrypts the initial message and returns +αAccept: + + + + +ρ = {α Request } *τ + + + +α Accept = { ρ + 1}τ + + + +The Accept +packet also contains the authorization intended for use by +the X server. A description of authorization type "XDM-AUTHORIZATION-1" +follows. + + + +The Accept +packet contains the authorization name +"XDM-AUTHORIZATION-1". The authorization data is the string: + + +β Accept = {σ}τ + + + +To create authorization information for connection setup with the X server +using the XDM-AUTHORIZATION-1 authorization protocol, the client computes the +following: + + +N mark = "X client identifier" + + +T lineup = "Current time in seconds on client host (32 bits)" + + +β = {ρNT}σ + + + +For TCP connections @N@ is 48 bits long and contains the 32-bit IPv4 address of +the client host followed by the 16-bit port number of the client socket. +Formats for other connections must be registered. +The resulting value, β, is 192 bits of authorization data that is sent +in the connection setup to the server. The server receives the packet, +decrypts the contents. To accept the connection, the following must hold: + + + + + +ρ must match the value generated for the most recent XDMCP negotiation. + + + + +T must be within 1200 seconds of the internally stored time. If no time +been received before, the current time is set to @T@. + + + + +No packet containing the same pair (N, T) can have been received +in the last 1200 seconds (20 minutes). + + + + + + diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 979f4db86..50313b616 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -32,12 +32,13 @@ AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -# Require xorg-macros: XORG_DEFAULT_OPTIONS +# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS m4_ifndef([XORG_MACROS_VERSION], - [m4_fatal([must install xorg-macros 1.6 or later before running autoconf/autogen])]) -XORG_MACROS_VERSION(1.6) + [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.10) XORG_DEFAULT_OPTIONS XORG_WITH_DOXYGEN(1.6.1) +XORG_CHECK_SGML_DOCTOOLS(1.5) m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])]) XORG_FONT_MACROS_VERSION(1.1) @@ -2182,6 +2183,7 @@ dbe/Makefile dix/Makefile doc/Makefile doc/xml/Makefile +doc/xml/dtrace/Makefile doc/xml/xserver.ent fb/Makefile record/Makefile diff --git a/xorg-server/doc/xml/Makefile.am b/xorg-server/doc/xml/Makefile.am index 3eba24e8c..2913eff55 100644 --- a/xorg-server/doc/xml/Makefile.am +++ b/xorg-server/doc/xml/Makefile.am @@ -21,6 +21,8 @@ # DEALINGS IN THE SOFTWARE. # +SUBDIRS = dtrace + XML_FILES = Xserver-spec.xml include xmlrules.in diff --git a/xorg-server/doc/xml/Xserver-spec.xml b/xorg-server/doc/xml/Xserver-spec.xml index 7249d4267..a457063bd 100644 --- a/xorg-server/doc/xml/Xserver-spec.xml +++ b/xorg-server/doc/xml/Xserver-spec.xml @@ -357,11 +357,15 @@ Resource types are integer values starting at 1. Get a resource type by calling

- RESTYPE CreateNewResourceType(deleteFunc) + RESTYPE CreateNewResourceType(deleteFunc, char *name)
deleteFunc will be called to destroy all resources with this -type. +type. name will be used to identify this type of resource +to clients using the X-Resource extension, to security +extensions such as SELinux, and to tracing frameworks such as DTrace. +[The name argument was added in xorg-server 1.8.] + Resource classes are masks starting at 1 << 31 which can be or'ed with any resource type to provide attributes for the diff --git a/xorg-server/doc/xml/dtrace/Makefile.am b/xorg-server/doc/xml/dtrace/Makefile.am new file mode 100644 index 000000000..946fba7d8 --- /dev/null +++ b/xorg-server/doc/xml/dtrace/Makefile.am @@ -0,0 +1,36 @@ +# +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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 (including the next +# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +# + +XML_FILES = Xserver-DTrace.xml + +include ../xmlrules.in + +if XSERVER_DTRACE +doc_DATA = $(BUILT_DOC_FILES) +else +noinst_DATA = $(BUILT_DOC_FILES) +endif + +CLEANFILES = $(CLEAN_DOC_FILES) + +EXTRA_DIST = $(XML_FILES) diff --git a/xorg-server/doc/xml/dtrace/Xserver-DTrace.xml b/xorg-server/doc/xml/dtrace/Xserver-DTrace.xml new file mode 100644 index 000000000..e0425c8ee --- /dev/null +++ b/xorg-server/doc/xml/dtrace/Xserver-DTrace.xml @@ -0,0 +1,579 @@ + + %defs; +]> + +
+ + Xserver provider for DTrace + + AlanCoopersmith + + Oracle Corporation + Solaris Engineering + + + X.Org Xserver version &xserver.version; + + +Copyright (c) 2005, 2006, 2007, 2010, Oracle and/or its affiliates. +All rights reserved. + +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 (including the next +paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + + + + + + Introduction + + This page provides details on a + statically defined user application tracing provider + for the + DTrace + facility in Solaris 10, + MacOS X 10.5, and later releases. This + provider instruments various points in the X server, to allow + tracing what client applications are up to. + + + + The provider was integrated into the X.Org git master repository + with Solaris 10 & OpenSolaris support for the Xserver 1.4 release, + released in 2007 with X11R7.3. Support for DTrace on MacOS X + was added in Xserver 1.7. + + + + These probes expose the request and reply structure of the X protocol + between clients and the X server, so an understanding of that basic + nature will aid in learning how to use these probes. + + + + + Available probes + + + Due to the way User-Defined DTrace probes work, arguments to + these probes all bear undistinguished names of + arg0, arg1, + arg2, etc. These tables should help you + determine what the real data is for each of the probe arguments. + + + Probes and their arguments + + + + + + + + + + + + Probe name + Description + arg0 + arg1 + arg2 + arg3 + arg4 + + + + + Request Probes + + + request-start + Called just before processing each client request. + requestName + requestCode + requestLength + clientId + requestBuffer + + + request-done + Called just after processing each client request. + requestName + requestCode + sequenceNumber + clientId + resultCode + + + Event Probes + + + send-event + Called just before send each event to a client. + clientId + eventCode + eventBuffer + + + + Client Connection Probes + + + client-connect + Called when a new connection is opened from a client + clientId + clientFD + + + + client-auth + Called when client authenticates (normally just after connection opened) + clientId + clientAddr + clientPid + clientZoneId + + + + client-disconnect + Called when a client connection is closed + clientId + + + + Resource Allocation Probes + + + resource-alloc + Called when a new resource (pixmap, gc, colormap, etc.) is allocated + resourceId + resourceTypeId + resourceValue + resourceTypeName + + + + resource-free + Called when a resource is freed + resourceId + resourceTypeId + resourceValue + resourceTypeName + + + + +
+
+
+ + + Data Available in Probe Arguments + + + To access data in arguments of type string, you will need + to use copyinstr(). + To access data buffers referenced via uintptr_t's, you will + need to use copyin(). + + + Probe Arguments + + + + + + + Argument name + Type + Description + + + + + clientAddr + string + String representing address client connected from + + + clientFD + int + X server's file descriptor for server side of each connection + + + clientId + int + Unique integer identifier for each connection to the + X server + + + clientPid + pid_t + Process id of client, if connection is local + (from getpeerucred()) + + + clientZoneId + zoneid_t + Solaris: Zone id of client, if connection is local + (from getpeerucred()) + + + eventBuffer + uintptr_t + Pointer to buffer containing X event - decode using + structures in + <X11/Xproto.h> + and similar headers for each extension + + + eventCode + uint8_t + Event number of X event + + + resourceId + uint32_t + X resource id (XID) + + + resourceTypeId + uint32_t + Resource type id + + + resourceTypeName + string + String representing X resource type + ("PIXMAP", etc.) + + + resourceValue + uintptr_t + Pointer to data for X resource + + + resultCode + int + Integer code representing result status of request + + + requestBuffer + uintptr_t + Pointer to buffer containing X request - decode using + structures in + <X11/Xproto.h> + and similar headers for each extension + + + requestCode + uint8_t + Request number of X request or Extension + + + requestName + string + Name of X request or Extension + + + requestLength + uint16_t + Length of X request + + + sequenceNumber + uint32_t + Number of X request in in this connection + + + +
+
+
+ + + Examples + + + Counting requests by request name + + + This script simply increments a counter for each different request + made, and when you exit the script (such as by hitting + ControlC + ) prints the counts. + + +#!/usr/sbin/dtrace -s + +Xserver*:::request-start +{ + @counts[copyinstr(arg0)] = count(); +} + + + The output from a short run may appear as: + + QueryPointer 1 + CreatePixmap 2 + FreePixmap 2 + PutImage 2 + ChangeGC 10 + CopyArea 10 + CreateGC 14 + FreeGC 14 + RENDER 28 + SetClipRectangles 40 + + + + + This can be rewritten slightly to cache the string containing the name + of the request since it will be reused many times, instead of copying + it over and over from the kernel: + + +#!/usr/sbin/dtrace -s + +string Xrequest[uintptr_t]; + +Xserver*:::request-start +/Xrequest[arg0] == ""/ +{ + Xrequest[arg0] = copyinstr(arg0); +} + +Xserver*:::request-start +{ + @counts[Xrequest[arg0]] = count(); +} + + + + + + Get average CPU time per request + + This script records the CPU time used between the probes at + the start and end of each request and aggregates it per request type. + + +#!/usr/sbin/dtrace -s + +Xserver*:::request-start +{ + reqstart = vtimestamp; +} + +Xserver*:::request-done +{ + @times[copyinstr(arg0)] = avg(vtimestamp - reqstart); +} + + + The output from a sample run might look like: + + + ChangeGC 889 + MapWindow 907 + SetClipRectangles 1319 + PolyPoint 1413 + PolySegment 1434 + PolyRectangle 1828 + FreeCursor 1895 + FreeGC 1950 + CreateGC 2244 + FreePixmap 2246 + GetInputFocus 2249 + TranslateCoords 8508 + QueryTree 8846 + GetGeometry 9948 + CreatePixmap 12111 + AllowEvents 14090 + GrabServer 14791 + MIT-SCREEN-SAVER 16747 + ConfigureWindow 22917 + SetInputFocus 28521 + PutImage 240841 + + + + + + + Monitoring clients that connect and disconnect + + + This script simply prints information about each client that + connects or disconnects from the server while it is running. + Since the provider is specified as Xserver$1 instead + of Xserver* like previous examples, it won't monitor + all Xserver processes running on the machine, but instead expects + the process id of the X server to monitor to be specified as the + argument to the script. + + +#!/usr/sbin/dtrace -s + +Xserver$1:::client-connect +{ + printf("** Client Connect: id %d\n", arg0); +} + +Xserver$1:::client-auth +{ + printf("** Client auth'ed: id %d => %s pid %d\n", + arg0, copyinstr(arg1), arg2); +} + +Xserver$1:::client-disconnect +{ + printf("** Client Disconnect: id %d\n", arg0); +} + + + A sample run: + + +# ./foo.d 5790 +dtrace: script './foo.d' matched 4 probes +CPU ID FUNCTION:NAME + 0 15774 CloseDownClient:client-disconnect ** Client Disconnect: id 65 + + 2 15774 CloseDownClient:client-disconnect ** Client Disconnect: id 64 + + 0 15773 EstablishNewConnections:client-connect ** Client Connect: id 64 + + 0 15772 AuthAudit:client-auth ** Client auth'ed: id 64 => local host pid 2034 + + 0 15773 EstablishNewConnections:client-connect ** Client Connect: id 65 + + 0 15772 AuthAudit:client-auth ** Client auth'ed: id 65 => local host pid 2034 + + 0 15774 CloseDownClient:client-disconnect ** Client Disconnect: id 64 + + + + + + + + Monitoring clients creating Pixmaps + + + This script can be used to determine which clients are creating + pixmaps in the X server, printing information about each client + as it connects to help trace it back to the program on the other + end of the X connection. + + +#!/usr/sbin/dtrace -qs + +string Xrequest[uintptr_t]; +string Xrestype[uintptr_t]; + +Xserver$1:::request-start +/Xrequest[arg0] == ""/ +{ + Xrequest[arg0] = copyinstr(arg0); +} + +Xserver$1:::resource-alloc +/arg3 != 0 && Xrestype[arg3] == ""/ +{ + Xrestype[arg3] = copyinstr(arg3); +} + + +Xserver$1:::request-start +/Xrequest[arg0] == "X_CreatePixmap"/ +{ + printf("-> %s: client %d\n", Xrequest[arg0], arg3); +} + +Xserver$1:::request-done +/Xrequest[arg0] == "X_CreatePixmap"/ +{ + printf("<- %s: client %d\n", Xrequest[arg0], arg3); +} + +Xserver$1:::resource-alloc +/Xrestype[arg3] == "PIXMAP"/ +{ + printf("** Pixmap alloc: %08x\n", arg0); +} + + +Xserver$1:::resource-free +/Xrestype[arg3] == "PIXMAP"/ +{ + printf("** Pixmap free: %08x\n", arg0); +} + +Xserver$1:::client-connect +{ + printf("** Client Connect: id %d\n", arg0); +} + +Xserver$1:::client-auth +{ + printf("** Client auth'ed: id %d => %s pid %d\n", + arg0, copyinstr(arg1), arg2); +} + +Xserver$1:::client-disconnect +{ + printf("** Client Disconnect: id %d\n", arg0); +} + + + Sample output from a run of this script: + +** Client Connect: id 17 +** Client auth'ed: id 17 => local host pid 20273 +-> X_CreatePixmap: client 17 +** Pixmap alloc: 02200009 +<- X_CreatePixmap: client 17 +-> X_CreatePixmap: client 15 +** Pixmap alloc: 01e00180 +<- X_CreatePixmap: client 15 +-> X_CreatePixmap: client 15 +** Pixmap alloc: 01e00181 +<- X_CreatePixmap: client 15 +-> X_CreatePixmap: client 14 +** Pixmap alloc: 01c004c8 +<- X_CreatePixmap: client 14 +** Pixmap free: 02200009 +** Client Disconnect: id 17 +** Pixmap free: 01e00180 +** Pixmap free: 01e00181 + + + + + + + + + +
+ diff --git a/xorg-server/doc/xml/xmlrules.in b/xorg-server/doc/xml/xmlrules.in index 1db7f128e..667cc2ebb 100644 --- a/xorg-server/doc/xml/xmlrules.in +++ b/xorg-server/doc/xml/xmlrules.in @@ -39,6 +39,14 @@ SUFFIXES = .xml .txt .html .pdf XML_ENT_DIR = $(abs_top_builddir)/doc/xml XMLTO_FLAGS = --searchpath $(XML_ENT_DIR) +if HAVE_STYLESHEETS +XMLTO_FLAGS += -m $(XSL_STYLESHEET) +BUILT_DOC_FILES += xorg.css + +xorg.css: $(STYLESHEET_SRCDIR)/xorg.css + $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@ +endif + if HAVE_XMLTO BUILT_DOC_FILES += $(TXT_FILES) .xml.txt: @@ -59,7 +67,7 @@ endif endif -CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES) +CLEAN_DOC_FILES = $(TXT_FILES) $(HTML_FILES) $(PDF_FILES) xorg.css # All the files we build depend on the entities $(BUILT_DOC_FILES): $(XML_ENT_DIR)/xserver.ent diff --git a/xorg-server/hw/xfree86/ddc/ddc.c b/xorg-server/hw/xfree86/ddc/ddc.c index 3b70ce508..975e07620 100644 --- a/xorg-server/hw/xfree86/ddc/ddc.c +++ b/xorg-server/hw/xfree86/ddc/ddc.c @@ -102,7 +102,7 @@ resort(unsigned char *s_block) } static int -DDC_checksum(unsigned char *block, int len) +DDC_checksum(const unsigned char *block, int len) { int i, result = 0; int not_null = 0; @@ -149,7 +149,10 @@ GetEDID_DDC1(unsigned int *s_ptr) d_pos++; } free(s_ptr); - if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL; + if (d_block && DDC_checksum(d_block,EDID1_LEN)) { + free(d_block); + return NULL; + } return (resort(d_block)); } diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c index b432ec750..718727ebe 100644 --- a/xorg-server/hw/xquartz/GL/indirect.c +++ b/xorg-server/hw/xquartz/GL/indirect.c @@ -271,8 +271,7 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) { __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n", - (unsigned int) baseContext); + GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx %p)\n", baseContext); if (context != NULL) { if (context->sid != 0 && surface_hash != NULL) { lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL); @@ -321,7 +320,7 @@ static void surface_notify(void *_arg, void *data) { case AppleDRISurfaceNotifyDestroyed: if (surface_hash != NULL) x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id)); - draw->base.pDraw = NULL; + draw->pDraw = NULL; draw->sid = 0; break; diff --git a/xorg-server/hw/xquartz/pbproxy/main.m b/xorg-server/hw/xquartz/pbproxy/main.m index 560cf0182..cfdc7696d 100644 --- a/xorg-server/hw/xquartz/pbproxy/main.m +++ b/xorg-server/hw/xquartz/pbproxy/main.m @@ -1,163 +1,165 @@ -/* main.m - Copyright (c) 2002, 2008 Apple Computer, Inc. All rights reserved. - - 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 ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. - */ - -#include "pbproxy.h" -#import "x-selection.h" - -#include -#include -#include - -Display *xpbproxy_dpy; -int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; -int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; -BOOL xpbproxy_have_xfixes; - -extern char *display; - -#ifdef STANDALONE_XPBPROXY -BOOL xpbproxy_is_standalone = NO; -#endif - -x_selection *_selection_object; - -extern BOOL serverInitComplete; -extern pthread_mutex_t serverInitCompleteMutex; -extern pthread_cond_t serverInitCompleteCond; - -static inline void wait_for_server_init(void) { - /* If the server hasn't finished initializing, wait for it... */ - if(!serverInitComplete) { - pthread_mutex_lock(&serverInitCompleteMutex); - while(!serverInitComplete) - pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex); - pthread_mutex_unlock(&serverInitCompleteMutex); - } -} - -static int x_io_error_handler (Display *dpy) { - /* We lost our connection to the server. */ - - TRACE (); - - /* trigger the thread to restart? - * NO - this would be to a "deeper" problem, and restarts would just - * make things worse... - */ -#ifdef STANDALONE_XPBPROXY - if(xpbproxy_is_standalone) - exit(EXIT_FAILURE); -#endif - - return 0; -} - -static int x_error_handler (Display *dpy, XErrorEvent *errevent) { - return 0; -} - -int xpbproxy_run (void) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - size_t i; - - wait_for_server_init(); - - for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) { - xpbproxy_dpy = XOpenDisplay(NULL); - - if(!xpbproxy_dpy && display) { - char _display[32]; - snprintf(_display, sizeof(_display), ":%s", display); - setenv("DISPLAY", _display, TRUE); - - xpbproxy_dpy=XOpenDisplay(_display); - } - if(!xpbproxy_dpy) - sleep(1); - } - - if (xpbproxy_dpy == NULL) { - fprintf (stderr, "xpbproxy: can't open default display\n"); - [pool release]; - return EXIT_FAILURE; - } - - XSetIOErrorHandler (x_io_error_handler); - XSetErrorHandler (x_error_handler); - - if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base, - &xpbproxy_apple_wm_error_base)) { - fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n"); - [pool release]; - return EXIT_FAILURE; - } - - xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base); - - XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask | - AppleWMPasteboardNotifyMask); - - _selection_object = [[x_selection alloc] init]; - - if(!xpbproxy_input_register()) { - [pool release]; - return EXIT_FAILURE; - } - - [pool release]; - - CFRunLoopRun(); - - return EXIT_SUCCESS; -} - -id xpbproxy_selection_object (void) { - return _selection_object; -} - -Time xpbproxy_current_timestamp (void) { - /* FIXME: may want to fetch a timestamp from the server.. */ - return CurrentTime; -} - -void debug_printf (const char *fmt, ...) { - static int spew = -1; - - if (spew == -1) { - char *x = getenv ("DEBUG"); - spew = (x != NULL && atoi (x) != 0); - } - - if (spew) { - va_list args; - va_start(args, fmt); - vfprintf (stderr, fmt, args); - va_end(args); - } -} +/* main.m + Copyright (c) 2002, 2008 Apple Computer, Inc. All rights reserved. + + 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. + */ + +#include "pbproxy.h" +#import "x-selection.h" + +#include +#include +#include + +Display *xpbproxy_dpy; +int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; +int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; +BOOL xpbproxy_have_xfixes; + +extern char *display; + +#ifdef STANDALONE_XPBPROXY +BOOL xpbproxy_is_standalone = NO; +#endif + +x_selection *_selection_object; + +extern BOOL serverInitComplete; +extern pthread_mutex_t serverInitCompleteMutex; +extern pthread_cond_t serverInitCompleteCond; + +static inline void wait_for_server_init(void) { + /* If the server hasn't finished initializing, wait for it... */ + if(!serverInitComplete) { + pthread_mutex_lock(&serverInitCompleteMutex); + while(!serverInitComplete) + pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex); + pthread_mutex_unlock(&serverInitCompleteMutex); + } +} + +static int x_io_error_handler (Display *dpy) { + /* We lost our connection to the server. */ + + TRACE (); + + /* trigger the thread to restart? + * NO - this would be to a "deeper" problem, and restarts would just + * make things worse... + */ +#ifdef STANDALONE_XPBPROXY + if(xpbproxy_is_standalone) + exit(EXIT_FAILURE); +#endif + + /* Prevent _XIOError from calling exit() */ + pthread_exit(NULL); + return 0; +} + +static int x_error_handler (Display *dpy, XErrorEvent *errevent) { + return 0; +} + +int xpbproxy_run (void) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + size_t i; + + wait_for_server_init(); + + for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) { + xpbproxy_dpy = XOpenDisplay(NULL); + + if(!xpbproxy_dpy && display) { + char _display[32]; + snprintf(_display, sizeof(_display), ":%s", display); + setenv("DISPLAY", _display, TRUE); + + xpbproxy_dpy=XOpenDisplay(_display); + } + if(!xpbproxy_dpy) + sleep(1); + } + + if (xpbproxy_dpy == NULL) { + fprintf (stderr, "xpbproxy: can't open default display\n"); + [pool release]; + return EXIT_FAILURE; + } + + XSetIOErrorHandler (x_io_error_handler); + XSetErrorHandler (x_error_handler); + + if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base, + &xpbproxy_apple_wm_error_base)) { + fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n"); + [pool release]; + return EXIT_FAILURE; + } + + xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base); + + XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask | + AppleWMPasteboardNotifyMask); + + _selection_object = [[x_selection alloc] init]; + + if(!xpbproxy_input_register()) { + [pool release]; + return EXIT_FAILURE; + } + + [pool release]; + + CFRunLoopRun(); + + return EXIT_SUCCESS; +} + +id xpbproxy_selection_object (void) { + return _selection_object; +} + +Time xpbproxy_current_timestamp (void) { + /* FIXME: may want to fetch a timestamp from the server.. */ + return CurrentTime; +} + +void debug_printf (const char *fmt, ...) { + static int spew = -1; + + if (spew == -1) { + char *x = getenv ("DEBUG"); + spew = (x != NULL && atoi (x) != 0); + } + + if (spew) { + va_list args; + va_start(args, fmt); + vfprintf (stderr, fmt, args); + va_end(args); + } +} diff --git a/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh b/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh new file mode 100644 index 000000000..ccaaba7e0 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/genLists4Comparizon.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# +# This script compares the group names which "have to be", according to the descriptions in base.xml - +# and actually existing in the symbol files. Some differences are ok (like extra double quotes or +# extra escaping character) - but all the rest should be in sync. +# + +ROOT="`dirname $0`/.." +F1=reg2ll.lst +F2=gn2ll.lst + +xsltproc $ROOT/xslt/reg2ll.xsl $ROOT/rules/base.xml | sort | uniq > $F1 + +for i in $ROOT/symbols/*; do + if [ -f $i ]; then + id="`basename $i`" + export id + gawk 'BEGIN{ + FS = "\""; + id = ENVIRON["id"]; + isDefault = 0; +} +/.*default.*/{ + isDefault = 1; +} +/xkb_symbols/{ + variant = $2; +}/^[[:space:]]*name\[Group1\][[:space:]]*=/{ + if (isDefault == 1) + { + printf "%s:\"%s\"\n",id,$2; + isDefault=0; + } else + { + name=$2; + printf "%s(%s):\"%s\"\n", id, variant, name; + } +}' $i + fi +done | sort | uniq > $F2 + +diff $F1 $F2 diff --git a/xorg-server/xkeyboard-config/tests/listCI2.xsl b/xorg-server/xkeyboard-config/tests/listCI2.xsl new file mode 100644 index 000000000..09ee37abb --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/listCI2.xsl @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/xorg-server/xkeyboard-config/tests/listCIs.xsl b/xorg-server/xkeyboard-config/tests/listCIs.xsl new file mode 100644 index 000000000..87e5bd9de --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/listCIs.xsl @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/xorg-server/xkeyboard-config/tests/mxkbledpanel/Imakefile b/xorg-server/xkeyboard-config/tests/mxkbledpanel/Imakefile new file mode 100644 index 000000000..3fd46021e --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/mxkbledpanel/Imakefile @@ -0,0 +1,8 @@ +LOCAL_LIBRARIES1 = -lXm + SRCS1 = mxkbledpanel.c + OBJS1 = mxkbledpanel.o + +PROGRAMS=mxkbledpanel + +ComplexProgramTarget_1(mxkbledpanel,$(LOCAL_LIBRARIES1),) + diff --git a/xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.c b/xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.c new file mode 100644 index 000000000..5d52c52c1 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.c @@ -0,0 +1,605 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +Display *theDisplay; +XtAppContext appContext; +int xkbEventBase; +Widget topLevel; +Widget leds[XkbNumIndicators]; +Atom ledAtoms[XkbNumIndicators]; +XmString ledNames[XkbNumIndicators]; +XkbDescPtr xkb_desc; + +void valueChangedProc(Widget,XtPointer,XmToggleButtonCallbackStruct *); +XtCallbackRec valueChangedCB[2]={(XtCallbackProc)valueChangedProc,NULL}; + +/************************************************************************/ +/* */ +/* Application Resources */ +/* */ +/************************************************************************/ +#define YES 1 +#define NO 0 +#define DONT_CARE -1 + +typedef struct +{ + int wanted; + int wantAutomatic; + int wantExplicit; + int wantNamed; + int wantReal; + int wantVirtual; + int useUnion; +} OptionsRec; + +OptionsRec options; + +#define Offset(field) XtOffsetOf(OptionsRec,field) +XtResource resources[] = +{ + {"wanted", "Wanted", XtRInt, sizeof(int), + Offset(wanted), XtRImmediate, (XtPointer) DONT_CARE }, + {"wantAutomatic", "WantAutomatic", XtRInt, sizeof(int), + Offset(wantAutomatic), XtRImmediate, (XtPointer) DONT_CARE}, + {"wantExplicit", "WantExplicit", XtRInt, sizeof(int), + Offset(wantExplicit), XtRImmediate, (XtPointer) DONT_CARE}, + {"wantNamed", "WantNamed", XtRInt, sizeof(int), + Offset(wantNamed), XtRImmediate, (XtPointer) DONT_CARE}, + {"wantReal", "WantReal", XtRInt, sizeof(int), + Offset(wantReal), XtRImmediate, (XtPointer) DONT_CARE}, + {"wantVirtual", "WantVirtual", XtRInt, sizeof(int), + Offset(wantVirtual), XtRImmediate, (XtPointer) DONT_CARE}, + {"useUnion", "UseUnion", XtRInt, sizeof(int), + Offset(useUnion), XtRImmediate, (XtPointer) YES}, + NULL +}; +#undef Offset + +String fallbackResources[] = +{ + "*mainWindow.width: 100", + "*mainWindow.height: 50", + NULL +}; + +XrmOptionDescRec optionDesc[] = +{ + {"-watch", "*wanted", XrmoptionSepArg, (XtPointer) "0"}, + {"-automatic", "*wantAutomatic", XrmoptionNoArg, (XtPointer) "0"}, + {"+automatic", "*wantAutomatic", XrmoptionNoArg, (XtPointer) "1"}, + {"-explicit", "*wantExplicit", XrmoptionNoArg, (XtPointer) "0"}, + {"+explicit", "*wantExplicit", XrmoptionNoArg, (XtPointer) "1"}, + {"-named", "*wantNamed", XrmoptionNoArg, (XtPointer) "0"}, + {"+named", "*wantNamed", XrmoptionNoArg, (XtPointer) "1"}, + {"-real", "*wantReal", XrmoptionNoArg, (XtPointer) "0"}, + {"+real", "*wantReal", XrmoptionNoArg, (XtPointer) "1"}, + {"-virtual", "*wantVirtual", XrmoptionNoArg, (XtPointer) "0"}, + {"+virtual", "*wantVirtual", XrmoptionNoArg, (XtPointer) "1"}, + {"-intersection", "*useUnion", XrmoptionNoArg, (XtPointer) "0"}, + {"-union", "*useUnion", XrmoptionNoArg, (XtPointer) "1"} +}; + +/************************************************************************/ +/* */ +/* usage */ +/* */ +/************************************************************************/ +void usage(char *program) +{ + printf("Usage: %s \n",program); + printf("Legal options include the usual X toolkit options plus:\n"); + printf(" -help Print this message\n"); + printf(" -indpy Name of display to watch\n"); + printf(" -watch Mask of LEDs to watch\n"); + printf(" [-+]automatic (Don't) watch automatic LEDs\n"); + printf(" [-+]explicit (Don't) watch explicit LEDs\n"); + printf(" [-+]named (Don't) watch named LEDs\n"); + printf(" [-+]real (Don't) watch real LEDs\n"); + printf(" [-+]virtual (Don't) watch virtual LEDs\n"); + printf(" -intersection Watch only LEDs in all desired sets\n"); + printf(" -union Watch LEDs in any desired sets\n"); + printf("The default set of LEDs is -intersection +named +virtual\n"); + return; +} +/************************************************************************/ +/* */ +/* XkbEventHandler */ +/* */ +/* DESCRIPTION: */ +/* */ +/* Handles events generated by the Xkb server extension. */ +/* */ +/************************************************************************/ +Boolean XkbEventHandler(XEvent *event) +{ + XkbEvent *xkbEv = (XkbEvent *) event; + + if (xkbEv->any.xkb_type==XkbIndicatorStateNotify) { + register int i; + register unsigned bit; + for (i=0,bit=1;iindicators.changed&bit)&&(leds[i])) + { + if (xkbEv->indicators.state&bit) + XmToggleButtonSetState(leds[i],True,False); + else + XmToggleButtonSetState(leds[i],False,False); + } + } + else if (xkbEv->any.xkb_type==XkbIndicatorMapNotify) { + unsigned change= xkbEv->indicators.changed; + + if (XkbGetIndicatorMap(theDisplay,change,xkb_desc)!=Success) + fprintf(stderr,"Couldn't get changed indicator maps\n"); + } + + return True; + +} /* XkbEventHandler */ + +/************************************************************************/ +/* */ +/* InitXkb */ +/* */ +/************************************************************************/ +Boolean InitXkb(Display *theDisplay) +{ + int i,opcode,errorBase,major,minor; + XkbDescPtr xkb; + unsigned int bit; + unsigned int real,virtual,named,explicit,automatic; + char *name; + + if (!XkbQueryExtension(theDisplay, + &opcode, + &xkbEventBase, + &errorBase, + &major, + &minor)) + return False; + + if (!XkbUseExtension(theDisplay,&major,&minor)) + return False; + + XkbSelectEvents(theDisplay, + XkbUseCoreKbd, + XkbIndicatorStateNotifyMask|XkbIndicatorMapNotifyMask, + XkbIndicatorStateNotifyMask|XkbIndicatorMapNotifyMask); + + XtSetEventDispatcher(theDisplay, + xkbEventBase+XkbEventCode, + XkbEventHandler); + + xkb=XkbGetMap(theDisplay,0,XkbUseCoreKbd); + real=virtual=named=explicit=automatic=0; + + if (!xkb) + { + fprintf(stderr,"Couldn't get keymap\n"); + return False; + } + if (XkbGetIndicatorMap(theDisplay,XkbAllIndicatorsMask,xkb)!=Success) + { + fprintf(stderr,"Couldn't read indicator map\n"); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return False; + } + real=virtual=named=explicit=automatic=0; + + if (XkbGetNames(theDisplay,XkbIndicatorNamesMask,xkb)!=Success) + { + fprintf(stderr,"Couldn't read indicator names\n"); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return False; + } + real=virtual=named=explicit=automatic=0; + + for (i=0,bit=1;iindicators->maps[i]; + name = NULL; + if (xkb->names->indicators[i]!=None) + { + named|= bit; + name = XGetAtomName(theDisplay,xkb->names->indicators[i]); + } + if (name != NULL) + { + ledAtoms[i] = xkb->names->indicators[i]; + ledNames[i] = XmStringCreate(name,XmSTRING_DEFAULT_CHARSET); + } + else + { + char temp[12]; + sprintf(temp,"led%d\0",i+1); + ledAtoms[i] = None; + ledNames[i] = XmStringCreate(temp,XmSTRING_DEFAULT_CHARSET); + } + if (xkb->indicators->phys_indicators&bit) + real|= bit; + if ((((map->which_groups!=0)&&(map->groups!=0))|| + ((map->which_mods!=0)&& + ((map->mods.real_mods!=0)||(map->mods.vmods!=0)))|| + (map->ctrls!=0))&& + ((map->flags&XkbIM_NoAutomatic)==0)) { + automatic|= bit; + } + else explicit|= bit; + } + + virtual = ~real; + + if (options.useUnion) + { + if ((options.wantReal==NO) || (options.wantReal==DONT_CARE)) + real = 0; + if ((options.wantVirtual==NO) || (options.wantVirtual==DONT_CARE)) + virtual = 0; + if ((options.wantNamed==NO) || (options.wantNamed==DONT_CARE)) + named = 0; + if ((options.wantAutomatic==NO) || (options.wantAutomatic==DONT_CARE)) + automatic = 0; + if ((options.wantExplicit==NO) || (options.wantExplicit==DONT_CARE)) + explicit = 0; + + options.wanted |= real|virtual|named|automatic|explicit; + } + else + { + if (options.wanted == DONT_CARE) + options.wanted = ~0; + + if (options.wantReal==NO) + real = ~real; + else if (options.wantReal==DONT_CARE) + real = ~0; + + if (options.wantVirtual==NO) + virtual = ~virtual; + else if (options.wantVirtual==DONT_CARE) + virtual = ~0; + + if (options.wantNamed==NO) + named = ~named; + else if (options.wantNamed==DONT_CARE) + named = ~0; + + if (options.wantAutomatic==NO) + automatic = ~automatic; + else if (options.wantAutomatic==DONT_CARE) + automatic = ~0; + + if (options.wantExplicit==NO) + explicit = ~explicit; + else if (options.wantExplicit==DONT_CARE) + explicit = ~0; + + options.wanted &= real&virtual&named&automatic&explicit; + } + + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return True; + +} /* InitXkb */ + +/************************************************************************/ +/* */ +/* valueChangedProc - called when a toggle button is pressed. */ +/* */ +/************************************************************************/ +void valueChangedProc(Widget w, + XtPointer clientData, + XmToggleButtonCallbackStruct *callbackData) +{ + int led = (int) clientData; + XkbDescPtr xkb; + + xkb = XkbGetMap(theDisplay,0,XkbUseCoreKbd); + if (!xkb) + { + fprintf(stderr,"XkbGetMap failed\n"); + return; + } + + if (XkbGetIndicatorMap(theDisplay,XkbAllIndicatorsMask,xkb)!=Success) + { + fprintf(stderr,"GetIndicatorMap failed\n"); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return; + } + + /* The 'flags' field tells whether this indicator is automatic + * (XkbIM_NoExplicit - 0x80), explicit (XkbIM_NoAutomatic - 0x40), + * or neither (both - 0xC0). + * + * If NoAutomatic is set, the server ignores the rest of the + * fields in the indicator map (i.e. it disables automatic control + * of the LED). If NoExplicit is set, the server prevents clients + * from explicitly changing the value of the LED (using the core + * protocol *or* XKB). If NoAutomatic *and* NoExplicit are set, + * the LED cannot be changed (unless you change the map first). + * If neither NoAutomatic nor NoExplicit are set, the server will + * change the LED according to the indicator map, but clients can + * override that (until the next automatic change) using the core + * protocol or XKB. + */ + switch (xkb->indicators->maps[led].flags & + (XkbIM_NoExplicit|XkbIM_NoAutomatic)) + { + case XkbIM_NoExplicit|XkbIM_NoAutomatic: + { + XmToggleButtonSetState(w,!callbackData->set,FALSE); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return; + } + + case XkbIM_NoAutomatic: + { + if (ledAtoms[led] != None) + XkbSetNamedIndicator(theDisplay,XkbUseCoreKbd, + ledAtoms[led],callbackData->set, + FALSE,NULL); + else + { + XKeyboardControl xkc; + xkc.led= led; + if (callbackData->set) + xkc.led_mode= LedModeOn; + else xkc.led_mode= LedModeOff; + XChangeKeyboardControl(theDisplay,KBLed|KBLedMode,&xkc); + XSync(theDisplay,0); + } + + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return; + } + + case XkbIM_NoExplicit: + break; + } + + /* The 'ctrls' field tells what controls tell this indicator to + * to turn on: RepeatKeys (0x1), SlowKeys (0x2), BounceKeys (0x4), + * StickyKeys (0x8), MouseKeys (0x10), AccessXKeys (0x20), + * TimeOut (0x40), Feedback (0x80), ToggleKeys (0x100), + * Overlay1 (0x200), Overlay2 (0x400), GroupsWrap (0x800), + * InternalMods (0x1000), IgnoreLockMods (0x2000), + * PerKeyRepeat (0x3000), or ControlsEnabled (0x4000) + */ + if (xkb->indicators->maps[led].ctrls) + { + unsigned long which = xkb->indicators->maps[led].ctrls; + + XkbGetControls(theDisplay,XkbAllControlsMask,xkb); + if (callbackData->set) + xkb->ctrls->enabled_ctrls |= which; + else + xkb->ctrls->enabled_ctrls &= ~which; + XkbSetControls(theDisplay,which|XkbControlsEnabledMask,xkb); + } + + /* The 'which_groups' field tells when this indicator turns on + * for the 'groups' field: base (0x1), latched (0x2), locked (0x4), + * or effective (0x8). + */ + if (xkb->indicators->maps[led].groups) + { + int i; + unsigned int group = 1; + + /* Turning on a group indicator is kind of tricky. For + * now, we will just Latch or Lock the first group we find + * if that is what this indicator does. Otherwise, we're + * just going to punt and get out of here. + */ + if (callbackData->set) + { + for (i = XkbNumKbdGroups-1; i >= 0; i--) + if ((1 << i) & + xkb->indicators->maps[led].groups) + group = i; + if (xkb->indicators->maps[led].which_groups & + (XkbIM_UseLocked | XkbIM_UseEffective)) + XkbLockGroup(theDisplay,XkbUseCoreKbd,group); + else if (xkb->indicators->maps[led].which_groups&XkbIM_UseLatched) + XkbLatchGroup(theDisplay,XkbUseCoreKbd,group); + else + { + XmToggleButtonSetState(w,!callbackData->set,FALSE); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return; + } + } + /* Turning off a group indicator will mean that we just + * Lock the first group that this indicator doesn't watch. + */ + else + { + for (i = XkbNumKbdGroups-1; i >= 0; i--) + if (!((1 << i) & + xkb->indicators->maps[led].groups)) + group = i; + XkbLockGroup(theDisplay,XkbUseCoreKbd,group); + } + } + + /* The 'which_mods' field tells when this indicator turns on + * for the modifiers: base (0x1), latched (0x2), locked (0x4), + * or effective (0x8). + * + * The 'real_mods' field tells whether this turns on when one of + * the real X modifiers is set: Shift (0x1), Lock (0x2), Control (0x4), + * Mod1 (0x8), Mod2 (0x10), Mod3 (0x20), Mod4 (0x40), or Mod5 (0x80). + * + * The 'virtual_mods' field tells whether this turns on when one of + * the virtual modifiers is set. + * + * The 'mask' field tells what real X modifiers the virtual_modifiers + * map to? + */ + if (xkb->indicators->maps[led].mods.real_mods || + xkb->indicators->maps[led].mods.mask) + { + XkbStateRec state; + unsigned int affect,mods; + + affect = (xkb->indicators->maps[led].mods.real_mods | + xkb->indicators->maps[led].mods.mask); + + if (callbackData->set) + mods = affect; + else + mods = 0; + + if (xkb->indicators->maps[led].which_mods & + (XkbIM_UseLocked | XkbIM_UseEffective)) + XkbLockModifiers(theDisplay,XkbUseCoreKbd,affect,mods); + else if (xkb->indicators->maps[led].which_mods & + XkbIM_UseLatched) + XkbLatchModifiers(theDisplay,XkbUseCoreKbd,affect,mods); + else + { + XmToggleButtonSetState(w,!callbackData->set,FALSE); + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + return; + } + } + + XkbFreeKeyboard(xkb,XkbAllComponentsMask,True); + +} /* valueChangedProc */ + +/************************************************************************/ +/* */ +/* InitializeUI */ +/* */ +/************************************************************************/ +void InitializeUI(Widget topLevel) +{ + Arg argList[3]; + char buf[256]; + int i; + unsigned int bit,n; + Widget mainWindow,rowColumn; + XmString tempString; + + mainWindow = (Widget) XmCreateMainWindow(topLevel,"mainWindow",NULL,0); + XtManageChild(mainWindow); + rowColumn = (Widget) XmCreateRowColumn(mainWindow,"rowColumn",NULL,0); + XtManageChild(rowColumn); + + XkbGetIndicatorState(theDisplay,XkbUseCoreKbd,&n); + for (i=0,bit=1;i 1) + { + usage(argv[0]); + exit(0); + } + + /* Defaults + */ + if ((options.wanted == DONT_CARE) && + (options.wantReal == DONT_CARE) && + (options.wantVirtual == DONT_CARE) && + (options.wantNamed == DONT_CARE) && + (options.wantAutomatic == DONT_CARE) && + (options.wantExplicit == DONT_CARE) && + (options.useUnion == YES)) + { + options.wanted = 0; + options.wantReal = YES; + options.wantNamed = YES; + options.wantAutomatic = YES; + } + + /********************************************************************/ + /* */ + /* See if the server has XKB. */ + /* */ + /********************************************************************/ + theDisplay = XtDisplay(topLevel); + if (!InitXkb(theDisplay)) + { + fprintf(stderr,"Could not initialize XKB extension.\n"); + exit(0); + } + + if (options.wanted == 0) + { + fprintf(stderr,"No LED's were selected.\n\n"); + usage(argv[0]); + exit(0); + } + + /********************************************************************/ + /* */ + /* Set up the UI and go. */ + /* */ + /********************************************************************/ + XtRealizeWidget(topLevel); + InitializeUI(topLevel); + XtAppMainLoop(appContext); + + /* NOT REACHED */ + exit(0L); +} diff --git a/xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.man b/xorg-server/xkeyboard-config/tests/mxkbledpanel/mxkbledpanel.man new file mode 100644 index 000000000..e69de29bb diff --git a/xorg-server/xkeyboard-config/tests/ruby/README b/xorg-server/xkeyboard-config/tests/ruby/README new file mode 100644 index 000000000..2ddf58a82 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/ruby/README @@ -0,0 +1,3 @@ +This is just some stuff to play with symbols/inet file, trying to analize it. +Only maintainers might be interested. It is written in Ruby - but it will +never be actually used in xkeyboard-config distribution. diff --git a/xorg-server/xkeyboard-config/tests/ruby/find_fragments.rb b/xorg-server/xkeyboard-config/tests/ruby/find_fragments.rb new file mode 100644 index 000000000..f991ad0ab --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/ruby/find_fragments.rb @@ -0,0 +1,52 @@ +#!/usr/bin/ruby +# +# $Id$ +# The script finds the fragments +# + +require "xkbparser.rb" + +baseDir = "../.." + +symbolsDir = "#{baseDir}/symbols" +#symbolsDir = "." + +parser = Parser.new + +allSyms = parser.parse("#{symbolsDir}/inet") + +everything = allSyms.merge + +everything.filter(1) + +#numCombinations = 1 + +#puts "everything:" + +#everything.find_all do | symName, keycodes | +#puts "#{symName}, #{keycodes.length} mappings -> " +# keycodes.find_all do | keycode, counter | +# puts " #{keycode} -> #{counter} occurences" +# end +# numCombinations *= (keycodes.length + 1) +#end + +#puts "Total mappings: #{everything.length}/#{everything.full_length()}, #{numCombinations} combinations" +# + +numCombinations = 0 +allSyms.find_all do | symsName, symbols | + puts "n: #{symsName}" + + # Counting only symbols which used more than once + numDupSymbols = symbols.keys.inject(0) do | rv, keycode | + c = everything.cardinality(keycode, symbols[keycode]) + puts "#{keycode} -> #{symbols[keycode]}, #{c}" + (c > 0) ? rv : rv + 1 + end + + numCombinations += (1 << numDupSymbols) + puts "l: #{symbols.length} d: #{numDupSymbols} c: #{numCombinations}" +end + +puts "numCombinations: #{numCombinations}" diff --git a/xorg-server/xkeyboard-config/tests/ruby/find_match.rb b/xorg-server/xkeyboard-config/tests/ruby/find_match.rb new file mode 100644 index 000000000..43af93482 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/ruby/find_match.rb @@ -0,0 +1,42 @@ +#!/usr/bin/ruby +# +# $Id$ +# The script finds best matching xkb_symbols in symbols/in +# +# Parameters: $0 - the name of the file with new xkb_symbols +# $1 - max number of non-matching mappings (0 by default) +# + +require "xkbparser.rb" + +baseDir = "../.." + +symbolsDir = "#{baseDir}/symbols" +#symbolsDir = "." + +parser = Parser.new + +allSyms = parser.parse("#{symbolsDir}/inet") + +newSyms = parser.parse(ARGV[0]) +limit = ARGV[1].to_i + +newSyms.find_all do | key, value | + + if value.hidden? + next + end + + puts "Existing xkb_symbols matching #{key}: " + + sorted = allSyms.match_symbols(value,limit).sort_by do | symsName, diff | + sprintf "%03d_%s", diff.size, symsName + end + + sorted.find_all do | symsName, diff | + puts " #{symsName}, up to #{allSyms[symsName].size} keys (difference #{diff.size})-> #{diff}" + end + +end + + diff --git a/xorg-server/xkeyboard-config/tests/ruby/utils.rb b/xorg-server/xkeyboard-config/tests/ruby/utils.rb new file mode 100644 index 000000000..93ff0ee5e --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/ruby/utils.rb @@ -0,0 +1,64 @@ +# +# $Id$ +# +# Commont classes +# + +# +# The hash containing non-unique mappings +# It can have a->b and a->c together +# Also, for every mapping it counts the number of times this mapping was set +# +class NonuniqueCountingHash < Hash + + alias get_original [] + alias put_original []= + + def []=(key, value) + own = self.get_original(key) + hash = get_original(key) + if hash.nil? + put_original(key, hash = Hash.new) + end + if hash.has_key?(value) + hash[value] += 1 + else + hash[value] = 1 + end + end + + # + # Number of all mappings (a->b and a->c counted as 2 mappings) + # + def full_length() + values.inject(0) do | rv, hash | + rv + hash.length + end + end + + def cardinality(key1, key2) + if has_key?(key1) + hash = get_original(key1) + if hash.has_key?(key2) + hash[key2] + else + 0 + end + else + 0 + end + end + + def filter(limit) + find_all do | key, hash | + hash.find_all do | key1, counter | + if (counter <= limit) + hash.delete(key1) + end + end + if hash.empty? + delete(key) + end + end + end +end diff --git a/xorg-server/xkeyboard-config/tests/ruby/xkbparser.rb b/xorg-server/xkeyboard-config/tests/ruby/xkbparser.rb new file mode 100644 index 000000000..ecf246b6c --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/ruby/xkbparser.rb @@ -0,0 +1,185 @@ +# +# $Id$ +# +# Commont parsing classes for symbols/inet +# The parsing is simplified, based on regex - it is NOT a real parser for very +# complex XKB format +# + +require "utils.rb" + +class Symbols < Hash + + # + # Constructor + # + def initialize + @includedSyms = Array.new + end + + # Write-only property, parent list of symbols definitions + def symbols_list=(symbolsList) + @symbolsList = symbolsList + end + + # Whether this set of symbols is hidden or not + def hidden? + @hidden + end + + def hidden=(h) + @hidden = h + end + + # + # Add "dependency" - the symbols referenced using the "include" statement. + # + def add_included(other) + @includedSyms.push(other) + end + + alias get_original [] + alias keys_original keys + + # + # Get the symbol, trying first own definitions, then walking through all + # dependenies + # + def [](symName) + own = self.get_original(symName) + if own.nil? + @includedSyms.find_all do | symsName | + syms = @symbolsList[symsName] + his = syms[symName] + if !his.nil? + own = his + break + end + end + end + own + end + + # + # All keys - including the ones specified in the included sections + # + def keys() + @includedSyms.inject(keys_original) do | rv, symsName | + syms = @symbolsList[symsName] + rv | syms.keys + end + end + + # Size of all keys + def length() + keys().length() + end + + # + # Size - takes into account overlapping key definitions + # + def size() + keys.size() + end + + # + # Create a hash including all elements of this hash which are not in the + # other hash, use symbols + and * for marking the elements which existed in + # the original hash (+ if not existed) + # + def -(other) + diff = self.class.new + self.find_all do | key, value | + existing = other[key] + if existing != value + diff[key] = [ value, existing.nil? ? '+' : '' ] + end + end + diff + end + + + def to_s + s = "{\n" + # First output included syms + @includedSyms.find_all do | symsName | + s += " include \"inet(#{symsName})\"\n" + end + # Then - own definitions + self.find_all do | key, value | + s += " key #{key} { [ #{value} ] };\n" + end + s + "}"; + end + +end + +class SymbolsList < Hash + + # + # Add new xkb_symbols + # + def add_symbols (symbolsName, hidden) + newSyms = Symbols.new + newSyms.symbols_list = self + newSyms.hidden = hidden + self[symbolsName] = newSyms + end + + def to_s + s = "// Autogenerated\n\n" + self.find_all do | symbols, mapping | + s += "partial alphanumeric_keys\nxkb_symbols \"#{symbols}\" #{mapping};\n\n" + end + s + end + + def match_symbols(new_symbols,limit) + matching = Hash.new + find_all do | symbols, mapping | + diff = new_symbols - mapping + if diff.size <= limit + matching[symbols] = diff + end + end + matching + end + + def merge() + everything = NonuniqueCountingHash.new + find_all do | symsName, syms | + syms.find_all do | symName, keycode | + everything[symName] = keycode + end + end + everything + end + +end + +class Parser + + def parse (fileName) + allSyms = SymbolsList.new; + currentSyms = nil + hidden = false + File.open(fileName) do | file | + file.each_line do | line | + line.scan(/xkb_symbols\s+"(\w+)"/) do | symsName | + currentSyms = allSyms.add_symbols(symsName[0], hidden) + end + line.scan(/^\s*key\s*<(\w+)>\s*\{\s*\[\s*(\w+)/) do | keycode, keysym | + currentSyms[keycode] = keysym + end + line.scan(/^partial\s+(hidden\s+)?alphanumeric_keys/) do | h | + hidden = !h[0].nil? + end + line.scan(/^\s*include\s+"inet\((\w+)\)"/) do | otherPart | + currentSyms.add_included(otherPart[0]) + end + end + end + allSyms + end + +end diff --git a/xorg-server/xkeyboard-config/tests/testLayouts.pl b/xorg-server/xkeyboard-config/tests/testLayouts.pl new file mode 100644 index 000000000..a1d43a395 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/testLayouts.pl @@ -0,0 +1,17 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use xkbTestFunc; + +xkbTestFunc::backupXkbSettings(); + +xkbTestFunc::dumpXkbSettingsBackup(); + +xkbTestFunc::testLevel2( "layout", "variant", 2, "(", ")", 1, 1, 0 ); + +sleep 2; + +xkbTestFunc::restoreXkbSettings(); + +print "Done!\n"; diff --git a/xorg-server/xkeyboard-config/tests/testModels.pl b/xorg-server/xkeyboard-config/tests/testModels.pl new file mode 100644 index 000000000..ed4f99341 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/testModels.pl @@ -0,0 +1,15 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use xkbTestFunc; + +xkbTestFunc::backupXkbSettings(); + +xkbTestFunc::dumpXkbSettingsBackup(); + +xkbTestFunc::testLevel1( "model", 1 ); + +xkbTestFunc::restoreXkbSettings(); + +print "Done!\n"; diff --git a/xorg-server/xkeyboard-config/tests/testOptions.pl b/xorg-server/xkeyboard-config/tests/testOptions.pl new file mode 100644 index 000000000..57ccc58d3 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/testOptions.pl @@ -0,0 +1,15 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use xkbTestFunc; + +xkbTestFunc::backupXkbSettings(); + +xkbTestFunc::dumpXkbSettingsBackup(); + +xkbTestFunc::testLevel2( "group", "option", 4, ":", "", 0, 0, 1 ); + +xkbTestFunc::restoreXkbSettings(); + +print "Done!\n"; diff --git a/xorg-server/xkeyboard-config/tests/testShortDescriptions b/xorg-server/xkeyboard-config/tests/testShortDescriptions new file mode 100644 index 000000000..c05299e97 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/testShortDescriptions @@ -0,0 +1,6 @@ +#!/bin/sh + +awk '/shortDescr/{print toupper($0)}' ../rules/base.xml.in | sed 's/<[^>]*>//g;s/ //g' | sort | uniq > xml.sd +awk '{print $1}' ../docs/iso3166-3.csv | sort > iso.sd +diff -u iso.sd xml.sd | grep '+' + diff --git a/xorg-server/xkeyboard-config/tests/xkbTestFunc.pm b/xorg-server/xkeyboard-config/tests/xkbTestFunc.pm new file mode 100644 index 000000000..1d7881d23 --- /dev/null +++ b/xorg-server/xkeyboard-config/tests/xkbTestFunc.pm @@ -0,0 +1,164 @@ +package xkbTestFunc; + +use strict; +use warnings; + +our $VERSION='1.00'; + +our $origXkbRules; +our $origXkbModel; +our $origXkbLayouts; +our $origXkbOptions; +our $origXkbVariants; + +sub backupXkbSettings +{ + ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ) = getXkbSettings(); +} + +sub getXkbSettings +{ + my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ); + + open (XPROP, "xprop -root |") or die "Could not start xprop"; + PROP: while () + { + if (/_XKB_RULES_NAMES\(STRING\) = \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\"/) + { + ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = + ( $1, $2, $3, $4, $5 ) ; + last PROP; + } + } + close XPROP; + + return ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ); +} + +sub setXkbSettings +{ + my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_; + ( system ( "setxkbmap", "-synch", + "-rules", $xkbRules, + "-model", $xkbModel, + "-layout", $xkbLayouts, + "-variant", $xkbVariants, + "-option", $xkbOptions ) == 0 ) or die "Could not set xkb configuration"; + sleep 1; +} + +sub restoreXkbSettings +{ + setXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ); +} + +sub defaultXkbSettings +{ + return ( "base", "pc105", "us", "", "" ); +} + +sub dumpXkbSettings +{ + my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_; + print "rules: [$xkbRules]\n" ; + print "model: [$xkbModel]\n" ; + print "layouts: [$xkbLayouts]\n" ; + print "variants: [$xkbVariants]\n" ; + print "options: [$xkbOptions]\n" ; +} + +sub dumpXkbSettingsBackup +{ + dumpXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ); +} + +sub testLevel1 +{ + my ( $type, $idx ) = @_; + + open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or + die ( "Could not start xsltproc" ); + while () + { + chomp(); + if (/(\S+)/) + { + my $paramValue=$1; + print "--- setting $type: [$paramValue]\n"; + my @params = defaultXkbSettings(); + $params[$idx] = $paramValue; + dumpXkbSettings ( @params ); + setXkbSettings ( @params ); + #print "--- dump:\n"; + #dumpXkbSettings( getXkbSettings() ); + } + } + close XSLTPROC; +} + +sub testLevel2 +{ + my ( $type, $subtype, $idx, $delim1, $delim2, $ifCheckLevel1, $ifAddLevel1, $ifResetToDefault ) = @_; + + open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or + die ( "Could not start xsltproc" ); + while () + { + chomp(); + if (/(\S+)/) + { + my $paramValue=$1; + print "--- scanning $type: [$paramValue]\n"; + + if ( $ifCheckLevel1 ) + { + my @params = defaultXkbSettings(); + if ( $ifResetToDefault ) + { + setXkbSettings ( @params ); + } + $params[$idx] = "$paramValue"; + dumpXkbSettings ( @params ); + setXkbSettings ( @params ); + #print "--- dump:\n"; + #dumpXkbSettings( getXkbSettings() ); + } + + open ( XSLTPROC2, "xsltproc --stringparam type $subtype --stringparam parentId $paramValue listCI2.xsl ../rules/base.xml.in |" ) or + die ( "Could not start xsltproc" ); + while () + { + chomp(); + if (/(\S+)/) + { + my $paramValue2=$1; + print " --- $subtype: [$paramValue2]\n"; + my @params = defaultXkbSettings(); + if ( $ifResetToDefault ) + { + setXkbSettings ( @params ); + } + if ( $ifAddLevel1 ) + { + $params[$idx] = "$paramValue$delim1$paramValue2$delim2"; + } + else + { + $params[$idx] = "$paramValue2"; + } + dumpXkbSettings ( @params ); + setXkbSettings ( @params ); + #print "--- dump:\n"; + #dumpXkbSettings( getXkbSettings() ); + } + } + close XSLTPROC2; + } + } + close XSLTPROC; +} + +1; +__END__ + +No docs yet diff --git a/xorg-server/xkeyboard-config/xslt/reg2ll.xsl b/xorg-server/xkeyboard-config/xslt/reg2ll.xsl new file mode 100644 index 000000000..5cb4c8bec --- /dev/null +++ b/xorg-server/xkeyboard-config/xslt/reg2ll.xsl @@ -0,0 +1,23 @@ + + + + + + + + + + + + +:"" + + +():" - " + + diff --git a/xorg-server/xkeyboard-config/xslt/xfree86.xsl b/xorg-server/xkeyboard-config/xslt/xfree86.xsl new file mode 100644 index 000000000..8b4e84976 --- /dev/null +++ b/xorg-server/xkeyboard-config/xslt/xfree86.xsl @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3