doc: hook up doxygen

Build the doxygen API documentation. This is copied from libinput so it takes
over that style (which is more readable than the default doxygen style).
Some extra documentation is added too and all the immediate errors are fixed
in this commit but doxygen still warns about undocumented parameters.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-09-25 11:42:28 +10:00
parent 9db3e80cf4
commit 96ba358984
22 changed files with 9060 additions and 26 deletions

View file

@ -32,14 +32,14 @@ variables:
# See the documentation here: #
# https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html #
###############################################################################
FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config meson systemd-devel protobuf-c-devel libxkbcommon-devel'
FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config meson systemd-devel protobuf-c-devel libxkbcommon-devel doxygen'
############################ end of package lists #############################
# these tags should be updated each time the list of packages is updated
# changing these will force rebuilding the associated image
# Note: these tags have no meaning and are not tied to a particular
# libinput version
FEDORA_TAG: '2020-08-21.1'
FEDORA_TAG: '2020-09-25.0'
FDO_UPSTREAM_REPO: libinput/libei
@ -232,6 +232,14 @@ build-no-libxkcommon-nodeps@fedora:32:
before_script:
- dnf remove -y libxkcommon-devel
build-no-documentation@fedora:32:
extends:
- .fedora-build@template
variables:
MESON_ARGS: "-Ddocumentation=false"
before_script:
- dnf remove -y doxygen
build-no-portal@fedora:32:
extends:
- .fedora-build@template
@ -266,3 +274,20 @@ fedora:32@default-build:
needs:
- "fedora:32@container-prep"
pages:
stage: deploy
extends:
- .build@template
- .fdo.distribution-image@fedora
variables:
FDO_DISTRIBUTION_VERSION: '32'
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
after_script:
- mv "$MESON_BUILDDIR"/apidoc/ public
only:
refs:
- master
artifacts:
paths:
- public

View file

@ -38,7 +38,7 @@ variables:
# See the documentation here: #
# https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html #
###############################################################################
FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config meson systemd-devel protobuf-c-devel libxkbcommon-devel'
FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config meson systemd-devel protobuf-c-devel libxkbcommon-devel doxygen'
############################ end of package lists #############################
# these tags should be updated each time the list of packages is updated
@ -253,6 +253,14 @@ build-no-libxkcommon-nodeps@{{distro.name}}:{{version}}:
before_script:
- dnf remove -y libxkcommon-devel
build-no-documentation@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Ddocumentation=false"
before_script:
- dnf remove -y doxygen
build-no-portal@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
@ -298,3 +306,20 @@ valgrind@{{distro.name}}:{{version}}:
{% endfor %}
{% endfor %}
pages:
stage: deploy
extends:
- .build@template
- .fdo.distribution-image@fedora
variables:
FDO_DISTRIBUTION_VERSION: '32'
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
after_script:
- mv "$MESON_BUILDDIR"/apidoc/ public
only:
refs:
- master
artifacts:
paths:
- public

View file

@ -3,7 +3,7 @@
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2020-08-21.1'
.default_tag: &default_tag '2020-09-25.0'
distributions:
- name: fedora

View file

