Import Upstream version 2.34.1
This commit is contained in:
commit
58e3841b5c
|
@ -0,0 +1,18 @@
|
|||
|
||||
Authors of AT-SPI D-Bus implementation
|
||||
--------------------------------------
|
||||
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
Mark Doffman <mark.doffman@codethink.co.uk>
|
||||
|
||||
|
||||
Authors of AT-SPI spec & implementation in CORBA
|
||||
------------------------------------------------
|
||||
|
||||
Bill Haneman <bill.haneman@sun.com>
|
||||
Marc Mulcahy <marc.mulchay@sun.com>
|
||||
Michael Meeks <micheal@ximian.com>
|
||||
Li Yuan <lee.yuan@oracle.com>
|
||||
|
||||
with contributions from:
|
||||
Mark McLoughlin <mark@skynet.ie>
|
|
@ -0,0 +1,502 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -0,0 +1 @@
|
|||
Mike Gorse <mgorse@suse.com>
|
|
@ -0,0 +1,662 @@
|
|||
What's new in at-spi2-atk 2.34.1:
|
||||
|
||||
* socket_embed_hook: Make plug_id parameter const.
|
||||
|
||||
What's new in at-spi2-atk 2.34.0:
|
||||
|
||||
* Updated doap.
|
||||
|
||||
What's new in at-spi2-atk 2.33.92:
|
||||
|
||||
* License is now lGPL-2.1+.
|
||||
* Several test fixes (thanks to Samuel THibault).
|
||||
* Initialize desktop name/path early; needed since we now defer
|
||||
registration.
|
||||
|
||||
What's new in at-spi2-atk 2.33.91:
|
||||
|
||||
* Defer registration until the main loop is entered. This fixes an issue
|
||||
where a Python application could import gtk but not enter the main loop,
|
||||
resulting in the application registering with AT-SPI but not responding
|
||||
to queries.
|
||||
|
||||
* Make sure return values are initialized for some functions.
|
||||
|
||||
What's new in at-spi2-atk 2.33.2:
|
||||
|
||||
* Add support for ROLE_CONTENT_DELETION and ROLE_CONTENT_INSERTION
|
||||
|
||||
* Fix a build issue where libgobject might not have been linked, resulting in
|
||||
undefined symbols.
|
||||
|
||||
What's new in at-spi2-atk 2.33.1:
|
||||
|
||||
* Document atk_bridge_adaptor_init error messages.
|
||||
|
||||
* Add atk_bridge_set_event_context.
|
||||
|
||||
* Add AccessibleId property.
|
||||
|
||||
What's new in at-spi2-atk 2.31.92:
|
||||
|
||||
* Fix a crash when retrieveing headers from table cells.
|
||||
|
||||
What's new in at-spi2-atk 2.31.2:
|
||||
|
||||
* Add ScrollSubstringTo and ScrollSubstringToPoint interfaces.
|
||||
|
||||
What's new in at-spi2-atk 2.29.1:
|
||||
|
||||
* Fix a case where we could return without unlocking a mutex (bgo#793625).
|
||||
|
||||
* Add ScrollTo and ScrollToPoint interfaces.
|
||||
|
||||
* Fix various compiler warnings and build issues.
|
||||
|
||||
What's new in at-spi2-atk 2.26.1:
|
||||
|
||||
* meson: Ensure paths written to .pc file are absolute.
|
||||
|
||||
* Package a couple of missing meson.build files.
|
||||
|
||||
What's new in at-spi2-atk 2.25.3:
|
||||
|
||||
* Add error-message, error-for, details, and details-for relation types
|
||||
|
||||
* Add Meson build system (thanks to Emmanuele Bassi).
|
||||
|
||||
What's new in at-spi2-atk 2.25.2:
|
||||
|
||||
* Fix use after free when returned objects hold only one ref (bgo#781716).
|
||||
|
||||
* Add some missing roles to correspond with atk (description list,
|
||||
description term, description value, and footnote).
|
||||
|
||||
What's new in at-spi2-atk 2.25.1:
|
||||
|
||||
* Fix position getter for table cells.
|
||||
|
||||
* Fix memory corruption when deleting an event from the list of events
|
||||
for which there are registered listeners (bgo#781658).
|
||||
|
||||
What's new in at-spi2-atk 2.24.0:
|
||||
|
||||
* test: remove atk_table_cell_get_column_index test, as the
|
||||
at-spi2-core function no longer exists (and never worked anyhow).
|
||||
|
||||
What's new in at-spi2-atk 2.22.0:
|
||||
|
||||
* Remove some inadverrtently-committed debugging code.
|
||||
|
||||
What's new in at-spi2-atk 2.21.91:
|
||||
What's new in at-spi2-atk 2.21.91:
|
||||
|
||||
* atk_bridge_adaptor_init: return -1 if NO_AT_BRIDGE is set (bgo#770574).
|
||||
|
||||
What's new in at-spi2-atk 2.21.4:
|
||||
|
||||
* emit_event: Fix out-of-bounds memory access if class is NULL.
|
||||
|
||||
* Collection: fix missing return value (bgo#758934).
|
||||
|
||||
What's new in at-spi2-atk 2.19.92:
|
||||
|
||||
* Don't drop the main context when p2p socket configuration fails
|
||||
(bgo#763273).
|
||||
|
||||
* Make sure the runtime directory exists (bgo#763274).
|
||||
|
||||
What's new in at-spi2-atk 2.19.91:
|
||||
|
||||
* Avoid lagging with large gtk menus (bgo#754048).
|
||||
|
||||
What's new in at-spi2-atk 2.19.90:
|
||||
|
||||
* Always accept connections as root if unable to find an owning user.
|
||||
|
||||
What's new in at-spi2-atk 2.19.2:
|
||||
|
||||
* Test fixes for atk-adaptor and cache changes.
|
||||
|
||||
* Fixes for Text, Value, and Table Cell adaptors (bgo#755724).
|
||||
|
||||
* Many new tests, thanks to Patryk Kaczmarek of Samsung.
|
||||
|
||||
What's new in at-spi2-atk 2.17.90:
|
||||
|
||||
* Update for new caching API (bgo#650090).
|
||||
|
||||
What's new in at-spi2-atk 2.17.1:
|
||||
|
||||
* Eliminate some console warnings due to NULL gobjects.
|
||||
|
||||
* Tests: fix out-of-source and parallel build (bgo#751137).
|
||||
|
||||
* Add some missing files to the distribution (bgo#751138).
|
||||
|
||||
What's new in at-spi2-atk 2.15.90:
|
||||
|
||||
* Add roles for fractions, roots, subscripts, and superscripts.
|
||||
|
||||
* Add action tests (bgo#743418).
|
||||
|
||||
What's new in at-spi2-atk 2.15.4:
|
||||
|
||||
* Don't parse non-existent signal arguments from atk.
|
||||
|
||||
* Support ATK_STATE_HAS_TOOLTIP (bgo#738953).
|
||||
|
||||
* Support ATK_STATE_READ_ONLY (bgo#690008).
|
||||
|
||||
What's new in at-spi2-atk 2.15.3:
|
||||
|
||||
* Add mapping between ATK_ROLE_STATIC and ATSPI_ROLE_STATIC
|
||||
|
||||
What's new in at-spi2-atk 2.14.1:
|
||||
|
||||
* Aggressively filter out children-changed signals for objects with
|
||||
MANAGES_DESCENDANTS (bgo#728319).
|
||||
|
||||
What's new in at-spi2-atk 2.13.4:
|
||||
|
||||
* Fix typo in .pc file (bgo#721719).
|
||||
|
||||
* Fix retrieving text attributes (bgo#731980).
|
||||
|
||||
* Correctly remove the socket on exit (bgo#684076).
|
||||
|
||||
What's new in at-spi2-atk 2.13.1:
|
||||
|
||||
* Add an atexit handler to remove the D-Bus socket (bgo#684076).
|
||||
|
||||
* Only send cache-related events for transients when explicitly requested.
|
||||
Hopefully this will improve performance when we are flooded with them.
|
||||
(bgo#728319).
|
||||
|
||||
What's new in at-spi2-atk 2.11.92:
|
||||
|
||||
* Bump minimum libdbus version needed, since we use a function
|
||||
introduced in 1.5.
|
||||
|
||||
What's new in at-spi2-atk 2.11.91:
|
||||
|
||||
* Improve compatibility with at-spi2-registryd <= 2.10.
|
||||
|
||||
* Collection: Fix an infinite loop when encountering a NULL parent
|
||||
|
||||
What's new in at-spi2-atk 2.11.90:
|
||||
|
||||
* Add AtspitableCell, tracking the new atk interface
|
||||
|
||||
What's new in at-spi2-atk 2.11.5:
|
||||
|
||||
* Allow sending of properties with events upon request (BGO#708695).
|
||||
|
||||
What's new in at-spi2-atk 2.11.3:
|
||||
|
||||
* Fix atspi_text_get_bounded_ranges
|
||||
|
||||
* document: add support to current page and page count (BGO#719508).
|
||||
|
||||
What's new in at-spi2-atk 2.11.2:
|
||||
|
||||
* Add new roles and states to track atk (BGO#710464, BGO#712608, BGO#712609).
|
||||
|
||||
What's new in at-spi2-atk 2.11.1:
|
||||
|
||||
* Fix Contains method for components (BGO#710730).
|
||||
|
||||
What's new in at-spi2-atk 2.9.92:
|
||||
|
||||
* Properly clean up when timing out when motifying keystroke listeners
|
||||
(BGO#707218).
|
||||
|
||||
* Allow lists of attribute values when reading collection match rules
|
||||
(BGO#700865).
|
||||
|
||||
What's new in at-spi2-atk 2.9.90:
|
||||
|
||||
* Implement GetStringAtOffset (BGO#705581).
|
||||
|
||||
What's new in at-spi2-atk 2.9.5:
|
||||
|
||||
* Fix another crash when we're initialized and shut down repeatedly.
|
||||
|
||||
What's new in at-spi2-atk 2.9.4:
|
||||
|
||||
* Fix a deadlock for apps that also register AT-SPI key event listeners
|
||||
(ie, the Orca preferences dialog works again).
|
||||
|
||||
What's new in at-spi2-atk 2.9.3:
|
||||
|
||||
* Fix for BGO#681276 (reentrancy issues with gnome-shell).
|
||||
|
||||
What's new in at-spi2-atk 2.9.2:
|
||||
|
||||
* Fix a memory leak in the socket adaptor (BGO#696733).
|
||||
|
||||
* Fix various DBusError leaks (BGO#698951).
|
||||
|
||||
* Fix crash when a main loop is shut down repeatedly (BGO#699554).
|
||||
|
||||
* Suppress a warning if an app returns NULL when referencing a child.
|
||||
|
||||
What's new in at-spi2-atk 2.7.91:
|
||||
|
||||
* Add Locale property (BGO#694368).
|
||||
|
||||
What's new in at-spi2-atk 2.7.90:
|
||||
|
||||
* Bump atk dependency to 2.7.5 (BGO#693189).
|
||||
|
||||
What's new in at-spi2-atk 2.7.5:
|
||||
|
||||
* Support ATSPI_ROLE_LEVEL_BAR to correspond to the new atk role.
|
||||
|
||||
* Fix various compiler warnings.
|
||||
|
||||
What's new in at-spi2-atk 2.7.3:
|
||||
|
||||
* re-register if the registry goes away and later returns.
|
||||
|
||||
* Stop using deprecated glib functions.
|
||||
|
||||
* Fix a few memory leaks.
|
||||
|
||||
What's new in at-spi2-atk 2.7.2:
|
||||
|
||||
* atk-adaptor: don't emit a critical in case the bridge was not initialized
|
||||
(BGO#684334).
|
||||
|
||||
* Remove dbind (it was only used for the droute test).
|
||||
|
||||
* Fix a crash in socket_embed_hook if spi_global_register is NULL.
|
||||
|
||||
* [droute] Fix memory leak in path cleanup (BGO#688363).
|
||||
|
||||
What's new in at-spi2-atk 2.7.1:
|
||||
|
||||
* Remove the schema; it was only used to specify the location of the
|
||||
atk-bridge library, which is now installed in the standard path.
|
||||
|
||||
* Fix compiler warnings (BGO#678045).
|
||||
|
||||
What's new in at-spi2-atk 2.6.0:
|
||||
|
||||
* Fix some crashes in atk_bridge_adaptor_cleanup (BGO#684434).
|
||||
|
||||
* When the cache is activated, register it on the main D-Bus connection.
|
||||
|
||||
What's new in at-spi2-atk 2.5.92:
|
||||
|
||||
* Fix atspi_hyperlink_get_uri (BGO#683182).
|
||||
|
||||
* Only initialize the cache when an AT is running.
|
||||
|
||||
* Fix various memory leaks (BGO#683979, BGO#684077)
|
||||
What's new in at-spi2-atk 2.5.91:
|
||||
|
||||
* Removed the gtk 3.0 module (BGO#678315).
|
||||
|
||||
What's new in at-spi2-atk 2.5.90:
|
||||
|
||||
* Don't leak a GError when option parsing fails (BGO#679296)
|
||||
|
||||
* Rework some inefficient code when removing clients and events (BGO#679295,
|
||||
BGO#679297).
|
||||
|
||||
What's new in at-spi2-atk 2.5.5:
|
||||
|
||||
* Implement GetLocalizedName for actions (BGO#680598)
|
||||
|
||||
* Allow to build out of source directory (BGO#680280).
|
||||
|
||||
What's new in at-spi2-atk 2.5.4:
|
||||
|
||||
Fix for bug #679013 - AtspiCollection should be implemented for
|
||||
all containers
|
||||
|
||||
* Don't create a (non-readable) subdirectory for the socket when root.
|
||||
|
||||
* Plug ref count leaks (BGO#679285).
|
||||
|
||||
* Only create a directory and a socket when requested.
|
||||
|
||||
* Only add items to the cache on children-changed if the children are
|
||||
included in the event.
|
||||
|
||||
* Only send PropertyChange signals used for caching, absent listeners.
|
||||
|
||||
What's new in at-spi2-atk 2.5.3:
|
||||
|
||||
* Create a library (libatk-bridge), currently with atk_bridge_adaptor_init()
|
||||
and atk_bridge_adaptor_cleanup() functions, to facilitate linking directly
|
||||
into, ie GTK+ 3.
|
||||
|
||||
* Only register events at beginning if an AT is listening (BGO#678475).
|
||||
|
||||
* Use XDG_RUNTIME_DIR to hold the socket, rather than a potentially secure
|
||||
directory hard-coded under /tmp (BGO#678348).
|
||||
|
||||
* Fix various compiler warnings and build errors.
|
||||
|
||||
What's new in at-spi2-atk 2.5.2:
|
||||
|
||||
* Fix for bug 677211 - The collection interface's MATCH_ANY fails for states
|
||||
|
||||
What's new in at-spi2-atk 2.5.1:
|
||||
|
||||
* Updated Norwegian Nynorsk translation
|
||||
|
||||
What's new in at-spi2-atk 2.4.0:
|
||||
|
||||
* Updated Hindi translation.
|
||||
|
||||
What's new in at-spi2-atk 2.3.92:
|
||||
|
||||
* Add Khmer and Malayalam translations.
|
||||
|
||||
What's new in at-spi2-atk 2.3.91:
|
||||
|
||||
* Have GetIndexInParent() return a signed int, per the spec.
|
||||
|
||||
* Send a DoAction reply message before invoking atk (works around
|
||||
atk_action_do_action potentially not returning right away for gtk).
|
||||
|
||||
|
||||
What's new in at-spi2-atk 2.3.90:
|
||||
|
||||
* Have GrabFocus return a bool, per the spec, rather than a uint32.
|
||||
|
||||
* Fix a potential crash when emitting a signal if the ATK implementor
|
||||
misbehaves.
|
||||
|
||||
What's new in at-spi2-atk 2.3.5:
|
||||
|
||||
* Remove the ability to set an accessible's name and description via AT-SPI
|
||||
(it seems wrong to have been exposing this in the first place).
|
||||
|
||||
* Fix for BGO#659967: some list API usage fixes.
|
||||
|
||||
* Fix for BGO#663967: Don't use /a11y/ as a dconf path.
|
||||
|
||||
* Fix for BGO#666371: possible crash when accessibles are created and
|
||||
deleted in rapid succession; eg, in gnome-shell)
|
||||
|
||||
* Avoid triggering GLib criticals in a few places.
|
||||
|
||||
What's new in at-spi2-atk 2.3.4:
|
||||
|
||||
* Fix for BGO#666870: Keystroke listeners do not work unless an event listener
|
||||
is also registered [also needs updated at-spi2-core]
|
||||
|
||||
What's new in at-spi2-atk 2.3.3:
|
||||
|
||||
* Fix for BGO#664822 - gnome-shell crash when an AT is launched
|
||||
|
||||
* Fix a reference leak if a child-added signal has no object value.
|
||||
|
||||
* Change a : to a / in the suffix to an event, to allow DBus match rules
|
||||
using arg0path.
|
||||
|
||||
* Only deregister objects when they are marked defunct, not when a previously
|
||||
defunct object is marked as no longer defunct.
|
||||
|
||||
What's new in at-spi2-atk 2.3.2:
|
||||
|
||||
* Have AtkSocket's implementation of ref_state_set to return empty sets
|
||||
instead of NULL
|
||||
|
||||
* Fix for BGO#663876: Make sure the a11y hierarchy under an AtkPlug is
|
||||
generated when embedding.
|
||||
|
||||
What's new in at-spi2-atk 2.3.1:
|
||||
|
||||
* Fix a small coding error that could generate compiler warnings.
|
||||
|
||||
What's new in at-spi2-atk 2.2.1:
|
||||
|
||||
* Updated Finnish translation.
|
||||
|
||||
What's new in at-spi2-atk 2.2.0:
|
||||
|
||||
* Really fix BGO#658013: Attach the timeout for a key listener to the
|
||||
appropriate main loop context.
|
||||
|
||||
What's new in at-spi2-atk 2.1.92:
|
||||
|
||||
* Fix for BGO#658013: Add timeout to check for disconnect on a key listener.
|
||||
|
||||
What's new in at-spi2-atk 2.1.91:
|
||||
|
||||
* Fix for BGO#645321: Use an array of bytes rather than a string for the
|
||||
atk-bridge location in the schema.
|
||||
|
||||
What's new in at-spi2-atk 2.1.90:
|
||||
|
||||
* Try to use the new AtkWindow interface to register for window events.
|
||||
|
||||
What's new in at-spi2-atk 2.1.5:
|
||||
|
||||
* Use libatspi constants rather than keeping duplicate copies of the
|
||||
constants in at-spi2-atk.
|
||||
|
||||
* Fixed some problems when shutting down and restarting the module.
|
||||
|
||||
What's new in at-spi2-atk 2.1.4:
|
||||
|
||||
* Ensure the detail integers are initialized before sending events.
|
||||
|
||||
* Map some new atk roles.
|
||||
|
||||
What's new in at-spi2-atk 2.1.3:
|
||||
|
||||
* Fix for BGO#652797: Remove unused AtkMisc instance.
|
||||
|
||||
* Only register events when something is listening. In theory, this should
|
||||
mitigate performance loss that might show up when no ATs are running.
|
||||
|
||||
* BGO#652596: Allow setting value via the DBus property again.
|
||||
|
||||
* BGO#652858: Deregister objects on state-changed:defunct.
|
||||
|
||||
* Add AT-SPI mapping for ATK_RELATION_NODE_PARENT_OF.
|
||||
|
||||
What's new in at-spi2-atk 2.0.2:
|
||||
|
||||
* Fix matching on attributes for collection methods
|
||||
|
||||
* Fix for BGO#650286: Ensure valid UTF-8 from ATK
|
||||
|
||||
* Always emit children-changed, property-change, and state-changed events, in
|
||||
order to keep caches synchronized.
|
||||
|
||||
* Add GetAtspiVersion to fetch the version of the AT-SPI specification provided
|
||||
by an application.
|
||||
|
||||
What's new in at-spi2-atk 2.0.1:
|
||||
|
||||
* Fix a memory leak in impl_GetText
|
||||
|
||||
What's new in at-spi2-atk 1.91.93:
|
||||
|
||||
* Removed dbus-glib-related includes, as they are no longer required.
|
||||
|
||||
What's new in at-spi2-atk 1.91.92:
|
||||
|
||||
* Handle text-insert and text-removed signals from ATK (BGO#638377).
|
||||
|
||||
* Use the new dbus errors when compiled against a version of libdbus that
|
||||
defines them.
|
||||
|
||||
* Use libatspi to get the accessibility bus and handle main loop integration.
|
||||
This fixes a crash with some builds of Firefox (FDO#35115).
|
||||
Note that this adds a dependency on libatspi.
|
||||
|
||||
* Fix accessibility of applications running as root on Linux.
|
||||
|
||||
What's new in at-spi2-atk 1.91.91:
|
||||
|
||||
* Fix some missing prototypes.
|
||||
|
||||
* Do not exit if the accessibility bus disconnects.
|
||||
|
||||
What's new in at-spi2-atk 1.91.90:
|
||||
|
||||
* Fix for BGO#641338: Avoid crashing when unable to listen for p2p connections.
|
||||
|
||||
* Set /tmp/at-spi2 to be world-writable.
|
||||
|
||||
* Fix for BGO#641869: Remove --enable-relocate option.
|
||||
|
||||
* Changed accessibility key name as was done in gsettings-desktop-schemas.
|
||||
|
||||
* Fixed several memory leaks.
|
||||
|
||||
* Fixed some build errors.
|
||||
|
||||
What's new in at-spi2-atk 1.91.6:
|
||||
|
||||
* Fixed the path in org.a11y.atspi.gschema.xml for lib64.
|
||||
|
||||
* Implemented SetPosition, SetExtents, and SetSize for components.
|
||||
|
||||
What's new in at-spi2-atk 1.91.5:
|
||||
|
||||
* Fixed some memory leaks.
|
||||
|
||||
* Fixed a crash if peer-to-peer connections are disabled.
|
||||
|
||||
* Fixed setting of GTK_PATH with --enable-relocate (was broken in 1.91.4).
|
||||
|
||||
What's new in at-spi2-atk 1.91.4:
|
||||
|
||||
* Support direct dbus connections to improve performance if dbus-glib
|
||||
0.90 or greater is available.
|
||||
|
||||
* Added a GSettings key to specify the location of libatk-bridge.so.
|
||||
|
||||
* Added a desktop file to load gail and atk-bridge with the new
|
||||
gnome-settings-daemon.
|
||||
|
||||
What's new in at-spi2-atk 1.91.3:
|
||||
|
||||
* Attributes in a collection match rule are now expected to be sent as a
|
||||
dictionary.
|
||||
|
||||
What's new in at-spi2-atk 1.91.2:
|
||||
|
||||
* FIxed BGO#563546: Removed the g_atexit hook.
|
||||
|
||||
What's new in at-spi2-atk 1.91.1:
|
||||
|
||||
* Fire all events until we receive a reply from GetRegisteredEvents
|
||||
|
||||
What's new in at-spi2-atk 1.91.0:
|
||||
|
||||
* --disable-relocate is the default again.
|
||||
|
||||
What's new in at-spi2-atk 0.3.92:
|
||||
|
||||
* Have value methods return 0 on failure rather than fail, as in original pyatspi
|
||||
|
||||
What's new in at-spi2-atk 0.3.91.1:
|
||||
|
||||
* Fi a build error introduced in 0.3.91.
|
||||
|
||||
What's new in at-spi2-atk 0.3.91:
|
||||
|
||||
* Default to --enable-relocate for now.
|
||||
|
||||
* Fix for FDO#29880: gtk module can't handle reloading.
|
||||
|
||||
What's new in at-spi2-atk 0.3.90:
|
||||
|
||||
* FDO#29365: Stop using a deprecated glib function.
|
||||
|
||||
* Caching fixes--GetItems was completely broken in v0.3.6, and fixed a
|
||||
possible crash when it is called.
|
||||
|
||||
* Only emit signals when AT-SPI clients are listening for them.
|
||||
|
||||
What's new in at-spi2-atk 0.3.6:
|
||||
|
||||
* Fixed a problem with dbus introspection.
|
||||
|
||||
* Do not block waiting for a response when registering.
|
||||
|
||||
What's new in at-spi2-atk 0.3.5:
|
||||
|
||||
* Have a socket retrieve its state set from its embedded plug
|
||||
|
||||
* Rename AT_SPI_CLIENT to AT_SPI_REENTER_G_MAIN_LOOP, but still check the
|
||||
former variable as well for now.
|
||||
|
||||
What's new in at-spi2-atk 0.3.4:
|
||||
|
||||
* Ref an object while adding it to the message generated by GetItems.
|
||||
This prevents a crash if all other references to the objects go away while
|
||||
it is being analyzed.
|
||||
|
||||
* Add GetChildren to the introspection.
|
||||
|
||||
* Fix NSelectedRows and NSelectedColumns.
|
||||
|
||||
* Fix the behavior of ChildCount and GetChildAtIndex for sockets with
|
||||
embedded plugs.
|
||||
|
||||
* Fix extra unref when calling get_row_header or get_column_header on a
|
||||
table, or calling atk_hyperlink_get_object.
|
||||
|
||||
* Set the /desktop/gnome/interface/at-spi-dbus gconf key to false by default
|
||||
(this key is only used when at-spi2 is relocated, which it is not by default).
|
||||
|
||||
* Fix a few compiler warnings.
|
||||
|
||||
What's new in at-spi2-atk 0.3.3:
|
||||
|
||||
* Remove unused gtk build dependency.
|
||||
|
||||
* Install a copy of the module into the gtk-3.0 modules directory.
|
||||
|
||||
* Correct handling of some children-changed events sent by Firefox.
|
||||
|
||||
* Lease objects that send events if they are not cached; fixes some
|
||||
tracebacks when handling Firefox events.
|
||||
|
||||
What's new in at-spi2-atk 0.3.2:
|
||||
|
||||
* Some hyperlink fixes.
|
||||
|
||||
* Cache additions are now done in an idle call. This prevents additions
|
||||
from being made when an object may not be fully initialized and prevents
|
||||
Firefox 3.6 from crashing.
|
||||
|
||||
* The cache object has been placed into the org.a11y.atspi namespace.
|
||||
|
||||
What's new in at-spi2-atk 0.3.1:
|
||||
|
||||
* Added a gconf schema.
|
||||
|
||||
* org.freedesktop.DBus.Properties.GetAll now works rather then crashing.
|
||||
|
||||
* The position, size, and extents of an AtkSocket are now fetched from the
|
||||
corresponding AtkPlug.
|
||||
|
||||
* An application is no longer registered if its root is an AtkPlug.
|
||||
|
||||
* Fix BGO#538680 - Count ignored in GetMatchesTo
|
||||
|
||||
* Fix FDO#27626 - deadlock when registering an application.
|
||||
|
||||
* Fix a problem with various hyperlink methods.
|
||||
|
||||
* Fix for an AtkPlug sometimes not appearing in the hierarchy.
|
||||
|
||||
* Fix a crash if the registry returns an unexpected message while embedding.
|
||||
|
||||
* Remove libxml2 dependency since libxml2 is no longer used.
|
||||
|
||||
* Fix handling of MATCH_ANY for a stateset in a collection match rule.
|
||||
|
||||
* Disabled relocation by default.
|
|
@ -0,0 +1,128 @@
|
|||
D-Bus AT-SPI
|
||||
------------
|
||||
|
||||
This version of at-spi is a major break from version 1.x.
|
||||
It has been completely rewritten to use D-Bus rather than
|
||||
ORBIT / CORBA for its transport protocol.
|
||||
|
||||
A page including instructions for testing, project status and
|
||||
TODO items is kept up to date at:
|
||||
|
||||
http://www.linuxfoundation.org/en/AT-SPI_on_D-Bus
|
||||
|
||||
The mailing list used for general questions is:
|
||||
|
||||
accessibility-atspi@lists.linux-foundation.org
|
||||
|
||||
For bug reports, feature requests, patches or enhancements please use
|
||||
the AT-SPI project on bugzilla.gnome.org. Use the at-spi2-atk component for
|
||||
bugs specific to this module.
|
||||
|
||||
http://bugzilla.gnome.org
|
||||
|
||||
A git repository with the latest development code is available at:
|
||||
|
||||
https://git.gnome.org/browse/at-spi2-atk
|
||||
|
||||
Code in this repository depends on at-spi2-core resources. The
|
||||
at-spi2-core repository can be found at:
|
||||
|
||||
https://git.gnome.org/browse/at-spi2-core
|
||||
|
||||
More information
|
||||
----------------
|
||||
|
||||
The project was started with a D-Bus performance review
|
||||
the results of which are available on the GNOME wiki. Keep in
|
||||
mind that the D-Bus AT-SPI design documents on this page
|
||||
have not been kept up to date.
|
||||
|
||||
https://wiki.gnome.org/Accessibility/Documentation/GNOME2/ATSPI2-Investigation
|
||||
|
||||
Other sources of relevant information about AT-SPI and Accessibility
|
||||
include:
|
||||
|
||||
https://wiki.gnome.org/Accessibility
|
||||
https://accessibility.kde.org/developer/atk.php
|
||||
https://people.gnome.org/~billh/at-spi-idl/html/
|
||||
|
||||
|
||||
|
||||
Contents of this package
|
||||
------------------------
|
||||
|
||||
This package includes libatk-bridge, a library that bridges ATK to the new
|
||||
D-Bus based AT-SPI, as well as a corresponding module for gtk+ 2.x. Gtk+ 3.x
|
||||
now links against libatk-bridge directly rather than requiring it to be loaded
|
||||
as a module.
|
||||
|
||||
These libraries depend on the at-spi2-core code that contains the daemon for
|
||||
registering applications, D-Bus helper libraries and the AT-SPI D-Bus specifications.
|
||||
|
||||
Building this package
|
||||
---------------------
|
||||
|
||||
In order to build at-spi2-atk you will need:
|
||||
|
||||
- Python 3.5
|
||||
- Meson
|
||||
- Ninja
|
||||
|
||||
Additionally, you will need the development files for:
|
||||
|
||||
- libdbus
|
||||
- GLib
|
||||
- GTK+ 3.x
|
||||
- ATK
|
||||
- AT-SPI
|
||||
|
||||
To build and install this package, you will typically need to run `meson` to
|
||||
configure the build process, and Ninja to run the compilation and installation
|
||||
instructions:
|
||||
|
||||
# Configure the build and initialize the build directory
|
||||
meson _build .
|
||||
|
||||
# Enter the build directory
|
||||
cd _build
|
||||
|
||||
# Build the project
|
||||
ninja
|
||||
|
||||
# Install the project
|
||||
sudo ninja install
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
To run the test suite, use `meson test` from the build directory.
|
||||
|
||||
Directory structure
|
||||
-------------------
|
||||
|
||||
The directories within this package are arranged as follows:
|
||||
|
||||
droute
|
||||
|
||||
Contains a framework for registering objects
|
||||
with a D-Bus connection and for routing messages to
|
||||
the implementing object.
|
||||
|
||||
Used by the ATK adaptor.
|
||||
|
||||
atk-adaptor
|
||||
|
||||
This directory contains code that bridges
|
||||
the at-spi to the GTK+ toolkit, and which is
|
||||
loaded at runtime by GTK+-based Gnome applications.
|
||||
The 'bridge' automatically registers GTK+-2.0
|
||||
applications with the accessibility registry,
|
||||
and relays UI events from application to registry.
|
||||
It is also responsible for servicing requests from
|
||||
the registry to register handlers for specific event
|
||||
types.
|
||||
|
||||
tests
|
||||
|
||||
Contains tests for atspi.
|
||||
More details in tests/README
|
|
@ -0,0 +1,6 @@
|
|||
[GTK Module]
|
||||
Name=AT-SPI2 ATK
|
||||
Description=Accessibility ToolKit GTK+ Module
|
||||
X-GTK-Module-Name=gail:atk-bridge
|
||||
X-GTK-Module-Enabled-Schema=org.gnome.desktop.interface
|
||||
X-GTK-Module-Enabled-Key=toolkit-accessibility
|
|
@ -0,0 +1,25 @@
|
|||
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
||||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:gnome="http://api.gnome.org/doap-extensions#"
|
||||
xmlns="http://usefulinc.com/ns/doap#">
|
||||
|
||||
<name xml:lang="en">at-spi2-atk</name>
|
||||
<shortdesc xml:lang="en">GTK+ module for bridging AT-SPI to ATK</shortdesc>
|
||||
<description xml:lang="en">at-spi2-atk is the library used to bridge ATK to AT-SPI, allowing applications exposing information via ATK to interface with clients that use AT-SPI. This module provides the necessary inter-process communication to allow accessibility-oriented software to operate.</description>
|
||||
<homepage rdf:resource="http://www.linuxfoundation.org/en/Accessibility/ATK/AT-SPI/AT-SPI_on_D-Bus"/>
|
||||
<license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" />
|
||||
<bug-database rdf:resource="https://gitlab.gnome.org/GNOME/at-spi2-atk/issues/" />
|
||||
<download-page rdf:resource="http://download.gnome.org/sources/at-spi2-atk/" />
|
||||
<mailing-list rdf:resource="https://lists.linux-foundation.org/mailman/listinfo/accessibility-atspi"/>
|
||||
<category rdf:resource="http://api.gnome.org/doap-extensions#core" />
|
||||
<programming-language>C</programming-language>
|
||||
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Mike Gorse</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:mgorse@suse.com" />
|
||||
<gnome:userid>mgorse</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
</Project>
|
|
@ -0,0 +1,21 @@
|
|||
gtkmodule_LTLIBRARIES = libatk-bridge.la
|
||||
|
||||
libatk_bridge_la_CFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(ATK_CFLAGS) \
|
||||
$(ATSPI_CFLAGS) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/atk-adaptor/adaptors \
|
||||
-I$(top_srcdir)/atk-adaptor/
|
||||
$(P2P_CFLAGS)
|
||||
|
||||
libatk_bridge_la_LDFLAGS = -no-undefined \
|
||||
-module \
|
||||
-avoid-version \
|
||||
-rpath $(gtkmoduledir)
|
||||
|
||||
libatk_bridge_la_LIBADD = $(DBUS_LIBS) \
|
||||
$(GMODULE_LIBS) \
|
||||
$(ATK_LIBS) \
|
||||
$(ATSPI_LIBS) \
|
||||
$(top_builddir)/atk-adaptor/libatk-bridge-2.0.la
|
|
@ -0,0 +1,452 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "accessible-cache.h"
|
||||
#include "accessible-register.h"
|
||||
#include "bridge.h"
|
||||
#include "event.h"
|
||||
|
||||
SpiCache *spi_global_cache = NULL;
|
||||
|
||||
static gboolean
|
||||
child_added_listener (GSignalInvocationHint * signal_hint,
|
||||
guint n_param_values,
|
||||
const GValue * param_values, gpointer data);
|
||||
|
||||
static void
|
||||
toplevel_added_listener (AtkObject * accessible,
|
||||
guint index, AtkObject * child);
|
||||
|
||||
static void
|
||||
remove_object (GObject * source, GObject * gobj, gpointer data);
|
||||
|
||||
static void
|
||||
add_object (SpiCache * cache, GObject * gobj);
|
||||
|
||||
static void
|
||||
add_subtree (SpiCache *cache, AtkObject * accessible);
|
||||
|
||||
static gboolean
|
||||
add_pending_items (gpointer data);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
spi_cache_finalize (GObject * object);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
enum
|
||||
{
|
||||
OBJECT_ADDED,
|
||||
OBJECT_REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint cache_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
G_DEFINE_TYPE (SpiCache, spi_cache, G_TYPE_OBJECT)
|
||||
|
||||
static void spi_cache_class_init (SpiCacheClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
spi_cache_parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
object_class->finalize = spi_cache_finalize;
|
||||
|
||||
cache_signals [OBJECT_ADDED] = \
|
||||
g_signal_new ("object-added",
|
||||
SPI_CACHE_TYPE,
|
||||
G_SIGNAL_ACTION,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
cache_signals [OBJECT_REMOVED] = \
|
||||
g_signal_new ("object-removed",
|
||||
SPI_CACHE_TYPE,
|
||||
G_SIGNAL_ACTION,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_OBJECT);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_cache_init (SpiCache * cache)
|
||||
{
|
||||
cache->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
cache->add_traversal = g_queue_new ();
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
if (g_thread_supported ())
|
||||
g_message ("AT-SPI: Threads enabled");
|
||||
|
||||
g_debug ("AT-SPI: Initial Atk tree regisration");
|
||||
#endif
|
||||
|
||||
g_signal_connect (spi_global_register,
|
||||
"object-deregistered",
|
||||
(GCallback) remove_object, cache);
|
||||
|
||||
add_subtree (cache, spi_global_app_data->root);
|
||||
|
||||
cache->child_added_listener = atk_add_global_event_listener (child_added_listener,
|
||||
"Gtk:AtkObject:children-changed");
|
||||
|
||||
g_signal_connect (G_OBJECT (spi_global_app_data->root),
|
||||
"children-changed::add",
|
||||
(GCallback) toplevel_added_listener, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_cache_finalize (GObject * object)
|
||||
{
|
||||
SpiCache *cache = SPI_CACHE (object);
|
||||
|
||||
while (!g_queue_is_empty (cache->add_traversal))
|
||||
g_object_unref (G_OBJECT (g_queue_pop_head (cache->add_traversal)));
|
||||
g_queue_free (cache->add_traversal);
|
||||
g_hash_table_unref (cache->objects);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (spi_global_register,
|
||||
(GCallback) remove_object, cache);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (spi_global_app_data->root),
|
||||
(GCallback) toplevel_added_listener, NULL);
|
||||
|
||||
atk_remove_global_event_listener (cache->child_added_listener);
|
||||
|
||||
G_OBJECT_CLASS (spi_cache_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
remove_object (GObject * source, GObject * gobj, gpointer data)
|
||||
{
|
||||
SpiCache *cache = SPI_CACHE (data);
|
||||
|
||||
if (spi_cache_in (cache, gobj))
|
||||
{
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("CACHE REM - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
|
||||
atk_object_get_role (ATK_OBJECT (gobj)),
|
||||
spi_register_object_to_path (spi_global_register, gobj));
|
||||
#endif
|
||||
g_signal_emit (cache, cache_signals [OBJECT_REMOVED], 0, gobj);
|
||||
g_hash_table_remove (cache->objects, gobj);
|
||||
}
|
||||
else if (g_queue_remove (cache->add_traversal, gobj))
|
||||
{
|
||||
g_object_unref (gobj);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_object (SpiCache * cache, GObject * gobj)
|
||||
{
|
||||
g_return_if_fail (G_IS_OBJECT (gobj));
|
||||
|
||||
g_hash_table_insert (cache->objects, gobj, NULL);
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("CACHE ADD - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
|
||||
atk_object_get_role (ATK_OBJECT (gobj)),
|
||||
spi_register_object_to_path (spi_global_register, gobj));
|
||||
#endif
|
||||
|
||||
g_signal_emit (cache, cache_signals [OBJECT_ADDED], 0, gobj);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static GRecMutex cache_mutex;
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
static GStaticMutex recursion_check_guard = G_STATIC_MUTEX_INIT;
|
||||
static gboolean recursion_check = FALSE;
|
||||
|
||||
static gboolean
|
||||
recursion_check_and_set ()
|
||||
{
|
||||
gboolean ret;
|
||||
g_static_mutex_lock (&recursion_check_guard);
|
||||
ret = recursion_check;
|
||||
recursion_check = TRUE;
|
||||
g_static_mutex_unlock (&recursion_check_guard);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
recursion_check_unset ()
|
||||
{
|
||||
g_static_mutex_lock (&recursion_check_guard);
|
||||
recursion_check = FALSE;
|
||||
g_static_mutex_unlock (&recursion_check_guard);
|
||||
}
|
||||
#endif /* SPI_ATK_DEBUG */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
append_children (AtkObject * accessible, GQueue * traversal)
|
||||
{
|
||||
AtkObject *current;
|
||||
guint i;
|
||||
gint count = atk_object_get_n_accessible_children (accessible);
|
||||
|
||||
if (count < 0)
|
||||
count = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
current = atk_object_ref_accessible_child (accessible, i);
|
||||
if (current)
|
||||
{
|
||||
g_queue_push_tail (traversal, current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a subtree of accessible objects
|
||||
* to the cache at the accessible object provided.
|
||||
*
|
||||
* The leaf nodes do not have their children
|
||||
* registered. A node is considered a leaf
|
||||
* if it has the state "manages-descendants"
|
||||
* or if it has already been registered.
|
||||
*/
|
||||
static void
|
||||
add_subtree (SpiCache *cache, AtkObject * accessible)
|
||||
{
|
||||
g_return_if_fail (ATK_IS_OBJECT (accessible));
|
||||
|
||||
g_object_ref (accessible);
|
||||
g_queue_push_tail (cache->add_traversal, accessible);
|
||||
add_pending_items (cache);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_pending_items (gpointer data)
|
||||
{
|
||||
SpiCache *cache = SPI_CACHE (data);
|
||||
AtkObject *current;
|
||||
GQueue *to_add;
|
||||
|
||||
to_add = g_queue_new ();
|
||||
|
||||
while (!g_queue_is_empty (cache->add_traversal))
|
||||
{
|
||||
AtkStateSet *set;
|
||||
|
||||
/* cache->add_traversal holds a ref to current */
|
||||
current = g_queue_pop_head (cache->add_traversal);
|
||||
set = atk_object_ref_state_set (current);
|
||||
|
||||
if (set && !atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
|
||||
{
|
||||
/* transfer the ref into to_add */
|
||||
g_queue_push_tail (to_add, current);
|
||||
if (!spi_cache_in (cache, G_OBJECT (current)) &&
|
||||
!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS) &&
|
||||
!atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
|
||||
{
|
||||
append_children (current, cache->add_traversal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* drop the ref for the removed object */
|
||||
g_object_unref (current);
|
||||
}
|
||||
|
||||
if (set)
|
||||
g_object_unref (set);
|
||||
}
|
||||
|
||||
while (!g_queue_is_empty (to_add))
|
||||
{
|
||||
current = g_queue_pop_head (to_add);
|
||||
|
||||
/* Make sure object is registerd so we are notified if it goes away */
|
||||
g_free (spi_register_object_to_path (spi_global_register,
|
||||
G_OBJECT (current)));
|
||||
|
||||
add_object (cache, G_OBJECT(current));
|
||||
g_object_unref (G_OBJECT (current));
|
||||
}
|
||||
|
||||
g_queue_free (to_add);
|
||||
cache->add_pending_idle = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static gboolean
|
||||
child_added_listener (GSignalInvocationHint * signal_hint,
|
||||
guint n_param_values,
|
||||
const GValue * param_values, gpointer data)
|
||||
{
|
||||
SpiCache *cache = spi_global_cache;
|
||||
AtkObject *accessible;
|
||||
|
||||
const gchar *detail = NULL;
|
||||
|
||||
/*
|
||||
* Ensure that only accessibles already in the cache
|
||||
* have their signals processed.
|
||||
*/
|
||||
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (accessible), TRUE);
|
||||
|
||||
g_rec_mutex_lock (&cache_mutex);
|
||||
|
||||
if (spi_cache_in (cache, G_OBJECT(accessible)))
|
||||
{
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
if (recursion_check_and_set ())
|
||||
g_warning ("AT-SPI: Recursive use of cache module");
|
||||
|
||||
g_debug ("AT-SPI: Tree update listener");
|
||||
#endif
|
||||
if (signal_hint->detail)
|
||||
detail = g_quark_to_string (signal_hint->detail);
|
||||
|
||||
if (detail && !strncmp (detail, "add", 3))
|
||||
{
|
||||
gpointer child;
|
||||
child = g_value_get_pointer (param_values + 2);
|
||||
if (!child)
|
||||
{
|
||||
g_rec_mutex_unlock (&cache_mutex);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_object_ref (child);
|
||||
g_queue_push_tail (cache->add_traversal, child);
|
||||
|
||||
if (cache->add_pending_idle == 0)
|
||||
cache->add_pending_idle = spi_idle_add (add_pending_items, cache);
|
||||
}
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
recursion_check_unset ();
|
||||
#endif
|
||||
}
|
||||
|
||||
g_rec_mutex_unlock (&cache_mutex);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
toplevel_added_listener (AtkObject * accessible,
|
||||
guint index, AtkObject * child)
|
||||
{
|
||||
SpiCache *cache = spi_global_cache;
|
||||
|
||||
g_return_if_fail (ATK_IS_OBJECT (accessible));
|
||||
|
||||
g_rec_mutex_lock (&cache_mutex);
|
||||
|
||||
if (spi_cache_in (cache, G_OBJECT(accessible)))
|
||||
{
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
if (recursion_check_and_set ())
|
||||
g_warning ("AT-SPI: Recursive use of registration module");
|
||||
|
||||
g_debug ("AT-SPI: Toplevel added listener");
|
||||
#endif
|
||||
if (!ATK_IS_OBJECT (child))
|
||||
{
|
||||
child = atk_object_ref_accessible_child (accessible, index);
|
||||
}
|
||||
else
|
||||
g_object_ref (child);
|
||||
|
||||
g_queue_push_tail (cache->add_traversal, child);
|
||||
|
||||
if (cache->add_pending_idle == 0)
|
||||
cache->add_pending_idle = spi_idle_add (add_pending_items, cache);
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
recursion_check_unset ();
|
||||
#endif
|
||||
}
|
||||
|
||||
g_rec_mutex_unlock (&cache_mutex);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
spi_cache_foreach (SpiCache * cache, GHFunc func, gpointer data)
|
||||
{
|
||||
g_hash_table_foreach (cache->objects, func, data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
spi_cache_in (SpiCache * cache, GObject * object)
|
||||
{
|
||||
if (!cache)
|
||||
return FALSE;
|
||||
|
||||
if (g_hash_table_lookup_extended (cache->objects,
|
||||
object,
|
||||
NULL,
|
||||
NULL))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
void
|
||||
spi_cache_print_info (GObject * obj)
|
||||
{
|
||||
char * path = spi_register_object_to_path (spi_global_register, obj);
|
||||
|
||||
if (spi_cache_in (spi_global_cache, obj))
|
||||
g_printf ("%s IC\n", path);
|
||||
else
|
||||
g_printf ("%s NC\n", path);
|
||||
|
||||
if (path)
|
||||
g_free (path);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBLE_CACHE_H
|
||||
#define ACCESSIBLE_CACHE_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
typedef struct _SpiCache SpiCache;
|
||||
typedef struct _SpiCacheClass SpiCacheClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SPI_CACHE_TYPE (spi_cache_get_type ())
|
||||
#define SPI_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_CACHE_TYPE, SpiCache))
|
||||
#define SPI_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_CACHE_TYPE, SpiCacheClass))
|
||||
#define SPI_IS_CACHE(o) (G_TYPE_CHECK__INSTANCE_TYPE ((o), SPI_CACHE_TYPE))
|
||||
#define SPI_IS_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SPI_CACHE_TYPE))
|
||||
|
||||
struct _SpiCache
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GHashTable * objects;
|
||||
GQueue *add_traversal;
|
||||
gint add_pending_idle;
|
||||
|
||||
guint child_added_listener;
|
||||
};
|
||||
|
||||
struct _SpiCacheClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType spi_cache_get_type (void);
|
||||
|
||||
extern SpiCache *spi_global_cache;
|
||||
|
||||
void
|
||||
spi_cache_foreach (SpiCache * cache, GHFunc func, gpointer data);
|
||||
|
||||
gboolean
|
||||
spi_cache_in (SpiCache * cache, GObject * object);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* ACCESSIBLE_CACHE_H */
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "accessible-leasing.h"
|
||||
#include "event.h"
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
#include "accessible-cache.h"
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
SpiLeasing *spi_global_leasing;
|
||||
|
||||
typedef struct _ExpiryElement
|
||||
{
|
||||
guint expiry_s;
|
||||
GObject *object;
|
||||
} ExpiryElement;
|
||||
|
||||
static void spi_leasing_dispose (GObject * object);
|
||||
|
||||
static void spi_leasing_finalize (GObject * object);
|
||||
|
||||
static void add_expiry_timeout (SpiLeasing * leasing);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
G_DEFINE_TYPE (SpiLeasing, spi_leasing, G_TYPE_OBJECT)
|
||||
|
||||
static void spi_leasing_class_init (SpiLeasingClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
spi_leasing_parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
object_class->finalize = spi_leasing_finalize;
|
||||
object_class->dispose = spi_leasing_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
spi_leasing_init (SpiLeasing * leasing)
|
||||
{
|
||||
leasing->expiry_queue = g_queue_new ();
|
||||
leasing->expiry_func_id = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
spi_leasing_finalize (GObject * object)
|
||||
{
|
||||
SpiLeasing *leasing = SPI_LEASING (object);
|
||||
|
||||
if (leasing->expiry_func_id)
|
||||
g_source_remove (leasing->expiry_func_id);
|
||||
g_queue_free (leasing->expiry_queue);
|
||||
G_OBJECT_CLASS (spi_leasing_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_leasing_dispose (GObject * object)
|
||||
{
|
||||
SpiLeasing *leasing = SPI_LEASING (object);
|
||||
|
||||
ExpiryElement *head;
|
||||
while ((head = g_queue_pop_head (leasing->expiry_queue)))
|
||||
{
|
||||
g_object_unref (head->object);
|
||||
g_slice_free (ExpiryElement, head);
|
||||
}
|
||||
G_OBJECT_CLASS (spi_leasing_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
End the lease on all objects whose expiry time has passed.
|
||||
|
||||
Check when the next event is and set the next expiry func.
|
||||
*/
|
||||
static gboolean
|
||||
expiry_func (gpointer data)
|
||||
{
|
||||
SpiLeasing *leasing = SPI_LEASING (data);
|
||||
|
||||
ExpiryElement *head, *current;
|
||||
GTimeVal t;
|
||||
|
||||
g_get_current_time (&t);
|
||||
|
||||
head = g_queue_peek_head (leasing->expiry_queue);
|
||||
while (head != NULL && head->expiry_s <= t.tv_sec)
|
||||
{
|
||||
current = g_queue_pop_head (leasing->expiry_queue);
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("REVOKE - ");
|
||||
spi_cache_print_info (current->object);
|
||||
#endif
|
||||
|
||||
g_object_unref (current->object);
|
||||
g_slice_free (ExpiryElement, current);
|
||||
|
||||
head = g_queue_peek_head (leasing->expiry_queue);
|
||||
}
|
||||
|
||||
leasing->expiry_func_id = 0;
|
||||
add_expiry_timeout (leasing);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
Checks if an expiry timeout is already scheduled, if so returns.
|
||||
This is becasue events will always be added to the end of the queue.
|
||||
Events are always later in time to previoulsy added events.
|
||||
|
||||
Otherwise calculate the next wake time using the top of the queue
|
||||
and add the next expiry function.
|
||||
|
||||
This function is called when a lease is added or at the end of the
|
||||
expiry function to add the next expiry timeout.
|
||||
*/
|
||||
static void
|
||||
add_expiry_timeout (SpiLeasing * leasing)
|
||||
{
|
||||
ExpiryElement *elem;
|
||||
GTimeVal t;
|
||||
guint next_expiry;
|
||||
|
||||
if (leasing->expiry_func_id != 0)
|
||||
return;
|
||||
|
||||
elem = (ExpiryElement *) g_queue_peek_head (leasing->expiry_queue);
|
||||
if (elem == NULL)
|
||||
return;
|
||||
|
||||
/* The current time is implicitly rounded down here by ignoring the us */
|
||||
g_get_current_time (&t);
|
||||
next_expiry = elem->expiry_s - t.tv_sec;
|
||||
leasing->expiry_func_id = spi_timeout_add_seconds (next_expiry,
|
||||
expiry_func, leasing);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
The lease time is expected to be in seconds, the rounding is going to be to
|
||||
intervals of 1 second.
|
||||
|
||||
The lease time is going to be rounded up, as the lease time should be
|
||||
considered a MINIMUM that the object will be leased for.
|
||||
*/
|
||||
#define LEASE_TIME_S 15
|
||||
#define EXPIRY_TIME_S (LEASE_TIME_S + 1)
|
||||
|
||||
GObject *
|
||||
spi_leasing_take (SpiLeasing * leasing, GObject * object)
|
||||
{
|
||||
/*
|
||||
Get the current time.
|
||||
Quantize the time.
|
||||
Add the release event to the queue.
|
||||
Check the next expiry.
|
||||
*/
|
||||
|
||||
GTimeVal t;
|
||||
guint expiry_s;
|
||||
|
||||
ExpiryElement *elem;
|
||||
|
||||
g_get_current_time (&t);
|
||||
expiry_s = t.tv_sec + EXPIRY_TIME_S;
|
||||
|
||||
elem = g_slice_new (ExpiryElement);
|
||||
elem->expiry_s = expiry_s;
|
||||
elem->object = g_object_ref (object);
|
||||
|
||||
g_queue_push_tail (leasing->expiry_queue, elem);
|
||||
|
||||
add_expiry_timeout (leasing);
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("LEASE - ");
|
||||
spi_cache_print_info (object);
|
||||
#endif
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008, 2009 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBLE_LEASING_H
|
||||
#define ACCESSIBLE_LEASING_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
typedef struct _SpiLeasing SpiLeasing;
|
||||
typedef struct _SpiLeasingClass SpiLeasingClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SPI_LEASING_TYPE (spi_leasing_get_type ())
|
||||
#define SPI_LEASING(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_LEASING_TYPE, SpiLeasing))
|
||||
#define SPI_LEASING_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_LEASING_TYPE, SpiLeasingClass))
|
||||
#define SPI_IS_LEASING(o) (G_TYPE_CHECK__INSTANCE_TYPE ((o), SPI_LEASING_TYPE))
|
||||
#define SPI_IS_LEASING_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SPI_LEASING_TYPE))
|
||||
|
||||
struct _SpiLeasing
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GQueue *expiry_queue;
|
||||
guint expiry_func_id;
|
||||
};
|
||||
|
||||
struct _SpiLeasingClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType spi_leasing_get_type (void);
|
||||
|
||||
extern SpiLeasing *spi_global_leasing;
|
||||
|
||||
GObject *spi_leasing_take (SpiLeasing * leasing, GObject * object);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* ACCESSIBLE_LEASING_H */
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008, 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bridge.h"
|
||||
#include "accessible-register.h"
|
||||
|
||||
/*
|
||||
* This module is responsible for keeping track of all the AtkObjects in
|
||||
* the application, so that they can be accessed remotely and placed in
|
||||
* a client side cache.
|
||||
*
|
||||
* To access an AtkObject remotely we need to provide a D-Bus object
|
||||
* path for it. The D-Bus object paths used have a standard prefix
|
||||
* (SPI_ATK_OBJECT_PATH_PREFIX). Appended to this prefix is a string
|
||||
* representation of an integer reference. So to access an AtkObject
|
||||
* remotely we keep a Hashtable that maps the given reference to
|
||||
* the AtkObject pointer. An object in this hash table is said to be 'registered'.
|
||||
*
|
||||
* The architecture of AT-SPI dbus is such that AtkObjects are not
|
||||
* remotely reference counted. This means that we need to keep track of
|
||||
* object destruction. When an object is destroyed it must be 'deregistered'
|
||||
* To do this lookup we keep a dbus-id attribute on each AtkObject.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SPI_ATK_PATH_PREFIX_LENGTH 27
|
||||
#define SPI_ATK_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
|
||||
#define SPI_ATK_OBJECT_PATH_ROOT "root"
|
||||
|
||||
#define SPI_ATK_OBJECT_REFERENCE_TEMPLATE SPI_ATK_OBJECT_PATH_PREFIX "%d"
|
||||
|
||||
#define SPI_DBUS_ID "spi-dbus-id"
|
||||
|
||||
SpiRegister *spi_global_register = NULL;
|
||||
|
||||
static const gchar * spi_register_root_path = SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_ROOT;
|
||||
|
||||
enum
|
||||
{
|
||||
OBJECT_REGISTERED,
|
||||
OBJECT_DEREGISTERED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint register_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
spi_register_finalize (GObject * object);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
G_DEFINE_TYPE (SpiRegister, spi_register, G_TYPE_OBJECT)
|
||||
|
||||
static void spi_register_class_init (SpiRegisterClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
spi_register_parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
object_class->finalize = spi_register_finalize;
|
||||
|
||||
register_signals [OBJECT_REGISTERED] =
|
||||
g_signal_new ("object-registered",
|
||||
SPI_REGISTER_TYPE,
|
||||
G_SIGNAL_ACTION,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
register_signals [OBJECT_DEREGISTERED] =
|
||||
g_signal_new ("object-deregistered",
|
||||
SPI_REGISTER_TYPE,
|
||||
G_SIGNAL_ACTION,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_OBJECT);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_register_init (SpiRegister * reg)
|
||||
{
|
||||
reg->ref2ptr = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
reg->reference_counter = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
deregister_object (gpointer data, GObject * gobj)
|
||||
{
|
||||
SpiRegister *reg = SPI_REGISTER (data);
|
||||
|
||||
spi_register_deregister_object (reg, gobj, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_register_remove_weak_ref (gpointer key, gpointer val, gpointer reg)
|
||||
{
|
||||
g_object_weak_unref (val, deregister_object, reg);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_register_finalize (GObject * object)
|
||||
{
|
||||
SpiRegister *reg = SPI_REGISTER (object);
|
||||
|
||||
g_hash_table_foreach (reg->ref2ptr, spi_register_remove_weak_ref, reg);
|
||||
g_hash_table_unref (reg->ref2ptr);
|
||||
|
||||
G_OBJECT_CLASS (spi_register_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Each AtkObject must be asssigned a D-Bus path (Reference)
|
||||
*
|
||||
* This function provides an integer reference for a new
|
||||
* AtkObject.
|
||||
*
|
||||
* TODO: Make this reference a little more unique, this is shoddy.
|
||||
*/
|
||||
static guint
|
||||
assign_reference (SpiRegister * reg)
|
||||
{
|
||||
reg->reference_counter++;
|
||||
/* Reference of 0 not allowed as used as direct key in hash table */
|
||||
if (reg->reference_counter == 0)
|
||||
reg->reference_counter++;
|
||||
return reg->reference_counter;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Returns the reference of the object, or 0 if it is not registered.
|
||||
*/
|
||||
static guint
|
||||
object_to_ref (GObject * gobj)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_data (gobj, SPI_DBUS_ID));
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts the Accessible object reference to its D-Bus object path
|
||||
*/
|
||||
static gchar *
|
||||
ref_to_path (guint ref)
|
||||
{
|
||||
return g_strdup_printf (SPI_ATK_OBJECT_REFERENCE_TEMPLATE, ref);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback for when a registered AtkObject is destroyed.
|
||||
*
|
||||
* Removes the AtkObject from the reference lookup tables, meaning
|
||||
* it is no longer exposed over D-Bus.
|
||||
*/
|
||||
void
|
||||
spi_register_deregister_object (SpiRegister *reg, GObject *gobj, gboolean unref)
|
||||
{
|
||||
guint ref;
|
||||
|
||||
ref = object_to_ref (gobj);
|
||||
if (ref != 0)
|
||||
{
|
||||
g_signal_emit (reg,
|
||||
register_signals [OBJECT_DEREGISTERED],
|
||||
0,
|
||||
gobj);
|
||||
if (unref)
|
||||
g_object_weak_unref (gobj, deregister_object, reg);
|
||||
g_hash_table_remove (reg->ref2ptr, GINT_TO_POINTER (ref));
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("DEREG - %d", ref);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
register_object (SpiRegister * reg, GObject * gobj)
|
||||
{
|
||||
guint ref;
|
||||
g_return_if_fail (G_IS_OBJECT (gobj));
|
||||
|
||||
ref = assign_reference (reg);
|
||||
|
||||
g_hash_table_insert (reg->ref2ptr, GINT_TO_POINTER (ref), gobj);
|
||||
g_object_set_data (G_OBJECT (gobj), SPI_DBUS_ID, GINT_TO_POINTER (ref));
|
||||
g_object_weak_ref (G_OBJECT (gobj), deregister_object, reg);
|
||||
|
||||
#ifdef SPI_ATK_DEBUG
|
||||
g_debug ("REG - %d", ref);
|
||||
#endif
|
||||
|
||||
g_signal_emit (reg, register_signals [OBJECT_REGISTERED], 0, gobj);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Used to lookup an GObject from its D-Bus path.
|
||||
*
|
||||
* If the D-Bus path is not found this function returns NULL.
|
||||
*/
|
||||
GObject *
|
||||
spi_register_path_to_object (SpiRegister * reg, const char *path)
|
||||
{
|
||||
guint index;
|
||||
void *data;
|
||||
|
||||
g_return_val_if_fail (path, NULL);
|
||||
|
||||
if (strncmp (path, SPI_ATK_OBJECT_PATH_PREFIX, SPI_ATK_PATH_PREFIX_LENGTH)
|
||||
!= 0)
|
||||
return NULL;
|
||||
|
||||
path += SPI_ATK_PATH_PREFIX_LENGTH; /* Skip over the prefix */
|
||||
|
||||
/* Map the root path to the root object. */
|
||||
if (!g_strcmp0 (SPI_ATK_OBJECT_PATH_ROOT, path))
|
||||
return G_OBJECT (spi_global_app_data->root);
|
||||
|
||||
index = atoi (path);
|
||||
data = g_hash_table_lookup (reg->ref2ptr, GINT_TO_POINTER (index));
|
||||
if (data)
|
||||
return G_OBJECT(data);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GObject *
|
||||
spi_global_register_path_to_object (const char * path)
|
||||
{
|
||||
return spi_register_path_to_object (spi_global_register, path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Used to lookup a D-Bus path from the GObject.
|
||||
*
|
||||
* If the objects is not already registered,
|
||||
* this function will register it.
|
||||
*/
|
||||
gchar *
|
||||
spi_register_object_to_path (SpiRegister * reg, GObject * gobj)
|
||||
{
|
||||
guint ref;
|
||||
|
||||
if (gobj == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Map the root object to the root path. */
|
||||
if ((void *)gobj == (void *)spi_global_app_data->root)
|
||||
return g_strdup (spi_register_root_path);
|
||||
|
||||
ref = object_to_ref (gobj);
|
||||
if (!ref)
|
||||
{
|
||||
register_object (reg, gobj);
|
||||
ref = object_to_ref (gobj);
|
||||
}
|
||||
|
||||
if (!ref)
|
||||
return NULL;
|
||||
else
|
||||
return ref_to_path (ref);
|
||||
}
|
||||
|
||||
guint
|
||||
spi_register_object_to_ref (GObject * gobj)
|
||||
{
|
||||
return object_to_ref (gobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the path that indicates the accessible desktop object.
|
||||
* This object is logically located on the registry daemon and not
|
||||
* within any particular application.
|
||||
*/
|
||||
gchar *
|
||||
spi_register_root_object_path ()
|
||||
{
|
||||
return g_strdup (SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_ROOT);
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008, 2009 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBLE_REGISTER_H
|
||||
#define ACCESSIBLE_REGISTER_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
typedef struct _SpiRegister SpiRegister;
|
||||
typedef struct _SpiRegisterClass SpiRegisterClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SPI_REGISTER_TYPE (spi_register_get_type ())
|
||||
#define SPI_REGISTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_REGISTER_TYPE, SpiRegister))
|
||||
#define SPI_REGISTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SPI_REGISTER_TYPE, SpiRegisterClass))
|
||||
#define SPI_IS_REGISTER(o) (G_TYPE_CHECK__INSTANCE_TYPE ((o), SPI_REGISTER_TYPE))
|
||||
#define SPI_IS_REGISTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SPI_REGISTER_TYPE))
|
||||
|
||||
struct _SpiRegister
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GHashTable * ref2ptr;
|
||||
guint reference_counter;
|
||||
};
|
||||
|
||||
struct _SpiRegisterClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType spi_register_get_type (void);
|
||||
|
||||
extern SpiRegister *spi_global_register;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
GObject *
|
||||
spi_register_path_to_object (SpiRegister * reg, const char *path);
|
||||
|
||||
GObject *
|
||||
spi_global_register_path_to_object (const char * path);
|
||||
|
||||
gchar *
|
||||
spi_register_object_to_path (SpiRegister * reg, GObject * gobj);
|
||||
|
||||
guint
|
||||
spi_register_object_to_ref (GObject * gobj);
|
||||
|
||||
gchar *
|
||||
spi_register_root_object_path ();
|
||||
|
||||
void
|
||||
spi_register_deregister_object (SpiRegister *reg, GObject *gobj, gboolean unref);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* ACCESSIBLE_REGISTER_H */
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* stateset.c : implements the StateSet interface */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "accessible-stateset.h"
|
||||
#include "bitarray.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static AtspiStateType *accessible_state_types = NULL;
|
||||
static AtkStateType *atk_state_types = NULL;
|
||||
|
||||
|
||||
static gboolean
|
||||
spi_init_state_type_tables (void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (accessible_state_types || atk_state_types)
|
||||
return FALSE;
|
||||
if (!accessible_state_types)
|
||||
accessible_state_types = g_new (AtspiStateType, ATK_STATE_LAST_DEFINED);
|
||||
if (!atk_state_types)
|
||||
atk_state_types = g_new (AtkStateType, ATSPI_STATE_LAST_DEFINED);
|
||||
g_return_val_if_fail (accessible_state_types, FALSE);
|
||||
g_return_val_if_fail (atk_state_types, FALSE);
|
||||
|
||||
for (i = 0; i < ATSPI_STATE_LAST_DEFINED; i++)
|
||||
{
|
||||
atk_state_types[i] = ATK_STATE_INVALID;
|
||||
}
|
||||
|
||||
for (i=0; i < ATK_STATE_LAST_DEFINED; i++)
|
||||
{
|
||||
accessible_state_types[i] = ATSPI_STATE_INVALID;
|
||||
}
|
||||
|
||||
accessible_state_types[ATK_STATE_ACTIVE] = ATSPI_STATE_ACTIVE;
|
||||
atk_state_types[ATSPI_STATE_ACTIVE] = ATK_STATE_ACTIVE;
|
||||
accessible_state_types[ATK_STATE_ARMED] = ATSPI_STATE_ARMED;
|
||||
atk_state_types[ATSPI_STATE_ARMED] = ATK_STATE_ARMED;
|
||||
accessible_state_types[ATK_STATE_BUSY] = ATSPI_STATE_BUSY;
|
||||
atk_state_types[ATSPI_STATE_BUSY] = ATK_STATE_BUSY;
|
||||
accessible_state_types[ATK_STATE_CHECKED] = ATSPI_STATE_CHECKED;
|
||||
atk_state_types[ATSPI_STATE_CHECKED] = ATK_STATE_CHECKED;
|
||||
accessible_state_types[ATK_STATE_DEFUNCT] = ATSPI_STATE_DEFUNCT;
|
||||
atk_state_types[ATSPI_STATE_DEFUNCT] = ATK_STATE_DEFUNCT;
|
||||
accessible_state_types[ATK_STATE_EDITABLE] = ATSPI_STATE_EDITABLE;
|
||||
atk_state_types[ATSPI_STATE_EDITABLE] = ATK_STATE_EDITABLE;
|
||||
accessible_state_types[ATK_STATE_ENABLED] = ATSPI_STATE_ENABLED;
|
||||
atk_state_types[ATSPI_STATE_ENABLED] = ATK_STATE_ENABLED;
|
||||
accessible_state_types[ATK_STATE_EXPANDABLE] = ATSPI_STATE_EXPANDABLE;
|
||||
atk_state_types[ATSPI_STATE_EXPANDABLE] = ATK_STATE_EXPANDABLE;
|
||||
accessible_state_types[ATK_STATE_EXPANDED] = ATSPI_STATE_EXPANDED;
|
||||
atk_state_types[ATSPI_STATE_EXPANDED] = ATK_STATE_EXPANDED;
|
||||
accessible_state_types[ATK_STATE_FOCUSABLE] = ATSPI_STATE_FOCUSABLE;
|
||||
atk_state_types[ATSPI_STATE_FOCUSABLE] = ATK_STATE_FOCUSABLE;
|
||||
accessible_state_types[ATK_STATE_FOCUSED] = ATSPI_STATE_FOCUSED;
|
||||
atk_state_types[ATSPI_STATE_FOCUSED] = ATK_STATE_FOCUSED;
|
||||
accessible_state_types[ATK_STATE_HORIZONTAL] = ATSPI_STATE_HORIZONTAL;
|
||||
atk_state_types[ATSPI_STATE_HORIZONTAL] = ATK_STATE_HORIZONTAL;
|
||||
accessible_state_types[ATK_STATE_ICONIFIED] = ATSPI_STATE_ICONIFIED;
|
||||
atk_state_types[ATSPI_STATE_ICONIFIED] = ATK_STATE_ICONIFIED;
|
||||
accessible_state_types[ATK_STATE_MODAL] = ATSPI_STATE_MODAL;
|
||||
atk_state_types[ATSPI_STATE_MODAL] = ATK_STATE_MODAL;
|
||||
accessible_state_types[ATK_STATE_MULTI_LINE] = ATSPI_STATE_MULTI_LINE;
|
||||
atk_state_types[ATSPI_STATE_MULTI_LINE] = ATK_STATE_MULTI_LINE;
|
||||
accessible_state_types[ATK_STATE_MULTISELECTABLE] = ATSPI_STATE_MULTISELECTABLE;
|
||||
atk_state_types[ATSPI_STATE_MULTISELECTABLE] = ATK_STATE_MULTISELECTABLE;
|
||||
accessible_state_types[ATK_STATE_OPAQUE] = ATSPI_STATE_OPAQUE;
|
||||
atk_state_types[ATSPI_STATE_OPAQUE] = ATK_STATE_OPAQUE;
|
||||
accessible_state_types[ATK_STATE_PRESSED] = ATSPI_STATE_PRESSED;
|
||||
atk_state_types[ATSPI_STATE_PRESSED] = ATK_STATE_PRESSED;
|
||||
accessible_state_types[ATK_STATE_RESIZABLE] = ATSPI_STATE_RESIZABLE;
|
||||
atk_state_types[ATSPI_STATE_RESIZABLE] = ATK_STATE_RESIZABLE;
|
||||
accessible_state_types[ATK_STATE_SELECTABLE] = ATSPI_STATE_SELECTABLE;
|
||||
atk_state_types[ATSPI_STATE_SELECTABLE] = ATK_STATE_SELECTABLE;
|
||||
accessible_state_types[ATK_STATE_SELECTED] = ATSPI_STATE_SELECTED;
|
||||
atk_state_types[ATSPI_STATE_SELECTED] = ATK_STATE_SELECTED;
|
||||
accessible_state_types[ATK_STATE_SENSITIVE] = ATSPI_STATE_SENSITIVE;
|
||||
atk_state_types[ATSPI_STATE_SENSITIVE] = ATK_STATE_SENSITIVE;
|
||||
accessible_state_types[ATK_STATE_SHOWING] = ATSPI_STATE_SHOWING;
|
||||
atk_state_types[ATSPI_STATE_SHOWING] = ATK_STATE_SHOWING;
|
||||
accessible_state_types[ATK_STATE_SINGLE_LINE] = ATSPI_STATE_SINGLE_LINE;
|
||||
atk_state_types[ATSPI_STATE_SINGLE_LINE] = ATK_STATE_SINGLE_LINE;
|
||||
accessible_state_types[ATK_STATE_STALE] = ATSPI_STATE_STALE;
|
||||
atk_state_types[ATSPI_STATE_STALE] = ATK_STATE_STALE;
|
||||
accessible_state_types[ATK_STATE_TRANSIENT] = ATSPI_STATE_TRANSIENT;
|
||||
atk_state_types[ATSPI_STATE_TRANSIENT] = ATK_STATE_TRANSIENT;
|
||||
accessible_state_types[ATK_STATE_VERTICAL] = ATSPI_STATE_VERTICAL;
|
||||
atk_state_types[ATSPI_STATE_VERTICAL] = ATK_STATE_VERTICAL;
|
||||
accessible_state_types[ATK_STATE_VISIBLE] = ATSPI_STATE_VISIBLE;
|
||||
atk_state_types[ATSPI_STATE_VISIBLE] = ATK_STATE_VISIBLE;
|
||||
accessible_state_types[ATK_STATE_MANAGES_DESCENDANTS] = ATSPI_STATE_MANAGES_DESCENDANTS;
|
||||
atk_state_types[ATSPI_STATE_MANAGES_DESCENDANTS] = ATK_STATE_MANAGES_DESCENDANTS;
|
||||
accessible_state_types[ATK_STATE_INDETERMINATE] = ATSPI_STATE_INDETERMINATE;
|
||||
atk_state_types[ATSPI_STATE_INDETERMINATE] = ATK_STATE_INDETERMINATE;
|
||||
accessible_state_types[ATK_STATE_TRUNCATED] = ATSPI_STATE_TRUNCATED;
|
||||
atk_state_types[ATSPI_STATE_TRUNCATED] = ATK_STATE_TRUNCATED;
|
||||
accessible_state_types[ATK_STATE_REQUIRED] = ATSPI_STATE_REQUIRED;
|
||||
atk_state_types[ATSPI_STATE_REQUIRED] = ATK_STATE_REQUIRED;
|
||||
accessible_state_types[ATK_STATE_INVALID_ENTRY] = ATSPI_STATE_INVALID_ENTRY;
|
||||
atk_state_types[ATSPI_STATE_INVALID_ENTRY] = ATK_STATE_INVALID_ENTRY;
|
||||
accessible_state_types[ATK_STATE_SUPPORTS_AUTOCOMPLETION] = ATSPI_STATE_SUPPORTS_AUTOCOMPLETION;
|
||||
atk_state_types[ATSPI_STATE_SUPPORTS_AUTOCOMPLETION] = ATK_STATE_SUPPORTS_AUTOCOMPLETION;
|
||||
accessible_state_types[ATK_STATE_SELECTABLE_TEXT] = ATSPI_STATE_SELECTABLE_TEXT;
|
||||
atk_state_types[ATSPI_STATE_SELECTABLE_TEXT] = ATK_STATE_SELECTABLE_TEXT;
|
||||
accessible_state_types[ATK_STATE_DEFAULT] = ATSPI_STATE_IS_DEFAULT;
|
||||
atk_state_types[ATSPI_STATE_IS_DEFAULT] = ATK_STATE_DEFAULT;
|
||||
accessible_state_types[ATK_STATE_VISITED] = ATSPI_STATE_VISITED;
|
||||
atk_state_types[ATSPI_STATE_VISITED] = ATK_STATE_VISITED;
|
||||
accessible_state_types[ATK_STATE_HAS_POPUP] = ATSPI_STATE_HAS_POPUP;
|
||||
atk_state_types[ATSPI_STATE_HAS_POPUP] = ATK_STATE_HAS_POPUP;
|
||||
accessible_state_types[ATK_STATE_CHECKABLE] = ATSPI_STATE_CHECKABLE;
|
||||
atk_state_types[ATSPI_STATE_CHECKABLE] = ATK_STATE_CHECKABLE;
|
||||
accessible_state_types[ATK_STATE_HAS_TOOLTIP] = ATSPI_STATE_HAS_TOOLTIP;
|
||||
atk_state_types[ATSPI_STATE_HAS_TOOLTIP] = ATK_STATE_HAS_TOOLTIP;
|
||||
accessible_state_types[ATK_STATE_READ_ONLY] = ATSPI_STATE_READ_ONLY;
|
||||
atk_state_types[ATSPI_STATE_READ_ONLY] = ATK_STATE_READ_ONLY;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline AtkState
|
||||
state_spi_to_atk (AtspiStateType state)
|
||||
{
|
||||
guint idx = state;
|
||||
if (idx < ATSPI_STATE_LAST_DEFINED)
|
||||
return atk_state_types [idx];
|
||||
else
|
||||
return ATK_STATE_INVALID;
|
||||
}
|
||||
|
||||
AtkState
|
||||
spi_atk_state_from_spi_state (AtspiStateType state)
|
||||
{
|
||||
spi_init_state_type_tables ();
|
||||
return state_spi_to_atk (state);
|
||||
}
|
||||
|
||||
AtkStateSet *
|
||||
spi_state_set_cache_from_sequence (GArray *seq)
|
||||
{
|
||||
int i;
|
||||
AtkStateSet *set;
|
||||
AtkStateType *states;
|
||||
|
||||
spi_init_state_type_tables ();
|
||||
|
||||
states = g_newa (AtkStateType, seq->len);
|
||||
for (i = 0; i < seq->len; i++)
|
||||
states [i] = state_spi_to_atk (g_array_index (seq, dbus_int32_t, i));
|
||||
|
||||
set = atk_state_set_new ();
|
||||
atk_state_set_add_states (set, states, seq->len);
|
||||
|
||||
g_array_free (seq, TRUE);
|
||||
return set;
|
||||
}
|
||||
|
||||
void
|
||||
spi_atk_state_to_dbus_array (AtkObject * object, dbus_uint32_t * array)
|
||||
{
|
||||
AtkStateSet *set = atk_object_ref_state_set (object);
|
||||
spi_atk_state_set_to_dbus_array (set, array);
|
||||
g_clear_object (&set);
|
||||
}
|
||||
|
||||
void
|
||||
spi_atk_state_set_to_dbus_array (AtkStateSet * set, dbus_uint32_t * array)
|
||||
{
|
||||
int i;
|
||||
|
||||
array[0] = 0;
|
||||
array[1] = 0;
|
||||
if (!set)
|
||||
return;
|
||||
spi_init_state_type_tables ();
|
||||
|
||||
g_assert (ATK_STATE_LAST_DEFINED <= 64);
|
||||
for (i = 0; i < ATK_STATE_LAST_DEFINED; i++)
|
||||
{
|
||||
if (atk_state_set_contains_state (set, i))
|
||||
{
|
||||
int a = accessible_state_types[i];
|
||||
g_assert (a < 64);
|
||||
BITARRAY_SET (array, a);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBLE_STATE_SET_H_
|
||||
#define ACCESSIBLE_STATE_SET_H_
|
||||
|
||||
#include <atk/atkstateset.h>
|
||||
#include "atspi/atspi.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* private - internal API to abstract away atk API */
|
||||
AtkStateSet *spi_state_set_cache_from_sequence(GArray *seq);
|
||||
AtkState spi_atk_state_from_spi_state (AtspiStateType state);
|
||||
void spi_atk_state_to_dbus_array (AtkObject * object, dbus_uint32_t * array);
|
||||
void spi_atk_state_set_to_dbus_array (AtkStateSet *set, dbus_uint32_t * array);
|
||||
#define spi_state_set_cache_ref(s) g_object_ref (s)
|
||||
#define spi_state_set_cache_unref(s) g_object_unref (s)
|
||||
#define spi_state_set_cache_new(seq) spi_state_set_cache_from_sequence (seq)
|
||||
#define spi_state_set_cache_contains(s,a) atk_state_set_contains_state (ATK_STATE_SET (s), \
|
||||
spi_atk_state_from_spi_state (a))
|
||||
#define spi_state_set_cache_add(s,a) atk_state_set_add_state (ATK_STATE_SET (s), \
|
||||
spi_atk_state_from_spi_state (a))
|
||||
#define spi_state_set_cache_remove(s,a) atk_state_set_remove_state (ATK_STATE_SET (s), \
|
||||
spi_atk_state_from_spi_state (a))
|
||||
#define spi_state_set_cache_xor(a,b) atk_state_set_xor_sets (ATK_STATE_SET (a), ATK_STATE_SET (b))
|
||||
#define spi_state_set_cache_is_empty(a) atk_state_set_is_empty (ATK_STATE_SET (a))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* ACCESSIBLE_STATE_SET_H_ */
|
|
@ -0,0 +1,574 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "atspi/atspi.h"
|
||||
#include "spi-dbus.h"
|
||||
#include "accessible-stateset.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
#include <string.h>
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Name (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
return droute_return_v_string (iter, atk_object_get_name (object));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Description (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
return droute_return_v_string (iter, atk_object_get_description (object));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Locale (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
return droute_return_v_string (iter, atk_object_get_object_locale (object));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Parent (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *obj = (AtkObject *) user_data;
|
||||
AtkObject *parent;
|
||||
DBusMessageIter iter_variant;
|
||||
dbus_uint32_t role;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
role = spi_accessible_role_from_atk_role (atk_object_get_role (obj));
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(so)",
|
||||
&iter_variant);
|
||||
|
||||
parent = atk_object_get_parent (obj);
|
||||
if (parent == NULL)
|
||||
{
|
||||
/* TODO, move in to a 'Plug' wrapper. */
|
||||
if (ATK_IS_PLUG (obj))
|
||||
{
|
||||
char *id = g_object_get_data (G_OBJECT (obj), "dbus-plug-parent");
|
||||
char *bus_parent;
|
||||
char *path_parent;
|
||||
|
||||
if (id)
|
||||
{
|
||||
bus_parent = g_strdup (id);
|
||||
if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
|
||||
{
|
||||
DBusMessageIter iter_parent;
|
||||
*(path_parent++) = '\0';
|
||||
dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_parent);
|
||||
dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_STRING, &bus_parent);
|
||||
dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_OBJECT_PATH, &path_parent);
|
||||
dbus_message_iter_close_container (&iter_variant, &iter_parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_null_reference (&iter_variant);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_null_reference (&iter_variant);
|
||||
}
|
||||
}
|
||||
else if (role != ATSPI_ROLE_APPLICATION)
|
||||
spi_object_append_null_reference (&iter_variant);
|
||||
else
|
||||
spi_object_append_desktop_reference (&iter_variant);
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_reference (&iter_variant, parent);
|
||||
}
|
||||
|
||||
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ChildCount (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
int childCount;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
childCount = (ATK_IS_SOCKET (object) && atk_socket_is_occupied (ATK_SOCKET (object)))
|
||||
? 1
|
||||
: atk_object_get_n_accessible_children (object);
|
||||
return droute_return_v_int32 (iter, childCount);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetChildAtIndex (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t i;
|
||||
AtkObject *child;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
if (ATK_IS_SOCKET (object) && atk_socket_is_occupied (ATK_SOCKET (object)) && i == 0)
|
||||
{
|
||||
AtkSocket *socket = ATK_SOCKET (object);
|
||||
gchar *child_name, *child_path;
|
||||
child_name = g_strdup (socket->embedded_plug_id);
|
||||
child_path = g_utf8_strchr (child_name + 1, -1, ':');
|
||||
if (child_path)
|
||||
{
|
||||
DBusMessageIter iter, iter_socket;
|
||||
*(child_path++) = '\0';
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_socket);
|
||||
dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_STRING, &child_name);
|
||||
dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_OBJECT_PATH, &child_path);
|
||||
dbus_message_iter_close_container (&iter, &iter_socket);
|
||||
return reply;
|
||||
}
|
||||
g_free (child_name);
|
||||
}
|
||||
child = atk_object_ref_accessible_child (object, i);
|
||||
reply = spi_object_return_reference (message, child);
|
||||
if (child)
|
||||
g_object_unref (child);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetChildren (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
gint i;
|
||||
gint count;
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter, iter_array;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
count = atk_object_get_n_accessible_children (object);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
goto oom;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "(so)", &iter_array))
|
||||
goto oom;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
AtkObject *child = atk_object_ref_accessible_child (object, i);
|
||||
spi_object_append_reference (&iter_array, child);
|
||||
if (child)
|
||||
g_object_unref (child);
|
||||
}
|
||||
if (!dbus_message_iter_close_container (&iter, &iter_array))
|
||||
goto oom;
|
||||
return reply;
|
||||
oom:
|
||||
// TODO: handle out-of-memory
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetIndexInParent (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
dbus_int32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
rv = atk_object_get_index_in_parent (object);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv, DBUS_TYPE_INVALID);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
spi_init_relation_type_table (AtspiRelationType * types)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < ATK_RELATION_LAST_DEFINED; i++)
|
||||
types[i] = ATSPI_RELATION_NULL;
|
||||
|
||||
types[ATK_RELATION_CONTROLLED_BY] = ATSPI_RELATION_CONTROLLED_BY;
|
||||
types[ATK_RELATION_CONTROLLER_FOR] = ATSPI_RELATION_CONTROLLER_FOR;
|
||||
types[ATK_RELATION_LABEL_FOR] = ATSPI_RELATION_LABEL_FOR;
|
||||
types[ATK_RELATION_LABELLED_BY] = ATSPI_RELATION_LABELLED_BY;
|
||||
types[ATK_RELATION_MEMBER_OF] = ATSPI_RELATION_MEMBER_OF;
|
||||
types[ATK_RELATION_NODE_CHILD_OF] = ATSPI_RELATION_NODE_CHILD_OF;
|
||||
types[ATK_RELATION_FLOWS_TO] = ATSPI_RELATION_FLOWS_TO;
|
||||
types[ATK_RELATION_FLOWS_FROM] = ATSPI_RELATION_FLOWS_FROM;
|
||||
types[ATK_RELATION_SUBWINDOW_OF] = ATSPI_RELATION_SUBWINDOW_OF;
|
||||
types[ATK_RELATION_EMBEDS] = ATSPI_RELATION_EMBEDS;
|
||||
types[ATK_RELATION_EMBEDDED_BY] = ATSPI_RELATION_EMBEDDED_BY;
|
||||
types[ATK_RELATION_POPUP_FOR] = ATSPI_RELATION_POPUP_FOR;
|
||||
types[ATK_RELATION_PARENT_WINDOW_OF] =
|
||||
ATSPI_RELATION_PARENT_WINDOW_OF;
|
||||
types[ATK_RELATION_DESCRIPTION_FOR] =
|
||||
ATSPI_RELATION_DESCRIPTION_FOR;
|
||||
types[ATK_RELATION_DESCRIBED_BY] = ATSPI_RELATION_DESCRIBED_BY;
|
||||
types[ATK_RELATION_DETAILS] = ATSPI_RELATION_DETAILS;
|
||||
types[ATK_RELATION_DETAILS_FOR] = ATSPI_RELATION_DETAILS_FOR;
|
||||
types[ATK_RELATION_ERROR_MESSAGE] = ATSPI_RELATION_ERROR_MESSAGE;
|
||||
types[ATK_RELATION_ERROR_FOR] = ATSPI_RELATION_ERROR_FOR;
|
||||
types[ATK_RELATION_NODE_PARENT_OF] = ATSPI_RELATION_NODE_PARENT_OF;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static AtspiRelationType
|
||||
spi_relation_type_from_atk_relation_type (AtkRelationType type)
|
||||
{
|
||||
static gboolean is_initialized = FALSE;
|
||||
static AtspiRelationType
|
||||
spi_relation_type_table[ATK_RELATION_LAST_DEFINED];
|
||||
AtspiRelationType spi_type;
|
||||
|
||||
if (!is_initialized)
|
||||
is_initialized = spi_init_relation_type_table (spi_relation_type_table);
|
||||
|
||||
if (type > ATK_RELATION_NULL && type < ATK_RELATION_LAST_DEFINED)
|
||||
spi_type = spi_relation_type_table[type];
|
||||
else
|
||||
spi_type = ATSPI_RELATION_EXTENDED;
|
||||
return spi_type;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRelationSet (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
AtkRelationSet *set;
|
||||
DBusMessageIter iter, iter_array, iter_struct, iter_targets;
|
||||
gint count;
|
||||
gint i, j;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
set = atk_object_ref_relation_set (object);
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "(ua(so))", &iter_array))
|
||||
{
|
||||
goto oom;
|
||||
}
|
||||
count = 0;
|
||||
if (set)
|
||||
count = atk_relation_set_get_n_relations (set);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
AtkRelation *r = atk_relation_set_get_relation (set, i);
|
||||
AtkRelationType rt;
|
||||
GPtrArray *target;
|
||||
dbus_uint32_t type;
|
||||
if (!r)
|
||||
continue;
|
||||
rt = atk_relation_get_relation_type (r);
|
||||
type = spi_relation_type_from_atk_relation_type (rt);
|
||||
target = atk_relation_get_target (r);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
|
||||
{
|
||||
goto oom;
|
||||
}
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &type);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter_struct, DBUS_TYPE_ARRAY, "(so)", &iter_targets))
|
||||
{
|
||||
goto oom;
|
||||
}
|
||||
for (j = 0; j < target->len; j++)
|
||||
{
|
||||
AtkObject *obj = target->pdata[j];
|
||||
if (!obj)
|
||||
continue;
|
||||
spi_object_append_reference (&iter_targets, obj);
|
||||
}
|
||||
dbus_message_iter_close_container (&iter_struct, &iter_targets);
|
||||
dbus_message_iter_close_container (&iter_array, &iter_struct);
|
||||
}
|
||||
dbus_message_iter_close_container (&iter, &iter_array);
|
||||
oom:
|
||||
if (set)
|
||||
g_object_unref (set);
|
||||
// TODO: handle out of memory */
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRole (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
gint role;
|
||||
dbus_uint32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
role = atk_object_get_role (object);
|
||||
rv = spi_accessible_role_from_atk_role (role);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRoleName (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
gint role;
|
||||
const char *role_name;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
role = atk_object_get_role (object);
|
||||
role_name = atk_role_get_name (role);
|
||||
if (!role_name)
|
||||
role_name = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &role_name,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLocalizedRoleName (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
gint role;
|
||||
const char *role_name;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
role = atk_object_get_role (object);
|
||||
role_name = atk_role_get_localized_name (role);
|
||||
if (!role_name)
|
||||
role_name = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &role_name,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetState (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
|
||||
DBusMessage *reply = NULL;
|
||||
DBusMessageIter iter, iter_array;
|
||||
|
||||
dbus_uint32_t states[2];
|
||||
|
||||
guint count;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
|
||||
spi_atk_state_to_dbus_array (object, states);
|
||||
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "u", &iter_array);
|
||||
for (count = 0; count < 2; count++)
|
||||
{
|
||||
dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_UINT32,
|
||||
&states[count]);
|
||||
}
|
||||
dbus_message_iter_close_container (&iter, &iter_array);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributes (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
AtkAttributeSet *attributes;
|
||||
DBusMessage *reply = NULL;
|
||||
DBusMessageIter iter;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
attributes = atk_object_get_attributes (object);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, attributes);
|
||||
|
||||
atk_attribute_set_free (attributes);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Attributes (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
DBusMessageIter iter_variant;
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
AtkAttributeSet *attributes;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
attributes = atk_object_get_attributes (object);
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "a{ss}", &iter_variant);
|
||||
spi_object_append_attribute_set (&iter_variant, attributes);
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
|
||||
atk_attribute_set_free (attributes);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetApplication (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
return spi_object_return_reference (message, atk_get_root ());
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetInterfaces (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter, iter_array;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "s",
|
||||
&iter_array);
|
||||
spi_object_append_interfaces (&iter_array, object);
|
||||
dbus_message_iter_close_container (&iter, &iter_array);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_AccessibleId (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
|
||||
|
||||
return droute_return_v_string (iter, atk_object_get_accessible_id (object));
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetChildAtIndex, "GetChildAtIndex"},
|
||||
{impl_GetChildren, "GetChildren"},
|
||||
{impl_GetIndexInParent, "GetIndexInParent"},
|
||||
{impl_GetRelationSet, "GetRelationSet"},
|
||||
{impl_GetRole, "GetRole"},
|
||||
{impl_GetRoleName, "GetRoleName"},
|
||||
{impl_GetLocalizedRoleName, "GetLocalizedRoleName"},
|
||||
{impl_GetState, "GetState"},
|
||||
{impl_GetAttributes, "GetAttributes"},
|
||||
{impl_GetApplication, "GetApplication"},
|
||||
{impl_GetInterfaces, "GetInterfaces"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_Name, NULL, "Name"},
|
||||
{impl_get_Description, NULL, "Description"},
|
||||
{impl_get_Locale, NULL, "Locale"},
|
||||
{impl_get_Parent, NULL, "Parent"},
|
||||
{impl_get_ChildCount, NULL, "ChildCount"},
|
||||
{impl_get_Attributes, NULL, "Attributes"},
|
||||
{impl_get_AccessibleId, NULL, "AccessibleId"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_accessible (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_ACCESSIBLE,
|
||||
spi_org_a11y_atspi_Accessible,
|
||||
methods, properties);
|
||||
};
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NActions (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_action_get_n_actions (action));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_get_description (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t index;
|
||||
const char *desc;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
desc = atk_action_get_description (action, index);
|
||||
if (!desc)
|
||||
desc = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &desc,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_get_name (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t index;
|
||||
const char *name;
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
name = atk_action_get_name (action, index);
|
||||
if (!name)
|
||||
name = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &name,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_get_localized_name (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t index;
|
||||
const char *name;
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
name = atk_action_get_localized_name (action, index);
|
||||
if (!name)
|
||||
name = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &name,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_get_keybinding (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t index;
|
||||
const char *kb;
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
kb = atk_action_get_keybinding (action, index);
|
||||
if (!kb)
|
||||
kb = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &kb,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
DBusMessage *reply;
|
||||
gint count;
|
||||
gint i;
|
||||
DBusMessageIter iter, iter_array, iter_struct;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
count = atk_action_get_n_actions (action);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
goto oom;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "(sss)", &iter_array))
|
||||
goto oom;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const char *name = atk_action_get_name (action, i);
|
||||
const char *lname = atk_action_get_localized_name (action, i);
|
||||
const char *desc = atk_action_get_description (action, i);
|
||||
const char *kb = atk_action_get_keybinding (action, i);
|
||||
if (!name)
|
||||
name = "";
|
||||
if (!lname)
|
||||
lname = "";
|
||||
if (!desc)
|
||||
desc = "";
|
||||
if (!kb)
|
||||
kb = "";
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
|
||||
goto oom;
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &lname);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &kb);
|
||||
if (!dbus_message_iter_close_container (&iter_array, &iter_struct))
|
||||
goto oom;
|
||||
}
|
||||
if (!dbus_message_iter_close_container (&iter, &iter_array))
|
||||
goto oom;
|
||||
return reply;
|
||||
oom:
|
||||
// TODO: handle out-of-memory
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_DoAction (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkAction *action = (AtkAction *) user_data;
|
||||
dbus_int32_t index;
|
||||
dbus_bool_t rv = TRUE;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_ACTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
dbus_connection_send (bus, reply, NULL);
|
||||
dbus_message_unref (reply);
|
||||
atk_action_do_action (action, index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DRouteMethod methods[] = {
|
||||
{impl_get_description, "GetDescription"}
|
||||
,
|
||||
{impl_get_name, "GetName"}
|
||||
,
|
||||
{impl_get_localized_name, "GetLocalizedName"}
|
||||
,
|
||||
{impl_get_keybinding, "GetKeyBinding"}
|
||||
,
|
||||
{impl_GetActions, "GetActions"}
|
||||
,
|
||||
{impl_DoAction, "DoAction"}
|
||||
,
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_NActions, NULL, "NActions"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_action (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_ACTION,
|
||||
spi_org_a11y_atspi_Action, methods, properties);
|
||||
};
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ADAPTORS_H
|
||||
#define ADAPTORS_H
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
AtspiRole spi_accessible_role_from_atk_role (AtkRole role);
|
||||
|
||||
void spi_initialize_accessible (DRoutePath * path);
|
||||
void spi_initialize_action (DRoutePath * path);
|
||||
void spi_initialize_application (DRoutePath * path);
|
||||
void spi_initialize_collection (DRoutePath * path);
|
||||
void spi_initialize_component (DRoutePath * path);
|
||||
void spi_initialize_document (DRoutePath * path);
|
||||
void spi_initialize_editabletext (DRoutePath * path);
|
||||
void spi_initialize_hyperlink (DRoutePath * path);
|
||||
void spi_initialize_hypertext (DRoutePath * path);
|
||||
void spi_initialize_image (DRoutePath * path);
|
||||
void spi_initialize_selection (DRoutePath * path);
|
||||
void spi_initialize_socket (DRoutePath * path);
|
||||
void spi_initialize_table (DRoutePath * path);
|
||||
void spi_initialize_table_cell (DRoutePath * path);
|
||||
void spi_initialize_text (DRoutePath * path);
|
||||
void spi_initialize_value (DRoutePath * path);
|
||||
void spi_initialize_cache (DRoutePath * path);
|
||||
|
||||
#endif /* ADAPTORS_H */
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "introspection.h"
|
||||
|
||||
/* for spi_global_app_data is there a better way? */
|
||||
#include "../bridge.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ToolkitName (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
return droute_return_v_string (iter, atk_get_toolkit_name ());
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Version (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
return droute_return_v_string (iter, atk_get_toolkit_version ());
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_AtspiVersion (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
return droute_return_v_string (iter, "2.1");
|
||||
}
|
||||
|
||||
static dbus_int32_t id;
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Id (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
return droute_return_v_int32 (iter, id);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_set_Id (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
id = droute_get_v_int32 (iter);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_registerToolkitEventListener (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_get_app_bus(DBusConnection *bus, DBusMessage *msg, void *data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
|
||||
if (bus == spi_global_app_data->bus)
|
||||
spi_atk_add_client (dbus_message_get_sender (msg));
|
||||
|
||||
if (!spi_global_app_data->app_bus_addr)
|
||||
spi_atk_create_socket (spi_global_app_data);
|
||||
|
||||
reply = dbus_message_new_method_return(msg);
|
||||
if (reply)
|
||||
{
|
||||
const char *retval = (atspi_is_initialized () ?
|
||||
"":
|
||||
spi_global_app_data->app_bus_addr);
|
||||
if (!retval)
|
||||
retval = "";
|
||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &retval, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_registerToolkitEventListener, "registerToolkitEventListener"},
|
||||
{impl_registerObjectEventListener, "registerObjectEventListener"},
|
||||
{impl_pause, "pause"},
|
||||
{impl_resume, "resume"},
|
||||
{impl_GetLocale, "GetLocale"},
|
||||
{impl_get_app_bus, "GetApplicationBusAddress"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_ToolkitName, NULL, "ToolkitName"},
|
||||
{impl_get_Version, NULL, "Version"},
|
||||
{impl_get_AtspiVersion, NULL, "AtspiVersion"},
|
||||
{impl_get_Id, impl_set_Id, "Id"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/*static long
|
||||
obj_is_root (const char *path, void *user_data)
|
||||
{
|
||||
AtkObject *obj = atk_dbus_get_object (path);
|
||||
return (obj == atk_get_root ());
|
||||
}*/
|
||||
|
||||
void
|
||||
spi_initialize_application (DRoutePath * path)
|
||||
{
|
||||
droute_path_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_APPLICATION,
|
||||
spi_org_a11y_atspi_Application,
|
||||
methods, properties);
|
||||
};
|
|
@ -0,0 +1,356 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
* Copyright 2008, 2009 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "accessible-stateset.h"
|
||||
#include "accessible-cache.h"
|
||||
#include "bridge.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
/* TODO - This should possibly be a common define */
|
||||
#define SPI_OBJECT_PREFIX "/org/a11y/atspi"
|
||||
#define SPI_CACHE_OBJECT_SUFFIX "/cache"
|
||||
#define SPI_CACHE_OBJECT_PATH SPI_OBJECT_PREFIX SPI_CACHE_OBJECT_SUFFIX
|
||||
|
||||
#define SPI_OBJECT_REFERENCE_SIGNATURE "(" \
|
||||
DBUS_TYPE_STRING_AS_STRING \
|
||||
DBUS_TYPE_OBJECT_PATH_AS_STRING \
|
||||
")"
|
||||
|
||||
#define SPI_CACHE_ITEM_SIGNATURE "(" \
|
||||
SPI_OBJECT_REFERENCE_SIGNATURE \
|
||||
SPI_OBJECT_REFERENCE_SIGNATURE \
|
||||
SPI_OBJECT_REFERENCE_SIGNATURE \
|
||||
DBUS_TYPE_INT32_AS_STRING \
|
||||
DBUS_TYPE_INT32_AS_STRING \
|
||||
DBUS_TYPE_ARRAY_AS_STRING \
|
||||
DBUS_TYPE_STRING_AS_STRING \
|
||||
DBUS_TYPE_STRING_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
DBUS_TYPE_STRING_AS_STRING \
|
||||
DBUS_TYPE_ARRAY_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
")"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static const char *
|
||||
get_toolkit_name (AtkObject *obj)
|
||||
{
|
||||
static const char *toolkit_name = NULL;
|
||||
|
||||
if (!toolkit_name)
|
||||
toolkit_name = atk_get_toolkit_name ();
|
||||
|
||||
if (!toolkit_name)
|
||||
return "no toolkit name set yet";
|
||||
|
||||
/* TODO: query object attributes */
|
||||
return toolkit_name;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
should_call_index_in_parent (AtkObject *obj, AtkStateSet *set)
|
||||
{
|
||||
if (atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
|
||||
return FALSE;
|
||||
|
||||
if (!strcmp (get_toolkit_name (obj), "gtk") &&
|
||||
atk_object_get_role (obj) == ATK_ROLE_MENU_ITEM)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
should_cache_children (AtkObject *obj, AtkStateSet *set)
|
||||
{
|
||||
if (atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS) ||
|
||||
atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
|
||||
return FALSE;
|
||||
|
||||
if (!strcmp (get_toolkit_name (obj), "gtk") &&
|
||||
atk_object_get_role (obj) == ATK_ROLE_MENU)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshals the given AtkObject into the provided D-Bus iterator.
|
||||
*
|
||||
* The object is marshalled including all its client side cache data.
|
||||
* The format of the structure is (o(so)iiassusau).
|
||||
*/
|
||||
static void
|
||||
append_cache_item (AtkObject * obj, gpointer data)
|
||||
{
|
||||
DBusMessageIter iter_struct, iter_sub_array;
|
||||
dbus_uint32_t states[2];
|
||||
dbus_int32_t count, index;
|
||||
AtkStateSet *set;
|
||||
DBusMessageIter *iter_array = (DBusMessageIter *) data;
|
||||
const char *name, *desc;
|
||||
dbus_uint32_t role;
|
||||
|
||||
set = atk_object_ref_state_set (obj);
|
||||
AtkObject *application, *parent;
|
||||
|
||||
dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
|
||||
/* Marshal object path */
|
||||
spi_object_append_reference (&iter_struct, obj);
|
||||
|
||||
role = spi_accessible_role_from_atk_role (atk_object_get_role (obj));
|
||||
|
||||
/* Marshal application */
|
||||
application = spi_global_app_data->root;
|
||||
spi_object_append_reference (&iter_struct, application);
|
||||
|
||||
/* Marshal parent */
|
||||
parent = atk_object_get_parent (obj);
|
||||
if (parent == NULL)
|
||||
{
|
||||
/* TODO, move in to a 'Plug' wrapper. */
|
||||
if (ATK_IS_PLUG (obj))
|
||||
{
|
||||
char *id = g_object_get_data (G_OBJECT (obj), "dbus-plug-parent");
|
||||
char *bus_parent;
|
||||
char *path_parent;
|
||||
|
||||
if (id)
|
||||
{
|
||||
bus_parent = g_strdup (id);
|
||||
if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
|
||||
{
|
||||
DBusMessageIter iter_parent;
|
||||
*(path_parent++) = '\0';
|
||||
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_parent);
|
||||
dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_STRING, &bus_parent);
|
||||
dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_OBJECT_PATH, &path_parent);
|
||||
dbus_message_iter_close_container (&iter_struct, &iter_parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_null_reference (&iter_struct);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_null_reference (&iter_struct);
|
||||
}
|
||||
}
|
||||
else if (role != ATSPI_ROLE_APPLICATION)
|
||||
spi_object_append_null_reference (&iter_struct);
|
||||
else
|
||||
spi_object_append_desktop_reference (&iter_struct);
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_object_append_reference (&iter_struct, parent);
|
||||
}
|
||||
|
||||
/* Marshal index in parent */
|
||||
index = (should_call_index_in_parent (obj, set)
|
||||
? atk_object_get_index_in_parent (obj) : -1);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &index);
|
||||
|
||||
/* marshal child count */
|
||||
count = (should_cache_children (obj, set)
|
||||
? atk_object_get_n_accessible_children (obj) : -1);
|
||||
|
||||
if (ATK_IS_SOCKET (obj) && atk_socket_is_occupied (ATK_SOCKET (obj)))
|
||||
count = 1;
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &count);
|
||||
|
||||
/* Marshal interfaces */
|
||||
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "s",
|
||||
&iter_sub_array);
|
||||
spi_object_append_interfaces (&iter_sub_array, obj);
|
||||
dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
|
||||
|
||||
/* Marshal name */
|
||||
name = atk_object_get_name (obj);
|
||||
if (!name)
|
||||
name = "";
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
|
||||
/* Marshal role */
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &role);
|
||||
|
||||
/* Marshal description */
|
||||
desc = atk_object_get_description (obj);
|
||||
if (!desc)
|
||||
desc = "";
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
|
||||
|
||||
/* Marshal state set */
|
||||
spi_atk_state_set_to_dbus_array (set, states);
|
||||
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "u",
|
||||
&iter_sub_array);
|
||||
for (count = 0; count < 2; count++)
|
||||
{
|
||||
dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_UINT32,
|
||||
&states[count]);
|
||||
}
|
||||
dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
|
||||
|
||||
dbus_message_iter_close_container (iter_array, &iter_struct);
|
||||
g_object_unref (set);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
ref_accessible_hf (gpointer key, gpointer obj_data, gpointer data)
|
||||
{
|
||||
g_object_ref (key);
|
||||
}
|
||||
|
||||
/* For use as a GHFunc */
|
||||
static void
|
||||
append_accessible_hf (gpointer key, gpointer obj_data, gpointer data)
|
||||
{
|
||||
/* Make sure it isn't a hyperlink */
|
||||
if (ATK_IS_OBJECT (key))
|
||||
append_cache_item (ATK_OBJECT (key), data);
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_list_hf (gpointer key, gpointer obj_data, gpointer data)
|
||||
{
|
||||
GSList **listptr = data;
|
||||
*listptr = g_slist_prepend (*listptr, key);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
emit_cache_remove (SpiCache *cache, GObject * obj)
|
||||
{
|
||||
DBusMessage *message;
|
||||
|
||||
if ((message = dbus_message_new_signal (SPI_CACHE_OBJECT_PATH,
|
||||
ATSPI_DBUS_INTERFACE_CACHE,
|
||||
"RemoveAccessible")))
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
dbus_message_iter_init_append (message, &iter);
|
||||
|
||||
spi_object_append_reference (&iter, ATK_OBJECT (obj));
|
||||
|
||||
dbus_connection_send (spi_global_app_data->bus, message, NULL);
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emit_cache_add (SpiCache *cache, GObject * obj)
|
||||
{
|
||||
AtkObject *accessible = ATK_OBJECT (obj);
|
||||
DBusMessage *message;
|
||||
|
||||
if ((message = dbus_message_new_signal (SPI_CACHE_OBJECT_PATH,
|
||||
ATSPI_DBUS_INTERFACE_CACHE,
|
||||
"AddAccessible")))
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
dbus_message_iter_init_append (message, &iter);
|
||||
g_object_ref (accessible);
|
||||
append_cache_item (accessible, &iter);
|
||||
g_object_unref (accessible);
|
||||
|
||||
dbus_connection_send (spi_global_app_data->bus, message, NULL);
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRoot (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
return spi_object_return_reference (message, spi_global_app_data->root);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetItems (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter, iter_array;
|
||||
GSList *pending_unrefs = NULL;
|
||||
|
||||
if (bus == spi_global_app_data->bus)
|
||||
spi_atk_add_client (dbus_message_get_sender (message));
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
|
||||
SPI_CACHE_ITEM_SIGNATURE, &iter_array);
|
||||
spi_cache_foreach (spi_global_cache, ref_accessible_hf, NULL);
|
||||
spi_cache_foreach (spi_global_cache, append_accessible_hf, &iter_array);
|
||||
spi_cache_foreach (spi_global_cache, add_to_list_hf, &pending_unrefs);
|
||||
g_slist_free_full (pending_unrefs, g_object_unref);
|
||||
dbus_message_iter_close_container (&iter, &iter_array);
|
||||
return reply;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetRoot, "GetRoot"},
|
||||
{impl_GetItems, "GetItems"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_cache (DRoutePath * path)
|
||||
{
|
||||
droute_path_add_interface (path, ATSPI_DBUS_INTERFACE_CACHE, spi_org_a11y_atspi_Cache, methods, NULL);
|
||||
|
||||
g_signal_connect (spi_global_cache, "object-added",
|
||||
(GCallback) emit_cache_add, NULL);
|
||||
|
||||
g_signal_connect (spi_global_cache, "object-removed",
|
||||
(GCallback) emit_cache_remove, NULL);
|
||||
};
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,512 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static DBusMessage *
|
||||
impl_Contains (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_int32_t x, y;
|
||||
dbus_uint32_t coord_type;
|
||||
dbus_bool_t retval;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
retval =
|
||||
atk_component_contains (component, x, y, (AtkCoordType) coord_type);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_int32_t x, y;
|
||||
dbus_uint32_t coord_type;
|
||||
DBusMessage *reply;
|
||||
AtkObject *child;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
child =
|
||||
atk_component_ref_accessible_at_point (component, x, y,
|
||||
(AtkCoordType) coord_type);
|
||||
reply = spi_object_return_reference (message, child);
|
||||
if (child)
|
||||
g_object_unref (child);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetExtents (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_uint32_t coord_type;
|
||||
gint ix, iy, iwidth, iheight;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_component_get_extents (component, &ix, &iy, &iwidth, &iheight,
|
||||
(AtkCoordType) coord_type);
|
||||
return spi_dbus_return_rect (message, ix, iy, iwidth, iheight);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetPosition (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_uint32_t coord_type;
|
||||
gint ix = 0, iy = 0;
|
||||
dbus_int32_t x, y;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_component_get_position (component, &ix, &iy, (AtkCoordType) coord_type);
|
||||
x = ix;
|
||||
y = iy;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32,
|
||||
&y, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetSize (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
gint iwidth = 0, iheight = 0;
|
||||
dbus_int32_t width, height;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
atk_component_get_size (component, &iwidth, &iheight);
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &width,
|
||||
DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLayer (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
AtkLayer atklayer;
|
||||
dbus_uint32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
atklayer = atk_component_get_layer (component);
|
||||
|
||||
switch (atklayer)
|
||||
{
|
||||
case ATK_LAYER_BACKGROUND:
|
||||
rv = ATSPI_LAYER_BACKGROUND;
|
||||
break;
|
||||
case ATK_LAYER_CANVAS:
|
||||
rv = ATSPI_LAYER_CANVAS;
|
||||
break;
|
||||
case ATK_LAYER_WIDGET:
|
||||
rv = ATSPI_LAYER_WIDGET;
|
||||
break;
|
||||
case ATK_LAYER_MDI:
|
||||
rv = ATSPI_LAYER_MDI;
|
||||
break;
|
||||
case ATK_LAYER_POPUP:
|
||||
rv = ATSPI_LAYER_POPUP;
|
||||
break;
|
||||
case ATK_LAYER_OVERLAY:
|
||||
rv = ATSPI_LAYER_OVERLAY;
|
||||
break;
|
||||
case ATK_LAYER_WINDOW:
|
||||
rv = ATSPI_LAYER_WINDOW;
|
||||
break;
|
||||
default:
|
||||
rv = ATSPI_LAYER_INVALID;
|
||||
break;
|
||||
}
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetMDIZOrder (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_int16_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
rv = atk_component_get_mdi_zorder (component);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT16, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GrabFocus (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
rv = atk_component_grab_focus (component);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static DBusMessage *
|
||||
impl_registerFocusHandler (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_deregisterFocusHandler (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAlpha (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
double rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
rv = atk_component_get_alpha (component);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_DOUBLE, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetExtents (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
DBusMessageIter iter, iter_struct;
|
||||
dbus_uint32_t coord_type;
|
||||
dbus_int32_t x, y, width, height;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (strcmp (dbus_message_get_signature (message), "(iiii)u") != 0)
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
dbus_message_iter_init (message, &iter);
|
||||
dbus_message_iter_recurse (&iter, &iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &x);
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &y);
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &width);
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &height);
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_next (&iter);
|
||||
dbus_message_iter_get_basic (&iter, &coord_type);
|
||||
|
||||
ret = atk_component_set_extents (component, x, y, width, height, coord_type);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetPosition (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_uint32_t coord_type;
|
||||
dbus_int32_t x, y;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_component_set_position (component, x, y, coord_type);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ScreenExtents (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
DBusMessageIter iter_variant, iter_struct;
|
||||
gint ix = -1, iy = -1, iwidth = -1, iheight = -1;
|
||||
dbus_uint32_t x, y, width, height;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data), FALSE);
|
||||
|
||||
atk_component_get_extents (component, &ix, &iy, &iwidth, &iheight, ATK_XY_SCREEN);
|
||||
x = ix;
|
||||
y = iy;
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(uuuu)",
|
||||
&iter_variant);
|
||||
dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &x);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &y);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &width);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &height);
|
||||
dbus_message_iter_close_container (&iter_variant, &iter_struct);
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetSize (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_int32_t width, height;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32, &height,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_component_set_size (component, width, height);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_ScrollTo (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_uint32_t type;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_component_scroll_to (component, type);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_ScrollToPoint (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkComponent *component = (AtkComponent *) user_data;
|
||||
dbus_uint32_t type;
|
||||
dbus_int32_t x, y;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INT32, &x,
|
||||
DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_component_scroll_to_point (component, type, x, y);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_Contains, "Contains"},
|
||||
{impl_GetAccessibleAtPoint, "GetAccessibleAtPoint"},
|
||||
{impl_GetExtents, "GetExtents"},
|
||||
{impl_GetPosition, "GetPosition"},
|
||||
{impl_GetSize, "GetSize"},
|
||||
{impl_GetLayer, "GetLayer"},
|
||||
{impl_GetMDIZOrder, "GetMDIZOrder"},
|
||||
{impl_GrabFocus, "GrabFocus"},
|
||||
//{impl_registerFocusHandler, "registerFocusHandler"},
|
||||
//{impl_deregisterFocusHandler, "deregisterFocusHandler"},
|
||||
{impl_GetAlpha, "GetAlpha"},
|
||||
{impl_SetExtents, "SetExtents"},
|
||||
{impl_SetPosition, "SetPosition"},
|
||||
{impl_SetSize, "SetSize"},
|
||||
{impl_ScrollTo, "ScrollTo"},
|
||||
{impl_ScrollToPoint, "ScrollToPoint"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_ScreenExtents, NULL, "ScreenExtents"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
void
|
||||
spi_initialize_component (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_COMPONENT, spi_org_a11y_atspi_Component, methods, properties);
|
||||
};
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_CurrentPageNumber (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkDocument *document = (AtkDocument *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_DOCUMENT (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_document_get_current_page_number (document));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_PageCount (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkDocument *document = (AtkDocument *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_DOCUMENT (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_document_get_page_count (document));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkDocument *document = (AtkDocument *) user_data;
|
||||
const gchar *lc;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
lc = atk_document_get_locale (document);
|
||||
if (!lc)
|
||||
lc = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &lc,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributeValue (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkDocument *document = (AtkDocument *) user_data;
|
||||
gchar *attributename;
|
||||
const gchar *atr;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atr = atk_document_get_attribute_value (document, attributename);
|
||||
if (!atr)
|
||||
atr = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &atr,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributes (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkDocument *document = (AtkDocument *) user_data;
|
||||
DBusMessage *reply;
|
||||
AtkAttributeSet *attributes;
|
||||
DBusMessageIter iter;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
attributes = atk_document_get_attributes (document);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, attributes);
|
||||
}
|
||||
|
||||
if (attributes)
|
||||
atk_attribute_set_free (attributes);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetLocale, "GetLocale"},
|
||||
{impl_GetAttributeValue, "GetAttributeValue"},
|
||||
{impl_GetAttributes, "GetAttributes"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_CurrentPageNumber, NULL, "CurrentPageNumber"},
|
||||
{impl_get_PageCount, NULL, "PageCount"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_document (DRoutePath * path)
|
||||
{
|
||||
droute_path_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_DOCUMENT, spi_org_a11y_atspi_Document, methods, properties);
|
||||
};
|
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
#include "introspection.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetTextContents (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
const char *newContents;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_editable_text_set_text_contents (editable, newContents);
|
||||
rv = TRUE;
|
||||
// TODO decide if we really need this return value
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_InsertText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
dbus_int32_t position, length;
|
||||
char *text;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
gint ip;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
|
||||
DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ip = position;
|
||||
atk_editable_text_insert_text (editable, text, length, &ip);
|
||||
rv = TRUE;
|
||||
// TODO decide if we really need this return value
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_CopyText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
dbus_int32_t startPos, endPos;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_editable_text_copy_text (editable, startPos, endPos);
|
||||
return dbus_message_new_method_return (message);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_CutText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
dbus_int32_t startPos, endPos;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_editable_text_cut_text (editable, startPos, endPos);
|
||||
rv = TRUE;
|
||||
// TODO decide if we really need this return value
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_DeleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
dbus_int32_t startPos, endPos;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_editable_text_delete_text (editable, startPos, endPos);
|
||||
rv = TRUE;
|
||||
// TODO decide if we really need this return value
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_PasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkEditableText *editable = (AtkEditableText *) user_data;
|
||||
dbus_int32_t position;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_editable_text_paste_text (editable, position);
|
||||
rv = TRUE;
|
||||
// TODO decide if we really need this return value
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_SetTextContents, "SetTextContents"},
|
||||
{impl_InsertText, "InsertText"},
|
||||
{impl_CopyText, "CopyText"},
|
||||
{impl_CutText, "CutText"},
|
||||
{impl_DeleteText, "DeleteText"},
|
||||
{impl_PasteText, "PasteText"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_editabletext (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, spi_org_a11y_atspi_EditableText, methods, NULL);
|
||||
};
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "introspection.h"
|
||||
#include "object.h"
|
||||
|
||||
static AtkHyperlink *
|
||||
get_hyperlink (void *user_data)
|
||||
{
|
||||
if (ATK_IS_HYPERLINK (user_data))
|
||||
return ATK_HYPERLINK (user_data);
|
||||
if (ATK_IS_HYPERLINK_IMPL (user_data))
|
||||
return atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (user_data));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NAnchors (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link));
|
||||
}
|
||||
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_StartIndex (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_EndIndex (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetObject (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
dbus_int32_t i;
|
||||
AtkObject *atk_object;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_object = atk_hyperlink_get_object (link, i);
|
||||
return spi_object_return_reference (message, atk_object);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetURI (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
dbus_int32_t i;
|
||||
gchar *rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
rv = atk_hyperlink_get_uri (link, i);
|
||||
if (!rv)
|
||||
rv = g_strdup ("");
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (rv);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_IsValid (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkHyperlink *link = get_hyperlink (user_data);
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERLINK (link),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
rv = atk_hyperlink_is_valid (link);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetObject, "GetObject"},
|
||||
{impl_GetURI, "GetURI"},
|
||||
{impl_IsValid, "IsValid"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_NAnchors, NULL, "NAnchors"},
|
||||
{impl_get_StartIndex, NULL, "StartIndex"},
|
||||
{impl_get_EndIndex, NULL, "EndIndex"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_hyperlink (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_HYPERLINK,
|
||||
spi_org_a11y_atspi_Hyperlink,
|
||||
methods, properties);
|
||||
};
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
|
||||
#include "introspection.h"
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetNLinks (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkHypertext *hypertext = (AtkHypertext *) user_data;
|
||||
gint rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
rv = atk_hypertext_get_n_links (hypertext);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLink (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkHypertext *hypertext = (AtkHypertext *) user_data;
|
||||
dbus_int32_t linkIndex;
|
||||
AtkHyperlink *link;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
link = atk_hypertext_get_link (hypertext, linkIndex);
|
||||
/*The above line doesn't ref the link, and the next call is going to unref*/
|
||||
if (link)
|
||||
g_object_ref (link);
|
||||
return spi_hyperlink_return_reference (message, link);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetLinkIndex (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkHypertext *hypertext = (AtkHypertext *) user_data;
|
||||
dbus_int32_t characterIndex;
|
||||
dbus_int32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_hypertext_get_link_index (hypertext, characterIndex);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetNLinks, "GetNLinks"},
|
||||
{impl_GetLink, "GetLink"},
|
||||
{impl_GetLinkIndex, "GetLinkIndex"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_hypertext (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_HYPERTEXT, spi_org_a11y_atspi_Hypertext, methods, NULL);
|
||||
};
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ImageDescription (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkImage *image = (AtkImage *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
|
||||
return droute_return_v_string (iter,
|
||||
atk_image_get_image_description (image));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ImageLocale (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkImage *image = (AtkImage *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
|
||||
return droute_return_v_string (iter, atk_image_get_image_locale (image));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetImageExtents (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkImage *image = (AtkImage *) user_data;
|
||||
dbus_uint32_t coordType;
|
||||
gint ix, iy, iwidth, iheight;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_IMAGE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_image_get_image_size (image, &iwidth, &iheight);
|
||||
atk_image_get_image_position (image, &ix, &iy, (AtkCoordType) coordType);
|
||||
return spi_dbus_return_rect (message, ix, iy, iwidth, iheight);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetImagePosition (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkImage *image = (AtkImage *) user_data;
|
||||
dbus_uint32_t coord_type;
|
||||
gint ix = 0, iy = 0;
|
||||
dbus_int32_t x, y;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_IMAGE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_image_get_image_position (image, &ix, &iy, (AtkCoordType) coord_type);
|
||||
x = ix;
|
||||
y = iy;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32,
|
||||
&y, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetImageSize (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkImage *image = (AtkImage *) user_data;
|
||||
gint iwidth = 0, iheight = 0;
|
||||
dbus_int32_t width, height;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_IMAGE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
atk_image_get_image_size (image, &iwidth, &iheight);
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &width,
|
||||
DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetImageExtents, "GetImageExtents"},
|
||||
{impl_GetImagePosition, "GetImagePosition"},
|
||||
{impl_GetImageSize, "GetImageSize"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_ImageDescription, NULL, "ImageDescription"},
|
||||
{impl_get_ImageLocale, NULL, "ImageLocale"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_image (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_IMAGE, spi_org_a11y_atspi_Image, methods, properties);
|
||||
};
|
|
@ -0,0 +1,31 @@
|
|||
source = [
|
||||
'accessible-adaptor.c',
|
||||
'action-adaptor.c',
|
||||
'application-adaptor.c',
|
||||
'cache-adaptor.c',
|
||||
'collection-adaptor.c',
|
||||
'component-adaptor.c',
|
||||
'document-adaptor.c',
|
||||
'editabletext-adaptor.c',
|
||||
'hyperlink-adaptor.c',
|
||||
'hypertext-adaptor.c',
|
||||
'image-adaptor.c',
|
||||
'selection-adaptor.c',
|
||||
'socket-adaptor.c',
|
||||
'table-adaptor.c',
|
||||
'table-cell-adaptor.c',
|
||||
'text-adaptor.c',
|
||||
'value-adaptor.c',
|
||||
]
|
||||
|
||||
libatk_bridge_adaptors = static_library('atk-bridge-adaptors', source,
|
||||
include_directories: [
|
||||
root_inc,
|
||||
include_directories('..'),
|
||||
],
|
||||
dependencies: [ libdbus_dep, atspi_dep, atk_dep ],
|
||||
c_args: p2p_cflags)
|
||||
|
||||
libatk_bridge_adaptors_dep = declare_dependency(link_with: libatk_bridge_adaptors,
|
||||
dependencies: [ libdbus_dep, atspi_dep, atk_dep ],
|
||||
include_directories: include_directories('.'))
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NSelectedChildren (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter,
|
||||
atk_selection_get_selection_count
|
||||
(selection));
|
||||
}
|
||||
|
||||
/*static char *
|
||||
impl_get_NSelectedChildren_str (void *datum)
|
||||
{
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data), FALSE);
|
||||
return g_strdup_printf ("%d",
|
||||
atk_selection_get_selection_count ((AtkSelection *)
|
||||
datum));
|
||||
}*/
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetSelectedChild (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
DBusMessage *reply;
|
||||
dbus_int32_t selectedChildIndex;
|
||||
AtkObject *atk_object;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectedChildIndex,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_object = atk_selection_ref_selection (selection, selectedChildIndex);
|
||||
reply = spi_object_return_reference (message, atk_object);
|
||||
if (atk_object)
|
||||
g_object_unref (atk_object);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SelectChild (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_int32_t childIndex;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_selection_add_selection (selection, childIndex);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_DeselectSelectedChild (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_int32_t selectedChildIndex;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectedChildIndex,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_selection_remove_selection (selection, selectedChildIndex);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_IsChildSelected (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_int32_t childIndex;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_selection_is_child_selected (selection, childIndex);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SelectAll (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
rv = atk_selection_select_all_selection (selection);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_ClearSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
rv = atk_selection_clear_selection (selection);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_DeselectChild (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkSelection *selection = (AtkSelection *) user_data;
|
||||
dbus_int32_t selectedChildIndex;
|
||||
dbus_bool_t rv = FALSE;
|
||||
gint i, nselected;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_SELECTION (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectedChildIndex,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
nselected = atk_selection_get_selection_count (selection);
|
||||
for (i = 0; i < nselected; ++i)
|
||||
{
|
||||
AtkObject *selected_obj = atk_selection_ref_selection (selection, i);
|
||||
if (atk_object_get_index_in_parent (selected_obj) == selectedChildIndex)
|
||||
{
|
||||
g_object_unref (G_OBJECT (selected_obj));
|
||||
rv = atk_selection_remove_selection (selection, i);
|
||||
break;
|
||||
}
|
||||
g_object_unref (G_OBJECT (selected_obj));
|
||||
}
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetSelectedChild, "GetSelectedChild"},
|
||||
{impl_SelectChild, "SelectChild"},
|
||||
{impl_DeselectSelectedChild, "DeselectSelectedChild"},
|
||||
{impl_IsChildSelected, "IsChildSelected"},
|
||||
{impl_SelectAll, "SelectAll"},
|
||||
{impl_ClearSelection, "ClearSelection"},
|
||||
{impl_DeselectChild, "DeselectChild"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_NSelectedChildren, NULL, "NSelectedChildren"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_selection (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_SELECTION,
|
||||
spi_org_a11y_atspi_Selection,
|
||||
methods, properties);
|
||||
};
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "accessible-stateset.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
#include "bridge.h"
|
||||
|
||||
static DBusMessage *
|
||||
new_socket_call_message (AtkComponent *component, const char *member)
|
||||
{
|
||||
char *id = g_object_get_data (G_OBJECT (component), "dbus-plug-parent");
|
||||
char *bus_parent;
|
||||
char *path_parent;
|
||||
|
||||
if (!id)
|
||||
{
|
||||
g_warning ("new_socket_call_message: no id");
|
||||
return NULL;
|
||||
}
|
||||
bus_parent = g_strdup (id);
|
||||
if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
|
||||
{
|
||||
DBusMessage *message;
|
||||
*(path_parent++) = '\0';
|
||||
message = dbus_message_new_method_call (bus_parent, path_parent,
|
||||
ATSPI_DBUS_INTERFACE_COMPONENT,
|
||||
member);
|
||||
g_free (bus_parent);
|
||||
return message;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atspi_plug_component_get_extents (AtkComponent *component, gint *x, gint *y,
|
||||
gint *width, gint *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
DBusMessage *message = new_socket_call_message (component, "GetExtents");
|
||||
DBusMessage *reply;
|
||||
dbus_uint32_t coord_type_dbus = coord_type;
|
||||
DBusError error;
|
||||
const char *signature;
|
||||
DBusMessageIter iter, iter_struct;
|
||||
dbus_int32_t tmp;
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_append_args (message, DBUS_TYPE_UINT32, &coord_type_dbus, DBUS_TYPE_INVALID);
|
||||
reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus,
|
||||
message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (!reply)
|
||||
{
|
||||
*x = -1;
|
||||
*y = -1;
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
return;
|
||||
}
|
||||
signature = dbus_message_get_signature (reply);
|
||||
if (g_strcmp0 (signature, "(iiii)") != 0)
|
||||
{
|
||||
g_warning ("Got unexpected signature %s from GetExtents\n", signature);
|
||||
dbus_message_unref (reply);
|
||||
*x = -1;
|
||||
*y = -1;
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
return;
|
||||
}
|
||||
dbus_message_iter_init (reply, &iter);
|
||||
dbus_message_iter_recurse (&iter, &iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &tmp);
|
||||
*x = tmp;
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &tmp);
|
||||
*y = tmp;
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &tmp);
|
||||
*width = tmp;
|
||||
dbus_message_iter_next (&iter_struct);
|
||||
dbus_message_iter_get_basic (&iter_struct, &tmp);
|
||||
*height = tmp;
|
||||
dbus_message_unref (reply);
|
||||
}
|
||||
|
||||
static void
|
||||
atspi_plug_component_get_position (AtkComponent *component, gint *x, gint *y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
DBusMessage *message = new_socket_call_message (component, "GetPosition");
|
||||
DBusMessage *reply;
|
||||
dbus_uint32_t coord_type_dbus = coord_type;
|
||||
DBusError error;
|
||||
dbus_int32_t x_dbus, y_dbus;
|
||||
|
||||
dbus_error_init (&error);
|
||||
dbus_message_append_args (message, DBUS_TYPE_UINT32, &coord_type_dbus, DBUS_TYPE_INVALID);
|
||||
reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus,
|
||||
message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (!reply)
|
||||
{
|
||||
*x = -1;
|
||||
*y = -1;
|
||||
return;
|
||||
}
|
||||
if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_INT32, &x_dbus,
|
||||
DBUS_TYPE_INT32, &y_dbus, DBUS_TYPE_INVALID))
|
||||
{
|
||||
g_warning ("GetPosition failed: %s", error.message);
|
||||
dbus_error_free (&error);
|
||||
*x = -1;
|
||||
*y = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = x_dbus;
|
||||
*y = y_dbus;
|
||||
}
|
||||
dbus_message_unref (reply);
|
||||
}
|
||||
|
||||
static void
|
||||
atspi_plug_component_get_size (AtkComponent *component,
|
||||
gint *width, gint *height)
|
||||
{
|
||||
DBusMessage *message = new_socket_call_message (component, "GetSize");
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
dbus_uint32_t width_dbus, height_dbus;
|
||||
|
||||
dbus_error_init (&error);
|
||||
reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus,
|
||||
message, -1, &error);
|
||||
dbus_message_unref (message);
|
||||
if (!reply)
|
||||
{
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
return;
|
||||
}
|
||||
if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_INT32, &width_dbus,
|
||||
DBUS_TYPE_INT32, &height_dbus, DBUS_TYPE_INVALID))
|
||||
{
|
||||
g_warning ("GetSize failed: %s", error.message);
|
||||
dbus_error_free (&error);
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = width_dbus;
|
||||
*height = height_dbus;
|
||||
}
|
||||
dbus_message_unref (reply);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_Embedded (DBusConnection *bus,
|
||||
DBusMessage *message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkObject *object = (AtkObject *) user_data;
|
||||
char *path;
|
||||
gchar *id;
|
||||
|
||||
if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL);
|
||||
g_object_set_data_full (G_OBJECT (object), "dbus-plug-parent", id, (GDestroyNotify)g_free);
|
||||
|
||||
if (ATK_IS_COMPONENT (object))
|
||||
{
|
||||
AtkComponent *component = ATK_COMPONENT (object);
|
||||
AtkComponentIface *iface = ATK_COMPONENT_GET_IFACE (component);
|
||||
iface->get_extents = atspi_plug_component_get_extents;
|
||||
iface->get_size = atspi_plug_component_get_size;
|
||||
iface->get_position = atspi_plug_component_get_position;
|
||||
}
|
||||
|
||||
/* Retrieve some info about the children, if they exist, when
|
||||
embedding the plug to ensure the a11y subtree is generated.
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=663876 */
|
||||
atk_object_get_n_accessible_children (object);
|
||||
|
||||
return dbus_message_new_method_return (message);
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_Embedded, "Embedded"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_socket (DRoutePath * path)
|
||||
{
|
||||
droute_path_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_SOCKET,
|
||||
NULL, /* spi_org_a11y_atspi_Socket, */
|
||||
methods, NULL);
|
||||
};
|
|
@ -0,0 +1,331 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) *
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* streamablecontent.c : implements the StreamableContent interface */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <libspi/component.h>
|
||||
#include <libspi/streamablecontent.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Our parent Gtk object type */
|
||||
#define PARENT_TYPE SPI_TYPE_BASE
|
||||
|
||||
/* A pointer to our parent object class */
|
||||
static GObjectClass *spi_streamable_parent_class;
|
||||
|
||||
#define SPI_CONTENT_STREAM_TYPE (spi_content_stream_get_type ())
|
||||
#define SPI_CONTENT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_CONTENT_STREAM_TYPE, SpiContentStream))
|
||||
#define SPI_CONTENT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_CONTENT_STREAM_TYPE, SpiContentStreamClass))
|
||||
#define SPI_IS_CONTENT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPI_CONTENT_STREAM_TYPE))
|
||||
#define SPI_IS_CONTENT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_CONTENT_STREAM_TYPE))
|
||||
|
||||
typedef struct _SpiContentStream SpiContentStream;
|
||||
typedef struct _SpiContentStreamClass SpiContentStreamClass;
|
||||
|
||||
struct _SpiContentStream
|
||||
{
|
||||
BonoboObject parent;
|
||||
GIOChannel *gio;
|
||||
};
|
||||
|
||||
struct _SpiContentStreamClass
|
||||
{
|
||||
BonoboObjectClass parent_class;
|
||||
POA_Accessibility_ContentStream__epv epv;
|
||||
};
|
||||
|
||||
GType spi_content_stream_get_type (void);
|
||||
|
||||
static SpiContentStream *
|
||||
spi_content_stream_new (GIOChannel * gio)
|
||||
{
|
||||
SpiContentStream *new_stream = g_object_new (SPI_CONTENT_STREAM_TYPE, NULL);
|
||||
new_stream->gio = gio;
|
||||
return new_stream;
|
||||
}
|
||||
|
||||
static void
|
||||
spi_content_stream_dispose (GObject * o)
|
||||
{
|
||||
if (SPI_IS_CONTENT_STREAM (o))
|
||||
{
|
||||
SpiContentStream *stream = SPI_CONTENT_STREAM (o);
|
||||
if (stream->gio)
|
||||
g_io_channel_unref (stream->gio);
|
||||
}
|
||||
}
|
||||
|
||||
static CORBA_long
|
||||
impl_content_stream_seek (PortableServer_Servant servant,
|
||||
const CORBA_long offset,
|
||||
const Accessibility_ContentStream_SeekType whence,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
SpiContentStream *stream =
|
||||
SPI_CONTENT_STREAM (bonobo_object_from_servant (servant));
|
||||
if (stream && stream->gio)
|
||||
{
|
||||
GError *err;
|
||||
GSeekType seektype = G_SEEK_SET;
|
||||
switch (whence)
|
||||
{
|
||||
case Accessibility_ContentStream_SEEK_CURRENT:
|
||||
seektype = G_SEEK_CUR;
|
||||
break;
|
||||
case Accessibility_ContentStream_SEEK_END:
|
||||
seektype = G_SEEK_END;
|
||||
break;
|
||||
}
|
||||
if (g_io_channel_seek_position (stream->gio, (gint64) offset,
|
||||
seektype, &err) == G_IO_STATUS_NORMAL)
|
||||
return offset;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static CORBA_long
|
||||
impl_content_stream_read (PortableServer_Servant servant,
|
||||
const CORBA_long count,
|
||||
Accessibility_ContentStream_iobuf ** buffer,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
SpiContentStream *stream =
|
||||
SPI_CONTENT_STREAM (bonobo_object_from_servant (servant));
|
||||
CORBA_long realcount = 0;
|
||||
|
||||
if (stream && stream->gio)
|
||||
{
|
||||
gchar *gbuf = NULL;
|
||||
GIOStatus status;
|
||||
GError *err = NULL;
|
||||
|
||||
/* read the giochannel and determine the actual bytes read... */
|
||||
if (count != -1)
|
||||
{
|
||||
gbuf = g_malloc (count + 1);
|
||||
status =
|
||||
g_io_channel_read_chars (stream->gio, gbuf, count, &realcount,
|
||||
&err);
|
||||
}
|
||||
else
|
||||
status =
|
||||
g_io_channel_read_to_end (stream->gio, &gbuf, &realcount, &err);
|
||||
|
||||
if (status == G_IO_STATUS_NORMAL || status == G_IO_STATUS_EOF)
|
||||
{
|
||||
*buffer = Bonobo_Stream_iobuf__alloc ();
|
||||
CORBA_sequence_set_release (*buffer, TRUE);
|
||||
|
||||
(*buffer)->_buffer =
|
||||
CORBA_sequence_CORBA_octet_allocbuf (realcount);
|
||||
(*buffer)->_length = realcount;
|
||||
|
||||
g_memmove ((*buffer)->_buffer, gbuf, realcount);
|
||||
}
|
||||
|
||||
g_free (gbuf);
|
||||
}
|
||||
|
||||
return realcount;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_content_stream_close (PortableServer_Servant servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
GIOStatus status;
|
||||
GError *err;
|
||||
SpiContentStream *stream =
|
||||
SPI_CONTENT_STREAM (bonobo_object_from_servant (servant));
|
||||
if (stream && stream->gio)
|
||||
{
|
||||
status = g_io_channel_shutdown (stream->gio, TRUE, &err);
|
||||
g_io_channel_unref (stream->gio);
|
||||
}
|
||||
if (err)
|
||||
g_free (err);
|
||||
}
|
||||
|
||||
static void
|
||||
spi_content_stream_class_init (SpiContentStreamClass * klass)
|
||||
{
|
||||
POA_Accessibility_ContentStream__epv *epv = &klass->epv;
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
epv->seek = impl_content_stream_seek;
|
||||
epv->read = impl_content_stream_read;
|
||||
epv->close = impl_content_stream_close;
|
||||
|
||||
object_class->dispose = spi_content_stream_dispose;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
spi_content_stream_init (SpiContentStream * stream)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BONOBO_TYPE_FUNC_FULL (SpiContentStream,
|
||||
Accessibility_ContentStream,
|
||||
BONOBO_TYPE_OBJECT, spi_content_stream)
|
||||
static AtkStreamableContent
|
||||
*get_streamable_from_servant (PortableServer_Servant servant)
|
||||
{
|
||||
SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (object->gobj), NULL);
|
||||
return ATK_STREAMABLE_CONTENT (object->gobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* CORBA Accessibility::StreamableContent::getContentTypes method implementation
|
||||
*/
|
||||
static Accessibility_StringSeq *
|
||||
impl_accessibility_streamable_get_content_types (PortableServer_Servant
|
||||
servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
Accessibility_StringSeq *typelist = Accessibility_StringSeq__alloc ();
|
||||
AtkStreamableContent *streamable = get_streamable_from_servant (servant);
|
||||
int n_types, i;
|
||||
|
||||
typelist->_length = typelist->_maximum = 0;
|
||||
|
||||
g_return_val_if_fail (streamable != NULL, typelist);
|
||||
|
||||
n_types = atk_streamable_content_get_n_mime_types (streamable);
|
||||
|
||||
if (n_types)
|
||||
{
|
||||
typelist->_length = typelist->_maximum = n_types;
|
||||
typelist->_buffer = Accessibility_StringSeq_allocbuf (n_types);
|
||||
for (i = 0; i < n_types; ++i)
|
||||
{
|
||||
const gchar *mimetype =
|
||||
atk_streamable_content_get_mime_type (streamable, i);
|
||||
typelist->_buffer[i] = CORBA_string_dup (mimetype ? mimetype : "");
|
||||
}
|
||||
}
|
||||
return typelist;
|
||||
}
|
||||
|
||||
/*
|
||||
* CORBA Accessibility::StreamableContent::getContent method implementation
|
||||
*/
|
||||
static Bonobo_Stream
|
||||
impl_accessibility_streamable_get_content (PortableServer_Servant servant,
|
||||
const CORBA_char * content_type,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
Bonobo_Stream stream;
|
||||
AtkStreamableContent *streamable = get_streamable_from_servant (servant);
|
||||
GIOChannel *gio;
|
||||
|
||||
g_return_val_if_fail (streamable != NULL, NULL);
|
||||
|
||||
gio = atk_streamable_content_get_stream (streamable, content_type);
|
||||
|
||||
stream = CORBA_OBJECT_NIL; /* deprecated,
|
||||
* and it was never implemented,
|
||||
* so don't bother fixing this
|
||||
*/
|
||||
return stream;
|
||||
}
|
||||
|
||||
/*
|
||||
* CORBA Accessibility::StreamableContent::getStream method implementation
|
||||
*/
|
||||
static Accessibility_ContentStream
|
||||
impl_accessibility_streamable_get_stream (PortableServer_Servant servant,
|
||||
const CORBA_char * content_type,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
SpiContentStream *stream;
|
||||
AtkStreamableContent *streamable = get_streamable_from_servant (servant);
|
||||
GIOChannel *gio;
|
||||
|
||||
g_return_val_if_fail (streamable != NULL, NULL);
|
||||
|
||||
gio = atk_streamable_content_get_stream (streamable, content_type);
|
||||
|
||||
stream = spi_content_stream_new (gio);
|
||||
|
||||
return bonobo_object_dup_ref (BONOBO_OBJREF (stream), ev);
|
||||
}
|
||||
|
||||
/*
|
||||
* CORBA Accessibility::StreamableContent::GetURI method implementation
|
||||
*/
|
||||
static CORBA_string
|
||||
impl_accessibility_streamable_get_uri (PortableServer_Servant servant,
|
||||
const CORBA_char * content_type,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gchar *uri;
|
||||
AtkStreamableContent *streamable = get_streamable_from_servant (servant);
|
||||
|
||||
g_return_val_if_fail (streamable != NULL, NULL);
|
||||
|
||||
uri = atk_streamable_content_get_uri (streamable, content_type);
|
||||
|
||||
return (uri != NULL ? CORBA_string_dup (uri) : CORBA_string_dup (""));
|
||||
}
|
||||
|
||||
static void
|
||||
spi_streamable_class_init (SpiStreamableClass * klass)
|
||||
{
|
||||
POA_Accessibility_StreamableContent__epv *epv = &klass->epv;
|
||||
spi_streamable_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
epv->getContentTypes = impl_accessibility_streamable_get_content_types;
|
||||
epv->getContent = impl_accessibility_streamable_get_content;
|
||||
epv->getStream = impl_accessibility_streamable_get_stream;
|
||||
epv->GetURI = impl_accessibility_streamable_get_uri;
|
||||
}
|
||||
|
||||
static void
|
||||
spi_streamable_init (SpiStreamable * streamable)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SpiStreamable *
|
||||
spi_streamable_interface_new (AtkObject * o)
|
||||
{
|
||||
SpiStreamable *retval = g_object_new (SPI_STREAMABLE_TYPE, NULL);
|
||||
|
||||
spi_base_construct (SPI_BASE (retval), G_OBJECT (o));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
BONOBO_TYPE_FUNC_FULL (SpiStreamable,
|
||||
Accessibility_StreamableContent,
|
||||
PARENT_TYPE, spi_streamable)
|
|
@ -0,0 +1,673 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NRows (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_table_get_n_rows (table));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NColumns (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_table_get_n_columns (table));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Caption (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
spi_object_append_v_reference (iter, atk_table_get_caption (table));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Summary (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
spi_object_append_v_reference (iter, atk_table_get_summary (table));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NSelectedRows (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
gint *selected_rows = NULL;
|
||||
int count;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
count = atk_table_get_selected_rows (table, &selected_rows);
|
||||
if (selected_rows)
|
||||
g_free (selected_rows);
|
||||
return droute_return_v_int32 (iter, count);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_NSelectedColumns (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
gint *selected_columns = NULL;
|
||||
int count;
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
|
||||
count = atk_table_get_selected_columns (table, &selected_columns);
|
||||
if (selected_columns)
|
||||
g_free (selected_columns);
|
||||
return droute_return_v_int32 (iter, count);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row, column;
|
||||
DBusMessage *reply;
|
||||
AtkObject *obj;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
obj = atk_table_ref_at (table, row, column);
|
||||
reply = spi_object_return_reference (message, obj);
|
||||
if (obj)
|
||||
g_object_unref (obj);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetIndexAt (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row, column;
|
||||
dbus_int32_t index;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
index = atk_table_get_index_at (table, row, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &index,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowAtIndex (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t index;
|
||||
dbus_int32_t row;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
row = atk_table_get_row_at_index (table, index);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &row,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetColumnAtIndex (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t index;
|
||||
dbus_int32_t column;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
column = atk_table_get_column_at_index (table, index);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
validate_unallocated_string (const gchar *str)
|
||||
{
|
||||
if (!str)
|
||||
return "";
|
||||
if (!g_utf8_validate (str, -1, NULL))
|
||||
{
|
||||
g_warning ("atk-bridge: received bad UTF-8 string from a table function");
|
||||
return "";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowDescription (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
dbus_int32_t row;
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
const gchar *description;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
description = atk_table_get_row_description (table, row);
|
||||
description = validate_unallocated_string (description);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &description,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetColumnDescription (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t column;
|
||||
const char *description;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
description = atk_table_get_column_description (table, column);
|
||||
description = validate_unallocated_string (description);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &description,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowExtentAt (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row, column;
|
||||
dbus_int32_t extent;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
extent = atk_table_get_row_extent_at (table, row, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetColumnExtentAt (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row, column;
|
||||
dbus_int32_t extent;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
extent = atk_table_get_column_extent_at (table, row, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowHeader (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row;
|
||||
AtkObject *obj = NULL;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
obj = atk_table_get_row_header (table, row);
|
||||
return spi_object_return_reference (message, obj);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetColumnHeader (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t column;
|
||||
AtkObject *obj;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
obj = atk_table_get_column_header (table, column);
|
||||
return spi_object_return_reference (message, obj);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetSelectedRows (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
gint *selected_rows = NULL;
|
||||
gint count;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
count = atk_table_get_selected_rows (table, &selected_rows);
|
||||
if (!selected_rows)
|
||||
count = 0;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
/* tbd - figure out if this is safe for a 0-length array */
|
||||
dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
|
||||
&selected_rows, count, DBUS_TYPE_INVALID);
|
||||
}
|
||||
if (selected_rows)
|
||||
g_free (selected_rows);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetSelectedColumns (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
gint *selected_columns = NULL;
|
||||
gint count;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
count = atk_table_get_selected_columns (table, &selected_columns);
|
||||
if (!selected_columns)
|
||||
count = 0;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
/* tbd - figure out if this is safe for a 0-length array */
|
||||
dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
|
||||
&selected_columns, count, DBUS_TYPE_INVALID);
|
||||
}
|
||||
if (selected_columns)
|
||||
g_free (selected_columns);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_IsRowSelected (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_is_row_selected (table, row);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_IsColumnSelected (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t column;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_is_column_selected (table, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_IsSelected (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row, column;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_is_selected (table, row, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_AddRowSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_add_row_selection (table, row);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_AddColumnSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t column;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_add_column_selection (table, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_RemoveRowSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t row;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_remove_row_selection (table, row);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_RemoveColumnSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t column;
|
||||
DBusMessage *reply;
|
||||
dbus_bool_t ret;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ret = atk_table_remove_column_selection (table, column);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTable *table = (AtkTable *) user_data;
|
||||
dbus_int32_t index;
|
||||
dbus_int32_t row, column, row_extents, col_extents;
|
||||
dbus_bool_t is_selected;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply;
|
||||
AtkObject *cell;
|
||||
AtkRole role = ATK_ROLE_INVALID;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
column = atk_table_get_column_at_index (table, index);
|
||||
row = atk_table_get_row_at_index (table, index);
|
||||
row_extents = atk_table_get_row_extent_at (table, row, column);
|
||||
col_extents = atk_table_get_column_extent_at (table, row, column);
|
||||
is_selected = atk_table_is_selected (table, row, column);
|
||||
cell = atk_table_ref_at (table, row, column);
|
||||
if (cell)
|
||||
{
|
||||
role = atk_object_get_role (cell);
|
||||
g_object_unref (cell);
|
||||
}
|
||||
ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32,
|
||||
&column, DBUS_TYPE_INT32, &row_extents,
|
||||
DBUS_TYPE_INT32, &col_extents,
|
||||
DBUS_TYPE_BOOLEAN, &is_selected,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetAccessibleAt, "GetAccessibleAt"},
|
||||
{impl_GetIndexAt, "GetIndexAt"},
|
||||
{impl_GetRowAtIndex, "GetRowAtIndex"},
|
||||
{impl_GetColumnAtIndex, "GetColumnAtIndex"},
|
||||
{impl_GetRowDescription, "GetRowDescription"},
|
||||
{impl_GetColumnDescription, "GetColumnDescription"},
|
||||
{impl_GetRowExtentAt, "GetRowExtentAt"},
|
||||
{impl_GetColumnExtentAt, "GetColumnExtentAt"},
|
||||
{impl_GetRowHeader, "GetRowHeader"},
|
||||
{impl_GetColumnHeader, "GetColumnHeader"},
|
||||
{impl_GetSelectedRows, "GetSelectedRows"},
|
||||
{impl_GetSelectedColumns, "GetSelectedColumns"},
|
||||
{impl_IsRowSelected, "IsRowSelected"},
|
||||
{impl_IsColumnSelected, "IsColumnSelected"},
|
||||
{impl_IsSelected, "IsSelected"},
|
||||
{impl_AddRowSelection, "AddRowSelection"},
|
||||
{impl_AddColumnSelection, "AddColumnSelection"},
|
||||
{impl_RemoveRowSelection, "RemoveRowSelection"},
|
||||
{impl_RemoveColumnSelection, "RemoveColumnSelection"},
|
||||
{impl_GetRowColumnExtentsAtIndex, "GetRowColumnExtentsAtIndex"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_NRows, NULL, "NRows"},
|
||||
{impl_get_NColumns, NULL, "NColumns"},
|
||||
{impl_get_Caption, NULL, "Caption"},
|
||||
{impl_get_Summary, NULL, "Summary"},
|
||||
{impl_get_NSelectedRows, NULL, "NSelectedRows"},
|
||||
{impl_get_NSelectedColumns, NULL, "NSelectedColumns"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_table (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_TABLE, spi_org_a11y_atspi_Table, methods, properties);
|
||||
};
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2013 SUSE LLC.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_ColumnSpan (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = (AtkTableCell *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_table_cell_get_column_span (cell));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
message_from_object_array (DBusMessage *message, GPtrArray *array)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter, iter_array;
|
||||
gint len;
|
||||
gint i;
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "(so)", &iter_array))
|
||||
return reply; /* TODO: handle out of memory */
|
||||
len = (array? array->len: 0);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
spi_object_append_reference (&iter_array, g_ptr_array_index (array, i));
|
||||
}
|
||||
dbus_message_iter_close_container (&iter, &iter_array);
|
||||
g_ptr_array_unref (array);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetColumnHeaderCells (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = user_data;
|
||||
GPtrArray *array;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
array = atk_table_cell_get_column_header_cells (cell);
|
||||
return message_from_object_array (message, array);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_RowSpan (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = (AtkTableCell *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_table_cell_get_row_span (cell));
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowHeaderCells (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = user_data;
|
||||
GPtrArray *array;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
array = atk_table_cell_get_row_header_cells (cell);
|
||||
return message_from_object_array (message, array);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Position (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = (AtkTableCell *) user_data;
|
||||
gint row = -1, column = -1;
|
||||
DBusMessageIter iter_struct, iter_variant;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data), FALSE);
|
||||
if (!atk_table_cell_get_position (cell, &row, &column))
|
||||
return FALSE;
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(ii)", &iter_variant);
|
||||
dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL, &iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, (dbus_int32_t *) &row);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, (dbus_int32_t *) &column);
|
||||
dbus_message_iter_close_container (&iter_variant, &iter_struct);
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_Table (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = (AtkTableCell *) user_data;
|
||||
AtkObject *table;
|
||||
DBusMessageIter iter_variant;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data), FALSE);
|
||||
|
||||
table = atk_table_cell_get_table (cell);
|
||||
if (!table)
|
||||
return FALSE;
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(so)", &iter_variant);
|
||||
spi_object_append_reference (&iter_variant, table);
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRowColumnSpan (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkTableCell *cell = (AtkTableCell *) user_data;
|
||||
gint row, column, row_span, column_span;
|
||||
dbus_int32_t d_row, d_column, d_row_span, d_column_span;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TABLE_CELL (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
atk_table_cell_get_row_column_span (cell, &row, &column, &row_span,
|
||||
&column_span);
|
||||
d_row = row;
|
||||
d_column = column;
|
||||
d_row_span = row_span;
|
||||
d_column_span = column_span;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &d_row, DBUS_TYPE_INT32,
|
||||
&d_column, DBUS_TYPE_INT32, &d_row_span,
|
||||
DBUS_TYPE_INT32, &d_column_span,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetRowHeaderCells, "GetRowHeaderCells"},
|
||||
{impl_GetColumnHeaderCells, "GetColumnHeaderCells"},
|
||||
{impl_GetRowColumnSpan, "GetRowColumnSpan"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_ColumnSpan, NULL, "ColumnSpan"},
|
||||
{impl_get_Position, NULL, "Position"},
|
||||
{impl_get_RowSpan, NULL, "RowSpan"},
|
||||
{impl_get_Table, NULL, "Table"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_table_cell (DRoutePath * path)
|
||||
{
|
||||
droute_path_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_TABLE_CELL,
|
||||
spi_org_a11y_atspi_TableCell,
|
||||
methods, properties);
|
||||
};
|
|
@ -0,0 +1,955 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "object.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_CharacterCount (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_text_get_character_count (text));
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_CaretOffset (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
|
||||
return droute_return_v_int32 (iter, atk_text_get_caret_offset (text));
|
||||
}
|
||||
|
||||
static gchar *
|
||||
validate_allocated_string (gchar *str)
|
||||
{
|
||||
if (!str)
|
||||
return g_strdup ("");
|
||||
if (!g_utf8_validate (str, -1, NULL))
|
||||
{
|
||||
g_warning ("atk-bridge: received bad UTF-8 string from a get_text function");
|
||||
g_free (str);
|
||||
return g_strdup ("");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetText (DBusConnection * bus, DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gchar *txt;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
|
||||
&endOffset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
txt = atk_text_get_text (text, startOffset, endOffset);
|
||||
txt = validate_allocated_string (txt);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (txt);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetCaretOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_text_set_caret_offset (text, offset);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetTextBeforeOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_uint32_t type;
|
||||
gchar *txt;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
txt =
|
||||
atk_text_get_text_before_offset (text, offset, (AtkTextBoundary) type,
|
||||
&intstart_offset, &intend_offset);
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
txt = validate_allocated_string (txt);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt,
|
||||
DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (txt);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetTextAtOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset, type;
|
||||
gchar *txt;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
txt =
|
||||
atk_text_get_text_at_offset (text, offset, (AtkTextBoundary) type,
|
||||
&intstart_offset, &intend_offset);
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
txt = validate_allocated_string (txt);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt,
|
||||
DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (txt);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetTextAfterOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_uint32_t type;
|
||||
gchar *txt;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
txt =
|
||||
atk_text_get_text_after_offset (text, offset, (AtkTextBoundary) type,
|
||||
&intstart_offset, &intend_offset);
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
txt = validate_allocated_string (txt);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt,
|
||||
DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (txt);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetCharacterAtOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_int32_t ch;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
ch = atk_text_get_character_at_offset (text, offset);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &ch,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_text_for_legacy_implementations(AtkText *text,
|
||||
gint offset,
|
||||
AtkTextGranularity granularity,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
gchar *txt = 0;
|
||||
AtkTextBoundary boundary = 0;
|
||||
switch (granularity) {
|
||||
case ATK_TEXT_GRANULARITY_CHAR:
|
||||
boundary = ATK_TEXT_BOUNDARY_CHAR;
|
||||
break;
|
||||
|
||||
case ATK_TEXT_GRANULARITY_WORD:
|
||||
boundary = ATK_TEXT_BOUNDARY_WORD_START;
|
||||
break;
|
||||
|
||||
case ATK_TEXT_GRANULARITY_SENTENCE:
|
||||
boundary = ATK_TEXT_BOUNDARY_SENTENCE_START;
|
||||
break;
|
||||
|
||||
case ATK_TEXT_GRANULARITY_LINE:
|
||||
boundary = ATK_TEXT_BOUNDARY_LINE_START;
|
||||
break;
|
||||
|
||||
case ATK_TEXT_GRANULARITY_PARAGRAPH:
|
||||
/* This is not implemented in previous versions of ATK */
|
||||
txt = g_strdup("");
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if (!txt)
|
||||
{
|
||||
txt =
|
||||
atk_text_get_text_at_offset (text, offset, boundary,
|
||||
start_offset, end_offset);
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetStringAtOffset (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_uint32_t granularity;
|
||||
gchar *txt = 0;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &granularity,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
txt =
|
||||
atk_text_get_string_at_offset (text, offset, (AtkTextGranularity) granularity,
|
||||
&intstart_offset, &intend_offset);
|
||||
|
||||
/* Accessibility layers implementing an older version of ATK (even if
|
||||
* a new enough version of libatk is installed) might return NULL due
|
||||
* not to provide an implementation for get_string_at_offset(), so we
|
||||
* try with the legacy implementation if that's the case. */
|
||||
if (!txt)
|
||||
txt = get_text_for_legacy_implementations(text, offset,
|
||||
(AtkTextGranularity) granularity,
|
||||
&intstart_offset, &intend_offset);
|
||||
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
txt = validate_allocated_string (txt);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &txt,
|
||||
DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
g_free (txt);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributeValue (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
char *attributeName;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
char *rv = NULL;
|
||||
DBusMessage *reply;
|
||||
AtkAttributeSet *set;
|
||||
GSList *cur_attr;
|
||||
AtkAttribute *at;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_STRING,
|
||||
&attributeName, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
set = atk_text_get_run_attributes (text, offset,
|
||||
&intstart_offset, &intend_offset);
|
||||
cur_attr = (GSList *) set;
|
||||
while (cur_attr)
|
||||
{
|
||||
at = (AtkAttribute *) cur_attr->data;
|
||||
if (!strcmp (at->name, attributeName))
|
||||
{
|
||||
rv = at->value;
|
||||
break;
|
||||
}
|
||||
cur_attr = cur_attr->next;
|
||||
}
|
||||
if (!rv)
|
||||
rv = "";
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &rv, DBUS_TYPE_INVALID);
|
||||
}
|
||||
atk_attribute_set_free (set);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributes (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset, intend_offset;
|
||||
DBusMessage *reply;
|
||||
AtkAttributeSet *set;
|
||||
DBusMessageIter iter;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
set = atk_text_get_run_attributes (text, offset,
|
||||
&intstart_offset, &intend_offset);
|
||||
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, set);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
atk_attribute_set_free (set);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetDefaultAttributes (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
DBusMessage *reply;
|
||||
AtkAttributeSet *set;
|
||||
DBusMessageIter iter;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
set = atk_text_get_default_attributes (text);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, set);
|
||||
}
|
||||
atk_attribute_set_free (set);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetCharacterExtents (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_uint32_t coordType;
|
||||
dbus_int32_t x, y, width, height;
|
||||
gint ix = 0, iy = 0, iw = 0, ih = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32,
|
||||
&coordType, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
atk_text_get_character_extents (text, offset, &ix, &iy, &iw, &ih,
|
||||
(AtkCoordType) coordType);
|
||||
x = ix;
|
||||
y = iy;
|
||||
width = iw;
|
||||
height = ih;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32,
|
||||
&y, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32,
|
||||
&height, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t x, y;
|
||||
dbus_uint32_t coordType;
|
||||
dbus_int32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_text_get_offset_at_point (text, x, y, coordType);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetNSelections (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
rv = atk_text_get_n_selections (text);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t selectionNum;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
/* atk_text_get_selection returns gchar * which we discard */
|
||||
g_free (atk_text_get_selection
|
||||
(text, selectionNum, &intstart_offset, &intend_offset));
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_AddSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
|
||||
&endOffset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_text_add_selection (text, startOffset, endOffset);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_RemoveSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t selectionNum;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_text_remove_selection (text, selectionNum);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_SetSelection (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t selectionNum, startOffset, endOffset;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INT32,
|
||||
&startOffset, DBUS_TYPE_INT32, &endOffset, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rv = atk_text_set_selection (text, selectionNum, startOffset, endOffset);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetRangeExtents (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
dbus_uint32_t coordType;
|
||||
AtkTextRectangle rect;
|
||||
dbus_int32_t x, y, width, height;
|
||||
DBusMessage *reply;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
|
||||
&endOffset, DBUS_TYPE_UINT32, &coordType, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
memset (&rect, 0, sizeof (rect));
|
||||
atk_text_get_range_extents (text, startOffset, endOffset,
|
||||
(AtkCoordType) coordType, &rect);
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
width = rect.width;
|
||||
height = rect.height;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32,
|
||||
&y, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32,
|
||||
&height, DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
#define MAXRANGELEN 512
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetBoundedRanges (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t x, y, width, height;
|
||||
dbus_uint32_t coordType, xClipType, yClipType;
|
||||
AtkTextRange **range_list = NULL;
|
||||
AtkTextRectangle rect;
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter, array, struc, variant;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_INT32, &height, DBUS_TYPE_INT32, &width, DBUS_TYPE_UINT32,
|
||||
&coordType, DBUS_TYPE_UINT32, &xClipType, DBUS_TYPE_UINT32, &yClipType,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = width;
|
||||
rect.height = height;
|
||||
|
||||
range_list =
|
||||
atk_text_get_bounded_ranges (text, &rect, (AtkCoordType) coordType,
|
||||
(AtkTextClipType) xClipType,
|
||||
(AtkTextClipType) yClipType);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
/* This isn't pleasant. */
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "(iisv)", &array))
|
||||
{
|
||||
int len;
|
||||
int count = (range_list ? MAXRANGELEN : 0);
|
||||
for (len = 0; len < count && range_list[len]; ++len)
|
||||
{
|
||||
if (dbus_message_iter_open_container
|
||||
(&array, DBUS_TYPE_STRUCT, NULL, &struc))
|
||||
{
|
||||
dbus_int32_t val;
|
||||
val = range_list[len]->start_offset;
|
||||
dbus_message_iter_append_basic (&struc, DBUS_TYPE_INT32, &val);
|
||||
val = range_list[len]->end_offset;
|
||||
dbus_message_iter_append_basic (&struc, DBUS_TYPE_INT32, &val);
|
||||
dbus_message_iter_append_basic (&struc, DBUS_TYPE_STRING,
|
||||
&range_list[len]->content);
|
||||
/* The variant is unimplemented in atk, but I don't want to
|
||||
* unilaterally muck with the spec and remove it, so I'll just
|
||||
* throw in a dummy value */
|
||||
if (dbus_message_iter_open_container
|
||||
(&struc, DBUS_TYPE_VARIANT, "i", &variant))
|
||||
{
|
||||
dbus_uint32_t dummy = 0;
|
||||
dbus_message_iter_append_basic (&variant, DBUS_TYPE_INT32,
|
||||
&dummy);
|
||||
dbus_message_iter_close_container (&struc, &variant);
|
||||
}
|
||||
dbus_message_iter_close_container (&array, &struc);
|
||||
g_free (range_list[len]->content);
|
||||
g_free (range_list[len]);
|
||||
}
|
||||
}
|
||||
dbus_message_iter_close_container (&iter, &array);
|
||||
}
|
||||
|
||||
if (range_list)
|
||||
g_free (range_list);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetAttributeRun (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t offset;
|
||||
dbus_bool_t includeDefaults;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
gint intstart_offset = 0, intend_offset = 0;
|
||||
DBusMessage *reply;
|
||||
AtkAttributeSet *attributes = NULL;
|
||||
DBusMessageIter iter;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &offset, DBUS_TYPE_BOOLEAN,
|
||||
&includeDefaults, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
if (includeDefaults)
|
||||
{
|
||||
attributes = g_slist_concat (attributes,
|
||||
atk_text_get_default_attributes (text));
|
||||
}
|
||||
|
||||
attributes = g_slist_concat (attributes,
|
||||
atk_text_get_run_attributes (text, offset,
|
||||
&intstart_offset,
|
||||
&intend_offset));
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, attributes);
|
||||
|
||||
startOffset = intstart_offset;
|
||||
endOffset = intend_offset;
|
||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &startOffset);
|
||||
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &endOffset);
|
||||
|
||||
atk_attribute_set_free (attributes);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_GetDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusMessageIter iter;
|
||||
AtkAttributeSet *attributes;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
attributes = atk_text_get_default_attributes (text);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_attribute_set (&iter, attributes);
|
||||
}
|
||||
|
||||
if (attributes)
|
||||
atk_attribute_set_free (attributes);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_ScrollSubstringTo (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
dbus_uint32_t type;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_text_scroll_substring_to (text, startOffset, endOffset, type);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_ScrollSubstringToPoint (DBusConnection * bus,
|
||||
DBusMessage * message, void *user_data)
|
||||
{
|
||||
AtkText *text = (AtkText *) user_data;
|
||||
dbus_int32_t startOffset, endOffset;
|
||||
dbus_uint32_t type;
|
||||
dbus_int32_t x, y;
|
||||
dbus_bool_t ret;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_TEXT (user_data),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_INT32, &startOffset,
|
||||
DBUS_TYPE_INT32, &endOffset,
|
||||
DBUS_TYPE_UINT32, &type,
|
||||
DBUS_TYPE_INT32, &x,
|
||||
DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
ret = atk_text_scroll_substring_to_point (text, startOffset, endOffset, type, x, y);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_GetText, "GetText"},
|
||||
{impl_SetCaretOffset, "SetCaretOffset"},
|
||||
{impl_GetTextBeforeOffset, "GetTextBeforeOffset"},
|
||||
{impl_GetTextAtOffset, "GetTextAtOffset"},
|
||||
{impl_GetTextAfterOffset, "GetTextAfterOffset"},
|
||||
{impl_GetStringAtOffset, "GetStringAtOffset"},
|
||||
{impl_GetCharacterAtOffset, "GetCharacterAtOffset"},
|
||||
{impl_GetAttributeValue, "GetAttributeValue"},
|
||||
{impl_GetAttributes, "GetAttributes"},
|
||||
{impl_GetDefaultAttributes, "GetDefaultAttributes"},
|
||||
{impl_GetCharacterExtents, "GetCharacterExtents"},
|
||||
{impl_GetOffsetAtPoint, "GetOffsetAtPoint"},
|
||||
{impl_GetNSelections, "GetNSelections"},
|
||||
{impl_GetSelection, "GetSelection"},
|
||||
{impl_AddSelection, "AddSelection"},
|
||||
{impl_RemoveSelection, "RemoveSelection"},
|
||||
{impl_SetSelection, "SetSelection"},
|
||||
{impl_GetRangeExtents, "GetRangeExtents"},
|
||||
{impl_GetBoundedRanges, "GetBoundedRanges"},
|
||||
{impl_GetAttributeRun, "GetAttributeRun"},
|
||||
{impl_GetDefaultAttributeSet, "GetDefaultAttributeSet"},
|
||||
{impl_ScrollSubstringTo, "ScrollSubstringTo"},
|
||||
{impl_ScrollSubstringToPoint, "ScrollSubstringToPoint"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_CharacterCount, NULL, "CharacterCount"},
|
||||
{impl_get_CaretOffset, NULL, "CaretOffset"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_text (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_TEXT, spi_org_a11y_atspi_Text, methods, properties);
|
||||
};
|
|
@ -0,0 +1,248 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
#include "bridge.h"
|
||||
|
||||
#include "spi-dbus.h"
|
||||
#include "introspection.h"
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_MinimumValue (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
GValue src = { 0 };
|
||||
GValue dest = { 0 };
|
||||
gdouble dub;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
|
||||
AtkValueIface *iface = ATK_VALUE_GET_IFACE (value);
|
||||
if (iface->get_range)
|
||||
{
|
||||
AtkRange *range = atk_value_get_range (value);
|
||||
dub = atk_range_get_lower_limit (range);
|
||||
atk_range_free (range);
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
g_value_init (&src, G_TYPE_DOUBLE);
|
||||
atk_value_get_minimum_value (value, &src);
|
||||
g_value_init (&dest, G_TYPE_DOUBLE);
|
||||
|
||||
if (g_value_transform (&src, &dest))
|
||||
{
|
||||
dub = g_value_get_double (&dest);
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_MaximumValue (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
GValue src = { 0 };
|
||||
GValue dest = { 0 };
|
||||
gdouble dub = 0;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
|
||||
|
||||
AtkValueIface *iface = ATK_VALUE_GET_IFACE (value);
|
||||
if (iface->get_range)
|
||||
{
|
||||
AtkRange *range = atk_value_get_range (value);
|
||||
dub = atk_range_get_upper_limit (range);
|
||||
atk_range_free (range);
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
g_value_init (&src, G_TYPE_DOUBLE);
|
||||
atk_value_get_maximum_value (value, &src);
|
||||
g_value_init (&dest, G_TYPE_DOUBLE);
|
||||
|
||||
if (g_value_transform (&src, &dest))
|
||||
{
|
||||
dub = g_value_get_double (&dest);
|
||||
}
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_MinimumIncrement (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
GValue src = { 0 };
|
||||
GValue dest = { 0 };
|
||||
gdouble dub = 0;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
|
||||
|
||||
AtkValueIface *iface = ATK_VALUE_GET_IFACE (value);
|
||||
if (iface->get_increment)
|
||||
{
|
||||
dub = atk_value_get_increment (value);
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
g_value_init (&src, G_TYPE_DOUBLE);
|
||||
atk_value_get_minimum_increment (value, &src);
|
||||
g_value_init (&dest, G_TYPE_DOUBLE);
|
||||
|
||||
if (g_value_transform (&src, &dest))
|
||||
{
|
||||
dub = g_value_get_double (&dest);
|
||||
}
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_get_CurrentValue (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
GValue src = { 0 };
|
||||
GValue dest = { 0 };
|
||||
gdouble dub = 0;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
|
||||
|
||||
AtkValueIface *iface = ATK_VALUE_GET_IFACE (value);
|
||||
if (iface->get_value_and_text)
|
||||
{
|
||||
gchar *text = NULL;
|
||||
atk_value_get_value_and_text (value, &dub, &text);
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
g_value_init (&src, G_TYPE_DOUBLE);
|
||||
atk_value_get_current_value (value, &src);
|
||||
g_value_init (&dest, G_TYPE_DOUBLE);
|
||||
|
||||
if (g_value_transform (&src, &dest))
|
||||
{
|
||||
dub = g_value_get_double (&dest);
|
||||
}
|
||||
return droute_return_v_double (iter, dub);
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
impl_set_CurrentValue (DBusMessageIter * iter, void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
GValue src = { 0 };
|
||||
GValue dest = { 0 };
|
||||
gdouble dub;
|
||||
DBusMessageIter iter_variant;
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
|
||||
|
||||
dbus_message_iter_recurse (iter, &iter_variant);
|
||||
if (dbus_message_iter_get_arg_type (&iter_variant) != DBUS_TYPE_DOUBLE)
|
||||
{
|
||||
g_warning ("TODO: Support setting value from a non-double");
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_get_basic (&iter_variant, &dub);
|
||||
|
||||
AtkValueIface *iface = ATK_VALUE_GET_IFACE (value);
|
||||
if (iface->set_value)
|
||||
{
|
||||
atk_value_set_value (value, dub);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_value_init (&src, G_TYPE_DOUBLE);
|
||||
g_value_set_double (&src, dub);
|
||||
|
||||
atk_value_get_current_value (value, &dest);
|
||||
|
||||
if (g_value_transform (&src, &dest))
|
||||
{
|
||||
atk_value_set_current_value (value, &dest);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* keeping this method around for backwards-compatibility for now; see
|
||||
* * BGO#652596 */
|
||||
static DBusMessage *
|
||||
impl_SetCurrentValue (DBusConnection * bus, DBusMessage * message,
|
||||
void *user_data)
|
||||
{
|
||||
AtkValue *value = (AtkValue *) user_data;
|
||||
dbus_bool_t rv;
|
||||
DBusMessage *reply;
|
||||
gdouble dub = 0;
|
||||
GValue new_value = { 0 };
|
||||
|
||||
g_return_val_if_fail (ATK_IS_VALUE (value),
|
||||
droute_not_yet_handled_error (message));
|
||||
|
||||
if (!dbus_message_get_args
|
||||
(message, NULL, DBUS_TYPE_DOUBLE, &dub, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return droute_invalid_arguments_error (message);
|
||||
}
|
||||
|
||||
g_value_init (&new_value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (&new_value, dub);
|
||||
rv = atk_value_set_current_value (value, &new_value);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod methods[] = {
|
||||
{impl_SetCurrentValue, "SetCurrentValue"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty properties[] = {
|
||||
{impl_get_MinimumValue, NULL, "MinimumValue"},
|
||||
{impl_get_MaximumValue, NULL, "MaximumValue"},
|
||||
{impl_get_MinimumIncrement, NULL, "MinimumIncrement"},
|
||||
{impl_get_CurrentValue, impl_set_CurrentValue, "CurrentValue"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
spi_initialize_value (DRoutePath * path)
|
||||
{
|
||||
spi_atk_add_interface (path,
|
||||
ATSPI_DBUS_INTERFACE_VALUE, spi_org_a11y_atspi_Value, methods, properties);
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002, 2003 Ximian, Inc.
|
||||
* Copyright 2008, 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ATK_BRIDGE_H
|
||||
#define ATK_BRIDGE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
int atk_bridge_adaptor_init (int * argc, char ** argv[]);
|
||||
void atk_bridge_adaptor_cleanup (void);
|
||||
void atk_bridge_set_event_context(GMainContext *cnx);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* ATK_BRIDGE_H */
|
|
@ -0,0 +1,3 @@
|
|||
atk_bridge_adaptor_init
|
||||
atk_bridge_adaptor_cleanup
|
||||
atk_bridge_set_event_context
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _BITARRAY_H
|
||||
#define _BITARRAY_H
|
||||
|
||||
#include "dbus/dbus.h"
|
||||
#include "glib.h"
|
||||
|
||||
#define BITARRAY_SEQ_TERM 0xffffffff
|
||||
|
||||
#define BITARRAY_SET(p, n) ((p)[n>>5] |= (1<<(n&31)))
|
||||
#endif /* _BITARRAY_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002, 2003 Ximian, Inc.
|
||||
* Copyright 2008, 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef BRIDGE_H
|
||||
#define BRIDGE_H
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
typedef struct _SpiBridge SpiBridge;
|
||||
typedef struct _SpiBridgeClass SpiBridgeClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _AtspiPropertyDefinition AtspiPropertyDefinition;
|
||||
struct _AtspiPropertyDefinition
|
||||
{
|
||||
char *name;
|
||||
GType type;
|
||||
DRoutePropertyFunction func;
|
||||
};
|
||||
|
||||
typedef struct _event_data event_data;
|
||||
struct _event_data
|
||||
{
|
||||
gchar *bus_name;
|
||||
gchar **data;
|
||||
GSList *properties;
|
||||
};
|
||||
|
||||
struct _SpiBridge
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
AtkObject *root;
|
||||
|
||||
DBusConnection *bus;
|
||||
DRouteContext *droute;
|
||||
GMainContext *main_context;
|
||||
DBusServer *server;
|
||||
GList *direct_connections;
|
||||
|
||||
/*
|
||||
SpiRegister *reg;
|
||||
SpiCache *cache;
|
||||
SpiLeasing *leasing;
|
||||
*/
|
||||
gchar *desktop_name;
|
||||
gchar *desktop_path;
|
||||
gchar *app_tmp_dir;
|
||||
gchar *app_bus_addr;
|
||||
GList *events;
|
||||
gboolean events_initialized;
|
||||
GHashTable *property_hash;
|
||||
guint registration_pending;
|
||||
};
|
||||
|
||||
extern SpiBridge *spi_global_app_data;
|
||||
|
||||
void spi_atk_add_client (const char *bus_name);
|
||||
void spi_atk_remove_client (const char *bus_name);
|
||||
|
||||
int spi_atk_create_socket (SpiBridge *app);
|
||||
|
||||
void spi_atk_add_interface (DRoutePath *path,
|
||||
const char *name,
|
||||
const char *introspect,
|
||||
const DRouteMethod *methods,
|
||||
const DRouteProperty *properties);
|
||||
|
||||
DRoutePropertyFunction _atk_bridge_find_property_func (const char *property,
|
||||
GType *type);
|
||||
|
||||
GType _atk_bridge_type_from_iface (const char *iface);
|
||||
|
||||
gboolean _atk_bridge_register_application (gpointer data);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* BRIDGE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
* Copyright 2008, 2009 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
void spi_atk_register_event_listeners (void);
|
||||
void spi_atk_deregister_event_listeners (void);
|
||||
void spi_atk_tidy_windows (void);
|
||||
|
||||
gboolean spi_event_is_subtype (gchar **needle, gchar **haystack);
|
||||
|
||||
extern GMainContext *spi_context;
|
||||
guint spi_idle_add(GSourceFunc function, gpointer data);
|
||||
guint spi_timeout_add_seconds (gint interval, GSourceFunc function, gpointer data);
|
||||
#endif /* EVENT_H */
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008, 2009 Codethink Ltd.
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002, 2003 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "config.h"
|
||||
|
||||
#include <gmodule.h>
|
||||
#include <atk-bridge.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
gtk_module_init (gint * argc, gchar ** argv[])
|
||||
{
|
||||
return atk_bridge_adaptor_init (argc, argv);
|
||||
}
|
||||
|
||||
gchar*
|
||||
g_module_check_init (GModule *module)
|
||||
{
|
||||
g_module_make_resident (module);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gnome_accessibility_module_init (void)
|
||||
{
|
||||
atk_bridge_adaptor_init (NULL, NULL);
|
||||
|
||||
if (g_getenv ("AT_SPI_DEBUG"))
|
||||
{
|
||||
g_print ("Atk Accessibility bridge initialized\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_accessibility_module_shutdown (void)
|
||||
{
|
||||
atk_bridge_adaptor_cleanup ();
|
||||
}
|
|
@ -0,0 +1,924 @@
|
|||
|
||||
/*
|
||||
* This file has been auto-generated from the introspection data available
|
||||
* in the at-spi2-core repository. The D-Bus procol is defined in this
|
||||
* repository, which can be found at:
|
||||
*
|
||||
* http://download.gnome.org/sources/at-spi2-core/0.1/
|
||||
*
|
||||
* DO NOT EDIT.
|
||||
*/
|
||||
|
||||
|
||||
const char *spi_org_a11y_atspi_Accessible =
|
||||
"<interface name=\"org.a11y.atspi.Accessible\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"Name\" type=\"s\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Description\" type=\"s\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Parent\" type=\"(so)\">"
|
||||
" "
|
||||
" </property>"
|
||||
""
|
||||
" <property access=\"read\" name=\"ChildCount\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Locale\" type=\"s\" />"
|
||||
""
|
||||
" <method name=\"GetChildAtIndex\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetChildren\">"
|
||||
" <arg direction=\"out\" type=\"a(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetIndexInParent\">"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRelationSet\">"
|
||||
" <arg direction=\"out\" type=\"a(ua(so))\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRole\">"
|
||||
" <arg direction=\"out\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRoleName\">"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetLocalizedRoleName\">"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetState\">"
|
||||
" <arg direction=\"out\" type=\"au\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributes\">"
|
||||
" <arg direction=\"out\" type=\"a{ss}\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetApplication\">"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Action =
|
||||
"<interface name=\"org.a11y.atspi.Action\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"NActions\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetDescription\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetName\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetLocalizedName\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetKeyBinding\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetActions\">"
|
||||
" <arg direction=\"out\" type=\"a(sss)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DoAction\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Application =
|
||||
"<interface name=\"org.a11y.atspi.Application\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"ToolkitName\" type=\"s\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Version\" type=\"s\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"AtspiVersion\" type=\"s\" />"
|
||||
" <property access=\"read\" name=\"Id\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetLocale\">"
|
||||
" <arg direction=\"in\" name=\"lctype\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"RegisterEventListener\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeregisterEventListener\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Collection =
|
||||
"<interface name=\"org.a11y.atspi.Collection\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"GetMatches\">"
|
||||
" <arg direction=\"in\" name=\"rule\" type=\"(auuasuauusub)\" />"
|
||||
" "
|
||||
" <arg direction=\"in\" name=\"sortby\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"count\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"traverse\" type=\"b\" />"
|
||||
" <arg direction=\"out\" type=\"a(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetMatchesTo\">"
|
||||
" <arg direction=\"in\" name=\"current_object\" type=\"o\" />"
|
||||
" "
|
||||
" <arg direction=\"in\" name=\"rule\" type=\"(auuasuauusub)\" />"
|
||||
" "
|
||||
" <arg direction=\"in\" name=\"sortby\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"tree\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"limit_scope\" type=\"b\" />"
|
||||
" <arg direction=\"in\" name=\"count\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"traverse\" type=\"b\" />"
|
||||
" <arg direction=\"out\" type=\"a(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetMatchesFrom\">"
|
||||
" <arg direction=\"in\" name=\"current_object\" type=\"o\" />"
|
||||
" "
|
||||
" <arg direction=\"in\" name=\"rule\" type=\"(auuasuauusub)\" />"
|
||||
" "
|
||||
" <arg direction=\"in\" name=\"sortby\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"tree\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"count\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"traverse\" type=\"b\" />"
|
||||
" <arg direction=\"out\" type=\"a(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetActiveDescendant\">"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Component =
|
||||
"<interface name=\"org.a11y.atspi.Component\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"Contains\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAccessibleAtPoint\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetExtents\">"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"(iiii)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetPosition\">"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"y\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetSize\">"
|
||||
" <arg direction=\"out\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"height\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetLayer\">"
|
||||
" <arg direction=\"out\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetMDIZOrder\">"
|
||||
" <arg direction=\"out\" type=\"n\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GrabFocus\">"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAlpha\">"
|
||||
" <arg direction=\"out\" type=\"d\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SetExtents\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"height\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SetPosition\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coord_type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SetSize\">"
|
||||
" <arg direction=\"in\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"height\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"ScrollTo\">"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\"/>"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"ScrollToPoint\">"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\"/>"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\"/>"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\"/>"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Document =
|
||||
"<interface name=\"org.a11y.atspi.Document\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"CurrentPageNumber\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"PageCount\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetLocale\">"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributeValue\">"
|
||||
" <arg direction=\"in\" name=\"attributename\" type=\"s\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributes\">"
|
||||
" <arg direction=\"out\" type=\"{ss}\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Hypertext =
|
||||
"<interface name=\"org.a11y.atspi.Hypertext\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"GetNLinks\">"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetLink\">"
|
||||
" <arg direction=\"in\" name=\"linkIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetLinkIndex\">"
|
||||
" <arg direction=\"in\" name=\"characterIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Hyperlink =
|
||||
"<interface name=\"org.a11y.atspi.Hyperlink\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"NAnchors\" type=\"n\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"StartIndex\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"EndIndex\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetObject\">"
|
||||
" <arg direction=\"in\" name=\"i\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetURI\">"
|
||||
" <arg direction=\"in\" name=\"i\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"IsValid\">"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Image =
|
||||
"<interface name=\"org.a11y.atspi.Image\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"ImageDescription\" type=\"s\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"ImageLocale\" type=\"s\" />"
|
||||
""
|
||||
" <method name=\"GetImageExtents\">"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"(iiii)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetImagePosition\">"
|
||||
" <arg direction=\"out\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetImageSize\">"
|
||||
" <arg direction=\"out\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"height\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Selection =
|
||||
"<interface name=\"org.a11y.atspi.Selection\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"NSelectedChildren\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetSelectedChild\">"
|
||||
" <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SelectChild\">"
|
||||
" <arg direction=\"in\" name=\"childIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeselectSelectedChild\">"
|
||||
" <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"IsChildSelected\">"
|
||||
" <arg direction=\"in\" name=\"childIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SelectAll\">"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"ClearSelection\">"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeselectChild\">"
|
||||
" <arg direction=\"in\" name=\"childIndex\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Table =
|
||||
"<interface name=\"org.a11y.atspi.Table\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"NRows\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"NColumns\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Caption\" type=\"(so)\">"
|
||||
" "
|
||||
" </property>"
|
||||
""
|
||||
" <property access=\"read\" name=\"Summary\" type=\"(so)\">"
|
||||
" "
|
||||
" </property>"
|
||||
""
|
||||
" <property access=\"read\" name=\"NSelectedRows\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"NSelectedColumns\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetAccessibleAt\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetIndexAt\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRowAtIndex\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetColumnAtIndex\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRowDescription\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetColumnDescription\">"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRowExtentAt\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetColumnExtentAt\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRowHeader\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetColumnHeader\">"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"(so)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetSelectedRows\">"
|
||||
" <arg direction=\"out\" type=\"ai\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetSelectedColumns\">"
|
||||
" <arg direction=\"out\" type=\"ai\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"IsRowSelected\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"IsColumnSelected\">"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"IsSelected\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"AddRowSelection\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"AddColumnSelection\">"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"RemoveRowSelection\">"
|
||||
" <arg direction=\"in\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"RemoveColumnSelection\">"
|
||||
" <arg direction=\"in\" name=\"column\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRowColumnExtentsAtIndex\">"
|
||||
" <arg direction=\"in\" name=\"index\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" <arg direction=\"out\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"col\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"row_extents\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"col_extents\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"is_selected\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_TableCell =
|
||||
"<interface name=\"org.a11y.atspi.TableCell\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"ColumnSpan\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Position\" type=\"(ii)\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"RowSpan\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"Table\" type=\"(so)\" />"
|
||||
""
|
||||
" <method name=\"GetRowColumnSpan\">"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" <arg direction=\"out\" name=\"row\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"col\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"row_extents\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"col_extents\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Text =
|
||||
"<interface name=\"org.a11y.atspi.Text\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"CharacterCount\" type=\"i\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"CaretOffset\" type=\"i\" />"
|
||||
""
|
||||
" <method name=\"GetStringAtOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"granularity\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetText\">"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SetCaretOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetTextBeforeOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetTextAtOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetTextAfterOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetCharacterAtOffset\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributeValue\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"attributeName\" type=\"s\" />"
|
||||
" <arg direction=\"out\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributes\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"a{ss}\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetDefaultAttributes\">"
|
||||
" <arg direction=\"out\" type=\"a{ss}\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetCharacterExtents\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"height\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetOffsetAtPoint\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetNSelections\">"
|
||||
" <arg direction=\"out\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetSelection\">"
|
||||
" <arg direction=\"in\" name=\"selectionNum\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"AddSelection\">"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"RemoveSelection\">"
|
||||
" <arg direction=\"in\" name=\"selectionNum\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"SetSelection\">"
|
||||
" <arg direction=\"in\" name=\"selectionNum\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRangeExtents\">"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"height\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetBoundedRanges\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"width\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"height\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"coordType\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"xClipType\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"yClipType\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"a(iisv)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetAttributeRun\">"
|
||||
" <arg direction=\"in\" name=\"offset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"includeDefaults\" type=\"b\" />"
|
||||
" <arg direction=\"out\" type=\"a{ss}\" />"
|
||||
" <arg direction=\"out\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"out\" name=\"endOffset\" type=\"i\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetDefaultAttributeSet\">"
|
||||
" <arg direction=\"out\" type=\"a{ss}\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"ScrollSubstringTo\">"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\"/>"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"ScrollSubstringToPoint\">"
|
||||
" <arg direction=\"in\" name=\"startOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endOffset\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\"/>"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\"/>"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\"/>"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_EditableText =
|
||||
"<interface name=\"org.a11y.atspi.EditableText\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"SetTextContents\">"
|
||||
" <arg direction=\"in\" name=\"newContents\" type=\"s\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"InsertText\">"
|
||||
" <arg direction=\"in\" name=\"position\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"text\" type=\"s\" />"
|
||||
" <arg direction=\"in\" name=\"length\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"CopyText\">"
|
||||
" <arg direction=\"in\" name=\"startPos\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endPos\" type=\"i\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"CutText\">"
|
||||
" <arg direction=\"in\" name=\"startPos\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endPos\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeleteText\">"
|
||||
" <arg direction=\"in\" name=\"startPos\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"endPos\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"PasteText\">"
|
||||
" <arg direction=\"in\" name=\"position\" type=\"i\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Cache =
|
||||
"<interface name=\"org.a11y.atspi.Cache\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"GetItems\">"
|
||||
" <arg direction=\"out\" name=\"nodes\" type=\"a((so)(so)iiassusau)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <signal name=\"AddAccessible\">"
|
||||
" <arg name=\"nodeAdded\" type=\"((so)(so)iiassusau)\" />"
|
||||
" "
|
||||
" </signal>"
|
||||
""
|
||||
" <signal name=\"RemoveAccessible\">"
|
||||
" <arg name=\"nodeRemoved\" type=\"(so)\" />"
|
||||
" "
|
||||
" </signal>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Value =
|
||||
"<interface name=\"org.a11y.atspi.Value\" version=\"0.1.7\">"
|
||||
""
|
||||
" <property access=\"read\" name=\"MinimumValue\" type=\"d\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"MaximumValue\" type=\"d\" />"
|
||||
""
|
||||
" <property access=\"read\" name=\"MinimumIncrement\" type=\"d\" />"
|
||||
""
|
||||
" <property access=\"readwrite\" name=\"CurrentValue\" type=\"d\" />"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_Registry =
|
||||
"<interface name=\"org.a11y.atspi.Registry\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"RegisterEvent\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"s\">"
|
||||
" </arg>"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeregisterEvent\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"s\">"
|
||||
" </arg>"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GetRegisteredEvents\">"
|
||||
" <arg direction=\"out\" name=\"events\" type=\"a(ss)\">"
|
||||
" </arg>"
|
||||
" </method>"
|
||||
""
|
||||
" <signal name=\"EventListenerRegistered\">"
|
||||
" <arg direction=\"out\" name=\"bus\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"path\" type=\"s\" />"
|
||||
" </signal>"
|
||||
""
|
||||
" <signal name=\"EventListenerDeregistered\">"
|
||||
" <arg direction=\"out\" name=\"bus\" type=\"s\" />"
|
||||
" <arg direction=\"out\" name=\"path\" type=\"s\" />"
|
||||
" </signal>"
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_DeviceEventController =
|
||||
"<interface name=\"org.a11y.atspi.DeviceEventController\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"RegisterKeystrokeListener\">"
|
||||
" <arg direction=\"in\" name=\"listener\" type=\"o\" />"
|
||||
" <arg direction=\"in\" name=\"keys\" type=\"a(iisi)\">"
|
||||
" "
|
||||
" </arg>"
|
||||
" <arg direction=\"in\" name=\"mask\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"au\">"
|
||||
" "
|
||||
" </arg>"
|
||||
" <arg direction=\"in\" name=\"mode\" type=\"(bbb)\">"
|
||||
" "
|
||||
" </arg>"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeregisterKeystrokeListener\">"
|
||||
" <arg direction=\"in\" name=\"listener\" type=\"o\" />"
|
||||
" <arg direction=\"in\" name=\"keys\" type=\"a(iisi)\">"
|
||||
" "
|
||||
" </arg>"
|
||||
" <arg direction=\"in\" name=\"mask\" type=\"u\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"RegisterDeviceEventListener\">"
|
||||
" <arg direction=\"in\" name=\"listener\" type=\"o\" />"
|
||||
" <arg direction=\"in\" name=\"types\" type=\"u\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"DeregisterDeviceEventListener\">"
|
||||
" <arg direction=\"in\" name=\"listener\" type=\"o\" />"
|
||||
" <arg direction=\"in\" name=\"types\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GenerateKeyboardEvent\">"
|
||||
" <arg direction=\"in\" name=\"keycode\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"keystring\" type=\"s\" />"
|
||||
" <arg direction=\"in\" name=\"type\" type=\"u\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"GenerateMouseEvent\">"
|
||||
" <arg direction=\"in\" name=\"x\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"y\" type=\"i\" />"
|
||||
" <arg direction=\"in\" name=\"eventName\" type=\"s\" />"
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"NotifyListenersSync\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
" <method name=\"NotifyListenersAsync\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
|
||||
" "
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
||||
const char *spi_org_a11y_atspi_DeviceEventListener =
|
||||
"<interface name=\"org.a11y.atspi.DeviceEventListener\" version=\"0.1.7\">"
|
||||
""
|
||||
" <method name=\"NotifyEvent\">"
|
||||
" <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
|
||||
" "
|
||||
" <arg direction=\"out\" type=\"b\" />"
|
||||
" </method>"
|
||||
""
|
||||
"</interface>"
|
||||
"";
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
/*
|
||||
* This file has been auto-generated from the introspection data available
|
||||
* in the at-spi2-core repository. The D-Bus procol is defined in this
|
||||
* repository, which can be found at:
|
||||
*
|
||||
* http://download.gnome.org/sources/at-spi2-core/0.1/
|
||||
*
|
||||
* DO NOT EDIT.
|
||||
*/
|
||||
|
||||
#ifndef SPI_INTROSPECTION_DATA_H_
|
||||
#define SPI_INTROSPECTION_DATA_H_
|
||||
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Accessible;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Action;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Application;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Collection;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Component;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Document;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Hypertext;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Hyperlink;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Image;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Selection;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Table;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_TableCell;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Text;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_EditableText;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Cache;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Value;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_Registry;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_DeviceEventController;
|
||||
|
||||
extern const char *spi_org_a11y_atspi_DeviceEventListener;
|
||||
|
||||
|
||||
#endif /* SPI_INTROSPECTION_DATA_H_ */
|
|
@ -0,0 +1,62 @@
|
|||
subdir('adaptors')
|
||||
|
||||
atk_bridge_sources = [
|
||||
'accessible-leasing.c',
|
||||
'accessible-cache.c',
|
||||
'accessible-register.c',
|
||||
'accessible-stateset.c',
|
||||
'introspection.c',
|
||||
'bridge.c',
|
||||
'object.c',
|
||||
'event.c',
|
||||
'spi-dbus.c',
|
||||
]
|
||||
|
||||
install_headers([ 'atk-bridge.h' ], subdir: join_paths(meson.project_name(), '2.0'))
|
||||
|
||||
libatk_bridge = shared_library('atk-bridge-2.0', atk_bridge_sources,
|
||||
include_directories: root_inc,
|
||||
dependencies: [
|
||||
libatk_bridge_adaptors_dep,
|
||||
libdroute_dep,
|
||||
libdbus_dep,
|
||||
gmodule_dep,
|
||||
gobject_dep,
|
||||
atk_dep,
|
||||
atspi_dep,
|
||||
],
|
||||
c_args: p2p_cflags,
|
||||
version: atk_bridge_libversion,
|
||||
soversion: atk_bridge_soversion,
|
||||
install: true)
|
||||
|
||||
libatk_bridge_dep = declare_dependency(link_with: libatk_bridge,
|
||||
include_directories: [
|
||||
root_inc,
|
||||
include_directories('.')
|
||||
])
|
||||
|
||||
atk_bridge_module = shared_module('atk-bridge', 'gtk-2.0/module.c',
|
||||
include_directories: root_inc,
|
||||
dependencies: [
|
||||
libatk_bridge_dep,
|
||||
libdbus_dep,
|
||||
atk_dep,
|
||||
atspi_dep,
|
||||
gmodule_dep,
|
||||
],
|
||||
c_args: p2p_cflags,
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('libdir'), 'gtk-2.0', 'modules'))
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
name: 'atk-bridge-2.0',
|
||||
description: 'ATK/D-Bus Bridge',
|
||||
version: meson.project_version(),
|
||||
libraries: libatk_bridge,
|
||||
requires_private: ['gobject-2.0', 'atspi-2'],
|
||||
filebase: 'atk-bridge-2.0',
|
||||
subdirs: 'at-spi2-atk/2.0',
|
||||
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
|
||||
)
|
|
@ -0,0 +1,515 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008, 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module contains utility functions for exporting AT-SPI
|
||||
* objects based upon an ATK object.
|
||||
*
|
||||
* It incudes functions for marshalling object references
|
||||
* and supported interfaces to a D-Bus message.
|
||||
*/
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include "atspi/atspi.h"
|
||||
#include "spi-dbus.h"
|
||||
|
||||
#include "accessible-register.h"
|
||||
#include "accessible-cache.h"
|
||||
#include "accessible-leasing.h"
|
||||
|
||||
#include "bridge.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* This is the all important function that decides whether an object should
|
||||
* be leased or not.
|
||||
*
|
||||
* The choice of algorithm for this is somewhat vuage. We want ideally to lease
|
||||
* all atk objects that are not owned by their parent.
|
||||
*
|
||||
* The 'cache' object attempts to cache all objects that are owned by their
|
||||
* parent by traversing the tree of accessibles, ignoring the children of
|
||||
* manages-descendants and transient objects.
|
||||
*
|
||||
* This function will simply look for all the accessibles that the cache object
|
||||
* has not found and assume that they need to be leased.
|
||||
*/
|
||||
void
|
||||
spi_object_lease_if_needed (GObject *obj)
|
||||
{
|
||||
if (!spi_cache_in (spi_global_cache, obj))
|
||||
{
|
||||
spi_leasing_take (spi_global_leasing, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* It is assumed that all of these functions are returning an accessible
|
||||
* object to the client side.
|
||||
*
|
||||
* All of them will lease the AtkObject if it is deemed neccessary.
|
||||
*/
|
||||
|
||||
void
|
||||
spi_object_append_null_reference (DBusMessageIter * iter)
|
||||
{
|
||||
DBusMessageIter iter_struct;
|
||||
const char *name;
|
||||
const char *path = ATSPI_DBUS_PATH_NULL;
|
||||
|
||||
name = dbus_bus_get_unique_name (spi_global_app_data->bus);
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
|
||||
dbus_message_iter_close_container (iter, &iter_struct);
|
||||
}
|
||||
|
||||
void
|
||||
spi_object_append_reference (DBusMessageIter * iter, AtkObject * obj)
|
||||
{
|
||||
DBusMessageIter iter_struct;
|
||||
const gchar *name;
|
||||
gchar *path;
|
||||
|
||||
if (!obj) {
|
||||
spi_object_append_null_reference (iter);
|
||||
return;
|
||||
}
|
||||
|
||||
spi_object_lease_if_needed (G_OBJECT (obj));
|
||||
|
||||
name = dbus_bus_get_unique_name (spi_global_app_data->bus);
|
||||
path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
|
||||
|
||||
if (!path)
|
||||
path = g_strdup (SPI_DBUS_PATH_NULL);
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
|
||||
dbus_message_iter_close_container (iter, &iter_struct);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
/* TODO: Perhaps combine with spi_object_append_reference. Leaving separate
|
||||
* for now in case we want to use a different path for hyperlinks. */
|
||||
void
|
||||
spi_hyperlink_append_reference (DBusMessageIter * iter, AtkHyperlink * obj)
|
||||
{
|
||||
DBusMessageIter iter_struct;
|
||||
const gchar *name;
|
||||
gchar *path;
|
||||
|
||||
if (!obj) {
|
||||
spi_object_append_null_reference (iter);
|
||||
return;
|
||||
}
|
||||
|
||||
spi_object_lease_if_needed (G_OBJECT (obj));
|
||||
|
||||
name = dbus_bus_get_unique_name (spi_global_app_data->bus);
|
||||
path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
|
||||
|
||||
if (!path)
|
||||
path = g_strdup (SPI_DBUS_PATH_NULL);
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
|
||||
dbus_message_iter_close_container (iter, &iter_struct);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
void
|
||||
spi_object_append_v_reference (DBusMessageIter * iter, AtkObject * obj)
|
||||
{
|
||||
DBusMessageIter iter_variant;
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(so)",
|
||||
&iter_variant);
|
||||
spi_object_append_reference (&iter_variant, obj);
|
||||
dbus_message_iter_close_container (iter, &iter_variant);
|
||||
}
|
||||
|
||||
void
|
||||
spi_object_append_desktop_reference (DBusMessageIter * iter)
|
||||
{
|
||||
DBusMessageIter iter_struct;
|
||||
const char *name = spi_global_app_data->desktop_name;
|
||||
const char *path = spi_global_app_data->desktop_path;
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
|
||||
&iter_struct);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
|
||||
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
|
||||
dbus_message_iter_close_container (iter, &iter_struct);
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
spi_object_return_reference (DBusMessage * msg, AtkObject * obj)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
|
||||
reply = dbus_message_new_method_return (msg);
|
||||
if (reply)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_object_append_reference (&iter, obj);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
spi_hyperlink_return_reference (DBusMessage * msg, AtkHyperlink * obj)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
|
||||
reply = dbus_message_new_method_return (msg);
|
||||
if (reply)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
spi_hyperlink_append_reference (&iter, obj);
|
||||
}
|
||||
if (obj)
|
||||
g_object_unref (G_OBJECT (obj));
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
spi_object_append_interfaces (DBusMessageIter * iter, AtkObject * obj)
|
||||
{
|
||||
const gchar *itf;
|
||||
|
||||
itf = ATSPI_DBUS_INTERFACE_ACCESSIBLE;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
|
||||
if (ATK_IS_ACTION (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_ACTION;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (atk_object_get_role (obj) == ATK_ROLE_APPLICATION)
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_APPLICATION;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_COMPONENT (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_COMPONENT;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_EDITABLE_TEXT (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_EDITABLE_TEXT;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_TEXT (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_TEXT;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_HYPERTEXT (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_HYPERTEXT;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_IMAGE (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_IMAGE;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_SELECTION (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_SELECTION;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_TABLE (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_TABLE;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_TABLE_CELL (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_TABLE_CELL;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_VALUE (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_VALUE;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (ATK_IS_STREAMABLE_CONTENT (obj))
|
||||
{
|
||||
itf = "org.a11y.atspi.StreamableContent";
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ATK_IS_OBJECT (obj))
|
||||
{
|
||||
itf = "org.a11y.atspi.Collection";
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_DOCUMENT (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_DOCUMENT;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
|
||||
if (ATK_IS_HYPERLINK_IMPL (obj))
|
||||
{
|
||||
itf = ATSPI_DBUS_INTERFACE_HYPERLINK;
|
||||
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
spi_object_append_attribute_set (DBusMessageIter * iter, AtkAttributeSet * attr)
|
||||
{
|
||||
DBusMessageIter dictIter;
|
||||
|
||||
dbus_message_iter_open_container (iter, DBUS_TYPE_ARRAY, "{ss}", &dictIter);
|
||||
while (attr)
|
||||
{
|
||||
DBusMessageIter dictEntryIter;
|
||||
AtkAttribute *attribute = (AtkAttribute *) attr->data;
|
||||
const char *key = attribute->name;
|
||||
const char *value = attribute->value;
|
||||
|
||||
if (key == NULL)
|
||||
key = "";
|
||||
if (value == NULL)
|
||||
value = "";
|
||||
|
||||
dbus_message_iter_open_container (&dictIter, DBUS_TYPE_DICT_ENTRY, NULL,
|
||||
&dictEntryIter);
|
||||
dbus_message_iter_append_basic (&dictEntryIter, DBUS_TYPE_STRING,
|
||||
&key);
|
||||
dbus_message_iter_append_basic (&dictEntryIter, DBUS_TYPE_STRING,
|
||||
&value);
|
||||
dbus_message_iter_close_container (&dictIter, &dictEntryIter);
|
||||
attr = g_slist_next (attr);
|
||||
}
|
||||
dbus_message_iter_close_container (iter, &dictIter);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static gboolean
|
||||
init_role_lookup_table (AtspiRole * role_table)
|
||||
{
|
||||
int i;
|
||||
/* if it's not in the list below, dunno what it is */
|
||||
for (i = 0; i < ATK_ROLE_LAST_DEFINED; ++i)
|
||||
{
|
||||
role_table[i] = ATSPI_ROLE_UNKNOWN;
|
||||
}
|
||||
|
||||
role_table[ATK_ROLE_INVALID] = ATSPI_ROLE_INVALID;
|
||||
role_table[ATK_ROLE_ACCEL_LABEL] = ATSPI_ROLE_ACCELERATOR_LABEL;
|
||||
role_table[ATK_ROLE_ALERT] = ATSPI_ROLE_ALERT;
|
||||
role_table[ATK_ROLE_ANIMATION] = ATSPI_ROLE_ANIMATION;
|
||||
role_table[ATK_ROLE_ARROW] = ATSPI_ROLE_ARROW;
|
||||
role_table[ATK_ROLE_CALENDAR] = ATSPI_ROLE_CALENDAR;
|
||||
role_table[ATK_ROLE_CANVAS] = ATSPI_ROLE_CANVAS;
|
||||
role_table[ATK_ROLE_CHECK_BOX] = ATSPI_ROLE_CHECK_BOX;
|
||||
role_table[ATK_ROLE_CHECK_MENU_ITEM] = ATSPI_ROLE_CHECK_MENU_ITEM;
|
||||
role_table[ATK_ROLE_COLOR_CHOOSER] = ATSPI_ROLE_COLOR_CHOOSER;
|
||||
role_table[ATK_ROLE_COLUMN_HEADER] = ATSPI_ROLE_COLUMN_HEADER;
|
||||
role_table[ATK_ROLE_COMBO_BOX] = ATSPI_ROLE_COMBO_BOX;
|
||||
role_table[ATK_ROLE_DATE_EDITOR] = ATSPI_ROLE_DATE_EDITOR;
|
||||
role_table[ATK_ROLE_DESKTOP_ICON] = ATSPI_ROLE_DESKTOP_ICON;
|
||||
role_table[ATK_ROLE_DESKTOP_FRAME] = ATSPI_ROLE_DESKTOP_FRAME;
|
||||
role_table[ATK_ROLE_DIAL] = ATSPI_ROLE_DIAL;
|
||||
role_table[ATK_ROLE_DIALOG] = ATSPI_ROLE_DIALOG;
|
||||
role_table[ATK_ROLE_DIRECTORY_PANE] = ATSPI_ROLE_DIRECTORY_PANE;
|
||||
role_table[ATK_ROLE_DRAWING_AREA] = ATSPI_ROLE_DRAWING_AREA;
|
||||
role_table[ATK_ROLE_FILE_CHOOSER] = ATSPI_ROLE_FILE_CHOOSER;
|
||||
role_table[ATK_ROLE_FILLER] = ATSPI_ROLE_FILLER;
|
||||
role_table[ATK_ROLE_FONT_CHOOSER] = ATSPI_ROLE_FONT_CHOOSER;
|
||||
role_table[ATK_ROLE_FRAME] = ATSPI_ROLE_FRAME;
|
||||
role_table[ATK_ROLE_GLASS_PANE] = ATSPI_ROLE_GLASS_PANE;
|
||||
role_table[ATK_ROLE_HTML_CONTAINER] = ATSPI_ROLE_HTML_CONTAINER;
|
||||
role_table[ATK_ROLE_ICON] = ATSPI_ROLE_ICON;
|
||||
role_table[ATK_ROLE_IMAGE] = ATSPI_ROLE_IMAGE;
|
||||
role_table[ATK_ROLE_INTERNAL_FRAME] = ATSPI_ROLE_INTERNAL_FRAME;
|
||||
role_table[ATK_ROLE_LABEL] = ATSPI_ROLE_LABEL;
|
||||
role_table[ATK_ROLE_LAYERED_PANE] = ATSPI_ROLE_LAYERED_PANE;
|
||||
role_table[ATK_ROLE_LIST] = ATSPI_ROLE_LIST;
|
||||
role_table[ATK_ROLE_LIST_ITEM] = ATSPI_ROLE_LIST_ITEM;
|
||||
role_table[ATK_ROLE_MENU] = ATSPI_ROLE_MENU;
|
||||
role_table[ATK_ROLE_MENU_BAR] = ATSPI_ROLE_MENU_BAR;
|
||||
role_table[ATK_ROLE_MENU_ITEM] = ATSPI_ROLE_MENU_ITEM;
|
||||
role_table[ATK_ROLE_OPTION_PANE] = ATSPI_ROLE_OPTION_PANE;
|
||||
role_table[ATK_ROLE_PAGE_TAB] = ATSPI_ROLE_PAGE_TAB;
|
||||
role_table[ATK_ROLE_PAGE_TAB_LIST] = ATSPI_ROLE_PAGE_TAB_LIST;
|
||||
role_table[ATK_ROLE_PANEL] = ATSPI_ROLE_PANEL;
|
||||
role_table[ATK_ROLE_PASSWORD_TEXT] = ATSPI_ROLE_PASSWORD_TEXT;
|
||||
role_table[ATK_ROLE_POPUP_MENU] = ATSPI_ROLE_POPUP_MENU;
|
||||
role_table[ATK_ROLE_PROGRESS_BAR] = ATSPI_ROLE_PROGRESS_BAR;
|
||||
role_table[ATK_ROLE_PUSH_BUTTON] = ATSPI_ROLE_PUSH_BUTTON;
|
||||
role_table[ATK_ROLE_RADIO_BUTTON] = ATSPI_ROLE_RADIO_BUTTON;
|
||||
role_table[ATK_ROLE_RADIO_MENU_ITEM] = ATSPI_ROLE_RADIO_MENU_ITEM;
|
||||
role_table[ATK_ROLE_ROOT_PANE] = ATSPI_ROLE_ROOT_PANE;
|
||||
role_table[ATK_ROLE_ROW_HEADER] = ATSPI_ROLE_ROW_HEADER;
|
||||
role_table[ATK_ROLE_SCROLL_BAR] = ATSPI_ROLE_SCROLL_BAR;
|
||||
role_table[ATK_ROLE_SCROLL_PANE] = ATSPI_ROLE_SCROLL_PANE;
|
||||
role_table[ATK_ROLE_SEPARATOR] = ATSPI_ROLE_SEPARATOR;
|
||||
role_table[ATK_ROLE_SLIDER] = ATSPI_ROLE_SLIDER;
|
||||
role_table[ATK_ROLE_SPIN_BUTTON] = ATSPI_ROLE_SPIN_BUTTON;
|
||||
role_table[ATK_ROLE_SPLIT_PANE] = ATSPI_ROLE_SPLIT_PANE;
|
||||
role_table[ATK_ROLE_STATUSBAR] = ATSPI_ROLE_STATUS_BAR;
|
||||
role_table[ATK_ROLE_TABLE] = ATSPI_ROLE_TABLE;
|
||||
role_table[ATK_ROLE_TABLE_CELL] = ATSPI_ROLE_TABLE_CELL;
|
||||
role_table[ATK_ROLE_TABLE_COLUMN_HEADER] =
|
||||
ATSPI_ROLE_TABLE_COLUMN_HEADER;
|
||||
role_table[ATK_ROLE_TABLE_ROW_HEADER] = ATSPI_ROLE_TABLE_ROW_HEADER;
|
||||
role_table[ATK_ROLE_TEAR_OFF_MENU_ITEM] =
|
||||
ATSPI_ROLE_TEAROFF_MENU_ITEM;
|
||||
role_table[ATK_ROLE_TERMINAL] = ATSPI_ROLE_TERMINAL;
|
||||
role_table[ATK_ROLE_TEXT] = ATSPI_ROLE_TEXT;
|
||||
role_table[ATK_ROLE_TOGGLE_BUTTON] = ATSPI_ROLE_TOGGLE_BUTTON;
|
||||
role_table[ATK_ROLE_TOOL_BAR] = ATSPI_ROLE_TOOL_BAR;
|
||||
role_table[ATK_ROLE_TOOL_TIP] = ATSPI_ROLE_TOOL_TIP;
|
||||
role_table[ATK_ROLE_TREE] = ATSPI_ROLE_TREE;
|
||||
role_table[ATK_ROLE_TREE_TABLE] = ATSPI_ROLE_TREE_TABLE;
|
||||
role_table[ATK_ROLE_UNKNOWN] = ATSPI_ROLE_UNKNOWN;
|
||||
role_table[ATK_ROLE_VIEWPORT] = ATSPI_ROLE_VIEWPORT;
|
||||
role_table[ATK_ROLE_WINDOW] = ATSPI_ROLE_WINDOW;
|
||||
role_table[ATK_ROLE_HEADER] = ATSPI_ROLE_HEADER;
|
||||
role_table[ATK_ROLE_FOOTER] = ATSPI_ROLE_FOOTER;
|
||||
role_table[ATK_ROLE_PARAGRAPH] = ATSPI_ROLE_PARAGRAPH;
|
||||
role_table[ATK_ROLE_RULER] = ATSPI_ROLE_RULER;
|
||||
role_table[ATK_ROLE_APPLICATION] = ATSPI_ROLE_APPLICATION;
|
||||
role_table[ATK_ROLE_AUTOCOMPLETE] = ATSPI_ROLE_AUTOCOMPLETE;
|
||||
role_table[ATK_ROLE_EDITBAR] = ATSPI_ROLE_EDITBAR;
|
||||
role_table[ATK_ROLE_EMBEDDED] = ATSPI_ROLE_EMBEDDED;
|
||||
role_table[ATK_ROLE_ENTRY] = ATSPI_ROLE_ENTRY;
|
||||
role_table[ATK_ROLE_CHART] = ATSPI_ROLE_CHART;
|
||||
role_table[ATK_ROLE_CAPTION] = ATSPI_ROLE_CAPTION;
|
||||
role_table[ATK_ROLE_DOCUMENT_FRAME] = ATSPI_ROLE_DOCUMENT_FRAME;
|
||||
role_table[ATK_ROLE_HEADING] = ATSPI_ROLE_HEADING;
|
||||
role_table[ATK_ROLE_PAGE] = ATSPI_ROLE_PAGE;
|
||||
role_table[ATK_ROLE_SECTION] = ATSPI_ROLE_SECTION;
|
||||
role_table[ATK_ROLE_FORM] = ATSPI_ROLE_FORM;
|
||||
role_table[ATK_ROLE_REDUNDANT_OBJECT] = ATSPI_ROLE_REDUNDANT_OBJECT;
|
||||
role_table[ATK_ROLE_LINK] = ATSPI_ROLE_LINK;
|
||||
role_table[ATK_ROLE_INPUT_METHOD_WINDOW] =
|
||||
ATSPI_ROLE_INPUT_METHOD_WINDOW;
|
||||
role_table[ATK_ROLE_TABLE_ROW] = ATSPI_ROLE_TABLE_ROW;
|
||||
role_table[ATK_ROLE_TREE_ITEM] = ATSPI_ROLE_TREE_ITEM;
|
||||
role_table[ATK_ROLE_DOCUMENT_SPREADSHEET] =
|
||||
ATSPI_ROLE_DOCUMENT_SPREADSHEET;
|
||||
role_table[ATK_ROLE_DOCUMENT_PRESENTATION] =
|
||||
ATSPI_ROLE_DOCUMENT_PRESENTATION;
|
||||
role_table[ATK_ROLE_DOCUMENT_TEXT] = ATSPI_ROLE_DOCUMENT_TEXT;
|
||||
role_table[ATK_ROLE_DOCUMENT_WEB] = ATSPI_ROLE_DOCUMENT_WEB;
|
||||
role_table[ATK_ROLE_DOCUMENT_EMAIL] = ATSPI_ROLE_DOCUMENT_EMAIL;
|
||||
role_table[ATK_ROLE_COMMENT] = ATSPI_ROLE_COMMENT;
|
||||
role_table[ATK_ROLE_LIST_BOX] = ATSPI_ROLE_LIST_BOX;
|
||||
role_table[ATK_ROLE_GROUPING] = ATSPI_ROLE_GROUPING;
|
||||
role_table[ATK_ROLE_IMAGE_MAP] = ATSPI_ROLE_IMAGE_MAP;
|
||||
role_table[ATK_ROLE_NOTIFICATION] = ATSPI_ROLE_NOTIFICATION;
|
||||
role_table[ATK_ROLE_INFO_BAR] = ATSPI_ROLE_INFO_BAR;
|
||||
role_table[ATK_ROLE_LEVEL_BAR] = ATSPI_ROLE_LEVEL_BAR;
|
||||
role_table[ATK_ROLE_TITLE_BAR] = ATSPI_ROLE_TITLE_BAR;
|
||||
role_table[ATK_ROLE_BLOCK_QUOTE] = ATSPI_ROLE_BLOCK_QUOTE;
|
||||
role_table[ATK_ROLE_AUDIO] = ATSPI_ROLE_AUDIO;
|
||||
role_table[ATK_ROLE_VIDEO] = ATSPI_ROLE_VIDEO;
|
||||
role_table[ATK_ROLE_DEFINITION] = ATSPI_ROLE_DEFINITION;
|
||||
role_table[ATK_ROLE_ARTICLE] = ATSPI_ROLE_ARTICLE;
|
||||
role_table[ATK_ROLE_LANDMARK] = ATSPI_ROLE_LANDMARK;
|
||||
role_table[ATK_ROLE_LOG] = ATSPI_ROLE_LOG;
|
||||
role_table[ATK_ROLE_MARQUEE] = ATSPI_ROLE_MARQUEE;
|
||||
role_table[ATK_ROLE_MATH] = ATSPI_ROLE_MATH;
|
||||
role_table[ATK_ROLE_RATING] = ATSPI_ROLE_RATING;
|
||||
role_table[ATK_ROLE_TIMER] = ATSPI_ROLE_TIMER;
|
||||
role_table[ATK_ROLE_STATIC] = ATSPI_ROLE_STATIC;
|
||||
role_table[ATK_ROLE_MATH_FRACTION] = ATSPI_ROLE_MATH_FRACTION;
|
||||
role_table[ATK_ROLE_MATH_ROOT] = ATSPI_ROLE_MATH_ROOT;
|
||||
role_table[ATK_ROLE_SUBSCRIPT] = ATSPI_ROLE_SUBSCRIPT;
|
||||
role_table[ATK_ROLE_SUPERSCRIPT] = ATSPI_ROLE_SUPERSCRIPT;
|
||||
role_table[ATK_ROLE_DESCRIPTION_LIST] = ATSPI_ROLE_DESCRIPTION_LIST;
|
||||
role_table[ATK_ROLE_DESCRIPTION_TERM] = ATSPI_ROLE_DESCRIPTION_TERM;
|
||||
role_table[ATK_ROLE_DESCRIPTION_VALUE] = ATSPI_ROLE_DESCRIPTION_VALUE;
|
||||
role_table[ATK_ROLE_FOOTNOTE] = ATSPI_ROLE_FOOTNOTE;
|
||||
role_table[ATK_ROLE_CONTENT_DELETION] = ATSPI_ROLE_CONTENT_DELETION;
|
||||
role_table[ATK_ROLE_CONTENT_INSERTION] = ATSPI_ROLE_CONTENT_INSERTION;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AtspiRole
|
||||
spi_accessible_role_from_atk_role (AtkRole role)
|
||||
{
|
||||
static gboolean is_initialized = FALSE;
|
||||
static AtspiRole spi_role_table[ATK_ROLE_LAST_DEFINED];
|
||||
AtspiRole spi_role;
|
||||
|
||||
if (!is_initialized)
|
||||
{
|
||||
is_initialized = init_role_lookup_table (spi_role_table);
|
||||
}
|
||||
|
||||
if (role >= 0 && role < ATK_ROLE_LAST_DEFINED)
|
||||
{
|
||||
spi_role = spi_role_table[role];
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_role = ATSPI_ROLE_EXTENDED;
|
||||
}
|
||||
return spi_role;
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008, 2009, 2010 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ACCESSIBLE_OBJECT_H
|
||||
#define ACCESSIBLE_OBJECT_H
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
void
|
||||
spi_object_lease_if_needed (GObject *obj);
|
||||
|
||||
void
|
||||
spi_object_append_reference (DBusMessageIter * iter, AtkObject * obj);
|
||||
|
||||
void
|
||||
spi_hyperlink_append_reference (DBusMessageIter * iter, AtkObject * obj);
|
||||
|
||||
void
|
||||
spi_object_append_v_reference (DBusMessageIter * iter, AtkObject * obj);
|
||||
|
||||
void
|
||||
spi_object_append_desktop_reference (DBusMessageIter * iter);
|
||||
|
||||
void
|
||||
spi_object_append_null_reference (DBusMessageIter * iter);
|
||||
|
||||
DBusMessage *
|
||||
spi_object_return_reference (DBusMessage * msg, AtkObject * obj);
|
||||
|
||||
DBusMessage *
|
||||
spi_hyperlink_return_reference (DBusMessage * msg, AtkHyperlink * obj);
|
||||
|
||||
void
|
||||
spi_object_append_interfaces (DBusMessageIter * iter, AtkObject * obj);
|
||||
|
||||
void
|
||||
spi_object_append_attribute_set (DBusMessageIter * iter, AtkAttributeSet * attr);
|
||||
|
||||
AtspiRole
|
||||
spi_accessible_role_from_atk_role (AtkRole role);
|
||||
|
||||
#endif /* ACCESSIBLE_OBJECT_H */
|
|
@ -0,0 +1,289 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <atspi/atspi.h>
|
||||
|
||||
DBusMessage *
|
||||
spi_dbus_general_error (DBusMessage * message)
|
||||
{
|
||||
return dbus_message_new_error (message,
|
||||
"org.a11y.atspi.GeneralError",
|
||||
"General error");
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
spi_dbus_return_rect (DBusMessage * message, gint ix, gint iy, gint iwidth,
|
||||
gint iheight)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
dbus_uint32_t x, y, width, height;
|
||||
|
||||
x = ix;
|
||||
y = iy;
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (reply)
|
||||
{
|
||||
DBusMessageIter iter, sub;
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_STRUCT, NULL, &sub))
|
||||
goto oom;
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &x);
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &y);
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &width);
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &height);
|
||||
if (!dbus_message_iter_close_container (&iter, &sub))
|
||||
goto oom;
|
||||
}
|
||||
return reply;
|
||||
oom:
|
||||
/* todo: return an error */
|
||||
return reply;
|
||||
}
|
||||
|
||||
void spi_dbus_emit_valist(DBusConnection *bus, const char *path, const char *interface, const char *name, int first_arg_type, va_list args)
|
||||
{
|
||||
DBusMessage *sig;
|
||||
|
||||
sig = dbus_message_new_signal(path, interface, name);
|
||||
if (first_arg_type != DBUS_TYPE_INVALID)
|
||||
{
|
||||
dbus_message_append_args_valist(sig, first_arg_type, args);
|
||||
}
|
||||
dbus_connection_send(bus, sig, NULL);
|
||||
dbus_message_unref(sig);
|
||||
}
|
||||
|
||||
dbus_bool_t spi_dbus_message_iter_get_struct(DBusMessageIter *iter, ...)
|
||||
{
|
||||
va_list args;
|
||||
DBusMessageIter iter_struct;
|
||||
int type;
|
||||
void *ptr;
|
||||
|
||||
dbus_message_iter_recurse(iter, &iter_struct);
|
||||
va_start(args, iter);
|
||||
for (;;)
|
||||
{
|
||||
type = va_arg(args, int);
|
||||
if (type == DBUS_TYPE_INVALID) break;
|
||||
if (type != dbus_message_iter_get_arg_type(&iter_struct))
|
||||
{
|
||||
va_end(args);
|
||||
return FALSE;
|
||||
}
|
||||
ptr = va_arg(args, void *);
|
||||
dbus_message_iter_get_basic(&iter_struct, ptr);
|
||||
dbus_message_iter_next(&iter_struct);
|
||||
}
|
||||
dbus_message_iter_next(iter);
|
||||
va_end(args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t spi_dbus_message_iter_append_struct(DBusMessageIter *iter, ...)
|
||||
{
|
||||
va_list args;
|
||||
DBusMessageIter iter_struct;
|
||||
int type;
|
||||
void *ptr;
|
||||
|
||||
if (!dbus_message_iter_open_container(iter, DBUS_TYPE_STRUCT, NULL, &iter_struct)) return FALSE;
|
||||
va_start(args, iter);
|
||||
for (;;)
|
||||
{
|
||||
type = va_arg(args, int);
|
||||
if (type == DBUS_TYPE_INVALID) break;
|
||||
ptr = va_arg(args, void *);
|
||||
dbus_message_iter_append_basic(&iter_struct, type, ptr);
|
||||
}
|
||||
va_end(args);
|
||||
if (!dbus_message_iter_close_container(iter, &iter_struct)) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t spi_dbus_marshal_deviceEvent(DBusMessage *message, const AtspiDeviceEvent *e)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
if (!message) return FALSE;
|
||||
dbus_message_iter_init_append(message, &iter);
|
||||
return spi_dbus_message_iter_append_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
dbus_bool_t spi_dbus_demarshal_deviceEvent(DBusMessage *message, AtspiDeviceEvent *e)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
dbus_message_iter_init(message, &iter);
|
||||
return spi_dbus_message_iter_get_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a rather annoying function needed to replace
|
||||
* NULL values of strings with the empty string. Null string
|
||||
* values can be created by the atk_object_get_name or text selection
|
||||
*/
|
||||
static const void *
|
||||
provide_defaults(const gint type,
|
||||
const void *val)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DBUS_TYPE_STRING:
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
if (!val)
|
||||
return "";
|
||||
else
|
||||
return val;
|
||||
default:
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Appends all the standard parameters to an AT-SPI event.
|
||||
*/
|
||||
void
|
||||
spi_dbus_signal_new (const char *path,
|
||||
const char *klass,
|
||||
const char *major,
|
||||
const char *minor,
|
||||
dbus_int32_t detail1,
|
||||
dbus_int32_t detail2)
|
||||
{
|
||||
DBusMessage *sig;
|
||||
DBusMessageIter iter;
|
||||
gchar *cname, *t;
|
||||
|
||||
if (!klass) klass = "";
|
||||
if (!major) major = "";
|
||||
if (!minor) minor = "";
|
||||
|
||||
/*
|
||||
* This is very annoying, but as '-' isn't a legal signal
|
||||
* name in D-Bus (Why not??!?) The names need converting
|
||||
* on this side, and again on the client side.
|
||||
*/
|
||||
cname = g_strdup(major);
|
||||
while ((t = strchr(cname, '-')) != NULL) *t = '_';
|
||||
|
||||
sig = dbus_message_new_signal(path, klass, cname);
|
||||
g_free(cname);
|
||||
|
||||
dbus_message_iter_init_append(sig, &iter);
|
||||
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
|
||||
}
|
||||
|
||||
void
|
||||
spi_dbus_emit_signal(DBusConnection *bus, const char *path,
|
||||
const char *klass,
|
||||
const char *major,
|
||||
const char *minor,
|
||||
dbus_int32_t detail1,
|
||||
dbus_int32_t detail2,
|
||||
const char *type,
|
||||
const void *val)
|
||||
{
|
||||
gchar *cname, *t;
|
||||
DBusMessage *sig;
|
||||
DBusMessageIter iter, sub;
|
||||
if (!klass) klass = "";
|
||||
if (!major) major = "";
|
||||
if (!minor) minor = "";
|
||||
if (!type) type = "u";
|
||||
|
||||
/*
|
||||
* This is very annoying, but as '-' isn't a legal signal
|
||||
* name in D-Bus (Why not??!?) The names need converting
|
||||
* on this side, and again on the client side.
|
||||
*/
|
||||
cname = g_strdup(major);
|
||||
while ((t = strchr(cname, '-')) != NULL) *t = '_';
|
||||
|
||||
sig = dbus_message_new_signal(path, klass, cname);
|
||||
g_free(cname);
|
||||
|
||||
dbus_message_iter_init_append(sig, &iter);
|
||||
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
|
||||
|
||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, type, &sub);
|
||||
/*
|
||||
* I need to convert the string signature to an integer type signature.
|
||||
* DBUS_TYPE_INT32 is defined as 'i' whereas the string is "i".
|
||||
* I should just be able to cast the first character of the string to an
|
||||
* integer.
|
||||
*/
|
||||
val = provide_defaults((int) *type, val);
|
||||
dbus_message_iter_append_basic(&sub, (int) *type, &val);
|
||||
dbus_message_iter_close_container(&iter, &sub);
|
||||
|
||||
dbus_connection_send(bus, sig, NULL);
|
||||
dbus_message_unref(sig);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error)
|
||||
{
|
||||
DBusMessage *message, *reply;
|
||||
DBusMessageIter iter, iter_variant;
|
||||
int typ;
|
||||
|
||||
dbus_error_init (error);
|
||||
message = dbus_message_new_method_call (dest, path, "org.freedesktop.DBus.Properties", "get");
|
||||
if (!message) return FALSE;
|
||||
if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &prop, DBUS_TYPE_INVALID))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
reply = dbus_connection_send_with_reply_and_block (bus, message, 1000, error);
|
||||
dbus_message_unref (message);
|
||||
if (!reply) return FALSE;
|
||||
dbus_message_iter_init (reply, &iter);
|
||||
dbus_message_iter_recurse (&iter, &iter_variant);
|
||||
typ = dbus_message_iter_get_arg_type (&iter_variant);
|
||||
if (type) *type = typ;
|
||||
if (typ == DBUS_TYPE_INVALID || typ == DBUS_TYPE_STRUCT || typ == DBUS_TYPE_ARRAY)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_get_basic (&iter_variant, ptr);
|
||||
dbus_message_unref (reply);
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
||||
* Copyright 2001, 2002 Ximian, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef SPI_DBUS_H_
|
||||
#define SPI_DBUS_H_
|
||||
|
||||
#include <glib.h>
|
||||
#include <atspi/atspi.h>
|
||||
|
||||
#define DBG(a,b) if(_dbg>=(a))b
|
||||
|
||||
extern int _dbg;
|
||||
|
||||
#define SPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
|
||||
#define SPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry"
|
||||
#define SPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry"
|
||||
|
||||
#define SPI_DBUS_PATH_NULL "/org/a11y/atspi/null"
|
||||
#define SPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root"
|
||||
|
||||
DBusMessage *spi_dbus_general_error(DBusMessage *message);
|
||||
DBusMessage *spi_dbus_return_rect(DBusMessage *message, gint ix, gint iy, gint iwidth, gint iheight);
|
||||
|
||||
void spi_dbus_emit_valist(DBusConnection *bus, const char *path, const char *interface, const char *name, int first_arg_type, va_list args);
|
||||
dbus_bool_t spi_dbus_message_iter_get_struct(DBusMessageIter *iter, ...);
|
||||
dbus_bool_t spi_dbus_message_iter_append_struct(DBusMessageIter *iter, ...);
|
||||
dbus_bool_t spi_dbus_marshal_deviceEvent(DBusMessage *message, const AtspiDeviceEvent *e);
|
||||
dbus_bool_t spi_dbus_demarshal_deviceEvent(DBusMessage *message, AtspiDeviceEvent *e);
|
||||
dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error);
|
||||
void spi_dbus_emit_signal(DBusConnection *bus, const char *path, const char *klass, const char *major, const char *minor, dbus_int32_t detail1, dbus_int32_t detail2, const char *type, const void *val);
|
||||
/*
|
||||
void spi_dbus_add_disconnect_match (DBusConnection *bus, const char *name);
|
||||
void spi_dbus_remove_disconnect_match (DBusConnection *bus, const char *name);
|
||||
*/
|
||||
|
||||
#endif /* SPI_DBUS_H_ */
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "droute-pairhash.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static guint
|
||||
str_hash (guint32 h, const char *p)
|
||||
{
|
||||
for (p += 1; *p != '\0'; p++)
|
||||
h = (h << 5) - h + *p;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
StrPair *
|
||||
str_pair_new (const gchar *one, const gchar *two)
|
||||
{
|
||||
StrPair *pair;
|
||||
|
||||
pair = g_new (StrPair, 1);
|
||||
pair->one = one;
|
||||
pair->two = two;
|
||||
return pair;
|
||||
}
|
||||
|
||||
guint
|
||||
str_pair_hash (gconstpointer key)
|
||||
{
|
||||
StrPair *pair = (StrPair *) key;
|
||||
guint hash = 0;
|
||||
|
||||
/*g_return_val_if_fail (pair != NULL, 0);
|
||||
g_return_val_if_fail (pair->one != NULL, 0);
|
||||
g_return_val_if_fail (pair->two != NULL, 0);
|
||||
*/
|
||||
|
||||
if (*(pair->two) != '\0')
|
||||
{
|
||||
hash = *(pair->two);
|
||||
hash = str_hash (hash, pair->two);
|
||||
hash = str_hash (hash, pair->one);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
gboolean
|
||||
str_pair_equal (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
StrPair *ap = (StrPair *) a;
|
||||
StrPair *bp = (StrPair *) b;
|
||||
|
||||
if (g_str_equal (ap->one, bp->one) &&
|
||||
g_str_equal (ap->two, bp->two))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef _DROUTE_PAIRHASH_H
|
||||
#define _DROUTE_PAIRHASH_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _StrPair StrPair;
|
||||
struct _StrPair
|
||||
{
|
||||
const gchar *one;
|
||||
const gchar *two;
|
||||
};
|
||||
|
||||
StrPair *str_pair_new (const gchar *one,
|
||||
const gchar *two);
|
||||
|
||||
guint str_pair_hash (gconstpointer key);
|
||||
gboolean str_pair_equal (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
#endif /* _DROUTE_PAIRHASH_H */
|
|
@ -0,0 +1,307 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <droute/droute.h>
|
||||
|
||||
#include "atspi/atspi.h"
|
||||
|
||||
#define TEST_OBJECT_PATH "/test/object"
|
||||
#define TEST_INTERFACE_ONE "test.interface.One"
|
||||
#define TEST_INTERFACE_TWO "test.interface.Two"
|
||||
|
||||
#define OBJECT_ONE "ObjectOne";
|
||||
#define OBJECT_TWO "ObjectTwo";
|
||||
|
||||
#define STRING_ONE "StringOne"
|
||||
#define STRING_TWO "StringTwo"
|
||||
|
||||
#define INT_ONE 0
|
||||
#define INT_TWO 456
|
||||
|
||||
#define NONE_REPLY_STRING "NoneMethod"
|
||||
|
||||
const gchar *test_interface_One = \
|
||||
"<interface name=\"test.interface.One\">"
|
||||
" <method name=\"null\"/>"
|
||||
" <method name=\"getInt\">"
|
||||
" <arg direction=\"out\" type=\"o\"/>"
|
||||
" </method>"
|
||||
" <method name=\"setInt\">"
|
||||
" <arg direction=\"in\" type=\"o\"/>"
|
||||
" </method>"
|
||||
" <method name=\"getString\">"
|
||||
" <arg direction=\"out\" type=\"s\"/>"
|
||||
" </method>"
|
||||
" <method name=\"setString\">"
|
||||
" <arg direction=\"in\" type=\"s\"/>"
|
||||
" </method>"
|
||||
"</interface>";
|
||||
|
||||
const gchar *test_interface_Two = \
|
||||
"<interface name=\"test.interface.One\">"
|
||||
" <method name=\"null\"/>"
|
||||
" <method name=\"getInt\">"
|
||||
" <arg direction=\"out\" type=\"o\"/>"
|
||||
" </method>"
|
||||
" <method name=\"setInt\">"
|
||||
" <arg direction=\"in\" type=\"o\"/>"
|
||||
" </method>"
|
||||
" <method name=\"getString\">"
|
||||
" <arg direction=\"out\" type=\"s\"/>"
|
||||
" </method>"
|
||||
" <method name=\"setString\">"
|
||||
" <arg direction=\"in\" type=\"s\"/>"
|
||||
" </method>"
|
||||
"</interface>";
|
||||
|
||||
typedef struct _AnObject
|
||||
{
|
||||
gchar *astring;
|
||||
guint *anint;
|
||||
} AnObject;
|
||||
|
||||
static DBusConnection *bus;
|
||||
static GMainLoop *main_loop;
|
||||
static gboolean success = TRUE;
|
||||
|
||||
static DBusMessage *
|
||||
impl_null (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_getInt (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
AnObject *object = (AnObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_INT32, &(object->anint), DBUS_TYPE_INVALID);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_setInt (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
AnObject *object = (AnObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &(object->anint), DBUS_TYPE_INVALID);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_getString (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
AnObject *object = (AnObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &(object->astring), DBUS_TYPE_INVALID);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_setString (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
AnObject *object = (AnObject *) user_data;
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
g_free (object->astring);
|
||||
dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &(object->astring), DBUS_TYPE_INVALID);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_getInterfaceOne (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
gchar *itf = TEST_INTERFACE_ONE;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &itf, DBUS_TYPE_INVALID);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_getInterfaceTwo (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
gchar *itf = TEST_INTERFACE_TWO;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &itf, DBUS_TYPE_INVALID);
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DRouteMethod test_methods_one[] = {
|
||||
{impl_null, "null"},
|
||||
{impl_getInt, "getInt"},
|
||||
{impl_setInt, "setInt"},
|
||||
{impl_getString, "getString"},
|
||||
{impl_setString, "setString"},
|
||||
{impl_getInterfaceOne, "getInterfaceOne"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteMethod test_methods_two[] = {
|
||||
{impl_null, "null"},
|
||||
{impl_getInt, "getInt"},
|
||||
{impl_setInt, "setInt"},
|
||||
{impl_getString, "getString"},
|
||||
{impl_setString, "setString"},
|
||||
{impl_getInterfaceTwo, "getInterfaceTwo"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static DRouteProperty test_properties[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
set_reply (DBusPendingCall *pending, void *user_data)
|
||||
{
|
||||
void **replyptr = (void **)user_data;
|
||||
|
||||
*replyptr = dbus_pending_call_steal_reply (pending);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, DBusError *error)
|
||||
{
|
||||
DBusPendingCall *pending;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
if (!dbus_connection_send_with_reply (bus, message, &pending, -1))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
dbus_pending_call_set_notify (pending, set_reply, (void *)&reply, NULL);
|
||||
while (!reply)
|
||||
{
|
||||
if (!dbus_connection_read_write_dispatch (bus, -1))
|
||||
return NULL;
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
gboolean
|
||||
do_tests_func (gpointer data)
|
||||
{
|
||||
DBusError error;
|
||||
const gchar *bus_name;
|
||||
DBusMessage *message, *reply;
|
||||
|
||||
gchar *expected_string;
|
||||
gchar *result_string;
|
||||
|
||||
dbus_error_init (&error);
|
||||
bus_name = dbus_bus_get_unique_name (bus);
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
|
||||
message = dbus_message_new_method_call (bus_name,
|
||||
TEST_OBJECT_PATH,
|
||||
TEST_INTERFACE_ONE,
|
||||
"null");
|
||||
reply = send_and_allow_reentry (bus, message, NULL);
|
||||
dbus_message_unref (message);
|
||||
if (reply)
|
||||
dbus_message_unref (reply);
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
|
||||
expected_string = TEST_INTERFACE_ONE;
|
||||
result_string = NULL;
|
||||
message = dbus_message_new_method_call (bus_name,
|
||||
TEST_OBJECT_PATH,
|
||||
TEST_INTERFACE_ONE,
|
||||
"getInterfaceOne");
|
||||
reply = send_and_allow_reentry (bus, message, NULL);
|
||||
dbus_message_unref (message);
|
||||
dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &result_string,
|
||||
DBUS_TYPE_INVALID);
|
||||
dbus_message_unref (reply);
|
||||
if (g_strcmp0(expected_string, result_string))
|
||||
{
|
||||
g_print ("Failed: reply to getInterfaceOne was %s; expected %s\n",
|
||||
result_string, expected_string);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
|
||||
g_main_loop_quit (main_loop);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
DRouteContext *cnx;
|
||||
DRoutePath *path;
|
||||
AnObject *object;
|
||||
DBusError error;
|
||||
|
||||
/* Setup some server object */
|
||||
|
||||
object = g_new0(AnObject, 1);
|
||||
object->astring = g_strdup (STRING_ONE);
|
||||
object->anint = INT_ONE;
|
||||
|
||||
dbus_error_init (&error);
|
||||
main_loop = g_main_loop_new(NULL, FALSE);
|
||||
bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
|
||||
atspi_dbus_connection_setup_with_g_main(bus, g_main_context_default());
|
||||
|
||||
cnx = droute_new ();
|
||||
path = droute_add_one (cnx, TEST_OBJECT_PATH, object);
|
||||
|
||||
droute_path_add_interface (path,
|
||||
TEST_INTERFACE_ONE,
|
||||
test_interface_One,
|
||||
test_methods_one,
|
||||
test_properties);
|
||||
|
||||
droute_path_add_interface (path,
|
||||
TEST_INTERFACE_TWO,
|
||||
test_interface_Two,
|
||||
test_methods_two,
|
||||
test_properties);
|
||||
|
||||
droute_path_register (path, bus);
|
||||
|
||||
g_idle_add (do_tests_func, NULL);
|
||||
g_main_loop_run(main_loop);
|
||||
if (success)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "glib.h"
|
||||
|
||||
#include "droute-variant.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
dbus_bool_t
|
||||
droute_return_v_int32 (DBusMessageIter *iter, dbus_int32_t val)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
|
||||
if (!dbus_message_iter_open_container
|
||||
(iter, DBUS_TYPE_VARIANT, DBUS_TYPE_INT32_AS_STRING, &sub))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &val);
|
||||
dbus_message_iter_close_container (iter, &sub);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
droute_return_v_double (DBusMessageIter *iter, double val)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
|
||||
if (!dbus_message_iter_open_container
|
||||
(iter, DBUS_TYPE_VARIANT, DBUS_TYPE_DOUBLE_AS_STRING, &sub))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_DOUBLE, &val);
|
||||
dbus_message_iter_close_container (iter, &sub);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
droute_return_v_string (DBusMessageIter *iter, const char *val)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
|
||||
if (!val)
|
||||
val = "";
|
||||
if (!g_utf8_validate (val, -1, NULL))
|
||||
{
|
||||
g_warning ("droute: Received bad UTF-8 string");
|
||||
val = "";
|
||||
}
|
||||
|
||||
if (!dbus_message_iter_open_container
|
||||
(iter, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &sub))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING, &val);
|
||||
dbus_message_iter_close_container (iter, &sub);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
droute_return_v_object (DBusMessageIter *iter, const char *path)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
|
||||
if (!dbus_message_iter_open_container
|
||||
(iter, DBUS_TYPE_VARIANT, DBUS_TYPE_OBJECT_PATH_AS_STRING, &sub))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
dbus_message_iter_append_basic (&sub, DBUS_TYPE_OBJECT_PATH, &path);
|
||||
dbus_message_iter_close_container (iter, &sub);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
dbus_int32_t
|
||||
droute_get_v_int32 (DBusMessageIter *iter)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
dbus_int32_t rv;
|
||||
|
||||
// TODO- ensure we have the correct type
|
||||
dbus_message_iter_recurse (iter, &sub);
|
||||
dbus_message_iter_get_basic (&sub, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
const char *
|
||||
droute_get_v_string (DBusMessageIter *iter)
|
||||
{
|
||||
DBusMessageIter sub;
|
||||
char *rv;
|
||||
|
||||
// TODO- ensure we have the correct type
|
||||
dbus_message_iter_recurse (iter, &sub);
|
||||
dbus_message_iter_get_basic (&sub, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef _DROUTE_VARIANT_H
|
||||
#define _DROUTE_VARIANT_H
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
dbus_bool_t droute_return_v_int32 (DBusMessageIter *iter, dbus_int32_t val);
|
||||
dbus_bool_t droute_return_v_double (DBusMessageIter *iter, double val);
|
||||
dbus_bool_t droute_return_v_string (DBusMessageIter *iter, const char *val);
|
||||
dbus_bool_t droute_return_v_object (DBusMessageIter *iter, const char *path);
|
||||
|
||||
dbus_int32_t droute_get_v_int32 (DBusMessageIter *iter);
|
||||
const char *droute_get_v_string (DBusMessageIter *iter);
|
||||
|
||||
#endif /* _DROUTE_VARIANT_H */
|
|
@ -0,0 +1,743 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "droute.h"
|
||||
#include "droute-pairhash.h"
|
||||
|
||||
#define CHUNKS_DEFAULT (512)
|
||||
|
||||
#define oom() g_error ("D-Bus out of memory, this message will fail anyway")
|
||||
|
||||
#if defined DROUTE_DEBUG
|
||||
#define _DROUTE_DEBUG(format, args...) g_print (format , ## args)
|
||||
#else
|
||||
#define _DROUTE_DEBUG(format, args...)
|
||||
#endif
|
||||
|
||||
struct _DRouteContext
|
||||
{
|
||||
GPtrArray *registered_paths;
|
||||
|
||||
gchar *introspect_string;
|
||||
};
|
||||
|
||||
struct _DRoutePath
|
||||
{
|
||||
DRouteContext *cnx;
|
||||
gchar *path;
|
||||
gboolean prefix;
|
||||
GStringChunk *chunks;
|
||||
GPtrArray *interfaces;
|
||||
GPtrArray *introspection;
|
||||
GHashTable *methods;
|
||||
GHashTable *properties;
|
||||
|
||||
DRouteIntrospectChildrenFunction introspect_children_cb;
|
||||
void *introspect_children_data;
|
||||
void *user_data;
|
||||
DRouteGetDatumFunction get_datum;
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct PropertyPair
|
||||
{
|
||||
DRoutePropertyFunction get;
|
||||
DRoutePropertyFunction set;
|
||||
} PropertyPair;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_message (DBusConnection *bus, DBusMessage *message, void *user_data);
|
||||
|
||||
static DBusMessage *
|
||||
droute_object_does_not_exist_error (DBusMessage *message);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DRoutePath *
|
||||
path_new (DRouteContext *cnx,
|
||||
const char *path,
|
||||
gboolean prefix,
|
||||
void *user_data,
|
||||
DRouteIntrospectChildrenFunction introspect_children_cb,
|
||||
void *introspect_children_data,
|
||||
DRouteGetDatumFunction get_datum)
|
||||
{
|
||||
DRoutePath *new_path;
|
||||
|
||||
new_path = g_new0 (DRoutePath, 1);
|
||||
new_path->cnx = cnx;
|
||||
new_path->path = g_strdup (path);
|
||||
new_path->prefix = prefix;
|
||||
new_path->chunks = g_string_chunk_new (CHUNKS_DEFAULT);
|
||||
new_path->interfaces = g_ptr_array_new ();
|
||||
new_path->introspection = g_ptr_array_new ();
|
||||
|
||||
new_path->methods = g_hash_table_new_full ((GHashFunc)str_pair_hash,
|
||||
str_pair_equal,
|
||||
g_free,
|
||||
NULL);
|
||||
|
||||
new_path->properties = g_hash_table_new_full ((GHashFunc)str_pair_hash,
|
||||
str_pair_equal,
|
||||
g_free,
|
||||
g_free);
|
||||
|
||||
new_path->introspect_children_cb = introspect_children_cb;
|
||||
new_path->introspect_children_data = introspect_children_data;
|
||||
new_path->user_data = user_data;
|
||||
new_path->get_datum = get_datum;
|
||||
|
||||
return new_path;
|
||||
}
|
||||
|
||||
static void
|
||||
path_free (DRoutePath *path, gpointer user_data)
|
||||
{
|
||||
g_free (path->path);
|
||||
g_string_chunk_free (path->chunks);
|
||||
g_ptr_array_free (path->interfaces, TRUE);
|
||||
g_free(g_ptr_array_free (path->introspection, FALSE));
|
||||
g_hash_table_destroy (path->methods);
|
||||
g_hash_table_destroy (path->properties);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static void *
|
||||
path_get_datum (DRoutePath *path, const gchar *pathstr)
|
||||
{
|
||||
if (path->get_datum != NULL)
|
||||
return (path->get_datum) (pathstr, path->user_data);
|
||||
else
|
||||
return path->user_data;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
DRouteContext *
|
||||
droute_new ()
|
||||
{
|
||||
DRouteContext *cnx;
|
||||
|
||||
cnx = g_new0 (DRouteContext, 1);
|
||||
cnx->registered_paths = g_ptr_array_new ();
|
||||
|
||||
return cnx;
|
||||
}
|
||||
|
||||
void
|
||||
droute_free (DRouteContext *cnx)
|
||||
{
|
||||
g_ptr_array_foreach (cnx->registered_paths, (GFunc) path_free, NULL);
|
||||
g_ptr_array_free (cnx->registered_paths, TRUE);
|
||||
g_free (cnx);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusObjectPathVTable droute_vtable =
|
||||
{
|
||||
NULL,
|
||||
&handle_message,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
DRoutePath *
|
||||
droute_add_one (DRouteContext *cnx,
|
||||
const char *path,
|
||||
const void *data)
|
||||
{
|
||||
DRoutePath *new_path;
|
||||
|
||||
new_path = path_new (cnx, path, FALSE, (void *)data, NULL, NULL, NULL);
|
||||
|
||||
g_ptr_array_add (cnx->registered_paths, new_path);
|
||||
return new_path;
|
||||
}
|
||||
|
||||
DRoutePath *
|
||||
droute_add_many (DRouteContext *cnx,
|
||||
const char *path,
|
||||
const void *data,
|
||||
DRouteIntrospectChildrenFunction introspect_children_cb,
|
||||
void *introspect_children_data,
|
||||
const DRouteGetDatumFunction get_datum)
|
||||
{
|
||||
DRoutePath *new_path;
|
||||
|
||||
new_path = path_new (cnx, path, TRUE, (void *) data,
|
||||
introspect_children_cb, introspect_children_data,
|
||||
get_datum);
|
||||
|
||||
g_ptr_array_add (cnx->registered_paths, new_path);
|
||||
return new_path;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
droute_path_add_interface(DRoutePath *path,
|
||||
const char *name,
|
||||
const char *introspect,
|
||||
const DRouteMethod *methods,
|
||||
const DRouteProperty *properties)
|
||||
{
|
||||
gchar *itf;
|
||||
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
itf = g_string_chunk_insert (path->chunks, name);
|
||||
g_ptr_array_add (path->interfaces, itf);
|
||||
g_ptr_array_add (path->introspection, (gpointer) introspect);
|
||||
|
||||
for (; methods != NULL && methods->name != NULL; methods++)
|
||||
{
|
||||
gchar *meth;
|
||||
|
||||
meth = g_string_chunk_insert (path->chunks, methods->name);
|
||||
g_hash_table_insert (path->methods, str_pair_new (itf, meth), methods->func);
|
||||
}
|
||||
|
||||
for (; properties != NULL && properties->name != NULL; properties++)
|
||||
{
|
||||
gchar *prop;
|
||||
PropertyPair *pair;
|
||||
|
||||
prop = g_string_chunk_insert (path->chunks, properties->name);
|
||||
pair = g_new (PropertyPair, 1);
|
||||
pair->get = properties->get;
|
||||
pair->set = properties->set;
|
||||
g_hash_table_insert (path->properties, str_pair_new (itf, prop), pair);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* The data structures don't support an efficient implementation of GetAll
|
||||
* and I don't really care.
|
||||
*/
|
||||
static DBusMessage *
|
||||
impl_prop_GetAll (DBusMessage *message,
|
||||
DRoutePath *path,
|
||||
const char *pathstr)
|
||||
{
|
||||
DBusMessageIter iter, iter_dict, iter_dict_entry;
|
||||
DBusMessage *reply;
|
||||
DBusError error;
|
||||
GHashTableIter prop_iter;
|
||||
|
||||
StrPair *key;
|
||||
PropertyPair *value;
|
||||
gchar *iface;
|
||||
|
||||
void *datum = path_get_datum (path, pathstr);
|
||||
if (!datum)
|
||||
return droute_object_does_not_exist_error (message);
|
||||
|
||||
dbus_error_init (&error);
|
||||
if (!dbus_message_get_args
|
||||
(message, &error, DBUS_TYPE_STRING, &iface, DBUS_TYPE_INVALID))
|
||||
{
|
||||
DBusMessage *ret;
|
||||
ret = dbus_message_new_error (message, DBUS_ERROR_FAILED, error.message);
|
||||
dbus_error_free (&error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
oom ();
|
||||
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter, DBUS_TYPE_ARRAY, "{sv}", &iter_dict))
|
||||
oom ();
|
||||
|
||||
g_hash_table_iter_init (&prop_iter, path->properties);
|
||||
while (g_hash_table_iter_next (&prop_iter, (gpointer*)&key, (gpointer*)&value))
|
||||
{
|
||||
if (!g_strcmp0 (key->one, iface))
|
||||
{
|
||||
if (!value->get)
|
||||
continue;
|
||||
if (!dbus_message_iter_open_container
|
||||
(&iter_dict, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict_entry))
|
||||
oom ();
|
||||
dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING,
|
||||
&key->two);
|
||||
(value->get) (&iter_dict_entry, datum);
|
||||
if (!dbus_message_iter_close_container (&iter_dict, &iter_dict_entry))
|
||||
oom ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!dbus_message_iter_close_container (&iter, &iter_dict))
|
||||
oom ();
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
impl_prop_GetSet (DBusMessage *message,
|
||||
DRoutePath *path,
|
||||
const char *pathstr,
|
||||
gboolean get)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
DBusError error;
|
||||
|
||||
StrPair pair;
|
||||
PropertyPair *prop_funcs = NULL;
|
||||
|
||||
void *datum;
|
||||
|
||||
dbus_error_init (&error);
|
||||
if (!dbus_message_get_args (message,
|
||||
&error,
|
||||
DBUS_TYPE_STRING,
|
||||
&(pair.one),
|
||||
DBUS_TYPE_STRING,
|
||||
&(pair.two),
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
DBusMessage *ret;
|
||||
ret = dbus_message_new_error (message, DBUS_ERROR_FAILED, error.message);
|
||||
dbus_error_free (&error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle prop): %s|%s on %s\n", pair.one, pair.two, pathstr);
|
||||
|
||||
prop_funcs = (PropertyPair *) g_hash_table_lookup (path->properties, &pair);
|
||||
if (!prop_funcs)
|
||||
{
|
||||
DBusMessage *ret;
|
||||
#ifdef DBUS_ERROR_UNKNOWN_PROPERTY
|
||||
ret = dbus_message_new_error (message, DBUS_ERROR_UNKNOWN_PROPERTY, "Property unavailable");
|
||||
#else
|
||||
ret = dbus_message_new_error (message, DBUS_ERROR_FAILED, "Property unavailable");
|
||||
#endif
|
||||
dbus_error_free (&error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
datum = path_get_datum (path, pathstr);
|
||||
if (!datum)
|
||||
return droute_object_does_not_exist_error (message);
|
||||
|
||||
if (get && prop_funcs->get)
|
||||
{
|
||||
|
||||
DBusMessageIter iter;
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle prop Get): %s|%s on %s\n", pair.one, pair.two, pathstr);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_iter_init_append (reply, &iter);
|
||||
if (!(prop_funcs->get) (&iter, datum))
|
||||
{
|
||||
dbus_message_unref (reply);
|
||||
reply = dbus_message_new_error (message, DBUS_ERROR_FAILED, "Get failed");
|
||||
}
|
||||
}
|
||||
else if (!get && prop_funcs->set)
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle prop Get): %s|%s on %s\n", pair.one, pair.two, pathstr);
|
||||
|
||||
dbus_message_iter_init (message, &iter);
|
||||
/* Skip the interface and property name */
|
||||
dbus_message_iter_next(&iter);
|
||||
dbus_message_iter_next(&iter);
|
||||
(prop_funcs->set) (&iter, datum);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
}
|
||||
#ifdef DBUS_ERROR_PROPERTY_READ_ONLY
|
||||
else if (!get)
|
||||
{
|
||||
reply = dbus_message_new_error (message, DBUS_ERROR_PROPERTY_READ_ONLY, "Property is read-only");
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
reply = dbus_message_new_error (message, DBUS_ERROR_FAILED, "Getter or setter unavailable");
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_dbus (DBusConnection *bus,
|
||||
DBusMessage *message,
|
||||
const gchar *iface,
|
||||
const gchar *member,
|
||||
const gchar *pathstr)
|
||||
{
|
||||
static int id = 1;
|
||||
char *id_str = (char *) g_malloc(40);
|
||||
DBusMessage *reply;
|
||||
|
||||
if (strcmp (iface, DBUS_INTERFACE_DBUS) != 0 ||
|
||||
strcmp (member, "Hello") != 0)
|
||||
{
|
||||
g_free (id_str);
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
/* TODO: Fix this hack (we don't handle wrap-around, for instance) */
|
||||
sprintf (id_str, ":1.%d", id++);
|
||||
reply = dbus_message_new_method_return (message);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_STRING, &id_str, DBUS_TYPE_INVALID);
|
||||
dbus_connection_send (bus, reply, NULL);
|
||||
dbus_connection_flush (bus);
|
||||
dbus_message_unref (reply);
|
||||
g_free (id_str);
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_properties (DBusConnection *bus,
|
||||
DBusMessage *message,
|
||||
DRoutePath *path,
|
||||
const gchar *iface,
|
||||
const gchar *member,
|
||||
const gchar *pathstr)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
DBusHandlerResult result = DBUS_HANDLER_RESULT_HANDLED;
|
||||
|
||||
if (!g_strcmp0(member, "GetAll"))
|
||||
reply = impl_prop_GetAll (message, path, pathstr);
|
||||
else if (!g_strcmp0 (member, "Get"))
|
||||
reply = impl_prop_GetSet (message, path, pathstr, TRUE);
|
||||
else if (!g_strcmp0 (member, "Set"))
|
||||
reply = impl_prop_GetSet (message, path, pathstr, FALSE);
|
||||
else
|
||||
result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
if (reply)
|
||||
{
|
||||
dbus_connection_send (bus, reply, NULL);
|
||||
dbus_message_unref (reply);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static const char *introspection_header =
|
||||
"<?xml version=\"1.0\"?>\n";
|
||||
|
||||
static const char *introspection_node_element =
|
||||
"<node name=\"%s\">\n";
|
||||
|
||||
static const char *introspection_footer =
|
||||
"</node>";
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_introspection (DBusConnection *bus,
|
||||
DBusMessage *message,
|
||||
DRoutePath *path,
|
||||
const gchar *iface,
|
||||
const gchar *member,
|
||||
const gchar *pathstr)
|
||||
{
|
||||
GString *output;
|
||||
gchar *final;
|
||||
gint i;
|
||||
|
||||
DBusMessage *reply;
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle introspection): %s\n", pathstr);
|
||||
|
||||
if (g_strcmp0 (member, "Introspect"))
|
||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
output = g_string_new(introspection_header);
|
||||
|
||||
g_string_append_printf(output, introspection_node_element, pathstr);
|
||||
|
||||
if (!path->get_datum || path_get_datum (path, pathstr))
|
||||
{
|
||||
for (i=0; i < path->introspection->len; i++)
|
||||
{
|
||||
gchar *introspect = (gchar *) g_ptr_array_index (path->introspection, i);
|
||||
g_string_append (output, introspect);
|
||||
}
|
||||
}
|
||||
|
||||
if (path->introspect_children_cb)
|
||||
{
|
||||
gchar *children = (*path->introspect_children_cb) (pathstr, path->introspect_children_data);
|
||||
if (children)
|
||||
{
|
||||
g_string_append (output, children);
|
||||
g_free (children);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append(output, introspection_footer);
|
||||
final = g_string_free(output, FALSE);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
oom ();
|
||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
|
||||
DBUS_TYPE_INVALID);
|
||||
dbus_connection_send (bus, reply, NULL);
|
||||
|
||||
dbus_message_unref (reply);
|
||||
g_free(final);
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_other (DBusConnection *bus,
|
||||
DBusMessage *message,
|
||||
DRoutePath *path,
|
||||
const gchar *iface,
|
||||
const gchar *member,
|
||||
const gchar *pathstr)
|
||||
{
|
||||
gint result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
StrPair pair;
|
||||
DRouteFunction func;
|
||||
DBusMessage *reply = NULL;
|
||||
|
||||
void *datum;
|
||||
|
||||
pair.one = iface;
|
||||
pair.two = member;
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle other): %s|%s on %s\n", member, iface, pathstr);
|
||||
|
||||
func = (DRouteFunction) g_hash_table_lookup (path->methods, &pair);
|
||||
if (func != NULL)
|
||||
{
|
||||
datum = path_get_datum (path, pathstr);
|
||||
if (!datum)
|
||||
reply = droute_object_does_not_exist_error (message);
|
||||
else
|
||||
reply = (func) (bus, message, datum);
|
||||
|
||||
/* All D-Bus method calls must have a reply.
|
||||
* If one is not provided presume that the caller has already
|
||||
* sent one.
|
||||
*/
|
||||
if (reply)
|
||||
{
|
||||
dbus_connection_send (bus, reply, NULL);
|
||||
dbus_message_unref (reply);
|
||||
}
|
||||
result = DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle other) (reply): type %d\n",
|
||||
dbus_message_get_type(reply));
|
||||
return result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_message (DBusConnection *bus, DBusMessage *message, void *user_data)
|
||||
{
|
||||
DRoutePath *path = (DRoutePath *) user_data;
|
||||
const gchar *iface = dbus_message_get_interface (message);
|
||||
const gchar *member = dbus_message_get_member (message);
|
||||
const gint type = dbus_message_get_type (message);
|
||||
const gchar *pathstr = dbus_message_get_path (message);
|
||||
|
||||
DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
_DROUTE_DEBUG ("DRoute (handle message): %s|%s of type %d on %s\n", member, iface, type, pathstr);
|
||||
|
||||
/* Check for basic reasons not to handle */
|
||||
if (type != DBUS_MESSAGE_TYPE_METHOD_CALL ||
|
||||
member == NULL ||
|
||||
iface == NULL)
|
||||
return result;
|
||||
|
||||
if (!strcmp (pathstr, DBUS_PATH_DBUS))
|
||||
result = handle_dbus (bus, message, iface, member, pathstr);
|
||||
else if (!strcmp (iface, "org.freedesktop.DBus.Properties"))
|
||||
result = handle_properties (bus, message, path, iface, member, pathstr);
|
||||
else if (!strcmp (iface, "org.freedesktop.DBus.Introspectable"))
|
||||
result = handle_introspection (bus, message, path, iface, member, pathstr);
|
||||
else
|
||||
result = handle_other (bus, message, path, iface, member, pathstr);
|
||||
#if 0
|
||||
if (result == DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
|
||||
g_print ("DRoute | Unhandled message: %s|%s of type %d on %s\n", member, iface, type, pathstr);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static DBusMessage *
|
||||
droute_object_does_not_exist_error (DBusMessage *message)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
gchar *errmsg;
|
||||
|
||||
errmsg= g_strdup_printf (
|
||||
"Method \"%s\" with signature \"%s\" on interface \"%s\" could not be processed as object %s does not exist\n",
|
||||
dbus_message_get_member (message),
|
||||
dbus_message_get_signature (message),
|
||||
dbus_message_get_interface (message),
|
||||
dbus_message_get_path (message));
|
||||
#ifdef DBUS_ERROR_UNKNOWN_OBJECT
|
||||
reply = dbus_message_new_error (message,
|
||||
DBUS_ERROR_UNKNOWN_OBJECT,
|
||||
errmsg);
|
||||
#else
|
||||
reply = dbus_message_new_error (message,
|
||||
DBUS_ERROR_FAILED,
|
||||
errmsg);
|
||||
#endif
|
||||
g_free (errmsg);
|
||||
return reply;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
DBusMessage *
|
||||
droute_not_yet_handled_error (DBusMessage *message)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
gchar *errmsg;
|
||||
|
||||
errmsg= g_strdup_printf (
|
||||
"Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist\n",
|
||||
dbus_message_get_member (message),
|
||||
dbus_message_get_signature (message),
|
||||
dbus_message_get_interface (message));
|
||||
reply = dbus_message_new_error (message,
|
||||
DBUS_ERROR_UNKNOWN_METHOD,
|
||||
errmsg);
|
||||
g_free (errmsg);
|
||||
return reply;
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
droute_out_of_memory_error (DBusMessage *message)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
gchar *errmsg;
|
||||
|
||||
errmsg= g_strdup_printf (
|
||||
"Method \"%s\" with signature \"%s\" on interface \"%s\" could not be processed due to lack of memory\n",
|
||||
dbus_message_get_member (message),
|
||||
dbus_message_get_signature (message),
|
||||
dbus_message_get_interface (message));
|
||||
reply = dbus_message_new_error (message,
|
||||
DBUS_ERROR_NO_MEMORY,
|
||||
errmsg);
|
||||
g_free (errmsg);
|
||||
return reply;
|
||||
}
|
||||
|
||||
DBusMessage *
|
||||
droute_invalid_arguments_error (DBusMessage *message)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
gchar *errmsg;
|
||||
|
||||
errmsg= g_strdup_printf (
|
||||
"Method \"%s\" with signature \"%s\" on interface \"%s\" was supplied with invalid arguments\n",
|
||||
dbus_message_get_member (message),
|
||||
dbus_message_get_signature (message),
|
||||
dbus_message_get_interface (message));
|
||||
reply = dbus_message_new_error (message,
|
||||
DBUS_ERROR_INVALID_ARGS,
|
||||
errmsg);
|
||||
g_free (errmsg);
|
||||
return reply;
|
||||
}
|
||||
|
||||
void
|
||||
droute_path_register (DRoutePath *path, DBusConnection *bus)
|
||||
{
|
||||
if (path->prefix)
|
||||
dbus_connection_register_fallback (bus, path->path, &droute_vtable, path);
|
||||
else
|
||||
dbus_connection_register_object_path (bus, path->path,
|
||||
&droute_vtable, path);
|
||||
}
|
||||
|
||||
void
|
||||
droute_path_unregister (DRoutePath *path, DBusConnection *bus)
|
||||
{
|
||||
dbus_connection_unregister_object_path (bus, path->path);
|
||||
}
|
||||
|
||||
void
|
||||
droute_context_register (DRouteContext *cnx, DBusConnection *bus)
|
||||
{
|
||||
g_ptr_array_foreach (cnx->registered_paths, (GFunc) droute_path_register,
|
||||
bus);
|
||||
}
|
||||
|
||||
void
|
||||
droute_context_unregister (DRouteContext *cnx, DBusConnection *bus)
|
||||
{
|
||||
g_ptr_array_foreach (cnx->registered_paths, (GFunc) droute_path_unregister,
|
||||
bus);
|
||||
}
|
||||
|
||||
void
|
||||
droute_context_deregister (DRouteContext *cnx, DBusConnection *bus)
|
||||
{
|
||||
g_ptr_array_foreach (cnx->registered_paths, (GFunc) droute_path_unregister,
|
||||
bus);
|
||||
}
|
||||
|
||||
void
|
||||
droute_intercept_dbus (DBusConnection *bus)
|
||||
{
|
||||
dbus_connection_register_object_path (bus, DBUS_PATH_DBUS,
|
||||
&droute_vtable, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
droute_unintercept_dbus (DBusConnection *bus)
|
||||
{
|
||||
dbus_connection_unregister_object_path (bus, DBUS_PATH_DBUS);
|
||||
}
|
||||
|
||||
/*END------------------------------------------------------------------------*/
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
||||
*
|
||||
* Copyright 2008 Novell, Inc.
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef _DROUTE_H
|
||||
#define _DROUTE_H
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <droute/droute-variant.h>
|
||||
|
||||
|
||||
typedef DBusMessage *(*DRouteFunction) (DBusConnection *, DBusMessage *, void *);
|
||||
typedef dbus_bool_t (*DRoutePropertyFunction) (DBusMessageIter *, void *);
|
||||
typedef gchar *(*DRouteIntrospectChildrenFunction) (const char *, void *);
|
||||
|
||||
typedef void *(*DRouteGetDatumFunction) (const char *, void *);
|
||||
|
||||
typedef struct _DRouteMethod DRouteMethod;
|
||||
struct _DRouteMethod
|
||||
{
|
||||
DRouteFunction func;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
typedef struct _DRouteProperty DRouteProperty;
|
||||
struct _DRouteProperty
|
||||
{
|
||||
DRoutePropertyFunction get;
|
||||
DRoutePropertyFunction set;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct _DRouteContext DRouteContext;
|
||||
|
||||
typedef struct _DRoutePath DRoutePath;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
DRouteContext *
|
||||
droute_new ();
|
||||
|
||||
void
|
||||
droute_free (DRouteContext *cnx);
|
||||
|
||||
DRoutePath *
|
||||
droute_add_one (DRouteContext *cnx,
|
||||
const char *path,
|
||||
const void *data);
|
||||
|
||||
DRoutePath *
|
||||
droute_add_many (DRouteContext *cnx,
|
||||
const char *path,
|
||||
const void *data,
|
||||
DRouteIntrospectChildrenFunction introspect_children_cb,
|
||||
void *introspect_children_data,
|
||||
const DRouteGetDatumFunction get_datum);
|
||||
|
||||
void
|
||||
droute_path_add_interface (DRoutePath *path,
|
||||
const char *name,
|
||||
const char *introspect,
|
||||
const DRouteMethod *methods,
|
||||
const DRouteProperty *properties);
|
||||
|
||||
DBusMessage *
|
||||
droute_not_yet_handled_error (DBusMessage *message);
|
||||
|
||||
DBusMessage *
|
||||
droute_invalid_arguments_error (DBusMessage *message);
|
||||
|
||||
DBusMessage *
|
||||
droute_out_of_memory_error (DBusMessage *message);
|
||||
|
||||
void
|
||||
droute_path_register (DRoutePath *path, DBusConnection *bus);
|
||||
|
||||
void
|
||||
droute_path_unregister (DRoutePath *path, DBusConnection *bus);
|
||||
|
||||
void
|
||||
droute_context_register (DRouteContext *cnx, DBusConnection *bus);
|
||||
|
||||
void
|
||||
droute_context_unregister (DRouteContext *cnx, DBusConnection *bus);
|
||||
|
||||
void
|
||||
droute_intercept_dbus (DBusConnection *connection);
|
||||
|
||||
void
|
||||
droute_unintercept_dbus (DBusConnection *connection);
|
||||
#endif /* _DROUTE_H */
|
|
@ -0,0 +1,18 @@
|
|||
droute_sources = [
|
||||
'droute.c',
|
||||
'droute-variant.c',
|
||||
'droute-pairhash.c',
|
||||
]
|
||||
|
||||
libdroute = static_library('droute', droute_sources,
|
||||
dependencies: [ glib_dep, libdbus_dep ],
|
||||
include_directories: root_inc)
|
||||
|
||||
libdroute_dep = declare_dependency(link_with: libdroute,
|
||||
dependencies: [ glib_dep, libdbus_dep ],
|
||||
include_directories: include_directories('.'))
|
||||
|
||||
droute_test = executable('droute-test', 'droute-test.c',
|
||||
dependencies: [ libdroute_dep, atspi_dep ],
|
||||
include_directories: root_inc)
|
||||
test('droute-test', droute_test)
|
|
@ -0,0 +1,64 @@
|
|||
project('at-spi2-atk', 'c',
|
||||
version: '2.34.1',
|
||||
license: 'LGPLv2.1+',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
'c_std=c99',
|
||||
],
|
||||
meson_version : '>= 0.40.1')
|
||||
|
||||
atk_bridge_soversion = 0
|
||||
atk_bridge_libversion = '0.0.0'
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
host_system = host_machine.system()
|
||||
|
||||
# XXX: for strcasecmp(); should use g_ascii_strcasecmp()
|
||||
add_project_arguments([ '-D_DEFAULT_SOURCE', ], language: 'c')
|
||||
|
||||
# We are using deprecated API; don't warn if we're building stable
|
||||
# releases, to avoid making the build logs less readable. We keep
|
||||
# the warnings during development cycles, to remind us we should
|
||||
# port away from deprecated API
|
||||
if meson.project_version().split('.').get(1).to_int().is_even()
|
||||
add_project_arguments([ '-DATK_DISABLE_DEPRECATION_WARNINGS' ], language: 'c')
|
||||
endif
|
||||
|
||||
# XXX: Unused
|
||||
at_spi_conf = configuration_data()
|
||||
at_spi_conf.set('GETTEXT_PACKAGE', meson.project_name())
|
||||
configure_file(output: 'config.h',
|
||||
configuration: at_spi_conf)
|
||||
|
||||
root_inc = include_directories('.')
|
||||
|
||||
# Dependencies
|
||||
libdbus_req_version = '>= 1.5'
|
||||
glib_req_version = '>= 2.32.0'
|
||||
gobject_req_version = '>= 2.0.0'
|
||||
gmodule_req_version = '>= 2.0.0'
|
||||
atk_req_version = '>= 2.33.3'
|
||||
atspi_req_version = '>= 2.33.2'
|
||||
libxml_req_version = '>= 2.9.1'
|
||||
|
||||
libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
|
||||
glib_dep = dependency('glib-2.0', version: glib_req_version)
|
||||
gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
|
||||
gmodule_dep = dependency('gmodule-2.0', version: gmodule_req_version)
|
||||
atk_dep = dependency('atk', version: atk_req_version)
|
||||
atspi_dep = dependency('atspi-2', version: atspi_req_version)
|
||||
libxml_dep = dependency('libxml-2.0', version: libxml_req_version, required: false)
|
||||
|
||||
if get_option('disable_p2p')
|
||||
p2p_cflags = [ '-DDISABLE_P2P' ]
|
||||
else
|
||||
p2p_cflags = []
|
||||
endif
|
||||
|
||||
install_data('at-spi2-atk.desktop',
|
||||
install_dir: join_paths(get_option('libdir'), 'gnome-settings-daemon-3.0', 'gtk-modules'))
|
||||
|
||||
subdir('droute')
|
||||
subdir('atk-adaptor')
|
||||
subdir('tests')
|
|
@ -0,0 +1,4 @@
|
|||
option('disable_p2p',
|
||||
description: 'Disable peer-to-peer DBus connections',
|
||||
type: 'boolean',
|
||||
value: false)
|
|
@ -0,0 +1,8 @@
|
|||
.deps/
|
||||
.libs/
|
||||
app-test
|
||||
atk-test
|
||||
*.log
|
||||
*.o
|
||||
*.la
|
||||
*.lo
|
|
@ -0,0 +1,206 @@
|
|||
|
||||
Testing AT-SPI requires both a test application and an AT client.
|
||||
|
||||
Test applications are built from xml files using xml loader module,
|
||||
based on Dummy ATK implementation.
|
||||
|
||||
Each test is built as a GTest object and packed into a single interface test suite.
|
||||
|
||||
Test directory contains:
|
||||
|
||||
* atk_suite - Generates a test suite, the main executable of all test suite,
|
||||
help is shown when run with '-h' parameter.
|
||||
|
||||
* atk-object-xml-loader - Generates dummy atk object from xml file.
|
||||
|
||||
* test-application - Starts an application with atk object generated by atk-object-xml-loader
|
||||
|
||||
* data/ - Folder which contains xml file from which dummy atk object is generated
|
||||
|
||||
* dummyatk/ - Folder which contains dummy atk implementation
|
||||
|
||||
|
||||
************************
|
||||
HOW TO CREATE NEW TESTS:
|
||||
|
||||
1) Add atspi interface which will be tested to Atk_Test_Case in atk_suite.c and atk_suite.h,
|
||||
then add proper test call in atk_suite_build function.
|
||||
2) Prepare xml file which describes tested root object and descendants.
|
||||
If any new fields in xml file appear, atk-object-xml-loader should be modifed.
|
||||
3) Add test file named atk_test_TEST_NAME.c, where TEST_NAME is tested interface name:
|
||||
a) Create function which runs tested application
|
||||
b) Create get_root_obj function for tested interface
|
||||
c) Create tested functions
|
||||
d) Create function which calls all test functions, this function should be called in atk_suite.c file.
|
||||
|
||||
*************************
|
||||
AVAILABLE TESTS:
|
||||
|
||||
- Accessible:
|
||||
-accessible_get_name
|
||||
-accessible_get_description
|
||||
-accessible_get_child_count
|
||||
-accessible_get_parent
|
||||
-accessible_get_child_at_index
|
||||
-accessible_get_index_in_parent
|
||||
-accessible_get_relation_set_1
|
||||
-accessible_get_relation_set_2
|
||||
-accessible_get_role
|
||||
-accessible_get_role_name
|
||||
-accessible_get_localized_role_name
|
||||
-accessible_get_state_set
|
||||
-accessible_get_attributes
|
||||
-accessible_get_attributes_as_array
|
||||
-accessible_get_toolkit_name
|
||||
-accessible_get_toolkit_version
|
||||
-accessible_get_atspi_version
|
||||
-accessible_get_id
|
||||
-accessible_get_application
|
||||
-accessible_get_action_iface
|
||||
-accessible_get_collection_iface
|
||||
-accessible_get_component_iface
|
||||
-accessible_get_document_iface
|
||||
-accessible_get_editable_text_iface
|
||||
-accessible_get_hypertext_iface
|
||||
-accessible_get_image_iface
|
||||
-accessible_get_selection_iface
|
||||
-accessible_get_table_iface
|
||||
-accessible_get_text_iface
|
||||
-accessible_get_value_iface
|
||||
-accessible_get_interfaces
|
||||
-accessible_get_object_locale
|
||||
-accessible_set_cache_mask
|
||||
-accessible_clear_cache
|
||||
-accessible_get_process_id
|
||||
- Action:
|
||||
-get_action_interface
|
||||
-action_get_action_description
|
||||
-action_get_action_name
|
||||
-action_get_n_actions
|
||||
-action_get_key_binding
|
||||
-action_get_localized_name
|
||||
-action_do_action
|
||||
- Component:
|
||||
-component_contains
|
||||
-component_get_accessible_at_point
|
||||
-component_get_extents
|
||||
-component_get_layer
|
||||
-component_get_mdi_z_order
|
||||
-component_grab_focus
|
||||
-component_get_alpha
|
||||
-component_set_extents
|
||||
- Collection
|
||||
-get_collection_iface
|
||||
-get_matches
|
||||
-get_matches_to
|
||||
-get_matches_from
|
||||
- EditableText:
|
||||
-get_editable_text_iface
|
||||
-editable_text_set_attributes
|
||||
-editable_text_insert_text
|
||||
-editable_text_copy_text
|
||||
-editable_text_cut_text
|
||||
-editable_text_delete_text
|
||||
-editable_text_paste_text
|
||||
- Image:
|
||||
-get_image_iface
|
||||
-image_get_image_size
|
||||
-image_get_image_position
|
||||
-image_get_image_extents
|
||||
-image_get_image_locale
|
||||
- HyperLink
|
||||
-hyperlink_get_n_anchors
|
||||
-hyperlink_get_uri
|
||||
-hyperlink_get_object
|
||||
-hyperlink_get_index_range
|
||||
-hyperlink_get_start_index
|
||||
-hyperlink_get_end_index
|
||||
-hyperlink_is_valid
|
||||
- HyperText
|
||||
-hypertext_get_n_links
|
||||
-hypertext_get_link
|
||||
-hypertext_get_link_index
|
||||
- Relation
|
||||
-relation_get_relation_type
|
||||
-relation_get_n_targets
|
||||
-relation_get_target
|
||||
- Selection
|
||||
-selection_get_n_selected_children
|
||||
-selection_get_selected_child
|
||||
-selection_select_child
|
||||
-selection_deselect_selected
|
||||
-selection_deselect_child
|
||||
-selection_is_child_selected
|
||||
-selection_select_all
|
||||
-selection_clear_selection
|
||||
- State Set
|
||||
-state_set_new
|
||||
-state_set_set_by_name
|
||||
-state_set_add
|
||||
-state_set_compare
|
||||
-state_set_contains
|
||||
-state_set_equals
|
||||
-state_set_get_states
|
||||
-state_set_is_empty
|
||||
-state_set_remove
|
||||
- Table
|
||||
-table_get_caption
|
||||
-table_get_summary
|
||||
-table_get_n_rows
|
||||
-table_get_n_columns
|
||||
-table_get_accessible_at
|
||||
-table_get_index_at
|
||||
-table_get_row_at_index
|
||||
-table_get_column_at_index
|
||||
-table_get_row_description
|
||||
-table_get_column_description
|
||||
-table_get_row_extent_at
|
||||
-table_get_column_extent_at
|
||||
-table_get_row_header
|
||||
-table_get_column_header
|
||||
-table_get_n_selected_rows
|
||||
-table_get_selected_rows
|
||||
-table_get_selected_columns
|
||||
-table_get_n_selected_columns
|
||||
-table_is_row_selected
|
||||
-table_is_column_selected
|
||||
-table_add_row_selection
|
||||
-table_add_column_selection
|
||||
-table_remove_row_selection
|
||||
-table_remove_column_selection
|
||||
-table_get_row_column_extents_at_index
|
||||
-table_is_selected
|
||||
- Table Cell
|
||||
-table_cell_get_column_span
|
||||
-table_cell_get_column_header_cells
|
||||
-table_cell_get_column_index
|
||||
-table_cell_get_row_span
|
||||
-table_cell_get_row_header_cells
|
||||
-table_cell_get_row_column_span
|
||||
-table_cell_get_table
|
||||
- Text:
|
||||
-text_get_character_count
|
||||
-text_get_text
|
||||
-text_get_caret_offset
|
||||
-text_get_text_attributes
|
||||
-text_get_attribute_run
|
||||
-text_get_get_text_attribute_value
|
||||
-text_get_defualt_attributes
|
||||
-text_set_caret_offset
|
||||
-text_get_string_at_offset
|
||||
-text_get_character_at_offset
|
||||
-text_get_character_extents
|
||||
-text_get_offset_at_point
|
||||
-text_get_range_extents
|
||||
-text_get_bounded_ranges
|
||||
-text_get_n_selections
|
||||
-text_get_selection
|
||||
-text_add_selection
|
||||
-text_remove_selection
|
||||
-text_set_selection
|
||||
- Value
|
||||
-value_get_minimum_value
|
||||
-value_get_current_value
|
||||
-value_get_maximum_value
|
||||
-value_set_current_value
|
||||
-value_get_minimum_increment
|
|
@ -0,0 +1,389 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#include "my-atk.h"
|
||||
|
||||
#define ACCESSIBLE_NODE ((const xmlChar *) "accessible")
|
||||
#define ACC_ACTION_NODE ((const xmlChar *) "accessible_action")
|
||||
#define ACC_COMPONENT_NODE ((const xmlChar *) "accessible_component")
|
||||
#define ACC_DOCUMENT_NODE ((const xmlChar *) "accessible_document")
|
||||
#define ACC_HYPERLINK_NODE ((const xmlChar *) "accessible_hyperlink")
|
||||
#define ACC_HYPERTEXT_NODE ((const xmlChar *) "accessible_hypertext")
|
||||
#define ACC_IMAGE_NODE ((const xmlChar *) "accessible_image")
|
||||
#define ACC_TABLE_NODE ((const xmlChar *) "accessible_table")
|
||||
#define ACC_TABLE_CELL_NODE ((const xmlChar *) "accessible_table_cell")
|
||||
#define ACC_EDIT_TEXT_NODE ((const xmlChar *) "accessible_editable_text")
|
||||
#define ACC_TEXT_NODE ((const xmlChar *) "accessible_text")
|
||||
#define ACC_SELECTION_NODE ((const xmlChar *) "accessible_selection")
|
||||
#define ACC_VALUE_NODE ((const xmlChar *) "accessible_value")
|
||||
#define ACTION_NODE ((const xmlChar *) "action")
|
||||
#define DOCUMENT_NODE ((const xmlChar *) "document")
|
||||
#define INTERFACE_NODE ((const xmlChar *) "interface")
|
||||
#define RELATION_NODE ((const xmlChar *) "relation")
|
||||
#define STATE_NODE ((const xmlChar *) "state")
|
||||
#define COMPONENT_NODE ((const xmlChar *) "component")
|
||||
#define HYPERLINK_NODE ((const xmlChar *) "hyperlink")
|
||||
#define HYPERTEXT_NODE ((const xmlChar *) "hypertext")
|
||||
#define IMAGE_NODE ((const xmlChar *) "image")
|
||||
#define TABLE_NODE ((const xmlChar *) "table")
|
||||
#define TABLE_CELL_NODE ((const xmlChar *) "table_cell")
|
||||
#define TEXT_NODE ((const xmlChar *) "text_node")
|
||||
#define VALUE_NODE ((const xmlChar *) "value_node")
|
||||
#define SELECT_NODE ((const xmlChar *) "select_node")
|
||||
|
||||
#define NAME_ATTR ((const xmlChar *) "name")
|
||||
#define DESC_ATTR ((const xmlChar *) "description")
|
||||
#define ROLE_ATTR ((const xmlChar *) "role")
|
||||
#define MIN_ATTR ((const xmlChar *) "min")
|
||||
#define MAX_ATTR ((const xmlChar *) "max")
|
||||
#define CURRENT_ATTR ((const xmlChar *) "current")
|
||||
#define STEP_ATTR ((const xmlChar *) "step")
|
||||
#define COL_HEADER_ATTR ((const xmlChar *) "col_header")
|
||||
#define ROW_HEADER_ATTR ((const xmlChar *) "row_header")
|
||||
#define COL_DESC_ATTR ((const xmlChar *) "col_desc")
|
||||
#define ROW_DESC_ATTR ((const xmlChar *) "row_desc")
|
||||
#define SELECTED_ATTR ((const xmlChar *) "selected")
|
||||
#define SELECTED_COL_ATTR ((const xmlChar *) "selected_col")
|
||||
#define RELATION_TYPE_ATTR ((const xmlChar *) "relation_type")
|
||||
#define RELATION_TARGET_NAME_ATTR ((const xmlChar *) "target_name")
|
||||
#define STATE_TYPE_ATTR ((const xmlChar *) "state_enum")
|
||||
#define ACTION_NAME_ATTR ((const xmlChar *) "action_name")
|
||||
#define ACTION_DES_ATTR ((const xmlChar *) "action_description")
|
||||
#define ACTION_KEY_BIND_ATTR ((const xmlChar *) "key_binding")
|
||||
#define COMP_X_ATTR ((const xmlChar *) "x")
|
||||
#define COMP_Y_ATTR ((const xmlChar *) "y")
|
||||
#define COMP_WIDTH_ATTR ((const xmlChar *) "width")
|
||||
#define COMP_HEIGHT_ATTR ((const xmlChar *) "height")
|
||||
#define COMP_LAYER_ATTR ((const xmlChar *) "layer")
|
||||
#define COMP_ZORDER_ATTR ((const xmlChar *) "zorder")
|
||||
#define COMP_ALPHA_ATTR ((const xmlChar *) "alpha")
|
||||
#define IMAGE_DES_ATTR ((const xmlChar *) "image_description")
|
||||
#define IMAGE_LOCALE_ATTR ((const xmlChar *) "image_locale")
|
||||
#define TEXT_TEXT_ATTR ((const xmlChar *) "text")
|
||||
#define TEXT_BOLD_ATTR ((const xmlChar *) "bold_text")
|
||||
#define TEXT_UNDERLINE_ATTR ((const xmlChar *) "underline_text")
|
||||
#define TEXT_DUMMY_ATTR ((const xmlChar *) "dummy_text")
|
||||
#define START_ATTR ((const xmlChar *) "start")
|
||||
#define END_ATTR ((const xmlChar *) "end")
|
||||
#define LINK_ATTR ((const xmlChar *) "link")
|
||||
#define CELL_X_ATTR ((const xmlChar *) "cell_x")
|
||||
#define CELL_Y_ATTR ((const xmlChar *) "cell_y")
|
||||
#define ROW_SPAN_ATTR ((const xmlChar *) "row_span")
|
||||
#define COLUMN_SPAN_ATTR ((const xmlChar *) "column_span")
|
||||
#define SELECT_ATTR ((const xmlChar *) "selected")
|
||||
#define PAGE_ATTR ((const xmlChar *) "page_no")
|
||||
#define PAGE_NUM_ATTR ((const xmlChar *) "page_number")
|
||||
|
||||
MyAtkObject *relation_target = NULL;
|
||||
|
||||
static double atof_get_prop (xmlNode *node, const xmlChar *attr)
|
||||
{
|
||||
double ret;
|
||||
xmlChar *str = xmlGetProp (node, attr);
|
||||
if (!str)
|
||||
return 0;
|
||||
ret = atof ((const char *)str);
|
||||
xmlFree(str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int atoi_get_prop (xmlNode *node, const xmlChar *attr)
|
||||
{
|
||||
int ret;
|
||||
xmlChar *str = xmlGetProp (node, attr);
|
||||
if (!str)
|
||||
return 0;
|
||||
ret = atoi ((const char *)str);
|
||||
xmlFree(str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static AtkAttribute *
|
||||
get_atk_attribute (xmlNode *node, const xmlChar *attr)
|
||||
{
|
||||
xmlChar *str;
|
||||
AtkAttribute *tmp = g_malloc (sizeof (AtkAttribute));
|
||||
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
|
||||
str = xmlGetProp (node, attr);
|
||||
tmp->name = g_strdup ((const char *)attr);
|
||||
tmp->value = g_strdup ((const char *)str);
|
||||
|
||||
free (str);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
create_atk_object_from_element (xmlNode *element)
|
||||
{
|
||||
xmlNode *child_node;
|
||||
xmlNode *child_node2;
|
||||
|
||||
gpointer obj;
|
||||
gpointer child_obj = NULL;
|
||||
AtkRelationSet *relation_set = NULL;
|
||||
AtkObject *array[1];
|
||||
AtkRelation *relation;
|
||||
AtkStateSet *state_set = NULL;
|
||||
AtkStateType state_type;
|
||||
|
||||
xmlChar *name;
|
||||
xmlChar *description;
|
||||
xmlChar *state_enum;
|
||||
xmlChar *role;
|
||||
gint relation_type;
|
||||
xmlChar *relation_target_name;
|
||||
xmlChar *action_name;
|
||||
xmlChar *action_des;
|
||||
xmlChar *action_key_bind;
|
||||
xmlChar *image_des;
|
||||
xmlChar *image_locale;
|
||||
xmlChar *text;
|
||||
gint x_size, y_size;
|
||||
gint width, height;
|
||||
gint x_extent, y_extent, w_extent, h_extent;
|
||||
name = xmlGetProp (element, NAME_ATTR);
|
||||
description = xmlGetProp (element, DESC_ATTR);
|
||||
role = xmlGetProp (element, ROLE_ATTR);
|
||||
GType type = MY_TYPE_ATK_OBJECT;
|
||||
gint layer;
|
||||
gint zorder;
|
||||
gdouble alpha;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACCESSIBLE_NODE))
|
||||
type = MY_TYPE_ATK_OBJECT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_ACTION_NODE))
|
||||
type = MY_TYPE_ATK_ACTION;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_COMPONENT_NODE))
|
||||
type = MY_TYPE_ATK_COMPONENT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_DOCUMENT_NODE))
|
||||
type = MY_TYPE_ATK_DOCUMENT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_EDIT_TEXT_NODE))
|
||||
type = MY_TYPE_ATK_EDITABLE_TEXT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_HYPERLINK_NODE))
|
||||
type = MY_TYPE_ATK_HYPERTEXT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_HYPERTEXT_NODE))
|
||||
type = MY_TYPE_ATK_HYPERTEXT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_IMAGE_NODE))
|
||||
type = MY_TYPE_ATK_IMAGE;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_SELECTION_NODE))
|
||||
type = MY_TYPE_ATK_SELECTION;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_TEXT_NODE))
|
||||
type = MY_TYPE_ATK_TEXT;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_TABLE_NODE))
|
||||
type = MY_TYPE_ATK_TABLE;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_TABLE_CELL_NODE))
|
||||
type = MY_TYPE_ATK_TABLE_CELL;
|
||||
|
||||
if (!xmlStrcmp (element->name, ACC_VALUE_NODE))
|
||||
type = MY_TYPE_ATK_VALUE;
|
||||
|
||||
|
||||
obj = g_object_new (type,
|
||||
"accessible-name", name,
|
||||
"accessible-description", description,
|
||||
"accessible-role", atk_role_for_name ((const gchar *)role),
|
||||
NULL);
|
||||
child_node = element->xmlChildrenNode;
|
||||
while (child_node != NULL) {
|
||||
if (!xmlStrcmp (child_node->name, ACCESSIBLE_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_ACTION_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_COMPONENT_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_DOCUMENT_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_EDIT_TEXT_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_HYPERLINK_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_HYPERTEXT_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_IMAGE_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_SELECTION_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_TABLE_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_TABLE_CELL_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_TEXT_NODE) ||
|
||||
!xmlStrcmp (child_node->name, ACC_VALUE_NODE)) {
|
||||
child_obj = create_atk_object_from_element (child_node);
|
||||
my_atk_object_add_child (obj, child_obj);
|
||||
}
|
||||
child_node2 = child_node->xmlChildrenNode;
|
||||
while (child_node2 != NULL) {
|
||||
if (!xmlStrcmp (child_node2->name, RELATION_NODE)) {
|
||||
relation_type = atoi_get_prop (child_node2, RELATION_TYPE_ATTR);
|
||||
relation_target_name = xmlGetProp (child_node2, RELATION_TARGET_NAME_ATTR);
|
||||
relation_set = atk_object_ref_relation_set (ATK_OBJECT (child_obj));
|
||||
array[0] = ATK_OBJECT (obj);
|
||||
relation = atk_relation_new (array, 1, relation_type);
|
||||
atk_relation_new (array, 1, relation_type);
|
||||
atk_relation_set_add (relation_set, relation);
|
||||
g_object_unref (relation);
|
||||
g_object_unref (relation_set);
|
||||
xmlFree (relation_target_name);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, STATE_NODE)) {
|
||||
state_set = atk_object_ref_state_set (ATK_OBJECT (child_obj));
|
||||
state_enum = xmlGetProp (child_node2, STATE_TYPE_ATTR);
|
||||
state_type = atk_state_type_for_name ((const gchar *)state_enum);
|
||||
atk_state_set_add_state (state_set, state_type);
|
||||
g_object_unref (state_set);
|
||||
xmlFree (state_enum);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, ACTION_NODE)) {
|
||||
action_name = xmlGetProp (child_node2, ACTION_NAME_ATTR);
|
||||
action_des = xmlGetProp (child_node2, ACTION_DES_ATTR);
|
||||
action_key_bind = xmlGetProp (child_node2, ACTION_KEY_BIND_ATTR);
|
||||
my_atk_action_add_action (child_obj, (const gchar *)action_name,
|
||||
(const gchar *)action_des,
|
||||
(const gchar *)action_key_bind);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, COMPONENT_NODE)) {
|
||||
x_extent = atoi_get_prop (child_node2, COMP_X_ATTR);
|
||||
y_extent = atoi_get_prop (child_node2, COMP_Y_ATTR);
|
||||
w_extent = atoi_get_prop (child_node2, COMP_WIDTH_ATTR);
|
||||
h_extent = atoi_get_prop (child_node2, COMP_HEIGHT_ATTR);
|
||||
layer = atoi_get_prop (child_node2, COMP_LAYER_ATTR);
|
||||
zorder = atoi_get_prop (child_node2, COMP_ZORDER_ATTR);
|
||||
alpha = atof_get_prop (child_node2, COMP_ALPHA_ATTR);
|
||||
atk_component_set_extents (ATK_COMPONENT (child_obj),
|
||||
x_extent,
|
||||
y_extent,
|
||||
w_extent,
|
||||
h_extent,
|
||||
ATK_XY_SCREEN);
|
||||
my_atk_component_set_layer (ATK_COMPONENT (child_obj), layer);
|
||||
my_atk_component_set_mdi_zorder (ATK_COMPONENT (child_obj), zorder);
|
||||
my_atk_component_set_alpha (ATK_COMPONENT (child_obj), alpha);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, DOCUMENT_NODE)) {
|
||||
my_atk_set_document (ATK_DOCUMENT(child_obj),
|
||||
atoi_get_prop (child_node2, PAGE_ATTR),
|
||||
atoi_get_prop (child_node2, PAGE_NUM_ATTR));
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, HYPERLINK_NODE)) {
|
||||
xmlChar *text = xmlGetProp (child_node2, TEXT_TEXT_ATTR);
|
||||
|
||||
my_atk_set_hypertext (ATK_HYPERTEXT (child_obj), (const gchar *)text);
|
||||
xmlFree (text);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, HYPERTEXT_NODE)) {
|
||||
xmlChar *text = xmlGetProp (child_node2, TEXT_TEXT_ATTR);
|
||||
|
||||
my_atk_set_hypertext (ATK_HYPERTEXT (child_obj), (const gchar *)text);
|
||||
xmlFree (text);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, IMAGE_NODE)) {
|
||||
image_des = xmlGetProp (child_node2, IMAGE_DES_ATTR);
|
||||
x_size = atoi_get_prop (child_node2, COMP_X_ATTR);
|
||||
y_size = atoi_get_prop (child_node2, COMP_Y_ATTR);
|
||||
width = atoi_get_prop (child_node2, COMP_WIDTH_ATTR);
|
||||
height = atoi_get_prop (child_node2, COMP_HEIGHT_ATTR);
|
||||
image_locale = xmlGetProp (child_node2, IMAGE_LOCALE_ATTR);
|
||||
|
||||
my_atk_set_image (ATK_IMAGE (child_obj),
|
||||
(const gchar *)image_des,
|
||||
x_size,
|
||||
y_size,
|
||||
width,
|
||||
height,
|
||||
(const gchar *)image_locale);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, TEXT_NODE)) {
|
||||
text = xmlGetProp (child_node2, TEXT_TEXT_ATTR);
|
||||
AtkAttributeSet *attrSet = NULL;
|
||||
AtkAttribute *a1 = get_atk_attribute (child_node2, TEXT_BOLD_ATTR);
|
||||
AtkAttribute *a2 = get_atk_attribute (child_node2, TEXT_UNDERLINE_ATTR);
|
||||
AtkAttribute *a3 = get_atk_attribute (child_node2, TEXT_DUMMY_ATTR);
|
||||
attrSet = g_slist_append(NULL, a1);
|
||||
attrSet = g_slist_append(attrSet, a2);
|
||||
attrSet = g_slist_append(attrSet, a3);
|
||||
my_atk_set_text (ATK_TEXT (child_obj),
|
||||
(const gchar *)text,
|
||||
atoi_get_prop (child_node2, COMP_X_ATTR),
|
||||
atoi_get_prop (child_node2, COMP_Y_ATTR),
|
||||
atoi_get_prop (child_node2, COMP_WIDTH_ATTR),
|
||||
atoi_get_prop (child_node2, COMP_HEIGHT_ATTR),
|
||||
attrSet);
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, TABLE_CELL_NODE)) {
|
||||
my_atk_set_table_cell (ATK_TABLE_CELL (child_obj),
|
||||
atoi_get_prop (child_node2, CELL_X_ATTR),
|
||||
atoi_get_prop (child_node2, CELL_Y_ATTR),
|
||||
atoi_get_prop (child_node2, ROW_SPAN_ATTR),
|
||||
atoi_get_prop (child_node2, COLUMN_SPAN_ATTR));
|
||||
}
|
||||
if (!xmlStrcmp (child_node2->name, VALUE_NODE)) {
|
||||
my_atk_set_value (ATK_VALUE(child_obj),
|
||||
atof_get_prop (child_node2, MIN_ATTR),
|
||||
atof_get_prop (child_node2, CURRENT_ATTR),
|
||||
atof_get_prop (child_node2, MAX_ATTR),
|
||||
atof_get_prop (child_node2, STEP_ATTR));
|
||||
}
|
||||
child_node2 = child_node2->next;
|
||||
}
|
||||
child_node = child_node->next;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads the XML from filename and uses it
|
||||
* to create a tree of MyAtkObjects.
|
||||
*
|
||||
* returns: The root object of the tree.
|
||||
*/
|
||||
MyAtkObject *
|
||||
atk_object_xml_parse (gchar *filename)
|
||||
{
|
||||
xmlDoc *doc;
|
||||
xmlNode *root_element;
|
||||
MyAtkObject *new_atk_object = NULL;
|
||||
|
||||
doc = xmlReadFile (filename, NULL, 0);
|
||||
g_assert (doc != NULL);
|
||||
|
||||
root_element = xmlDocGetRootElement (doc);
|
||||
|
||||
if (!root_element)
|
||||
return NULL;
|
||||
|
||||
new_atk_object = create_atk_object_from_element (root_element);
|
||||
|
||||
xmlFreeDoc (doc);
|
||||
return new_atk_object;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ATK_OBJECT_XML_LOADER_H
|
||||
#define ATK_OBJECT_XML_LOADER_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "my-atk.h"
|
||||
|
||||
MyAtkObject * atk_object_xml_parse (gchar *filename);
|
||||
|
||||
#endif /*ATK_OBJECT_XML_LOADER_H*/
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
static gchar *tdata_list = NULL;
|
||||
static gchar *one_test = NULL;
|
||||
|
||||
typedef struct _Atk_Test_Case Atk_Test_Case;
|
||||
|
||||
struct _Atk_Test_Case {
|
||||
const char *test_case;
|
||||
void (*build)( void);
|
||||
};
|
||||
|
||||
static const Atk_Test_Case atc[] = {
|
||||
{ ATK_TEST_PATH_ACCESSIBLE, atk_test_accessible },
|
||||
{ ATK_TEST_PATH_ACTION, atk_test_action },
|
||||
{ ATK_TEST_PATH_COMP, atk_test_component },
|
||||
{ ATK_TEST_PATH_COLLECTION, atk_test_collection },
|
||||
{ ATK_TEST_PATH_DOC, atk_test_document },
|
||||
{ ATK_TEST_PATH_EDIT_TEXT, atk_test_editable_text },
|
||||
{ ATK_TEST_PATH_HYPERLINK, atk_test_hyperlink },
|
||||
{ ATK_TEST_PATH_HYPERTEXT, atk_test_hypertext },
|
||||
{ ATK_TEST_PATH_IMAGE, atk_test_image },
|
||||
{ ATK_TEST_PATH_SELECTION, atk_test_selection },
|
||||
{ ATK_TEST_PATH_STATE_SET, atk_test_state_set },
|
||||
{ ATK_TEST_PATH_TABLE, atk_test_table },
|
||||
{ ATK_TEST_PATH_TABLE_CELL, atk_test_table_cell },
|
||||
{ ATK_TEST_PATH_TEXT, atk_test_text },
|
||||
{ ATK_TEST_PATH_VALUE, atk_test_value },
|
||||
{ NULL, NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
_list_tests (void)
|
||||
{
|
||||
const Atk_Test_Case *itr;
|
||||
|
||||
itr = atc;
|
||||
g_print ("Available Test Cases:\n");
|
||||
for (; itr->test_case; itr++)
|
||||
g_print ("\t%s\n", itr->test_case);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_suite_build (int argc, char **argv )
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_accessible ();
|
||||
atk_test_action ();
|
||||
atk_test_component ();
|
||||
atk_test_collection ();
|
||||
atk_test_document ();
|
||||
|
||||
atk_test_editable_text ();
|
||||
atk_test_hyperlink ();
|
||||
atk_test_hypertext ();
|
||||
atk_test_image ();
|
||||
atk_test_selection ();
|
||||
atk_test_state_set ();
|
||||
atk_test_table ();
|
||||
atk_test_table_cell ();
|
||||
atk_test_text ();
|
||||
atk_test_value ();
|
||||
}
|
||||
|
||||
static GOptionEntry optentries[] = {
|
||||
{"list", 'l', 0, G_OPTION_ARG_NONE, &tdata_list, "Display all available test cases", NULL},
|
||||
{"separate", 0, 0, G_OPTION_ARG_STRING, &one_test, "Run only NAME test", "NAME"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int test_result;
|
||||
GOptionContext *opt;
|
||||
opt = g_option_context_new (NULL);
|
||||
g_option_context_add_main_entries (opt, optentries, NULL);
|
||||
g_option_context_set_help_enabled (opt, TRUE);
|
||||
g_option_context_set_ignore_unknown_options (opt, TRUE);
|
||||
|
||||
if (!g_option_context_parse (opt, &argc, &argv, NULL))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (tdata_list) {
|
||||
_list_tests();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
clean_exit_on_fail ();
|
||||
|
||||
if (one_test) {
|
||||
if (!g_strcmp0 (one_test, "Accessible")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_accessible ();
|
||||
test_result = g_test_run ();
|
||||
return (test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Action")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_action ();
|
||||
test_result = g_test_run ();
|
||||
return (test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Component")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_component ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Collection")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_collection ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Document")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_document ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Editable_Text")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_editable_text ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Hyperlink")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_hyperlink ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Hypertext")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_hypertext ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Image")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_image ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Selection")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_selection ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "State_Set")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_state_set ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Table")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_table ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Table_Cell")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_table_cell ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Text")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_text ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
if (!g_strcmp0 (one_test, "Value")) {
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
atk_test_value ();
|
||||
test_result = g_test_run ();
|
||||
return ( test_result == 0 ) ? 0 : 255;
|
||||
}
|
||||
g_print ("Unknown test name\n");
|
||||
_list_tests ();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
atk_suite_build (argc, argv);
|
||||
test_result = g_test_run ();
|
||||
|
||||
return (test_result == 0 ) ? 0 : 255;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _ATK_SUITE_H
|
||||
#define _ATK_SUITE_H
|
||||
|
||||
#include <atspi/atspi.h>
|
||||
|
||||
#define ATK_TEST_PATH_ACCESSIBLE (const char *)"/Accessible"
|
||||
#define ATK_TEST_PATH_ACTION (const char *)"/Action"
|
||||
#define ATK_TEST_PATH_COMP (const char *)"/Component"
|
||||
#define ATK_TEST_PATH_COLLECTION (const char *)"/Collection"
|
||||
#define ATK_TEST_PATH_DOC (const char *)"/Document"
|
||||
#define ATK_TEST_PATH_EDIT_TEXT (const char *)"/Editable_Text"
|
||||
#define ATK_TEST_PATH_HYPERLINK (const char *)"/Hyperlink"
|
||||
#define ATK_TEST_PATH_HYPERTEXT (const char *)"/Hypertext"
|
||||
#define ATK_TEST_PATH_IMAGE (const char *)"/Image"
|
||||
#define ATK_TEST_PATH_SELECTION (const char *)"/Selection"
|
||||
#define ATK_TEST_PATH_STATE_SET (const char *)"/State_Set"
|
||||
#define ATK_TEST_PATH_TABLE (const char *)"/Table"
|
||||
#define ATK_TEST_PATH_TABLE_CELL (const char *)"/Table_Cell"
|
||||
#define ATK_TEST_PATH_TEXT (const char *)"/Text"
|
||||
#define ATK_TEST_PATH_VALUE (const char *)"/Value"
|
||||
|
||||
void atk_test_accessible (void);
|
||||
void atk_test_action (void);
|
||||
void atk_test_component (void);
|
||||
void atk_test_collection (void);
|
||||
void atk_test_document (void);
|
||||
void atk_test_editable_text (void);
|
||||
void atk_test_hyperlink (void);
|
||||
void atk_test_hypertext (void);
|
||||
void atk_test_image (void);
|
||||
void atk_test_selection (void);
|
||||
void atk_test_state_set (void);
|
||||
void atk_test_table (void);
|
||||
void atk_test_table_cell (void);
|
||||
void atk_test_text (void);
|
||||
void atk_test_value (void);
|
||||
|
||||
#endif /* _ATK_SUITE_H */
|
|
@ -0,0 +1,446 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-accessible.xml"
|
||||
|
||||
static void
|
||||
teardown_accessible_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_description (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_description (obj, NULL), ==, "Root of the accessible tree" );
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_child_count (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gint child_c = atspi_accessible_get_child_count (obj, NULL);
|
||||
g_assert_cmpint ( 3, ==, child_c );
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_parent (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL );
|
||||
AtspiAccessible *parent = atspi_accessible_get_parent (child, NULL );
|
||||
g_assert (parent == obj );
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_child_at_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL );
|
||||
g_assert_cmpstr (atspi_accessible_get_name (child, NULL), ==, "obj2");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_index_in_parent (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 2, NULL);
|
||||
int index = atspi_accessible_get_index_in_parent (child, NULL);
|
||||
g_assert_cmpint (index, ==, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_relation_set_1 (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child1 = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (child1, 0, NULL);
|
||||
GArray *rel_set = atspi_accessible_get_relation_set (child, NULL);
|
||||
g_assert_cmpint (rel_set->len, == , 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_relation_set_2 (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *obj2 = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiAccessible *obj2_1 = atspi_accessible_get_child_at_index (obj2, 0, NULL);
|
||||
GArray *rel_set = atspi_accessible_get_relation_set (obj2_1, NULL);
|
||||
int i=0;
|
||||
for (i = 0; i < rel_set->len; i++) {
|
||||
AtspiRelation *a = g_array_index (rel_set, AtspiRelation *, i);
|
||||
g_assert_cmpint (atspi_relation_get_relation_type (a), == , ATSPI_RELATION_CONTROLLER_FOR );
|
||||
g_assert_cmpint (atspi_relation_get_n_targets (a), ==, 1);
|
||||
AtspiAccessible *target = atspi_relation_get_target (a, 0);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (target,NULL), == , "obj2");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_role (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiRole root_role = atspi_accessible_get_role (obj, NULL);
|
||||
g_assert_cmpint (root_role, ==, ATSPI_ROLE_ACCELERATOR_LABEL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_role_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *root_role_name = atspi_accessible_get_role_name (obj, NULL);
|
||||
g_assert_cmpstr (root_role_name, ==, "accelerator label");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_localized_role_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *root_role_name = atspi_accessible_get_localized_role_name (obj, NULL);
|
||||
g_assert_cmpstr (root_role_name, ==, "accelerator label");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
AtspiStateType valid_states[] = {
|
||||
ATSPI_STATE_MODAL,
|
||||
ATSPI_STATE_MULTI_LINE,
|
||||
};
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
int i = 0;
|
||||
for (i = 0; i < states_arr->len; ++i) {
|
||||
g_assert_cmpint (valid_states[i], ==, g_array_index (states_arr, AtspiStateType, i));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains(states, ATSPI_STATE_MULTI_LINE));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_attributes (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
GHashTable *attr_hash_tab = atspi_accessible_get_attributes (obj, NULL);
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
gchar *valid_keys[] = { "atspi" };
|
||||
gchar *valid_values[] = { "test" };
|
||||
|
||||
g_hash_table_iter_init (&iter, attr_hash_tab );
|
||||
int i = 0;
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
g_assert_cmpstr (valid_keys[i], ==, (gchar *)key );
|
||||
g_assert_cmpstr (valid_values[i], ==, (gchar *)value );
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_attributes_as_array (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *valid_attr[] = { "atspi:test", NULL };
|
||||
GArray *attr_arr = atspi_accessible_get_attributes_as_array ( obj, NULL);
|
||||
int i = 0;
|
||||
g_assert (attr_arr->len == (sizeof(valid_attr)/sizeof(gchar *))-1);
|
||||
for( i = 0; i < attr_arr->len; ++i) {
|
||||
g_assert_cmpstr (valid_attr[i], ==, g_array_index (attr_arr, gchar *, i));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_toolkit_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *toolkit_name = atspi_accessible_get_toolkit_name (obj, NULL);
|
||||
|
||||
g_assert_cmpstr (toolkit_name, ==, "atspitesting-toolkit");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_toolkit_version (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *toolkit_ver = atspi_accessible_get_toolkit_version (obj, NULL);
|
||||
/* should be empty string, because no value is setted */
|
||||
g_assert_cmpstr (toolkit_ver, ==, "");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_atspi_version (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *atspi_version = atspi_accessible_get_atspi_version (obj, NULL);
|
||||
g_assert_cmpstr (atspi_version, ==, "2.1");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_id (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gint app_id = atspi_accessible_get_id (obj, NULL);
|
||||
g_assert_cmpint (app_id, !=, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_application (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *app = atspi_accessible_get_application (obj, NULL);
|
||||
g_assert (app != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_action_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAction *iface = atspi_accessible_get_action_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_collection_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_component_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_document_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiDocument *iface = atspi_accessible_get_document_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_editable_text_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_hypertext_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiHypertext *iface = atspi_accessible_get_hypertext_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_image_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiImage *iface = atspi_accessible_get_image_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_selection_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_table_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiTable *iface = atspi_accessible_get_table_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_text_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiText *iface = atspi_accessible_get_text_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_value_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiValue *iface = atspi_accessible_get_value_iface (obj);
|
||||
g_assert (iface == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_interfaces (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
gchar *valid_obj_ifaces[] = { "Accessible", "Collection" };
|
||||
|
||||
GArray *ifaces = atspi_accessible_get_interfaces (obj);
|
||||
g_assert (ifaces->len == 2);
|
||||
int i = 0;
|
||||
for (i = 0; i < ifaces->len; ++i)
|
||||
g_assert_cmpstr (valid_obj_ifaces[i], ==, g_array_index (ifaces, gchar *, i));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_object_locale (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
const gchar *obj_locale = atspi_accessible_get_object_locale (obj, NULL);
|
||||
g_assert_cmpstr (obj_locale, ==, setlocale (LC_MESSAGES, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_set_cache_mask (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCache cache_mask = ATSPI_CACHE_ROLE;
|
||||
atspi_accessible_set_cache_mask (obj, cache_mask);
|
||||
g_assert_cmpint (obj->parent.app->cache, ==, cache_mask);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_check_cache_cleared (AtspiAccessible *obj)
|
||||
{
|
||||
g_assert_cmpint (obj->cached_properties, ==, ATSPI_CACHE_NONE);
|
||||
GPtrArray *array = obj->children;
|
||||
int i;
|
||||
for (i=0; i<array->len; i++)
|
||||
atk_test_check_cache_cleared (g_ptr_array_index (array, i));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_clear_cache (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
atspi_accessible_clear_cache (obj);
|
||||
atk_test_check_cache_cleared (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_process_id (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
guint proc_id = atspi_accessible_get_process_id (obj, NULL);
|
||||
g_assert_cmpint (proc_id, ==, child_pid);
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_accessible (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_name",
|
||||
0, NULL, NULL, atk_test_accessible_get_name, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_description",
|
||||
0, NULL, NULL, atk_test_accessible_get_description, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_child_count",
|
||||
0, NULL, NULL, atk_test_accessible_get_child_count, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_parent",
|
||||
0, NULL, NULL, atk_test_accessible_get_parent, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_child_at_index",
|
||||
0, NULL, NULL, atk_test_accessible_get_child_at_index, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_index_in_parent",
|
||||
0, NULL, NULL, atk_test_accessible_get_index_in_parent, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_relation_set_1",
|
||||
0, NULL, NULL, atk_test_accessible_get_relation_set_1, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_relation_set_2",
|
||||
0, NULL, NULL, atk_test_accessible_get_relation_set_2, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_role",
|
||||
0, NULL, NULL, atk_test_accessible_get_role, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_role_name",
|
||||
0, NULL, NULL, atk_test_accessible_get_role_name, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_localized_role_name",
|
||||
0, NULL, NULL, atk_test_accessible_get_localized_role_name, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_state_set",
|
||||
0, NULL, NULL, atk_test_accessible_get_state_set, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_attributes",
|
||||
0, NULL, NULL, atk_test_accessible_get_attributes, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_attributes_as_array",
|
||||
0, NULL, NULL, atk_test_accessible_get_attributes_as_array, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_toolkit_name",
|
||||
0, NULL, NULL, atk_test_accessible_get_toolkit_name, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_toolkit_version",
|
||||
0, NULL, NULL, atk_test_accessible_get_toolkit_version, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_atspi_version",
|
||||
0, NULL, NULL, atk_test_accessible_get_atspi_version, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_id",
|
||||
0, NULL, NULL, atk_test_accessible_get_id, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_application",
|
||||
0, NULL, NULL, atk_test_accessible_get_application, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_action_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_action_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_collection_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_collection_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_component_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_component_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_document_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_document_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_editable_text_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_editable_text_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_hypertext_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_hypertext_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_image_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_image_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_selection_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_selection_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_table_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_table_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_text_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_text_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_value_iface",
|
||||
0, NULL, NULL, atk_test_accessible_get_value_iface, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_interfaces",
|
||||
0, NULL, NULL, atk_test_accessible_get_interfaces, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_object_locale",
|
||||
0, NULL, NULL, atk_test_accessible_get_object_locale, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_set_cache_mask",
|
||||
0, NULL, NULL, atk_test_accessible_set_cache_mask, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_clear_cache",
|
||||
0, NULL, NULL, atk_test_accessible_clear_cache, teardown_accessible_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_accessible_get_process_id",
|
||||
0, NULL, NULL, atk_test_accessible_get_process_id, teardown_accessible_test);
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-action.xml"
|
||||
|
||||
static void
|
||||
teardown_action_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_sample_get_interface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *iface = atspi_accessible_get_action_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_get_action_description (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert_cmpstr (atspi_action_get_action_description (action, 0, NULL), == ,"action1 description");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_get_action_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert_cmpstr (atspi_action_get_action_name (action, 0, NULL), == ,"action1");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_get_n_actions (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert_cmpint (atspi_action_get_n_actions (action, NULL), == , 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_get_key_binding (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert_cmpstr (atspi_action_get_key_binding (action, 0, NULL), == ,"action1 key binding");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_get_localized_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert_cmpstr (atspi_action_get_localized_name (action, 0, NULL), == ,"action1");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_action_do_action (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiAction *action = atspi_accessible_get_action_iface (child);
|
||||
g_assert (action != NULL);
|
||||
atspi_action_do_action (action, 0, NULL);
|
||||
atspi_accessible_clear_cache (obj);
|
||||
AtspiStateSet *s = atspi_accessible_get_state_set (child);
|
||||
GArray *array = atspi_state_set_get_states (s);
|
||||
g_assert_cmpint (array->len, ==, 1);
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_action (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_sample_get_interface",
|
||||
0, NULL, NULL, atk_test_action_sample_get_interface, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_description",
|
||||
0, NULL, NULL, atk_test_action_get_action_description, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_name",
|
||||
0, NULL, NULL, atk_test_action_get_action_name, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_n_actions",
|
||||
0, NULL, NULL, atk_test_action_get_n_actions, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_key_binding",
|
||||
0, NULL, NULL, atk_test_action_get_key_binding, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_localized_name",
|
||||
0, NULL, NULL, atk_test_action_get_localized_name, teardown_action_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_do_action",
|
||||
0, NULL, NULL, atk_test_action_do_action, teardown_action_test);
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-collection.xml"
|
||||
|
||||
static void
|
||||
teardown_collection_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_collection_get_collection_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
|
||||
g_assert (iface);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_collection_get_matches (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
|
||||
g_assert (iface);
|
||||
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
|
||||
AtspiMatchRule *rule = NULL;
|
||||
AtspiStateSet *ss = atspi_accessible_get_state_set (child);
|
||||
|
||||
rule = atspi_match_rule_new (ss,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
FALSE);
|
||||
GArray *ret = atspi_collection_get_matches (iface,
|
||||
rule,
|
||||
ATSPI_Collection_SORT_ORDER_CANONICAL,
|
||||
0,
|
||||
FALSE,
|
||||
NULL);
|
||||
g_assert_cmpint (2, ==, ret->len);
|
||||
|
||||
AtspiAccessible *get = NULL;
|
||||
get = g_array_index (ret, AtspiAccessible *, 0);
|
||||
g_assert_cmpstr("obj1", ==, atspi_accessible_get_name (get, NULL));
|
||||
get = g_array_index (ret, AtspiAccessible *, 1);
|
||||
g_assert_cmpstr("obj3", ==, atspi_accessible_get_name (get, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_collection_get_matches_to (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
|
||||
g_assert (iface);
|
||||
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiAccessible *child1 = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
|
||||
AtspiMatchRule *rule = NULL;
|
||||
AtspiStateSet *ss = atspi_accessible_get_state_set (child);
|
||||
|
||||
rule = atspi_match_rule_new (ss,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
FALSE);
|
||||
GArray *ret = atspi_collection_get_matches_to (iface,
|
||||
child1,
|
||||
rule,
|
||||
ATSPI_Collection_SORT_ORDER_CANONICAL,
|
||||
ATSPI_Collection_TREE_INORDER,
|
||||
TRUE,
|
||||
0,
|
||||
FALSE,
|
||||
NULL);
|
||||
g_assert_cmpint (1, ==, ret->len);
|
||||
AtspiAccessible *get = NULL;
|
||||
get = g_array_index (ret, AtspiAccessible *, 0);
|
||||
g_assert_cmpstr("obj1", ==, atspi_accessible_get_name (get, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_collection_get_matches_from (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiCollection *iface = atspi_accessible_get_collection_iface (obj);
|
||||
g_assert (iface);
|
||||
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiAccessible *child1 = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
|
||||
AtspiMatchRule *rule = NULL;
|
||||
AtspiStateSet *ss = atspi_accessible_get_state_set (child);
|
||||
|
||||
rule = atspi_match_rule_new (ss,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
NULL,
|
||||
ATSPI_Collection_MATCH_ALL,
|
||||
FALSE);
|
||||
GArray *ret = atspi_collection_get_matches_from (iface,
|
||||
child1,
|
||||
rule,
|
||||
ATSPI_Collection_SORT_ORDER_CANONICAL,
|
||||
ATSPI_Collection_TREE_INORDER,
|
||||
0,
|
||||
FALSE,
|
||||
NULL);
|
||||
g_assert_cmpint (3, ==, ret->len);
|
||||
AtspiAccessible *get = NULL;
|
||||
get = g_array_index (ret, AtspiAccessible *, 0);
|
||||
g_assert_cmpstr("obj2/1", ==, atspi_accessible_get_name (get, NULL));
|
||||
get = g_array_index (ret, AtspiAccessible *, 1);
|
||||
g_assert_cmpstr("obj3", ==, atspi_accessible_get_name (get, NULL));
|
||||
get = g_array_index (ret, AtspiAccessible *, 2);
|
||||
g_assert_cmpstr("obj3", ==, atspi_accessible_get_name (get, NULL));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
atk_test_collection (void )
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_collection_iface",
|
||||
0, NULL, NULL, atk_test_collection_get_collection_iface, teardown_collection_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches",
|
||||
0, NULL, NULL, atk_test_collection_get_matches, teardown_collection_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches_to",
|
||||
0, NULL, NULL, atk_test_collection_get_matches_to, teardown_collection_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_COLLECTION "/atk_test_collection_get_matches_from",
|
||||
0, NULL, NULL, atk_test_collection_get_matches_from, teardown_collection_test );
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-component.xml"
|
||||
|
||||
static void
|
||||
teardown_component_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_sample (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_contains (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
gboolean ret = atspi_component_contains (iface, 400, 300, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert (ret != FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_get_accessible_at_point (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
AtspiAccessible *r = atspi_component_get_accessible_at_point (iface,
|
||||
400,
|
||||
300,
|
||||
ATSPI_COORD_TYPE_SCREEN,
|
||||
NULL);
|
||||
g_assert (r != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_get_extents (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
AtspiRect *r = atspi_component_get_extents (iface, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert_cmpint (r->x, ==, 350);
|
||||
g_assert_cmpint (r->y, ==, 200);
|
||||
g_assert_cmpint (r->width, ==, 250);
|
||||
g_assert_cmpint (r->height, ==, 250);
|
||||
g_free (r);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_get_layer (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
AtspiComponentLayer layer = atspi_component_get_layer (iface, NULL);
|
||||
g_assert_cmpint (layer, ==, ATSPI_LAYER_WIDGET);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_get_mdi_z_order (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
gshort ret = atspi_component_get_mdi_z_order (iface, NULL);
|
||||
g_assert_cmpint (ret, ==, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_grab_focus (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
gboolean ret = atspi_component_grab_focus (iface, NULL);
|
||||
g_assert (ret != FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_get_alpha (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
gdouble ret = atspi_component_get_alpha (iface, NULL);
|
||||
g_assert_cmpint (ret, ==, 2.5);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_component_set_extents (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiComponent *iface = atspi_accessible_get_component_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
AtspiRect *r = atspi_component_get_extents (iface, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert_cmpint (r->x, ==, 350);
|
||||
g_assert_cmpint (r->y, ==, 200);
|
||||
g_assert_cmpint (r->width, ==, 250);
|
||||
g_assert_cmpint (r->height, ==, 250);
|
||||
g_free (r);
|
||||
|
||||
gboolean ret = atspi_component_set_extents (iface, 100, 100, 100, 100, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert (ret != FALSE);
|
||||
|
||||
r = atspi_component_get_extents (iface, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert_cmpint (r->x, ==, 100);
|
||||
g_assert_cmpint (r->y, ==, 100);
|
||||
g_assert_cmpint (r->width, ==, 100);
|
||||
g_assert_cmpint (r->height, ==, 100);
|
||||
g_free (r);
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_component (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_sample",
|
||||
0, NULL, NULL, atk_test_component_sample, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_contains",
|
||||
0, NULL, NULL, atk_test_component_contains, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_accessible_at_point",
|
||||
0, NULL, NULL, atk_test_component_get_accessible_at_point, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_extents",
|
||||
0, NULL, NULL, atk_test_component_get_extents, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_layer",
|
||||
0, NULL, NULL, atk_test_component_get_layer, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_mdi_z_order",
|
||||
0, NULL, NULL, atk_test_component_get_mdi_z_order, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_grab_focus",
|
||||
0, NULL, NULL, atk_test_component_grab_focus, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_get_alpha",
|
||||
0, NULL, NULL, atk_test_component_get_alpha, teardown_component_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_COMP "/atk_test_component_set_extents",
|
||||
0, NULL, NULL, atk_test_component_set_extents, teardown_component_test);
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-document.xml"
|
||||
|
||||
static void
|
||||
teardown_document_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_document_get_document_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiDocument *iface = atspi_accessible_get_document_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_document_get_locale (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiDocument *iface = atspi_accessible_get_document_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpstr (atspi_document_get_locale (iface, NULL), ==, "document_locale");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_document_get_attribute_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiDocument *iface = atspi_accessible_get_document_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpstr (atspi_document_get_document_attribute_value (iface, "atspi1", NULL), ==, "test1");
|
||||
g_assert_cmpstr (atspi_document_get_document_attribute_value (iface, "atspi2", NULL), ==, "test2");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_document_get_attributes (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiDocument *iface = atspi_accessible_get_document_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
GHashTable *attr = atspi_document_get_document_attributes (iface, NULL);
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init (&iter, attr);
|
||||
|
||||
gchar *valid_keys[] = {"atspi1", "atspi2"};
|
||||
gchar *valid_values[] = {"test1", "test2"};
|
||||
|
||||
int i=0;
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
g_assert_cmpstr (valid_keys[i], ==, (gchar *)key);
|
||||
g_assert_cmpstr (valid_values[i], ==, (gchar *)value);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_document(void )
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_document_iface",
|
||||
0, NULL, NULL, atk_test_document_get_document_iface, teardown_document_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_locale",
|
||||
0, NULL, NULL, atk_test_document_get_locale, teardown_document_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attribute_value",
|
||||
0, NULL, NULL, atk_test_document_get_attribute_value, teardown_document_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attributes",
|
||||
0, NULL, NULL, atk_test_document_get_attributes, teardown_document_test );
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-editable-text.xml"
|
||||
|
||||
static void
|
||||
teardown_editable_text_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_editable_text_get_editable_text_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Function is in docs but not implemented */
|
||||
static void
|
||||
atk_test_editable_text_set_attributes (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert (atspi_editable_text_set_attributes (iface, "attribute", 1, 2, NULL));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
atk_test_editable_text_insert_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
g_assert (atspi_editable_text_insert_text (iface, 0, "test_text", 9, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_editable_text_copy_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
g_assert (atspi_editable_text_copy_text (iface, 1, 2, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_editable_text_cut_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
g_assert (atspi_editable_text_cut_text (iface, 1, 2, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_editable_text_delete_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert (atspi_editable_text_delete_text (iface, 1, 2, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_editable_text_paste_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
|
||||
AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert (atspi_editable_text_paste_text (iface, 2, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_editable_text(void )
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_get_editable_text_iface",
|
||||
0, NULL, NULL, atk_test_editable_text_get_editable_text_iface, teardown_editable_text_test);
|
||||
#if 0
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_set_attributes",
|
||||
0, NULL, NULL, atk_test_editable_text_set_attributes, teardown_editable_text_test);
|
||||
#endif
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_insert_text",
|
||||
0, NULL, NULL, atk_test_editable_text_insert_text, teardown_editable_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_copy_text",
|
||||
0, NULL, NULL, atk_test_editable_text_copy_text, teardown_editable_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_cut_text",
|
||||
0, NULL, NULL, atk_test_editable_text_cut_text, teardown_editable_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_delete_text",
|
||||
0, NULL, NULL, atk_test_editable_text_delete_text, teardown_editable_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_paste_text",
|
||||
0, NULL, NULL, atk_test_editable_text_paste_text, teardown_editable_text_test);
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-hypertext.xml"
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_n_anchors (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
gint n = atspi_hyperlink_get_n_anchors (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_uri (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
gchar *str = atspi_hyperlink_get_uri (obj, 0, NULL);
|
||||
g_assert (str);
|
||||
g_assert_cmpstr (str, ==, "pinkbike.com");
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_object (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
AtspiAccessible *acc = atspi_hyperlink_get_object (obj, 0, NULL);
|
||||
g_assert (acc);
|
||||
AtspiText *at = atspi_accessible_get_text_iface (acc);
|
||||
g_assert (at);
|
||||
gchar *text = atspi_text_get_text (at, 0, 12, NULL);
|
||||
g_assert_cmpstr (text,==,"pinkbike.com");
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_index_range (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
AtspiRange *range = atspi_hyperlink_get_index_range (obj, NULL);
|
||||
g_assert (range);
|
||||
/*
|
||||
ATK do not define this function
|
||||
*/
|
||||
g_assert_cmpint (range->start_offset, ==, -1);
|
||||
g_assert_cmpint (range->end_offset, ==, -1);
|
||||
g_free (range);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_start_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
gint n = atspi_hyperlink_get_start_index (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 69);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_get_end_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
gint n = atspi_hyperlink_get_end_index (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 81);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hyperlink_is_valid (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj1 = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj1);
|
||||
AtspiHyperlink *obj = atspi_hypertext_get_link (obj1, 1, NULL);
|
||||
g_assert (obj);
|
||||
g_assert (atspi_hyperlink_is_valid (obj, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_hyperlink_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_hyperlink(void)
|
||||
{
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_n_anchors",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_n_anchors, teardown_hyperlink_test );
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_uri",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_uri, teardown_hyperlink_test);
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_object",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_object, teardown_hyperlink_test);
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_index_range",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_index_range, teardown_hyperlink_test);
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_start_index",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_start_index, teardown_hyperlink_test);
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_get_end_index",
|
||||
0, NULL, NULL, atk_test_hyperlink_get_end_index, teardown_hyperlink_test);
|
||||
g_test_add_vtable(ATK_TEST_PATH_HYPERTEXT "/atk_test_hyperlink_is_valid",
|
||||
0, NULL, NULL, atk_test_hyperlink_is_valid, teardown_hyperlink_test);
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-hypertext.xml"
|
||||
|
||||
static void
|
||||
atk_test_hypertext_get_n_links (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj);
|
||||
gint cnt = atspi_hypertext_get_n_links (obj, NULL);
|
||||
g_assert_cmpint (cnt, ==, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hypertext_get_link (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj);
|
||||
AtspiHyperlink *link = atspi_hypertext_get_link (obj, 1, NULL);
|
||||
g_assert (link);
|
||||
gchar *str = atspi_hyperlink_get_uri (link, 0, NULL);
|
||||
g_assert (str);
|
||||
g_assert_cmpstr (str, ==, "pinkbike.com");
|
||||
|
||||
g_free (str);
|
||||
|
||||
link = atspi_hypertext_get_link (obj, 0, NULL);
|
||||
str = atspi_hyperlink_get_uri (link, 0, NULL);
|
||||
g_assert_cmpstr (str, ==, "dh-zone.com");
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_hypertext_get_link_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiHypertext *obj = atspi_accessible_get_hypertext_iface (child);
|
||||
g_assert (obj);
|
||||
gint cnt = atspi_hypertext_get_link_index (obj, 15, NULL);
|
||||
g_assert_cmpint (cnt, ==, -1);
|
||||
cnt = atspi_hypertext_get_link_index (obj, 55, NULL);
|
||||
g_assert_cmpint (cnt, ==, 0);
|
||||
cnt = atspi_hypertext_get_link_index (obj, 70, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_hypertext_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_hypertext (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_n_links",
|
||||
0, NULL, NULL, atk_test_hypertext_get_n_links, teardown_hypertext_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_links",
|
||||
0, NULL, NULL, atk_test_hypertext_get_link, teardown_hypertext_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_HYPERTEXT "/atk_test_hypertext_get_link_index",
|
||||
0, NULL, NULL, atk_test_hypertext_get_link_index, teardown_hypertext_test );
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-image.xml"
|
||||
|
||||
static void
|
||||
teardown_image_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_sample_get_interface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *iface = atspi_accessible_get_image_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_get_image_description (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *image = atspi_accessible_get_image_iface (child);
|
||||
gchar *desc = atspi_image_get_image_description (image, NULL);
|
||||
g_assert (desc);
|
||||
g_assert_cmpstr (desc, == ,"image description");
|
||||
g_free (desc);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_get_image_size (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *image = atspi_accessible_get_image_iface (child);
|
||||
AtspiPoint *p = atspi_image_get_image_size (image, NULL);
|
||||
g_assert (p);
|
||||
|
||||
g_assert_cmpint (p->x,==,100);
|
||||
g_assert_cmpint (p->y,==,50);
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_get_image_position (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *image = atspi_accessible_get_image_iface (child);
|
||||
AtspiPoint *p = atspi_image_get_image_position (image, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert (p);
|
||||
g_assert_cmpint (p->x,==,500);
|
||||
g_assert_cmpint (p->y,==,50);
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_get_image_extents (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *image = atspi_accessible_get_image_iface (child);
|
||||
AtspiRect *r = atspi_image_get_image_extents (image, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert (r);
|
||||
|
||||
g_assert_cmpint (r->x, ==, 500);
|
||||
g_assert_cmpint (r->y, ==, 50);
|
||||
g_assert_cmpint (r->width, ==, 100);
|
||||
g_assert_cmpint (r->height, ==, 50);
|
||||
|
||||
g_free (r);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_image_get_image_locale (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
|
||||
AtspiImage *image = atspi_accessible_get_image_iface (child);
|
||||
gchar *locale = atspi_image_get_image_locale (image, NULL);
|
||||
|
||||
g_assert (locale);
|
||||
g_assert_cmpstr (locale, ==,"image_locale");
|
||||
g_free (locale);
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_image (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_sample_get_interface",
|
||||
0, NULL, NULL, atk_test_image_sample_get_interface, teardown_image_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_description",
|
||||
0, NULL, NULL, atk_test_image_get_image_description, teardown_image_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_size",
|
||||
0, NULL, NULL, atk_test_image_get_image_size, teardown_image_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_position",
|
||||
0, NULL, NULL, atk_test_image_get_image_position, teardown_image_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_extents",
|
||||
0, NULL, NULL, atk_test_image_get_image_extents, teardown_image_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_locale",
|
||||
0, NULL, NULL, atk_test_image_get_image_locale, teardown_image_test);
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-selection.xml"
|
||||
|
||||
static void
|
||||
teardown_selection_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_sample_get_interface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_get_n_selected_children (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_get_selected_child (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
gchar* valid_names[] = { "obj2/1", "obj2/2", "obj3/1"};
|
||||
|
||||
AtspiAccessible *o = NULL;
|
||||
int i=0;
|
||||
int selected_count = atspi_selection_get_n_selected_children (iface, NULL);
|
||||
for (i=0; i<selected_count; i++) {
|
||||
o = atspi_selection_get_selected_child (iface, i, NULL);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (o, NULL), ==, valid_names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_select_child (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
|
||||
atspi_selection_select_child (iface, 2, NULL);
|
||||
atspi_selection_select_child (iface, 3, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_deselect_selected (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
|
||||
atspi_selection_select_child (iface, 2, NULL);
|
||||
atspi_selection_select_child (iface, 3, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 5);
|
||||
|
||||
atspi_selection_deselect_selected_child (iface, 2, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_deselect_child (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
|
||||
atspi_selection_select_child (iface, 2, NULL);
|
||||
atspi_selection_select_child (iface, 3, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 5);
|
||||
|
||||
atspi_selection_deselect_child (iface, 2, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_is_child_selected (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert (atspi_selection_is_child_selected (iface, 0, NULL));
|
||||
g_assert (atspi_selection_is_child_selected (iface, 1, NULL));
|
||||
g_assert (atspi_selection_is_child_selected (iface, 4, NULL));
|
||||
g_assert (!atspi_selection_is_child_selected (iface, 2, NULL));
|
||||
g_assert (!atspi_selection_is_child_selected (iface, 3, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_select_all (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
atspi_selection_select_all (iface, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_selection_clear_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiSelection *iface = atspi_accessible_get_selection_iface (child);
|
||||
g_assert (iface != NULL);
|
||||
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 3);
|
||||
atspi_selection_clear_selection (iface, NULL);
|
||||
g_assert_cmpint (atspi_selection_get_n_selected_children (iface, NULL), ==, 0);
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_selection (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_sample_get_interface",
|
||||
0, NULL, NULL, atk_test_selection_sample_get_interface, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_get_n_selected_children",
|
||||
0, NULL, NULL, atk_test_selection_get_n_selected_children, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_get_selected_child",
|
||||
0, NULL, NULL, atk_test_selection_get_selected_child, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_select_child",
|
||||
0, NULL, NULL, atk_test_selection_select_child, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_deselect_selected",
|
||||
0, NULL, NULL, atk_test_selection_deselect_selected, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_deselect_child",
|
||||
0, NULL, NULL, atk_test_selection_deselect_child, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_is_child_selected",
|
||||
0, NULL, NULL, atk_test_selection_is_child_selected, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_select_all",
|
||||
0, NULL, NULL, atk_test_selection_select_all, teardown_selection_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_SELECTION "/atk_test_selection_clear_selection",
|
||||
0, NULL, NULL, atk_test_selection_clear_selection, teardown_selection_test);
|
||||
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_suite.h"
|
||||
#include "atk_test_util.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-accessible.xml"
|
||||
|
||||
static void
|
||||
teardown_state_set_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_state_set (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
AtspiStateType valid_states[] = {
|
||||
ATSPI_STATE_MODAL,
|
||||
ATSPI_STATE_MULTI_LINE,
|
||||
};
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
int i = 0;
|
||||
for (i = 0; i < states_arr->len; ++i) {
|
||||
g_assert_cmpint (valid_states[i], ==, g_array_index (states_arr, AtspiStateType, i));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MULTI_LINE));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_new (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType));
|
||||
|
||||
gint state = 0;
|
||||
state = 11; // ATSPI_STATE_FOCUSABLE
|
||||
g_array_append_val (states_arr, state);
|
||||
state = 12; // ATSPI_STATE_FOCUSED
|
||||
g_array_append_val (states_arr, state);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
|
||||
AtspiStateSet *ss = atspi_state_set_new (states_arr);
|
||||
|
||||
AtspiStateType valid_states[] = {
|
||||
ATSPI_STATE_FOCUSABLE,
|
||||
ATSPI_STATE_FOCUSED,
|
||||
};
|
||||
|
||||
g_assert (atspi_state_set_contains (ss, valid_states[0]));
|
||||
g_assert (atspi_state_set_contains (ss, valid_states[1]));
|
||||
int i = 0;
|
||||
for (i = 0; i < states_arr->len; ++i) {
|
||||
g_assert_cmpint (valid_states[i], ==, g_array_index (states_arr, AtspiStateType, i));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_set_by_name (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
atspi_state_set_set_by_name (states, "modal", FALSE);
|
||||
|
||||
states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 1);
|
||||
g_assert (!atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MULTI_LINE));
|
||||
|
||||
atspi_state_set_set_by_name (states, "modal", TRUE);
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_add (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
|
||||
g_assert (!atspi_state_set_contains (states, ATSPI_STATE_FOCUSABLE));
|
||||
|
||||
atspi_state_set_add (states, ATSPI_STATE_FOCUSABLE);
|
||||
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_FOCUSABLE));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_compare (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType));
|
||||
|
||||
gint state = 0;
|
||||
state = 11; // ATSPI_STATE_FOCUSABLE
|
||||
g_array_append_val (states_arr, state);
|
||||
state = 12; // ATSPI_STATE_FOCUSED
|
||||
g_array_append_val (states_arr, state);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
|
||||
AtspiStateSet *ss = atspi_state_set_new (states_arr);
|
||||
|
||||
AtspiStateSet *ret = atspi_state_set_compare (states, ss);
|
||||
|
||||
g_assert (atspi_state_set_contains (ret, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains (ret, ATSPI_STATE_MULTI_LINE));
|
||||
g_assert (atspi_state_set_contains (ret, ATSPI_STATE_FOCUSED));
|
||||
g_assert (atspi_state_set_contains (ret, ATSPI_STATE_FOCUSABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_contains (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
|
||||
g_assert (!atspi_state_set_contains (states, ATSPI_STATE_FOCUSABLE));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_equals (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType));
|
||||
|
||||
gint state = 0;
|
||||
state = 16; // ATSPI_STATE_MODAL
|
||||
g_array_append_val (states_arr, state);
|
||||
state = 17; // ATSPI_STATE_MULTI_LINE
|
||||
g_array_append_val (states_arr, state);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
|
||||
AtspiStateSet *ss = atspi_state_set_new (states_arr);
|
||||
|
||||
g_assert (atspi_state_set_equals (states, ss));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_get_states (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
AtspiStateType valid_states[] = {
|
||||
ATSPI_STATE_MODAL,
|
||||
ATSPI_STATE_MULTI_LINE,
|
||||
};
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
int i = 0;
|
||||
for (i = 0; i < states_arr->len; ++i)
|
||||
g_assert_cmpint (valid_states[i], ==, g_array_index (states_arr, AtspiStateType, i));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MULTI_LINE));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_is_empty (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
AtspiStateSet *root_states = atspi_accessible_get_state_set (obj);
|
||||
|
||||
g_assert (!atspi_state_set_is_empty (states));
|
||||
g_assert (atspi_state_set_is_empty (root_states));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_state_set_remove (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *obj = get_root_obj (DATA_FILE);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 0, NULL);
|
||||
AtspiStateSet *states = atspi_accessible_get_state_set (child);
|
||||
GArray *states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 2);
|
||||
atspi_state_set_remove (states, ATSPI_STATE_MODAL);
|
||||
|
||||
states_arr = atspi_state_set_get_states (states);
|
||||
|
||||
g_assert_cmpint (states_arr->len, ==, 1);
|
||||
g_assert (!atspi_state_set_contains (states, ATSPI_STATE_MODAL));
|
||||
g_assert (atspi_state_set_contains (states, ATSPI_STATE_MULTI_LINE));
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_state_set (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_accessible_get_state_set",
|
||||
0, NULL, NULL, atk_test_accessible_get_state_set, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_new",
|
||||
0, NULL, NULL, atk_test_state_set_new, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_set_by_name",
|
||||
0, NULL, NULL, atk_test_state_set_set_by_name, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_add",
|
||||
0, NULL, NULL, atk_test_state_set_add, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_compare",
|
||||
0, NULL, NULL, atk_test_state_set_compare, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_contains",
|
||||
0, NULL, NULL, atk_test_state_set_contains, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_equals",
|
||||
0, NULL, NULL, atk_test_state_set_equals, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_get_states",
|
||||
0, NULL, NULL, atk_test_state_set_get_states, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_is_empty",
|
||||
0, NULL, NULL, atk_test_state_set_is_empty, teardown_state_set_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_STATE_SET "/atk_test_state_set_remove",
|
||||
0, NULL, NULL, atk_test_state_set_remove, teardown_state_set_test);
|
||||
}
|
||||
|
|
@ -0,0 +1,478 @@
|
|||
/*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-table.xml"
|
||||
|
||||
static void
|
||||
atk_test_table_get_caption (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
AtspiAccessible *acc = atspi_table_get_caption (obj, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("caption name", ==, atspi_accessible_get_name (acc, NULL));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_summary (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
AtspiAccessible *acc = atspi_table_get_summary (obj, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("table summary name", ==, atspi_accessible_get_name (acc, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_n_columns (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint cnt = atspi_table_get_n_columns (obj, NULL);
|
||||
g_assert_cmpint (cnt, ==, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_n_rows (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint cnt = atspi_table_get_n_rows (obj, NULL);
|
||||
g_assert_cmpint (cnt, ==, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_accessible_at (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
AtspiAccessible *acc = atspi_table_get_accessible_at (obj, 0, 0, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("cell 0/0", ==, atspi_accessible_get_name (acc, NULL));
|
||||
|
||||
acc = atspi_table_get_accessible_at (obj, 3, 2, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("cell 2/3", ==, atspi_accessible_get_name (acc, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_index_at (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
|
||||
gint cnt = atspi_table_get_index_at (obj, 0, 0, NULL);
|
||||
g_assert_cmpint (cnt, ==, 0);
|
||||
|
||||
cnt = atspi_table_get_index_at (obj, 1, 0, NULL);
|
||||
g_assert_cmpint (cnt, ==, 3);
|
||||
|
||||
cnt = atspi_table_get_index_at (obj, 0, 1, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_row_at_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
|
||||
gint cnt = atspi_table_get_row_at_index (obj, 1, NULL);
|
||||
g_assert_cmpint (cnt, ==, 0);
|
||||
|
||||
cnt = atspi_table_get_row_at_index (obj, 4, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
|
||||
cnt = atspi_table_get_row_at_index (obj, 6, NULL);
|
||||
g_assert_cmpint (cnt, ==, 2);
|
||||
|
||||
cnt = atspi_table_get_row_at_index (obj, 11, NULL);
|
||||
g_assert_cmpint (cnt, ==, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_column_at_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
|
||||
gint cnt = atspi_table_get_column_at_index (obj, 6, NULL);
|
||||
g_assert_cmpint (cnt, ==, 0);
|
||||
|
||||
cnt = atspi_table_get_column_at_index (obj, 1, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
|
||||
cnt = atspi_table_get_column_at_index (obj, 5, NULL);
|
||||
g_assert_cmpint (cnt, ==, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_row_description (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gchar *desc = atspi_table_get_row_description (obj, 0, NULL);
|
||||
g_assert (desc);
|
||||
g_assert_cmpstr (desc, ==, "first row");
|
||||
g_free (desc);
|
||||
desc = atspi_table_get_row_description (obj, 2, NULL);
|
||||
g_assert (desc);
|
||||
g_assert_cmpstr (desc, ==, "third row");
|
||||
g_free (desc);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_column_description (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gchar *desc = atspi_table_get_column_description (obj, 0, NULL);
|
||||
g_assert (desc);
|
||||
g_assert_cmpstr (desc, ==, "first column");
|
||||
g_free (desc);
|
||||
desc = atspi_table_get_column_description (obj, 2, NULL);
|
||||
g_assert (desc);
|
||||
g_assert_cmpstr (desc, ==, "third column");
|
||||
g_free (desc);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_row_extent_at (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint cnt = atspi_table_get_row_extent_at (obj, 1, 1, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_column_extent_at (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint cnt = atspi_table_get_column_extent_at (obj, 1, 1, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_row_header (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
AtspiAccessible *acc = atspi_table_get_row_header (obj, 0, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("row 1 header", ==, atspi_accessible_get_name (acc, NULL));
|
||||
acc = atspi_table_get_row_header (obj, 3, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("row 4 header", ==, atspi_accessible_get_name (acc, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_column_header (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
AtspiAccessible *acc = atspi_table_get_column_header (obj, 0, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("column 1 header", ==, atspi_accessible_get_name (acc, NULL));
|
||||
acc = atspi_table_get_column_header (obj, 1, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("column 2 header", ==, atspi_accessible_get_name (acc, NULL));
|
||||
acc = atspi_table_get_column_header (obj, 2, NULL);
|
||||
g_assert (acc);
|
||||
g_assert_cmpstr ("column 3 header", ==, atspi_accessible_get_name (acc, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_n_selected_rows (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint cnt = atspi_table_get_n_selected_rows (obj, NULL);
|
||||
g_assert_cmpint (cnt, ==, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_selected_rows (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
GArray *array = atspi_table_get_selected_rows (obj, NULL);
|
||||
g_assert (array);
|
||||
g_assert_cmpint (array->len, ==, 2);
|
||||
g_assert_cmpint (g_array_index (array,gint, 0), ==, 0);
|
||||
g_assert_cmpint (g_array_index (array,gint, 1), ==, 2);
|
||||
g_array_free (array, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_selected_columns (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
GArray *array = atspi_table_get_selected_columns (obj, NULL);
|
||||
g_assert (array);
|
||||
g_assert_cmpint (array->len, ==, 1);
|
||||
g_assert_cmpint (g_array_index (array, gint, 0), ==, 1);
|
||||
|
||||
g_array_free (array, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_n_selected_columns (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert(obj);
|
||||
gint cnt = atspi_table_get_n_selected_columns (obj, NULL);
|
||||
g_assert_cmpint (cnt, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_is_row_selected (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_true (atspi_table_is_row_selected (obj, 0, NULL));
|
||||
g_assert_false (atspi_table_is_row_selected (obj, 1, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_is_column_selected (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_true (atspi_table_is_column_selected (obj, 1, NULL));
|
||||
g_assert_false (atspi_table_is_column_selected (obj, 0, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_add_row_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_false (atspi_table_is_row_selected (obj, 1, NULL));
|
||||
g_assert_true (atspi_table_add_row_selection (obj, 1, NULL));
|
||||
g_assert_true (atspi_table_is_row_selected (obj, 1, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_add_column_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_false (atspi_table_is_column_selected (obj, 2, NULL));
|
||||
g_assert_true (atspi_table_add_column_selection (obj, 2, NULL));
|
||||
g_assert_true (atspi_table_is_column_selected (obj, 2, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_remove_row_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_true (atspi_table_is_row_selected (obj, 2, NULL));
|
||||
g_assert_true (atspi_table_remove_row_selection (obj, 2, NULL));
|
||||
g_assert_false (atspi_table_is_row_selected (obj, 2, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_remove_column_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_true (atspi_table_is_column_selected (obj, 1, NULL));
|
||||
g_assert_true (atspi_table_remove_column_selection (obj, 1, NULL));
|
||||
g_assert_false (atspi_table_is_column_selected (obj, 1, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_get_row_column_extents_at_index (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
gint row;
|
||||
gint col;
|
||||
gint row_ext;
|
||||
gint col_ext;
|
||||
gboolean is_selected;
|
||||
g_assert_true (atspi_table_get_row_column_extents_at_index (obj, 0, &row, &col, &row_ext, &col_ext, &is_selected, NULL));
|
||||
|
||||
g_assert_cmpint (row, ==, 0);
|
||||
g_assert_cmpint (col, ==, 0);
|
||||
g_assert_cmpint (row_ext, ==, 2);
|
||||
g_assert_cmpint (col_ext, ==, 1);
|
||||
g_assert_false (is_selected);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_is_selected (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiTable *obj = atspi_accessible_get_table_iface (child);
|
||||
g_assert_true (atspi_table_is_selected (obj, 0, 2, NULL));
|
||||
g_assert_false (atspi_table_is_selected (obj, 1, 0, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_table_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_table(void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_caption",
|
||||
0, NULL, NULL, atk_test_table_get_caption, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_summary",
|
||||
0, NULL, NULL, atk_test_table_get_summary, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_columns",
|
||||
0, NULL, NULL, atk_test_table_get_n_columns, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_rows",
|
||||
0, NULL, NULL, atk_test_table_get_n_rows, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_accessible_at",
|
||||
0, NULL, NULL, atk_test_table_get_accessible_at, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_index_at",
|
||||
0, NULL, NULL, atk_test_table_get_index_at, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_at_index",
|
||||
0, NULL, NULL, atk_test_table_get_row_at_index, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_at_index",
|
||||
0, NULL, NULL, atk_test_table_get_column_at_index, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_description",
|
||||
0, NULL, NULL, atk_test_table_get_row_description, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_description",
|
||||
0, NULL, NULL, atk_test_table_get_column_description, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_extent_at",
|
||||
0, NULL, NULL, atk_test_table_get_row_extent_at, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_extent_at",
|
||||
0, NULL, NULL, atk_test_table_get_column_extent_at, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_header",
|
||||
0, NULL, NULL, atk_test_table_get_row_header, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_column_header",
|
||||
0, NULL, NULL, atk_test_table_get_column_header, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_selected_rows",
|
||||
0, NULL, NULL, atk_test_table_get_n_selected_rows, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_selected_rows",
|
||||
0, NULL, NULL, atk_test_table_get_selected_rows, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_selected_columns",
|
||||
0, NULL, NULL, atk_test_table_get_selected_columns, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_n_selected_columns",
|
||||
0, NULL, NULL, atk_test_table_get_n_selected_columns, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_row_selected",
|
||||
0, NULL, NULL, atk_test_table_is_row_selected, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_column_selected",
|
||||
0, NULL, NULL, atk_test_table_is_column_selected, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_add_row_selection",
|
||||
0, NULL, NULL, atk_test_table_add_row_selection, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_add_column_selection",
|
||||
0, NULL, NULL, atk_test_table_add_column_selection, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_remove_row_selection",
|
||||
0, NULL, NULL, atk_test_table_remove_row_selection, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_remove_column_selection",
|
||||
0, NULL, NULL, atk_test_table_remove_column_selection, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_get_row_column_extents_at_index",
|
||||
0, NULL, NULL, atk_test_table_get_row_column_extents_at_index, teardown_table_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE "/atk_test_table_is_selected",
|
||||
0, NULL, NULL, atk_test_table_is_selected, teardown_table_test);
|
||||
}
|
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-table.xml"
|
||||
|
||||
static void
|
||||
atk_test_accessible_get_table_cell (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_cell_get_column_span (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
g_assert_cmpint (3, ==, atspi_table_cell_get_column_span (obj, NULL));
|
||||
|
||||
cell = atspi_accessible_get_child_at_index (child, 11, NULL);
|
||||
obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
g_assert_cmpint (1, ==, atspi_table_cell_get_column_span (obj, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
static void
|
||||
atk_test_table_cell_get_column_header_cells (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
GPtrArray *ret = atspi_table_cell_get_column_header_cells (obj, NULL);
|
||||
g_assert_cmpint (3, ==, ret->len);
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
atk_test_table_cell_get_row_span (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
g_assert_cmpint (2, ==, atspi_table_cell_get_row_span (obj, NULL));
|
||||
|
||||
cell = atspi_accessible_get_child_at_index (child, 11, NULL);
|
||||
obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
g_assert_cmpint (1, ==, atspi_table_cell_get_column_span (obj, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
static void
|
||||
atk_test_table_cell_get_row_header_cells (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
GPtrArray *ret = atspi_table_cell_get_row_header_cells (obj, NULL);
|
||||
g_assert_cmpint (4, ==, ret->len);
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
gint row = 10;
|
||||
gint column = 10;
|
||||
gint row_span = 10;
|
||||
gint column_span = 10;
|
||||
|
||||
atspi_table_cell_get_row_column_span (obj, &row, &column, &row_span, &column_span, NULL);
|
||||
|
||||
g_assert_cmpint (row, ==, 0);
|
||||
g_assert_cmpint (column, ==, 0);
|
||||
g_assert_cmpint (row_span, ==, 2);
|
||||
g_assert_cmpint (column_span, ==, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_cell_get_position (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (cell);
|
||||
|
||||
gint row = 10;
|
||||
gint column = 10;
|
||||
|
||||
atspi_table_cell_get_position (obj, &row, &column, NULL);
|
||||
|
||||
/* TODO: not a very good test for the app to return (-1, -1) */
|
||||
g_assert_cmpint (row, ==, -1);
|
||||
g_assert_cmpint (column, ==, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
|
||||
AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
|
||||
AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
|
||||
g_assert (obj);
|
||||
|
||||
AtspiAccessible *tab = atspi_table_cell_get_table (obj, NULL);
|
||||
g_assert (tab);
|
||||
g_assert (child == tab);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_table_cell_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_table_cell (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_accessible_get_table_cell",
|
||||
0, NULL, NULL, atk_test_accessible_get_table_cell, teardown_table_cell_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_span",
|
||||
0, NULL, NULL, atk_test_table_cell_get_column_span, teardown_table_cell_test);
|
||||
/*
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_header_cells",
|
||||
0, NULL, NULL, atk_test_table_cell_get_column_header_cells, teardown_table_cell_test);
|
||||
*/
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_span",
|
||||
0, NULL, NULL, atk_test_table_cell_get_row_span, teardown_table_cell_test);
|
||||
/*
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_header_cells",
|
||||
0, NULL, NULL, atk_test_table_cell_get_row_header_cells, teardown_table_cell_test);
|
||||
*/
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_column_span",
|
||||
0, NULL, NULL, atk_test_table_cell_get_row_column_span, teardown_table_cell_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_position",
|
||||
0, NULL, NULL, atk_test_table_cell_get_position, teardown_table_cell_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_table",
|
||||
0, NULL, NULL, atk_test_table_cell_get_table, teardown_table_cell_test);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,481 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-text.xml"
|
||||
|
||||
static gboolean GHRunc_find (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
if (!g_strcmp0 (key, user_data)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_character_count (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint count = atspi_text_get_character_count (obj, NULL);
|
||||
g_assert_cmpint (count, ==, 16);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_text (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gchar *text = atspi_text_get_text (obj, 9, 14, NULL);
|
||||
g_assert_cmpstr (text, ==, "works");
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_caret_offset (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint pos = atspi_text_get_caret_offset (obj, NULL);
|
||||
g_assert_cmpint (pos,==,-1);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_set_caret_offset (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
g_assert_true (atspi_text_set_caret_offset (obj, 5, NULL));
|
||||
g_assert_false (atspi_text_set_caret_offset (obj, -1, NULL));
|
||||
gint pos = atspi_text_get_caret_offset (obj, NULL);
|
||||
g_assert_cmpint (pos, ==, 5);
|
||||
}
|
||||
static void
|
||||
atk_test_text_get_character_at_offset (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
guint chr = atspi_text_get_character_at_offset (obj, 5, NULL);
|
||||
g_assert_cmpint (chr, ==, 32);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_character_extents (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
AtspiRect *rec = atspi_text_get_character_extents (obj, 6, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert_cmpint (rec->x, ==, 100);
|
||||
g_assert_cmpint (rec->y, ==, 33);
|
||||
g_assert_cmpint (rec->width, ==, 110);
|
||||
g_assert_cmpint (rec->height, ==, 30);
|
||||
|
||||
g_free (rec);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_range_extents (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
AtspiRect *rec = atspi_text_get_range_extents (obj, 0, 1, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
|
||||
g_assert_cmpint (rec->x, ==, 100);
|
||||
g_assert_cmpint (rec->y, ==, 33);
|
||||
g_assert_cmpint (rec->width, ==, 110);
|
||||
g_assert_cmpint (rec->height, ==, 30);
|
||||
|
||||
g_free (rec);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_add_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_n_selections (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 0);
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 3);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
g_assert_true (atspi_text_add_selection (obj, 14, 15, NULL));
|
||||
|
||||
AtspiRange *range = atspi_text_get_selection (obj, 0, NULL);
|
||||
g_assert (range);
|
||||
g_assert_cmpint (range->start_offset, ==, 9);
|
||||
g_assert_cmpint (range->end_offset, ==, 14);
|
||||
g_free (range);
|
||||
|
||||
range = atspi_text_get_selection (obj, 1, NULL);
|
||||
g_assert (range);
|
||||
g_assert_cmpint (range->start_offset, ==, 14);
|
||||
g_assert_cmpint (range->end_offset, ==, 15);
|
||||
g_free (range);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_set_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
g_assert_true(atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
g_assert_true(atspi_text_add_selection (obj, 14, 15, NULL));
|
||||
g_assert_true(atspi_text_set_selection (obj, 0, 1, 2, NULL));
|
||||
g_assert_true(atspi_text_set_selection (obj, 1, 3, 4, NULL));
|
||||
|
||||
AtspiRange *range = atspi_text_get_selection (obj, 0, NULL);
|
||||
g_assert (range);
|
||||
g_assert_cmpint (range->start_offset, ==, 1);
|
||||
g_assert_cmpint (range->end_offset, ==, 2);
|
||||
g_free (range);
|
||||
|
||||
range = atspi_text_get_selection (obj, 1, NULL);
|
||||
g_assert (range);
|
||||
g_assert_cmpint (range->start_offset, ==, 3);
|
||||
g_assert_cmpint (range->end_offset, ==, 4);
|
||||
g_free (range);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_remove_selection (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 0);
|
||||
|
||||
g_assert_true (atspi_text_add_selection (obj, 9, 14, NULL));
|
||||
g_assert_true (atspi_text_add_selection (obj, 14, 15, NULL));
|
||||
n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 2);
|
||||
|
||||
g_assert_true (atspi_text_remove_selection (obj, 1, NULL));
|
||||
n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 1);
|
||||
|
||||
g_assert_true (atspi_text_remove_selection (obj, 0, NULL));
|
||||
n = atspi_text_get_n_selections (obj, NULL);
|
||||
g_assert_cmpint (n, ==, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_offset_at_point (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint n = atspi_text_get_offset_at_point (obj, 0, 0, ATSPI_COORD_TYPE_SCREEN, NULL);
|
||||
g_assert_cmpint (n, ==, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_text_attribute_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
GError *err = NULL;
|
||||
gchar *str = atspi_text_get_text_attribute_value (obj, 0, "text_test_attr1", &err);
|
||||
if (err)
|
||||
g_print ("error msg:%s\n", err->message);
|
||||
g_assert (str);
|
||||
g_assert_cmpstr (str, ==, "on");
|
||||
g_free (str);
|
||||
|
||||
str = atspi_text_get_text_attribute_value (obj, 0, "text_test_attr2", NULL);
|
||||
g_assert (str);
|
||||
g_assert_cmpstr (str, ==, "off");
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_attribute_run (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint start_offset = 0;
|
||||
gint end_offset = 0;
|
||||
GHashTable *tab = atspi_text_get_attribute_run (obj, 0, FALSE, &start_offset, &end_offset , NULL);
|
||||
|
||||
g_assert (tab);
|
||||
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "text_test_attr1"), ==, "on");
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "text_test_attr2"), ==, "off");
|
||||
g_assert_cmpint (start_offset, == , 5);
|
||||
g_assert_cmpint (end_offset, == , 10);
|
||||
g_hash_table_destroy (tab);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_defualt_attributes (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
GHashTable *tab = atspi_text_get_default_attributes (obj, NULL);
|
||||
g_assert (tab);
|
||||
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "bold_text"), ==, "on");
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "underline_text"), ==, "off");
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "dummy_text"), ==, "");
|
||||
g_hash_table_destroy (tab);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_text_attributes (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
gint start_offset = 0;
|
||||
gint end_offset = 0;
|
||||
GHashTable *tab = atspi_text_get_text_attributes (obj, 0, &start_offset, &end_offset, NULL);
|
||||
|
||||
g_assert (tab);
|
||||
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "text_test_attr1"), ==, "on");
|
||||
g_assert_cmpstr ((const char*) g_hash_table_find (tab, GHRunc_find, "text_test_attr2"), ==, "off");
|
||||
g_assert_cmpint (start_offset, == , 5);
|
||||
g_assert_cmpint (end_offset, == , 10);
|
||||
g_hash_table_destroy (tab);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_string_at_offset_s1 (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
AtspiTextRange *range = atspi_text_get_string_at_offset (obj, 0, ATSPI_TEXT_GRANULARITY_CHAR, NULL);
|
||||
|
||||
g_assert_cmpint (range->start_offset, ==, 0);
|
||||
g_assert_cmpint (range->end_offset, ==, 1);
|
||||
g_assert_cmpstr (range->content, ==, "t");
|
||||
|
||||
g_free (range);
|
||||
|
||||
range = atspi_text_get_string_at_offset (obj, 5, ATSPI_TEXT_GRANULARITY_WORD, NULL);
|
||||
|
||||
g_assert_cmpint (range->start_offset, ==, 6);
|
||||
g_assert_cmpint (range->end_offset, ==, 7);
|
||||
g_assert_cmpstr (range->content, ==, "it");
|
||||
|
||||
g_free (range);
|
||||
}
|
||||
static void
|
||||
atk_test_text_get_string_at_offset_s2 (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 1, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
AtspiTextRange *range = atspi_text_get_string_at_offset (obj, 20, ATSPI_TEXT_GRANULARITY_SENTENCE, NULL);
|
||||
|
||||
g_assert_cmpint (range->start_offset, ==, 18);
|
||||
g_assert_cmpint (range->end_offset, ==, 34);
|
||||
g_assert_cmpstr (range->content, ==, "Second sentence.");
|
||||
|
||||
g_free (range);
|
||||
|
||||
range = atspi_text_get_string_at_offset (obj, 21, ATSPI_TEXT_GRANULARITY_LINE, NULL);
|
||||
|
||||
g_assert_cmpint (range->start_offset, ==, 18);
|
||||
g_assert_cmpint (range->end_offset, ==, 34);
|
||||
g_assert_cmpstr (range->content, ==, "Second sentence.");
|
||||
|
||||
g_free (range);
|
||||
|
||||
range = atspi_text_get_string_at_offset (obj, 0, ATSPI_TEXT_GRANULARITY_PARAGRAPH, NULL);
|
||||
|
||||
g_assert_cmpint (range->start_offset, ==, 0);
|
||||
g_assert_cmpint (range->end_offset, ==, 0);
|
||||
g_assert_cmpstr (range->content, ==, "");
|
||||
|
||||
g_free (range);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_text_get_bounded_ranges (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiText *obj = atspi_accessible_get_text_iface (child);
|
||||
|
||||
GArray *array = atspi_text_get_bounded_ranges (obj, 15, 21, 100, 50, ATSPI_COORD_TYPE_SCREEN, ATSPI_TEXT_CLIP_MAX, ATSPI_TEXT_CLIP_MIN, NULL);
|
||||
g_assert (array);
|
||||
|
||||
AtspiTextRange *range = &g_array_index (array, AtspiTextRange, 0);
|
||||
g_assert_cmpint (g_array_get_element_size (array), ==, sizeof (AtspiTextRange));
|
||||
g_assert_cmpint (range->start_offset, ==, 0);
|
||||
g_assert_cmpint (range->end_offset, ==, 5);
|
||||
g_assert_cmpstr (range->content, ==, "text0");
|
||||
|
||||
range = &g_array_index (array, AtspiTextRange, 1);
|
||||
g_assert_cmpint (g_array_get_element_size (array), ==, sizeof (AtspiTextRange));
|
||||
g_assert_cmpint (range->start_offset, ==, 6);
|
||||
g_assert_cmpint (range->end_offset, ==, 10);
|
||||
g_assert_cmpstr (range->content, ==, "it w");
|
||||
|
||||
g_array_free (array,TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_text_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_text (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_count",
|
||||
0, NULL, NULL, atk_test_text_get_character_count, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text",
|
||||
0, NULL, NULL, atk_test_text_get_text, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_caret_offset",
|
||||
0, NULL, NULL, atk_test_text_get_caret_offset, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text_attributes",
|
||||
0, NULL, NULL, atk_test_text_get_text_attributes, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_attribute_run",
|
||||
0, NULL, NULL, atk_test_text_get_attribute_run, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_text_attribute_value",
|
||||
0, NULL, NULL, atk_test_text_get_text_attribute_value, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_defualt_attributes",
|
||||
0, NULL, NULL, atk_test_text_get_defualt_attributes, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_set_caret_offset",
|
||||
0, NULL, NULL, atk_test_text_set_caret_offset, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_string_at_offset_s1",
|
||||
0, NULL, NULL, atk_test_text_get_string_at_offset_s1, teardown_text_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_string_at_offset_s2",
|
||||
0, NULL, NULL, atk_test_text_get_string_at_offset_s2, teardown_text_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_at_offset",
|
||||
0, NULL, NULL, atk_test_text_get_character_at_offset, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_character_extents",
|
||||
0, NULL, NULL, atk_test_text_get_character_extents, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_offset_at_point",
|
||||
0, NULL, NULL, atk_test_text_get_offset_at_point, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_range_extents",
|
||||
0, NULL, NULL, atk_test_text_get_range_extents, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_bounded_ranges",
|
||||
0, NULL, NULL, atk_test_text_get_bounded_ranges, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_n_selections",
|
||||
0, NULL, NULL, atk_test_text_get_n_selections, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_get_selection",
|
||||
0, NULL, NULL, atk_test_text_get_selection, teardown_text_test);
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_add_selection",
|
||||
0, NULL, NULL, atk_test_text_add_selection, teardown_text_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_remove_selection",
|
||||
0, NULL, NULL, atk_test_text_remove_selection, teardown_text_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_TEXT "/atk_test_text_set_selection",
|
||||
0, NULL, NULL, atk_test_text_set_selection, teardown_text_test);
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include "atk_test_util.h"
|
||||
|
||||
pid_t child_pid;
|
||||
|
||||
static void assert_clean_exit (int sig)
|
||||
{
|
||||
kill (child_pid, SIGTERM);
|
||||
}
|
||||
|
||||
void clean_exit_on_fail ()
|
||||
{
|
||||
signal (SIGABRT, assert_clean_exit);
|
||||
}
|
||||
|
||||
void
|
||||
run_app (const char *file_name)
|
||||
{
|
||||
child_pid = fork ();
|
||||
if (child_pid == 0) {
|
||||
execlp (TESTS_BUILD_DIR "/app-test",
|
||||
TESTS_BUILD_DIR "/app-test",
|
||||
"--test-data-file",
|
||||
file_name,
|
||||
NULL);
|
||||
_exit (EXIT_SUCCESS);
|
||||
}
|
||||
if (child_pid) fprintf(stderr, "child_pid %d\n", child_pid);
|
||||
}
|
||||
|
||||
static AtspiAccessible *try_get_root_obj (AtspiAccessible *obj)
|
||||
{
|
||||
int i;
|
||||
|
||||
gint child_count = atspi_accessible_get_child_count (obj, NULL);
|
||||
if (child_count < 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i=0; i<child_count; i++) {
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,i, NULL);
|
||||
if (child && !strcmp (atspi_accessible_get_name (child, NULL), "root_object"))
|
||||
return child;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AtspiAccessible * get_root_obj (const char *file_name)
|
||||
{
|
||||
int tries = 0;
|
||||
AtspiAccessible *child;
|
||||
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
|
||||
AtspiAccessible *obj = NULL;
|
||||
|
||||
fprintf(stderr, "run_app: %s\n", file_name);
|
||||
run_app (file_name);
|
||||
|
||||
obj = atspi_get_desktop (0);
|
||||
|
||||
/* Wait for application to start, up to 100 times 10ms. */
|
||||
while (++tries <= 100)
|
||||
{
|
||||
child = try_get_root_obj (obj);
|
||||
if (child)
|
||||
return child;
|
||||
|
||||
nanosleep(&timeout, NULL);
|
||||
}
|
||||
|
||||
if (atspi_accessible_get_child_count (obj, NULL) < 1) {
|
||||
g_test_message ("Fail, test application not found\n");
|
||||
} else {
|
||||
g_test_message ("test object not found\n");
|
||||
}
|
||||
g_test_fail ();
|
||||
kill (child_pid, SIGTERM);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void terminate_app (void)
|
||||
{
|
||||
int tries = 0;
|
||||
|
||||
AtspiAccessible *child;
|
||||
struct timespec timeout = { .tv_sec = 0, .tv_nsec = 10 * 1000000 };
|
||||
AtspiAccessible *obj = NULL;
|
||||
|
||||
kill (child_pid, SIGTERM);
|
||||
|
||||
obj = atspi_get_desktop (0);
|
||||
|
||||
/* Wait for application to stop, up to 100 times 10ms. */
|
||||
while (++tries <= 100)
|
||||
{
|
||||
child = try_get_root_obj (obj);
|
||||
if (child == NULL)
|
||||
return;
|
||||
|
||||
nanosleep(&timeout, NULL);
|
||||
}
|
||||
|
||||
g_test_message ("Fail, test application still running\n");
|
||||
g_test_fail ();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ATK_TEST_UTIL_H
|
||||
#define _ATK_TEST_UTIL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include "atk_suite.h"
|
||||
|
||||
extern pid_t child_pid;
|
||||
|
||||
void run_app (const char *file_name);
|
||||
AtspiAccessible *get_root_obj (const char *file_name);
|
||||
void terminate_app (void);
|
||||
void clean_exit_on_fail ();
|
||||
|
||||
#endif /* _ATK_TEST_UTIL_H */
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright 2008 Codethink Ltd.
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "atk_test_util.h"
|
||||
#include "atk_suite.h"
|
||||
|
||||
#define DATA_FILE TESTS_DATA_DIR"/test-value.xml"
|
||||
|
||||
static void
|
||||
atk_test_value_get_value_iface (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
g_assert (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_value_get_minimum_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
gdouble val = atspi_value_get_minimum_value (obj, NULL);
|
||||
g_assert_cmpfloat (val, ==, 1.25);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_value_get_current_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
gdouble val = atspi_value_get_current_value (obj, NULL);
|
||||
g_assert_cmpfloat (val, ==, 2.25);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_value_get_maximum_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
gdouble val = atspi_value_get_maximum_value (obj, NULL);
|
||||
g_assert_cmpfloat (val, ==, 3.25);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_value_set_current_value (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
g_assert (atspi_value_set_current_value (obj, 2.5, NULL));
|
||||
gdouble val = atspi_value_get_current_value (obj, NULL);
|
||||
g_assert_cmpfloat (val, ==, 2.5);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_test_value_get_minimum_increment (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
AtspiAccessible *_obj = get_root_obj (DATA_FILE);
|
||||
g_assert (_obj);
|
||||
AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
|
||||
g_assert (child);
|
||||
AtspiValue *obj = atspi_accessible_get_value_iface (child);
|
||||
gdouble val = atspi_value_get_minimum_increment (obj, NULL);
|
||||
g_assert_cmpfloat (val, ==, 0.25);
|
||||
}
|
||||
|
||||
static void
|
||||
teardown_value_test (gpointer fixture, gconstpointer user_data)
|
||||
{
|
||||
terminate_app ();
|
||||
}
|
||||
|
||||
void
|
||||
atk_test_value (void)
|
||||
{
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_value_iface",
|
||||
0, NULL, NULL, atk_test_value_get_value_iface, teardown_value_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_minimum_value",
|
||||
0, NULL, NULL, atk_test_value_get_minimum_value, teardown_value_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_current_value",
|
||||
0, NULL, NULL, atk_test_value_get_current_value, teardown_value_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_maximum_value",
|
||||
0, NULL, NULL, atk_test_value_get_maximum_value, teardown_value_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_set_current_value",
|
||||
0, NULL, NULL, atk_test_value_set_current_value, teardown_value_test );
|
||||
g_test_add_vtable (ATK_TEST_PATH_VALUE "/atk_test_value_get_minimum_increment",
|
||||
0, NULL, NULL, atk_test_value_get_minimum_increment, teardown_value_test );
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="obj1" role="alert">
|
||||
<state state_enum="modal"/>
|
||||
<state state_enum="multi-line"/>
|
||||
</accessible>
|
||||
<accessible description="second child" name="obj2" role="animation">
|
||||
<accessible description="first prechild" name="obj2/1" role="arrow">
|
||||
<relation relation_type="2" target_name="obj2"/>
|
||||
</accessible>
|
||||
<accessible description="second prechild" name="obj2/2" role="canvas"/>
|
||||
</accessible>
|
||||
<accessible description="third child" name="obj3" role="check box">
|
||||
<accessible description="first prechild" name="obj3/1" role="check menu item"/>
|
||||
</accessible>
|
||||
</accessible>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="obj1" role="alert"/>
|
||||
<accessible_action description="second child" name="obj2" role="application">
|
||||
<action action_name="action1" action_description="action1 description" key_binding="action1 key binding"/>
|
||||
<action action_name="action2" action_description="action2 description" key_binding="action2 key binding"/>
|
||||
</accessible_action>
|
||||
<accessible_action description="third child" name="obj3" role="push button">
|
||||
<action action_name="action1" action_description="action1 description" key_binding="action1 key binding"/>
|
||||
</accessible_action>
|
||||
</accessible>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="obj1" role="alert">
|
||||
<state state_enum="modal"/>
|
||||
<state state_enum="multi-line"/>
|
||||
</accessible>
|
||||
<accessible description="second child" name="obj2" role="animation">
|
||||
<accessible description="first prechild" name="obj2/1" role="arrow">
|
||||
<relation relation_type="2" target_name="obj2"/>
|
||||
<state state_enum="modal"/>
|
||||
<state state_enum="multi-line"/>
|
||||
</accessible>
|
||||
<accessible description="second prechild" name="obj2/2" role="canvas"/>
|
||||
</accessible>
|
||||
<accessible description="third child" name="obj3" role="check box">
|
||||
<state state_enum="modal"/>
|
||||
<state state_enum="multi-line"/>
|
||||
<accessible description="first prechild" name="obj3/1" role="check menu item"/>
|
||||
</accessible>
|
||||
</accessible>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_component description="second child" name="obj2" role="application">
|
||||
<component x="350" y="200" width="0" height="0" layer="2" zorder="1" alpha="1.5"/>
|
||||
</accessible_component>
|
||||
<accessible_component description="third child" name="obj3" role="push button">
|
||||
<component x="250" y="250" width="350" height="200" layer="3" zorder="2" alpha="2.5"/>
|
||||
<accessible_component description="third child a" name="aobj3" role="push button">
|
||||
<component x="250" y="250" width="350" height="200" layer="4" zorder="3" alpha="3.5"/>
|
||||
</accessible_component>
|
||||
</accessible_component>
|
||||
<accessible description="second child" name="obj2" role="application" />
|
||||
</accessible>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="test" role="alert"/>
|
||||
<accessible_document description="image child" name="my_document" role="text">
|
||||
<document page_numer="7" page_no="2"/>
|
||||
</accessible_document>
|
||||
</accessible>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_editable_text description="first child" name="obj0" role="entry">
|
||||
<text_edit_node text="test text"/>
|
||||
</accessible_editable_text>
|
||||
<accessible_editable_text description="second child" name="obj1" role="entry">
|
||||
<text_edit_node text="second test text"/>
|
||||
</accessible_editable_text>
|
||||
</accessible>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_hypertext description="first child" name="obj0" role="alert">
|
||||
<hypertext text="This is article about know downhill portals href='dh-zone.com' href='pinkbike.com'" />
|
||||
</accessible_hypertext>
|
||||
</accessible>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="obj1" role="alert"/>
|
||||
<accessible_image description="image child" name="obj0" role="image">
|
||||
<image image_description="image description" width="100" height="50" x="500" y="50" image_extents="png" image_locale="image_locale"/>
|
||||
</accessible_image>
|
||||
</accessible>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_selection description="first child" name="obj1" role="alert">
|
||||
<accessible description="first prechild" name="obj2/1" role="arrow">
|
||||
<state state_enum="selected"/>
|
||||
</accessible>
|
||||
<accessible description="second prechild" name="obj2/2" role="canvas" selected="1">
|
||||
<state state_enum="selected"/>
|
||||
</accessible>
|
||||
<accessible description="first prechild" name="obj2/1" role="arrow"/>
|
||||
<accessible description="second prechild" name="obj2/2" role="canvas"/>
|
||||
<accessible description="first prechild" name="obj3/1" role="check menu item">
|
||||
<state state_enum="selected"/>
|
||||
</accessible>
|
||||
</accessible_selection>
|
||||
</accessible>
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_table description="first_child" name="obj0" role="table">
|
||||
<accessible description="table caption" name="caption name" role="caption"/>
|
||||
<accessible description="table summary" name="table summary name" role="heading"/>
|
||||
<accessible description="first column" name="col1" role="table column header">
|
||||
<accessible description="first column header" name="column 1 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="second column" name="col2" role="table column header">
|
||||
<state state_enum="selected"/>
|
||||
<accessible description="second column header" name="column 2 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="third column" name="col3" role="table column header">
|
||||
<accessible description="thrid column header" name="column 3 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="first row" name="row1" role="table row header">
|
||||
<state state_enum="selected"/>
|
||||
<accessible description="first row header" name="row 1 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="second row" name="row2" role="table row header">
|
||||
<accessible description="second row header" name="row 2 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="third row" name="row3" role="table row header">
|
||||
<state state_enum="selected"/>
|
||||
<accessible description="third row header" name="row 3 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible description="fourth row" name="row4" role="table row header">
|
||||
<accessible description="fourth row header" name="row 4 header" role="header"/>
|
||||
</accessible>
|
||||
<accessible_table_cell description="table cell 1" name="cell 0/0" role="table cell">
|
||||
<table_cell cell_x="0" cell_y="0" row_span="2"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 5" name="cell 1/0" role="table cell">
|
||||
<table_cell cell_x="1" cell_y="0" column_span="3"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 9" name="cell 2/0" role="table cell">
|
||||
<state state_enum="selected"/>
|
||||
<table_cell cell_x="2" cell_y="0"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 2" name="cell 0/1" role="table cell">
|
||||
<table_cell cell_x="0" cell_y="1"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 6" name="cell 1/1" role="table cell">
|
||||
<table_cell cell_x="1" cell_y="1"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 10" name="cell 2/1" role="table cell">
|
||||
<table_cell cell_x="2" cell_y="1"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 3" name="cell 0/2" role="table cell">
|
||||
<table_cell cell_x="0" cell_y="2"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 7" name="cell 1/2" role="table cell">
|
||||
<table_cell cell_x="1" cell_y="2"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 11" name="cell 2/2" role="table cell">
|
||||
<table_cell cell_x="2" cell_y="2"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 4" name="cell 0/3" role="table cell">
|
||||
<table_cell cell_x="0" cell_y="3"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 8" name="cell 1/3" role="table cell">
|
||||
<table_cell cell_x="1" cell_y="3"/>
|
||||
</accessible_table_cell>
|
||||
<accessible_table_cell description="table cell 12" name="cell 2/3" role="table cell">
|
||||
<table_cell cell_x="2" cell_y="3"/>
|
||||
</accessible_table_cell>
|
||||
</accessible_table>
|
||||
</accessible>
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_text description="first child" name="obj0" role="text">
|
||||
<text_node text="text0 it works!." x="100" y="33" width="110" height="30" bold_text="on" underline_text="off"/>
|
||||
</accessible_text>
|
||||
<accessible_text description="second child" name="obj1" role="text">
|
||||
<text_node text="First sentence./n Second sentence." x="66" y="44" width="550" height="40" bold_text="off" underline_text="off"/>
|
||||
</accessible_text>
|
||||
</accessible>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible_value description="first child" name="obj0" role="alert">
|
||||
<value_node min="1.25" current="2.25" max="3.25" step="0.25"/>
|
||||
</accessible_value>
|
||||
</accessible>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" ?>
|
||||
<accessible description="Root of the accessible tree" name="root_object" role="accelerator label">
|
||||
<accessible description="first child" name="obj1" role="alert">
|
||||
<state state_enum="modal"/>
|
||||
<state state_enum="multi-line"/>
|
||||
</accessible>
|
||||
<accessible description="second child" name="obj2" role="animation">
|
||||
<accessible description="first prechild" name="obj2/1" role="arrow">
|
||||
<relation relation_type="2" target_name="obj2"/>
|
||||
</accessible>
|
||||
<accessible description="second prechild" name="obj2/2" role="canvas"/>
|
||||
</accessible>
|
||||
<accessible description="third child" name="obj3" role="check box">
|
||||
<accessible description="first prechild" name="obj3/1" role="check menu item"/>
|
||||
</accessible>
|
||||
</accessible>
|
|
@ -0,0 +1,23 @@
|
|||
dummyatk_sources = [
|
||||
'my-atk-action.c',
|
||||
'my-atk-component.c',
|
||||
'my-atk-document.c',
|
||||
'my-atk-editable-text.c',
|
||||
'my-atk-hyperlink.c',
|
||||
'my-atk-hypertext.c',
|
||||
'my-atk-image.c',
|
||||
'my-atk-text.c',
|
||||
'my-atk-object.c',
|
||||
'my-atk-table.c',
|
||||
'my-atk-table-cell.c',
|
||||
'my-atk-selection.c',
|
||||
'my-atk-value.c',
|
||||
]
|
||||
|
||||
dummyatk = static_library('dummyatk', dummyatk_sources,
|
||||
include_directories: root_inc,
|
||||
dependencies: [ glib_dep, gobject_dep, atk_dep ])
|
||||
|
||||
dummyatk_dep = declare_dependency(link_with: dummyatk,
|
||||
dependencies: [ glib_dep, gobject_dep, atk_dep ],
|
||||
include_directories: include_directories('.'))
|
|
@ -0,0 +1,263 @@
|
|||
/*
|
||||
* AT-SPI - Assistive Technology Service Provider Interface
|
||||
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
||||
*
|
||||
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <atk/atk.h>
|
||||
|
||||
#include "my-atk-object.h"
|
||||
#include "my-atk-action.h"
|
||||
|
||||
typedef struct _MyAtkActionInfo MyAtkActionInfo;
|
||||
|
||||
struct _MyAtkActionInfo {
|
||||
gchar *name;
|
||||
gchar *description;
|
||||
gchar *keybinding;
|
||||
|
||||
MyAtkActionFunc do_action_func;
|
||||
};
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MyAtkAction,
|
||||
my_atk_action,
|
||||
MY_TYPE_ATK_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
|
||||
atk_action_interface_init));
|
||||
|
||||
#define MY_ATK_ACTION_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), MY_TYPE_ATK_ACTION, MyAtkActionPrivate))
|
||||
|
||||
struct _MyAtkActionPrivate {
|
||||
GQueue *action_queue;
|
||||
guint action_idle_handler;
|
||||
GList *action_list;
|
||||
GList *children;
|
||||
};
|
||||
|
||||
static void
|
||||
my_atk_action_initialize (AtkObject *obj, gpointer data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
my_atk_action_init (MyAtkAction *action_obj)
|
||||
{
|
||||
MyAtkActionPrivate *priv = MY_ATK_ACTION_GET_PRIVATE (action_obj);
|
||||
action_obj->priv = priv;
|
||||
priv->action_queue = NULL;
|
||||
priv->action_idle_handler = 0;
|
||||
priv->action_list = NULL;
|
||||
priv->children = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
my_atk_action_finalize (GObject *object)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
my_atk_action_class_init (MyAtkActionClass *my_class)
|
||||
{
|
||||
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
|
||||
|
||||
gobject_class->finalize = my_atk_action_finalize;
|
||||
|
||||
atk_class->initialize = my_atk_action_initialize;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (MyAtkActionPrivate));
|
||||
}
|
||||
|
||||
static MyAtkActionInfo *
|
||||
_my_atk_action_get_action_info (MyAtkAction *action, gint i)
|
||||
{
|
||||
MyAtkActionPrivate *priv = NULL;
|
||||
MyAtkActionInfo *node_data = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
|
||||
|
||||
priv = action->priv;
|
||||
|
||||
if (priv->action_list == NULL)
|
||||
return NULL;
|
||||
|
||||
node_data = g_list_nth_data (priv->action_list, i);
|
||||
|
||||
g_return_val_if_fail (node_data, NULL);
|
||||
|
||||
return node_data;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
my_atk_action_description_get (AtkAction *action, gint i)
|
||||
{
|
||||
MyAtkAction *my_action = NULL;
|
||||
MyAtkActionInfo *info = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
|
||||
my_action = MY_ATK_ACTION (action);
|
||||
|
||||
info = _my_atk_action_get_action_info (my_action, i);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
return strdup (info->description);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_atk_action_description_set (AtkAction *action, gint i, const char *des)
|
||||
{
|
||||
MyAtkAction *my_action = NULL;
|
||||
MyAtkActionInfo *info = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), FALSE);
|
||||
my_action = MY_ATK_ACTION (action);
|
||||
|
||||
info = _my_atk_action_get_action_info (my_action, i);
|
||||
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
|
||||
g_free (info->description);
|
||||
info->description = g_strdup (des);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
my_atk_action_name_get (AtkAction *action, gint i)
|
||||
{
|
||||
MyAtkAction *my_action = NULL;
|
||||
MyAtkActionInfo *info = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
|
||||
my_action = MY_ATK_ACTION (action);
|
||||
|
||||
info = _my_atk_action_get_action_info (my_action, i);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
return strdup (info->name);
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
my_atk_action_localized_name_get (AtkAction *action, gint i)
|
||||
{
|
||||
MyAtkAction *my_action = NULL;
|
||||
MyAtkActionInfo *info = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
|
||||
my_action = MY_ATK_ACTION (action);
|
||||
|
||||
info = _my_atk_action_get_action_info (my_action, i);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
return strdup (info->name);
|
||||
}
|
||||
|
||||
static gint
|
||||
my_atk_action_get_n_actions (AtkAction *action)
|
||||
{
|
||||
MyAtkAction *action_obj = NULL;
|
||||
MyAtkActionPrivate *priv = NULL;
|
||||
|
||||
action_obj = MY_ATK_ACTION (action);
|
||||
priv = action_obj->priv;
|
||||
|
||||
return g_list_length (priv->action_list);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
my_atk_action_get_keybinding (AtkAction *action, gint i)
|
||||
{
|
||||
MyAtkAction *my_action = NULL;
|
||||
MyAtkActionInfo *info = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), NULL);
|
||||
my_action = MY_ATK_ACTION (action);
|
||||
|
||||
info = _my_atk_action_get_action_info (my_action, i);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
return strdup (info->keybinding);
|
||||
}
|
||||
|
||||
void perform_action (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set1 = atk_object_ref_state_set (obj);
|
||||
atk_state_set_add_state (state_set1, ATK_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_atk_action_do_action (AtkAction *action, gint i)
|
||||
{
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), FALSE);
|
||||
|
||||
perform_action (ATK_OBJECT (action));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
guint my_atk_action_add_action (MyAtkAction *action,
|
||||
const gchar *action_name,
|
||||
const gchar *action_description,
|
||||
const gchar *action_keybinding)
|
||||
{
|
||||
MyAtkActionInfo *info = NULL;
|
||||
MyAtkActionPrivate *priv = NULL;
|
||||
|
||||
g_return_val_if_fail (MY_IS_ATK_ACTION (action), -1);
|
||||
|
||||
priv = action->priv;
|
||||
|
||||
info = g_slice_new (MyAtkActionInfo);
|
||||
info->name = g_strdup (action_name);
|
||||
info->description = g_strdup (action_description);
|
||||
info->keybinding = g_strdup (action_keybinding);
|
||||
|
||||
priv->action_list = g_list_append (priv->action_list, info);
|
||||
|
||||
return g_list_length (priv->action_list);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface);
|
||||
|
||||
iface->do_action = my_atk_action_do_action;
|
||||
|
||||
iface->get_n_actions = my_atk_action_get_n_actions;
|
||||
iface->get_description = my_atk_action_description_get;
|
||||
iface->get_keybinding = my_atk_action_get_keybinding;
|
||||
iface->get_name = my_atk_action_name_get;
|
||||
iface->set_description = my_atk_action_description_set;
|
||||
iface->get_localized_name = my_atk_action_localized_name_get;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue