Upstream repository discontinued (code migrated to at-spi2-core).
Change-Id: I1bb5007094dce3c70d365fe7ebcdb8ea714b2a17
+++ /dev/null
-ChangeLog
-*.pyc
+++ /dev/null
-
-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>
+++ /dev/null
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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.
-\f
- 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
-\f
- 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!
+++ /dev/null
-Mike Gorse <mgorse@suse.com>
+++ /dev/null
-What's new in at-spi2-atk 2.37.90:
-
-* Add support for the new mark and suggestion roles (!21).
-
-* Meson: add tests option (!22).
-
-What's new in at-spi2-atk 2.34.2:
-
-* Meson: don't hard-code shared_library (!19).
-
-* Mitigate missing window events at startup.
-
-* Set C standard to gnu99 (#10).
-
-* Tests: include sys/time.h (#14).
-
-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.
+++ /dev/null
-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
+++ /dev/null
-[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
+++ /dev/null
-<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>
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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);
- }
- }
-}
+++ /dev/null
-/*
- * 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_ */
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2007 IBM Corp.
- *
- * 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.
- */
-
-/* collection.c: implements the Collection interface */
-
-#include <string.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-#include "bridge.h"
-
-#include "bitarray.h"
-#include "spi-dbus.h"
-#include "accessible-stateset.h"
-
-#include "accessible-register.h"
-#include "object.h"
-#include "introspection.h"
-
-typedef struct _MatchRulePrivate MatchRulePrivate;
-struct _MatchRulePrivate
-{
- gint *states;
- AtspiCollectionMatchType statematchtype;
- AtkAttributeSet *attributes;
- AtspiCollectionMatchType attributematchtype;
- gint *roles;
- AtspiCollectionMatchType rolematchtype;
- gchar **ifaces;
- AtspiCollectionMatchType interfacematchtype;
- gboolean invert;
-};
-
-static gboolean
-child_interface_p (AtkObject * child, gchar * repo_id)
-{
- if (!strcasecmp (repo_id, "action"))
- return ATK_IS_ACTION (child);
- if (!strcasecmp (repo_id, "component"))
- return ATK_IS_COMPONENT (child);
- if (!strcasecmp (repo_id, "editabletext"))
- return ATK_IS_EDITABLE_TEXT (child);
- if (!strcasecmp (repo_id, "text"))
- return ATK_IS_TEXT (child);
- if (!strcasecmp (repo_id, "hypertext"))
- return ATK_IS_HYPERTEXT (child);
- if (!strcasecmp (repo_id, "image"))
- return ATK_IS_IMAGE (child);
- if (!strcasecmp (repo_id, "selection"))
- return ATK_IS_SELECTION (child);
- if (!strcasecmp (repo_id, "table"))
- return ATK_IS_TABLE (child);
- if (!strcasecmp (repo_id, "value"))
- return ATK_IS_VALUE (child);
- if (!strcasecmp (repo_id, "streamablecontent"))
- return ATK_IS_STREAMABLE_CONTENT (child);
- if (!strcasecmp (repo_id, "document"))
- return ATK_IS_DOCUMENT (child);
- return FALSE;
-}
-
-#define child_collection_p(ch) (TRUE)
-
-static gboolean
-match_states_all_p (AtkObject * child, gint * set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = TRUE;
-
- if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- // TODO: use atk-state_set_contains_states; would be more efficient
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (!atk_state_set_contains_state (chs, set[i]))
- {
- ret = FALSE;
- break;
- }
- }
-
- g_object_unref (chs);
- return ret;
-}
-
-static gboolean
-match_states_any_p (AtkObject * child, gint * set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = FALSE;
-
- if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (atk_state_set_contains_state (chs, set[i]))
- {
- ret = TRUE;
- break;
- }
- }
-
- g_object_unref (chs);
- return ret;
-}
-
-static gboolean
-match_states_none_p (AtkObject * child, gint * set)
-{
- AtkStateSet *chs;
- gint i;
- gboolean ret = TRUE;
-
- if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
- return TRUE;
-
- chs = atk_object_ref_state_set (child);
-
- for (i = 0; set[i] != BITARRAY_SEQ_TERM; i++)
- {
- if (atk_state_set_contains_state (chs, set[i]))
- {
- ret = FALSE;
- break;
- }
- }
-
- g_object_unref (chs);
- return ret;
-}
-
-// TODO: need to convert at-spi roles/states to atk roles/states */
-static gboolean
-match_states_lookup (AtkObject * child, MatchRulePrivate * mrp)
-{
- switch (mrp->statematchtype)
- {
- case ATSPI_Collection_MATCH_ALL:
- if (match_states_all_p (child, mrp->states))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_ANY:
- if (match_states_any_p (child, mrp->states))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_NONE:
- if (match_states_none_p (child, mrp->states))
- return TRUE;
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-// TODO: Map at-spi -> atk roles at mrp creation instead of doing this;
-// would be more efficient
-#define spi_get_role(obj) spi_accessible_role_from_atk_role(atk_object_get_role(obj))
-
-static gboolean
-match_roles_all_p (AtkObject * child, gint * roles)
-{
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM)
- return TRUE;
- else if (roles[1] != BITARRAY_SEQ_TERM)
- return FALSE;
-
- return (atk_object_get_role (child) == roles[0]);
-
-}
-
-static gboolean
-match_roles_any_p (AtkObject * child, gint * roles)
-{
- AtspiRole role;
- int i;
-
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM)
- return TRUE;
-
- role = spi_accessible_role_from_atk_role (atk_object_get_role (child));
-
- for (i = 0; roles[i] != BITARRAY_SEQ_TERM; i++)
- if (role == roles[i])
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-match_roles_none_p (AtkObject * child, gint * roles)
-{
- AtkRole role;
- int i;
-
- if (roles == NULL || roles[0] == BITARRAY_SEQ_TERM)
- return TRUE;
-
- role = atk_object_get_role (child);
-
- for (i = 0; roles[i] != BITARRAY_SEQ_TERM; i++)
- if (role == roles[i])
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-match_roles_lookup (AtkObject * child, MatchRulePrivate * mrp)
-{
- switch (mrp->rolematchtype)
- {
- case ATSPI_Collection_MATCH_ALL:
- if (match_roles_all_p (child, mrp->roles))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_ANY:
- if (match_roles_any_p (child, mrp->roles))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_NONE:
- if (match_roles_none_p (child, mrp->roles))
- return TRUE;
- break;
-
- default:
- break;
-
- }
- return FALSE;
-}
-
-static gboolean
-match_interfaces_all_p (AtkObject * obj, gchar ** ifaces)
-{
- gint i;
-
- if (ifaces == NULL)
- return TRUE;
-
- for (i = 0; ifaces[i]; i++)
- if (!child_interface_p (obj, ifaces[i]))
- {
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
-match_interfaces_any_p (AtkObject * obj, gchar ** ifaces)
-{
- gint i;
-
- if (ifaces == NULL)
- return TRUE;
-
-
- for (i = 0; ifaces[i]; i++)
- if (child_interface_p (obj, ifaces[i]))
- {
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-match_interfaces_none_p (AtkObject * obj, gchar ** ifaces)
-{
- gint i;
-
- for (i = 0; ifaces[i]; i++)
- if (child_interface_p (obj, ifaces[i]))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-match_interfaces_lookup (AtkObject * child, MatchRulePrivate * mrp)
-{
- switch (mrp->interfacematchtype)
- {
-
- case ATSPI_Collection_MATCH_ALL:
- if (match_interfaces_all_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_ANY:
- if (match_interfaces_any_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_NONE:
- if (match_interfaces_none_p (child, mrp->ifaces))
- return TRUE;
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-#define split_attributes(attributes) (g_strsplit (attributes, ";", 0))
-
-static gboolean
-match_attributes_all_p (AtkObject * child, AtkAttributeSet * attributes)
-{
- int i, k;
- AtkAttributeSet *oa;
- gint length, oa_length;
- gboolean flag = FALSE;
-
- if (attributes == NULL || g_slist_length (attributes) == 0)
- return TRUE;
-
- oa = atk_object_get_attributes (child);
- length = g_slist_length (attributes);
- oa_length = g_slist_length (oa);
-
- for (i = 0; i < length; i++)
- {
- AtkAttribute *attr = g_slist_nth_data (attributes, i);
- for (k = 0; k < oa_length; k++)
- {
- AtkAttribute *oa_attr = g_slist_nth_data (attributes, i);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value))
- {
- flag = TRUE;
- break;
- }
- else
- flag = FALSE;
- }
- if (!flag)
- {
- atk_attribute_set_free (oa);
- return FALSE;
- }
- }
- atk_attribute_set_free (oa);
- return TRUE;
-}
-
-static gboolean
-match_attributes_any_p (AtkObject * child, AtkAttributeSet * attributes)
-{
- int i, k;
-
- AtkAttributeSet *oa;
- gint length, oa_length;
-
- length = g_slist_length (attributes);
- if (length == 0)
- return TRUE;
-
- oa = atk_object_get_attributes (child);
- oa_length = g_slist_length (oa);
-
- for (i = 0; i < length; i++)
- {
- AtkAttribute *attr = g_slist_nth_data (attributes, i);
- for (k = 0; k < oa_length; k++)
- {
- AtkAttribute *oa_attr = g_slist_nth_data (oa, k);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value))
- {
- atk_attribute_set_free (oa);
- return TRUE;
- }
- }
- }
- atk_attribute_set_free (oa);
- return FALSE;
-}
-
-static gboolean
-match_attributes_none_p (AtkObject * child, AtkAttributeSet * attributes)
-{
- int i, k;
-
- AtkAttributeSet *oa;
- gint length, oa_length;
-
- length = g_slist_length (attributes);
- if (length == 0)
- return TRUE;
-
- oa = atk_object_get_attributes (child);
- oa_length = g_slist_length (oa);
-
- for (i = 0; i < length; i++)
- {
- AtkAttribute *attr = g_slist_nth_data (attributes, i);
- for (k = 0; k < oa_length; k++)
- {
- AtkAttribute *oa_attr = g_slist_nth_data (attributes, i);
- if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
- !g_ascii_strcasecmp (oa_attr->value, attr->value))
- {
- atk_attribute_set_free (oa);
- return FALSE;
- }
- }
- }
- atk_attribute_set_free (oa);
- return TRUE;
-}
-
-static gboolean
-match_attributes_lookup (AtkObject * child, MatchRulePrivate * mrp)
-{
- switch (mrp->attributematchtype)
- {
-
- case ATSPI_Collection_MATCH_ALL:
- if (match_attributes_all_p (child, mrp->attributes))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_ANY:
- if (match_attributes_any_p (child, mrp->attributes))
- return TRUE;
- break;
-
- case ATSPI_Collection_MATCH_NONE:
- if (match_attributes_none_p (child, mrp->attributes))
- return TRUE;
- break;
-
- default:
- break;
- }
- return FALSE;
-}
-
-static gboolean
-traverse_p (AtkObject * child, const gboolean traverse)
-{
- if (traverse)
- return TRUE;
- else
- return !child_collection_p (child);
-}
-
-static int
-sort_order_canonical (MatchRulePrivate * mrp, GList * ls,
- gint kount, gint max,
- AtkObject * obj, glong index, gboolean flag,
- AtkObject * pobj, gboolean recurse, gboolean traverse)
-{
- gint i = index;
- glong acount = atk_object_get_n_accessible_children (obj);
- gboolean prev = pobj ? TRUE : FALSE;
-
- for (; i < acount && (max == 0 || kount < max); i++)
- {
- AtkObject *child = atk_object_ref_accessible_child (obj, i);
-
- if (!child)
- continue;
-
- if (prev && child == pobj)
- {
- g_object_unref (child);
- return kount;
- }
-
- if (flag && match_interfaces_lookup (child, mrp)
- && match_states_lookup (child, mrp)
- && match_roles_lookup (child, mrp)
- && match_attributes_lookup (child, mrp))
- {
-
- ls = g_list_append (ls, child);
- kount++;
- }
-
- if (!flag)
- flag = TRUE;
-
- if (recurse && traverse_p (child, traverse))
- kount = sort_order_canonical (mrp, ls, kount,
- max, child, 0, TRUE,
- pobj, recurse, traverse);
- g_object_unref (child);
- }
- return kount;
-}
-
-static int
-sort_order_rev_canonical (MatchRulePrivate * mrp, GList * ls,
- gint kount, gint max,
- AtkObject * obj, gboolean flag, AtkObject * pobj)
-{
- AtkObject *nextobj;
- AtkObject *parent;
- glong indexinparent;
-
- /* This breaks us out of the recursion. */
- if (!obj || obj == pobj)
- {
- return kount;
- }
-
- /* Add to the list if it matches */
- if (flag && match_interfaces_lookup (obj, mrp)
- && match_states_lookup (obj, mrp)
- && match_roles_lookup (obj, mrp) && match_attributes_lookup (obj, mrp)
- && (max == 0 || kount < max))
- {
- ls = g_list_append (ls, obj);
- kount++;
- }
-
- if (!flag)
- flag = TRUE;
-
- /* Get the current nodes index in it's parent and the parent object. */
- indexinparent = atk_object_get_index_in_parent (obj);
- parent = atk_object_get_parent (obj);
-
- if (indexinparent > 0 && (max == 0 || kount < max))
- {
- /* there are still some siblings to visit so get the previous sibling
- and get it's last descendant.
- First, get the previous sibling */
- nextobj = atk_object_ref_accessible_child (parent, indexinparent - 1);
-
- /* Now, drill down the right side to the last descendant */
- while (nextobj && atk_object_get_n_accessible_children (nextobj) > 0)
- {
- AtkObject *follow;
-
- follow = atk_object_ref_accessible_child (nextobj,
- atk_object_get_n_accessible_children
- (nextobj) - 1);
- g_object_unref (nextobj);
- nextobj = follow;
- }
- /* recurse with the last descendant */
- kount = sort_order_rev_canonical (mrp, ls, kount, max,
- nextobj, TRUE, pobj);
- if (nextobj)
- g_object_unref (nextobj);
- }
- else if (max == 0 || kount < max)
- {
- /* no more siblings so next node must be the parent */
- kount = sort_order_rev_canonical (mrp, ls, kount, max,
- parent, TRUE, pobj);
-
- }
- return kount;
-}
-
-static int
-query_exec (MatchRulePrivate * mrp, AtspiCollectionSortOrder sortby,
- GList * ls, gint kount, gint max,
- AtkObject * obj, glong index,
- gboolean flag,
- AtkObject * pobj, gboolean recurse, gboolean traverse)
-{
- switch (sortby)
- {
- case ATSPI_Collection_SORT_ORDER_CANONICAL:
- kount = sort_order_canonical (mrp, ls, 0, max, obj, index, flag,
- pobj, recurse, traverse);
- break;
- case ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL:
- kount = sort_order_canonical (mrp, ls, 0, max, obj, index, flag,
- pobj, recurse, traverse);
- break;
- default:
- kount = 0;
- g_warning ("Sort method not implemented yet");
- break;
- }
-
- return kount;
-}
-
-static gboolean
-bitarray_to_seq (dbus_uint32_t *array, int array_count, int **ret)
-{
- int out_size = 4;
- int out_count = 0;
- int i, j;
- int *out = (int *) g_malloc (out_size * sizeof (int));
-
- if (!out)
- return FALSE;
- for (i = 0; i < array_count; i++)
- {
- for (j = 0; j < 32; j++)
- {
- if (array[i] & (1 << j))
- {
- if (out_count == out_size - 2)
- {
- out_size <<= 1;
- out = (int *) g_realloc (out, out_size * sizeof (int));
- if (!out)
- return FALSE;
- }
- out[out_count++] = i * 32 + j;
- }
- }
- }
- out[out_count] = BITARRAY_SEQ_TERM;
- *ret = out;
- return TRUE;
-}
-
-
-static dbus_bool_t
-read_mr (DBusMessageIter * iter, MatchRulePrivate * mrp)
-{
- DBusMessageIter iter_struct, iter_array, iter_dict, iter_dict_entry;
- dbus_uint32_t *array;
- dbus_int32_t matchType;
- int array_count;
- AtkAttribute *attr;
- int i;
-
- dbus_message_iter_recurse (iter, &iter_struct);
-
- /* states */
- dbus_message_iter_recurse (&iter_struct, &iter_array);
- dbus_message_iter_get_fixed_array (&iter_array, &array, &array_count);
- bitarray_to_seq (array, array_count, &mrp->states);
- for (i = 0; mrp->states[i] != BITARRAY_SEQ_TERM; i++)
- {
- mrp->states[i] = spi_atk_state_from_spi_state (mrp->states[i]);
- }
- dbus_message_iter_next (&iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &matchType);
- dbus_message_iter_next (&iter_struct);
- mrp->statematchtype = matchType;;
-
- /* attributes */
- mrp->attributes = NULL;
- dbus_message_iter_recurse (&iter_struct, &iter_dict);
- while (dbus_message_iter_get_arg_type (&iter_dict) != DBUS_TYPE_INVALID)
- {
- const char *key, *val;
- const char *p, *q;
- dbus_message_iter_recurse (&iter_dict, &iter_dict_entry);
- dbus_message_iter_get_basic (&iter_dict_entry, &key);
- dbus_message_iter_next (&iter_dict_entry);
- dbus_message_iter_get_basic (&iter_dict_entry, &val);
- p = q = val;
- for (;;)
- {
- if (*q == '\0' || (*q == ':' && (q == val || q[-1] != '\\')))
- {
- char *tmp;
- attr = g_new (AtkAttribute, 1);
- attr->name = g_strdup (key);
- attr->value = g_strdup (p);
- attr->value[q - p] = '\0';
- tmp = attr->value;
- while (*tmp != '\0')
- {
- if (*tmp == '\\')
- memmove (tmp, tmp + 1, strlen (tmp));
- else
- tmp++;
- }
- mrp->attributes = g_slist_prepend (mrp->attributes, attr);
- if (*q == '\0')
- break;
- else
- p = ++q;
- }
- else
- q++;
- }
- dbus_message_iter_next (&iter_dict);
- }
- dbus_message_iter_next (&iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &matchType);
- mrp->attributematchtype = matchType;;
- dbus_message_iter_next (&iter_struct);
-
- /* Get roles and role match */
- dbus_message_iter_recurse (&iter_struct, &iter_array);
- dbus_message_iter_get_fixed_array (&iter_array, &array, &array_count);
- bitarray_to_seq (array, array_count, &mrp->roles);
- dbus_message_iter_next (&iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &matchType);
- mrp->rolematchtype = matchType;;
- dbus_message_iter_next (&iter_struct);
-
- /* Get interfaces and interface match */
- dbus_message_iter_recurse (&iter_struct, &iter_array);
- mrp->ifaces = g_new0 (gchar *, 16);
- i = 0;
- while (i < 15 && dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
- {
- char *iface;
- dbus_message_iter_get_basic (&iter_array, &iface);
- mrp->ifaces [i] = g_strdup (iface);
- i++;
- dbus_message_iter_next (&iter_array);
- }
- dbus_message_iter_next (&iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &matchType);
- mrp->interfacematchtype = matchType;;
- dbus_message_iter_next (&iter_struct);
- /* get invert */
- dbus_message_iter_get_basic (&iter_struct, &mrp->invert);
- dbus_message_iter_next (iter);
- return TRUE;
-}
-
-static DBusMessage *
-return_and_free_list (DBusMessage * message, GList * ls)
-{
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
- GList *item;
-
- 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))
- goto oom;
- for (item = ls; item; item = g_list_next (item))
- {
- spi_object_append_reference (&iter_array, ATK_OBJECT (item->data));
- }
- if (!dbus_message_iter_close_container (&iter, &iter_array))
- goto oom;
- g_list_free (ls);
- return reply;
-oom:
- // TODO: Handle out of memory
- g_list_free (ls);
- return reply;
-}
-
-static void
-free_mrp_data (MatchRulePrivate * mrp)
-{
- g_free (mrp->states);
- atk_attribute_set_free (mrp->attributes);
- g_free (mrp->roles);
- g_strfreev (mrp->ifaces);
-}
-
-static DBusMessage *
-GetMatchesFrom (DBusMessage * message,
- AtkObject * current_object,
- MatchRulePrivate * mrp,
- const AtspiCollectionSortOrder sortby,
- const dbus_bool_t isrestrict,
- dbus_int32_t count, const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *parent;
- glong index = atk_object_get_index_in_parent (current_object);
-
- ls = g_list_append (ls, current_object);
-
- if (!isrestrict)
- {
- parent = atk_object_get_parent (current_object);
- query_exec (mrp, sortby, ls, 0, count, parent, index,
- FALSE, NULL, TRUE, traverse);
- }
- else
- query_exec (mrp, sortby, ls, 0, count,
- current_object, 0, FALSE, NULL, TRUE, traverse);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-/*
- inorder traversal from a given object in the hierarchy
-*/
-
-static int
-inorder (AtkObject * collection, MatchRulePrivate * mrp,
- GList * ls, gint kount, gint max,
- AtkObject * obj,
- gboolean flag, AtkObject * pobj, dbus_bool_t traverse)
-{
- int i = 0;
-
- /* First, look through the children recursively. */
- kount = sort_order_canonical (mrp, ls, kount, max, obj, 0, TRUE,
- NULL, TRUE, TRUE);
-
- /* Next, we look through the right subtree */
- while ((max == 0 || kount < max) && obj && obj != collection)
- {
- AtkObject *parent = atk_object_get_parent (obj);
- i = atk_object_get_index_in_parent (obj);
- kount = sort_order_canonical (mrp, ls, kount, max, parent,
- i + 1, TRUE, FALSE, TRUE, TRUE);
- obj = parent;
- }
-
- if (max == 0 || kount < max)
- {
- kount = sort_order_canonical (mrp, ls, kount, max,
- obj, i + 1, TRUE, FALSE, TRUE, TRUE);
- }
-
- return kount;
-}
-
-/*
- GetMatchesInOrder: get matches from a given object in an inorder traversal.
-*/
-
-static DBusMessage *
-GetMatchesInOrder (DBusMessage * message,
- AtkObject * current_object,
- MatchRulePrivate * mrp,
- const AtspiCollectionSortOrder sortby,
- const dbus_bool_t recurse,
- dbus_int32_t count, const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *obj;
-
- ls = g_list_append (ls, current_object);
-
- obj = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
-
- inorder (obj, mrp, ls, 0, count,
- current_object, TRUE, NULL, traverse);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-/*
- GetMatchesInBackOrder: get matches from a given object in a
- reverse order traversal.
-*/
-
-static DBusMessage *
-GetMatchesInBackOrder (DBusMessage * message,
- AtkObject * current_object,
- MatchRulePrivate * mrp,
- const AtspiCollectionSortOrder sortby,
- dbus_int32_t count)
-{
- GList *ls = NULL;
- AtkObject *collection;
-
- ls = g_list_append (ls, current_object);
-
- collection = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
-
- sort_order_rev_canonical (mrp, ls, 0, count, current_object,
- FALSE, collection);
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-static DBusMessage *
-GetMatchesTo (DBusMessage * message,
- AtkObject * current_object,
- MatchRulePrivate * mrp,
- const AtspiCollectionSortOrder sortby,
- const dbus_bool_t recurse,
- const dbus_bool_t isrestrict,
- dbus_int32_t count, const dbus_bool_t traverse)
-{
- GList *ls = NULL;
- AtkObject *obj;
- ls = g_list_append (ls, current_object);
-
- if (recurse)
- {
- obj = ATK_OBJECT (atk_object_get_parent (current_object));
- query_exec (mrp, sortby, ls, 0, count,
- obj, 0, TRUE, current_object, TRUE, traverse);
- }
- else
- {
- obj = ATK_OBJECT (spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
- query_exec (mrp, sortby, ls, 0, count,
- obj, 0, TRUE, current_object, TRUE, traverse);
-
- }
-
- ls = g_list_remove (ls, ls->data);
-
- if (sortby != ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
-
- free_mrp_data (mrp);
- return return_and_free_list (message, ls);
-}
-
-static DBusMessage *
-impl_GetMatchesFrom (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- char *current_object_path = NULL;
- AtkObject *current_object;
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint32_t sortby;
- dbus_uint32_t tree;
- dbus_int32_t count;
- dbus_bool_t traverse;
- const char *signature;
-
- signature = dbus_message_get_signature (message);
- if (strcmp (signature, "o(aiia{ss}iaiiasib)uuib") != 0)
- {
- return droute_invalid_arguments_error (message);
- }
-
- dbus_message_iter_init (message, &iter);
- dbus_message_iter_get_basic (&iter, ¤t_object_path);
- current_object = ATK_OBJECT (spi_register_path_to_object (spi_global_register, current_object_path));
- if (!current_object)
- {
- // TODO: object-not-found error
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_next (&iter);
- if (!read_mr (&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic (&iter, &sortby);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &tree);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &count);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &traverse);
- dbus_message_iter_next (&iter);
-
- switch (tree)
- {
- case ATSPI_Collection_TREE_RESTRICT_CHILDREN:
- return GetMatchesFrom (message, current_object,
- &rule, sortby, TRUE, count, traverse);
- break;
- case ATSPI_Collection_TREE_RESTRICT_SIBLING:
- return GetMatchesFrom (message, current_object,
- &rule, sortby, FALSE, count, traverse);
- break;
- case ATSPI_Collection_TREE_INORDER:
- return GetMatchesInOrder (message, current_object,
- &rule, sortby, TRUE, count, traverse);
- break;
- default:
- return NULL;
- }
-}
-
-static DBusMessage *
-impl_GetMatchesTo (DBusConnection * bus, DBusMessage * message,
- void *user_data)
-{
- char *current_object_path = NULL;
- AtkObject *current_object;
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint32_t sortby;
- dbus_uint32_t tree;
- dbus_bool_t recurse;
- dbus_int32_t count;
- dbus_bool_t traverse;
- const char *signature;
-
- signature = dbus_message_get_signature (message);
- if (strcmp (signature, "o(aiia{ss}iaiiasib)uubib") != 0)
- {
- return droute_invalid_arguments_error (message);
- }
-
- dbus_message_iter_init (message, &iter);
- dbus_message_iter_get_basic (&iter, ¤t_object_path);
- current_object = ATK_OBJECT (spi_register_path_to_object (spi_global_register, current_object_path));
- if (!current_object)
- {
- // TODO: object-not-found error
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_next (&iter);
- if (!read_mr (&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic (&iter, &sortby);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &tree);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &recurse);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &count);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &traverse);
- dbus_message_iter_next (&iter);
-
- switch (tree)
- {
- case ATSPI_Collection_TREE_RESTRICT_CHILDREN:
- return GetMatchesTo (message, current_object,
- &rule, sortby, recurse, TRUE, count, traverse);
- break;
- case ATSPI_Collection_TREE_RESTRICT_SIBLING:
- return GetMatchesTo (message, current_object,
- &rule, sortby, recurse, FALSE, count, traverse);
- break;
- case ATSPI_Collection_TREE_INORDER:
- return GetMatchesInBackOrder (message, current_object,
- &rule, sortby, count);
- break;
- default:
- return NULL;
- }
-}
-
-static void
-append_accessible_properties (DBusMessageIter *iter, AtkObject *obj,
- GArray *properties)
-{
- DBusMessageIter iter_struct, iter_dict, iter_dict_entry;
- AtkStateSet *set;
- gint i;
- gint count;
-
- dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL, &iter_struct);
- spi_object_append_reference (&iter_struct, obj);
- dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "{sv}", &iter_dict);
- if (properties && properties->len)
- {
- gint i;
- for (i = 0; i < properties->len; i++)
- {
- gchar *prop = g_array_index (properties, char *, i);
- DRoutePropertyFunction func;
- GType type;
- func = _atk_bridge_find_property_func (prop, &type);
- if (func && G_TYPE_CHECK_INSTANCE_TYPE (obj, type))
- {
- dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY,
- NULL, &iter_dict_entry);
- dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING, &prop);
- func (&iter_dict_entry, obj);
- dbus_message_iter_close_container (&iter_dict, &iter_dict_entry);
- }
- }
- }
- else
- {
- GHashTableIter hi;
- gpointer key, value;
- g_hash_table_iter_init (&hi, spi_global_app_data->property_hash);
- while (g_hash_table_iter_next (&hi, &key, &value))
- {
- const DRouteProperty *prop = value;
- GType type = _atk_bridge_type_from_iface (key);
- if (!G_TYPE_CHECK_INSTANCE_TYPE (obj, type))
- continue;
- for (;prop->name; prop++)
- {
- const char *p = key + strlen (key);
- gchar *property_name;
- while (p[-1] != '.')
- p--;
- if (!strcmp (p, "Accessible"))
- property_name = g_strdup (prop->name);
- else
- property_name = g_strconcat (p, ".", prop->name, NULL);
- dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY,
- NULL, &iter_dict_entry);
- dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING, &property_name);
- g_free (property_name);
- prop->get (&iter_dict_entry, obj);
- dbus_message_iter_close_container (&iter_dict, &iter_dict_entry);
- }
- }
- }
- dbus_message_iter_close_container (&iter_struct, &iter_dict);
- dbus_message_iter_close_container (iter, &iter_struct);
-
- set = atk_object_ref_state_set (obj);
- if (set)
- {
- gboolean md = atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS);
- g_object_unref (set);
- if (md)
- return;
- }
- count = atk_object_get_n_accessible_children (obj);
- for (i = 0; i < count; i++)
- {
- AtkObject *child = atk_object_ref_accessible_child (obj, i);
- if (child)
- {
- append_accessible_properties (iter, child, properties);
- g_object_unref (child);
- }
- }
-}
-
-#if 0
-static void
-skip (const char **p)
-{
- const char *sig = *p;
- gint nest = (*sig != 'a');
-
- sig++;
- while (*sig)
- {
- if (*sig == '(' || *sig == '{')
- nest++;
- else if (*sig == ')' || *sig == '}')
- nest--;
- sig++;
- }
- *p = sig;
-}
-
-static gboolean
-types_match (DBusMessageIter *iter, char c)
-{
- char t = dbus_message_iter_get_arg_type (iter);
-
- if (t == 'r' && c == '(')
- return TRUE;
- else
- return (t == c);
-}
-
-static void
-walk (DBusMessageIter *iter, const char *sig, gboolean array)
-{
- while (*sig && *sig != ')' && *sig != '}')
- {
- if (array && dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_INVALID)
- break;
- if (!types_match (iter, *sig))
- {
- g_error ("Expected %s, got %c", sig, dbus_message_iter_get_arg_type (iter));
- }
- switch (*sig)
- {
- case 's':
- {
- const char *str;
- DBusError error;
- dbus_error_init (&error);
- dbus_message_iter_get_basic (iter, &str);
- g_print ("%s\n", str);
- if (!dbus_validate_utf8 (str, &error))
- g_error ("Bad UTF-8 string");
- }
- break;
- case 'a':
- {
- DBusMessageIter iter_array;
- dbus_message_iter_recurse (iter, &iter_array);
- walk (&iter_array, sig + 1, TRUE);
- skip (&sig);
- }
- break;
- case DBUS_TYPE_STRUCT:
- case DBUS_TYPE_DICT_ENTRY:
- {
- DBusMessageIter iter_struct;
- dbus_message_iter_recurse (iter, &iter_struct);
- walk (&iter_struct, sig + 1, FALSE);
- skip (&sig);
- }
- }
- dbus_message_iter_next (iter);
- if (!array)
- sig++;
- }
- if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_INVALID)
- g_error ("Unexpected data '%c'", dbus_message_iter_get_arg_type (iter));
-}
-
-static void
-walkm (DBusMessage *message)
-{
- DBusMessageIter iter;
- const char *sig = dbus_message_get_signature (message);
-
- g_print ("sig: %s\n", sig);
- dbus_message_iter_init (message, &iter);
- walk (&iter, sig, FALSE);
-}
-#endif
-
-static DBusMessage *
-impl_GetTree (DBusConnection * bus,
- DBusMessage * message, void *user_data)
-{
- AtkObject *object = (AtkObject *) user_data;
- DBusMessage *reply;
- DBusMessageIter iter, iter_array;
- MatchRulePrivate rule;
- GArray *properties;
-
- g_return_val_if_fail (ATK_IS_OBJECT (user_data),
- droute_not_yet_handled_error (message));
-
- if (strcmp (dbus_message_get_signature (message), "(aiia{ss}iaiiasib)as") != 0)
- return droute_invalid_arguments_error (message);
-
- properties = g_array_new (TRUE, TRUE, sizeof (char *));
- dbus_message_iter_init (message, &iter);
- if (!read_mr (&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
-
- dbus_message_iter_recurse (&iter, &iter_array);
- while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
- {
- const char *prop;
- dbus_message_iter_get_basic (&iter_array, &prop);
- g_array_append_val (properties, prop);
- dbus_message_iter_next (&iter_array);
- }
-
- 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, "((so)a{sv})",
- &iter_array);
- append_accessible_properties (&iter_array, object, properties);
- dbus_message_iter_close_container (&iter, &iter_array);
- }
-#if 0
- walkm (reply);
-#endif
- return reply;
-}
-
-static DBusMessage *
-impl_GetMatches (DBusConnection * bus, DBusMessage * message, void *user_data)
-{
- AtkObject *obj = ATK_OBJECT (spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
- DBusMessageIter iter;
- MatchRulePrivate rule;
- dbus_uint32_t sortby;
- dbus_int32_t count;
- dbus_bool_t traverse;
- GList *ls = NULL;
- const char *signature;
-
- signature = dbus_message_get_signature (message);
- if (strcmp (signature, "(aiia{ss}iaiiasib)uib") != 0)
- {
- return droute_invalid_arguments_error (message);
- }
-
- dbus_message_iter_init (message, &iter);
- if (!read_mr (&iter, &rule))
- {
- return spi_dbus_general_error (message);
- }
- dbus_message_iter_get_basic (&iter, &sortby);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &count);
- dbus_message_iter_next (&iter);
- dbus_message_iter_get_basic (&iter, &traverse);
- dbus_message_iter_next (&iter);
- ls = g_list_prepend (ls, obj);
- count = query_exec (&rule, sortby, ls, 0, count,
- obj, 0, TRUE, NULL, TRUE, traverse);
- ls = g_list_remove (ls, ls->data);
-
- if (sortby == ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL)
- ls = g_list_reverse (ls);
- free_mrp_data (&rule);
- return return_and_free_list (message, ls);
-}
-
-static DRouteMethod methods[] = {
- {impl_GetMatchesFrom, "GetMatchesFrom"},
- {impl_GetMatchesTo, "GetMatchesTo"},
- {impl_GetTree, "GetTree"},
- {impl_GetMatches, "GetMatches"},
- {NULL, NULL}
-};
-
-void
-spi_initialize_collection (DRoutePath * path)
-{
- spi_atk_add_interface (path,
- ATSPI_DBUS_INTERFACE_COLLECTION, spi_org_a11y_atspi_Collection, methods, NULL);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-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('.'))
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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)
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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);
-};
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-atk_bridge_adaptor_init
-atk_bridge_adaptor_cleanup
-atk_bridge_set_event_context
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include<sys/stat.h>
-#include <atk/atk.h>
-
-#include <droute/droute.h>
-#include <atspi/atspi.h>
-#include <atk-bridge.h>
-
-#include "bridge.h"
-#include "event.h"
-#include "adaptors.h"
-#include "object.h"
-#include "accessible-stateset.h"
-
-#include "accessible-register.h"
-#include "accessible-leasing.h"
-#include "accessible-cache.h"
-
-#include "spi-dbus.h"
-
-/*---------------------------------------------------------------------------*/
-
-static DBusHandlerResult
-signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data);
-
-SpiBridge *spi_global_app_data = NULL;
-
-static gboolean inited = FALSE;
-static gboolean atexit_added = FALSE;
-
-/*---------------------------------------------------------------------------*/
-
-static event_data *
-add_event (const char *bus_name, const char *event)
-{
- event_data *evdata;
- gchar **data;
-
- spi_atk_add_client (bus_name);
- evdata = g_new0 (event_data, 1);
- data = g_strsplit (event, ":", 3);
- if (!data)
- {
- g_free (evdata);
- return NULL;
- }
- evdata->bus_name = g_strdup (bus_name);
- evdata->data = data;
- spi_global_app_data->events = g_list_append (spi_global_app_data->events, evdata);
- return evdata;
-}
-
-static GSList *clients = NULL;
-
-static void
-tally_event_reply ()
-{
- static int replies_received = 0;
-
- if (!spi_global_app_data)
- return;
-
- replies_received++;
- if (replies_received == 3)
- {
- if (!clients)
- spi_atk_deregister_event_listeners ();
- spi_global_app_data->events_initialized = TRUE;
- }
-}
-
-GType
-_atk_bridge_type_from_iface (const char *iface)
-{
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_ACCESSIBLE))
- return ATK_TYPE_OBJECT;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_ACTION))
- return ATK_TYPE_ACTION;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_COMPONENT))
- return ATK_TYPE_COMPONENT;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_DOCUMENT))
- return ATK_TYPE_DOCUMENT;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_HYPERTEXT))
- return ATK_TYPE_HYPERTEXT;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_HYPERLINK))
- return ATK_TYPE_HYPERLINK;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_IMAGE))
- return ATK_TYPE_IMAGE;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_SELECTION))
- return ATK_TYPE_SELECTION;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_TABLE))
- return ATK_TYPE_TABLE;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_TEXT))
- return ATK_TYPE_TEXT;
- if (!strcmp (iface, ATSPI_DBUS_INTERFACE_VALUE))
- return ATK_TYPE_VALUE;
- return 0;
-}
-
-DRoutePropertyFunction
-_atk_bridge_find_property_func (const char *property, GType *type)
-{
- const char *iface;
- const char *member;
- DRouteProperty *dp;
-
- if (!strncasecmp (property, "action.", 7))
- {
- iface = ATSPI_DBUS_INTERFACE_ACTION;
- member = property + 7;
- }
- else if (!strncasecmp (property, "component.", 10))
- {
- iface = ATSPI_DBUS_INTERFACE_COMPONENT;
- member = property + 10;
- }
- else if (!strncasecmp (property, "selection.", 10))
- {
- iface = ATSPI_DBUS_INTERFACE_SELECTION;
- member = property + 10;
- }
- else if (!strncasecmp (property, "table.", 6))
- {
- iface = ATSPI_DBUS_INTERFACE_TABLE;
- member = property + 6;
- }
- else if (!strncasecmp (property, "text.", 5))
- {
- iface = ATSPI_DBUS_INTERFACE_TEXT;
- member = property + 5;
- }
- else if (!strncasecmp (property, "value.", 6))
- {
- iface = ATSPI_DBUS_INTERFACE_VALUE;
- member = property + 6;
- }
- else
- {
- iface = ATSPI_DBUS_INTERFACE_ACCESSIBLE;
- member = property;
- }
-
- *type = _atk_bridge_type_from_iface (iface);
-
- dp = g_hash_table_lookup (spi_global_app_data->property_hash, iface);
-
- if (!dp)
- return NULL;
-
- for (;dp->name; dp++)
- {
- if (!strcasecmp (dp->name, member))
- {
- return dp->get;
- }
- }
- return NULL;
-}
-
-static void
-add_property_to_event (event_data *evdata, const char *property)
-{
- AtspiPropertyDefinition *prop = g_new0 (AtspiPropertyDefinition, 1);
- prop->func = _atk_bridge_find_property_func (property, &prop->type);
- if (!prop->func)
- {
- g_warning ("atk-bridge: Request for unknown property '%s'", property);
- g_free (prop);
- return;
- }
-
- prop->name = g_strdup (property);
- evdata->properties = g_slist_append (evdata->properties, prop);
-}
-
-static void
-add_event_from_iter (DBusMessageIter *iter)
-{
- const char *bus_name, *event;
- event_data *evdata;
-
- dbus_message_iter_get_basic (iter, &bus_name);
- dbus_message_iter_next (iter);
- dbus_message_iter_get_basic (iter, &event);
- dbus_message_iter_next (iter);
- evdata = add_event (bus_name, event);
- if (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_ARRAY)
- {
- DBusMessageIter iter_sub_array;
- dbus_message_iter_recurse (iter, &iter_sub_array);
- while (dbus_message_iter_get_arg_type (&iter_sub_array) != DBUS_TYPE_INVALID)
- {
- const char *property;
- dbus_message_iter_get_basic (&iter_sub_array, &property);
- add_property_to_event (evdata, property);
- dbus_message_iter_next (&iter_sub_array);
- }
- }
-}
-
-static void
-get_events_reply (DBusPendingCall *pending, void *user_data)
-{
- DBusMessage *reply = dbus_pending_call_steal_reply (pending);
- DBusMessageIter iter, iter_array, iter_struct;
-
- if (!reply || !spi_global_app_data)
- goto done;
-
- if (strcmp (dbus_message_get_signature (reply), "a(ss)") != 0 &&
- strcmp (dbus_message_get_signature (reply), "a(ssas)") != 0)
- {
- g_warning ("atk-bridge: GetRegisteredEvents returned message with unknown signature");
- goto done;
- }
-
- dbus_message_iter_init (reply, &iter);
- dbus_message_iter_recurse (&iter, &iter_array);
- while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
- {
- dbus_message_iter_recurse (&iter_array, &iter_struct);
- add_event_from_iter (&iter_struct);
- dbus_message_iter_next (&iter_array);
- }
-
-done:
- if (reply)
- dbus_message_unref (reply);
- if (pending)
- dbus_pending_call_unref (pending);
-
- tally_event_reply ();
-}
-
-static void
-get_device_events_reply (DBusPendingCall *pending, void *user_data)
-{
- DBusMessage *reply = dbus_pending_call_steal_reply (pending);
- DBusMessageIter iter, iter_array, iter_struct;
-
- if (!reply)
- goto done;
-
- if (strncmp (dbus_message_get_signature (reply), "a(s", 3) != 0)
- {
- g_warning ("atk-bridge: get_device_events_reply: unknown signature");
- goto done;
- }
-
- dbus_message_iter_init (reply, &iter);
- dbus_message_iter_recurse (&iter, &iter_array);
- while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
- {
- char *bus_name;
- dbus_message_iter_recurse (&iter_array, &iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &bus_name);
- spi_atk_add_client (bus_name);
- dbus_message_iter_next (&iter_array);
- }
-
-done:
- if (reply)
- dbus_message_unref (reply);
- if (pending)
- dbus_pending_call_unref (pending);
-
- tally_event_reply ();
-}
-
-static void
-get_registered_event_listeners (SpiBridge *app)
-{
- DBusMessage *message;
- DBusPendingCall *pending = NULL;
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_REGISTRY,
- ATSPI_DBUS_INTERFACE_REGISTRY,
- "GetRegisteredEvents");
- if (!message)
- return;
-
- dbus_connection_send_with_reply (app->bus, message, &pending, -1);
- dbus_message_unref (message);
- if (!pending)
- {
- spi_global_app_data->events_initialized = TRUE;
- return;
- }
- dbus_pending_call_set_notify (pending, get_events_reply, NULL, NULL);
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_DEC,
- ATSPI_DBUS_INTERFACE_DEC,
- "GetKeystrokeListeners");
- if (!message)
- return;
- pending = NULL;
- dbus_connection_send_with_reply (app->bus, message, &pending, -1);
- dbus_message_unref (message);
- if (!pending)
- {
- spi_global_app_data->events_initialized = TRUE;
- return;
- }
- dbus_pending_call_set_notify (pending, get_device_events_reply, NULL, NULL);
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_DEC,
- ATSPI_DBUS_INTERFACE_DEC,
- "GetDeviceEventListeners");
- if (!message)
- return;
- pending = NULL;
- dbus_connection_send_with_reply (app->bus, message, &pending, -1);
- dbus_message_unref (message);
- if (!pending)
- {
- spi_global_app_data->events_initialized = TRUE;
- return;
- }
- dbus_pending_call_set_notify (pending, get_device_events_reply, NULL, NULL);
-}
-
-static void
-register_reply (DBusPendingCall *pending, void *user_data)
-{
- DBusMessage *reply;
- SpiBridge *app = user_data;
-
- reply = dbus_pending_call_steal_reply (pending);
- dbus_pending_call_unref (pending);
-
- if (!spi_global_app_data)
- {
- if (reply)
- dbus_message_unref (reply);
- return;
- }
-
- if (reply)
- {
- gchar *app_name, *obj_path;
-
- if (strcmp (dbus_message_get_signature (reply), "(so)") != 0)
- {
- g_warning ("AT-SPI: Could not obtain desktop path or name\n");
- }
- else
- {
- DBusMessageIter iter, iter_struct;
- dbus_message_iter_init (reply, &iter);
- dbus_message_iter_recurse (&iter, &iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &app_name);
- dbus_message_iter_next (&iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &obj_path);
-
- g_free (app->desktop_name);
- app->desktop_name = g_strdup (app_name);
- g_free (app->desktop_path);
- app->desktop_path = g_strdup (obj_path);
- }
- }
- else
- {
- g_warning ("AT-SPI: Could not embed inside desktop");
- return;
- }
- dbus_message_unref (reply);
-
- if (!spi_global_app_data->events_initialized)
- get_registered_event_listeners (spi_global_app_data);
-}
-
-static gboolean
-register_application (gpointer data)
-{
- SpiBridge * app = data;
- DBusMessage *message;
- DBusMessageIter iter;
- DBusPendingCall *pending;
-
- spi_global_app_data->registration_pending = 0;
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_ROOT,
- ATSPI_DBUS_INTERFACE_SOCKET,
- "Embed");
-
- dbus_message_iter_init_append (message, &iter);
- spi_object_append_reference (&iter, app->root);
-
- if (!dbus_connection_send_with_reply (app->bus, message, &pending, -1)
- || !pending)
- {
- if (pending)
- dbus_pending_call_unref (pending);
-
- dbus_message_unref (message);
- return FALSE;
- }
-
- dbus_pending_call_set_notify (pending, register_reply, app, NULL);
-
- if (message)
- dbus_message_unref (message);
-
- return FALSE;
-}
-
-void
-_atk_bridge_schedule_application_registration (SpiBridge *app)
-{
- /* We need the callback to be called first thing, before any other of ours
- * (and possibly of client apps), so use a high priority and a short timeout
- * to try and be called first by the main loop. */
- if (!app->registration_pending)
- app->registration_pending = spi_timeout_add_full (G_PRIORITY_HIGH, 0,
- register_application,
- app, NULL);
-}
-
-gboolean
-_atk_bridge_remove_pending_application_registration (SpiBridge *app)
-{
- if (app->registration_pending)
- {
- g_source_remove (app->registration_pending);
- app->registration_pending = 0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static void
-remove_socket ()
-{
- if (!spi_global_app_data)
- return;
-
- if (spi_global_app_data->app_bus_addr &&
- !strncmp (spi_global_app_data->app_bus_addr, "unix:path=", 10))
- {
- unlink (spi_global_app_data->app_bus_addr + 10);
- g_free (spi_global_app_data->app_bus_addr);
- spi_global_app_data->app_bus_addr = NULL;
- }
-
- if (spi_global_app_data->app_tmp_dir)
- {
- rmdir (spi_global_app_data->app_tmp_dir);
- g_free (spi_global_app_data->app_tmp_dir);
- spi_global_app_data->app_tmp_dir = NULL;
- }
-}
-
-static void
-deregister_application (SpiBridge * app)
-{
- DBusMessage *message;
- DBusMessageIter iter;
- const char *uname;
-
- if (_atk_bridge_remove_pending_application_registration (spi_global_app_data))
- return;
-
- message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_REGISTRY,
- ATSPI_DBUS_INTERFACE_REGISTRY,
- "DeregisterApplication");
- dbus_message_set_no_reply (message, TRUE);
-
- uname = dbus_bus_get_unique_name (app->bus);
-
- dbus_message_iter_init_append (message, &iter);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &uname);
- dbus_connection_send (app->bus, message, NULL);
- if (message)
- dbus_message_unref (message);
-
- remove_socket ();
-
- g_free (app->desktop_name);
- app->desktop_name = NULL;
- g_free (app->desktop_path);
- app->desktop_path = NULL;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*---------------------------------------------------------------------------*/
-
-static AtkPlugClass *plug_class;
-static AtkSocketClass *socket_class;
-
-static gchar *
-get_plug_id (AtkPlug * plug)
-{
- const char *uname = dbus_bus_get_unique_name (spi_global_app_data->bus);
- gchar *path;
- GString *str = g_string_new (NULL);
-
- path = spi_register_object_to_path (spi_global_register, G_OBJECT (plug));
- g_string_printf (str, "%s:%s", uname, path);
- g_free (path);
- return g_string_free (str, FALSE);
-}
-
-AtkStateSet *
-socket_ref_state_set (AtkObject *accessible)
-{
- char *child_name, *child_path;
- AtkSocket *socket = ATK_SOCKET (accessible);
- int count = 0;
- int j;
- int v;
- DBusMessage *message, *reply;
- DBusMessageIter iter, iter_array;
- AtkStateSet *set;
-
- set = atk_state_set_new ();
-
- if (!socket->embedded_plug_id)
- return set;
-
- child_name = g_strdup (socket->embedded_plug_id);
- if (!child_name)
- return set;
- child_path = g_utf8_strchr (child_name + 1, -1, ':');
- if (!child_path)
- {
- g_free (child_name);
- return set;
- }
- *(child_path++) = '\0';
- message = dbus_message_new_method_call (child_name, child_path, ATSPI_DBUS_INTERFACE_ACCESSIBLE, "GetState");
- g_free (child_name);
- reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus, message, 1, NULL);
- dbus_message_unref (message);
- if (reply == NULL)
- return set;
- if (strcmp (dbus_message_get_signature (reply), "au") != 0)
- {
- dbus_message_unref (reply);
- return set;
- }
-
- dbus_message_iter_init (reply, &iter);
- dbus_message_iter_recurse (&iter, &iter_array);
- do
- {
- dbus_message_iter_get_basic (&iter_array, &v);
- for (j = 0; j < 32; j++)
- {
- if (v & (1 << j))
- {
- AtkState state = spi_atk_state_from_spi_state ((count << 5) + j);
- atk_state_set_add_state (set, state);
- }
- }
- count++;
- }
- while (dbus_message_iter_next (&iter_array));
- dbus_message_unref (reply);
- return set;
-}
-
-static void
-socket_embed_hook (AtkSocket * socket, const gchar * plug_id)
-{
- g_return_if_fail (spi_global_register != NULL);
-
- AtkObject *accessible = ATK_OBJECT(socket);
- gchar *plug_name, *plug_path;
- AtkObjectClass *klass;
-
- /* Force registration */
- gchar *path = spi_register_object_to_path (spi_global_register, G_OBJECT (accessible));
- /* Let the plug know that it has been embedded */
- plug_name = g_strdup (plug_id);
- if (!plug_name)
- {
- g_free (path);
- return;
- }
- plug_path = g_utf8_strchr (plug_name + 1, -1, ':');
- if (plug_path)
- {
- DBusMessage *message;
- *(plug_path++) = '\0';
- message = dbus_message_new_method_call (plug_name, plug_path, ATSPI_DBUS_INTERFACE_SOCKET, "Embedded");
- dbus_message_append_args (message, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID);
- dbus_connection_send (spi_global_app_data->bus, message, NULL);
- }
- g_free (plug_name);
- g_free (path);
-
- klass = ATK_OBJECT_GET_CLASS (accessible);
- klass->ref_state_set = socket_ref_state_set;
-}
-
-static void
-install_plug_hooks ()
-{
- gpointer data;
-
- data = g_type_class_ref (ATK_TYPE_PLUG);
- plug_class = ATK_PLUG_CLASS (data);
- data = g_type_class_ref (ATK_TYPE_SOCKET);
- socket_class = ATK_SOCKET_CLASS (data);
- plug_class->get_object_id = get_plug_id;
- socket_class->embed = socket_embed_hook;
-}
-
-static guint
-get_ancestral_uid (guint pid)
-{
- FILE *fp;
- char buf [80];
- int ppid = 0;
- int uid = 0;
- gboolean got_ppid = 0;
- gboolean got_uid = 0;
-
- sprintf (buf, "/proc/%d/status", pid);
- fp = fopen (buf, "r");
- if (!fp)
- return 0;
- while ((!got_ppid || !got_uid) && fgets (buf, sizeof (buf), fp))
- {
- if (sscanf (buf, "PPid:\t%d", &ppid) == 1)
- got_ppid = TRUE;
- else if (sscanf (buf, "Uid:\t%d", &uid) == 1)
- got_uid = TRUE;
- }
- fclose (fp);
-
- if (!got_ppid || !got_uid)
- return 0;
- if (uid != 0)
- return uid;
- if (ppid == 0 || ppid == 1)
- return 0;
- return get_ancestral_uid (ppid);
-}
-
-static dbus_bool_t
-user_check (DBusConnection *bus, unsigned long uid, void *data)
-{
- if (uid == getuid () || uid == geteuid ())
- return TRUE;
- if (getuid () == 0)
- {
- guint ancestor = get_ancestral_uid (getpid ());
- return (ancestor == uid || ancestor == 1 || ancestor == 0);
- }
- return FALSE;
-}
-
-static void
-new_connection_cb (DBusServer *server, DBusConnection *con, void *data)
-{
- dbus_connection_set_unix_user_function (con, user_check, NULL, NULL);
- dbus_connection_ref(con);
- atspi_dbus_connection_setup_with_g_main(con, spi_context);
- droute_intercept_dbus (con);
- droute_context_register (spi_global_app_data->droute, con);
-
- spi_global_app_data->direct_connections = g_list_append (spi_global_app_data->direct_connections, con);
-}
-
-
-gchar *atspi_dbus_name = NULL;
-static gboolean atspi_no_register = FALSE;
-
-static GOptionEntry atspi_option_entries[] = {
- {"atspi-dbus-name", 0, 0, G_OPTION_ARG_STRING, &atspi_dbus_name,
- "D-Bus bus name to register as", NULL},
- {"atspi-no-register", 0, 0, G_OPTION_ARG_NONE, &atspi_no_register,
- "Do not register with Registry Daemon", NULL},
- {NULL}
-};
-
-static gchar *
-introspect_children_cb (const char *path, void *data)
-{
- if (!strcmp (path, "/org/a11y/atspi/accessible"))
- {
- return g_strdup ("<node name=\"root\"/>\n");
- /* TODO: Should we place the whole hierarchy here? */
- }
- return NULL;
-}
-
-static void
-handle_event_listener_registered (DBusConnection *bus, DBusMessage *message,
- void *user_data)
-{
- DBusMessageIter iter;
- const char *signature = dbus_message_get_signature (message);
-
- if (strcmp (signature, "ssas") != 0 &&
- strcmp (signature, "ss") != 0)
- {
- g_warning ("got RegisterEvent with invalid signature '%s'", signature);
- return;
- }
-
- dbus_message_iter_init (message, &iter);
- add_event_from_iter (&iter);
-}
-
-static void
-free_property_definition (void *data)
-{
- AtspiPropertyDefinition *pd = data;
-
- g_free (pd->name);
- g_free (pd);
-}
-
-static void
-remove_events (const char *bus_name, const char *event)
-{
- gchar **remove_data;
- GList *list;
-
- remove_data = g_strsplit (event, ":", 3);
- if (!remove_data)
- {
- return;
- }
-
- for (list = spi_global_app_data->events; list;)
- {
- event_data *evdata = list->data;
- if (!g_strcmp0 (evdata->bus_name, bus_name) &&
- spi_event_is_subtype (evdata->data, remove_data))
- {
- GList *next;
- GList *events = spi_global_app_data->events;
-
- g_strfreev (evdata->data);
- g_free (evdata->bus_name);
- g_slist_free_full (evdata->properties, free_property_definition);
- g_free (evdata);
-
- next = list->next;
- spi_global_app_data->events = g_list_delete_link (events, list);
- list = next;
- }
- else
- {
- list = list->next;
- }
- }
-
- g_strfreev (remove_data);
-}
-
-static void
-handle_event_listener_deregistered (DBusConnection *bus, DBusMessage *message,
- void *user_data)
-{
- gchar *name;
- char *sender;
-
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &sender,
- DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
- return;
-
- remove_events (sender, name);
-}
-
-static void
-handle_device_listener_registered (DBusConnection *bus, DBusMessage *message,
- void *user_data)
-{
- char *sender;
- DBusMessageIter iter, iter_struct;
-
- if (strncmp (dbus_message_get_signature (message), "(s", 2) != 0)
- {
- g_warning ("atk-bridge: handle_device_listener_register: unknown signature");
- return;
- }
-
- dbus_message_iter_init (message, &iter);
- dbus_message_iter_recurse (&iter, &iter_struct);
- dbus_message_iter_get_basic (&iter_struct, &sender);
- spi_atk_add_client (sender);
-}
-
-static DBusHandlerResult
-signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- const char *interface = dbus_message_get_interface (message);
- const char *member = dbus_message_get_member (message);
- DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- static gboolean registry_lost = FALSE;
-
- if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (!strcmp (interface, ATSPI_DBUS_INTERFACE_REGISTRY))
- {
- result = DBUS_HANDLER_RESULT_HANDLED;
- if (!strcmp (member, "EventListenerRegistered"))
- handle_event_listener_registered (bus, message, user_data);
- else if (!strcmp (member, "EventListenerDeregistered"))
- handle_event_listener_deregistered (bus, message, user_data);
- else
- result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- else if (!strcmp (interface, ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER))
- {
- result = DBUS_HANDLER_RESULT_HANDLED;
- if (!strcmp (member, "KeystrokeListenerRegistered"))
- handle_device_listener_registered (bus, message, user_data);
- else if (!strcmp (member, "DeviceListenerRegistered"))
- handle_device_listener_registered (bus, message, user_data);
- else
- result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- if (!g_strcmp0(interface, DBUS_INTERFACE_DBUS) &&
- !g_strcmp0(member, "NameOwnerChanged"))
- {
- char *name, *old, *new;
- if (dbus_message_get_args (message, NULL,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &old,
- DBUS_TYPE_STRING, &new,
- DBUS_TYPE_INVALID))
- {
- if (!strcmp (name, "org.a11y.atspi.Registry"))
- {
- if (registry_lost && !old[0])
- {
- register_application (spi_global_app_data);
- registry_lost = FALSE;
- }
- else if (!new[0])
- registry_lost = TRUE;
- }
- else if (*old != '\0' && *new == '\0')
- spi_atk_remove_client (old);
- }
- }
-
- return result;
-}
-
-int
-spi_atk_create_socket (SpiBridge *app)
-{
-#ifndef DISABLE_P2P
- DBusServer *server;
- DBusError error;
- const gchar *user_runtime_dir = g_get_user_runtime_dir ();
-
- if (g_mkdir_with_parents (user_runtime_dir, 0700) != 0)
- return -1;
-
- if (getuid () != 0)
- {
- app->app_tmp_dir = g_build_filename (user_runtime_dir,
- "at-spi2-XXXXXX", NULL);
- if (!g_mkdtemp (app->app_tmp_dir))
- {
- g_free (app->app_tmp_dir);
- app->app_tmp_dir = NULL;
- return -1;
- }
- }
-
- if (app->app_tmp_dir)
- app->app_bus_addr = g_strdup_printf ("unix:path=%s/socket", app->app_tmp_dir);
- else
- app->app_bus_addr = g_strdup_printf ("unix:path=%s/at-spi2-socket-%d",
- user_runtime_dir, getpid ());
-
- if (!spi_global_app_data->app_bus_addr)
- return -1;
-
- dbus_error_init(&error);
- server = dbus_server_listen(spi_global_app_data->app_bus_addr, &error);
- if (server == NULL)
- {
- g_warning ("atk-bridge: Couldn't listen on dbus server: %s", error.message);
- dbus_error_free (&error);
- spi_global_app_data->app_bus_addr [0] = '\0';
- return -1;
- }
-
- atspi_dbus_server_setup_with_g_main(server, spi_context);
- dbus_server_set_new_connection_function(server, new_connection_cb, NULL, NULL);
-
- spi_global_app_data->server = server;
-#endif
-
- return 0;
-}
-
-/*
- * Checks the status of the environment variables
- *
- * At this moment it only checks NO_AT_BRIDGE
- *
- * Returns TRUE if there isn't anything on the environment preventing
- * you to load the bridge, FALSE otherwise
- */
-static gboolean
-check_envvar (void)
-{
- const gchar *envvar;
-
- envvar = g_getenv ("NO_AT_BRIDGE");
-
- if (envvar && atoi (envvar) == 1)
- return FALSE;
- else
- return TRUE;
-}
-
-void
-spi_atk_activate ()
-{
- DRoutePath *treepath;
-
- spi_atk_register_event_listeners ();
- if (!spi_global_cache)
- {
- spi_global_cache = g_object_new (SPI_CACHE_TYPE, NULL);
- treepath = droute_add_one (spi_global_app_data->droute,
- "/org/a11y/atspi/cache", spi_global_cache);
-
- if (!treepath)
- {
- g_warning ("atk-bridge: Error in droute_add_one(). Already running?");
- return;
- }
- spi_initialize_cache (treepath);
- if (spi_global_app_data->bus)
- droute_path_register (treepath, spi_global_app_data->bus);
- }
-}
-
-/**
- * atk_bridge_adaptor_init: initializes the atk bridge adaptor
- *
- * The following needs to be initialized.
- *
- * - DRoute for routing message to their accessible objects.
- * - Event handlers for emmitting signals on specific ATK events.
- * - setup the bus for p2p communication
- * - Application registration with the AT-SPI registry.
- *
- * Returns: 0 if the bridge gets or was already initialized
- * succesfully, -1 otherwise
- */
-int
-atk_bridge_adaptor_init (gint * argc, gchar ** argv[])
-{
- GOptionContext *opt;
- GError *err = NULL;
- DBusError error;
- AtkObject *root;
- gboolean load_bridge;
- DRoutePath *accpath;
-
- load_bridge = check_envvar ();
- if (inited && !load_bridge)
- g_warning ("ATK Bridge is disabled but a11y has already been enabled.");
-
- if (inited)
- return 0;
- if (!load_bridge)
- return -1;
-
- inited = TRUE;
-
- root = atk_get_root ();
- g_warn_if_fail (root);
- if (!root)
- {
- inited = FALSE;
- return -1;
- }
-
- /* Parse command line options */
- opt = g_option_context_new (NULL);
- g_option_context_add_main_entries (opt, atspi_option_entries, NULL);
- g_option_context_set_ignore_unknown_options (opt, TRUE);
- if (!g_option_context_parse (opt, argc, argv, &err))
- {
- g_warning ("AT-SPI Option parsing failed: %s\n", err->message);
- g_error_free (err);
- }
- g_option_context_free (opt);
-
- /* Allocate global data and do ATK initializations */
- spi_global_app_data = g_new0 (SpiBridge, 1);
- spi_global_app_data->root = g_object_ref (root);
- spi_global_app_data->desktop_name = g_strdup (ATSPI_DBUS_NAME_REGISTRY);
- spi_global_app_data->desktop_path = g_strdup (ATSPI_DBUS_PATH_ROOT);
-
- /* Set up D-Bus connection and register bus name */
- dbus_error_init (&error);
- spi_global_app_data->bus = atspi_get_a11y_bus ();
- if (!spi_global_app_data->bus)
- {
- g_free (spi_global_app_data);
- spi_global_app_data = NULL;
- inited = FALSE;
- return -1;
- }
-
- if (atspi_dbus_name != NULL)
- {
- if (dbus_bus_request_name
- (spi_global_app_data->bus, atspi_dbus_name, 0, &error))
- {
- g_print ("AT-SPI Recieved D-Bus name - %s\n", atspi_dbus_name);
- }
- else
- {
- g_print
- ("AT-SPI D-Bus name requested but could not be allocated - %s\n",
- atspi_dbus_name);
- }
- }
-
- spi_global_app_data->main_context = g_main_context_new ();
-
- atspi_dbus_connection_setup_with_g_main (spi_global_app_data->bus, NULL);
-
- /* Hook our plug-and socket functions */
- install_plug_hooks ();
-
- /*
- * Create the leasing, register and cache objects.
- * The order is important here, the cache depends on the
- * register object.
- */
- spi_global_register = g_object_new (SPI_REGISTER_TYPE, NULL);
- spi_global_leasing = g_object_new (SPI_LEASING_TYPE, NULL);
-
- /* Register droute for routing AT-SPI messages */
- spi_global_app_data->droute =
- droute_new ();
-
- accpath = droute_add_many (spi_global_app_data->droute,
- "/org/a11y/atspi/accessible",
- NULL,
- introspect_children_cb,
- NULL,
- (DRouteGetDatumFunction)
- spi_global_register_path_to_object);
-
-
- /* Register all interfaces with droute and set up application accessible db */
- spi_initialize_accessible (accpath);
- spi_initialize_application (accpath);
- spi_initialize_action (accpath);
- spi_initialize_collection (accpath);
- spi_initialize_component (accpath);
- spi_initialize_document (accpath);
- spi_initialize_editabletext (accpath);
- spi_initialize_hyperlink (accpath);
- spi_initialize_hypertext (accpath);
- spi_initialize_image (accpath);
- spi_initialize_selection (accpath);
- spi_initialize_socket (accpath);
- spi_initialize_table (accpath);
- spi_initialize_table_cell (accpath);
- spi_initialize_text (accpath);
- spi_initialize_value (accpath);
-
- droute_context_register (spi_global_app_data->droute,
- spi_global_app_data->bus);
-
- /* Register methods to send D-Bus signals on certain ATK events */
- if (clients)
- spi_atk_activate ();
-
- /* Set up filter and match rules to catch signals */
- dbus_bus_add_match (spi_global_app_data->bus, "type='signal', interface='org.a11y.atspi.Registry', sender='org.a11y.atspi.Registry'", NULL);
- dbus_bus_add_match (spi_global_app_data->bus, "type='signal', interface='org.a11y.atspi.DeviceEventListener', sender='org.a11y.atspi.Registry'", NULL);
- dbus_bus_add_match (spi_global_app_data->bus, "type='signal', arg0='org.a11y.atspi.Registry', interface='org.freedesktop.DBus', member='NameOwnerChanged'", NULL);
- dbus_connection_add_filter (spi_global_app_data->bus, signal_filter, NULL,
- NULL);
-
- /* Register this app by sending a signal out to AT-SPI registry daemon */
- if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)))
- _atk_bridge_schedule_application_registration (spi_global_app_data);
- else
- get_registered_event_listeners (spi_global_app_data);
-
- if (!atexit_added)
- atexit (remove_socket);
- atexit_added = TRUE;
-
- dbus_error_free (&error);
- return 0;
-}
-
-void
-atk_bridge_adaptor_cleanup (void)
-{
- GList *l;
- GSList *ls;
-
- if (!inited)
- return;
-
- if (!spi_global_app_data)
- return;
-
- spi_atk_tidy_windows ();
- spi_atk_deregister_event_listeners ();
-
- deregister_application (spi_global_app_data);
-
- if (spi_global_app_data->bus)
- {
- dbus_connection_remove_filter (spi_global_app_data->bus, signal_filter, NULL);
- droute_context_unregister (spi_global_app_data->droute, spi_global_app_data->bus);
- dbus_connection_close (spi_global_app_data->bus);
- dbus_connection_unref (spi_global_app_data->bus);
- spi_global_app_data->bus = NULL;
- }
-
- for (l = spi_global_app_data->direct_connections; l; l = l->next)
- {
- DBusConnection *connection;
-
- connection = l->data;
-
- droute_context_unregister (spi_global_app_data->droute, connection);
- droute_unintercept_dbus (connection);
- dbus_connection_close (connection);
- dbus_connection_unref (connection);
- }
- g_list_free (spi_global_app_data->direct_connections);
- spi_global_app_data->direct_connections = NULL;
-
- for (ls = clients; ls; ls = ls->next)
- g_free (ls->data);
- g_slist_free (clients);
- clients = NULL;
-
- g_clear_object (&spi_global_cache);
- g_clear_object (&spi_global_leasing);
- g_clear_object (&spi_global_register);
-
- if (spi_global_app_data->main_context)
- g_main_context_unref (spi_global_app_data->main_context);
-
- droute_free (spi_global_app_data->droute);
-
- g_free (spi_global_app_data);
- spi_global_app_data = NULL;
-
- inited = FALSE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static gchar *name_match_tmpl =
- "type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged', arg0='%s'";
-
-void
-spi_atk_add_client (const char *bus_name)
-{
- GSList *l;
- gchar *match;
-
- for (l = clients; l; l = l->next)
- {
- if (!g_strcmp0 (l->data, bus_name))
- return;
- }
- if (!clients)
- spi_atk_activate ();
- clients = g_slist_append (clients, g_strdup (bus_name));
- match = g_strdup_printf (name_match_tmpl, bus_name);
- dbus_bus_add_match (spi_global_app_data->bus, match, NULL);
- g_free (match);
-}
-
-void
-spi_atk_remove_client (const char *bus_name)
-{
- GSList *l;
- GSList *next_node;
-
- l = clients;
- while (l)
- {
- next_node = l->next;
-
- if (!g_strcmp0 (l->data, bus_name))
- {
- gchar *match = g_strdup_printf (name_match_tmpl, l->data);
- dbus_bus_remove_match (spi_global_app_data->bus, match, NULL);
- g_free (match);
- g_free (l->data);
- clients = g_slist_delete_link (clients, l);
- if (!clients)
- spi_atk_deregister_event_listeners ();
- return;
- }
-
- l = next_node;
- }
-}
-
-void
-spi_atk_add_interface (DRoutePath *path,
- const char *name,
- const char *introspect,
- const DRouteMethod *methods,
- const DRouteProperty *properties)
-{
- droute_path_add_interface (path, name, introspect, methods, properties);
-
- if (properties)
- {
- if (!spi_global_app_data->property_hash)
- spi_global_app_data->property_hash = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free, NULL);
- g_hash_table_insert (spi_global_app_data->property_hash, g_strdup (name),
- (gpointer) properties);
- }
-}
-/*END------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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);
-
-void _atk_bridge_schedule_application_registration (SpiBridge *app);
-gboolean _atk_bridge_remove_pending_application_registration (SpiBridge *app);
-G_END_DECLS
-
-#endif /* BRIDGE_H */
+++ /dev/null
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2011, F123 Consulting & Mais Diferenças
- * 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.
- */
-
-#include <string.h>
-#include <ctype.h>
-
-#include <atk/atk.h>
-#include <droute/droute.h>
-#include <atspi/atspi.h>
-
-#include "bridge.h"
-#include "accessible-register.h"
-
-#include "spi-dbus.h"
-#include "event.h"
-#include "object.h"
-
-static GArray *listener_ids = NULL;
-
-static gint atk_bridge_key_event_listener_id;
-static gint atk_bridge_focus_tracker_id;
-
-GMainContext *spi_context = NULL;
-
-/*---------------------------------------------------------------------------*/
-
-#define ITF_EVENT_OBJECT "org.a11y.atspi.Event.Object"
-#define ITF_EVENT_WINDOW "org.a11y.atspi.Event.Window"
-#define ITF_EVENT_DOCUMENT "org.a11y.atspi.Event.Document"
-#define ITF_EVENT_FOCUS "org.a11y.atspi.Event.Focus"
-
-/*---------------------------------------------------------------------------*/
-
-typedef struct _SpiReentrantCallClosure
-{
- DBusConnection *bus;
- GMainLoop *loop;
- DBusMessage *reply;
- guint timeout;
-} SpiReentrantCallClosure;
-
-static void
-switch_main_context (GMainContext *cnx)
-{
- GList *list;
-
- if (spi_global_app_data->server)
- atspi_dbus_server_setup_with_g_main (spi_global_app_data->server, cnx);
- atspi_dbus_connection_setup_with_g_main (spi_global_app_data->bus, cnx);
- atspi_set_main_context (cnx);
- for (list = spi_global_app_data->direct_connections; list; list = list->next)
- atspi_dbus_connection_setup_with_g_main (list->data, cnx);
-
- if (_atk_bridge_remove_pending_application_registration (spi_global_app_data))
- _atk_bridge_schedule_application_registration (spi_global_app_data);
-}
-
-guint
-spi_idle_add(GSourceFunc function, gpointer data)
-{
- GSource *source;
- guint id;
-
- source = g_idle_source_new ();
- g_source_set_callback (source, function, data, NULL);
- id = g_source_attach (source, spi_context);
- g_source_unref (source);
-
- return id;
-}
-
-guint
-spi_timeout_add_seconds (gint interval, GSourceFunc function, gpointer data)
-{
- GSource *source;
- guint id;
-
- source = g_timeout_source_new_seconds (interval);
- g_source_set_callback (source, function, data, NULL);
- id = g_source_attach (source, spi_context);
- g_source_unref (source);
-
- return id;
-}
-
-guint
-spi_timeout_add_full (gint priority, guint interval, GSourceFunc function,
- gpointer data, GDestroyNotify notify)
-{
- GSource *source;
- guint id;
-
- source = g_timeout_source_new (interval);
- g_source_set_priority (source, priority);
- g_source_set_callback (source, function, data, notify);
- id = g_source_attach (source, spi_context);
- g_source_unref (source);
-
- return id;
-}
-
-static void
-set_reply (DBusPendingCall * pending, void *user_data)
-{
- SpiReentrantCallClosure* closure = (SpiReentrantCallClosure *) user_data;
-
- closure->reply = dbus_pending_call_steal_reply (pending);
- dbus_pending_call_unref (pending);
- switch_main_context (spi_context);
- g_main_loop_quit (closure->loop);
-}
-
-static gboolean
-timeout_reply (void *data)
-{
- SpiReentrantCallClosure *closure = data;
-
- switch_main_context (spi_context);
- g_main_loop_quit (closure->loop);
- closure->timeout = -1;
- return FALSE;
-}
-
-static DBusMessage *
-send_and_allow_reentry (DBusConnection * bus, DBusMessage * message)
-{
- DBusPendingCall *pending;
- SpiReentrantCallClosure closure;
- GSource *source;
-
- closure.bus = bus;
- closure.loop = g_main_loop_new (spi_global_app_data->main_context, FALSE);
- closure.reply = NULL;
- switch_main_context (spi_global_app_data->main_context);
-
- if (!dbus_connection_send_with_reply (bus, message, &pending, 9000) || !pending)
- {
- switch_main_context (spi_context);
- return NULL;
- }
- dbus_pending_call_set_notify (pending, set_reply, (void *) &closure, NULL);
- source = g_timeout_source_new (500);
- g_source_set_callback (source, timeout_reply, &closure, NULL);
- closure.timeout = g_source_attach (source, spi_global_app_data->main_context);
- g_source_unref (source);
- g_main_loop_run (closure.loop);
- if (closure.timeout != -1)
- g_source_destroy (source);
-
- g_main_loop_unref (closure.loop);
- if (!closure.reply)
- dbus_pending_call_cancel (pending);
- return closure.reply;
-}
-
-void
-atk_bridge_set_event_context(GMainContext *cnx)
-{
- spi_context = cnx;
- switch_main_context(spi_context);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Functionality related to sending device events from the application.
- *
- * This is used for forwarding key events on to the registry daemon.
- */
-
-static gboolean
-Accessibility_DeviceEventController_NotifyListenersSync (const
- AtspiDeviceEvent
- * key_event)
-{
- DBusMessage *message;
- dbus_bool_t consumed = FALSE;
-
- message =
- dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- ATSPI_DBUS_PATH_DEC,
- ATSPI_DBUS_INTERFACE_DEC,
- "NotifyListenersSync");
-
- if (spi_dbus_marshal_deviceEvent (message, key_event))
- {
- DBusMessage *reply =
- send_and_allow_reentry (spi_global_app_data->bus, message);
- if (reply)
- {
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN,
- &consumed, DBUS_TYPE_INVALID))
- {
- /* TODO: print a warning */
- dbus_error_free (&error);
- }
- dbus_message_unref (reply);
- }
- }
- dbus_message_unref (message);
- return consumed;
-}
-
-static void
-spi_init_keystroke_from_atk_key_event (AtspiDeviceEvent * keystroke,
- AtkKeyEventStruct * event)
-{
- keystroke->id = (dbus_int32_t) event->keyval;
- keystroke->hw_code = (dbus_int16_t) event->keycode;
- keystroke->timestamp = (dbus_uint32_t) event->timestamp;
- keystroke->modifiers = (dbus_uint16_t) (event->state & 0xFFFF);
- if (event->string)
- {
- gunichar c;
-
- keystroke->event_string = g_strdup (event->string);
- c = g_utf8_get_char_validated (event->string, -1);
- if (c > 0 && g_unichar_isprint (c))
- keystroke->is_text = TRUE;
- else
- keystroke->is_text = FALSE;
- }
- else
- {
- keystroke->event_string = g_strdup ("");
- keystroke->is_text = FALSE;
- }
- switch (event->type)
- {
- case (ATK_KEY_EVENT_PRESS):
- keystroke->type = ATSPI_KEY_PRESSED;
- break;
- case (ATK_KEY_EVENT_RELEASE):
- keystroke->type = ATSPI_KEY_RELEASED;
- break;
- default:
- keystroke->type = 0;
- break;
- }
-#if 0
- g_print
- ("key_event type %d; val=%d code=%d modifiers=%x name=%s is_text=%d, time=%lx\n",
- (int) keystroke->type, (int) keystroke->id, (int) keystroke->hw_code,
- (int) keystroke->modifiers, keystroke->event_string,
- (int) keystroke->is_text, (unsigned long) keystroke->timestamp);
-#endif
-}
-
-
-static gint
-spi_atk_bridge_key_listener (AtkKeyEventStruct * event, gpointer data)
-{
- gboolean result;
- AtspiDeviceEvent key_event;
-
- spi_init_keystroke_from_atk_key_event (&key_event, event);
-
- result =
- Accessibility_DeviceEventController_NotifyListenersSync (&key_event);
-
- if (key_event.event_string)
- g_free (key_event.event_string);
-
- return result;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static const void *
-validate_for_dbus (const gint type,
- const void *val)
-{
- switch (type)
- {
- case DBUS_TYPE_STRING:
- case DBUS_TYPE_OBJECT_PATH:
- if (!val)
- return "";
- else if (!g_utf8_validate (val, -1, NULL))
- {
- g_warning ("atk-bridge: Received bad UTF-8 string when emitting event");
- return "";
- }
- else
- return val;
- default:
- return val;
- }
-}
-
-static void
-append_basic (DBusMessageIter *iter,
- const char *type,
- const void *val)
-{
- DBusMessageIter sub;
-
- dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, type, &sub);
-
- val = validate_for_dbus ((int) *type, val);
- dbus_message_iter_append_basic(&sub, (int) *type, &val);
-
- dbus_message_iter_close_container(iter, &sub);
-}
-
-static void
-append_rect (DBusMessageIter *iter,
- const char *type,
- const void *val)
-{
- DBusMessageIter variant, sub;
- const AtkRectangle *rect = (const AtkRectangle *) val;
-
- dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, type, &variant);
-
- dbus_message_iter_open_container (&variant, DBUS_TYPE_STRUCT, NULL, &sub);
-
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->x));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->y));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->width));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->height));
-
- dbus_message_iter_close_container (&variant, &sub);
-
- dbus_message_iter_close_container(iter, &variant);
-}
-
-static void
-append_object (DBusMessageIter *iter,
- const char *type,
- const void *val)
-{
- spi_object_append_v_reference (iter, ATK_OBJECT (val));
-}
-
-static gchar *
-signal_name_to_dbus (const gchar *s)
-{
- gchar *ret = g_strdup (s);
- gchar *t;
-
- if (!ret)
- return NULL;
- ret [0] = toupper (ret [0]);
- while ((t = strchr (ret, '-')) != NULL)
- {
- memmove (t, t + 1, strlen (t));
- *t = toupper (*t);
- }
- return ret;
-}
-
-/*
- * Converts names of the form "active-descendant-changed" to
- * "ActiveDescendantChanged"
- */
-static gchar *
-ensure_proper_format (const char *name)
-{
- gchar *ret = (gchar *) g_malloc (strlen (name) * 2 + 2);
- gchar *p = ret;
- gboolean need_upper = TRUE;
-
- if (!ret)
- return NULL;
- while (*name)
- {
- if (need_upper)
- {
- *p++ = toupper (*name);
- need_upper = FALSE;
- }
- else if (*name == '-')
- need_upper = TRUE;
- else if (*name == ':')
- {
- need_upper = TRUE;
- *p++ = *name;
- }
- else
- *p++ = *name;
- name++;
- }
- *p = '\0';
- return ret;
-}
-
-void
-append_properties (GArray *properties, event_data *evdata)
-{
- GSList *ls;
- gint i;
-
- for (ls = evdata->properties; ls; ls = ls->next)
- {
- gboolean dup = FALSE;
- for (i = 0; i < properties->len; i++)
- {
- if (ls->data == g_array_index (properties, AtspiPropertyDefinition *, i))
- {
- dup = TRUE;
- break;
- }
- }
- if (!dup)
- g_array_append_val (properties, ls->data);
- }
-}
-
-static gboolean
-signal_is_needed (AtkObject *obj, const gchar *klass, const gchar *major,
- const gchar *minor, GArray **properties)
-{
- gchar *data [4];
- event_data *evdata;
- gboolean ret = FALSE;
- GList *list;
- GArray *props = NULL;
-
- if (!spi_global_app_data->events_initialized)
- return TRUE;
-
- data [0] = ensure_proper_format (klass[0] ? klass + 21 : klass);
- data [1] = ensure_proper_format (major);
- data [2] = ensure_proper_format (minor);
- data [3] = NULL;
-
- /* Hack: Always pass events that update the cache.
- * TODO: FOr 2.2, have at-spi2-core define a special "cache listener" for
- * this instead, so that we don't send these if no one is listening */
- if (!g_strcmp0 (data [1], "ChildrenChanged") ||
- ((!g_strcmp0 (data [1], "PropertyChange")) &&
- (!g_strcmp0 (data [2], "AccessibleName") ||
- !g_strcmp0 (data [2], "AccessibleDescription") ||
- !g_strcmp0 (data [2], "AccessibleParent") ||
- !g_strcmp0 (data [2], "AccessibleRole"))) ||
- !g_strcmp0 (data [1], "StateChanged"))
- {
- if (minor && !g_strcmp0 (minor, "defunct"))
- ret = TRUE;
- else
- {
- AtkStateSet *set = atk_object_ref_state_set (obj);
- AtkState state = ((!g_strcmp0 (data[1], "ChildrenChanged")) ?
- ATK_STATE_MANAGES_DESCENDANTS : ATK_STATE_TRANSIENT);
- ret = !atk_state_set_contains_state (set, state);
- g_object_unref (set);
- }
- }
-
- /* Hack: events such as "object::text-changed::insert:system" as
- generated by Gecko */
- data [2][strcspn (data [2], ":")] = '\0';
-
- for (list = spi_global_app_data->events; list; list = list->next)
- {
- evdata = list->data;
- if (spi_event_is_subtype (data, evdata->data))
- {
- ret = TRUE;
- if (!props)
- props = g_array_new (TRUE, TRUE, sizeof (AtspiPropertyDefinition *));
- append_properties (props, evdata);
- }
- }
-
- g_free (data [2]);
- g_free (data [1]);
- g_free (data [0]);
- *properties = props;
- return ret;
-}
-
-/* Convert a : to a / so that listeners can use arg0path to match only
- * * the prefix */
-static char *
-adapt_minor_for_dbus (const char *source)
-{
- gchar *ret = g_strdup (source);
- int i = strcspn (ret, ":");
- if (ret[i] == ':')
- ret[i] = '/';
- return ret;
-}
-
-/*
- * Emits an AT-SPI event.
- * AT-SPI events names are split into three parts:
- * class:major:minor
- * This is mapped onto D-Bus events as:
- * D-Bus Interface:Signal Name:Detail argument
- *
- * Marshals a basic type into the 'any_data' attribute of
- * the AT-SPI event.
- */
-static void
-emit_event (AtkObject *obj,
- const char *klass,
- const char *major,
- const char *minor,
- dbus_int32_t detail1,
- dbus_int32_t detail2,
- const char *type,
- const void *val,
- void (*append_variant) (DBusMessageIter *, const char *, const void *))
-{
- DBusConnection *bus = spi_global_app_data->bus;
- char *path;
- char *minor_dbus;
-
- gchar *cname;
- DBusMessage *sig;
- DBusMessageIter iter, iter_dict, iter_dict_entry;
- GArray *properties = NULL;
-
- if (!klass) klass = "";
- if (!major) major = "";
- if (!minor) minor = "";
- if (!type) type = "u";
-
- if (!signal_is_needed (obj, klass, major, minor, &properties))
- return;
-
- path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
- g_return_if_fail (path != NULL);
-
- /*
- * 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 = signal_name_to_dbus (major);
- sig = dbus_message_new_signal(path, klass, cname);
-
- dbus_message_iter_init_append(sig, &iter);
-
- minor_dbus = adapt_minor_for_dbus (minor);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor_dbus);
- g_free (minor_dbus);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
- append_variant (&iter, type, val);
-
- dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "{sv}", &iter_dict);
- /* Add requested properties, unless the object is being marked defunct, in
- which case it's safest not to touch it */
- if (minor == NULL || strcmp (minor, "defunct") != 0 || detail1 == 0)
- {
- if (properties)
- {
- gint i;
- for (i = 0; i < properties->len; i++)
- {
- AtspiPropertyDefinition *prop = g_array_index (properties, AtspiPropertyDefinition *, i);
- dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY, NULL,
- &iter_dict_entry);
- dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING, &prop->name);
- prop->func (&iter_dict_entry, obj);
- dbus_message_iter_close_container (&iter_dict, &iter_dict_entry);
- }
- g_array_free (properties, TRUE);
- }
- }
- dbus_message_iter_close_container (&iter, &iter_dict);
-
- dbus_connection_send(bus, sig, NULL);
- dbus_message_unref(sig);
-
- if (g_strcmp0 (cname, "ChildrenChanged") != 0)
- spi_object_lease_if_needed (G_OBJECT (obj));
-
- g_free(cname);
- g_free (path);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The focus listener handles the ATK 'focus' signal and forwards it
- * as the AT-SPI event, 'focus:'
- */
-static void
-focus_tracker (AtkObject * accessible)
-{
- emit_event (accessible, ITF_EVENT_FOCUS, "focus", "", 0, 0,
- DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
-}
-
-/*---------------------------------------------------------------------------*/
-
-#define PCHANGE "PropertyChange"
-
-/*
- * This handler handles the following ATK signals and
- * converts them to AT-SPI events:
- *
- * Gtk:AtkObject:property-change -> object:property-change:(property-name)
- *
- * The property-name is part of the ATK property-change signal.
- */
-static gboolean
-property_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- AtkPropertyValues *values;
-
- const gchar *pname = NULL;
-
- AtkObject *otemp;
- const gchar *s1;
- gint i;
-
- accessible = g_value_get_object (¶m_values[0]);
- values = (AtkPropertyValues *) g_value_get_pointer (¶m_values[1]);
-
- pname = values[0].property_name;
-
- /* TODO Could improve this control statement by matching
- * on only the end of the signal names,
- */
- if (strcmp (pname, "accessible-name") == 0)
- {
- s1 = atk_object_get_name (accessible);
- if (s1 != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
- }
- else if (strcmp (pname, "accessible-description") == 0)
- {
- s1 = atk_object_get_description (accessible);
- if (s1 != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
- }
- else if (strcmp (pname, "accessible-parent") == 0)
- {
- otemp = atk_object_get_parent (accessible);
- if (otemp != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- "(so)", otemp, append_object);
- }
- else if (strcmp (pname, "accessible-role") == 0)
- {
- i = atk_object_get_role (accessible);
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_UINT32_AS_STRING, GINT_TO_POINTER(i), append_basic);
- }
- else if (strcmp (pname, "accessible-table-summary") == 0)
- {
- otemp = atk_table_get_summary (ATK_TABLE (accessible));
- if (otemp != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- "(so)", otemp, append_object);
- }
- else if (strcmp (pname, "accessible-table-column-header") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_column_header (ATK_TABLE (accessible), i);
- if (otemp != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- "(so)", otemp, append_object);
- }
- else if (strcmp (pname, "accessible-table-row-header") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_row_header (ATK_TABLE (accessible), i);
- if (otemp != NULL)
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- "(so)", otemp, append_object);
- }
- else if (strcmp (pname, "accessible-table-row-description") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- s1 = atk_table_get_row_description (ATK_TABLE (accessible), i);
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
- }
- else if (strcmp (pname, "accessible-table-column-description") == 0)
- {
- i = g_value_get_int (&(values->new_value));
- s1 = atk_table_get_column_description (ATK_TABLE (accessible), i);
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
- }
- else if (strcmp (pname, "accessible-table-caption-object") == 0)
- {
- otemp = atk_table_get_caption (ATK_TABLE (accessible));
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- "(so)", otemp, append_object);
- }
- else
- {
- emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
- DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
- }
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-#define STATE_CHANGED "state-changed"
-
-/*
- * The state event listener handles 'Gtk:AtkObject:state-change' ATK signals
- * and forwards them as object:state-changed:(param-name) AT-SPI events. Where
- * the param-name is part of the ATK state-change signal.
- */
-static gboolean
-state_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- const gchar *pname;
- guint detail1;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- pname = g_value_get_string (¶m_values[1]);
-
- detail1 = (g_value_get_boolean (¶m_values[2])) ? 1 : 0;
- emit_event (accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0,
- DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
-
- if (!g_strcmp0 (pname, "defunct") && detail1)
- spi_register_deregister_object (spi_global_register, G_OBJECT (accessible),
- TRUE);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The window event listener handles the following ATK signals and forwards
- * them as AT-SPI events:
- *
- * window:create -> window:create
- * window:destroy -> window:destroy
- * window:minimize -> window:minimize
- * window:maximize -> window:maximize
- * window:activate -> window:activate
- * window:deactivate -> window:deactivate
- */
-static gboolean
-window_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *s;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- s = atk_object_get_name (accessible);
- emit_event (accessible, ITF_EVENT_WINDOW, name, "", 0, 0,
- DBUS_TYPE_STRING_AS_STRING, s, append_basic);
-
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * The document event listener handles the following ATK signals
- * and converts them to AT-SPI events:
- *
- * Gtk:AtkDocument:load-complete -> document:load-complete
- * Gtk:AtkDocument:load-stopped -> document:load-stopped
- * Gtk:AtkDocument:reload -> document:reload
- * Gtk:AtkDocument:page-changed -> document:page-changed
- */
-static gboolean
-document_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *s;
- gint detail1 = 0;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- if (n_param_values > 0) // on the case of page-changed
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- s = atk_object_get_name (accessible);
- emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", detail1, 0,
- DBUS_TYPE_STRING_AS_STRING, s, append_basic);
-
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Signal handler for "Gtk:AtkComponent:bounds-changed". Converts
- * this to an AT-SPI event - "object:bounds-changed".
- */
-static gboolean
-bounds_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- AtkRectangle *atk_rect;
- GSignalQuery signal_query;
- const gchar *name;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
-
- if (G_VALUE_HOLDS_BOXED (param_values + 1))
- {
- atk_rect = g_value_get_boxed (param_values + 1);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, "", 0, 0,
- "(iiii)", atk_rect, append_rect);
- }
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkObject:active-descendant-changed' and
- * converts it to the AT-SPI signal - 'object:active-descendant-changed'.
- *
- */
-static gboolean
-active_descendant_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- AtkObject *child;
- GSignalQuery signal_query;
- const gchar *name;
- gint detail1;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- child = ATK_OBJECT (g_value_get_pointer (¶m_values[1]));
- g_return_val_if_fail (ATK_IS_OBJECT (child), TRUE);
-
- detail1 = atk_object_get_index_in_parent (child);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, "", detail1, 0,
- "(so)", child, append_object);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkHypertext:link-selected' and
- * converts it to the AT-SPI signal - 'object:link-selected'
- *
- */
-static gboolean
-link_selected_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gint detail1 = 0;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, 0,
- DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-changed' and
- * converts it to the AT-SPI signal - 'object:text-changed'
- * This signal is deprecated by Gtk:AtkText:text-insert
- * and Gtk:AtkText:text-remove
- *
- */
-static gboolean
-text_changed_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gchar *selected;
- gint detail1 = 0, detail2 = 0;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (¶m_values[2]);
-
- selected =
- atk_text_get_text (ATK_TEXT (accessible), detail1, detail1 + detail2);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- DBUS_TYPE_STRING_AS_STRING, selected, append_basic);
- g_free (selected);
-
- return TRUE;
-}
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-insert' and
- * converts it to the AT-SPI signal - 'object:text-changed'
- *
- */
-static gboolean
-text_insert_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- guint text_changed_signal_id;
- GSignalQuery signal_query;
- const gchar *name;
- const gchar *minor_raw, *text;
- gchar *minor;
- gint detail1 = 0, detail2 = 0;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- /* Get signal name for 'Gtk:AtkText:text-changed' so
- * we convert it to the AT-SPI signal - 'object:text-changed'
- */
- text_changed_signal_id = g_signal_lookup ("text-changed", G_OBJECT_TYPE (accessible));
- g_signal_query (text_changed_signal_id, &signal_query);
- name = signal_query.signal_name;
-
-
- /* Add the insert and keep any detail coming from atk */
- minor_raw = g_quark_to_string (signal_hint->detail);
- if (minor_raw)
- minor = g_strconcat ("insert:", minor_raw, NULL);
- else
- minor = g_strdup ("insert");
-
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (¶m_values[2]);
-
- if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
- text = g_value_get_string (¶m_values[3]);
- else
- text = "";
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- DBUS_TYPE_STRING_AS_STRING, text, append_basic);
- g_free (minor);
- return TRUE;
-}
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-remove' and
- * converts it to the AT-SPI signal - 'object:text-changed'
- *
- */
-static gboolean
-text_remove_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- guint text_changed_signal_id;
- GSignalQuery signal_query;
- const gchar *name;
- const gchar *minor_raw, *text;
- gchar *minor;
- gint detail1 = 0, detail2 = 0;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- /* Get signal name for 'Gtk:AtkText:text-changed' so
- * we convert it to the AT-SPI signal - 'object:text-changed'
- */
- text_changed_signal_id = g_signal_lookup ("text-changed", G_OBJECT_TYPE (accessible));
- g_signal_query (text_changed_signal_id, &signal_query);
- name = signal_query.signal_name;
-
- minor_raw = g_quark_to_string (signal_hint->detail);
-
- /* Add the delete and keep any detail coming from atk */
- if (minor_raw)
- minor = g_strconcat ("delete:", minor_raw, NULL);
- else
- minor = g_strdup ("delete");
-
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (¶m_values[2]);
-
- if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
- text = g_value_get_string (¶m_values[3]);
- else
- text = "";
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- DBUS_TYPE_STRING_AS_STRING, text, append_basic);
- g_free (minor);
- return TRUE;
-}
-
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Handles the ATK signal 'Gtk:AtkText:text-selection-changed' and
- * converts it to the AT-SPI signal - 'object:text-selection-changed'
- *
- */
-static gboolean
-text_selection_changed_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values,
- gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name, *minor;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- minor = g_quark_to_string (signal_hint->detail);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, "", append_basic);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Children changed signal converter and forwarder.
- *
- * Klass (Interface) org.a11y.atspi.Event.Object
- * Major is the signal name.
- * Minor is 'add' or 'remove'
- * detail1 is the index.
- * detail2 is 0.
- * any_data is the child reference.
- */
-static gboolean
-children_changed_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- GSignalQuery signal_query;
- const gchar *name, *minor;
- gint detail1 = 0, detail2 = 0;
-
- AtkObject *accessible, *ao=NULL;
- gpointer child;
- AtkStateSet *set;
- gboolean ret;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- /* If the accessible is on STATE_MANAGES_DESCENDANTS state,
- children-changed signal are not forwarded. */
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- set = atk_object_ref_state_set (accessible);
- ret = atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS);
- g_object_unref (set);
-
- if (ret)
- return TRUE;
-
- minor = g_quark_to_string (signal_hint->detail);
-
- detail1 = g_value_get_uint (param_values + 1);
- child = g_value_get_pointer (param_values + 2);
-
- if (ATK_IS_OBJECT (child))
- {
- ao = ATK_OBJECT (child);
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- "(so)", ao, append_object);
- }
- else if ((minor != NULL) && (strcmp (minor, "add") == 0))
- {
- ao = atk_object_ref_accessible_child (accessible,
- detail1);
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- "(so)", ao, append_object);
- g_object_unref (ao);
- }
- else
- {
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
- "(so)", ao, append_object);
- }
-
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Generic signal converter and forwarder.
- *
- * Klass (Interface) org.a11y.atspi.Event.Object
- * Major is the signal name.
- * Minor is NULL.
- * detail1 is 0.
- * detail2 is 0.
- * any_data is NULL.
- */
-static gboolean
-generic_event_listener (GSignalInvocationHint * signal_hint,
- guint n_param_values,
- const GValue * param_values, gpointer data)
-{
- AtkObject *accessible;
- GSignalQuery signal_query;
- const gchar *name;
- int detail1 = 0, detail2 = 0;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- name = signal_query.signal_name;
-
- accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
-
- if (n_param_values > 1 && G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- if (n_param_values > 2 && G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (¶m_values[2]);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, "", detail1, detail2,
- DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
- return TRUE;
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Registers the provided function as a handler for the given signal name
- * and stores the signal id returned so that the function may be
- * de-registered later.
- */
-static guint
-add_signal_listener (GSignalEmissionHook listener, const char *signal_name)
-{
- guint id;
-
- id = atk_add_global_event_listener (listener, signal_name);
-
- if (id > 0) /* id == 0 is a failure */
- g_array_append_val (listener_ids, id);
-
- return id;
-}
-
-/*
- * Initialization for the signal handlers.
- *
- * Registers all required signal handlers.
- */
-void
-spi_atk_register_event_listeners (void)
-{
- /*
- * Kludge to make sure the Atk interface types are registered, otherwise
- * the AtkText signal handlers below won't get registered
- */
- GObject *ao = g_object_new (ATK_TYPE_OBJECT, NULL);
- AtkObject *bo = atk_no_op_object_new (ao);
- guint id = 0;
-
- g_object_unref (G_OBJECT (bo));
- g_object_unref (ao);
-
- if (listener_ids)
- {
- g_warning ("atk_bridge: spi_atk-register_event_listeners called multiple times");
- return;
- }
-
- /* Register for focus event notifications, and register app with central registry */
- listener_ids = g_array_sized_new (FALSE, TRUE, sizeof (guint), 16);
-
- atk_bridge_focus_tracker_id = atk_add_focus_tracker (focus_tracker);
-
- add_signal_listener (property_event_listener,
- "Gtk:AtkObject:property-change");
-
- /* window events: we tentative try to register using the old format */
- id = add_signal_listener (window_event_listener, "window:create");
-
- if (id != 0)
- {
- /* If we are able to register using the old format, we assume
- * that the ATK implementor is managing window events without
- * AtkWindow. We can't use the opposite test because after
- * including AtkWindow on ATK you would be able to register to
- * that event, although the ATK implementor could or not use it.
- */
-
- add_signal_listener (window_event_listener, "window:destroy");
- add_signal_listener (window_event_listener, "window:minimize");
- add_signal_listener (window_event_listener, "window:maximize");
- add_signal_listener (window_event_listener, "window:restore");
- add_signal_listener (window_event_listener, "window:activate");
- add_signal_listener (window_event_listener, "window:deactivate");
- }
- else
- {
- add_signal_listener (window_event_listener, "Atk:AtkWindow:create");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:destroy");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:minimize");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:maximize");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:restore");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:activate");
- add_signal_listener (window_event_listener, "Atk:AtkWindow:deactivate");
- }
-
- add_signal_listener (document_event_listener,
- "Gtk:AtkDocument:load-complete");
- add_signal_listener (document_event_listener, "Gtk:AtkDocument:reload");
- add_signal_listener (document_event_listener,
- "Gtk:AtkDocument:load-stopped");
- add_signal_listener (document_event_listener,
- "Gtk:AtkDocument:page-changed");
- /* TODO Fake this event on the client side */
- add_signal_listener (state_event_listener, "Gtk:AtkObject:state-change");
- /* TODO */
- add_signal_listener (active_descendant_event_listener,
- "Gtk:AtkObject:active-descendant-changed");
- add_signal_listener (bounds_event_listener,
- "Gtk:AtkComponent:bounds-changed");
- add_signal_listener (text_selection_changed_event_listener,
- "Gtk:AtkText:text-selection-changed");
- add_signal_listener (text_changed_event_listener,
- "Gtk:AtkText:text-changed");
- add_signal_listener (text_insert_event_listener,
- "Gtk:AtkText:text-insert");
- add_signal_listener (text_remove_event_listener,
- "Gtk:AtkText:text-remove");
- add_signal_listener (link_selected_event_listener,
- "Gtk:AtkHypertext:link-selected");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkObject:visible-data-changed");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkSelection:selection-changed");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkText:text-attributes-changed");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkText:text-caret-moved");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-inserted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-reordered");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-deleted");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkTable:column-inserted");
- add_signal_listener (generic_event_listener,
- "Gtk:AtkTable:column-reordered");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-deleted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:model-changed");
- add_signal_listener (children_changed_event_listener, "Gtk:AtkObject:children-changed");
-
-#if 0
- g_signal_connect (G_OBJECT (spi_global_app_data->root),
- "children-changed::add",
- (GCallback) toplevel_added_event_listener, NULL);
-
- g_signal_connect (G_OBJECT (spi_global_app_data->root),
- "children-changed::remove",
- (GCallback) toplevel_removed_event_listener, NULL);
-#endif
-
- /*
- * May add the following listeners to implement preemptive key listening for GTK+
- *
- * atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-press-event");
- * atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-release-event");
- */
- atk_bridge_key_event_listener_id =
- atk_add_key_event_listener (spi_atk_bridge_key_listener, NULL);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * De-registers all ATK signal handlers.
- */
-void
-spi_atk_deregister_event_listeners (void)
-{
- gint i;
- GArray *ids = listener_ids;
- listener_ids = NULL;
-
- if (atk_bridge_focus_tracker_id)
- {
- atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
- atk_bridge_focus_tracker_id = 0;
- }
-
- if (ids)
- {
- for (i = 0; i < ids->len; i++)
- {
- atk_remove_global_event_listener (g_array_index (ids, guint, i));
- }
- g_array_free (ids, TRUE);
- }
-
- if (atk_bridge_key_event_listener_id)
- {
- atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
- atk_bridge_key_event_listener_id = 0;
- }
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * TODO This function seems out of place here.
- *
- * Emits fake deactivate signals on all top-level windows.
- * Used when shutting down AT-SPI, ensuring that all
- * windows have been removed on the client side.
- */
-void
-spi_atk_tidy_windows (void)
-{
- AtkObject *root;
- gint n_children;
- gint i;
-
- root = atk_get_root ();
- n_children = atk_object_get_n_accessible_children (root);
- for (i = 0; i < n_children; i++)
- {
- AtkObject *child;
- AtkStateSet *stateset;
- const gchar *name;
-
- child = atk_object_ref_accessible_child (root, i);
- stateset = atk_object_ref_state_set (child);
-
- name = atk_object_get_name (child);
- if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
- {
- emit_event (child, ITF_EVENT_WINDOW, "deactivate", NULL, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, name, append_basic);
- }
- g_object_unref (stateset);
-
- emit_event (child, ITF_EVENT_WINDOW, "destroy", NULL, 0, 0,
- DBUS_TYPE_STRING_AS_STRING, name, append_basic);
- g_object_unref (child);
- }
-}
-
-gboolean
-spi_event_is_subtype (gchar **needle, gchar **haystack)
-{
- while (*haystack && **haystack)
- {
- if (g_strcmp0 (*needle, *haystack))
- return FALSE;
- needle++;
- haystack++;
- }
- return TRUE;
-}
-
-/*END------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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);
-guint spi_timeout_add_full (gint priority, guint interval, GSourceFunc function,
- gpointer data, GDestroyNotify notify);
-#endif /* EVENT_H */
+++ /dev/null
-/*
- * 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 ();
-}
+++ /dev/null
-
-/*
- * 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>"
-"";
-
+++ /dev/null
-
-/*
- * 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_ */
+++ /dev/null
-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 = 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'),
-)
+++ /dev/null
-/*
- * 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;
- role_table[ATK_ROLE_MARK] = ATSPI_ROLE_MARK;
- role_table[ATK_ROLE_SUGGESTION] = ATSPI_ROLE_SUGGESTION;
-
- 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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;
-}
-*/
+++ /dev/null
-/*
- * 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_ */
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-#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;
-}
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-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)
+++ /dev/null
-project('at-spi2-atk', 'c',
- version: '2.38.0',
- license: 'LGPLv2.1+',
- default_options: [
- 'buildtype=debugoptimized',
- 'warning_level=1',
- 'c_std=gnu99',
- ],
- 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.36.0'
-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, fallback : ['atk', 'libatk_dep'])
-atspi_dep = dependency('atspi-2', version: atspi_req_version, fallback : ['at-spi2-core', 'atspi_dep'])
-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')
-if get_option('tests')
- subdir('tests')
-endif
+++ /dev/null
-option('disable_p2p',
- description: 'Disable peer-to-peer DBus connections',
- type: 'boolean',
- value: false)
-option('tests',
- description: 'Whether to build tests',
- type: 'boolean',
- value: true)
+++ /dev/null
-[wrap-git]
-directory=at-spi2-core
-url=https://gitlab.gnome.org/GNOME/at-spi2-core.git
-push-url=git@gitlab.gnome.org:GNOME/at-spi2-core.git
-revision=master
+++ /dev/null
-[wrap-git]
-directory=atk
-url=https://gitlab.gnome.org/GNOME/atk.git
-push-url=git@gitlab.gnome.org:GNOME/atk.git
-revision=master
+++ /dev/null
-.deps/
-.libs/
-app-test
-atk-test
-*.log
-*.o
-*.la
-*.lo
+++ /dev/null
-
-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
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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*/
+++ /dev/null
-/*
- * 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;
-
-}
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 );
-}
-
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 );
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 );
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
-
-}
+++ /dev/null
-/*
- * 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);
-}
-
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
-
-
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 ();
-}
+++ /dev/null
-/*
- * 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 <sys/time.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 */
+++ /dev/null
-/*
- * 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 );
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
-
-
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-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('.'))
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_ACTION_H
-#define MY_ATK_ACTION_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_ACTION (my_atk_action_get_type ())
-#define MY_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_ACTION, MyAtkAction))
-#define MY_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_ACTION, MyAtkActionClass))
-#define MY_IS_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_ACTION))
-#define MY_IS_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_ACTION))
-#define MY_ATK_ACTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_ACTION, MyAtkActionClass))
-
-typedef struct _MyAtkAction MyAtkAction;
-typedef struct _MyAtkActionPrivate MyAtkActionPrivate;
-typedef struct _MyAtkActionClass MyAtkActionClass;
-
-typedef void (* MyAtkActionFunc) (MyAtkAction *action);
-
-struct _MyAtkAction {
- MyAtkObject parent;
- MyAtkActionPrivate *priv;
- gint last_performed_action;//this field is changed when action is performed
-
-};
-
-struct _MyAtkActionClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_action_get_type (void);
-
-guint my_atk_action_add_action (MyAtkAction *action,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding);
-
-#endif /*MY_ATK_ACTION_H*/
+++ /dev/null
-/*
- * 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-component.h"
-
-typedef struct _MyAtkComponentInfo MyAtkComponentInfo;
-
-static void atk_component_interface_init (AtkComponentIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkComponent,
- my_atk_component,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
- atk_component_interface_init));
-
-void
-my_atk_component_set_layer (AtkComponent *component,
- AtkLayer layer)
-{
- g_return_if_fail (MY_IS_ATK_COMPONENT (component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT (component);
- self->layer = layer;
-}
-
-void
-my_atk_component_set_mdi_zorder (AtkComponent *component,
- gint mdi_zorder)
-{
- g_return_if_fail (MY_IS_ATK_COMPONENT (component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT (component);
- self->zorder = mdi_zorder;
-}
-
-void
-my_atk_component_set_alpha (AtkComponent *component,
- gdouble alpha)
-{
-
- g_return_if_fail (MY_IS_ATK_COMPONENT (component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT (component);
- self->alpha = alpha;
-}
-
-static void
-my_atk_component_get_extents (AtkComponent *component,
- gint *width,
- gint *height,
- gint *x,
- gint *y,
- AtkCoordType coord_type)
-{
- g_return_if_fail (MY_IS_ATK_COMPONENT (component));
-
- MyAtkComponent *self = MY_ATK_COMPONENT (component);
- *width = self->extent.width;
- *height = self->extent.height;
- *x = self->extent.x;
- *y = self->extent.y;
-}
-
-static gboolean
-my_atk_component_set_extents (AtkComponent *component,
- gint x,
- gint y,
- gint width,
- gint height,
- AtkCoordType coord_type)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), FALSE);
-
- MyAtkComponent *self = MY_ATK_COMPONENT (component);
-
- if (self->extent_may_change) {
- self->extent.width = width;
- self->extent.height = height;
- self->extent.x = x;
- self->extent.y = y;
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-my_atk_component_contains (AtkComponent *component,
- gint c_x,
- gint c_y,
- AtkCoordType coord_type)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), FALSE);
-
- gint x, y, w, h;
- my_atk_component_get_extents (component, &x, &y, &w, &h, coord_type);
-
- if ((c_x >= x) && (c_y >= y) && (c_x < x + w) && (c_y < y + h))
- return TRUE;
- else
- return FALSE;
-}
-
-static AtkObject *
-my_atk_component_ref_accessible_at_point (AtkComponent *component,
- gint x,
- gint y,
- AtkCoordType coord_type)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), NULL);
-
- gint count,i;
- count = atk_object_get_n_accessible_children (ATK_OBJECT (component));
-
- for (i = 0; i < count; i++) {
- AtkObject *obj;
- obj = atk_object_ref_accessible_child (ATK_OBJECT (component), i);
-
- if (obj != NULL) {
- if (atk_component_contains (ATK_COMPONENT (obj), x, y, coord_type))
- return obj;
- else
- g_object_unref (obj);
- }
- }
- return NULL;
-}
-
-static gboolean
-my_atk_component_grab_focus (AtkComponent *component)
-{
- return TRUE;
-}
-
-static AtkLayer
-my_atk_component_get_layer (AtkComponent *component)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), -1);
-
- return MY_ATK_COMPONENT (component)->layer;
-}
-
-static gint
-my_atk_component_get_mdi_zorder (AtkComponent *component)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), -1);
-
- return MY_ATK_COMPONENT (component)->zorder;
-}
-
-static gdouble
-my_atk_component_get_alpha (AtkComponent *component)
-{
- g_return_val_if_fail (MY_IS_ATK_COMPONENT (component), -1);
-
- return MY_ATK_COMPONENT (component)->alpha;
-}
-
-static void
-atk_component_interface_init (AtkComponentIface *iface)
-{
- g_return_if_fail (iface);
-
- iface->add_focus_handler = NULL;
- iface->contains = my_atk_component_contains;
- iface->ref_accessible_at_point = my_atk_component_ref_accessible_at_point;
- iface->get_extents = my_atk_component_get_extents;
- iface->get_position = NULL;
- iface->get_size = NULL;
- iface->grab_focus = my_atk_component_grab_focus;
- iface->remove_focus_handler = NULL;
- iface->set_extents = my_atk_component_set_extents;
- iface->set_position = NULL;
- iface->set_size = NULL;
- iface->get_layer = my_atk_component_get_layer;
- iface->get_mdi_zorder = my_atk_component_get_mdi_zorder;
- iface->bounds_changed = NULL;
- iface->get_alpha = my_atk_component_get_alpha;
-}
-
-static void
-my_atk_component_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_component_finalize (GObject *object)
-{
-}
-
-static void
-my_atk_component_init(MyAtkComponent *obj)
-{
- obj->extent.x = 0;
- obj->extent.y = 0;
- obj->extent.width = 0;
- obj->extent.height = 0;
- obj->extent_may_change = TRUE;
- obj->layer = ATK_LAYER_BACKGROUND;
- obj->zorder = -1;
- obj->alpha = 1.0;
-}
-
-static void
-my_atk_component_class_init (MyAtkComponentClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_component_finalize;
-
- atk_class->initialize = my_atk_component_initialize;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_COMPONENT_H
-#define MY_ATK_COMPONENT_H
-
-#include <atk/atk.h>
-
-#define MY_TYPE_ATK_COMPONENT (my_atk_component_get_type ())
-#define MY_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_COMPONENT, MyAtkComponent))
-#define MY_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
-#define MY_IS_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_COMPONENT))
-#define MY_IS_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_COMPONENT))
-#define MY_ATK_COMPONENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
-
-typedef struct _MyAtkComponent MyAtkComponent;
-typedef struct _MyAtkComponentClass MyAtkComponentClass;
-
-typedef void (* MyAtkComponentFunc) (MyAtkComponent *component);
-
-struct _MyAtkComponent {
- MyAtkObject parent;
- AtkRectangle extent;
- gboolean extent_may_change;
- gboolean is_manage_descendants;
- AtkLayer layer;
- gint zorder;
- gdouble alpha;
-};
-
-struct _MyAtkComponentClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_component_get_type ();
-
-void my_atk_component_set_layer (AtkComponent *component, AtkLayer layer);
-void my_atk_component_set_mdi_zorder (AtkComponent *component, gint mdi_zorder);
-void my_atk_component_set_alpha (AtkComponent *component, gdouble alpha);
-
-#endif /*MY_ATK_COMPONENT_H*/
+++ /dev/null
-/*
- * 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 <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-document.h"
-
-static void atk_document_interface_init (AtkDocumentIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkDocument,
- my_atk_document,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_DOCUMENT,
- atk_document_interface_init));
-
-void
-my_atk_set_document (AtkDocument *obj, gint page, gint page_num)
-{
- g_return_if_fail (MY_IS_ATK_DOCUMENT(obj));
- MyAtkDocument *self = MY_ATK_DOCUMENT (obj);
-
- self->pages = page;
- self->current_page = page_num;
-
- AtkAttribute *attr1, *attr2;
- attr1 = g_malloc (sizeof (AtkAttribute));
- attr1->name = g_strdup ("atspi1");
- attr1->value = g_strdup ("test1");
-
- attr2 = g_malloc (sizeof (AtkAttribute));
- attr2->name = g_strdup ("atspi2");
- attr2->value = g_strdup ("test2");
-
- self->attributes = g_slist_append (NULL, attr1);
- self->attributes = g_slist_append (self->attributes, attr2);
-}
-
-static void
-my_atk_document_init (MyAtkDocument *obj)
-{
- obj->disposed = FALSE;
- obj->locale = NULL;
- obj->document_type = NULL;
- obj->pages = 0;
- obj->current_page = 0;
-}
-
-AtkAttributeSet *
-my_atk_document_get_document_attributes (AtkDocument *document)
-{
- MyAtkDocument *self = MY_ATK_DOCUMENT (document);
-
- return self->attributes;
-}
-
-const gchar *
-my_atk_document_get_document_attribute_value (AtkDocument *document, const gchar *value)
-{
- AtkAttributeSet *attr = my_atk_document_get_document_attributes (document);
- GSList *cur_attr = (GSList *) attr;
- AtkAttribute *at;
-
- while (cur_attr) {
- at = (AtkAttribute *) cur_attr->data;
- if (!g_strcmp0 (at->name, value)) {
- return at->value;
- }
- cur_attr = cur_attr->next;
- }
- return NULL;
-}
-
-gboolean
-my_atk_document_set_document_attribute (AtkDocument *document, const gchar *attribute_name, const gchar *attribute_value)
-{
- return FALSE;
-}
-
-gint
-my_atk_document_get_current_page_number (AtkDocument *document)
-{
- return 0;
-}
-
-gint
-my_atk_document_get_page_count (AtkDocument *document)
-{
- return 0;
-}
-
-const gchar *
-my_atk_document_get_document_locale (AtkDocument *document)
-{
-
- return g_strdup("document_locale");
-}
-
-static void
-atk_document_interface_init(AtkDocumentIface *iface)
-{
- if(!iface) return;
-
- iface->get_document_locale = my_atk_document_get_document_locale;
- iface->get_document_attributes = my_atk_document_get_document_attributes;
- iface->get_document_attribute_value = my_atk_document_get_document_attribute_value;
- iface->set_document_attribute = my_atk_document_set_document_attribute;
- iface->get_current_page_number = my_atk_document_get_current_page_number;
- iface->get_page_count = my_atk_document_get_page_count;
-}
-
-static void
-my_atk_document_initialize(AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_document_finalize(GObject *object)
-{
-}
-
-static void
-my_atk_document_class_init(MyAtkDocumentClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
-
- gobject_class->finalize = my_atk_document_finalize;
-
- atk_class->initialize = my_atk_document_initialize;
-}
-
+++ /dev/null
-/*
- * 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 MY_ATK_DOCUMENT_H
-#define MY_ATK_DOCUMENT_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_DOCUMENT (my_atk_document_get_type ())
-#define MY_ATK_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_DOCUMENT, MyAtkDocument))
-#define MY_ATK_DOCUMENT_CLASS(vdocument) (G_TYPE_CHECK_CLASS_CAST ((vdocument), MY_TYPE_ATK_DOCUMENT, MyAtkDocumentClass))
-#define MY_IS_ATK_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_DOCUMENT))
-#define MY_IS_ATK_DOCUMENT_CLASS(vdocument) (G_TYPE_CHECK_CLASS_TYPE ((vdocument), MY_TYPE_ATK_DOCUMENT))
-#define MY_ATK_DOCUMENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_DOCUMENT, MyAtkDocumentClass))
-
-// default string values
-#define DEF_LOCALE_TEXT "en-US"
-#define DEF_TYPE_TEXT "default type"
-
-typedef struct _MyAtkDocument MyAtkDocument;
-typedef struct _MyAtkDocumentClass MyAtkDocumentClass;
-
-struct _MyAtkDocument {
- MyAtkObject parent;
- gboolean disposed;
- gchar *locale;
- gchar *document_type;
- gint pages;
- gint current_page;
- AtkAttributeSet *attributes;
-};
-
-struct _MyAtkDocumentClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_document_get_type (void);
-
-void my_atk_set_document (AtkDocument *obj, gint page, gint page_num);
-
-#endif /*MY_ATK_DOCUMENT_H*/
+++ /dev/null
-/*
- * 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 <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-editable-text.h"
-
-typedef struct _MyAtkEditableTextInfo MyAtkEditableTextInfo;
-
-static void atk_editable_text_interface_init (AtkEditableTextIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkEditableText,
- my_atk_editable_text,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
- atk_editable_text_interface_init));
-
-guint
-my_atk_set_editable_text (AtkEditableText *editable_text, const gchar *text)
-{
- g_return_val_if_fail (MY_IS_ATK_EDITABLE_TEXT (editable_text), -1);
-
- return 0;
-}
-
-static void
-my_atk_editable_text_init (MyAtkEditableText *obj)
-{
- obj->text = NULL;
-}
-
-static gboolean
-my_atk_set_editable_text_set_run_attributes (AtkEditableText *text,
- AtkAttributeSet *attrib_set,
- gint start_offset,
- gint end_offset)
-{
- return FALSE;
-}
-
-static void
-my_atk_set_editable_text_set_text_contents (AtkEditableText *text,
- const gchar *string)
-{
-}
-
-static void
-my_atk_set_editable_text_insert_text (AtkEditableText *text,
- const gchar *string,
- gint length,
- gint *position)
-{
-}
-
-static void
-my_atk_set_editable_text_copy_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
-}
-
-static void
-my_atk_set_editable_text_cut_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
-}
-
-static void
-my_atk_set_editable_text_delete_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
-}
-
-static void
-my_atk_set_editable_text_paste_text (AtkEditableText *text,
- gint position)
-{
-}
-
-
-static void
-atk_editable_text_interface_init (AtkEditableTextIface *iface)
-{
- if (!iface) return;
- iface->set_run_attributes = my_atk_set_editable_text_set_run_attributes;
- iface->set_text_contents = my_atk_set_editable_text_set_text_contents;
- iface->insert_text = my_atk_set_editable_text_insert_text;
- iface->copy_text = my_atk_set_editable_text_copy_text;
- iface->cut_text = my_atk_set_editable_text_cut_text;
- iface->delete_text = my_atk_set_editable_text_delete_text;
- iface->paste_text = my_atk_set_editable_text_paste_text;
-}
-
-static void
-my_atk_editable_text_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_editable_text_finalize (GObject *object)
-{
-}
-
-static void
-my_atk_editable_text_class_init (MyAtkEditableTextClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_editable_text_finalize;
-
- atk_class->initialize = my_atk_editable_text_initialize;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_EDITABLE_TEXT_H_
-#define MY_ATK_EDITABLE_TEXT_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_EDITABLE_TEXT (my_atk_editable_text_get_type ())
-#define MY_ATK_EDITABLE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_EDITABLE_TEXT, MyAtkEditableText))
-#define MY_ATK_EDITABLE_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_EDITABLE_TEXT, MyAtkEditableTextClass))
-#define MY_IS_ATK_EDITABLE_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_EDITABLE_TEXT))
-#define MY_IS_ATK_EDITABLE_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_EDITABLE_TEXT))
-#define MY_ATK_EDITABLE_TEXT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_EDITABLE_TEXT, MyAtkEditableTextClass))
-
-typedef struct _MyAtkEditableText MyAtkEditableText;
-typedef struct _MyAtkEditableTextClass MyAtkEditableTextClass;
-
-typedef void (* MyAtkEditableTextFunc) (MyAtkEditableText *editable_text);
-
-struct _MyAtkEditableText {
- MyAtkObject parent;
- gchar *text;
-};
-
-struct _MyAtkEditableTextClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_editable_text_get_type (void);
-
-guint my_atk_set_editable_text (AtkEditableText *editable_text, const gchar *text);
-
-#endif /* MY_ATK_EDITABLE_TEXT_H_ */
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-#include <stdio.h>
-
-#include "my-atk-object.h"
-#include "my-atk-hyperlink.h"
-#include "my-atk-text.h"
-
-typedef struct _MyAtkHyperlinkInfo MyAtkHyperlinkInfo;
-
-G_DEFINE_TYPE (MyAtkHyperlink, my_atk_hyperlink, ATK_TYPE_HYPERLINK)
-
-gint
-my_atk_set_hyperlink (AtkHyperlink *obj, const gchar *uri, gint start, gint end)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), -1);
-
- self->uri = g_strdup (uri);
- self->start = start;
- self->end = end;
- self->state = FALSE;
- self->selected = FALSE;
-
- return 0;
-}
-
-MyAtkHyperlink *
-new_MyAtkHyperlink (void)
-{
- return g_object_new (MY_TYPE_ATK_HYPERLINK, NULL);
-}
-
-static gchar*
-my_atk_hyperlink_get_uri (AtkHyperlink *obj, gint i)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), NULL);
-
- return self->uri;
-}
-
-static AtkObject *
-my_atk_hyperlink_get_object (AtkHyperlink *obj, gint i)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- MyAtkText *text;
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), NULL);
-
- text = my_atk_text_new ();
- my_atk_set_text (ATK_TEXT (text),
- self->uri,
- 10,
- 50,
- self->end - self->start,
- 15,
- NULL);
-
- return ATK_OBJECT (text);
-}
-
-static gint
-my_atk_hyperlink_get_end_index (AtkHyperlink *obj)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), -1);
-
- return self->end;
-}
-
-static gint
-my_atk_hyperlink_get_start_index (AtkHyperlink *obj)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), -1);
-
- return self->start;
-}
-
-static gboolean
-my_atk_hyperlink_is_valid (AtkHyperlink *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), FALSE);
-
- return TRUE;
-}
-
-static gint
-my_atk_hyperlink_get_n_anchors (AtkHyperlink *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), -1);
-
- return 1;
-}
-
-static guint
-my_atk_hyperlink_link_state (AtkHyperlink *obj)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), -1);
-
- return self->state;
-}
-
-static gboolean
-my_atk_hyperlink_is_selected_link (AtkHyperlink *obj)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERLINK (obj), FALSE);
-
- return self->selected;
-}
-
-static void
-my_atk_hyperlink_link_activated (AtkHyperlink *obj)
-{
- MyAtkHyperlink *self = MY_ATK_HYPERLINK (obj);
- g_return_if_fail (MY_IS_ATK_HYPERLINK (obj));
-
- self->selected = !self->selected;
-}
-
-static void
-my_atk_hyperlink_init (MyAtkHyperlink *self)
-{
- self->uri =NULL;
- self->start = -1;
- self->end = -1;
- self->state = FALSE;
- self->selected = FALSE;
-}
-
-static void
-my_atk_hyperlink_set_property (GObject *obj,
- guint id,
- const GValue *value,
- GParamSpec *spec)
-{
- switch (id) {
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- default:
- //G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
- break;
- }
-}
-
-static void
-my_atk_hyperlink_get_property (GObject *obj,
- guint id,
- GValue *value,
- GParamSpec *pspec)
-{
-}
-
-static void
-my_atk_hyperlink_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_hyperlink_class_init (MyAtkHyperlinkClass *my_class)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
- AtkHyperlinkClass *iface = ATK_HYPERLINK_CLASS (my_class);
- const gchar *inst_tab[] = {"accessible-name", "accessible-description", "accessible-role", NULL};
-
- gobject_class->finalize = my_atk_hyperlink_class_finalize;
- gobject_class->set_property = my_atk_hyperlink_set_property;
- gobject_class->get_property = my_atk_hyperlink_get_property;
-
- gint i;
- for (i = 0; inst_tab[i] != NULL ; i++)
- g_object_class_install_property (gobject_class,
- i+1,
- g_param_spec_string (inst_tab[i],
- inst_tab[i],
- inst_tab[i],
- NULL,
- G_PARAM_READWRITE)
- );
-
- iface->get_uri = my_atk_hyperlink_get_uri;
- iface->get_object = my_atk_hyperlink_get_object;
- iface->get_end_index = my_atk_hyperlink_get_end_index;
- iface->get_start_index = my_atk_hyperlink_get_start_index;
- iface->is_valid = my_atk_hyperlink_is_valid;
- iface->get_n_anchors = my_atk_hyperlink_get_n_anchors;
- iface->link_state = my_atk_hyperlink_link_state;
- iface->is_selected_link = my_atk_hyperlink_is_selected_link;
- iface->link_activated = my_atk_hyperlink_link_activated;
-}
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef MY_ATK_HYPERLINK_H_
-#define MY_ATK_HYPERLINK_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_HYPERLINK (my_atk_hyperlink_get_type ())
-#define MY_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlink))
-#define MY_ATK_HYPERLINK_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlinkClass))
-#define MY_IS_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_HYPERLINK))
-#define MY_IS_ATK_HYPERLINK_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_HYPERLINK))
-#define MY_ATK_HYPERLINK_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_HYPERLINK, MyAtkHyperlinkClass))
-
-typedef struct _MyAtkHyperlink MyAtkHyperlink;
-typedef struct _MyAtkHyperlinkClass MyAtkHyperlinkClass;
-
-struct _MyAtkHyperlink {
- MyAtkObject parent;
- gchar *uri;
- gint start;
- gint end;
- gboolean state;
- gboolean selected;
-};
-
-struct _MyAtkHyperlinkClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_hyperlink_get_type (void);
-
-MyAtkHyperlink * new_MyAtkHyperlink (void);
-
-gint my_atk_set_hyperlink (AtkHyperlink *obj, const gchar *uri, gint start, gint end);
-
-#endif /* MY_ATK_HYPERLINK_H_ */
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-#include <stdio.h>
-
-#include "my-atk-object.h"
-#include "my-atk-hypertext.h"
-#include "my-atk-hyperlink.h"
-
-typedef struct _MyAtkHypertextInfo MyAtkHypertextInfo;
-
-static void atk_hypertext_interface_init (AtkHypertextIface *iface);
-static void GDestroyNotifyGOBJptrArray (gpointer data);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkHypertext,
- my_atk_hypertext,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERTEXT,
- atk_hypertext_interface_init));
-
-gint
-my_atk_set_hypertext (AtkHypertext *obj, const gchar *text)
-{
- MyAtkHypertext *self = MY_ATK_HYPERTEXT (obj);
- MyAtkHyperlink *link;
- gchar *ptr;
- const gchar *fstr= "href=";
- gint len = strlen (fstr);
- gint text_len = strlen (text);
- gint index = 0;
- gint start_offset;
- g_return_val_if_fail (MY_IS_ATK_HYPERTEXT (obj), -1);
-
- if (text_len < len)
- return -1;
-
- while (text) {
- ptr = g_strstr_len (text + index, text_len - index, fstr);
- index = ptr - text + len;
- if (ptr) {
- if (text_len < index || index < len)
- break;
- if (text[index] == '\'') {
- start_offset = index + 1;
- while (++index < text_len && text[index] != '\'');
- if (text[index] != '\'')
- break;
- link = new_MyAtkHyperlink ();
- my_atk_set_hyperlink (ATK_HYPERLINK (link),
- g_strndup (text + start_offset, index - start_offset),
- start_offset,
- index);
- g_ptr_array_add (self->array, link);
- }
- } else
- break;
- }
-
- return self->array->len > 0 ? 0 : -1;
-}
-
-static gint
-my_atk_hypertext_get_n_links (AtkHypertext *obj)
-{
- MyAtkHypertext *self = MY_ATK_HYPERTEXT (obj);
- g_return_val_if_fail (MY_IS_ATK_HYPERTEXT (obj), -1);
- return self->array->len;
-
-}
-
-static AtkHyperlink *
-my_atk_hypertext_get_link (AtkHypertext *obj, gint link_index)
-{
- MyAtkHypertext *self = MY_ATK_HYPERTEXT (obj);
- AtkHyperlink *link = NULL;
- g_return_val_if_fail (MY_IS_ATK_HYPERTEXT (obj), NULL);
- if (0 <= link_index && link_index < self->array->len)
- link = g_ptr_array_index (self->array, link_index);
- return link;
-}
-
-static gint
-my_atk_hypertext_get_link_index (AtkHypertext *obj, gint char_index)
-{
- MyAtkHypertext *self = MY_ATK_HYPERTEXT (obj);
- gint i;
- MyAtkHyperlink *link;
- g_return_val_if_fail (MY_IS_ATK_HYPERTEXT (obj), -1);
-
- for (i = 0; i < self->array->len; i++) {
- link = g_ptr_array_index (self->array, i);
- if (link->start <= char_index && char_index <= link->end)
- return i;
- }
- return -1;
-}
-
-static void
-my_atk_hypertext_link_selected (AtkHypertext *obj, gint link_index)
-{
- g_return_if_fail (MY_IS_ATK_HYPERTEXT (obj));
-}
-
-static void
-GDestroyNotifyGOBJptrArray (gpointer data)
-{
- g_object_unref (data);
-}
-
-static void
-atk_hypertext_interface_init (AtkHypertextIface *iface)
-{
- if (!iface) return;
- iface->get_n_links = my_atk_hypertext_get_n_links;
- iface->get_link = my_atk_hypertext_get_link;
- iface->get_link_index = my_atk_hypertext_get_link_index;
- iface->link_selected = my_atk_hypertext_link_selected;
-}
-
-static void
-my_atk_hypertext_init (MyAtkHypertext *self)
-{
- self->array = g_ptr_array_new_full (2, GDestroyNotifyGOBJptrArray);
-}
-
-static void
-my_atk_hypertext_class_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_hypertext_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_hypertext_class_init(MyAtkHypertextClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
-
- gobject_class->finalize = my_atk_hypertext_class_finalize;
-
- atk_class->initialize = my_atk_hypertext_class_initialize;
-}
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef MY_ATK_HYPERTEXT_H_
-#define MY_ATK_HYPERTEXT_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#define MY_TYPE_ATK_HYPERTEXT (my_atk_hypertext_get_type ())
-#define MY_ATK_HYPERTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertext))
-#define MY_ATK_HYPERTEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertextClass))
-#define MY_IS_ATK_HYPERTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_HYPERTEXT))
-#define MY_IS_ATK_HYPERTEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_HYPERTEXT))
-#define MY_ATK_HYPERTEXT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_HYPERTEXT, MyAtkHypertextClass))
-
-typedef struct _MyAtkHypertext MyAtkHypertext;
-typedef struct _MyAtkHypertextClass MyAtkHypertextClass;
-
-struct _MyAtkHypertext {
- MyAtkObject parent;
- GPtrArray *array;
-};
-
-struct _MyAtkHypertextClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_hypertext_get_type (void);
-
-gint my_atk_set_hypertext (AtkHypertext *obj, const gchar *text);
-
-#endif /* MY_ATK_HYPERTEXT_H_ */
+++ /dev/null
-/*
- * 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-image.h"
-
-typedef struct _MyAtkImageInfo MyAtkImageInfo;
-
-static void atk_image_interface_init (AtkImageIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkImage,
- my_atk_image,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
- atk_image_interface_init));
-
-guint
-my_atk_set_image (AtkImage *image,
- const gchar *desc,
- const gint x,
- const gint y,
- const gint width,
- const gint height,
- const gchar *locale)
-{
- g_return_val_if_fail (MY_IS_ATK_IMAGE (image), FALSE);
-
- MyAtkImage *self = MY_ATK_IMAGE (image);
-
- self->description = g_strdup (desc);
- self->x = x;
- self->y = y;
- self->width = width;
- self->height = height;
- self->locale = g_strdup (locale);
-
- return 0;
-}
-
-static void
-my_atk_image_init (MyAtkImage *obj)
-{
- MyAtkImage *self = MY_ATK_IMAGE (obj);
- self->description = NULL;
- self->x = -1;
- self->y = -1;
- self->width = -1;
- self->height = -1;
- self->locale = NULL;
-}
-
-void my_atk_image_get_image_position (AtkImage *obj, gint *x, gint *y, AtkCoordType coord_type)
-{
- g_return_if_fail (MY_IS_ATK_IMAGE (obj));
-
- MyAtkImage *self = MY_ATK_IMAGE (obj);
- *x = self->x;
- *y = self->y;
-}
-
-const gchar*
-my_atk_image_get_image_description (AtkImage *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), NULL);
-
- MyAtkImage *self = MY_ATK_IMAGE (obj);
-
- return g_strdup (self->description);
-}
-
-void my_atk_image_get_image_size (AtkImage *obj, gint *width, gint *height)
-{
- g_return_if_fail (MY_IS_ATK_IMAGE (obj));
-
- MyAtkImage *self = MY_ATK_IMAGE (obj);
- *width = self->width;
- *height = self->height;
-}
-
-gboolean
-my_atk_image_set_image_description (AtkImage *obj, const gchar * desc)
-{
- g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), FALSE);
-
- MyAtkImage *self = MY_ATK_IMAGE (obj);
-
- g_free (self->description);
- self->description = g_strdup (desc);
-
- return TRUE;
-}
-
-const gchar*
-my_atk_image_get_image_locale (AtkImage *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), NULL);
-
- MyAtkImage *self = MY_ATK_IMAGE (obj);
-
- return self->locale;
-}
-
-static void
-atk_image_interface_init (AtkImageIface *iface)
-{
- if (!iface) return;
- iface->get_image_position = my_atk_image_get_image_position;
- iface->set_image_description = my_atk_image_set_image_description;
- iface->get_image_description = my_atk_image_get_image_description;
- iface->get_image_size = my_atk_image_get_image_size;
- iface->get_image_locale = my_atk_image_get_image_locale;
-}
-
-static void
-my_atk_image_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_image_finalize (GObject *object)
-{
-}
-
-static void
-my_atk_image_class_init (MyAtkImageClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_image_finalize;
-
- atk_class->initialize = my_atk_image_initialize;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_IMAGE_H_
-#define MY_ATK_IMAGE_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_IMAGE (my_atk_image_get_type ())
-#define MY_ATK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_IMAGE, MyAtkImage))
-#define MY_ATK_IMAGE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_IMAGE, MyAtkImageClass))
-#define MY_IS_ATK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_IMAGE))
-#define MY_IS_ATK_IMAGE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_IMAGE))
-#define MY_ATK_IMAGE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_IMAGE, MyAtkImageClass))
-
-typedef struct _MyAtkImage MyAtkImage;
-typedef struct _MyAtkImageClass MyAtkImageClass;
-
-typedef void (* MyAtkImageFunc) (MyAtkImage *image);
-
-struct _MyAtkImage {
- MyAtkObject parent;
- gchar *description;
- gint x;
- gint y;
- gint width;
- gint height;
- gchar *locale;
-};
-
-struct _MyAtkImageClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_image_get_type (void);
-
-guint my_atk_set_image (AtkImage *image,
- const gchar *desc,
- const gint x,
- const gint y,
- const gint width,
- const gint height,
- const gchar *locale);
-
-#endif /* MY_ATK_IMAGE_H_ */
+++ /dev/null
-/*
- * 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 <stdio.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-GType my_atk_object_get_type (void);
-
-G_DEFINE_TYPE (MyAtkObject,
- my_atk_object,
- ATK_TYPE_OBJECT);
-
-void my_atk_object_add_child (MyAtkObject* parent,
- MyAtkObject* child)
-{
- g_ptr_array_add (parent->children, child);
- g_object_ref_sink (child);
-
- atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (parent));
-
- g_signal_emit_by_name (parent, "children-changed::add",
- parent->children->len - 1,
- child);
-}
-
-void my_atk_object_remove_child (MyAtkObject* parent,
- MyAtkObject* child)
-{
- gint i;
- for (i = parent->children->len - 1; i >= 0; i--) {
- if (g_ptr_array_index (parent->children, i) == child)
- break;
- }
- g_return_if_fail (i < 0);
- g_ptr_array_remove_index (parent->children, i);
- g_signal_emit_by_name (parent, "children-changed::remove", i, child);
-}
-
-static void my_atk_object_set_parent(AtkObject *accessible, AtkObject *parent)
-{
- MyAtkObject *self = MY_ATK_OBJECT (accessible);
- AtkObject *parent_old = atk_object_get_parent (accessible);
-
- if (parent_old == parent)
- return;
-
- AtkObjectClass *klass = ATK_OBJECT_CLASS (my_atk_object_parent_class);
- klass->set_parent (accessible, parent);
-
- if (parent_old != NULL)
- my_atk_object_remove_child (MY_ATK_OBJECT (parent_old), self);
-}
-
-static gint my_atk_object_get_n_children (AtkObject *accessible)
-{
- MyAtkObject *self = MY_ATK_OBJECT (accessible);
- return self->children->len;
-}
-
-static AtkObject* my_atk_object_ref_child (AtkObject *accessible, gint i)
-{
- MyAtkObject *self = MY_ATK_OBJECT (accessible);
-
- g_return_val_if_fail (i >= 0 || i <= self->children->len, NULL);
-
- AtkObject* child = ATK_OBJECT (g_ptr_array_index (self->children, i));
-
- return (child == NULL) ? NULL : g_object_ref (child);
-}
-
-static gint my_atk_object_get_index_in_parent (AtkObject *accessible)
-{
- AtkObject *parent = atk_object_get_parent (accessible);
- if (parent == NULL) return -1; /*root object so no parent*/
-
- MyAtkObject *parent_my = MY_ATK_OBJECT (parent);
-
- int i = parent_my->children->len;
- for (; i>=0; i--) {
- if (g_ptr_array_index (parent_my->children,i) == accessible)
- break;
- }
-
- g_return_val_if_fail (i>=0, -1);
-
- return i;
-}
-
-static AtkRelationSet *my_atk_object_ref_relation_set (AtkObject* accessible)
-{
- MyAtkObject *obj = MY_ATK_OBJECT (accessible);
- if (obj->relation_set == NULL)
- obj->relation_set = atk_relation_set_new ();
- return g_object_ref (ATK_RELATION_SET (obj->relation_set));
-}
-
-static AtkStateSet *my_atk_object_ref_state_set (AtkObject *accessible)
-{
- MyAtkObject *obj = MY_ATK_OBJECT (accessible);
- if (obj->state_set == NULL)
- obj->state_set = atk_state_set_new ();
- return g_object_ref (ATK_STATE_SET (obj->state_set));
-}
-
-static AtkAttributeSet *my_atk_object_get_attributes (AtkObject *accessible)
-{
- AtkAttributeSet *attributes;
- AtkAttribute *attr;
-
- attr = g_malloc (sizeof (AtkAttribute));
- attr->name = g_strdup ("atspi");
- attr->value = g_strdup ("test");
-
- attributes = g_slist_append (NULL, attr);
-
- return attributes;
-}
-
-static void my_atk_object_init (MyAtkObject *self)
-{
- self->children = g_ptr_array_new_full (10, g_object_unref);
-}
-
-static void my_atk_object_class_init (MyAtkObjectClass *my_class)
-{
- AtkObjectClass *object_class = ATK_OBJECT_CLASS (my_class);
-
- object_class->set_parent = my_atk_object_set_parent;
- object_class->get_n_children = my_atk_object_get_n_children;
- object_class->ref_child = my_atk_object_ref_child;
- object_class->get_index_in_parent = my_atk_object_get_index_in_parent;
- object_class->ref_state_set = my_atk_object_ref_state_set;
- object_class->get_attributes = my_atk_object_get_attributes;
- object_class->ref_relation_set = my_atk_object_ref_relation_set;
-
-}
+++ /dev/null
-/*
- * 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 MY_ATK_OBJECT_H
-#define MY_ATK_OBJECT_H
-
-#include <atk/atk.h>
-
-#define MY_TYPE_ATK_OBJECT (my_atk_object_get_type ())
-#define MY_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_OBJECT, MyAtkObject))
-#define MY_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
-#define MY_IS_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_OBJECT))
-#define MY_IS_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_OBJECT))
-#define MY_ATK_OBJECT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
-
-typedef struct _MyAtkObject MyAtkObject;
-typedef struct _MyAtkObjectClass MyAtkObjectClass;
-
-struct _MyAtkObject {
- AtkObject parent;
- AtkStateSet *state_set;
- AtkRelationSet *relation_set;
- GPtrArray* children;
- gint id;
- gboolean selected;
-};
-
-struct _MyAtkObjectClass {
- AtkObjectClass parent;
-};
-
-GType my_atk_object_get_type ();
-
-void my_atk_object_add_child (MyAtkObject* parent,
- MyAtkObject* child);
-
-void my_atk_object_remove_child (MyAtkObject* parent,
- MyAtkObject* child);
-
-#endif /*MY_ATK_OBJECT_H*/
+++ /dev/null
-/*
- * 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-selection.h"
-
-static void atk_selection_interface_init (AtkSelectionIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkSelection,
- my_atk_selection,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION,
- atk_selection_interface_init));
-
-static void
-my_atk_selection_init (MyAtkSelection *obj)
-{
-}
-
-static gboolean
-my_atk_selection_add_selection (AtkSelection *selection, gint i)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- if (!self)
- return FALSE;
-
- AtkObject *child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- AtkStateSet *ss = atk_object_ref_state_set (child);
- atk_state_set_add_state (ss, ATK_STATE_SELECTED);
- return atk_state_set_contains_state (ss, ATK_STATE_SELECTED);
-}
-
-static gboolean
-my_atk_selection_clear_selection (AtkSelection *selection)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- if (!self)
- return FALSE;
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- int i;
- int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));
-
- for (i=0; i<childs; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- atk_state_set_remove_state (states, ATK_STATE_SELECTED);
- }
- return TRUE;
-}
-
-static AtkObject*
-my_atk_selection_ref_selection (AtkSelection *selection, gint no)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- if (!self)
- return FALSE;
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- GArray *array = g_array_new (FALSE, FALSE, sizeof (AtkObject *));
- int i;
- int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));
-
- for (i=0; i<childs; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
- g_array_append_val (array, child);
- }
-
- return g_array_index (array, AtkObject *, no);
-}
-
-static gint
-my_atk_selection_get_selection_count (AtkSelection *selection)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- if (!self)
- return FALSE;
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- int i, ret=0;
- int childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));
-
- for (i=0; i<childs; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
- ret++;
-
- }
- return ret;
-}
-
-static gboolean
-my_atk_selection_is_child_selected (AtkSelection *selection, gint i)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- if (!self)
- return FALSE;
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-my_atk_selection_remove_selection (AtkSelection *selection, gint no)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- GArray *array = NULL;
- AtkObject *o = NULL;
- int i;
- int childs;
- gboolean ret = FALSE;
-
- if (!self)
- return FALSE;
- array = g_array_new (FALSE, FALSE, sizeof (AtkObject *));
- childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));
-
- for (i=0; i<childs; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (states, ATK_STATE_SELECTED))
- g_array_append_val (array, child);
- }
- g_object_unref (states);
-
- o = g_array_index (array, AtkObject *, no);
- states = atk_object_ref_state_set (o);
- atk_state_set_remove_state (states, ATK_STATE_SELECTED);
-
- ret = !atk_state_set_contains_state (states, ATK_STATE_SELECTED);
- g_object_unref (states);
- g_object_unref (o);
- g_object_unref (self);
- g_array_free (array, TRUE);
-
- return ret;
-}
-
-static gboolean
-my_atk_selection_select_all_selection (AtkSelection *selection)
-{
- MyAtkSelection *self = MY_ATK_SELECTION(selection);
- AtkObject *child = NULL;
- AtkStateSet *states = NULL;
- int i;
- int childs;
-
- if (!self)
- return FALSE;
- childs = atk_object_get_n_accessible_children (ATK_OBJECT (selection));
-
- for (i=0; i<childs; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (selection), i);
- states = atk_object_ref_state_set (child);
- atk_state_set_add_state (states, ATK_STATE_SELECTED);
- g_object_unref (states);
- g_object_unref (child);
- }
-
- g_object_unref (self);
- return TRUE;
-}
-
-static void
-atk_selection_interface_init (AtkSelectionIface *iface)
-{
- if(!iface) return;
-
- iface->add_selection = my_atk_selection_add_selection;
- iface->clear_selection = my_atk_selection_clear_selection;
- iface->ref_selection = my_atk_selection_ref_selection;
- iface->get_selection_count = my_atk_selection_get_selection_count;
- iface->is_child_selected = my_atk_selection_is_child_selected;
- iface->remove_selection = my_atk_selection_remove_selection;
- iface->select_all_selection = my_atk_selection_select_all_selection;
-}
-
-static void
-my_atk_selection_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_selection_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_selection_class_init (MyAtkSelectionClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
-
- gobject_class->finalize = my_atk_selection_finalize;
-
- atk_class->initialize = my_atk_selection_initialize;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_SELECTION_H
-#define MY_ATK_SELECTION_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-
-#define MY_TYPE_ATK_SELECTION (my_atk_selection_get_type ())
-#define MY_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_SELECTION, MyAtkSelection))
-#define MY_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass))
-#define MY_IS_ATK_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_SELECTION))
-#define MY_IS_ATK_SELECTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_SELECTION))
-#define MY_ATK_SELECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_SELECTION, MyAtkSelectionClass))
-
-/* Number of child objects for the MyAtkSelection instance */
-#define TEST_SELECTION_NCHILDREN 10
-
-typedef struct _MyAtkSelection MyAtkSelection;
-typedef struct _MyAtkSelectionClass MyAtkSelectionClass;
-
-struct _MyAtkSelection {
- MyAtkObject parent;
-// gboolean disposed;
- // gboolean multisel_supported;
- // MyAtkObject* child[TEST_SELECTION_NCHILDREN];
- // gboolean is_selected[TEST_SELECTION_NCHILDREN];
-};
-
-struct _MyAtkSelectionClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_selection_get_type (void);
-
-guint my_atk_selection_set (MyAtkSelection *selection);
-#endif /*MY_ATK_SELECTION_H*/
-
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-table.h"
-#include "my-atk-table-cell.h"
-
-typedef struct _MyAtkTableCellInfo MyAtkTableCellInfo;
-
-static void atk_tablecell_interface_init (AtkTableCellIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkTableCell,
- my_atk_tablecell,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL,
- atk_tablecell_interface_init));
-
-gboolean
-my_atk_set_table_cell (AtkTableCell *cell, gint x, gint y, gint row_span, gint column_span)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (cell), FALSE);
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (cell);
-
- self->x = x;
- self->y = y;
- self->row_span = row_span;
- self->column_span = column_span;
-
- /* Default value for span is 1, so that condition is needed */
- if (row_span == 0)
- self->row_span = 1;
- if (column_span == 0)
- self->column_span = 1;
-
- return TRUE;
-
-}
-gboolean
-my_atk_set_tablecell (MyAtkTableCell *self, gpointer value, const gchar *row_desc, MyAtkObject *parent_table, gboolean selected, gint *xy)
-{
- self->value = value;
- self->row_desc = g_strdup (row_desc);
- self->parent_table = parent_table;
- self->selected = selected;
-
- memcpy (self->xy, xy, sizeof (self->xy));
- return TRUE;
-}
-
-static gint
-my_atk_tablecell_get_column_span (AtkTableCell *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), -1);
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (obj);
- return self->column_span;
-}
-
-static gboolean
-my_atk_tablecell_get_row_column_span (AtkTableCell *obj, gint *row, gint *col, gint *row_span, gint *col_span)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), FALSE);
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (obj);
- *col = self->x;
- *row = self->y;
- *row_span = self->row_span;
- *col_span = self->column_span;
- return TRUE;
-}
-
-static GPtrArray *
-my_atk_tablecell_get_column_header_cells (AtkTableCell *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), FALSE);
- MyAtkTable *tab = MY_ATK_TABLE (atk_object_get_parent (ATK_OBJECT (obj)));
-
- gint i, all_child;
- all_child = MY_ATK_OBJECT (tab)->children->len;
- AtkObject *child = NULL;
- GPtrArray *ret = g_ptr_array_new_full (atk_table_get_n_columns ATK_TABLE (tab), g_object_unref);
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (tab), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER) {
- g_ptr_array_add (ret, child);
- }
- }
-
- return ret;
-}
-
-static AtkObject *
-my_atk_tablecell_get_table (AtkTableCell *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), NULL);
-
- return atk_object_get_parent (ATK_OBJECT (obj));
-}
-
-static gint
-my_atk_tablecell_get_row_span (AtkTableCell *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), -1);
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (obj);
- return self->row_span;
-}
-
-static gboolean
-my_atk_tablecell_get_position (AtkTableCell *obj, gint *row , gint *column)
-{
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), FALSE);
-
- *row = self->xy[0];
- *column = self->xy[1];
-
- return TRUE;
-}
-
-static GPtrArray *
-my_atk_tablecell_get_row_header_cells (AtkTableCell *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TABLE_CELL (obj), FALSE);
- MyAtkTable *tab = MY_ATK_TABLE (atk_object_get_parent (ATK_OBJECT (obj)));
-
- gint i, all_child;
- all_child = MY_ATK_OBJECT (tab)->children->len;
- AtkObject *child = NULL;
- GPtrArray *ret = g_ptr_array_new_full (atk_table_get_n_columns ATK_TABLE (tab), g_object_unref);
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (tab), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER) {
- g_ptr_array_add (ret, child);
- }
- }
-
- return ret;
-}
-
-static void
-atk_tablecell_interface_init (AtkTableCellIface *iface)
-{
- if (!iface) return;
- iface->get_column_span = my_atk_tablecell_get_column_span;
- iface->get_column_header_cells = my_atk_tablecell_get_column_header_cells;
- iface->get_position = my_atk_tablecell_get_position;
- iface->get_row_span = my_atk_tablecell_get_row_span;
- iface->get_row_header_cells = my_atk_tablecell_get_row_header_cells;
- iface->get_row_column_span = my_atk_tablecell_get_row_column_span;
- iface->get_table = my_atk_tablecell_get_table;
-}
-
-static void
-my_atk_tablecell_init (MyAtkTableCell *self)
-{
- self->value = NULL;
- self->parent_table = NULL;
- self->row_desc = NULL;
- self->selected = FALSE;
- memset (self->xy, -1, sizeof (self->xy));
- self->column_span = 1;
- self->row_span = 1;
- self->x = -1;
- self->y = -1;
- self->column_index = -1;
-}
-
-static void
-my_atk_tablecell_class_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_tablecell_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_tablecell_class_init (MyAtkTableCellClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_tablecell_class_finalize;
-
- atk_class->initialize = my_atk_tablecell_class_initialize;
-}
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef MY_ATK_TABLE_CELL_H_
-#define MY_ATK_TABLE_CELL_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#define MY_TYPE_ATK_TABLE_CELL (my_atk_tablecell_get_type ())
-#define MY_ATK_TABLE_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TABLE_CELL, MyAtkTableCell))
-#define MY_ATK_TABLE_CELL_CLASS (vtablecell) (G_TYPE_CHECK_CLASS_CAST ((vtablecell), MY_TYPE_ATK_TABLE_CELL, MyAtkTableCellClass))
-#define MY_IS_ATK_TABLE_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TABLE_CELL))
-#define MY_IS_ATK_TABLE_CELL_CLASS (vtablecell) (G_TYPE_CHECK_CLASS_TYPE ((vtablecell), MY_TYPE_ATK_TABLE_CELL))
-#define MY_ATK_TABLE_CELL_GET_CLASS (inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TABLE_CELL, MyAtkTableCellClass))
-
-typedef struct _MyAtkTableCell MyAtkTableCell;
-typedef struct _MyAtkTableCellClass MyAtkTableCellClass;
-
-struct _MyAtkTableCell {
- MyAtkObject parent;
- MyAtkObject *parent_table;
- gpointer value;
- gint x;
- gint y;
- gint column_span;
- gint row_span;
- gint column_index;
- gboolean selected;
- gchar *row_desc;
- gint xy[2];
-};
-
-struct _MyAtkTableCellClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_tablecell_get_type (void);
-
-gboolean my_atk_set_table_cell (AtkTableCell *self, gint x, gint y, gint row, gint column);
-gboolean my_atk_set_tablecell (MyAtkTableCell *self, gpointer value, const gchar *row_desc, MyAtkObject *parent_table, gboolean selected, gint *xy);
-
-#endif /* MY_ATK_TABLE_CELL_H_ */
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-table.h"
-#include "my-atk-table-cell.h"
-
-typedef struct _MyAtkTableInfo MyAtkTableInfo;
-
-static void GDestroyNotifyGPTRARRAYptrArray (gpointer data);
-static void atk_table_interface_init (AtkTableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkTable,
- my_atk_table,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE,
- atk_table_interface_init));
-
-
-static gint
-my_atk_table_get_index_at (AtkTable *obj, gint row, gint column)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint i, all_child, index_first_cell = -1;
- gint ret = -1;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
-
- MyAtkTableCell *cell = NULL;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_CELL) {
- if (index_first_cell == -1) {
- index_first_cell = i;
- }
- cell = MY_ATK_TABLE_CELL (child);
- if (cell->x == column && cell->y == row) {
- ret = i-index_first_cell;
- }
- }
- }
- return ret;
-}
-
-static gint
-my_atk_table_get_column_at_index (AtkTable *obj, gint index)
-{
- MyAtkTable *table = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint columns = -1;
- gint rows = -1;
- gint i, j;
-
- columns = atk_table_get_n_columns (ATK_TABLE (table));
- rows = atk_table_get_n_rows (ATK_TABLE (table));
-
- for (i = 0; i < rows; i++) {
- for (j = 0; j < columns; j++) {
- if (index == my_atk_table_get_index_at (obj, i, j))
- return j;
- }
- }
- return -1;
-}
-
-static gint
-my_atk_table_get_row_at_index (AtkTable *obj, gint index)
-{
- MyAtkTable *table = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint columns = -1;
- gint rows = -1;
- gint i, j;
-
- columns = atk_table_get_n_columns (ATK_TABLE (table));
- rows = atk_table_get_n_rows (ATK_TABLE (table));
-
- for (i = 0; i < rows; i++) {
- for (j = 0; j < columns; j++) {
- if (index == my_atk_table_get_index_at (obj, i, j))
- return i;
- }
- }
-
- return -1;
-}
-
-static gint
-my_atk_table_get_n_columns (AtkTable *obj)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint i, all_child, ret=0;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER)
- ret++;
- }
- return ret;
-}
-
-static gint
-my_atk_table_get_n_rows (AtkTable *obj)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint i, all_child, ret=0;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER)
- ret++;
- }
- return ret;
-}
-
-static AtkObject*
-my_atk_table_get_caption (AtkTable *obj)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
-
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- AtkObject *caption = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_CAPTION)
- caption = child;
- }
- return caption ? caption : NULL;
-}
-
-static AtkObject*
-my_atk_table_ref_at (AtkTable *obj, gint row, gint column)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- AtkObject *ret = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
-
- MyAtkTableCell *cell = NULL;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_CELL) {
- cell = MY_ATK_TABLE_CELL (child);
- if (cell->x == column && cell->y == row)
- ret = ATK_OBJECT (cell);
- }
- }
- return ret ? ret : NULL;
-}
-
-static const gchar *
-my_atk_table_get_row_description (AtkTable *obj, gint index)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- GPtrArray *ret = g_ptr_array_new_full ( my_atk_table_get_n_rows (obj),
- g_object_unref);
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER)
- g_ptr_array_add (ret, child);
- }
- child = g_ptr_array_index (ret, index);
-
- return g_strdup (atk_object_get_description (child));
-}
-
-static const gchar *
-my_atk_table_get_column_description (AtkTable *obj, gint index)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- GPtrArray *ret = g_ptr_array_new_full (my_atk_table_get_n_columns (obj), g_object_unref);
-
- all_child = MY_ATK_OBJECT(self)->children->len;
- AtkObject *child = NULL;
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER)
- g_ptr_array_add (ret, child);
- }
- child = g_ptr_array_index (ret, index);
-
- return g_strdup (atk_object_get_description (child));
-}
-
-static gint
-my_atk_table_test_table_get_row_extent_at (AtkTable *obj, gint row, gint col)
-{
- AtkObject *cell = my_atk_table_ref_at (obj, row, col);
-
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (cell);
-
- return self->row_span;
-}
-
-static gint
-my_atk_table_test_table_get_column_extent_at (AtkTable *obj, gint row, gint col)
-{
- AtkObject *cell = my_atk_table_ref_at (obj, row, col);
-
- MyAtkTableCell *self = MY_ATK_TABLE_CELL (cell);
-
- return self->column_span;
-}
-
-static AtkObject*
-my_atk_table_get_row_header (AtkTable *obj, gint row)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- GPtrArray *ret = g_ptr_array_new_full (my_atk_table_get_n_rows (obj), g_object_unref);
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
- AtkObject *c = NULL;
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER)
- g_ptr_array_add (ret, child);
- }
- c = ATK_OBJECT (g_ptr_array_index (ret, row));
-
- return atk_object_ref_accessible_child (c, 0);
-}
-
-static AtkObject*
-my_atk_table_get_column_header (AtkTable *obj, gint col)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- GPtrArray *ret = g_ptr_array_new_full (my_atk_table_get_n_rows (obj), g_object_unref);
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- AtkObject *child = NULL;
- AtkObject *c = NULL;
-
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER)
- g_ptr_array_add (ret, child);
- }
- c = g_ptr_array_index (ret, col);
-
- return atk_object_ref_accessible_child (c, 0);
-}
-
-gint
-my_atk_table_get_selected_rows (AtkTable *obj, gint **selected)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint i, all_child, row = 0, ret = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- GArray *array = g_array_new (FALSE, FALSE, sizeof (gint));
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i=0; i<all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER) {
- ss = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- ret++;
- g_array_append_val (array, row);
- }
- row++;
- }
- }
- if (selected)
- *selected = (gint *) g_array_free (array, FALSE);
- return ret;
-}
-
-gint
-my_atk_table_get_selected_columns (AtkTable *obj, gint **selected)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), -1);
- gint i, all_child, column = 0, ret = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- GArray *array = g_array_new (FALSE, FALSE, sizeof (gint));
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i=0; i<all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER) {
- ss = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- ret++;
- g_array_append_val (array, column);
- }
- column++;
- }
- }
- if (selected)
- *selected = (gint *) g_array_free (array, FALSE);
- return ret;
-}
-
-static gboolean
-my_atk_table_is_row_selected (AtkTable *obj, gint row)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child;
- AtkObject *child = NULL;
- AtkObject *c = NULL;
- AtkStateSet *ss = NULL;
- GPtrArray *ret = g_ptr_array_new_full (my_atk_table_get_n_rows (obj), g_object_unref);
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER)
- g_ptr_array_add (ret, child);
- }
- c = g_ptr_array_index (ret, row);
- ss = atk_object_ref_state_set (c);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-my_atk_table_is_column_selected (AtkTable *obj, gint col)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child;
- AtkObject *child = NULL;
- AtkObject *c = NULL;
- AtkStateSet *ss = NULL;
- GPtrArray *ret = g_ptr_array_new_full (my_atk_table_get_n_columns (obj), g_object_unref);
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER)
- g_ptr_array_add (ret, child);
- }
- c = g_ptr_array_index (ret, col);
- ss = atk_object_ref_state_set (c);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-my_atk_table_is_selected (AtkTable *obj, gint row, gint col)
-{
- AtkObject *cell = atk_table_ref_at (obj, row, col);
- AtkStateSet *ss = atk_object_ref_state_set (cell);
- gboolean ret = FALSE;
-
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED))
- ret = TRUE;
- return ret;
-}
-
-static gboolean
-my_atk_table_add_column_selection (AtkTable *obj, gint col)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child, counter = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER) {
- if (col == counter) {
- ss = atk_object_ref_state_set (child);
- if (!atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- atk_state_set_add_state (ss, ATK_STATE_SELECTED);
- return TRUE;
- }
- }
- counter++;
- }
- }
- return FALSE;
-}
-
-static gboolean
-my_atk_table_add_row_selection (AtkTable *obj, gint row)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child, counter = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER) {
- if (row == counter) {
- ss = atk_object_ref_state_set (child);
- if (!atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- atk_state_set_add_state (ss, ATK_STATE_SELECTED);
- return TRUE;
- }
- }
- counter++;
- }
- }
- return FALSE;
-}
-
-static gboolean
-my_atk_table_remove_column_selection (AtkTable *obj, gint col)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child, counter = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_COLUMN_HEADER) {
- if (col == counter) {
- ss = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- atk_state_set_remove_state (ss, ATK_STATE_SELECTED);
- return TRUE;
- }
- }
- counter++;
- }
- }
- return FALSE;
-}
-
-static gboolean
-my_atk_table_remove_row_selection (AtkTable *obj, gint row)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), FALSE);
- gint i, all_child, counter = 0;
- AtkObject *child = NULL;
- AtkStateSet *ss = NULL;
-
- all_child = MY_ATK_OBJECT (self)->children->len;
- for (i = 0; i < all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_TABLE_ROW_HEADER) {
- if (row == counter) {
- ss = atk_object_ref_state_set (child);
- if (atk_state_set_contains_state (ss, ATK_STATE_SELECTED)) {
- atk_state_set_remove_state (ss, ATK_STATE_SELECTED);
- return TRUE;
- }
- }
- counter++;
- }
- }
- return FALSE;
-}
-
-static AtkObject *
-my_atk_table_get_summary (AtkTable *obj)
-{
- MyAtkTable *self = MY_ATK_TABLE (obj);
- g_return_val_if_fail (MY_IS_ATK_TABLE (obj), NULL);
- gint i, all_child;
- AtkObject *summary = NULL;
-
- all_child = MY_ATK_OBJECT(self)->children->len;
- AtkObject *child = NULL;
- for (i=0; i<all_child; i++) {
- child = atk_object_ref_accessible_child (ATK_OBJECT (obj), i);
- if (atk_object_get_role (child) == ATK_ROLE_HEADING)
- summary = child;
- }
- return summary ? summary : NULL;
-}
-
-static void
-my_atk_table_set_column_header (AtkTable *obj, gint column, AtkObject *header)
-{
-}
-
-static void
-my_atk_table_set_column_description (AtkTable *obj, gint column, const gchar *desc)
-{
-}
-
-static void
-my_atk_table_set_caption (AtkTable *obj, AtkObject *caption)
-{
-}
-
-static void
-my_atk_table_set_row_description (AtkTable *obj, gint row, const gchar *desc)
-{
-}
-
-static void
-my_atk_table_set_row_header (AtkTable *obj, gint column, AtkObject *header)
-{
-}
-
-static void
-my_atk_table_set_summary (AtkTable *table, AtkObject *accessible)
-{
-}
-
-static void
-my_atk_table_row_inserted (AtkTable *table, gint row, gint num_inserted)
-{
-}
-
-static void
-my_atk_table_column_inserted (AtkTable *table, gint column, gint num_inserted)
-{
-}
-
-static void
-my_atk_table_row_deleted (AtkTable *table, gint row, gint num_deleted)
-{
-}
-
-static void
-my_atk_table_column_deleted (AtkTable *table, gint column, gint num_deleted)
-{
-}
-
-static void
-my_atk_table_row_reordered (AtkTable *table)
-{
-}
-
-static void
-my_atk_table_column_reordered (AtkTable *table)
-{
-}
-
-static void
-my_atk_table_model_changed (AtkTable *table)
-{
-}
-
-static void
-atk_table_interface_init (AtkTableIface *iface)
-{
-
- if (!iface) return;
-
- iface->ref_at = my_atk_table_ref_at;
-
- /* DEPRICATED BUT NOT IN ATSPI */
- iface->get_index_at = my_atk_table_get_index_at;
- iface->get_column_at_index = my_atk_table_get_column_at_index;
- iface->get_row_at_index = my_atk_table_get_row_at_index;
- /* DEPRICATED */
-
- iface->get_n_columns = my_atk_table_get_n_columns;
- iface->get_n_rows = my_atk_table_get_n_rows;
- iface->get_column_extent_at = my_atk_table_test_table_get_column_extent_at;
- iface->get_row_extent_at = my_atk_table_test_table_get_row_extent_at;
- iface->get_caption = my_atk_table_get_caption;
- iface->get_column_description = my_atk_table_get_column_description;
- iface->get_column_header = my_atk_table_get_column_header;
- iface->get_row_description = my_atk_table_get_row_description;
- iface->get_row_header = my_atk_table_get_row_header;
- iface->get_summary = my_atk_table_get_summary;
- iface->set_caption = my_atk_table_set_caption;
- iface->set_column_description = my_atk_table_set_column_description;
- iface->set_column_header = my_atk_table_set_column_header;
- iface->set_row_description = my_atk_table_set_row_description;
- iface->set_row_header = my_atk_table_set_row_header;
- iface->set_summary = my_atk_table_set_summary;
- iface->get_selected_columns = my_atk_table_get_selected_columns;
- iface->get_selected_rows = my_atk_table_get_selected_rows;
- iface->is_column_selected = my_atk_table_is_column_selected;
- iface->is_row_selected = my_atk_table_is_row_selected;
- iface->is_selected = my_atk_table_is_selected;
- iface->add_row_selection = my_atk_table_add_row_selection;
- iface->remove_row_selection = my_atk_table_remove_row_selection;
- iface->add_column_selection = my_atk_table_add_column_selection;
- iface->remove_column_selection = my_atk_table_remove_column_selection;
- iface->row_inserted = my_atk_table_row_inserted;
- iface->column_inserted = my_atk_table_column_inserted;
- iface->row_deleted = my_atk_table_row_deleted;
- iface->column_deleted = my_atk_table_column_deleted;
- iface->row_reordered = my_atk_table_row_reordered;
- iface->column_reordered = my_atk_table_column_reordered;
- iface->model_changed = my_atk_table_model_changed;
-}
-
-static void
-my_atk_table_init (MyAtkTable *self)
-{
- self->parent_table = NULL;
- self->table = g_ptr_array_new_with_free_func (GDestroyNotifyGPTRARRAYptrArray);
- self->row_header = g_ptr_array_new_with_free_func (GDestroyNotifyGPTRARRAYptrArray);
- self->column_headers = g_ptr_array_new_with_free_func (GDestroyNotifyGPTRARRAYptrArray);
- self->selected = FALSE;
- self->col_desc = NULL;
-
-}
-
-static void
-GDestroyNotifyGPTRARRAYptrArray (gpointer data)
-{
- g_ptr_array_free (data, TRUE);
-}
-
-static void
-my_atk_table_class_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_table_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_table_class_init (MyAtkTableClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_table_class_finalize;
-
- atk_class->initialize = my_atk_table_class_initialize;
-}
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef MY_ATK_TABLE_H_
-#define MY_ATK_TABLE_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#define MY_TYPE_ATK_TABLE (my_atk_table_get_type ())
-#define MY_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TABLE, MyAtkTable))
-#define MY_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_TABLE, MyAtkTableClass))
-#define MY_IS_ATK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TABLE))
-#define MY_IS_ATK_TABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_TABLE))
-#define MY_ATK_TABLE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TABLE, MyAtkTableClass))
-
-typedef struct _MyAtkTable MyAtkTable;
-typedef struct _MyAtkTableClass MyAtkTableClass;
-
-struct _MyAtkTable {
- MyAtkObject parent;
- MyAtkTable *parent_table;
- GPtrArray *table;
- GPtrArray *column_headers;
- GPtrArray *row_headers;
- GPtrArray *row_header;
- gchar *col_desc;
- gboolean selected;
-};
-
-struct _MyAtkTableClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_table_get_type (void);
-
-guint my_atk_set_table (AtkTable *obj,
- gchar *col_header,
- gchar *row_header,
- gchar *col_desc,
- gchar* row_desc,
- gchar *value,
- gboolean selected,
- gboolean selected_col);
-
-AtkObject*
-test_get_cell_from_table (AtkTable *obj, gint row);
-
-#endif /* MY_ATK_TABLE_H_ */
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#include "my-atk-text.h"
-
-typedef struct _MyAtkTextInfo MyAtkTextInfo;
-
-static void atk_text_interface_init (AtkTextIface *iface);
-
-typedef struct _MyAtkTextSelection MyAtkTextSelection;
-
-struct _MyAtkTextSelection {
- gint start;
- gint end;
-};
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkText,
- my_atk_text,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
- atk_text_interface_init));
-
-guint
-my_atk_set_text (AtkText *obj,
- const gchar *text,
- const gint x,
- const gint y,
- const gint width,
- const gint height,
- AtkAttributeSet *attrSet)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), -1);
-
- MyAtkText *self = MY_ATK_TEXT (obj);
- self->text = g_strdup (text);
- self->x = x;
- self->y = y;
- self->width = width;
- self->height = height;
- self->attributes = g_slist_copy (attrSet);
-
- return 0;
-}
-
-MyAtkText *
-my_atk_text_new (void)
-{
- return g_object_new (MY_TYPE_ATK_TEXT, NULL);
-}
-
-static gchar *
-my_atk_text_get_text (AtkText *obj, gint start_offset, gint end_offset)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
- gchar *str = MY_ATK_TEXT (obj)->text;
-
- if ((end_offset < start_offset) || start_offset < 0 || !str)
- return NULL;
- if (strlen (str) < end_offset)
- return NULL;
-
- return g_strndup (str + start_offset, end_offset - start_offset);
-}
-
-static gint
-my_atk_text_get_character_count (AtkText *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), -1);
- gchar *str = MY_ATK_TEXT (obj)->text;
- if (!str) return 0;
- return (gint) strlen (str);
-}
-
-static int
-my_atk_text_get_caret_offset (AtkText *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), -1);
- return MY_ATK_TEXT (obj)->caret_offset;
-}
-
-static gboolean
-my_atk_text_set_caret_offset (AtkText *obj, gint offset)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), FALSE);
- MyAtkText *self = MY_ATK_TEXT (obj);
- if (offset < 0 && strlen (self->text) <= offset)
- return FALSE;
- self->caret_offset = offset;
- return TRUE;
-}
-
-static gunichar
-my_atk_text_get_character_at_offset (AtkText *obj, gint offset)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), 255);
- return MY_ATK_TEXT (obj)->text[offset];
-}
-
-static void
-my_atk_text_get_character_extents (AtkText *obj, gint offset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords)
-{
- g_return_if_fail (MY_IS_ATK_TEXT (obj));
- MyAtkText *self = MY_ATK_TEXT (obj);
- *x = self->x;
- *y = self->y;
- *width = self->width;
- *height = self->height;
-}
-
-static void
-my_atk_text_get_range_extents (AtkText *obj, gint start_offset, gint stop_offset, AtkCoordType coords, AtkTextRectangle *rect)
-{
- g_return_if_fail (MY_IS_ATK_TEXT (obj));
- MyAtkText *self = MY_ATK_TEXT (obj);
- rect->x = self->x;
- rect->y = self->y;
- rect->width = self->width;
- rect->height = self->height;
-}
-
-static gint
-my_atk_text_get_n_selections (AtkText *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), -1);
- return g_list_length (MY_ATK_TEXT (obj)->selection);
-}
-
-static gboolean
-my_atk_text_add_selection (AtkText *obj, gint start_offset, gint end_offset)
-{
- MyAtkText *self = MY_ATK_TEXT (obj);
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), FALSE);
-
- MyAtkTextSelection *node = g_malloc (sizeof (MyAtkTextSelection));
-
- node->start = start_offset;
- node->end = end_offset;
-
- self->selection = g_list_append (self->selection, node);
-
- return TRUE;
-}
-
-static gchar *
-my_atk_text_get_selection (AtkText *obj, gint selection_num, gint *start_offset, gint *end_offset)
-{
- MyAtkText *self = MY_ATK_TEXT (obj);
- gchar *str = NULL;
- GList *it;
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
-
- if (selection_num < 0)
- return NULL;
-
- it = g_list_nth (self->selection, selection_num);
- if (!it)
- return NULL;
-
- str = my_atk_text_get_text (obj, ((MyAtkTextSelection *)it->data)->start, ((MyAtkTextSelection *)it->data)->end);
- if (!str)
- return NULL;
- *start_offset = ((MyAtkTextSelection *)it->data)->start;
- *end_offset = ((MyAtkTextSelection *)it->data)->end;
-
- return str;
-}
-
-static gboolean
-my_atk_text_set_selection (AtkText *obj, gint selection_num, gint start_offset, gint end_offset)
-{
- MyAtkText *self = MY_ATK_TEXT (obj);
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), FALSE);
-
- GList *it;
-
- if (selection_num < 0)
- return FALSE;
-
- it = g_list_nth (self->selection, selection_num);
- if (!it)
- return FALSE;
-
- ((MyAtkTextSelection *)it->data)->start = start_offset;
- ((MyAtkTextSelection *)it->data)->end = end_offset;
-
- return TRUE;
-}
-
-static gboolean
-my_atk_text_remove_selection (AtkText *obj, gint selection_num)
-{
- MyAtkText *self = MY_ATK_TEXT (obj);
- GList *it;
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), FALSE);
-
- if (selection_num < 0)
- return FALSE;
-
- it = g_list_nth (self->selection, selection_num);
- if (!it)
- return FALSE;
-
- self->selection = g_list_delete_link (self->selection, it);
- return TRUE;
-}
-
-static gint
-my_atk_text_get_offset_at_point (AtkText *obj, gint x, gint y, AtkCoordType coords)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), -1);
- return 5;
-}
-
-static AtkAttributeSet *
-my_atk_text_get_default_attributes (AtkText *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
- return MY_ATK_TEXT (obj)->attributes;
-}
-
-static AtkAttributeSet *
-my_atk_text_get_run_attributes (AtkText *obj, gint offset, gint *start_offset, gint *end_offset)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
- AtkAttributeSet *attributes;
- AtkAttribute *attr;
-
- attr = g_malloc (sizeof (AtkAttribute));
- attr->name = g_strdup ("text_test_attr1");
- attr->value = g_strdup ("on");
- attributes = g_slist_append (NULL, attr);
-
- attr = g_malloc (sizeof (AtkAttribute));
- attr->name = g_strdup ("text_test_attr2");
- attr->value = g_strdup ("off");
- attributes = g_slist_append (attributes, attr);
-
- *start_offset = 5;
- *end_offset = 10;
-
- return attributes;
-}
-
-static void setSentenceStartEnd (MyAtkText *self,gint *_offset, gint *start_offset, gint*end_offset, const gchar *fstr)
-{
- gchar *p_str_begin = NULL;
- gchar *p_str_end = NULL;
- const gint length = strlen (self->text);
- gint offset = *_offset;
- gint star_correction = 1;
- /*
- * In case if offset is in the middle of the word rewind to 1 character before.
- */
- for (; g_ascii_isalpha (self->text[offset]) && 0 < offset; offset--);
- /*
- * if [char] rewind to word after by passing none alpha
- * else try to find last [string] in range [0,offset]
- * if found then correct position
- * else not found so this is first sentence find first word
- */
- if (self->text[offset] == fstr[0]) {
- for (; !g_ascii_isalpha (self->text[offset]) && offset < length; offset++);
- p_str_begin = self->text + offset;
- } else {
- p_str_begin = g_strrstr_len (self->text, offset, fstr);
- if (p_str_begin) {
- for (; !g_ascii_isalpha (self->text[offset]) && length < offset; offset++);
- } else {
- for (offset = 0; !g_ascii_isalpha (self->text[offset]) && length < offset; offset++);
- star_correction = 0;
- }
- p_str_begin = self->text + offset;
- }
- /*
- * try find ending
- * if not found set ending at text end.
- * */
- p_str_end = g_strstr_len (self->text + offset, length - offset, fstr);
- if (!p_str_end) {
- p_str_end = self->text + (length -1);
- }
- if (p_str_begin && p_str_end) {
- *start_offset = p_str_begin - self->text + star_correction;
- *end_offset = p_str_end - self->text + 1;
- *_offset = offset;
- }
-}
-
-static gchar *
-my_atk_text_get_string_at_offset (AtkText *obj, gint offset, AtkTextGranularity granularity, gint *start_offset, gint *end_offset)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
- MyAtkText *self = MY_ATK_TEXT (obj);
- gint cnt;
- gint length;
- gint myoffset = 0;
- *start_offset = -1;
- *end_offset = -1;
-
- switch (granularity) {
- case ATK_TEXT_GRANULARITY_CHAR:
- *start_offset = offset;
- *end_offset = *start_offset + 1;
- break;
- case ATK_TEXT_GRANULARITY_WORD:
- length = strlen (self->text);
- for (; !g_ascii_isalpha (self->text[offset]) && offset < length ; offset++);
- for (cnt = offset; cnt < length; cnt++) {
- if (!g_ascii_isalpha (self->text[cnt])) {
- *start_offset = offset;
- *end_offset = cnt - 1;
- myoffset = 1;
- break;
- }
- }
- for (cnt = offset; 0 < cnt; cnt--) {
- if (!g_ascii_isalpha (self->text[cnt])) {
- *start_offset = cnt + 1;
- break;
- }
- }
- break;
- case ATK_TEXT_GRANULARITY_SENTENCE:
- setSentenceStartEnd (self, &offset, start_offset, end_offset, ".");
- break;
- case ATK_TEXT_GRANULARITY_LINE:
- setSentenceStartEnd (self, &offset, start_offset, end_offset, "/n");
- break;
- case ATK_TEXT_GRANULARITY_PARAGRAPH:
- /* Not implemented */
- *start_offset = 0;
- *end_offset = 0;
- break;
- default:
- break;
- }
- return my_atk_text_get_text (obj, *start_offset, *end_offset + myoffset);
-}
-
-AtkTextRange **
-my_atk_get_bounded_ranges (AtkText *obj, AtkTextRectangle *rect, AtkCoordType ctype, AtkTextClipType xclip, AtkTextClipType yclip)
-{
- g_return_val_if_fail (MY_IS_ATK_TEXT (obj), NULL);
- AtkTextRange **range = g_new (AtkTextRange *, 3);
-
- *range = g_new (AtkTextRange, 1);
- (*range)->start_offset = 0;
- (*range)->end_offset = 5;
- (*range)->content = my_atk_text_get_text (obj, (*range)->start_offset, (*range)->end_offset);
-
- *(range+1) = g_new (AtkTextRange, 1);
- (*(range+1))->start_offset = 6;
- (*(range+1))->end_offset = 10;
- (*(range+1))->content = my_atk_text_get_text (obj, (*(range+1))->start_offset, (*(range+1))->end_offset);
-
- *(range+2) = NULL;
-
- return range;
-}
-
-static void
-atk_text_interface_init (AtkTextIface *iface)
-{
- if (!iface) return;
-
- iface->get_text = my_atk_text_get_text;
- iface->get_character_count = my_atk_text_get_character_count;
- iface->get_caret_offset = my_atk_text_get_caret_offset;
- iface->set_caret_offset = my_atk_text_set_caret_offset;
- iface->get_character_at_offset = my_atk_text_get_character_at_offset;
- iface->get_character_extents = my_atk_text_get_character_extents;
- iface->get_range_extents = my_atk_text_get_range_extents;
- iface->get_n_selections = my_atk_text_get_n_selections;
- iface->add_selection = my_atk_text_add_selection;
- iface->get_selection = my_atk_text_get_selection;
- iface->set_selection = my_atk_text_set_selection;
- iface->remove_selection = my_atk_text_remove_selection;
- iface->get_offset_at_point = my_atk_text_get_offset_at_point;
- iface->get_default_attributes = my_atk_text_get_default_attributes;
- iface->get_string_at_offset = my_atk_text_get_string_at_offset;
- iface->get_bounded_ranges = my_atk_get_bounded_ranges;
- iface->get_run_attributes = my_atk_text_get_run_attributes;
-}
-
-static void
-my_atk_text_init (MyAtkText *self)
-{
- self->text = NULL;
- self->caret_offset = -1;
- self->x =-1;
- self->y = -1;
- self->width = -1;
- self->height = -1;
- self->selection = NULL;
- self->attributes = NULL;
-}
-
-static void
-my_atk_text_class_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_text_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_text_class_init (MyAtkTextClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
-
- gobject_class->finalize = my_atk_text_class_finalize;
- atk_class->initialize = my_atk_text_class_initialize;
-}
+++ /dev/null
-/*
- * 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 MY_ATK_TEXT_H_
-#define MY_ATK_TEXT_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#define MY_TYPE_ATK_TEXT (my_atk_text_get_type ())
-#define MY_ATK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_TEXT, MyAtkText))
-#define MY_ATK_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_TEXT, MyAtkTextClass))
-#define MY_IS_ATK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_TEXT))
-#define MY_IS_ATK_TEXT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_TEXT))
-#define MY_ATK_TEXT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_TEXT, MyAtkTextClass))
-
-typedef struct _MyAtkText MyAtkText;
-typedef struct _MyAtkTextClass MyAtkTextClass;
-
-typedef void (* MyAtkTextFunc) (MyAtkText *obj);
-
-struct _MyAtkText {
- MyAtkObject parent;
- gchar *text;
- gint caret_offset;
- gint x;
- gint y;
- gint width;
- gint height;
- GList *selection;
- AtkAttributeSet *attributes;
-};
-
-struct _MyAtkTextClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_text_get_type (void);
-
-guint my_atk_set_text (AtkText *obj,
- const gchar *text,
- const gint x,
- const gint y,
- const gint width,
- const gint height,
- AtkAttributeSet *attrSet);
-
-MyAtkText *my_atk_text_new (void);
-
-#endif /* MY_ATK_TEXT_H_ */
+++ /dev/null
-/*
- * 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 <glib.h>
-#include <string.h>
-#include <atk/atk.h>
-#include <stdio.h>
-
-#include "my-atk-object.h"
-#include "my-atk-value.h"
-
-typedef struct _MyAtkValueInfo MyAtkValueInfo;
-
-static void atk_value_interface_init (AtkValueIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MyAtkValue,
- my_atk_value,
- MY_TYPE_ATK_OBJECT,
- G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE,
- atk_value_interface_init));
-
-guint
-my_atk_set_value (AtkValue *obj, gdouble min, gdouble cur, gdouble max, gdouble step)
-{
- MyAtkValue *self = MY_ATK_VALUE (obj);
- g_return_val_if_fail (MY_IS_ATK_VALUE (obj), -1);
-
- self->min = min;
- self->cur = cur;
- self->max = max;
- self->step = step;
-
- return 0;
-}
-
-static void
-my_atk_value_get_value_and_text (AtkValue *obj, gdouble *value, gchar **text)
-{
- MyAtkValue *self = MY_ATK_VALUE (obj);
- g_return_if_fail (MY_IS_ATK_VALUE (obj));
-
- *value = self->cur;
- *text = g_strdup_printf ("%f", self->cur);
-}
-
-static AtkRange*
-my_atk_value_get_range (AtkValue *obj)
-{
- MyAtkValue *self = MY_ATK_VALUE (obj);
- g_return_val_if_fail (MY_IS_ATK_VALUE (obj), NULL);
-
- return atk_range_new (self->min, self->max, NULL);
-}
-
-static gdouble
-my_atk_value_get_increment (AtkValue *obj)
-{
- MyAtkValue *self = MY_ATK_VALUE (obj);
- g_return_val_if_fail (MY_IS_ATK_VALUE (obj), 0);
- return self->step;
-}
-
-static GSList*
-my_atk_value_get_sub_ranges (AtkValue *obj)
-{
- g_return_val_if_fail (MY_IS_ATK_VALUE (obj), NULL);
-
- return NULL;
-}
-
-static void
-my_atk_value_set_value (AtkValue *obj, const gdouble val)
-{
- MyAtkValue *self = MY_ATK_VALUE (obj);
- g_return_if_fail (MY_IS_ATK_VALUE (obj));
-
- if ( self->min < val && val < self->max )
- self->cur = val;
- return;
-}
-
-static void
-atk_value_interface_init (AtkValueIface *iface)
-{
- if (!iface) return;
- iface->get_value_and_text = my_atk_value_get_value_and_text;
- iface->get_range = my_atk_value_get_range;
- iface->get_increment = my_atk_value_get_increment;
- iface->get_sub_ranges = my_atk_value_get_sub_ranges;
- iface->set_value = my_atk_value_set_value;
-}
-
-static void
-my_atk_value_init (MyAtkValue *self)
-{
- self->min = 0;
- self->cur = 0;
- self->max = 0;
- self->step = 0;
-}
-
-static void
-my_atk_value_class_initialize (AtkObject *obj, gpointer data)
-{
-}
-
-static void
-my_atk_value_class_finalize (GObject *obj)
-{
-}
-
-static void
-my_atk_value_class_init(MyAtkValueClass *my_class)
-{
- AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
- GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
-
- gobject_class->finalize = my_atk_value_class_finalize;
-
- atk_class->initialize = my_atk_value_class_initialize;
-}
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef MY_ATK_VALUE_H_
-#define MY_ATK_VALUE_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <atk/atk.h>
-
-#include "my-atk-object.h"
-#define MY_TYPE_ATK_VALUE (my_atk_value_get_type ())
-#define MY_ATK_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_VALUE, MyAtkValue))
-#define MY_ATK_VALUE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_VALUE, MyAtkValueClass))
-#define MY_IS_ATK_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_VALUE))
-#define MY_IS_ATK_VALUE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_VALUE))
-#define MY_ATK_VALUE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_VALUE, MyAtkValueClass))
-
-typedef struct _MyAtkValue MyAtkValue;
-typedef struct _MyAtkValueClass MyAtkValueClass;
-
-struct _MyAtkValue {
- MyAtkObject parent;
- gdouble min;
- gdouble cur;
- gdouble max;
- gdouble step;
-};
-
-struct _MyAtkValueClass {
- MyAtkObjectClass parent;
-};
-
-GType my_atk_value_get_type (void);
-
-guint my_atk_set_value (AtkValue *obj, gdouble min, gdouble cur, gdouble max, gdouble step);
-
-#endif /* MY_ATK_VALUE_H_ */
+++ /dev/null
-/*
- * 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 MY_ATK_H
-#define MY_ATK_H
-
-#include "my-atk-action.h"
-#include "my-atk-object.h"
-#include "my-atk-component.h"
-#include "my-atk-document.h"
-#include "my-atk-editable-text.h"
-#include "my-atk-hyperlink.h"
-#include "my-atk-hypertext.h"
-#include "my-atk-image.h"
-#include "my-atk-table.h"
-#include "my-atk-table-cell.h"
-#include "my-atk-text.h"
-#include "my-atk-selection.h"
-#include "my-atk-value.h"
-
-#endif /*MY_ATK_H*/
+++ /dev/null
-subdir('dummyatk')
-
-xmlloader = static_library('xmlloader', [ 'atk-object-xml-loader.c' ],
- dependencies: [ glib_dep, gobject_dep, libxml_dep, atk_dep, dummyatk_dep ],
- include_directories: [ root_inc, include_directories('.') ])
-xmlloader_dep = declare_dependency(link_with: xmlloader)
-
-testutils = static_library('testutils', [ 'atk_test_util.c' ],
- dependencies: [ glib_dep, atspi_dep ],
- include_directories: [ root_inc, include_directories('.') ],
- c_args: ['-DTESTS_BUILD_DIR="@0@"'.format(meson.current_build_dir()) ] )
-testutils_dep = declare_dependency(link_with: testutils)
-
-# tests:
-# - name
-# - sources
-# - dependencies
-tests = [
- [
- 'atk-test', [
- 'atk_suite.c',
- 'atk_test_accessible.c',
- 'atk_test_action.c',
- 'atk_test_component.c',
- 'atk_test_collection.c',
- 'atk_test_document.c',
- 'atk_test_editable_text.c',
- 'atk_test_hyperlink.c',
- 'atk_test_hypertext.c',
- 'atk_test_image.c',
- 'atk_test_selection.c',
- 'atk_test_state_set.c',
- 'atk_test_table.c',
- 'atk_test_table_cell.c',
- 'atk_test_text.c',
- 'atk_test_value.c',
- ],
- [
- glib_dep,
- atspi_dep,
- xmlloader_dep,
- testutils_dep,
- dummyatk_dep,
- ]
- ],
-
- [
- 'app-test',
- [
- 'test-application.c',
- ],
- [
- glib_dep,
- atk_dep,
- xmlloader_dep,
- testutils_dep,
- dummyatk_dep,
- libatk_bridge_dep,
- ]
- ],
-]
-
-foreach t: tests
- test_name = t[0]
- test_sources = t[1]
- test_deps = t[2]
-
- test_bin = executable(test_name, test_sources,
- dependencies: test_deps,
- include_directories: root_inc,
- c_args: [
- '-DTESTS_BUILD_DIR="@0@"'.format(meson.current_build_dir()),
- '-DTESTS_SRC_DIR="@0@"'.format(meson.current_source_dir()),
- '-DTESTS_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
- ])
-
- if test_name == 'atk-test'
- atk_test_bin = test_bin
- endif
-endforeach
-
-test('atk-test', atk_test_bin, timeout: 120)
+++ /dev/null
-/*
- * 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.
- */
-
-/*
- * Testing AT-SPI requires both a test application and AT client.
- * Test applications are built using the Dummy ATK implementation: MyAtk.
- * This file contains the entry point for all test applications.
- * The test will provide its own implementation of atk_get_root,
- * and as such provide all the application state for the test.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <atk/atk.h>
-#include <atk-bridge.h>
-#include "my-atk.h"
-#include "atk-object-xml-loader.h"
-
-static AtkObject *root_accessible;
-
-static GMainLoop *mainloop;
-
-static gchar *tdata_path = NULL;
-
-void
-test_init (gchar *path)
-{
- gchar *td;
-
- if (path == NULL) {
- g_print ("No test data file provided\n");
- exit (EXIT_FAILURE);
- }
- tdata_path = path;
-
- td = g_build_path (G_DIR_SEPARATOR_S, tdata_path, NULL, NULL);
- root_accessible = ATK_OBJECT (atk_object_xml_parse (td));
- g_free (td);
-}
-
-AtkObject *
-test_get_root (void)
-{
- return root_accessible;
-}
-
-static AtkObject *
-get_root (void)
-{
- return test_get_root ();
-}
-
-const gchar *
-get_toolkit_name (void)
-{
- return strdup ("atspitesting-toolkit");
-}
-
-static void
-setup_atk_util (void)
-{
- AtkUtilClass *klass;
-
- klass = g_type_class_ref (ATK_TYPE_UTIL);
- klass->get_root = get_root;
- klass->get_toolkit_name = get_toolkit_name;
- g_type_class_unref (klass);
-}
-
-static GOptionEntry optentries[] = {
- {"test-data-file", 0, 0, G_OPTION_ARG_STRING, &tdata_path, "Path to file of test data", NULL},
- {NULL}
-};
-
-int main (int argc, char *argv[])
-{
- GOptionContext *opt;
- GError *err = NULL;
- opt = g_option_context_new (NULL);
- g_option_context_add_main_entries (opt, optentries, NULL);
- g_option_context_set_ignore_unknown_options (opt, TRUE);
-
- if (!g_option_context_parse (opt, &argc, &argv, &err))
- g_error("Option parsing failed: %s\n", err->message);
-
- setup_atk_util ();
- test_init (tdata_path);
- atk_bridge_adaptor_init (NULL, NULL);
-
- mainloop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (mainloop);
-
- return 0;
-}