@ -14,6 +14,14 @@ for EI, or 🥣 brei.
For the purpose of this document, **libei** refers to the project,
`libei`/`libeis`/`libreis` to the libraries provided.
Documentation
-------------
The API documentation is available
[here](https://libinput.pages.freedesktop.org/libei/)
Overview
--------
In the Wayland stack, the EIS server component is part of the
compositor, the EI client component is part of the Wayland client.

29
doc/libei.doxygen.in Normal file
View file

@ -0,0 +1,29 @@
PROJECT_NAME = @PACKAGE_NAME@
PROJECT_NUMBER = @PACKAGE_VERSION@
PROJECT_BRIEF = "A library for Emulated Input"
JAVADOC_AUTOBRIEF = YES
TAB_SIZE = 8
OPTIMIZE_OUTPUT_FOR_C = YES
EXTRACT_ALL = YES
EXTRACT_STATIC = YES
MAX_INITIALIZER_LINES = 0
WARNINGS = YES
QUIET = YES
INPUT = "@builddir@"
IMAGE_PATH = "@builddir@"
GENERATE_HTML = YES
HTML_OUTPUT = apidoc
SEARCHENGINE = NO
USE_MATHJAX = YES
GENERATE_LATEX = NO
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
DOTFILE_DIRS = "@builddir@"
EXAMPLE_PATH = "@builddir@"
SHOW_NAMESPACES = NO
HTML_HEADER = "@builddir@/header.html"
HTML_FOOTER = "@builddir@/footer.html"
HTML_EXTRA_STYLESHEET = "@builddir@/bootstrap.css" \
"@builddir@/customdoxygen.css" \
"@builddir@/libeidoxygen.css"

61
doc/mainpage.dox Normal file
View file

@ -0,0 +1,61 @@
/**
@mainpage
This is the libei API reference.
libei provides two different libraries, `libei` for clients and `libeis` for
servers (read: compositors). These two libraries are independently and
normal consumers of either `libei` or `libeis` should never need the other
library.
@section ei EI - the client implementation
The `libei` library is the component used by clients that want to emulate
input. `libei` connects to an EIS implementation.
The API documentation for EI is available at @ref libei.
@section eis EIS - the server implementation
The `libeis` library is the component used by processes that handle input
events. `libeis` handles requests from a `libei` client.
The API documentation for EI is available at @ref libeis.
@section examples Examples
Please see the [demo programs](https://gitlab.freedesktop.org/libinput/libei/-/tree/master/tools)
in the git repository.
The `eis-demo-client` is a minimal client that connects to an EIS
implementation and sends events.
The `eis-demo-server` is a minimal EIS implementation that accepts all
requests and prints them to screen.
The `eis-fake-portal` is a minimal [XDG Desktop
Portal](https://github.com/flatpak/xdg-desktop-portal/) implementation that
connects a portal-aware libei client with an EIS implementation.
@section building_against Building against libei or libeis
libei and libeis provides
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) files.
Software that uses libei or libeis should use pkg-config and the
`PKG_CHECK_MODULES` autoconf macro or the `dependency()` function in meson.
Otherwise, the most rudimentary way to compile and link a program against
libei or libeis is:
@verbatim
gcc -o myprogram mylibeiclient.c `pkg-config --cflags --libs libei`
gcc -o myprogram myEISimplementation.c `pkg-config --cflags --libs libeis`
@endverbatim
For further information on using pkgconfig see the pkg-config documentation.
@section About
Documentation generated from git commit [__GIT_VERSION__](https://gitlab.freedesktop.org/libinput/libei/commit/__GIT_VERSION__)
*/

49
doc/meson.build Normal file
View file

@ -0,0 +1,49 @@
prg_install = find_program('install')
doxygen = find_program('doxygen', required : false)
if not doxygen.found()
error('Program "doxygen" not found or not executable. Try building with -Ddocumentation=false')
endif
mainpage = vcs_tag(command : ['git', 'log', '-1', '--format=%h'],
fallback : 'unknown',
input : 'mainpage.dox',
output : 'mainpage.dox',
replace_string: '__GIT_VERSION__')
src_doxygen = files(
# source files
'../src/libei.h',
'../src/libeis.h',
# style files
'style/header.html',
'style/footer.html',
'style/customdoxygen.css',
'style/bootstrap.css',
'style/libeidoxygen.css',
)
doxyfiles = []
foreach f : src_doxygen
df = configure_file(input: f,
output: '@PLAINNAME@',
copy : true)
doxyfiles += [ df ]
endforeach
doc_config = configuration_data()
doc_config.set('PACKAGE_NAME', meson.project_name())
doc_config.set('PACKAGE_VERSION', meson.project_version())
doc_config.set('builddir', meson.current_build_dir())
doxyfile = configure_file(input : 'libei.doxygen.in',
output : 'libei.doxygen',
configuration : doc_config)
custom_target('doxygen',
input : [ doxyfiles, doxyfile, mainpage ] + src_doxygen,
output : [ '.' ],
command : [ doxygen, doxyfile ],
install : false,
depends: [ mainpage ],
build_by_default : true)

229
doc/style/LICENSE Normal file
View file

@ -0,0 +1,229 @@
These licenses apply to the doxygen documentation HTML style only. They do
not apply or affect libinput itself.
Apache: https://github.com/Velron/doxygen-bootstrapped/
MIT: https://bootswatch.com/paper/bootstrap.css
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The MIT License (MIT)
Copyright (c) 2011-2015 Twitter, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
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.

6
doc/style/README.md Normal file
View file

@ -0,0 +1,6 @@
# Doxygen-Bootstrap
This is a small project for integrating Doxygen output with Twitter Bootstrap.
See the Stratify Documentation for an example: https://stratifylabs.co/StratifyAPI/html/
The header.html and footer.html files in this repo are designed to be used with Jekyll and Github pages (specifically it is based on https://github.com/plusjade/jekyll-bootstrap/). Be sure to modify the header/footer html files so that they fit your needs. You can look at the source of https://stratifylabs.co/StratifyAPI/html/ to see what css and js files are used in the header.

7500
doc/style/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load diff

254
doc/style/customdoxygen.css Normal file
View file

@ -0,0 +1,254 @@
h1, .h1, h2, .h2, h3, .h3{
font-weight: 200 !important;
}
#navrow1, #navrow2, #navrow3, #navrow4, #navrow5{
border-bottom: 1px solid #EEEEEE;
}
.adjust-right {
margin-left: 30px !important;
font-size: 1.15em !important;
}
.navbar{
border: 0px solid #222 !important;
}
/* Sticky footer styles
-------------------------------------------------- */
html,
body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
min-height: 100%;
height: auto;
/* Negative indent footer by its height */
margin: 0 auto -60px;
/* Pad bottom by footer height */
padding: 0 0 60px;
}
/* Set the fixed height of the footer here */
#footer {
font-size: 0.9em;
padding: 8px 0px;
background-color: #f5f5f5;
}
.footer-row {
line-height: 44px;
}
#footer > .container {
padding-left: 15px;
padding-right: 15px;
}
.footer-follow-icon {
margin-left: 3px;
text-decoration: none !important;
}
.footer-follow-icon img {
width: 20px;
}
.footer-link {
padding-top: 5px;
display: inline-block;
color: #999999;
text-decoration: none;
}
.footer-copyright {
text-align: center;
}
@media (min-width: 992px) {
.footer-row {
text-align: left;
}
.footer-icons {
text-align: right;
}
}
@media (max-width: 991px) {
.footer-row {
text-align: center;
}
.footer-icons {
text-align: center;
}
}
/* DOXYGEN Code Styles
----------------------------------- */
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #9CAFD4;
color: #ffffff;
border: 1px double #869DCA;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
/* @end */
dl.el {
margin-left: -1cm;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 105%;
}
div.fragment {
padding: 4px 6px;
margin: 4px 8px 4px 2px;
border: 1px solid #C4CFE5;
}
div.line {
font-family: monospace, fixed;
font-size: 13px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.line.glow {
background-color: cyan;
box-shadow: 0 0 10px cyan;
}
span.lineno {
padding-right: 4px;
text-align: right;
border-right: 2px solid #0F0;
background-color: #E8E8E8;
white-space: pre;
}
span.lineno a {
background-color: #D8D8D8;
}
span.lineno a:hover {
background-color: #C8C8C8;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
blockquote {
background-color: #F7F8FB;
border-left: 2px solid #9CAFD4;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}

98
doc/style/doxy-boot.js Normal file
View file

@ -0,0 +1,98 @@
/*
Copyright (c) 2013-2016, Tyler Gilbert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$( document ).ready(function() {
$("div.headertitle").addClass("page-header");
$("div.title").addClass("h1");
$('li > a[href="index.html"] > span').before("<i class='fa fa-cog'></i> ");
$('li > a[href="index.html"] > span').text("Stratify Labs");
$('li > a[href="modules.html"] > span').before("<i class='fa fa-square'></i> ");
$('li > a[href="namespaces.html"] > span').before("<i class='fa fa-bars'></i> ");
$('li > a[href="annotated.html"] > span').before("<i class='fa fa-list-ul'></i> ");
$('li > a[href="classes.html"] > span').before("<i class='fa fa-book'></i> ");
$('li > a[href="inherits.html"] > span').before("<i class='fa fa-sitemap'></i> ");
$('li > a[href="functions.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_func.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_vars.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_enum.html"] > span').before("<i class='fa fa-list'></i> ");
$('li > a[href="functions_eval.html"] > span').before("<i class='fa fa-list'></i> ");
$(".icona .icon").addClass("label label-danger");
$(".icona .icon").after(" ");
$('img[src="closed.png"]').before("<i class='fa fa-chevron-right'></i> ");
$('img[src="closed.png"]').hide();
$("div.qindex").css("margin-bottom", "3em");
$("div.textblock").css("margin-bottom", "3em");
$("table.memberdecls").css("margin-bottom", "3em");
$("table.memberdecls").css("margin-top", "3em");
$("span.arrow").replaceWith("<i class='fa fa-chevron-right'></i> ");
$("ul.tablist").addClass("nav nav-pills");
$("ul.tablist").css("margin-top", "0.5em");
$("ul.tablist").css("margin-bottom", "0.5em");
$("li.current").addClass("active");
$("iframe").attr("scrolling", "yes");
$("#nav-path > ul").addClass("breadcrumb");
$("table.params").addClass("table");
$("div.ingroups").wrapInner("<small></small>");
$("div.levels").css("margin", "0.5em");
$("div.levels > span").addClass("btn btn-default btn-xs");
$("div.levels > span").css("margin-right", "0.25em");
$("table.directory").addClass("table table-striped table-bordered");
$("[class^=separator]").remove();
$("div.summary > a").addClass("btn btn-default btn-xs");
$("table.fieldtable").addClass("table");
$(".fragment").addClass("well");
$(".memitem").addClass("panel panel-default");
$(".memproto").addClass("panel-heading");
$(".memdoc").addClass("panel-body");
$("span.mlabel").addClass("label label-info");
$("table.memberdecls").addClass("table table-bordered");
//$("[class^=memitem]").addClass("active");
$("div.ah").addClass("btn btn-default");
$("span.mlabels").addClass("pull-right");
$("table.mlabels").css("width", "100%")
$("td.mlabels-right").addClass("pull-right");
$("div.ttc").addClass("panel panel-info");
$("div.ttname").addClass("panel-heading");
$("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body");
});

12
doc/style/dynsections.js Normal file
View file

@ -0,0 +1,12 @@
function toggleVisibility(linkObj)
{var base=$(linkObj).attr('id');var summary=$('#'+base+'-summary');var content=$('#'+base+'-content');var trigger=$('#'+base+'-trigger');var src=$(trigger).attr('src');if(content.is(':visible')===true){content.hide();summary.show();$(linkObj).addClass('closed').removeClass('opened');$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');}else{content.show();summary.hide();$(linkObj).removeClass('closed').addClass('opened');$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');}
return false;}
function updateStripes()
{$('table.directory tr').removeClass('even').filter(':visible:even').addClass('even');}
function toggleLevel(level)
{$('table.directory tr').each(function(){var l=this.id.split('_').length-1;var i=$('#img'+this.id.substring(3));var a=$('#arr'+this.id.substring(3));if(l<level+1){i.removeClass('iconfopen iconfclosed').addClass('iconfopen');a.html('&#9660;');$(this).show();}else if(l==level+1){i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');a.html('&#9658;');$(this).show();}else{$(this).hide();}});updateStripes();}
function toggleFolder(id)
{var currentRow=$('#row_'+id);var rows=currentRow.nextAll("tr");var re=new RegExp('^row_'+id+'\\d+_$',"i");var childRows=rows.filter(function(){return this.id.match(re);});if(childRows.filter(':first').is(':visible')===true){var currentRowSpans=currentRow.find("span");currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");currentRowSpans.filter(".arrow").html('&#9658;');rows.filter("[id^=row_"+id+"]").hide();}else{var currentRowSpans=currentRow.find("span");currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");currentRowSpans.filter(".arrow").html('&#9660;');var childRowsSpans=childRows.find("span");childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");childRowsSpans.filter(".arrow").html('&#9658;');childRows.show();}
updateStripes();}
function toggleInherit(id)
{var rows=$('tr.inherit.'+id);var img=$('tr.inherit_header.'+id+' img');var src=$(img).attr('src');if(rows.filter(':first').is(':visible')===true){rows.css('display','none');$(img).attr('src',src.substring(0,src.length-8)+'closed.png');}else{rows.css('display','table-row');$(img).attr('src',src.substring(0,src.length-10)+'open.png');}}

26
doc/style/footer.html Normal file
View file

@ -0,0 +1,26 @@
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
</div>
</div>
</div>
</div>
</div>
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
</a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>

40
doc/style/header.html Normal file
View file

@ -0,0 +1,40 @@
<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- For Mobile Devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<!--<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>-->
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="doxy-boot.js"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand">$projectname $projectnumber</a>
</div>
</div>
</nav>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div class="content" id="content">
<div class="container">
<div class="row">
<div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
<div style="margin-bottom: 15px;">
<!-- end header part -->

183
doc/style/layout.xml Normal file
View file

@ -0,0 +1,183 @@
<doxygenlayout version="1.0">
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="no" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespaces" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
</tab>
<tab type="files" visible="no" title="">
<tab type="filelist" visible="no" title="" intro=""/>
<tab type="globals" visible="no" title="" intro=""/>
</tab>
<tab type="examples" visible="no" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="no"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<allmemberslink visible="yes"/>
<detaileddescription title="Documentation"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="no"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title="Documentation"/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<groupgraph visible="$GROUP_GRAPHS"/>
<briefdescription visible="yes"/>
<detaileddescription title="Documentation"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<dirs visible="yes" title=""/>
<nestedgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title="Documentation"/>
</directory>
</doxygenlayout>

120
doc/style/libeidoxygen.css Normal file
View file

@ -0,0 +1,120 @@
@import url("https://fonts.googleapis.com/css?family=Roboto+Mono");
dd {
margin-left: 30px;
}
.title {
font-size: 200%;
font-weight: bold;
}
.title .ingroups {
font-size: 50%;
}
h1 {
font-size: 150%;
color: #354C7B;
background: none;
border-bottom: 1px solid #879ECB;
font-size: 150%;
font-weight: normal;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 0px;
width: 100%;
}
h2 {
font-size: 120%;
color: #354C7B;
background: none;
border-bottom: 1px solid #879ECB;
font-size: 150%;
font-weight: normal;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 0px;
width: 100%;
}
.sm-dox li {
float:left;
border-top: 0;
padding-right: 20px;
}
.sm li, .sm a {
position: relative;
}
.sm, .sm ul, .sm li {
list-style: none;
display: block;
line-height: normal;
direction: ltr;
text-align: left;
}
.sm, .sm *, .sm *::before, .sm *::after {
box-sizing: border-box;
}
#main-nav {
padding: 30px;
}
/* Main menu sub-items like file-list, etc */
#main-menu li ul {
display: none;
}
.paramname {
padding-right: 10px;
}
.memtitle {
background-image: none;
background-color: #F0F0F0;
}
.memproto {
background-color: #F0F0F0;
}
.headertitle {
background-image: none;
background-color: #F0F0F0;
}
div.header {
border: none;
}
td.fieldname {
font-family: 'Roboto Mono', monospace;
}
.fieldtable th {
background-image: none;
background-color: #F0F0F0;
}
body {
letter-spacing: 0px;
}
.mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #F0F0F0;
}
a {
color: #2873b0;
}
.navpath ul {
background-image: none;
background-color: #F0F0F0;
}

173
doc/style/style.css Normal file
View file

@ -0,0 +1,173 @@
/* The standard CSS for doxygen */
pre.fragment {
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 12pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 110%;
}
div.fragment {
padding: 4px;
margin: 4px;
}
div.line {
font-family: monospace, fixed;
font-size: 16px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.line.glow {
background-color: cyan;
box-shadow: 0 0 10px cyan;
}
span.lineno {
padding-right: 4px;
text-align: right;
border-right: 2px solid #0F0;
white-space: pre;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
td.indexkey {
background-color: #EBEFF6;
font-weight: bold;
border: 1px solid #C4CFE5;
margin: 2px 0px 2px 0;
padding: 2px 10px;
white-space: nowrap;
vertical-align: top;
}
td.indexvalue {
background-color: #EBEFF6;
border: 1px solid #C4CFE5;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #EEF1F7;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
address.footer {
text-align: right;
padding-right: 12px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
/* @end */

View file

@ -277,3 +277,7 @@ executable('test-build-libreis',
install : false)
configure_file(output: 'config.h', configuration: config_h)
if get_option('documentation')
subdir('doc')
endif

View file

@ -1 +1,2 @@
option('portal', type: 'boolean', value: 'true', description: 'Enable/disable org.freedesktop.portal support')
option('documentation', type: 'boolean', value: 'true', description: 'Enable/disable building the API documentation')

View file

@ -27,10 +27,65 @@
#include <stdint.h>
#include <stddef.h>
/**
* @addtogroup libei EI - The client API
*
* libei is the client-side module. This API should be used by processes
* that need to emulate devices.
*
* @{
*/
/**
* @struct ei
*
* The main context to interact with libei. A libei context is a single
* connection to an EIS implementation and may contain multiple devices, see
* @ref ei_device.
*
* An @ref ei context is refcounted, see ei_unref().
*/
struct ei;
/**
* @struct ei_device
*
* A single device to generate input events from. A device may have multiple
* capabilities. For example, a single device may be a pointer and a keyboard
* and a touch device. It is up to the EIS implementation on how to handle
* this case, some implementations may split a single device up into
* multiple virtual devices, others may not.
*
* An @ref ei_device is refcounted, see ei_device_unref().
*/
struct ei_device;
/**
* @struct ei_event
*
* An event received from the EIS impelementation. See @ref ei_event_type
* for the list of possible event types.
*
* An @ref ei_event is refcounted, see ei_event_unref().
*/
struct ei_event;
/**
* @enum ei_device_capability
*
* The set of supported capabilities. A device may have one or more
* capabilities but never zero - a EIS implementation must reject any
* device with zero capabilities.
*
* Capabilities are requested by the EI client but the EIS
* implementation may further reduce the capabilities. For example, a client
* may request the pointer and keyboard capability but only the former is
* permitted by the server. Any keyboard events sent by such a device events
* will be treated as client bug and discarded.
*
* See eis_device_has_capability().
*
*/
enum ei_device_capability {
EI_DEVICE_CAP_POINTER = 1,
EI_DEVICE_CAP_POINTER_ABSOLUTE,
@ -38,11 +93,27 @@ enum ei_device_capability {
EI_DEVICE_CAP_TOUCH,
};
/**
* @enum ei_keymap_type
*
* The set of supported keymap types.
*/
enum ei_keymap_type {
/**
* No explicit keymap has been assigned.
*/
EI_KEYMAP_TYPE_NONE = 0,
/**
* A libxkbcommon-compatible XKB keymap.
*/
EI_KEYMAP_TYPE_XKB,
};
/**
* @enum ei_keymap_source
*
* Identifies who provided the device's keymap.
*/
enum ei_keymap_source {
/**
* The keymap is the one provided by the client.
@ -54,6 +125,9 @@ enum ei_keymap_source {
EI_KEYMAP_SOURCE_SERVER,
};
/**
* @enum ei_keymap_source
*/
enum ei_event_type {
/**
* The server has approved the connection to this client. The client
@ -68,7 +142,7 @@ enum ei_event_type {
/**
* The server has disconnected this client - all resources left to
* reference this server are now obsolete. Once this event has been
* received, the @ref struct ei and all its associated resources
* received, the struct @ref ei and all its associated resources
* should be released.
*
* This event may occur at any time after the connection has been
@ -96,7 +170,7 @@ enum ei_event_type {
/**
* The server has removed a device belonging to this client. The
* caller should release the @ref struct ei_device and all its
* caller should release the struct @ref ei_device and all its
* associated resources. Any events sent through a removed device
* are discarded.
*/
@ -154,6 +228,7 @@ typedef void (*ei_log_handler)(struct ei *ei,
* Change the log handler for this context. If the log handler is NULL, the
* built-in default log function is used.
*
* @param ei The EI context
* @param log_handler The log handler or NULL to use the default log
* handler.
*/
@ -239,23 +314,32 @@ void
ei_set_user_data(struct ei *ei, void *user_data);
/**
* Connect to the org.freedesktop.portal.Desktop portal
* Return the custom data pointer for this context. libei will not look at or
* modify the pointer. Use ei_set_user_data() to change the user data.
*/
void *
ei_get_user_data(struct ei *ei);
/**
* Connect to the `org.freedesktop.portal.Desktop` portal.
*
* @return 0 on success or a negative errno on failure
*/
int
ei_setup_backend_portal(struct ei *ei);
/**
* Connect to an `org.freedesktop.portal.Desktop` implementation on the
* given busname.
*
* Outside of testing environments, there is usually no reason to use
* this function, use ei_setup_backend_portal() instead.
*
* @return 0 on success or a negative errno on failure
*/
int
ei_setup_backend_portal_busname(struct ei *ei, const char *busname);
/**
* Return the custom data pointer for this context. libei will not look at or
* modify the pointer. Use ei_set_user_data() to change the user data.
*/
void *
ei_get_user_data(struct ei *ei);
/**
* libei keeps a single file descriptor for all events. This fd should be
* monitored for events by the caller's mainloop, e.g. using select(). When
@ -286,8 +370,8 @@ struct ei_event *
ei_get_event(struct ei *ei);
/**
* Returns the next event in the internal event queue (or NULL) without
* removing that event from the queue, i.e. the next call to ei_get_event()
* Returns the next event in the internal event queue (or `NULL`) without
* removing that event from the queue; the next call to ei_get_event()
* will return that same event.
*
* This call is useful for checking whether there is an event and/or what
@ -299,7 +383,7 @@ ei_get_event(struct ei *ei);
* reference.
*
* A caller must not call ei_get_event() while holding a ref to an event
* returned by ei_peek_event().
* returned by ei_peek_event(). Doing so is undefined behavior.
*/
struct ei_event *
ei_peek_event(struct ei *ei);
@ -316,9 +400,22 @@ ei_peek_event(struct ei *ei);
struct ei_event *
ei_event_unref(struct ei_event *event);
/**
* Increase the refcount of this struct by one. Use ei_device_unref() to
* decrease the refcount.
*
* @return the argument passed into the function
*/
struct ei_device *
ei_device_ref(struct ei_device *device);
/**
* Decrease the refcount of this struct by one. When the refcount reaches
* zero, the context disconnects from the server and all allocated resources
* are released.
*
* @return always NULL
*/
struct ei_device *
ei_device_unref(struct ei_device *device);
@ -337,9 +434,18 @@ ei_device_unref(struct ei_device *device);
struct ei_device *
ei_device_new(struct ei *ei);
/**
* Set a custom data pointer for this context. libei will not look at or
* modify the pointer. Use ei_device_get_user_data() to retrieve a
* previously set user data.
*/
void
ei_device_set_user_data(struct ei_device *device, void *user_data);
/**
* Return the custom data pointer for this context. libei will not look at or
* modify the pointer. Use ei_device_get_user_data() to change the user data.
*/
void *
ei_device_get_user_data(struct ei_device *device);
@ -354,6 +460,7 @@ ei_device_get_user_data(struct ei_device *device);
* libei may quietly ignore names of unreasonable length. This is not
* something a normal caller ever needs to worry about.
*
* @param device The EI device
* @param name A name suggestion for the device
*/
void
@ -367,6 +474,7 @@ ei_device_configure_name(struct ei_device *device, const char *name);
*
* This function has no effect if called after ei_device_add()
*
* @param device The EI device
* @param cap The capability to enable
*/
bool
@ -399,8 +507,9 @@ ei_device_configure_capability(struct ei_device *device,
*
* This function has no effect if called after ei_device_add()
*
* @param device The EI device
* @param width The maximum (exclusive) x value in logical pixels
* @param heigth The maximum (exclusive) y value in logical pixels
* @param height The maximum (exclusive) y value in logical pixels
*/
void
ei_device_pointer_configure_range(struct ei_device *device,
@ -434,8 +543,10 @@ ei_device_touch_configure_range(struct ei_device *device,
*
* This function has no effect if called after ei_device_add()
*
* @param device The EI device
* @param type the type of the keymap
* @param fd a memmap-able file descriptor to the keymap
* @param size size of the keymap in bytes
*/
void
ei_device_keyboard_configure_keymap(struct ei_device *device,
@ -447,6 +558,11 @@ ei_device_keyboard_configure_keymap(struct ei_device *device,
* The server will respond with an @ref EI_EVENT_DEVICE_ADDED or @ref
* EI_EVENT_DEVICE_REMOVED event once the request has been processed.
*
* A client can assume that an @ref EI_EVENT_DEVICE_REMOVED event is sent
* for any device for which ei_device_add() was called before the @ref
* EI_EVENT_DISCONNECT. Where a client gets
* disconnected libei will emulate that event.
*
* A client may not send events through this device until it has been added
* by the server.
*/
@ -461,19 +577,24 @@ ei_device_add(struct ei_device *device);
* @ref EI_EVENT_DEVICE_REMOVED event for this device. After that event,
* device is considered removed by the server.
*
* A client can assume that an @ref EI_EVENT_DEVICE_REMOVED event is sent
* for any device for which ei_device_remove() was called before the @ref
* EI_EVENT_DISCONNECT. Where a client gets
* disconnected libei will emulate that event.
*
* This does not release any resources associated with this device, use
* ei_device_unref() for any references held by the client.
*/
void
ei_device_remove(struct ei_device *device);
/**
* Return the name of this device. The name of the device may change after
* ei_device_add() to the server-assigned name.
* Return the name of this device.
*
* The string pointed to may be freed at any time, callers must strdup() the
* returned value if they need to keep the name around.
* The return value of this function is constant after receiving the @ref
* EI_EVENT_DEVICE_ADDED event. Before then, the returned string may be
* freed at any time, callers must strdup() the returned value if they need
* to keep the name around.
*
* @return the name of the device (if any) or NULL
*/
@ -482,7 +603,7 @@ ei_device_get_name(struct ei_device *device);
/**
* Return true if the device has the requested capability. Device
* capabilities are constant after @ref EI_EVENT_DEVICE_ADDED.
* capabilities are constant after the @ref EI_EVENT_DEVICE_ADDED event.
*
* To change a device's capability, the device must be removed and a new
* device with the different capabilities must be added.
@ -491,15 +612,35 @@ bool
ei_device_has_capability(struct ei_device *device,
enum ei_device_capability cap);
/**
* Return the requested width for an @ref EI_DEVICE_CAP_POINTER_ABSOLUTE
* device. The width and height is constant after the @ref
* EI_EVENT_DEVICE_ADDED event.
*/
uint32_t
ei_device_pointer_get_width(struct ei_device *device);
/**
* Return the requested height for an @ref EI_DEVICE_CAP_POINTER_ABSOLUTE
* device. The width and height is constant after the @ref
* EI_EVENT_DEVICE_ADDED event.
*/
uint32_t
ei_device_pointer_get_height(struct ei_device *device);
/**
* Return the requested width for an @ref EI_DEVICE_CAP_TOUCH
* device. The width and height is constant after the @ref
* EI_EVENT_DEVICE_ADDED event.
*/
uint32_t
ei_device_touch_get_width(struct ei_device *device);
/**
* Return the requested height for an @ref EI_DEVICE_CAP_TOUCH
* device. The width and height is constant after the @ref
* EI_EVENT_DEVICE_ADDED event.
*/
uint32_t
ei_device_touch_get_height(struct ei_device *device);
@ -518,6 +659,9 @@ ei_device_touch_get_height(struct ei_device *device);
int
ei_device_keyboard_get_keymap(struct ei_device *device);
/**
* @return the size of the keymap in bytes
*/
size_t
ei_device_keyboard_get_keymap_size(struct ei_device *device);
@ -552,6 +696,9 @@ enum ei_keymap_source
ei_device_keyboard_get_keymap_source(struct ei_device *device);
/**
* Return the struct @ref ei context this device is associated with.
*/
struct ei *
ei_device_get_context(struct ei_device *device);
@ -559,6 +706,7 @@ ei_device_get_context(struct ei_device *device);
* Generate a relative motion event on a device with
* the @ref EI_DEVICE_CAP_POINTER capability.
*
* @param device The EI device
* @param x The x movement in logical pixels
* @param y The y movement in logical pixels
*/
@ -574,6 +722,7 @@ ei_device_pointer_motion(struct ei_device *device, double x, double y);
* - 0 <= y < height
* If these conditions are not met, the event is silently discarded.
*
* @param device The EI device
* @param x The x position in logical pixels
* @param y The y position in logical pixels
*/
@ -586,8 +735,9 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
* the @ref EI_DEVICE_CAP_POINTER_ABSOLUTE or
* @ref EI_DEVICE_CAP_POINTER capability.
*
* Button codes must match the #defines in linux/input-event-codes.h
* Button codes must match the defines in linux/input-event-codes.h
*
* @param device The EI device
* @param button The button code
* @param is_press true for button press, false for button release
*/
@ -604,6 +754,7 @@ ei_device_pointer_button(struct ei_device *device,
* do not call ei_device_pointer_scroll_discrete() for the
* same input event.
*
* @param device The EI device
* @param x The x scroll distance in logical pixels
* @param y The y scroll distance in logical pixels
*
@ -625,6 +776,7 @@ ei_device_pointer_scroll(struct ei_device *device, double x, double y);
* do not call ei_device_pointer_scroll() for the
* same input event.
*
* @param device The EI device
* @param x The x scroll distance in fractions or multiples of 120
* @param y The y scroll distance in fractions or multiples of 120
*
@ -640,6 +792,7 @@ ei_device_pointer_scroll_discrete(struct ei_device *device, int32_t x, int32_t y
* Keys use the evdev scan codes as defined in
* linux/input-event-codes.h
*
* @param device The EI device
* @param keycode The key code
* @param is_press true for key down, false for key up
*/
@ -660,10 +813,21 @@ ei_device_touch_new(struct ei_device *device);
/**
* This function can only be called once on an ei_touch object. Further
* calls to ei_touch_down() on the same object are silently ignored.
*
* The required conditions are:
* - 0 <= x < width
* - 0 <= y < height
*
* @param touch A newly created touch
* @param x The x position in logical pixels
* @param y The y position in logical pixels
*/
void
ei_touch_down(struct ei_touch *touch, double x, double y);
/**
* Move this touch to the new coordinates.
*/
void
ei_touch_motion(struct ei_touch *touch, double x, double y);
@ -687,6 +851,9 @@ ei_touch_get_user_data(struct ei_touch *touch);
void
ei_touch_set_user_data(struct ei_touch *touch, void *user_data);
/**
* @return the device this touch originates on
*/
struct ei_device *
ei_touch_get_device(struct ei_touch *touch);
@ -698,6 +865,7 @@ ei_touch_get_device(struct ei_touch *touch);
* - 0 <= x < width
* - 0 <= y < height
*
* @param device The EI device
* @param x The x position in logical pixels
* @param y The y position in logical pixels
*/
@ -725,3 +893,7 @@ ei_event_get_device(struct ei_event *event);
*/
uint64_t
ei_event_get_time(struct ei_event *event);
/**
* @}
*/

View file

@ -28,6 +28,15 @@
#include <stdbool.h>
#include <stdint.h>
/**
* @addtogroup libeis EIS - The server API
*
* libeis is the server-side module. This API should be used by processes
* that have control over input devices, e.g. Wayland compositors.
*
* @{
*/
struct eis;
struct eis_client;
struct eis_device;
@ -119,6 +128,7 @@ typedef void (*eis_log_handler)(struct eis *eis,
* Change the log handler for this context. If the log handler is NULL, the
* built-in default log function is used.
*
* @param eis The EIS context
* @param log_handler The log handler or NULL to use the default log
* handler.
*/
@ -305,7 +315,8 @@ eis_device_has_capability(struct eis_device *device,
/**
* Allow a capability on the device. This function must be called in
* response to an @EIS_EVENT_DEVICE_ADDED and before eis_device_connect().
* response to an @ref EIS_EVENT_DEVICE_ADDED and before
* eis_device_connect().
*
* This function has no effect if called for a capability the device does
* not support.
@ -411,6 +422,8 @@ uint32_t
eis_device_touch_get_width(struct eis_device *device);
/**
* @param device The EI device
*
* @see eis_device_touch_get_width
*/
uint32_t
@ -451,8 +464,10 @@ eis_device_keyboard_get_keymap_type(struct eis_device *device);
*
* This function has no effect if called after eis_device_connect()
*
* @param device the EIS device
* @param type the type of the keymap
* @param fd a memmap-able file descriptor to the keymap
* @param size the size of the keymap in bytes
*/
void
eis_device_keyboard_set_keymap(struct eis_device *device,
@ -578,3 +593,7 @@ eis_event_touch_get_x(struct eis_event *event);
*/
double
eis_event_touch_get_y(struct eis_event *event);
/**
* @}
*/