pax_global_header00006660000000000000000000000064125554651710014525gustar00rootroot0000000000000052 comment=45af3ce09477d7e7b0f526677d8cbfccd3fc0c3f java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/000077500000000000000000000000001255546517100176315ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/.gitignore000066400000000000000000000006721255546517100216260ustar00rootroot00000000000000*.o *.a *.lo *.la *.stamp *.bak *.tmp *.class *.gir *.typelib .tm* ~* nbproject/ .idea/ *.iml /autom4te.cache /INSTALL Makefile Makefile.in /aclocal.m4 /config.guess /config.h /config.h.in /config.log /config.status /config.sub /configure /depcomp /gtk-doc.make /install-sh /libtool /ltmain.sh /missing /mkinstalldirs /stamp-h1 jni/src/.libs jni/src/.deps wrapper/org/GNOME/Accessibility/AtkWrapper.java wrapper/java-atk-wrapper.jar /bin java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/AUTHORS000066400000000000000000000004331255546517100207010ustar00rootroot00000000000000Authors: Ke Wang (ke.wang@sun.com) Li Yuan (lee.yuan@oracle.com) Magdalen Berns (m.berns@thismagpie.com) Contains inspiration and possibly a little code from java-access-bridge, written by: Bill Haneman (bill.haneman@sun.com) Louise Miller java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/COPYING.LESSER000066400000000000000000000635011255546517100216650ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/ChangeLog000066400000000000000000000511041255546517100214040ustar00rootroot000000000000002d362db Wrapper: emit object:visible-data-changed signals b7b0017 JNI Remove commented out code f50641c Build: fix unused param warning in Atk init functions 493d3bc JNI: include AtkWrapper.h in AtkWrapper.c 3a467ab Build: include--enable-compile-warning option 6085986 JNI: Create AtkWrapper.h c0a1dc2 JNI: create prototype for access init and shutdown 5ec8c43 JNI/Wrapper remove get_text before/after offset 436034a Wrapper: Create java AtkTextGranularity interface 3d5190f HACKING: remove get_index_at from AtkTable list 626b62d JNI/Wrapper: remove jaw_table_get_index_at f9665d8 JNI: Create jaw_editable_text_set_run_attributes c667c6d Wrapper: Create setRunAttributes in AtkEditableText ead4304 UHACKING: remove AtkValue recommendations 20c4f46 JNI: call AtkValue getIncrement java method 194b59b Build: make with PLATFORM_CFLAGS 03e77fa JNI: fix unused event listener warnings in jaw_util 4cd782c Create jaw_action_get_localized_name & getLocalizedName f66c939 HACKING: remove set_current_value recommendation 56d1017 JNI: replace jaw_set_current_value with jaw_value_set_value 7e023e7 JNI: clean away deprecated implementors dddf8a4 Implement bounds-changed signal in AtkWrapper 56a9829 JNI: create jaw_value_get_range 8ae59cf JNI: minor formatting 2f60526 HACKING: remove get_column_span from AtkTableCell list 20b6f49 JNI Create jaw_table_cell_get_column_span 6c6f8f4 Wrapper: Create getColumnSpan in AtkTableCell 2daa369 HACKING: remove jaw_table_cell_get_row_span 6e0ad07 JNI: Create jaw_table_cell_get_row_span 35c961d Wrapper create getRowSpan in AtkTableCell 55ab1c6 HACKING: remove get_row_column_span 5e76875 JNI: Create jaw_table_cell_get_row_column_span 7279fd1 Wrapper: Create getRowColumnSpan in AtkTableCell faa9f0a HACKING: remove get_position from AtkTableCell list 02f847d JNI: Create jaw_table_cell_get_position a4e84b3 Wrapper: Create getPosition for AtkTableCell a398eb6 JNI: use correct descriptor for getTable methid d192274 Build: remove AC_PROG_RANLIB from configure.ac e3353d7 JNI: remove custom implementation of util listeners 213288b Build: don't use hard path for HOME install 38062ef Build: remove AC_ISC_POSIX from configure.ac f527e3a Release 0.33.2 3272fde Build: set AC_CONFIG_FILES for AC_OUTPUT 07d38bd Build: set JAVA_HOME before setting J path macros d43e0d9 Wrapper: add or remove ColumnSelection return false 37ab55b HACKING: remove set_summary from table list 582547a JNI: Create jaw_table_set_summary f04b199 Wrapper: Create setSummary in AtkTable 410ae8c HACKING: remove set_caption from table list e6b3492 JNI: Create jaw_table_set_caption 519074f Wrapper: Create setCaption in AtkTable f35407a Build: Address warning in autogen.sh dad0250 Update copyright for jawcomponent and AtkComponent 11be3ba JNI: fix java descriptor for set_extents call 7f0e70b JNI: minor formatting in jawtable.c 20d0e86 HACKING: remove set_column_header f3e635a JNI: Create jaw_table_set_column_header c59ceb0 Wrapper: Create setColumnHeader in AtkTable 99171b4 HACKING: remove set_row_header 046bb83 JNI: Create jaw_table_set_row_header 542cba0 Wrapper: Create setRowHeader in AtkTable d4d9dcc HACKING: remove set_column_description d958b3c HACKING: remove set_row_description 4b88e3b Wrapper: Create setColumnDescription in AtkTable f369fb1 JNI: Create jaw_table_set_column_description 0eeb57c Wrapper: Create setRowDescription in AtkTable 8c91d01 JNI: Create jaw_table_set_row_description c907993 Add links to atk table pointers 7b982b2 JNI: fix jawtable style and formatting 9b30dd6 HACKING: remove public ATK methods from text listing cfaa744 HACKING: format link e901dd1 HACKING: add link to wiki page cf9af15 HACKING: remove pointless header addc08c HACKING: Add information on debugging 932bbe8 HACKING: update list of implemented functions 288ee82 Wrapper: Fix for window:destroy events 095603b JNI: window events use g_signal_emit_by_name 1a59e45 Build: remove gcc from AC_PROG_CXX cebb7bc Build: fix configure.ac warning 4915bdd Build: fix AC_PROG_CXX missing macro 0b4386d Build: fix missing AC_PATH_X warning 18028d3 Build: add bug report info to AC_INIT 61e0c85 revert to commit eda0e53 b191b72 Build: fix JAVA_SRC wildcard compiler warning 4078b8c Build: fix DEP_CLASSES wildcard compiler warning eda0e53 Git: Ignore netbeans project files a22f707 gitignore: remove comment 7ee6025 Git: Ignore intellij project files 60a1077 JAR: Add manifest b2fccac Wrapper: add check for WINDOW to get_layer a43cf94 Wrapper: create getDescription in AtkAction 62fd94a JNI: Create jaw_action_set_description 2167afc JNI: Create jaw_object_ref_child ef1d041 JNI: Minor formatting improvement fe3cbcf JNI: Create jaw_object_ref_relation_set 510067e Wrapper: Use checked operations 3c73d3a JNI: Create jaw_impl_get_object_hash_table b6ffbf7 JNI: Fix unused warning in jaw_object_set_role 038384c JNI: fix unused variable warning in set_parent 227ec21 JNI: Fix unused variable warning in jaw_object_get_parent 2efa160 Release 0.33.1 35caeed Build: Use PLATFORM_LDFLAGS 4ed46b8 Build: tidy up root check 462d16d Build: fix unrecognised warning 75ffc2f Build: Remove unsused b0eba07 Build: do not repeat autoreconf check 56fde82 Implement AtkTableCell interface wrapper class 73b1a69 JNI: Create jaw_object_get_object_locale 5f583c6 Build: Add darwin includes be87bd1 JNI check g_object is not null before ref 6a9f8d6 Build: fix duplicate symbol error a522e2e JNI: create jaw_object_set_role 014f829 JNI: create jaw_object_set_parent d6dc33c JNI: create jaw_object_set_description 5e166eb JNI: Create jaw_object_set_name 703b05d JNI: create jaw_object_get_parent for JawObject 6ee2e71 JNI: Create jaw_object_initialize e745cae Maintainership: update bugzilla info d7468d5 Wrapper: Remove unnecessary java print statements 15efe67 Build: include $JDK_SRC/include/$host_os fb1b616 Create JawTableCellIface and AtkTableCell 81d962a JNI: create jaw_table_add_column_selection 6764dbb Build: fix root build configuration 573d850 Build: fix non-root install configuration f7746cb JNI: create jaw_table_add_row_selection da1612d JNI: Create jaw_window_add_signal function f15e0ad Revert to d53bd87 8733331 JNI: Fix JRE error when running java apps b1b75e8 JNI: Create JAW_TYPE_WINDOW dc471c4 Wrapper: fix bug in AtkWindow 85683e9 HACKING: update JawWindowIface signals info e234b6b Create jaw_table_cell_get_position 08a8116 HACKING: update list of unimplemented functions 75a675c Create JawTableCellIface and AtkTableCell 833638c JNI: fix crash when turning orca off 7a745c7 JNI: Do not set windows signals explicitly 1583a0b Maintainership: update bugzilla info 3133c34 JNI check g_object is not null before ref 1436754 JNI: create jaw_table_add_column_selection 7453f5b JNI: create jaw_table_add_row_selection d6345cb Wrapper: emit visible-data-changed signals 82f32ce Build: fix root build configuration e2f3680 Wrapper: add check for WINDOW to get_layer cca0fff JNI: Remove jawwindow.h include from jawimpl 383c469 JNI: remove need for jawwindow.h b4353ae JNI: remove jaw_object_state_change 3cb0b94 JNI: Create jaw_object_get_object_locale e7faa8e JNI: Init windows iface via impl & util 00ac829 JNI: remove atk-bridge include from jawobject.h 3378dd4 JNI: create jaw_object_set_role c97520e JNI: create jaw_object_peek_parent 68e1414 JNI: Remove unused from JawObject dbda22b JNI: create jaw_object_set_parent d24df6e JNI: create jaw_object_set_description 54dcfc6 JNI: Create jaw_object_set_name eaed794 JNI: Create jaw_impl_get_atk_relation_type_from_java_key a3d1600 JNI: create jaw_object_ref_relation_set 317befb JNI: create jaw_object_ref_child c3f1bd4 JNI: Create jaw_object_notify_state_change 77d3997 JNI: create jaw_object_get_parent for JawObject 7ec03a7 JNI: Create jaw_object_initialize 75147c0 Build: fix non-root install configuration d7b1980 Build: fix duplicate symbol error 0b5c3e9 Build: Add darwin includes e2d096f Build: Add JNI_INCLUDES after CHECK_JNI 23c01fa Build: remove unused 20668ec JNI: remove unneeded string.h include c15eee6 Build: include $JDK_SRC/include/$host_os cf4927a JNI: Create JawWindow for AtkWindow signals d53bd87 JNI: return with G_SOURCE_REMOVE 9b54bfe JNI: Initialise variables before using 4339b8b JNI: Use gdk_threads_add_idle() instead of g_idle_add() 3b9ec7f JNI: Remove gtk thread functions b6fd368 Remove autogenerated files a14a35e GConf is not needed; remove it as a requirement 59a10ad Release 0.33.0 c26046a JNI: GINT_TO_POINTER cast for g_hash_table_lookup arg 5f1dfcb JNI: create NewGlobalRef for gdk threads 236b9dd JNI: fix crash on java applications 5218010 JNI: fix jawimpl type error 2a6dd6c JNI: only show warnings with JAW_DEBUG=1 62edb07 JNI: remove data message 0067a0e Call gtk threads only once 3595f83 Release 0.32.92 ebcf2ff JNI: return JNI_ERR if JNI is NULL f65ebb7 JNI: Format jawaction 340d6a5 Wrapper: Don't set bounds in set_extents 6fce7ec JNI: Add NULL check before referencing gobjects da3b29a JNI: Use guint type not gint 36b3a4a JNI: Make use of dispatch constants 86f5eb2 JNI: get_instance with component_removed_handler 4061ce5 JNI: get instance in window_deactivate_handler fd00cca JNI find instance for object_state_change_handler 01abf43 HACKING: Add some convention and style info 74b7d96 JNI: organise some debug b4f4b5e JNI: Use consistent debug messages 88ee903 JNI use IIII for method argument 5f7d020 HACKING: remove unimplemented deprecated functions 08c4311 JNI: implement DetachCurrentThread function 399eb9b JNI-Wrapper: remove get_size and get_position 0fc6221 Wrapper: remove state ARMED condition 443947d Revert "Wrapper: remove state ARMED condition" 82d3351 Wrapper: remove state ARMED condition 795a04e Wrapper: minor formatting 3b71e11 Wrapper: Minor formatting improvement d625c15 Build: Set 1.6 as minimum java version bca842b HACKING: describe state of object class f4db2a6 JNI: improve formatting of jawtext 1cfd5ba JNI: format jawutil style 2d20481 JNI: fix casting warning 39a672b uncomment gtk_threads functions 372a884 Wrapper: Add documentation and formatting 50e2b59 Wrapper: Add isTopLevel static method cbdd3d2 Release 0.32.90 e5c1782 JNI: get name before checking for COMBO BOX 5ee3b8b update copyright 67f7912 dispatch radio, push toggle button events b4016fa AUTHORS: Add Magdalen Berns abcd681 Release 0.32.3 1937e99 Atwrapper add debugging to signals acfc165 AtkWrapper: warn if handler object is NULL 69d1dba Return JNI_OK for jboolean function 1702923 Add debug messages for global_ac == NULL 02cac3d use global_ac not lock in get/find instance 3bf09c9 Fix some debug inconsistencies 78f59a8 set_extents Rectangle width and height c8e4b30 Update object roles to include missing roles 1f3387b Check minimum version of atk and spi is installed c11a4dd use defined top level klass f06a2dd fix implicit function warning for g_sprintf 14e24c0 Fix post initialization lock up 48a3008 Fix debug message fbce3dd cache JVM onLoad so env attaches current thread 079f7cc return JNI_VERSION_1_6 15ed5a7 Use (GInstanceInitFunc) NULL 93ce3ec jawutil: include string header for strcmp use 5c7a112 Replace G_CONST_RETURN with const 6e7a344 AtkWrapper print exception stack traces 5bf850a FIX SIGEV fatal error 15a15ac fix jfieldID in get_extents a3b5c20 Merge branch 'old' into amend 5258611 set x y extents for both WINDOW and SCREEN ffed314 The set extents method only sets points x and y when AtkCoordType.SCREEN returns true. It is necessary to set them for AtkCoordType.WINDOW too. 8e0952c AtkWrapper: Remove hard-coded handler values 7da1a77 fixes for get and set extent methods 1f77888 Directly initialise accessibility 6a3f1b6 fix imcompatable pointer w in set_extents 78d0c91 fatal error when executing java programs 73d21e8 Check if g_module_supported 2969474 Add AM_SILENT_RULES([yes]) 69c586f Add autoconf check to autogen.sh 86a937b initialise using gnome_accessibility_module_init 1e55ab4 Fix mutex and cond initialisation 70ec322 remove return from jaw_component_get_extents 71108e2 Add additional dependencies 6bdf1ec AtkWrapper: implement g_cond_wait fa48f1b AtkWrapper: FIX hang on g_cond thread wait c5fadf7 Fix g_mutex and g_cond update syntax 5235f35 Revert "Fix g_mutex and g_cond update syntax" e769736 Fix g_mutex and g_cond update syntax 49d93f3 Init atk_bridge_adaptor in a standard way 31c5fa3 remove workaround for non root installs 781f1d2 Revert "remove workaround for non root installs" 3e7ce33 remove workaround for non root installs f955ce6 LDFLAGS Use proper version info syntax c1cc147 check if AM_PROG_AR is defined 1c7eab0 Add -rpath flag to LDFLAGS a3d7805 Add dependency on atk-bridge-2.0 35e8780 Add AC_SUBST(JAW_LIBS) ce57131 Don't use $JAVACFLAGS when setting JDK_SRC 8b48abf Add JDK_SRC to Build configuration e7e1fd6 put lt version info first in LDFLAGS 96e32ab Release 0.32.2 e80a1fc Revert "make: add top_srcdir and topsrcdir/wrapper to CFLAGS" 44a7330 make: add top_srcdir and topsrcdir/wrapper to CFLAGS a964d9d Build: set propertiesdir & java_atk_wrapperdir 347c21b jawimpl: initialise with compatible pointer type 853eac9 jawutil: tidy up style 35ae4b3 Fix symbol lookup error jaw_misc_type d6f8257 Release 0.32.1 2a738f7 NEWS add contributors info 8f76c73 AtkKeyEvent: remove reduntant cast to string f36a292 Component: remove return from get_extents 95495dc Component: set_extents returns gboolean b4f4c5f Release 0.32.0 045d08d HACKING: don't list get_minimum_increment 485a055 jawvalue: use consistent style 73c6573 Component: make use of instance methods c1e5271 AtkComponent: use consistent style d280772 HACKING: update Component interface info ec6e998 Component: Implement get and set extents 6c16482 jawcomponent: Remove focus_handler inits ca0c383 jawcomponent: FIX Incompatible pointer type error 922278a jawcomponent: fix formatting 248d86e HACKING add list of deprecated functions 10f6e7f HACKING: remove listed deprecated functions 06b089f jawtoplevel: sort out formatting 1e2d6e9 jawobject: sort out formatting d26fa5b HACKING: add detail about Windows interface d963473 HACKING: list unimplemented methods 078b736 HACKING Update with info dd797f7 Remove TODO file c7b0b5c AtkWrapper: Use g_cond_init dd3e623 AtkWrapper: use g_mutex_init 6654ea4 jawimpl.c: use g_mutex_init c8bd727 jawtext.c: improve formatting fb96ed7 jawtext: remove commented out code ff5fb2a jawtext: fix formatting 3ef5c47 jaweditabletext: fix formatting 53d40c0 FIX: assignment makes pointer from integer without a cast 4c97514 jawimpl.c: fix formatting 46e10e7 AtkObject for add_relationship third argument ebe7faf jaweditabletext: formating 074ab3b use atexit from stdlib 603f6bc AtkEditableText: fix formatting c9e4655 AtkWrapper: format spaces 72d5cad Notify when object gets focus 52d9505 update to jaw_value_get_increment e3dc525 Fix integer casting for AtkWrapper and jawimpl e00a9b5 unlock value from pointer e422818 remove references to atkmisc interface fc7c2b4 use atk_object_notify_state_change 8e772e2 Use atk_value_get_value_and_text f72b893 use g_value_set_schar #2 3ff3062 use g_value_set_schar a2e6a89 Warn for deprecated declarations ead5288 make atk-bridge available but do not use 2eb4049 remove g_thread_init() c41bfb3 Remove repeated code logic 471fcac remove g_type_init d5da1d0 make JNI Version check conditional 7e42ab0 Style: tabs for spaces 97df649 FIX incompatible implicit declaration warning cbbbb4e Release 0.31.0 b35e4bb set wrapperdir and propertiesdir to prefix 4a6a042 Set wrapperdir and propertiesdir correctly 3f3802e configure.ac: use current directory d23876a configure.ac: print useful build config info c295dab configure.ac: Specify minimum versions for building 11716b3 Remove fileSeperator object 00ba127 Set JAW_CFLAGS includes e17ebb4 FIX 'install-libLTLIBRARIES' failed: error 6ffafb0 Release 0.30.9 0c9436f Set JAVA_HOME properly a367c71 fix invalid flag d617870 Revert "Specify JAVA_HOME" 390cd63 Specify JAVA_HOME 4953364 remove repeated code 3400113 Allow writing of JavaInfo.class during distcheck 8a6aacb Remove directory cd into cwd (pointless) 6d3008f Style: replace tabs for spaces and format a bit 2c0d5b5 configure.ac: remove quotation marks 4e4c6e4 Change JRE_SRC back to JAVA_HOME e4e4c89 AtkWrapper: replace tabs for spaces 0aba5b1 configure.ac: change tabs to spaces 5bf3e3c configure: add check-news to AM_INIT_AUTOMAKE a288c8d ATKWrapper: fix b660968 mistake breaking build 4c33d87 jawaction: style improvements a266328 Atktext: style improvements b660968 fix typo 1f94187 Remove whitespace 18605ee Release 0.30.8 c8a2bdf atkwrapper: fix style and indentation bf9919f AtkKeyEvent: Use checked operations 3273d5c AtkKeyEvent.java: fix indentation 77fdaf8 Add $(srcdir)/*.java to EXTRA_DIST 7cca5a9 autogen.sh: less is more, tidy up 0601b23 autogen.sh: use unary operators 23c8ddd autogen.sh: fix indentation 63ec920 Update autogen.sh 78aa7ac HACKING: Update maintainer contact details 636f2d8 Release 0.30.7 833088d Makefile: add ${ACLOCAL_FLAGS} to ACLOCAL_FLAGS 3694129 Release 0.30.6 463d156 Change JAVA_HOME to JRE_SRC 85e8f03 Change JDK_HOME to JDK_SRC 6526797 Fix "unary operator expected" error f5dddbf DOAP: Add Magdalen Berns as maintainer ce8cd55 Release 0.30.5 3b22e56 Use -avoid-version only when target_os is cygwin dca347d doap: Remove Ke Wang from current maintainer list 624cdcd Add JAVACFLAGS option for build ff0d85c Adding initial .gitignore file 3645e6d Updated .doap file 33ff588 Fix Compilation errors 5b0b399 Fix bug616693: emit both the visible and showing events for combo box Signed-off-by: Leon Fan f4fb386 Added Li Yuan as maintainer 0d30f00 Use AT_SPI_IOR and AT_SPI_BUS instead of GConf key to check enablement of accessibility bbf30ec Portability fixes for libatk-wrapper 209e429 Use GTK_PATH to locate libatk-bridge.so 0d4bc3e Fix bug 611256 - atk_text_get_text is not working correctly with the specified end offset 08912f6 Release 0.29.5 5dcad0c Fix critical typo - should set NO_AT_BRIDGE to 0 instead of 1 in loadAtkBridge e7fc242 Fix tarball version 0965c28 Release 0.29.4 f78a65a Disable ATK Bridge before we load it to prevent it from being loaded by GTK laf first 6394303 Fix regression - confilct with GTK look and feel 919717d Release 0.29.3 44021c6 Add non-alphanumeric key mapping 11e2da7 Release 0.29.2 1684769 Add JAW_DEBUG - Set environment JAW_DEBUG=1 to get debug messages e448592 Fixed bug 606402 - Attempting to run swing applications with the JAW installed frequently causes the JRE to report a fatal runtime error 201572a Release 0.29.1 d4961d7 Add D-Bus support 7a490f1 Release 0.28.0 242478a Fixed bug 595234 - The caret position will not be changed when input text with gok composer def8b17 Fixed bug 591792 - Java application tooltips are not accessible to orca screen reader 81d7377 Release 0.27.8 fd325d7 Fixed bug 593261 - Slider bar can not be controled by gok 4ebe072 Fixed bug 592987 - Java Combobox is not accessible d21dd7e Replace jaw_impl_find_instance with jaw_impl_get_instance when handling active-descendant-changed signal a16cb15 Force Java app to quit before the invocation of exit func registered by ATK bridge dd9470a Comment out signal of visible-data-changed 9adf3bb Update version number 5e734e9 Release 0.27.7 4b7a067 Fixed bug that window events are not emitted(bug 591665,591670) 0d78630 Temporarily commentted window_state_change_handler 4aecdea Fixed d.o.o bug 10506 - java webstart applications don't run 4ab98ec Release 0.27.6 06b4fc5 Add dependency on GDK 2.0 f64c0da Solved conflict with the GTK Look And Feel 6520ebc Add missed JavaInfo.java 827fef2 Release 0.27.5 4db73b0 Added JDK_HOME auto-detection ce7a420 Fixed GNOME bugzilla bug 588879 2a8711c Release 0.27.4 e1e0a0c Remove jni_AtkWrapper.h from Makefile.am c1e1ecd Make JAVA_HOME not mandatory 9454375 Remove unused jni_AtkWrapper.h e28b69e Remove JavaInfo.java 79fcf62 Remove functionality of JAVA_HOME auto-detection 8b4fbfe Remove unused code cc4a4fb Fixed build problem of loop variables outside C99 mode c45e0fe Release 0.27.3 393c280 Add AtkWrapper.java.in to EXTRA_DIST b879b41 Use xprop instead of gconftool-2 to check whether accessibility technology is on 88222cc remove dependency on gtk+-2.0 9994e26 add JavaInfo.java to EXTRA_DIST a501731 Revert "Revert "Add method to auto-detect JAVA_HOME"" 1ee8062 Revert "Add method to auto-detect JAVA_HOME" 6cd94a8 Add method to auto-detect JAVA_HOME a791d03 Added code to determine whether to load 32 or 64-bit version of atk-bridge 9c146a1 Fixed a dependency problem 21c8275 Added code to get more accurate application name 5e2905b Added code to check whether accessibility technology is switched on 6a16496 Fixed conflict with GTK look and feel 32fc338 Fixed build dependency problem b9f6ab8 Update version number 57f226d Release 0.27.2 290213a Changes for preparation of initial release 2fb5d01 Minor changes to configure.in ac239b4 Minor changes for tarball distribution 9dafdb4 Add version argument to AC_INIT 0f14bcb Change license from LGPLv3 to LGPLv2.1 3363fd8 trivial changes to configure.in 13d1b78 Added .doap file 9e2f1dd Remove the need of empty directory "build-aux". 7590187 Initial commit. java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/HACKING000066400000000000000000000045111255546517100206210ustar00rootroot00000000000000Hacking Guide for Java ATK Wrapper ================================== As a general rule, non-trivial maintainer-submitted patches should be posted to gnome-accessibility-devel for comment and informational purpose prior to commit. Patches are welcome and if there are any suggestions, please send comments directly to the current maintainer, Magdalen Berns m.berns@thismagpie.com and make sure to cc the gnome-accessibility-devel list too. To file a bug against java-atk-wrapper: 1. go to 2. select java-atk-wrapper from the component list 3. file bug using a descriptive subject title 4. Wait for maintainer to accept bug or upload a patch to your bug for review More information on Java ATK Wrapper can be found at: Methods Not Yet Fully Implemented --------------------------------- Document Interface (not yet implemented): get_current_page_number get_page_count HyperlinkImpl: TODO Currently Not fully documented by ATK # NOTE: Window interface signals currently seems to be being handled in jawobject.c Object base class: AtkFunction implementor_ref_accessible get_attributes TableCell: get_column_header_cells get_row_header_cells Deprecated Methods Which Are Implemented ---------------------------------------- Table Interface: get_column_at_index get_row_at_index Text Interface: get_text_after_offset - use get_string_at_offset instead get_text_at_offset - use get_string_at_offset instead get_text_before_offset - use get_string_at_offset instead Conventions for Writing Java ATK Wrapper Code --------------------------------------------- Spaces instead of tabs. Two spaces per indent. JNI warning and error messages are in the form: if (jaw_debug) g_warning("method calling instance: instance == NULL"); These statements will only print if the environment variable JAW_DEBUG is set to 1. To use this setting type the following into the terminal or set it in ~/.bashrc: export JAW_DEBUG=1 Other Things to Keep in Mind ---------------------------- The jint object is mapped to C's long which is always at least 32 bits), instead of of C's int (which could be 16 bits). The resource for glib types can be found at java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/JavaInfo.java000066400000000000000000000004531255546517100221730ustar00rootroot00000000000000public class JavaInfo { public JavaInfo() { String strHome = System.getProperty("java.home"); if (strHome.endsWith( "/" + "jre" )) { strHome = strHome.substring(0, strHome.length()-4); } System.out.println(strHome); } public static void main(String args[]) { new JavaInfo(); } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/Makefile.am000066400000000000000000000001301255546517100216570ustar00rootroot00000000000000SUBDIRS=jni wrapper EXTRA_DIST = JavaInfo.java ACLOCAL_AMFLAGS=-I m4 ${ACLOCAL_FLAGS} java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/NEWS000066400000000000000000000400511255546517100203300ustar00rootroot00000000000000Changes in version 0.33.3 ========================= Build: 752590: Include --enable-compile-warning option 752350: Make with PLATFORM_CFLAGS 752095: Remove AC_PROG_RANLIB and AC_ISC_POSIX from configure.ac 750533: Don't use hard path for HOME install JNI: 752588: Create AtkWrapper.h and include in AtkWrapper.c 751997: Create prototype for access init and shutdown 740439: Create jaw_editable_text_set_run_attributes 752334: remove jaw_table_get_index_at 740542: Create jaw_action_get_localized_name 752291: Replace jaw_set_current_value with jaw_value_set_value 742499: Implement bounds-changed signal in AtkWrapper 752236: Create jaw_value_get_range 752190: Create jaw_table_cell_get_column_span 752188: Create jaw_table_cell_get_row_span 752187: Create jaw_table_cell_get_row_column_span 752174: Create jaw_table_cell_get_position 751267: BUGFIX: remove custom implementation of util listeners 752346: Fix unused event listener warnings in jaw_util Wrapper: 750937: Emit object:visible-data-changed signals 752319: Create java AtkTextGranularity interface 740439: Create setRunAttributes in AtkEditableText 740542: Create getLocalizedName in AtkAction 752190: Create getColumnSpan in AtkTableCell 752188: Create getRowSpan in AtkTableCell 752187: Create getRowColumnSpan in AtkTableCell 752174: Create getPosition for AtkTableCell Maintainership: Update HACKING Contributors: Magdalen Berns Changes in version 0.33.2 ========================= Build: 752060: Set AC_CONFIG_FILES for AC_OUTPUT 752038: Set JAVA_HOME before setting JA* path macros 751958: Fix warning in autogen.sh 751762: Fix AC_PROG_CXX missing macro warning 751671: Add manifest to jar JNI: 751997: Create jaw_table_set_summary 751995: Create jaw_table_set_caption 751938: Create jaw_table_set_column_header 751937: Create jaw_table_set_row_header 751897: Create jaw_table_set_column_description 751895: Create jaw_table_set_row_description 740543: Create jaw_action_set_description 750640: Create jaw_object_ref_child 750641: Create jaw_object_ref_relation_set 751441: Fix unused warnings 751951: Fix java descriptor for set_extents call 751183: window events use g_signal_emit_by_name Create jaw_impl_get_object_hash_table Wrapper: 751997: Create setSummary in AtkTable 751995: Create setCaption in AtkTable 751938: Create setColumnHeader in AtkTable 751937: Create setRowHeader in AtkTable 751897: Create setColumnDescription in AtkTable 751895: Create setRowDescription in AtkTable 740543: Create getDescription in AtkAction 751837: Fix window:destroy events 750934: add check for WINDOW to get_layer 739503: Use checked operations Maintainership: Update copyright for jawcomponent and AtkComponent 751758: Add bug report info to AC_INIT 751673: gitignore netbeans and intellij IDE project files 740534: update HACKING Contributors: Magdalen Berns Changes in version 0.33.1 ========================= Build: 751396: Use PLATFORM_LDFLAGS 751351: Fix unrecognised warning in AM_INIT_AUTOMAKE 751325: GModule is not needed; remove it as a requirement 751325: Donot repeat autoreconf check in autogen.sh 750521 Fix duplicate symbol error 750501: Add darwin includes for installations on OSX 750533: Fix non-root install failure 750501: Set JNI_INCLUDES for linux and add after CHECK_JNI Remove autogenerated files GConf is not needed; remove it as a requirement JNI: 750786: Create jaw_object_get_object_locale 751009: Check g_object is not null before ref 750716: Create jaw_object_set_role 750649: Create jaw_object_set_description 750655: Create jaw_object_set_parent 750647: Create jaw_object_set_name 750620: Create jaw_object_get_parent 750589: Create jaw_object_initialize 751008: Create jaw_table_add_column_selection 750998: Create jaw_table_add_row_selection 751281: Create jaw_window_add_signal 751159: Fix JRE error when running java apps 750461: Set signal handler returns to G_SOURCE_REMOVE 750425: Initialise variables before using them 750417: Use gdk_threads_add_idle() instead of g_idle_add() 750417: Remove gtk thread functions Wrapper: 751111: Implement AtkTableCell interface wrapper class 751286: Remove unnecessary print statements Maintainership: Update bugzilla info Contributors: Magdalen Berns Federico Mena Quintero Changes in version 0.33.0 ========================= Miscellanous: 750295 JNI: create NewGlobalRef for gdk threads 698095 JNI: FIX crash on java applications JNI: GINT_TO_POINTER cast for g_hash_table_lookup arg 745823 JNI: fix jawimpl type error 749926 JNI: Remove data from debug message 749392 JNI: Call gtk threads only once Maintainership: 749927 JNI: only show warnings with JAW_DEBUG=1 Contributors: Magdalen Berns Changes in version 0.32.92 ========================= Build: Set 1.6 as minimum java version Miscellanous: JNI: return JNI_ERR if JNI is NULL Wrapper: Don't set bounds in set_extents JNI: Add NULL check before referencing gobjects JNI: Use guint type not gint JNI: Make use of dispatch constants JNI: get_instance with component_removed_handler JNI: get instance in window_deactivate_handler JNI: find instance for object_state_change_handler JNI use IIII for method argument JNI-Wrapper: remove get_size and get_position Wrapper: remove state ARMED condition JNI: fix casting warning Wrapper: Add isTopLevel static method Maintainership: uncomment gtk_threads functions Wrapper: Add documentation and formatting JNI: format jawutil and jawaction JNI: Use consistent debug messages HACKING: Add some object info and update Contributors: Magdalen Berns Changes in version 0.32.90 ========================= Important Changes: JNI: get name before checking for COMBO BOX JNI: dispatch radio, push toggle button events Maintainership: Update Authors Contributors: Magdalen Berns Changes in version 0.32.3 ========================= Build: Use JNI_VERSION_1_6 LDFLAGS Use proper version info syntax check if AM_PROG_AR is defined Add -rpath flag to LDFLAGS Add dependency on atk-bridge-2.0 Add AC_SUBST(JAW_LIBS) Don't use $JAVACFLAGS when setting JDK_SRC Add JDK_SRC to Build configuration put lt version info first in LDFLAGS Check minimum version of atk and spi is installed Add AM_SILENT_RULES([yes]) Miscellanous: Directly initialise accessibility rather than load via gtk module jawutil: include string header for strcmp use Replace G_CONST_RETURN with const Print exception stack traces FIX SIGEV fatal error fix jfieldID in get_extents Merge branch 'old' into amend set x y extents for both WINDOW and SCREEN Use defined top level klass AtkWrapper: Remove hard-coded handler values Rectangle width and height for set_extents Replace G_CONST_RETURN with const FIX incompatable pointer FIX g_cond lockup Maintainership: Add various g_debug messages, warnings and erros for JAW_DEBUG=1 Contributors: Magdalen Berns Changes in version 0.32.2 ========================= Miscellanious: 741127: set propertiesdir & java_atk_wrapperdir 741073: initialise with compatible pointer type jawimpl 741062: Fix symbol lookup error jaw_misc_type Contributors: 741068: Tidy up style Magdalen Berns in jawutil Contributors: Magdalen Berns Changes in version 0.32.1 ========================= Miscellanious: 740644 jawvalue.c has no style 740649 Component: set_extents return gboolean 740650 Component: get_extents should not return anything. 740653 Remove Reundant cast to String Contributors: Magdalen Berns Changes in version 0.32.0 ========================= Build: 740286 FIX Warning in jaw_hypertext_get_link 740428 FIX Assignment makes pointer from integer without a cast 740589 Fix Incompatible pointer type error 740269 Do not used deprecated 'g_atexit' 740172 Do not use deprecated 'atk_focus_tracker_notify' 740270 Do not use deprecated 'g_mutex_new' 740271 Do not use deprecated 'g_cond_new' 740278 Do not use deprecated 'atk_misc_get_type' 740279 FIX cast to pointer from integer of different size 740280 FIX passing incompatible pointer type 740281 Do not use deprecated 'g_value_set_char' 740459 do not use deprecated 'g_mutex_new' in jawimpl.c Miscellanous: 740644 jawvalue.c style 740584 jawcomponent.c style 740548 jawobject.c style 740550 jawtoplevel.c style 740602 AtkComponent.java is not making use of instance methods 740590 remove deprecated and unimplemented focus handler methods 740437 jaweditabletext.c style 740445 jawtext.c style 740449 jawtext.c removed commented out code 740450 jawtext.c style further improved Maintainership: 740534 HACKING Update 740535 Remove TODO file 740539 HACKING Should list methods not yet fully implemented 740580 HACKING lists some deprecated functions 740581 HACKING should list deprecated functions which are implemented 740598 HACKING do not list unimplemented deprecated functions 740307 added java-atk-wrapper as a jhbuild module Contributors: Magdalen Berns Changes in version 0.31.0 ========================= Build: 739912: Set JAVA_HOME 739976: Fix 'install-libLTLIBRARIES' failed error 740062: set wrapperdir and propertiesdir to prefix Set wrapperdir and propertiesdir correctly Set JAW_CFLAGS includes configure.ac: use current working directory Specify minimum versions for building Miscellanous: Remove fileSeperator object print useful build config info Specify JAVA_HOME Changes in version 0.30.9 ========================= Build: Bug 739909: Allow writing of JavaInfo.class during distcheck Bug 739912: Set JAVA_HOME properly Fix invalid flag Remove directory cd into cwd configure: add check-news to AM_INIT_AUTOMAKE configure.ac: remove quotation marks fix b660968 mistake breaking build Miscellanous: Replace tabs for spaces and format a bit Change JRE_SRC back to JAVA_HOME change tabs to spaces jawaction: style improvements Atktext: style improvements fix typo Remove whitespace Mantainership: Close 9 obsolete Bugs Contributors: Magdalen Berns Changes in version 0.30.8 ========================= Build: Bug 739427: USE_GNOME2_MACROS=1 seems redundant => update autogen.sh Bug 739503: AtkKeyEvent: Use checked operations Add $(srcdir)/*.java to EXTRA_DIST autogen.sh: use unary operators Miscellanous: Atkwrapper: fix style and indentation AtkKeyEvent: fix indentation autogen.sh: less is more, tidy up Mantainership: HACKING: Update maintainer contact details Contributors: Magdalen Berns, Alejandro Pi�eiro Changes in version 0.30.7 ========================= Build: Bug 738776: Add ${ACLOCAL_FLAGS} to ACLOCAL_AMFLAGS Mantainership: Added ChangeLog with full git commit history included Contributors: Magdalen Berns Changes in version 0.30.6 ========================= Build: Bug 738721: Fix "unary operator expected" error Mantainership: 738709 Updated doap file (current active maintainers) Miscellanous: 738730 Change JDK_HOME to JDK_SRC 738731 Change JAVA_HOME to JRE_SRC Contributors: Magdalen Berns Changes in version 0.30.5 ========================= Maintainer note: while doing this release, we detected that the version bump on each release was not included on the master branch. So most of the 0.30.X JAW versions available were not reflected on master, but only on the branch gnome-2-30. In that sense, the versioning of this module was more updated on a specific branch that on master. This was against the usual GNOME policies, and in general, for any free software project using git as repository. So, from now on, the usual policy would be used, summarized as: * master will include also the version bumping. * specific branches will be used for developing new features or to keep track of stable branches Additionally, this NEWS entry will include all the changes since 0.29.5., beind those: * * Atk wrapping: * Bug 616693: emit both the visible and showing events for combo box * Bug 611256 - atk_text_get_text is not working correctly with the specified end offset * Building: * Add JAVACFLAGS option for build * Bug 703358 - java-atk-wrapper can't be re-automake with automake 1.13 * Use -avoid-version only when target_os is cygwin * Mantainership: * Updated doap file, both in format [1] and in content (current active maintainers) * Updated AUTHORS and MAINTAINERS files accordingly * Miscellanea * Use GTK_PATH to locate libatk-bridge.so * Use AT_SPI_IOR and AT_SPI_BUS instead of GConf key to check enablement of accessibility * Adding initial .gitignore file [1] https://mail.gnome.org/archives/release-team/2014-July/msg00045.html Contributors: Magdalen Berns, Leon Fan, James Page, Alejandro Pi�eiro, Yaakov Selkowitz, Ke Wang, =============================== Java ATK Wrapper version 0.29.5 Important changes: * Fix critical typo - should set NO_AT_BRIDGE to 0 instead of 1 in loadAtkBridge =============================== Java ATK Wrapper version 0.29.4 Important changes: * Fix regression - conflict with GTK look and feel =============================== Java ATK Wrapper version 0.29.3 Important changes: * Add non-alphanumeric key mapping =============================== Java ATK Wrapper version 0.29.2 Important changes: * Fixed bug 606402 - Attempting to run swing applications with the JAW installed frequently causes the JRE to report a fatal runtime error * Add JAW_DEBUG - Set environment JAW_DEBUG=1 to get debug messages =============================== Java ATK Wrapper version 0.29.1 Important changes: * Added support for at-spi2(at-spi d-bus) =============================== Java ATK Wrapper version 0.28.0 Important changes: * Fixed bug 591792 - Java application tooltips are not accessible to orca screen reader * Fixed bug 595234 - The caret position will not be changed when input text with gok composer Java ATK Wrapper version 0.27.8 =============================== Important changes: * Fixed 592987 - Java Combobox is not accessible * Fixed 593130 - JTree is not accessible to at-tools * Fixed 593258 - Table cell accessing issue * Fixed 593131 - Java application hangs when exiting from exit menuitem with orca running * Fixed 593250 - Alt+F4 sometime leads to application hang * Fixed 593261 - Slider bar can not be controled by gok Java ATK Wrapper version 0.27.7 =============================== Important changes: * Fixed d.o.o bug 10506 - java webstart applications don't run * Fixed bug that window events are not emitted(bug 591665,591670) Java ATK Wrapper version 0.27.6 =============================== Important changes: * Changed the method to resolve conflict with GTK Look And Feel. Now JAW can work with GTK l&f enabled. Java ATK Wrapper version 0.27.5 =============================== Important changes: * Fixed bug 588879 - JVM crash when selecting text demo of SwingSet * Added functionality of JDK_HOME auto-detection Java ATK Wrapper version 0.27.4 =============================== Important changes: * Fixed bug that class files of internal classes are not packed into jar file * Fixed build problem of loop variables outside C99 mode * Removed functionality of JAVA_HOME auto-detection Java ATK Wrapper version 0.27.3 =============================== Important changes: * Fixed several problems in build system. * Resolved conflict with GTK look and feel. * Added code to check whether accessibility technology is switched on * Added code to get more accurate application name * Added code to determine whether to load 32 or 64-bit version of atk-bridge * Added functionality to auto-detect JAVA_HOME * Removed dependency on gtk+-2.0 Java ATK Wrapper version 0.27.2 =============================== Important changes: * Use g_object_notify instead of g_signal_emit when there is property changes, so as to fix the crash bug. * Register gnome_accessibility_module_shutdown as a _atexit function after invocation of gnome_accessibility_module_init, so as to fix the bug that Java apps crash when exit. Java ATK Wrapper version 0.27.1 ================================ Initial release. java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/README000066400000000000000000000010651255546517100205130ustar00rootroot00000000000000Java ATK Wrapper is a implementation of ATK by using JNI technic. It converts Java Swing events into ATK events, and sends these events to ATK-Bridge. JAW is part of the Bonobo deprecation project. By talking to ATK-Bridge, it keeps itself from being affected by the change of underlying communication mechanism. JAW consists of two major parts: wrapper: the Java library that listens to Swing events, and adapting JAAPI to fit the interfaces of ATK jni: the C library that converts Swing events into GSignals and talks to ATK-Bridge java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/acinclude.m4000066400000000000000000000037711255546517100220320ustar00rootroot00000000000000AC_DEFUN([CHECK_JNI],[ dnl Check to see what platform and set jni include path AC_CANONICAL_HOST AC_MSG_CHECKING([platform to setup platform specific variables]) platform_win32="no" case "$host" in *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/win32" fi platform_win32="yes" PLATFORM_CFLAGS="-mms-bitfields" PLATFORM_LDFLAGS="-Wl,--kill-at" PLATFORM_CLASSPATH_SEPARATOR=";" SOPREFIX="lib" ;; *-*-cygwin*) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/win32" fi platform_win32="yes" PLATFORM_CFLAGS= PLATFORM_LDFLAGS= PLATFORM_CLASSPATH_SEPARATOR=":" SOPREFIX="cyg" ;; *-*-linux*) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/linux" fi PLATFORM_CFLAGS= PLATFORM_LDFLAGS="-rpath $libdir" PLATFORM_CLASSPATH_SEPARATOR=":" SOPREFIX= ;; *-*-solaris*) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/solaris" fi PLATFORM_CFLAGS= PLATFORM_LDFLAGS= PLATFORM_CLASSPATH_SEPARATOR=":" SOPREFIX= ;; *-*-darwin*) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/darwin" fi PLATFORM_CFLAGS= PLATFORM_LDFLAGS= PLATFORM_CLASSPATH_SEPARATOR=":" SOPREFIX= ;; *) if test "$gcj_compile" = "yes"; then JNI_INCLUDES= else JNI_INCLUDES="-I$JDK_SRC/include -I$JDK_SRC/include/$host_os" fi PLATFORM_CFLAGS= PLATFORM_LDFLAGS= PLATFORM_CLASSPATH_SEPARATOR=":" SOPREFIX= ;; esac AC_MSG_RESULT([$host_os]) AC_SUBST(JNI_INCLUDES) AC_SUBST(PLATFORM_CFLAGS) AC_SUBST(PLATFORM_LDFLAGS) AC_SUBST(PLATFORM_CLASSPATH_SEPARATOR) ]) java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/autogen.sh000077500000000000000000000016601255546517100216350ustar00rootroot00000000000000#!/bin/sh # Run this to generate all the initial makefiles, etc. test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. olddir=`pwd` cd "$srcdir" mkdir -p m4 AUTORECONF=`which autoreconf` if test -z ${AUTORECONF}; then echo "*** No autoreconf found, please intall it ***" exit 1 else autoreconf -vif || exit $? fi PKGCONFIG=`which pkg-config` if test -z "$PKGCONFIG"; then echo "*** pkg-config not found, please install it ***" exit 1 fi pkg-config --print-errors gobject-introspection-1.0 if [ "$?" != 0 ]; then echo "You probably need to install 'libgirepository1.0-dev'" exit 1 fi # README and INSTALL are required by automake, but may be deleted by clean # up rules. to get automake to work, simply touch these here, they will be # regenerated from their corresponding *.in files by ./configure anyway. touch README INSTALL cd "$olddir" test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/configure.ac000066400000000000000000000114721255546517100221240ustar00rootroot00000000000000AC_PREREQ(2.63) AC_INIT([java-atk-wrapper],[0.33.3],[https://bugzilla.gnome.org/enter_bug.cgi?product=java-atk-wrapper]) : ${CXXFLAGS=""} AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE([1.11 -Wall check-news]) AM_SILENT_RULES([yes]) m4_pattern_allow([AM_PROG_AR]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # Before making a release, the LT_VERSION string should be modified. # The string is of the form C:R:A. # - If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # - If binary compatibility has been broken (eg removed or changed interfaces) # change to C+1:0:0 # - If the interface is the same as the previous version, change to C:R+1:A LIB_ATK_WRAPPER_LT_VERSION=6:0:0 AC_SUBST(LIB_ATK_WRAPPER_LT_VERSION) # jni AC_CONFIG_HEADERS([config.h]) AC_PROG_CC(gcc) AC_PROG_CXX AC_PROG_INSTALL AC_PATH_XTRA # Initialize libtool LT_PREREQ([2.2.6]) LT_INIT([disable-static]) AC_CONFIG_MACRO_DIR([m4]) m4_define([req_ver_atk], [1.18.0]) PKG_CHECK_MODULES(JAW, [ atk >= 2.14.0 atk-bridge-2.0 atspi-2 >= 2.14.0 dbus-1 glib-2.0 >= 2.32.0 gthread-2.0 gdk-2.0 gdk-3.0 gobject-2.0 ]) AC_SUBST(JAW_LIBS) case "${target_os}" in cygwin*) LIB_ATK_WRAPPER_LD_FLAGS="-avoid-version -no-undefined" ;; *) LIB_ATK_WRAPPER_LD_FLAGS="-version-info $LIB_ATK_WRAPPER_LT_VERSION -no-undefined" ;; esac AC_SUBST(LIB_ATK_WRAPPER_LD_FLAGS) # java wrapper AM_CONDITIONAL(USER, test `whoami` = "root") JAVA_REQUIRED=1.6 JAVA_ERROR_MESSAGE="Java $JAVA_REQUIRED or later is required to build java-access-bridge" AC_ARG_VAR([JAVA_HOME],[Java Runtime Environment location]) AC_ARG_VAR([JDK_SRC],[JDK installation path]) CUR_DIR=`pwd` SRC_DIR=`dirname $0` AC_ARG_WITH([jdk_auto_detect], [AS_HELP_STRING([--with-jdk-auto-detect], [Auto-detection of jdk location])], [], [with_jdk_auto_detect=yes]) if test "x$with_jdk_auto_detect" = "xyes"; then `javac $JAVACFLAGS -classpath $CUR_DIR/wrapper/org/GNOME/Accessibility $CUR_DIR/JavaInfo.java` JDK_SRC=`java JavaInfo` JAVA_HOME=`java JavaInfo`/jre else if test -z "$JDK_SRC"; then AC_MSG_ERROR("You should specify JDK_SRC") fi fi AC_SUBST(JDK_SRC) AC_SUBST(JAVA_HOME) if test -z "$JAVA_HOME"; then JAVA_PATH=${PATH} else JAVA_PATH=${JAVA_HOME}:${JAVA_HOME}/jre/bin:${JAVA_HOME}/bin:${JAVA_HOME}/../bin:${PATH} fi AC_PATH_PROG(JAVA,java,,${JAVA_PATH}) if test -z "$JAVA"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) fi AC_SUBST(JAVA) AC_PATH_PROG(JAVAC,javac,,${JAVA_PATH}) if test -z "$JAVAC"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) fi AC_SUBST(JAVAC) AC_PATH_PROG(JAVAH,javah,,${JAVA_PATH}) if test -z "$JAVAH"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) fi AC_SUBST(JAVAH) AC_SUBST(JAVACFLAGS) AC_PATH_PROG(JAR,jar,,${JAVA_PATH}) if test -z "$JAR"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) fi AC_SUBST(JAR) if test "x$GCC" = xyes; then JAW_CFLAGS=$JAW_CFLAGS $CFLAGS else AC_MSG_ERROR("You should compile with GCC") fi AC_SUBST(JAW_CFLAGS) GNOME_COMPILE_WARNINGS([error]) case "$WARN_CFLAGS" in *-Werror*) WARN_CFLAGS="$WARN_CFLAGS -Wno-error=deprecated-declarations" ;; esac AM_CFLAGS="$AM_CFLAGS $WARN_CFLAGS" AC_SUBST(AM_CFLAGS) CHECK_JNI AC_MSG_CHECKING([JDK version]) jversion=`$JAVA -version 2>&1 | head -n1 | cut -f2 -d'"' | cut -f1 -d_` AC_MSG_RESULT($jversion) j_major_version=0`echo $jversion | cut -f1 -d.` j_minor_version=0`echo $jversion | cut -f2 -d.` j_micro_version=0`echo $jversion | cut -f3 -d.` min_major_version=0`echo $JAVA_REQUIRED | cut -f1 -d.` min_minor_version=0`echo $JAVA_REQUIRED | cut -f2 -d.` min_micro_version=0`echo $JAVA_REQUIRED | cut -f3 -d.` if test "$j_major_version" -lt "$min_major_version"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) elif test "$j_major_version" = "$min_major_version"; then if test "$j_minor_version" -lt "$min_minor_version"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) elif test "$j_minor_version" = "$min_minor_version"; then if test "$j_micro_version" -lt "$min_micro_version"; then AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]) fi fi fi XPROP_PATH=${PATH}:/usr/X11/bin AC_PATH_PROG(XPROP,xprop,,${XPROP_PATH}) if test -z "$XPROP"; then AC_MSG_ERROR([No xprop found]) fi AC_SUBST(XPROP) AC_CONFIG_FILES([ Makefile jni/Makefile jni/src/Makefile wrapper/Makefile wrapper/org/Makefile wrapper/org/GNOME/Makefile wrapper/org/GNOME/Accessibility/Makefile ]) AC_OUTPUT echo " Build configuration: Prefix: ${prefix} Source code location: ${srcdir} Compiler: ${CC} JDK src: ${JDK_SRC} Host OS: ${host_os} JNI includes: ${JNI_INCLUDES} Warn flags: ${WARN_CFLAGS} " java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/java-atk-wrapper.doap000066400000000000000000000024571255546517100236620ustar00rootroot00000000000000 Java ATK Wrapper ATK implementation for Java by using JNI technic Java ATK Wrapper provides a C wrapper to java to allow access to methods from the ATK API interface in java Java C Magdalen Berns mberns java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/000077500000000000000000000000001255546517100204115ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/Makefile.am000066400000000000000000000000141255546517100224400ustar00rootroot00000000000000SUBDIRS=src java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/000077500000000000000000000000001255546517100212005ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/AtkWrapper.c000066400000000000000000001225701255546517100234330ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include #include #include #include #include #include #include #include "jawutil.h" #include "jawimpl.h" #include "jawtoplevel.h" #include "AtkWrapper.h" #ifdef __cplusplus extern "C" { #endif #define JNI_FALSE 0 #define JNI_TRUE 1 #define KEY_DISPATCH_NOT_DISPATCHED 0 #define KEY_DISPATCH_CONSUMED 1 #define KEY_DISPATCH_NOT_CONSUMED 2 #define GDK_SHIFT_MASK (1 << 0) #define GDK_CONTROL_MASK (1 << 2) #define GDK_MOD1_MASK (1 << 3) #define GDK_META_MASK (1 << 28) typedef enum _SignalType SignalType; gboolean jaw_accessibility_init (void); void jaw_accessibility_shutdown (void); gboolean jaw_debug = FALSE; static gint key_dispatch_result; static GMainLoop* jni_main_loop; static gboolean jaw_initialized = FALSE; gboolean jaw_accessibility_init (void) { atk_bridge_adaptor_init (NULL, NULL); if (jaw_debug) printf("Atk Bridge Initialized\n"); return TRUE; } void jaw_accessibility_shutdown (void) { atk_bridge_adaptor_cleanup(); } static gpointer jni_loop_callback(void *data) { if (!g_main_loop_is_running((GMainLoop *)data)) g_main_loop_run((GMainLoop *)data); else { if (jaw_debug) printf("Running JNI already\n"); } return 0; } JNIEXPORT jboolean JNICALL Java_org_GNOME_Accessibility_AtkWrapper_initNativeLibrary() { const gchar* debug_env = g_getenv("JAW_DEBUG"); if (g_strcmp0(debug_env, "1") == 0) { jaw_debug = TRUE; } if (jaw_initialized) return JNI_TRUE; // Java app with GTK Look And Feel will load gail // Set NO_GAIL to "1" to prevent gail from executing g_setenv("NO_GAIL", "1", TRUE); // Disable ATK Bridge temporarily to aoid the loading // of ATK Bridge by GTK look and feel g_setenv("NO_AT_BRIDGE", "1", TRUE); g_type_class_unref(g_type_class_ref(JAW_TYPE_UTIL)); // Force to invoke base initialization function of each ATK interfaces g_type_class_unref(g_type_class_ref(ATK_TYPE_NO_OP_OBJECT)); return JNI_TRUE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_loadAtkBridge() { // Enable ATK Bridge so we can load it now g_unsetenv ("NO_AT_BRIDGE"); GThread *thread; GError *err; char * message; message = "JNI main loop"; err = NULL; jaw_initialized = jaw_accessibility_init(); if (jaw_debug) printf("Jaw Initialization STATUS in loadAtkBridge: %d\n", jaw_initialized); jni_main_loop = g_main_loop_new (NULL, FALSE); /*main loop NOT running*/ thread = g_thread_new(message, jni_loop_callback, (void *) jni_main_loop); if(thread == NULL) { if (jaw_debug) { printf("Thread create failed: %s!!\n", err->message ); g_error_free (err); } } } enum _SignalType { Sig_Text_Caret_Moved = 0, Sig_Text_Property_Changed_Insert = 1, Sig_Text_Property_Changed_Delete = 2, Sig_Text_Property_Changed_Replace = 3, Sig_Object_Children_Changed_Add = 4, Sig_Object_Children_Changed_Remove = 5, Sig_Object_Active_Descendant_Changed = 6, Sig_Object_Selection_Changed = 7, Sig_Object_Visible_Data_Changed = 8, Sig_Object_Property_Change_Accessible_Actions = 9, Sig_Object_Property_Change_Accessible_Value = 10, Sig_Object_Property_Change_Accessible_Description = 11, Sig_Object_Property_Change_Accessible_Name = 12, Sig_Object_Property_Change_Accessible_Hypertext_Offset = 13, Sig_Object_Property_Change_Accessible_Table_Caption = 14, Sig_Object_Property_Change_Accessible_Table_Summary = 15, Sig_Object_Property_Change_Accessible_Table_Column_Header = 16, Sig_Object_Property_Change_Accessible_Table_Column_Description = 17, Sig_Object_Property_Change_Accessible_Table_Row_Header = 18, Sig_Object_Property_Change_Accessible_Table_Row_Description = 19, Sig_Table_Model_Changed = 20, Sig_Text_Property_Changed = 21 }; typedef struct _CallbackPara { jobject global_ac; gboolean is_toplevel; SignalType signal_id; jobjectArray args; AtkStateType atk_state; gboolean state_value; } CallbackPara; static CallbackPara* alloc_callback_para (jobject ac) { if (ac == NULL) return NULL; CallbackPara *para = g_new(CallbackPara, 1); para->global_ac = ac; para->args = NULL; return para; } static void free_callback_para (CallbackPara *para) { JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { free_callback_para(para); return; } if (para->global_ac == NULL) { if (jaw_debug) g_warning("free_callback_para: para->global_ac == NULL"); free_callback_para(para); return; } (*jniEnv)->DeleteGlobalRef(jniEnv, para->global_ac); if (para->args) { (*jniEnv)->DeleteGlobalRef(jniEnv, para->args); } g_free(para); } static gboolean focus_notify_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("\nfocus_notify_handler: env == NULL\n"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("\nfocus_notify_handler: global_ac == NULL\n"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("\nfocus_notify_handler: jaw_impl == NULL\n"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, 1); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_focusNotify(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(focus_notify_handler, para); } static gboolean window_open_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; gboolean is_toplevel = para->is_toplevel; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) fprintf(stderr,"\n *** window_open_handler: jniEnv == NULL *** \n"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) fprintf(stderr,"\n *** window_open_handler: global_ac == NULL *** \n"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_open_handler: jaw_impl == NULL"); } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); if (!g_strcmp0(atk_role_get_name(atk_object_get_role(atk_obj)), "redundant object")) { free_callback_para(para); return G_SOURCE_REMOVE; } if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) { free_callback_para(para); return G_SOURCE_REMOVE; } if (is_toplevel) { gint n = jaw_toplevel_add_window(JAW_TOPLEVEL(atk_get_root()), atk_obj); g_object_notify(G_OBJECT(atk_get_root()), "accessible-name"); g_signal_emit_by_name(ATK_OBJECT(atk_get_root()), "children-changed::add", n, atk_obj, NULL); g_signal_emit_by_name(atk_obj, "create", 0); } free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowOpen(JNIEnv *jniEnv, jclass jClass, jobject jAccContext, jboolean jIsToplevel) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE; gdk_threads_add_idle(window_open_handler, para); } static gboolean window_close_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; gboolean is_toplevel = para->is_toplevel; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_close_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_close_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl *jaw_impl = jaw_impl_find_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_close_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); if (!g_strcmp0(atk_role_get_name(atk_object_get_role(atk_obj)), "redundant object")) { free_callback_para(para); return G_SOURCE_REMOVE; } if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) { free_callback_para(para); return G_SOURCE_REMOVE; } if (is_toplevel) { gint n = jaw_toplevel_remove_window(JAW_TOPLEVEL(atk_get_root()), atk_obj); g_object_notify(G_OBJECT(atk_get_root()), "accessible-name"); g_signal_emit_by_name(ATK_OBJECT(atk_get_root()), "children-changed::remove", n, atk_obj, NULL); g_signal_emit_by_name(atk_obj, "destroy", 0); } free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowClose(JNIEnv *jniEnv, jclass jClass, jobject jAccContext, jboolean jIsToplevel) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE; gdk_threads_add_idle(window_close_handler, para); } static gboolean window_minimize_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_minimize_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_minimize_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_find_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_minimize_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "minimize", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMinimize(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(window_minimize_handler, para); } static gboolean window_maximize_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_maximize_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_maximize_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_find_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_maximize_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "maximize", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMaximize(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac ); gdk_threads_add_idle(window_maximize_handler, para); } static gboolean window_restore_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_restore_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_restore_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_find_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_restore_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "restore", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowRestore(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(window_restore_handler, para); } static gboolean window_activate_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_activate_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_activate_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_activate_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "activate", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowActivate(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(window_activate_handler, para); } static gboolean window_deactivate_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_deactivate_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_deactivate_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_deactivate_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "deactivate", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowDeactivate(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(window_deactivate_handler, para); } static gboolean window_state_change_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("window_state_change_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("window_state_change_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("window_state_change_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); g_signal_emit_by_name(atk_obj, "state-change", 0); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowStateChange(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(window_state_change_handler, para); } static gchar get_char_value (JNIEnv *jniEnv, jobject o) { jclass classByte = (*jniEnv)->FindClass(jniEnv, "java/lang/Byte"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classByte, "byteValue", "()B"); return (gchar)(*jniEnv)->CallByteMethod(jniEnv, o, jmid); } static gdouble get_double_value (JNIEnv *jniEnv, jobject o) { jclass classDouble = (*jniEnv)->FindClass(jniEnv, "java/lang/Double"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classDouble, "doubleValue", "()D"); return (gdouble)(*jniEnv)->CallDoubleMethod(jniEnv, o, jmid); } static gfloat get_float_value (JNIEnv *jniEnv, jobject o) { jclass classFloat = (*jniEnv)->FindClass(jniEnv, "java/lang/Float"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classFloat, "floatValue", "()F"); return (gfloat)(*jniEnv)->CallFloatMethod(jniEnv, o, jmid); } static gint get_int_value (JNIEnv *jniEnv, jobject o) { jclass classInteger = (*jniEnv)->FindClass(jniEnv, "java/lang/Integer"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classInteger, "intValue", "()I"); return (gint)(*jniEnv)->CallIntMethod(jniEnv, o, jmid); } static gint64 get_int64_value (JNIEnv *jniEnv, jobject o) { jclass classLong = (*jniEnv)->FindClass(jniEnv, "java/lang/Long"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classLong, "longValue", "()J"); return (gint64)(*jniEnv)->CallLongMethod(jniEnv, o, jmid); } static gboolean signal_emit_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("signal_emit_handler: jniEnv == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } jobjectArray args = para->args; if (global_ac == NULL) { if (jaw_debug) g_warning("signal_emit_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_find_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("signal_emit_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); switch (para->signal_id) { case Sig_Text_Caret_Moved: { gint cursor_pos = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); g_signal_emit_by_name(atk_obj, "text_caret_moved", cursor_pos); break; } case Sig_Text_Property_Changed_Insert: { gint insert_position = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); gint insert_length = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 1)); g_signal_emit_by_name(atk_obj, "text_changed::insert", insert_position, insert_length); break; } case Sig_Text_Property_Changed_Delete: { gint delete_position = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); gint delete_length = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 1)); g_signal_emit_by_name(atk_obj, "text_changed::delete", delete_position, delete_length); break; } case Sig_Object_Children_Changed_Add: { gint child_index = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); jobject child_ac = (*jniEnv)->GetObjectArrayElement(jniEnv, args, 1); JawImpl *child_impl = jaw_impl_get_instance(jniEnv, child_ac); if (child_impl == NULL) { if (jaw_debug) g_warning("signal_emit_handler: child_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (!child_impl) { break; } g_signal_emit_by_name(atk_obj, "children_changed::add", child_index, child_impl); break; } case Sig_Object_Children_Changed_Remove: { gint child_index = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); jobject child_ac = (*jniEnv)->GetObjectArrayElement(jniEnv, args, 1); JawImpl *child_impl = jaw_impl_find_instance(jniEnv, child_ac); if (!child_impl) { break; } g_signal_emit_by_name(atk_obj, "children_changed::remove", child_index, child_impl); if (G_OBJECT(atk_obj) != NULL) g_object_unref(G_OBJECT(atk_obj)); break; } case Sig_Object_Active_Descendant_Changed: { jobject child_ac = (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0); JawImpl *child_impl = jaw_impl_get_instance(jniEnv, child_ac); if (child_impl == NULL) { if (jaw_debug) g_warning("signal_emit_handler: child_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (!child_impl) { break; } g_signal_emit_by_name(atk_obj, "active_descendant_changed", child_impl); break; } case Sig_Object_Selection_Changed: { g_signal_emit_by_name(atk_obj, "selection_changed"); break; } case Sig_Object_Visible_Data_Changed: { g_signal_emit_by_name(atk_obj, "visible_data_changed"); break; } case Sig_Object_Property_Change_Accessible_Actions: { gint oldValue = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); gint newValue = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 1)); AtkPropertyValues values = { NULL }; // GValues must be initialized g_assert (!G_VALUE_HOLDS_INT (&values.old_value)); g_value_init(&values.old_value, G_TYPE_INT); g_assert (G_VALUE_HOLDS_INT (&values.old_value)); g_value_set_int(&values.old_value, oldValue); if (jaw_debug) printf ("%d\n", g_value_get_int(&values.old_value)); g_assert (!G_VALUE_HOLDS_INT (&values.new_value)); g_value_init(&values.new_value, G_TYPE_INT); g_assert (G_VALUE_HOLDS_INT (&values.new_value)); g_value_set_int(&values.new_value, newValue); if (jaw_debug) printf ("%d\n", g_value_get_int(&values.new_value)); values.property_name = "accessible-actions"; g_signal_emit_by_name(atk_obj, "property_change::accessible-actions", &values); break; } case Sig_Object_Property_Change_Accessible_Value: { g_object_notify(G_OBJECT(atk_obj), "accessible-value"); break; } case Sig_Object_Property_Change_Accessible_Description: { g_object_notify(G_OBJECT(atk_obj), "accessible-description"); break; } case Sig_Object_Property_Change_Accessible_Name: { g_object_notify(G_OBJECT(atk_obj), "accessible-name"); break; } case Sig_Object_Property_Change_Accessible_Hypertext_Offset: { g_signal_emit_by_name(atk_obj, "property_change::accessible-hypertext-offset", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Caption: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-caption", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Summary: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-summary", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Column_Header: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-column-header", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Column_Description: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-column-description", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Row_Header: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-row-header", NULL); break; } case Sig_Object_Property_Change_Accessible_Table_Row_Description: { g_signal_emit_by_name(atk_obj, "property_change::accessible-table-row-description", NULL); break; } case Sig_Table_Model_Changed: { g_signal_emit_by_name(atk_obj, "model_changed"); break; } case Sig_Text_Property_Changed: { JawObject * jaw_obj = JAW_OBJECT(atk_obj); gint newValue = get_int_value(jniEnv, (*jniEnv)->GetObjectArrayElement(jniEnv, args, 0)); gint prevCount = GPOINTER_TO_INT(g_hash_table_lookup(jaw_obj->storedData, "Previous_Count")); gint curCount = atk_text_get_character_count(ATK_TEXT(jaw_obj)); g_hash_table_insert(jaw_obj->storedData, "Previous_Count", GINT_TO_POINTER(curCount)); if (curCount > prevCount) { g_signal_emit_by_name(atk_obj, "text_changed::insert", newValue, curCount - prevCount); } else if (curCount < prevCount) { g_signal_emit_by_name(atk_obj, "text_changed::delete", newValue, prevCount - curCount); } break; } default: break; } free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_emitSignal(JNIEnv *jniEnv, jclass jClass, jobject jAccContext, jint id, jobjectArray args) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); jobjectArray global_args = (jobjectArray)(*jniEnv)->NewGlobalRef(jniEnv, args); CallbackPara *para = alloc_callback_para(global_ac); para->signal_id = (gint)id; para->args = global_args; gdk_threads_add_idle(signal_emit_handler, para); } static gboolean object_state_change_handler (gpointer p) { CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("object_state_change_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("object_state_change_handler: global_ac"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("object_state_change_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } atk_object_notify_state_change(ATK_OBJECT(jaw_impl), para->atk_state, para->state_value); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_objectStateChange(JNIEnv *jniEnv, jclass jClass, jobject jAccContext, jobject state, jboolean value) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); AtkStateType state_type = jaw_util_get_atk_state_type_from_java_state( jniEnv, state ); para->atk_state = state_type; if (value == JNI_TRUE) { para->state_value = TRUE; } else { para->state_value = FALSE; } gdk_threads_add_idle(object_state_change_handler, para); } static gboolean component_added_handler (gpointer p) { JNIEnv *jniEnv; CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("component_added_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("component_added_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("component_added_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) { atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, 1); } free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentAdded(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(component_added_handler, para); } static gboolean component_removed_handler (gpointer p) { JNIEnv *jniEnv; CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("component_removed_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("component_removed_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("component_removed_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); if (atk_obj == NULL) { if (jaw_debug) g_warning("component_removed_handler: atk_obj == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, FALSE); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentRemoved(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(component_removed_handler, para); } /** * Signal is emitted when the position or size of the component changes. */ static gboolean bounds_changed_handler (gpointer p) { JNIEnv *jniEnv; CallbackPara *para = (CallbackPara*)p; jobject global_ac = para->global_ac; jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("bounds_changed_handler: env == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } if (global_ac == NULL) { if (jaw_debug) g_warning("bounds_changed_handler: global_ac == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("bounds_changed_handler: jaw_impl == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } AtkObject* atk_obj = ATK_OBJECT(jaw_impl); if (atk_obj == NULL) { if (jaw_debug) g_warning("bounds_changed_handler: atk_obj == NULL"); free_callback_para(para); return G_SOURCE_REMOVE; } g_signal_emit_by_name(atk_obj, "bounds_changed"); free_callback_para(para); return G_SOURCE_REMOVE; } JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_boundsChanged(JNIEnv *jniEnv, jclass jClass, jobject jAccContext) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext); CallbackPara *para = alloc_callback_para(global_ac); gdk_threads_add_idle(bounds_changed_handler, para); } static gboolean key_dispatch_handler (gpointer p) { key_dispatch_result = 0; jobject jAtkKeyEvent = (jobject)p; AtkKeyEventStruct *event = g_new0(AtkKeyEventStruct, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) { if (jaw_debug) g_warning("key_dispatch_handler: env == NULL"); return G_SOURCE_REMOVE; } jclass classAtkKeyEvent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkKeyEvent"); // type jfieldID jfidType = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "type", "I"); jint type = (*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidType); jfieldID jfidTypePressed = (*jniEnv)->GetStaticFieldID(jniEnv, classAtkKeyEvent, "ATK_KEY_EVENT_PRESSED", "I"); jfieldID jfidTypeReleased = (*jniEnv)->GetStaticFieldID(jniEnv, classAtkKeyEvent, "ATK_KEY_EVENT_RELEASED", "I"); jint type_pressed = (*jniEnv)->GetStaticIntField(jniEnv, classAtkKeyEvent, jfidTypePressed); jint type_released = (*jniEnv)->GetStaticIntField(jniEnv, classAtkKeyEvent, jfidTypeReleased); if (type == type_pressed) { event->type = ATK_KEY_EVENT_PRESS; } else if (type == type_released) { event->type = ATK_KEY_EVENT_RELEASE; } else { g_assert_not_reached(); } // state jfieldID jfidShift = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "isShiftKeyDown", "Z"); jboolean jShiftKeyDown = (*jniEnv)->GetBooleanField(jniEnv, jAtkKeyEvent, jfidShift); if (jShiftKeyDown == JNI_TRUE) { event->state |= GDK_SHIFT_MASK; } jfieldID jfidCtrl = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "isCtrlKeyDown", "Z"); jboolean jCtrlKeyDown = (*jniEnv)->GetBooleanField(jniEnv, jAtkKeyEvent, jfidCtrl); if (jCtrlKeyDown == JNI_TRUE) { event->state |= GDK_CONTROL_MASK; } jfieldID jfidAlt = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "isAltKeyDown", "Z"); jboolean jAltKeyDown = (*jniEnv)->GetBooleanField(jniEnv, jAtkKeyEvent, jfidAlt); if (jAltKeyDown == JNI_TRUE) { event->state |= GDK_MOD1_MASK; } jfieldID jfidMeta = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "isMetaKeyDown", "Z"); jboolean jMetaKeyDown = (*jniEnv)->GetBooleanField(jniEnv, jAtkKeyEvent, jfidMeta); if (jMetaKeyDown == JNI_TRUE) { event->state |= GDK_META_MASK; } // keyval jfieldID jfidKeyval = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "keyval", "I"); jint jkeyval = (*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidKeyval); event->keyval = (guint)jkeyval; // string jfieldID jfidString = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "string", "Ljava/lang/String;"); jstring jstr = (jstring)(*jniEnv)->GetObjectField(jniEnv, jAtkKeyEvent, jfidString); event->length = (gint)(*jniEnv)->GetStringLength(jniEnv, jstr); event->string = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jstr, 0); // keycode jfieldID jfidKeycode = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "keycode", "I"); event->keycode = (gint)(*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidKeycode); // timestamp jfieldID jfidTimestamp = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "timestamp", "I"); event->timestamp = (guint32)(*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidTimestamp); gboolean b = jaw_util_dispatch_key_event (event); if(jaw_debug) printf("key_dispatch_result b = %d\n ", b); if (b) { key_dispatch_result = KEY_DISPATCH_CONSUMED; } else { key_dispatch_result = KEY_DISPATCH_NOT_CONSUMED; } (*jniEnv)->ReleaseStringUTFChars(jniEnv, jstr, event->string); g_free(event); (*jniEnv)->DeleteGlobalRef(jniEnv, jAtkKeyEvent); return G_SOURCE_REMOVE; } JNIEXPORT jboolean JNICALL Java_org_GNOME_Accessibility_AtkWrapper_dispatchKeyEvent(JNIEnv *jniEnv, jclass jClass, jobject jAtkKeyEvent) { jboolean key_consumed; jobject global_key_event = (*jniEnv)->NewGlobalRef(jniEnv, jAtkKeyEvent); gdk_threads_add_idle(key_dispatch_handler, (gpointer)global_key_event); if(jaw_debug) printf("key_dispatch_result saved = %d\n ", key_dispatch_result); if (key_dispatch_result == KEY_DISPATCH_CONSUMED) { key_consumed = JNI_TRUE; } else { key_consumed = JNI_FALSE; } key_dispatch_result = KEY_DISPATCH_NOT_DISPATCHED; return key_consumed; } #ifdef __cplusplus } #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/AtkWrapper.h000066400000000000000000000107321255546517100234340ustar00rootroot00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class org_GNOME_Accessibility_AtkWrapper */ #ifndef _Included_org_GNOME_Accessibility_AtkWrapper #define _Included_org_GNOME_Accessibility_AtkWrapper #ifdef __cplusplus extern "C" { #endif /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: initNativeLibrary * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_GNOME_Accessibility_AtkWrapper_initNativeLibrary(void); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: loadAtkBridge * Signature: ()V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_loadAtkBridge(void); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: focusNotify * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_focusNotify (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowOpen * Signature: (Ljavax/accessibility/AccessibleContext;Z)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowOpen (JNIEnv *, jclass, jobject, jboolean); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowClose * Signature: (Ljavax/accessibility/AccessibleContext;Z)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowClose (JNIEnv *, jclass, jobject, jboolean); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowMinimize * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMinimize (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowMaximize * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMaximize (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowRestore * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowRestore (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowActivate * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowActivate (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowDeactivate * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowDeactivate (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: windowStateChange * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowStateChange (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: emitSignal * Signature: (Ljavax/accessibility/AccessibleContext;I[Ljava/lang/Object;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_emitSignal (JNIEnv *, jclass, jobject, jint, jobjectArray); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: objectStateChange * Signature: (Ljavax/accessibility/AccessibleContext;Ljava/lang/Object;Z)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_objectStateChange (JNIEnv *, jclass, jobject, jobject, jboolean); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: componentAdded * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentAdded (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: componentRemoved * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentRemoved (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: boundsChanged * Signature: (Ljavax/accessibility/AccessibleContext;)V */ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_boundsChanged (JNIEnv *, jclass, jobject); /* * Class: org_GNOME_Accessibility_AtkWrapper * Method: dispatchKeyEvent * Signature: (Lorg/GNOME/Accessibility/AtkKeyEvent;)Z */ JNIEXPORT jboolean JNICALL Java_org_GNOME_Accessibility_AtkWrapper_dispatchKeyEvent (JNIEnv *, jclass, jobject); #ifdef __cplusplus } #endif #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/Makefile.am000066400000000000000000000026721255546517100232430ustar00rootroot00000000000000lib_LTLIBRARIES = libatk-wrapper.la libatk_wrapper_la_SOURCES = AtkWrapper.c \ jawutil.c \ jawtoplevel.c \ jawobject.c \ jawimpl.c \ jawaction.c \ jawcomponent.c \ jawtext.c \ jaweditabletext.c \ jawhyperlink.c \ jawhypertext.c \ jawimage.c \ jawselection.c \ jawvalue.c \ jawtable.c \ jawtablecell.c noinst_HEADERS = AtkWrapper.h \ jawimpl.h \ jawobject.h \ jawhyperlink.h \ jawtoplevel.h \ jawutil.h libatk_wrapper_la_CFLAGS = $(JNI_INCLUDES)\ $(JAW_CFLAGS) \ $(AM_CFLAGS) \ $(PLATFORM_CFLAGS) libatk_wrapper_la_CPPFLAGS = $(JNI_INCLUDES)\ $(JAW_CFLAGS) \ $(PLATFORM_CFLAGS) libatk_wrapper_la_LDFLAGS = $(LIB_ATK_WRAPPER_LD_FLAGS) \ $(LT_VERSION_INFO) \ $(PLATFORM_LDFLAGS) \ $(AM_LDFLAGS) libatk_wrapper_la_LIBADD = $(JAW_LIBS) java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawaction.c000066400000000000000000000303361255546517100233300ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_action_interface_init (AtkActionIface*); extern gpointer jaw_action_data_init (jobject ac); extern void jaw_action_data_finalize (gpointer); static gboolean jaw_action_do_action(AtkAction *action, gint i); static gint jaw_action_get_n_actions(AtkAction *action); static const gchar* jaw_action_get_description(AtkAction *action, gint i); static const gchar* jaw_action_get_name(AtkAction *action, gint i); static const gchar* jaw_action_get_keybinding (AtkAction *action, gint i); static gboolean jaw_action_set_description (AtkAction *action, gint i, const gchar *description); static const gchar* jaw_action_get_localized_name(AtkAction *action, gint i); typedef struct _ActionData { jobject atk_action; gchar* action_name; jstring jstrActionName; jstring jstrLocalizedName; gchar* action_description; jstring jstrActionDescription; gchar* action_keybinding; jstring jstrActionKeybinding; } ActionData; void jaw_action_interface_init (AtkActionIface *iface) { iface->do_action = jaw_action_do_action; iface->get_n_actions = jaw_action_get_n_actions; iface->get_description = jaw_action_get_description; iface->get_name = jaw_action_get_name; iface->get_keybinding = jaw_action_get_keybinding; iface->set_description = jaw_action_set_description; iface->get_localized_name = jaw_action_get_localized_name; } gpointer jaw_action_data_init (jobject ac) { ActionData *data = g_new0(ActionData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAction, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_action = (*jniEnv)->NewObject(jniEnv, classAction, jmid, ac); data->atk_action = (*jniEnv)->NewGlobalRef(jniEnv, jatk_action); return data; } void jaw_action_data_finalize (gpointer p) { ActionData *data = (ActionData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_action) { if (data->action_name != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionName, data->action_name); (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrLocalizedName, data->action_name); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionName); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrLocalizedName); data->jstrActionName = NULL; data->jstrLocalizedName = NULL; data->action_name = NULL; } if (data->action_description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionDescription, data->action_description); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionDescription); data->jstrActionDescription = NULL; data->action_description = NULL; } if (data->action_keybinding != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionKeybinding, data->action_keybinding); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionKeybinding); data->jstrActionKeybinding = NULL; data->action_keybinding = NULL; } (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_action); data->atk_action = NULL; } } static gboolean jaw_action_do_action (AtkAction *action, gint i) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "do_action", "(I)Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_action, jmid, (jint)i); if (jresult == JNI_TRUE) return TRUE; return FALSE; } static gint jaw_action_get_n_actions (AtkAction *action) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "get_n_actions", "()I"); return (gint)(*jniEnv)->CallIntMethod(jniEnv, atk_action, jmid); } static const gchar* jaw_action_get_description (AtkAction *action, gint i) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "get_description", "(I)Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_action, jmid, (jint)i); if (data->action_description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionDescription, data->action_description); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionDescription); } data->jstrActionDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr); data->action_description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, data->jstrActionDescription, NULL); return data->action_description; } static gboolean jaw_action_set_description (AtkAction *action, gint i, const gchar *description) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "setDescription", "(ILjava/lang/String;)Z"); jboolean jisset = (*jniEnv)->CallBooleanMethod(jniEnv, atk_action, jmid, (jint)i, (jstring)description); if (jisset == JNI_TRUE) { return TRUE; } else { return FALSE; } } static const gchar* jaw_action_get_name (AtkAction *action, gint i) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "get_name", "(I)Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_action, jmid, (jint)i); if (data->action_name != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionName, data->action_name); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionName); } data->jstrActionName = (*jniEnv)->NewGlobalRef(jniEnv, jstr); data->action_name = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, data->jstrActionName, NULL); return data->action_name; } static const gchar* jaw_action_get_localized_name (AtkAction *action, gint i) { JawObject *jaw_obj = JAW_OBJECT(action); ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkAction = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*env)->GetMethodID(env, classAtkAction, "getLocalizedName", "(I)Ljava/lang/String;"); jstring jstr = (*env)->CallObjectMethod(env, atk_action, jmid, (jint)i); if (data->action_name != NULL) { (*env)->ReleaseStringUTFChars(env, data->jstrLocalizedName, data->action_name); (*env)->DeleteGlobalRef(env, data->jstrLocalizedName); } data->jstrLocalizedName = (*env)->NewGlobalRef(env, jstr); data->action_name = (gchar*)(*env)->GetStringUTFChars(env, data->jstrLocalizedName, NULL); return data->action_name; } static const gchar* jaw_action_get_keybinding (AtkAction *action, gint i) { JawObject *jaw_obj = JAW_OBJECT(action); if (jaw_obj == NULL) return NULL; ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION); jobject atk_action = data->atk_action; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkAction = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkAction"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkAction, "get_keybinding", "(I)Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_action, jmid, (jint)i); if (data->action_keybinding != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrActionKeybinding, data->action_keybinding); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrActionKeybinding); } data->jstrActionKeybinding = (*jniEnv)->NewGlobalRef(jniEnv, jstr); data->action_keybinding = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, data->jstrActionKeybinding, NULL); return data->action_keybinding; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawcomponent.c000066400000000000000000000333111255546517100240510ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_component_interface_init(AtkComponentIface*); extern gpointer jaw_component_data_init(jobject); extern void jaw_component_data_finalize(gpointer); static gboolean jaw_component_contains(AtkComponent *component, gint x, gint y, AtkCoordType coord_type); static AtkObject* jaw_component_ref_accessible_at_point(AtkComponent *component, gint x, gint y, AtkCoordType coord_type); static void jaw_component_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); static gboolean jaw_component_set_extents(AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type); static gboolean jaw_component_grab_focus(AtkComponent *component); static AtkLayer jaw_component_get_layer(AtkComponent *component); /*static gin jaw_component_get_mdi_zorder(AtkComponent *component); */ typedef struct _ComponentData { jobject atk_component; } ComponentData; void jaw_component_interface_init (AtkComponentIface *iface) { iface->contains = jaw_component_contains; iface->ref_accessible_at_point = jaw_component_ref_accessible_at_point; iface->get_extents = jaw_component_get_extents; iface->grab_focus = jaw_component_grab_focus; iface->get_layer = jaw_component_get_layer; iface->get_mdi_zorder = NULL; /*jaw_component_get_mdi_zorder;*/ iface->set_extents = jaw_component_set_extents; } gpointer jaw_component_data_init (jobject ac) { ComponentData *data = g_new0(ComponentData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classComponent, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_component = (*jniEnv)->NewObject(jniEnv, classComponent, jmid, ac); data->atk_component = (*jniEnv)->NewGlobalRef(jniEnv, jatk_component); return data; } void jaw_component_data_finalize (gpointer p) { ComponentData *data = (ComponentData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_component) { (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_component); data->atk_component = NULL; } } static void coord_screen_to_local (JNIEnv *jniEnv, jobject jobj, gint *x, gint *y) { jclass classAccessibleComponent = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleComponent, "getLocationOnScreen", "()Ljava/awt/Point;"); jobject jpoint = (*jniEnv)->CallObjectMethod(jniEnv, jobj, jmid); jclass classPoint = (*jniEnv)->FindClass(jniEnv, "java/awt/Point"); jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classPoint, "x", "I"); jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classPoint, "y", "I"); jint jx = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidX); jint jy = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidY); (*x) = (*x) - (gint)jx; (*y) = (*y) - (gint)jy; } static gboolean jaw_component_contains (AtkComponent *component, gint x, gint y, AtkCoordType coord_type) { JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "contains", "(III)Z"); jboolean jcontains = (*jniEnv)->CallBooleanMethod(jniEnv, atk_component, jmid, (jint)x, (jint)y, (jint)coord_type); if (jcontains == JNI_TRUE) { return TRUE; } else { return FALSE; } } static AtkObject* jaw_component_ref_accessible_at_point (AtkComponent *component, gint x, gint y, AtkCoordType coord_type) { JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "get_accessible_at_point", "(III)Ljavax/accessibility/AccessibleContext;"); jobject child_ac = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid, (jint)x, (jint)y, (jint)coord_type); JawImpl* jaw_impl = jaw_impl_get_instance( jniEnv, child_ac ); g_object_ref( G_OBJECT(jaw_impl) ); return ATK_OBJECT(jaw_impl); } static void jaw_component_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type) { if (x == NULL || y == NULL || width == NULL || height == NULL) return; if (component == NULL) return; JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "get_extents", "()Ljava/awt/Rectangle;"); jobject jrectangle = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid); if (jrectangle == NULL) { (*x) = 0; (*y) = 0; (*width) = 0; (*height) = 0; return; } jclass classRectangle = (*jniEnv)->FindClass(jniEnv, "java/awt/Rectangle"); jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "x", "I"); jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "y", "I"); jfieldID jfidW = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "width", "I"); jfieldID jfidH = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "height", "I"); (*x) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidX); (*y) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidY); (*width) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidW); (*height) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidH); } static gboolean jaw_component_set_extents (AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type) { JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "set_extents", "(IIIII)Ljava/awt/Rectangle;"); jobject jcomponent = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid, (jint)x, (jint)y, (jint)width, (jint)height, (jint)coord_type); if (jcomponent == NULL) { width = 0; height = 0; x = 0; y = 0; return FALSE; } jclass classRectangle = (*jniEnv)->FindClass(jniEnv, "java/awt/Rectangle"); // Get Field IDs jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, atk_component, "x", "I"); jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, atk_component, "y", "I"); jfieldID jfidWidth = (*jniEnv)->GetFieldID(jniEnv, atk_component, "width", "I"); jfieldID jfidHeight = (*jniEnv)->GetFieldID(jniEnv, atk_component, "height", "I"); jint jwidth = (*jniEnv)->GetIntField(jniEnv, classRectangle, jfidWidth); jint jheight = (*jniEnv)->GetIntField(jniEnv, classRectangle, jfidHeight); jint jx = (*jniEnv)->GetIntField(jniEnv, classRectangle, jfidX); jint jy = (*jniEnv)->GetIntField(jniEnv, classRectangle, jfidY); width = (gint)jwidth; height = (gint)jheight; x = (gint)jx; y = (gint)jy; return TRUE; } static gboolean jaw_component_grab_focus (AtkComponent *component) { JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "grab_focus", "()Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_component, jmid); if (jresult == JNI_TRUE) { return TRUE; } return FALSE; } static AtkLayer jaw_component_get_layer (AtkComponent *component) { JawObject *jaw_obj = JAW_OBJECT(component); ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT); jobject atk_component = data->atk_component; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkComponent"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkComponent, "get_layer", "()I"); jint jlayer = (*jniEnv)->CallIntMethod(jniEnv, atk_component, jmid); return (AtkLayer)jlayer; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jaweditabletext.c000066400000000000000000000272601255546517100245330ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" #include "jawobject.h" extern void jaw_editable_text_interface_init(AtkEditableTextIface*); extern gpointer jaw_editable_text_data_init(jobject); extern void jaw_editable_text_data_finalize(gpointer); static void jaw_editable_text_set_text_contents(AtkEditableText *text, const gchar *string); static void jaw_editable_text_insert_text(AtkEditableText *text, const gchar *string, gint length, gint *position); static void jaw_editable_text_copy_text(AtkEditableText *text, gint start_pos, gint end_pos); static void jaw_editable_text_cut_text(AtkEditableText *text, gint start_pos, gint end_pos); static void jaw_editable_text_delete_text(AtkEditableText *text, gint start_pos, gint end_pos); static void jaw_editable_text_paste_text(AtkEditableText *text, gint position); static gboolean jaw_editable_text_set_run_attributes(AtkEditableText *text, AtkAttributeSet *attrib_set, gint start_offset, gint end_offset); typedef struct _EditableTextData { jobject atk_editable_text; }EditableTextData; void jaw_editable_text_interface_init (AtkEditableTextIface *iface) { iface->set_text_contents = jaw_editable_text_set_text_contents; iface->insert_text = jaw_editable_text_insert_text; iface->copy_text = jaw_editable_text_copy_text; iface->cut_text = jaw_editable_text_cut_text; iface->delete_text = jaw_editable_text_delete_text; iface->paste_text = jaw_editable_text_paste_text; iface->set_run_attributes = jaw_editable_text_set_run_attributes; } gpointer jaw_editable_text_data_init (jobject ac) { EditableTextData *data = g_new0(EditableTextData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classEditableText, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_editable_text = (*jniEnv)->NewObject(jniEnv, classEditableText, jmid, ac); data->atk_editable_text = (*jniEnv)->NewGlobalRef(jniEnv, jatk_editable_text); return data; } void jaw_editable_text_data_finalize (gpointer p) { EditableTextData *data = (EditableTextData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_editable_text) { (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_editable_text); data->atk_editable_text = NULL; } } void jaw_editable_text_set_text_contents (AtkEditableText *text, const gchar *string) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "set_text_contents", "(Ljava/lang/String;)V"); jstring jstr = (*jniEnv)->NewStringUTF(jniEnv, string); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, jstr); } void jaw_editable_text_insert_text (AtkEditableText *text, const gchar *string, gint length, gint *position) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "insert_text", "(Ljava/lang/String;I)V"); jstring jstr = (*jniEnv)->NewStringUTF(jniEnv, string); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, jstr, (jint)*position); *position = *position + length; atk_text_set_caret_offset(ATK_TEXT(jaw_obj), *position); } void jaw_editable_text_copy_text (AtkEditableText *text, gint start_pos, gint end_pos) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "copy_text", "(II)V"); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, (jint)start_pos, (jint)end_pos); } void jaw_editable_text_cut_text (AtkEditableText *text, gint start_pos, gint end_pos) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "cut_text", "(II)V"); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, (jint)start_pos, (jint)end_pos); } void jaw_editable_text_delete_text (AtkEditableText *text, gint start_pos, gint end_pos) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "delete_text", "(II)V"); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, (jint)start_pos, (jint)end_pos); } void jaw_editable_text_paste_text (AtkEditableText *text, gint position) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkEditableText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkEditableText, "paste_text", "(I)V"); (*jniEnv)->CallVoidMethod(jniEnv, atk_editable_text, jmid, (jint)position); } static gboolean jaw_editable_text_set_run_attributes(AtkEditableText *text, AtkAttributeSet *attrib_set, gint start_offset, gint end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); EditableTextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_EDITABLE_TEXT); jobject atk_editable_text = data->atk_editable_text; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkEditableText = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkEditableText"); jmethodID jmid = (*env)->GetMethodID(env, classAtkEditableText, "setRunAttributes", "(Ljavax/swing/text/AttributeSet;II)Z"); jboolean jresult = (*env)->CallBooleanMethod(env, atk_editable_text, jmid, (jobject)attrib_set, (jint)start_offset, (jint)end_offset); if (jresult == JNI_TRUE) return TRUE; return FALSE; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawhyperlink.c000066400000000000000000000156071255546517100240640ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include "jawhyperlink.h" #include "jawutil.h" #include "jawimpl.h" static void jaw_hyperlink_class_init (JawHyperlinkClass *klass); static void jaw_hyperlink_dispose (GObject *gobject); static void jaw_hyperlink_finalize (GObject *gobject); /* AtkObject */ static gchar* jaw_hyperlink_get_uri (AtkHyperlink *atk_hyperlink, gint i); static AtkObject* jaw_hyperlink_get_object (AtkHyperlink *atk_hyperlink, gint i); static gint jaw_hyperlink_get_end_index (AtkHyperlink *atk_hyperlink); static gint jaw_hyperlink_get_start_index (AtkHyperlink *atk_hyperlink); static gboolean jaw_hyperlink_is_valid (AtkHyperlink *atk_hyperlink); static gint jaw_hyperlink_get_n_anchors (AtkHyperlink *atk_hyperlink); G_DEFINE_TYPE (JawHyperlink, jaw_hyperlink, ATK_TYPE_HYPERLINK) JawHyperlink* jaw_hyperlink_new (jobject jhyperlink) { JawHyperlink* jaw_hyperlink = g_object_new(JAW_TYPE_HYPERLINK, NULL); JNIEnv *jniEnv = jaw_util_get_jni_env(); jaw_hyperlink->jhyperlink = (*jniEnv)->NewGlobalRef(jniEnv, jhyperlink); return jaw_hyperlink; } static void jaw_hyperlink_class_init (JawHyperlinkClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = jaw_hyperlink_dispose; gobject_class->finalize = jaw_hyperlink_finalize; AtkHyperlinkClass *atk_hyperlink_class = ATK_HYPERLINK_CLASS(klass); atk_hyperlink_class->get_uri = jaw_hyperlink_get_uri; atk_hyperlink_class->get_object = jaw_hyperlink_get_object; atk_hyperlink_class->get_end_index = jaw_hyperlink_get_end_index; atk_hyperlink_class->get_start_index = jaw_hyperlink_get_start_index; atk_hyperlink_class->is_valid = jaw_hyperlink_is_valid; atk_hyperlink_class->get_n_anchors = jaw_hyperlink_get_n_anchors; } static void jaw_hyperlink_init (JawHyperlink *link) { } static void jaw_hyperlink_dispose(GObject *gobject) { /* Chain up to parent's dispose */ G_OBJECT_CLASS(jaw_hyperlink_parent_class)->dispose(gobject); } static void jaw_hyperlink_finalize(GObject *gobject) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(gobject); JNIEnv *jniEnv = jaw_util_get_jni_env(); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_hyperlink->jhyperlink); jaw_hyperlink->jhyperlink = NULL; /* Chain up to parent's finalize */ G_OBJECT_CLASS(jaw_hyperlink_parent_class)->finalize(gobject); } static gchar* jaw_hyperlink_get_uri (AtkHyperlink *atk_hyperlink, gint i) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "get_uri", "(I)Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, jhyperlink, jmid, (jint)i); if (jaw_hyperlink->uri != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_hyperlink->jstrUri, jaw_hyperlink->uri); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_hyperlink->jstrUri); } jaw_hyperlink->jstrUri = (*jniEnv)->NewGlobalRef(jniEnv, jstr); jaw_hyperlink->uri = (gchar*)(*jniEnv)->GetStringUTFChars( jniEnv, jaw_hyperlink->jstrUri, NULL ); return jaw_hyperlink->uri; } static AtkObject* jaw_hyperlink_get_object (AtkHyperlink *atk_hyperlink, gint i) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "get_object", "(I)Ljava/lang/String;"); jobject jobj = (*jniEnv)->CallObjectMethod(jniEnv, jhyperlink, jmid, (jint)i); if (jobj == NULL) { return NULL; } jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID( jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;" ); jobject ac = (*jniEnv)->CallObjectMethod( jniEnv, jobj, jmid ); AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, ac ); return obj; } static gint jaw_hyperlink_get_end_index (AtkHyperlink *atk_hyperlink) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "get_end_index", "()I"); jint jindex = (*jniEnv)->CallIntMethod(jniEnv, jhyperlink, jmid); return jindex; } static gint jaw_hyperlink_get_start_index (AtkHyperlink *atk_hyperlink) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "get_start_index", "()I"); jint jindex = (*jniEnv)->CallIntMethod(jniEnv, jhyperlink, jmid); return jindex; } static gboolean jaw_hyperlink_is_valid (AtkHyperlink *atk_hyperlink) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "is_valid", "()Z"); jboolean jvalid = (*jniEnv)->CallBooleanMethod(jniEnv, jhyperlink, jmid); return jvalid; } static gint jaw_hyperlink_get_n_anchors (AtkHyperlink *atk_hyperlink) { JawHyperlink *jaw_hyperlink = JAW_HYPERLINK(atk_hyperlink); jobject jhyperlink = jaw_hyperlink->jhyperlink; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHyperlink = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHyperlink"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHyperlink, "get_n_anchors", "()I"); jint janchors = (*jniEnv)->CallIntMethod(jniEnv, jhyperlink, jmid); return janchors; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawhyperlink.h000066400000000000000000000035201255546517100240600ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 _JAW_HYPERLINK_H_ #define _JAW_HYPERLINK_H_ #include #include G_BEGIN_DECLS #define JAW_TYPE_HYPERLINK (jaw_hyperlink_get_type ()) #define JAW_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_HYPERLINK, JawHyperlink)) #define JAW_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_HYPERLINK, JawHyperlinkClass)) #define JAW_IS_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_HYPERLINK)) #define JAW_IS_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_HYPERLINK)) #define JAW_HYPERLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_HYPERLINK, JawHyperlinkClass)) typedef struct _JawHyperlink JawHyperlink; typedef struct _JawHyperlinkClass JawHyperlinkClass; struct _JawHyperlink { AtkHyperlink parent; jobject jhyperlink; jstring jstrUri; gchar* uri; }; GType jaw_hyperlink_get_type (void); struct _JawHyperlinkClass { AtkHyperlinkClass parent_class; }; JawHyperlink* jaw_hyperlink_new (jobject jhyperlink); G_END_DECLS #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawhypertext.c000066400000000000000000000112611255546517100241030ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" #include "jawhyperlink.h" extern void jaw_hypertext_interface_init (AtkHypertextIface*); extern gpointer jaw_hypertext_data_init (jobject); extern void jaw_hypertext_data_finalize (gpointer); static AtkHyperlink* jaw_hypertext_get_link (AtkHypertext *hypertext, gint link_index); static gint jaw_hypertext_get_n_links (AtkHypertext *hypertext); static gint jaw_hypertext_get_link_index (AtkHypertext *hypertext, gint char_index); typedef struct _HypertextData { jobject atk_hypertext; GHashTable *link_table; } HypertextData; void jaw_hypertext_interface_init (AtkHypertextIface *iface) { iface->get_link = jaw_hypertext_get_link; iface->get_n_links = jaw_hypertext_get_n_links; iface->get_link_index = jaw_hypertext_get_link_index; } static void link_destroy_notify (gpointer p) { JawHyperlink* jaw_hyperlink = (JawHyperlink*)p; if(G_OBJECT(jaw_hyperlink) != NULL) g_object_unref(G_OBJECT(jaw_hyperlink)); } gpointer jaw_hypertext_data_init (jobject ac) { HypertextData *data = g_new0(HypertextData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classHypertext = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHypertext"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classHypertext, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_hypertext = (*jniEnv)->NewObject(jniEnv, classHypertext, jmid, ac); data->atk_hypertext = (*jniEnv)->NewGlobalRef(jniEnv, jatk_hypertext); data->link_table = g_hash_table_new_full(NULL, NULL, NULL, link_destroy_notify); return data; } void jaw_hypertext_data_finalize (gpointer p) { HypertextData *data = (HypertextData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_hypertext) { g_hash_table_remove_all(data->link_table); (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_hypertext); data->atk_hypertext = NULL; } } static AtkHyperlink* jaw_hypertext_get_link (AtkHypertext *hypertext, gint link_index) { JawObject *jaw_obj = JAW_OBJECT(hypertext); HypertextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_HYPERTEXT); jobject atk_hypertext = data->atk_hypertext; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHypertext = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHypertext"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHypertext, "get_link", "(I)Lorg/GNOME/Accessibility/AtkHyperlink;"); jobject jhyperlink = (*jniEnv)->CallObjectMethod(jniEnv, atk_hypertext, jmid, (jint)link_index); if (!jhyperlink) { return NULL; } JawHyperlink *jaw_hyperlink = jaw_hyperlink_new(jhyperlink); g_hash_table_insert(data->link_table, GINT_TO_POINTER(link_index), (gpointer)jaw_hyperlink); return ATK_HYPERLINK(jaw_hyperlink); } static gint jaw_hypertext_get_n_links (AtkHypertext *hypertext) { JawObject *jaw_obj = JAW_OBJECT(hypertext); HypertextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_HYPERTEXT); jobject atk_hypertext = data->atk_hypertext; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHypertext = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHypertext"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHypertext, "get_n_links", "()I"); return (gint)(*jniEnv)->CallIntMethod(jniEnv, atk_hypertext, jmid); } static gint jaw_hypertext_get_link_index (AtkHypertext *hypertext, gint char_index) { JawObject *jaw_obj = JAW_OBJECT(hypertext); HypertextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_HYPERTEXT); jobject atk_hypertext = data->atk_hypertext; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkHypertext = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkHypertext"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkHypertext, "get_link_index", "(I)I"); return (gint)(*jniEnv)->CallIntMethod(jniEnv, atk_hypertext, jmid, (jint)char_index); } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawimage.c000066400000000000000000000133341255546517100231340ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_image_interface_init (AtkImageIface*); extern gpointer jaw_image_data_init (jobject ac); extern void jaw_image_data_finalize (gpointer); static void jaw_image_get_image_position (AtkImage *image, gint *x, gint *y, AtkCoordType coord_type); static const gchar* jaw_image_get_image_description(AtkImage *image); static void jaw_image_get_image_size (AtkImage *image, gint *width, gint *height); typedef struct _ImageData { jobject atk_image; gchar* image_description; jstring jstrImageDescription; } ImageData; void jaw_image_interface_init (AtkImageIface *iface) { iface->get_image_position = jaw_image_get_image_position; iface->get_image_description = jaw_image_get_image_description; iface->set_image_description = NULL; iface->get_image_size = jaw_image_get_image_size; } gpointer jaw_image_data_init (jobject ac) { ImageData *data = g_new0(ImageData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classImage = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkImage"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classImage, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_image = (*jniEnv)->NewObject(jniEnv, classImage, jmid, ac); data->atk_image = (*jniEnv)->NewGlobalRef(jniEnv, jatk_image); return data; } void jaw_image_data_finalize (gpointer p) { ImageData *data = (ImageData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_image) { if (data->image_description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrImageDescription, data->image_description); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrImageDescription); data->jstrImageDescription = NULL; data->image_description = NULL; } (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_image); data->atk_image = NULL; } } static void jaw_image_get_image_position (AtkImage *image, gint *x, gint *y, AtkCoordType coord_type) { JawObject *jaw_obj = JAW_OBJECT(image); ImageData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_IMAGE); jobject atk_image = data->atk_image; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkImage = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkImage"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkImage, "get_image_position", "(I)Ljava/awt/Point;"); jobject jpoint = (*jniEnv)->CallObjectMethod(jniEnv, atk_image, jmid, (jint)coord_type); if (jpoint == NULL) { (*x) = 0; (*y) = 0; return; } jclass classPoint = (*jniEnv)->FindClass(jniEnv, "java/awt/Point"); jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classPoint, "x", "I"); jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classPoint, "y", "I"); jint jx = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidX); jint jy = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidY); (*x) = (gint)jx; (*y) = (gint)jy; } static const gchar* jaw_image_get_image_description (AtkImage *image) { JawObject *jaw_obj = JAW_OBJECT(image); ImageData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_IMAGE); jobject atk_image = data->atk_image; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkImage = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkImage"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkImage, "get_image_description", "()Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_image, jmid); if (data->image_description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrImageDescription, data->image_description); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrImageDescription); } data->jstrImageDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr); data->image_description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, data->jstrImageDescription, NULL); return data->image_description; } static void jaw_image_get_image_size (AtkImage *image, gint *width, gint *height) { JawObject *jaw_obj = JAW_OBJECT(image); ImageData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_IMAGE); jobject atk_image = data->atk_image; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkImage = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkImage"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkImage, "get_image_size", "()Ljava/awt/Dimension;"); jobject jdimension = (*jniEnv)->CallObjectMethod(jniEnv, atk_image, jmid); if (jdimension == NULL) { (*width) = 0; (*height) = 0; return; } jclass classDimension = (*jniEnv)->FindClass(jniEnv, "java/awt/Dimension"); jfieldID jfidWidth = (*jniEnv)->GetFieldID(jniEnv, classDimension, "width", "I"); jfieldID jfidHeight = (*jniEnv)->GetFieldID(jniEnv, classDimension, "height", "I"); jint jwidth = (*jniEnv)->GetIntField(jniEnv, jdimension, jfidWidth); jint jheight = (*jniEnv)->GetIntField(jniEnv, jdimension, jfidHeight); (*width) = (gint)jwidth; (*height) = (gint)jheight; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawimpl.c000066400000000000000000000634371255546517100230240ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include #include #include #include "jawutil.h" #include "jawimpl.h" #include "jawtoplevel.h" #include "jawobject.h" #ifdef __cplusplus extern "C" { #endif static void jaw_impl_class_init (JawImplClass *klass); //static void jaw_impl_init (JawImpl *impl); static void jaw_impl_dispose(GObject *gobject); static void jaw_impl_finalize(GObject *gobject); static gpointer jaw_impl_get_interface_data(JawObject *jaw_obj, guint iface); /* AtkObject */ static void jaw_impl_initialize(AtkObject *atk_obj, gpointer data); static AtkObject* jaw_impl_get_parent(AtkObject *atk_obj); static AtkObject* jaw_impl_ref_child (AtkObject *atk_obj, gint i); static AtkRelationSet* jaw_impl_ref_relation_set(AtkObject *atk_obj); extern void jaw_action_interface_init(AtkActionIface*); extern gpointer jaw_action_data_init(jobject); extern void jaw_action_data_finalize(gpointer); extern void jaw_component_interface_init(AtkComponentIface*); extern gpointer jaw_component_data_init(jobject); extern void jaw_component_data_finalize(gpointer); extern void jaw_text_interface_init(AtkTextIface*); extern gpointer jaw_text_data_init(jobject); extern void jaw_text_data_finalize(gpointer); extern void jaw_editable_text_interface_init(AtkEditableTextIface*); extern gpointer jaw_editable_text_data_init(jobject); extern void jaw_editable_text_data_finalize (gpointer); extern void jaw_hypertext_interface_init(AtkHypertextIface*); extern gpointer jaw_hypertext_data_init(jobject); extern void jaw_hypertext_data_finalize(gpointer); extern void jaw_image_interface_init(AtkImageIface*); extern gpointer jaw_image_data_init(jobject); extern void jaw_image_data_finalize(gpointer); extern void jaw_selection_interface_init(AtkSelectionIface*); extern gpointer jaw_selection_data_init(jobject); extern void jaw_selection_data_finalize(gpointer); extern void jaw_value_interface_init (AtkValueIface*); extern gpointer jaw_value_data_init (jobject); extern void jaw_value_data_finalize (gpointer); extern void jaw_table_interface_init (AtkTableIface*); extern gpointer jaw_table_data_init (jobject); extern void jaw_table_data_finalize (gpointer); extern void jaw_table_cell_interface_init (AtkTableCellIface*); extern gpointer jaw_table_cell_data_init (jobject); extern void jaw_table_cell_data_finalize (gpointer); typedef struct _JawInterfaceInfo { void (*finalize) (gpointer); gpointer data; } JawInterfaceInfo; static gpointer jaw_impl_parent_class = NULL; static GHashTable *typeTable = NULL; static GHashTable *objectTable = NULL; static gboolean jaw_debug = FALSE; static void object_table_insert (JNIEnv *jniEnv, jobject ac, JawImpl* jaw_impl) { jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "hashCode", "()I"); gint hash_key = (gint)(*jniEnv)->CallIntMethod(jniEnv, ac, jmid); g_hash_table_insert(objectTable, GINT_TO_POINTER(hash_key), GINT_TO_POINTER(jaw_impl)); } static JawImpl* object_table_lookup (JNIEnv *jniEnv, jobject ac) { jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "hashCode", "()I" ); gint hash_key = (gint)(*jniEnv)->CallIntMethod( jniEnv, ac, jmid ); gpointer value = NULL; if (objectTable==NULL) return NULL; value = g_hash_table_lookup(objectTable, GINT_TO_POINTER(hash_key)); return (JawImpl*)value; } static void object_table_remove(JNIEnv *jniEnv, jobject ac) { jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "hashCode", "()I" ); gint hash_key = (gint)(*jniEnv)->CallIntMethod( jniEnv, ac, jmid ); g_hash_table_remove(objectTable, GINT_TO_POINTER(hash_key)); } GHashTable* jaw_impl_get_object_hash_table(void) { return objectTable; } static void aggregate_interface(JNIEnv *jniEnv, JawObject *jaw_obj, guint tflag) { JawImpl *jaw_impl = JAW_IMPL(tflag, jaw_obj); jobject ac = jaw_obj->acc_context; jaw_impl->ifaceTable = g_hash_table_new(NULL, NULL); if (tflag & INTERFACE_ACTION) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_action_data_init(ac); info->finalize = jaw_action_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_ACTION, (gpointer)info); } if (tflag & INTERFACE_COMPONENT) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_component_data_init(ac); info->finalize = jaw_component_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_COMPONENT, (gpointer)info); } if (tflag & INTERFACE_TEXT) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_text_data_init(ac); info->finalize = jaw_text_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_TEXT, (gpointer)info); } if (tflag & INTERFACE_EDITABLE_TEXT) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_editable_text_data_init(ac); info->finalize = jaw_editable_text_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_EDITABLE_TEXT, (gpointer)info); } if (tflag & INTERFACE_HYPERTEXT) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_hypertext_data_init(ac); info->finalize = jaw_hypertext_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_HYPERTEXT, (gpointer)info); } if (tflag & INTERFACE_IMAGE) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_image_data_init(ac); info->finalize = jaw_image_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_IMAGE, (gpointer)info); } if (tflag & INTERFACE_SELECTION) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_selection_data_init(ac); info->finalize = jaw_selection_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_SELECTION, (gpointer)info); } if (tflag & INTERFACE_VALUE) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_value_data_init(ac); info->finalize = jaw_value_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_VALUE, (gpointer)info); } if (tflag & INTERFACE_TABLE) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_table_data_init(ac); info->finalize = jaw_table_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_TABLE, (gpointer)info); } if (tflag & INTERFACE_TABLE_CELL) { JawInterfaceInfo *info = g_new(JawInterfaceInfo, 1); info->data = jaw_table_cell_data_init(ac); info->finalize = jaw_table_cell_data_finalize; g_hash_table_insert(jaw_impl->ifaceTable, (gpointer)INTERFACE_TABLE_CELL, (gpointer)info); } } JawImpl* jaw_impl_get_instance (JNIEnv *jniEnv, jobject ac) { JawImpl *jaw_impl; jniEnv = jaw_util_get_jni_env(); if (jniEnv == NULL) return NULL; if (objectTable == NULL) objectTable = g_hash_table_new (NULL, NULL); jaw_impl = object_table_lookup(jniEnv, ac); if (jaw_impl == NULL) { jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, ac); if (global_ac != NULL) { guint tflag = jaw_util_get_tflag_from_jobj(jniEnv, global_ac); jaw_impl = (JawImpl*)g_object_new(JAW_TYPE_IMPL(tflag), NULL); if (jaw_impl != NULL) { JawObject *jaw_obj = JAW_OBJECT(jaw_impl); if (jaw_obj != NULL) { jaw_obj->acc_context = global_ac; jaw_obj->storedData = g_hash_table_new(g_str_hash, g_str_equal); aggregate_interface(jniEnv, jaw_obj, tflag); atk_object_initialize(ATK_OBJECT(jaw_impl), NULL); object_table_insert(jniEnv, global_ac, jaw_impl); } else { if (jaw_debug) g_warning("jaw_impl_get_instance: jaw_obj == NULL"); return NULL; } } else { if (jaw_debug) g_warning("jaw_impl_get_instance: jaw_impl == NULL"); } } else { if (jaw_debug) g_warning("jaw_impl_get_instance: global_ac == NULL"); return NULL; } } return jaw_impl; } JawImpl* jaw_impl_find_instance (JNIEnv *jniEnv, jobject ac) { JawImpl *jaw_impl; jaw_impl = object_table_lookup(jniEnv, ac); if (jaw_impl == NULL) { if (jaw_debug) g_warning("jaw_impl_find_instance: jaw_impl"); return NULL; } return jaw_impl; } static void jaw_impl_class_intern_init (gpointer klass) { if (jaw_impl_parent_class == NULL) { jaw_impl_parent_class = g_type_class_peek_parent (klass); } jaw_impl_class_init ((JawImplClass*) klass); } GType jaw_impl_get_type (guint tflag) { GType type; static const GInterfaceInfo atk_action_info = { (GInterfaceInitFunc) jaw_action_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_component_info = { (GInterfaceInitFunc) jaw_component_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_text_info = { (GInterfaceInitFunc) jaw_text_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_editable_text_info = { (GInterfaceInitFunc) jaw_editable_text_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_hypertext_info = { (GInterfaceInitFunc) jaw_hypertext_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_image_info = { (GInterfaceInitFunc) jaw_image_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_selection_info = { (GInterfaceInitFunc) jaw_selection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_value_info = { (GInterfaceInitFunc) jaw_value_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_table_info = { (GInterfaceInitFunc) jaw_table_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; static const GInterfaceInfo atk_table_cell_info = { (GInterfaceInitFunc) jaw_table_cell_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; if (typeTable == NULL) { typeTable = g_hash_table_new( NULL, NULL ); } type = GPOINTER_TO_GTYPE(g_hash_table_lookup(typeTable, GUINT_TO_POINTER(tflag))); if (type == 0) { GTypeInfo tinfo = { sizeof(JawImplClass), (GBaseInitFunc) NULL, /* base init */ (GBaseFinalizeFunc) NULL, /* base finalize */ (GClassInitFunc) jaw_impl_class_intern_init, /*class init */ (GClassFinalizeFunc) NULL, /* class finalize */ NULL, /* class data */ sizeof(JawImpl), /* instance size */ 0, /* nb preallocs */ (GInstanceInitFunc) NULL, /* instance init */ NULL /* value table */ }; gchar className[20]; g_sprintf(className, "JawImpl_%d", tflag); type = g_type_register_static(JAW_TYPE_OBJECT, className, &tinfo, 0); if (tflag & INTERFACE_ACTION) g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info); if (tflag & INTERFACE_COMPONENT) g_type_add_interface_static (type, ATK_TYPE_COMPONENT,&atk_component_info); if (tflag & INTERFACE_TEXT) g_type_add_interface_static (type, ATK_TYPE_TEXT,&atk_text_info); if (tflag & INTERFACE_EDITABLE_TEXT) g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info); if (tflag & INTERFACE_HYPERTEXT) g_type_add_interface_static (type, ATK_TYPE_HYPERTEXT,&atk_hypertext_info); if (tflag & INTERFACE_IMAGE) g_type_add_interface_static (type, ATK_TYPE_IMAGE, &atk_image_info); if (tflag & INTERFACE_SELECTION) g_type_add_interface_static (type, ATK_TYPE_SELECTION, &atk_selection_info); if (tflag & INTERFACE_VALUE) g_type_add_interface_static (type, ATK_TYPE_VALUE, &atk_value_info); if (tflag & INTERFACE_TABLE) g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info); if (tflag & INTERFACE_TABLE_CELL) g_type_add_interface_static (type, ATK_TYPE_TABLE_CELL, &atk_table_cell_info); g_hash_table_insert(typeTable, GINT_TO_POINTER(tflag), GTYPE_TO_POINTER(type)); } return type; } static void jaw_impl_class_init(JawImplClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = jaw_impl_dispose; gobject_class->finalize = jaw_impl_finalize; AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); atk_class->initialize = jaw_impl_initialize; atk_class->get_parent = jaw_impl_get_parent; atk_class->ref_child = jaw_impl_ref_child; atk_class->ref_relation_set = jaw_impl_ref_relation_set; JawObjectClass *jaw_class = JAW_OBJECT_CLASS (klass); jaw_class->get_interface_data = jaw_impl_get_interface_data; } /* static void jaw_impl_init(JawImpl *impl) { jaw_impl->ifaceTable = g_hash_table_new(NULL, NULL); } */ static void jaw_impl_dispose(GObject *gobject) { /* Chain up to parent's dispose */ G_OBJECT_CLASS(jaw_impl_parent_class)->dispose(gobject); } static void jaw_impl_finalize(GObject *gobject) { JawObject *jaw_obj = JAW_OBJECT(gobject); jobject global_ac = jaw_obj->acc_context; JawImpl *jaw_impl = (JawImpl*)jaw_obj; JNIEnv *jniEnv = jaw_util_get_jni_env(); object_table_remove( jniEnv, global_ac ); (*jniEnv)->DeleteGlobalRef(jniEnv, global_ac); jaw_obj->acc_context = NULL; /* Interface finalize */ GHashTableIter *iter = NULL; gpointer *key = NULL; gpointer *value = NULL; g_hash_table_iter_init(iter, jaw_impl->ifaceTable); while (g_hash_table_iter_next(iter, key, value)) { JawInterfaceInfo *info = (JawInterfaceInfo*)value; info->finalize(info->data); g_free(info); g_hash_table_iter_remove(iter); } if (jaw_impl->ifaceTable != NULL) { g_hash_table_unref(jaw_impl->ifaceTable); g_hash_table_destroy(jaw_obj->storedData); } /* Chain up to parent's finalize */ G_OBJECT_CLASS(jaw_impl_parent_class)->finalize(gobject); } static gpointer jaw_impl_get_interface_data (JawObject *jaw_obj, guint iface) { JawImpl *jaw_impl = (JawImpl*)jaw_obj; if (jaw_impl->ifaceTable == NULL || jaw_impl == NULL) return NULL; JawInterfaceInfo *info = g_hash_table_lookup(jaw_impl->ifaceTable,GUINT_TO_POINTER(iface)); if (info != NULL) return info->data; return NULL; } static void jaw_impl_initialize (AtkObject *atk_obj, gpointer data) { ATK_OBJECT_CLASS(jaw_impl_parent_class)->initialize(atk_obj, data); JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkWrapper = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkWrapper"); jmethodID jmid = (*jniEnv)->GetStaticMethodID(jniEnv, classAtkWrapper, "registerPropertyChangeListener", "(Ljavax/accessibility/AccessibleContext;)V"); (*jniEnv)->CallStaticVoidMethod(jniEnv, classAtkWrapper, jmid, ac); } static AtkObject* jaw_impl_get_parent (AtkObject *atk_obj) { if (jaw_toplevel_get_child_index(JAW_TOPLEVEL(atk_get_root()), atk_obj) != -1) { return ATK_OBJECT(atk_get_root()); } JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleParent", "()Ljavax/accessibility/Accessible;"); jobject jparent = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (jparent != NULL ) { jclass classAccessible = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); jobject parent_ac = (*jniEnv)->CallObjectMethod( jniEnv, jparent, jmid ); AtkObject *obj = (AtkObject*) object_table_lookup( jniEnv, parent_ac ); if (obj != NULL ) { return obj; } } return ATK_OBJECT(atk_get_root()); } static AtkObject* jaw_impl_ref_child (AtkObject *atk_obj, gint i) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleChild", "(I)Ljavax/accessibility/Accessible;" ); jobject jchild = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid, i ); if (jchild == NULL) { return NULL; } jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;" ); jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid ); AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac ); if (G_OBJECT(obj) != NULL) g_object_ref(G_OBJECT(obj)); return obj; } static jstring get_java_relation_key_constant (JNIEnv *jniEnv, const gchar* strKey) { jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleRelation"); jfieldID jfid = (*jniEnv)->GetStaticFieldID(jniEnv, classAccessibleRelation, strKey, "Ljava/lang/String;"); jstring jkey = (*jniEnv)->GetStaticObjectField(jniEnv, classAccessibleRelation, jfid); return jkey; } static gboolean is_java_relation_key (JNIEnv *jniEnv,jstring jKey, const gchar* strKey) { jstring jConstKey = get_java_relation_key_constant (jniEnv, strKey); if ( (*jniEnv)->IsSameObject(jniEnv, jKey, jConstKey) ) { return TRUE; } else { return FALSE; } } static AtkRelationType get_atk_relation_type_from_java_key (JNIEnv *jniEnv, jstring jrel_key) { if ( is_java_relation_key(jniEnv, jrel_key, "CHILD_NODE_OF") ) { return ATK_RELATION_NODE_CHILD_OF; } if ( is_java_relation_key(jniEnv, jrel_key, "CONTROLLED_BY") ) { return ATK_RELATION_CONTROLLED_BY; } if ( is_java_relation_key(jniEnv, jrel_key, "CONTROLLER_FOR") ) { return ATK_RELATION_CONTROLLER_FOR; } if ( is_java_relation_key(jniEnv, jrel_key, "EMBEDDED_BY") ) { return ATK_RELATION_EMBEDDED_BY; } if ( is_java_relation_key(jniEnv, jrel_key, "EMBEDS") ) { return ATK_RELATION_EMBEDS; } if ( is_java_relation_key(jniEnv, jrel_key, "FLOWS_FROM") ) { return ATK_RELATION_FLOWS_FROM; } if ( is_java_relation_key(jniEnv, jrel_key, "FLOWS_TO") ) { return ATK_RELATION_FLOWS_TO; } if ( is_java_relation_key(jniEnv, jrel_key, "LABEL_FOR") ) { return ATK_RELATION_LABEL_FOR; } if ( is_java_relation_key(jniEnv, jrel_key, "LABELED_BY") ) { return ATK_RELATION_LABELLED_BY; } if ( is_java_relation_key(jniEnv, jrel_key, "MEMBER_OF") ) { return ATK_RELATION_MEMBER_OF; } if ( is_java_relation_key(jniEnv, jrel_key, "PARENT_WINDOW_OF") ) { return ATK_RELATION_PARENT_WINDOW_OF; } if ( is_java_relation_key(jniEnv, jrel_key, "SUBWINDOW_OF") ) { return ATK_RELATION_SUBWINDOW_OF; } return ATK_RELATION_NULL; } AtkRelationType jaw_impl_get_atk_relation_type(JNIEnv *env, jstring jrel_key) { return get_atk_relation_type_from_java_key(env, jrel_key); } static AtkRelationSet* jaw_impl_ref_relation_set (AtkObject *atk_obj) { if (atk_obj->relation_set) g_object_unref(G_OBJECT(atk_obj->relation_set)); atk_obj->relation_set = atk_relation_set_new(); if(atk_obj == NULL) return NULL; JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleRelationSet", "()Ljavax/accessibility/AccessibleRelationSet;" ); jobject jrel_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); jclass classAccessibleRelationSet = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleRelationSet"); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelationSet, "toArray", "()[Ljavax/accessibility/AccessibleRelation;"); jobjectArray jrel_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel_set, jmid); jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jrel_arr); jsize i; for (i = 0; i < jarr_size; i++) { jobject jrel = (*jniEnv)->GetObjectArrayElement(jniEnv, jrel_arr, i); jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleRelation"); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelation, "getKey", "()Ljava/lang/String;"); jstring jrel_key = (*jniEnv)->CallObjectMethod( jniEnv, jrel, jmid ); AtkRelationType rel_type = get_atk_relation_type_from_java_key(jniEnv, jrel_key); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelation, "getTarget", "()[Ljava/lang/Object;"); jobjectArray jtarget_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel, jmid); jsize jtarget_size = (*jniEnv)->GetArrayLength(jniEnv, jtarget_arr); jsize j; for (j = 0; j < jtarget_size; j++) { jobject jtarget = (*jniEnv)->GetObjectArrayElement(jniEnv, jtarget_arr, j); jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible"); if ((*jniEnv)->IsInstanceOf(jniEnv, jtarget, classAccessible)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); jobject target_ac = (*jniEnv)->CallObjectMethod(jniEnv, jtarget, jmid); JawImpl *target_obj = jaw_impl_get_instance(jniEnv, target_ac); if(target_obj == NULL) return NULL; atk_object_add_relationship(atk_obj, rel_type, (AtkObject*) target_obj); } } } if(atk_obj->relation_set == NULL) return NULL; if (G_OBJECT(atk_obj->relation_set) != NULL) g_object_ref (atk_obj->relation_set); return atk_obj->relation_set; } #ifdef __cplusplus } #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawimpl.h000066400000000000000000000041351255546517100230170ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 _JAW_IMPL_H_ #define _JAW_IMPL_H_ #include #include "jawobject.h" G_BEGIN_DECLS #define JAW_TYPE_IMPL(tf) (jaw_impl_get_type (tf)) #define JAW_IMPL(tf, obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_IMPL(tf), JawImpl)) #define JAW_IMPL_CLASS(tf, klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_IMPL(tf), JawImplClass)) #define JAW_IS_IMPL(tf, obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_IMPL(tf))) #define JAW_IS_IMPL_CLASS(tf, klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_IMPL(tf))) #define JAW_IMPL_GET_CLASS(tf, obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_IMPL(tf), JawImplClass)) #ifdef GPOINTER_TO_SIZE #define GPOINTER_TO_GTYPE(gpointer) (GPOINTER_TO_SIZE (gpointer)) #endif #ifdef GSIZE_TO_POINTER #define GTYPE_TO_POINTER(gtype) (GSIZE_TO_POINTER(gtype)) #endif typedef struct _JawImpl JawImpl; typedef struct _JawImplClass JawImplClass; struct _JawImpl { JawObject parent; GHashTable *ifaceTable; }; JawImpl* jaw_impl_get_instance(JNIEnv*, jobject); JawImpl* jaw_impl_find_instance(JNIEnv*, jobject); GHashTable* jaw_impl_get_object_hash_table(void); GType jaw_impl_get_type (guint); AtkRelationType jaw_impl_get_atk_relation_type(JNIEnv *jniEnv, jstring jrel_key); struct _JawImplClass { JawObjectClass parent_class; }; G_END_DECLS #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawobject.c000066400000000000000000000610621255546517100233210ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include "jawobject.h" #include "jawutil.h" #include "jawimpl.h" #include "jawtoplevel.h" #ifdef __cplusplus extern "C" { #endif static void jaw_object_class_init(JawObjectClass *klass); static void jaw_object_init(JawObject *object); static void jaw_object_initialize(AtkObject *jaw_obj, gpointer data); static void jaw_object_dispose(GObject *gobject); static void jaw_object_finalize(GObject *gobject); /* AtkObject */ static const gchar* jaw_object_get_name(AtkObject *atk_obj); static const gchar* jaw_object_get_description(AtkObject *atk_obj); static gint jaw_object_get_n_children(AtkObject *atk_obj); static gint jaw_object_get_index_in_parent(AtkObject *atk_obj); static AtkRole jaw_object_get_role(AtkObject *atk_obj); static AtkStateSet* jaw_object_ref_state_set(AtkObject *atk_obj); static AtkObject* jaw_object_get_parent(AtkObject *obj); static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name); static void jaw_object_set_description (AtkObject *atk_obj, const gchar *description); static void jaw_object_set_parent(AtkObject *atk_obj, AtkObject *parent); static void jaw_object_set_role (AtkObject *atk_obj, AtkRole role); static const gchar *jaw_object_get_object_locale (AtkObject *atk_obj); static AtkRelationSet *jaw_object_ref_relation_set (AtkObject *atk_obj); static AtkObject *jaw_object_ref_child(AtkObject *atk_obj, gint i); static gpointer parent_class = NULL; static GHashTable *object_table = NULL; static JawObject* jaw_object_table_lookup (JNIEnv *jniEnv, jobject ac); enum { ACTIVATE, CREATE, DEACTIVATE, DESTROY, MAXIMIZE, MINIMIZE, MOVE, RESIZE, RESTORE, LAST_SIGNAL }; static guint jaw_window_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE (JawObject, jaw_object, ATK_TYPE_OBJECT); static guint jaw_window_add_signal (const gchar *name, JawObjectClass *klass) { return g_signal_new (name, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, 0, (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } static void jaw_object_class_init (JawObjectClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS(klass); gobject_class->dispose = jaw_object_dispose; gobject_class->finalize = jaw_object_finalize; AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); atk_class->get_name = jaw_object_get_name; atk_class->set_name = jaw_object_set_name; atk_class->get_description = jaw_object_get_description; atk_class->set_description = jaw_object_set_description; atk_class->get_n_children = jaw_object_get_n_children; atk_class->get_index_in_parent = jaw_object_get_index_in_parent; atk_class->get_role = jaw_object_get_role; atk_class->get_parent = jaw_object_get_parent; atk_class->set_parent = jaw_object_set_parent; atk_class->set_role = jaw_object_set_role; atk_class->get_object_locale = jaw_object_get_object_locale; atk_class->ref_relation_set = jaw_object_ref_relation_set; atk_class->ref_child = jaw_object_ref_child; atk_class->ref_state_set = jaw_object_ref_state_set; atk_class->initialize = jaw_object_initialize; jaw_window_signals[ACTIVATE] = jaw_window_add_signal ("activate", klass); jaw_window_signals[CREATE] = jaw_window_add_signal ("create", klass); jaw_window_signals[DEACTIVATE] = jaw_window_add_signal ("deactivate", klass); jaw_window_signals[DESTROY] = jaw_window_add_signal ("destroy", klass); jaw_window_signals[MAXIMIZE] = jaw_window_add_signal ("maximize", klass); jaw_window_signals[MINIMIZE] = jaw_window_add_signal ("minimize", klass); jaw_window_signals[MOVE] = jaw_window_add_signal ("move", klass); jaw_window_signals[RESIZE] = jaw_window_add_signal ("resize", klass); jaw_window_signals[RESTORE] = jaw_window_add_signal ("restore", klass); klass->get_interface_data = NULL; } static void jaw_object_initialize(AtkObject *atk_obj, gpointer data) { ATK_OBJECT_CLASS (jaw_object_parent_class)->initialize(atk_obj, data); } gpointer jaw_object_get_interface_data (JawObject *jaw_obj, guint iface) { JawObjectClass *klass = JAW_OBJECT_GET_CLASS(jaw_obj); if (klass->get_interface_data) return klass->get_interface_data(jaw_obj, iface); return NULL; } static void jaw_object_init (JawObject *object) { AtkObject *atk_obj = ATK_OBJECT(object); atk_obj->description = NULL; object->state_set = atk_state_set_new(); } static void jaw_object_dispose (GObject *gobject) { /* Customized dispose code */ /* Chain up to parent's dispose method */ G_OBJECT_CLASS(jaw_object_parent_class)->dispose(gobject); } static void jaw_object_finalize (GObject *gobject) { /* Customized finalize code */ JawObject *jaw_obj = JAW_OBJECT(gobject); AtkObject *atk_obj = ATK_OBJECT(gobject); JNIEnv *jniEnv = jaw_util_get_jni_env(); if (atk_obj->name != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName); jaw_obj->jstrName = NULL; atk_obj->name = NULL; } if (atk_obj->description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, atk_obj->description); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription); jaw_obj->jstrDescription = NULL; atk_obj->description = NULL; } if (G_OBJECT(jaw_obj->state_set) != NULL) { g_object_unref(G_OBJECT(jaw_obj->state_set)); /* Chain up to parent's finalize method */ G_OBJECT_CLASS(jaw_object_parent_class)->finalize(gobject); } } static AtkObject* jaw_object_get_parent(AtkObject *atk_obj) { if (jaw_toplevel_get_child_index(JAW_TOPLEVEL(atk_get_root()), atk_obj) != -1) { return ATK_OBJECT(atk_get_root()); } JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleParent", "()Ljavax/accessibility/AccessibleContext;"); jobject jparent = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (jparent != NULL ) { jclass classAccessible = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); jobject parent_ac = (*jniEnv)->CallObjectMethod(jniEnv, jparent, jmid); AtkObject *parent_obj = (AtkObject*) jaw_object_table_lookup( jniEnv, parent_ac ); if (parent_obj != NULL ) return parent_obj; } return ATK_OBJECT(atk_get_root()); } static void jaw_object_set_parent(AtkObject *atk_obj, AtkObject *parent) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "setAccessibleParent", "(Ljavax/accessibility/AccessibleContext;)"); jobject jparent = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (jparent != NULL ) { jclass classAccessible = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); jobject parent_ac = (*jniEnv)->CallObjectMethod(jniEnv, jparent, jmid); AtkObject *parent_obj = (AtkObject*) jaw_object_table_lookup( jniEnv, parent_ac ); if (parent_obj == NULL) return; } } static const gchar* jaw_object_get_name (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); atk_obj->name = (gchar *)ATK_OBJECT_CLASS (parent_class)->get_name (atk_obj); if (atk_object_get_role(atk_obj) == ATK_ROLE_COMBO_BOX && atk_object_get_n_accessible_children(atk_obj) == 1) { AtkSelection *selection = ATK_SELECTION(atk_obj); if (selection != NULL) { AtkObject *child = atk_selection_ref_selection(selection, 0); if (child != NULL) { return atk_object_get_name(child); } } } jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleName", "()Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (atk_obj->name != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName); } if (jstr != NULL) { jaw_obj->jstrName = (*jniEnv)->NewGlobalRef(jniEnv, jstr); atk_obj->name = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrName, NULL); } return atk_obj->name; } static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); atk_obj->name = (gchar *)ATK_OBJECT_CLASS (parent_class)->get_name (atk_obj); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "setAccessibleName", "(Ljava/lang/String;)"); jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (atk_obj->name != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName); } if (jstr != NULL) { jaw_obj->jstrName = (*jniEnv)->NewGlobalRef(jniEnv, jstr); atk_obj->name = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrName, NULL); } if (jstr == NULL) { name = ""; return; } } static const gchar* jaw_object_get_description (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleDescription", "()Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (atk_obj->description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, atk_obj->description); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription); atk_obj->description = NULL; } if (jstr != NULL) { jaw_obj->jstrDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr); atk_obj->description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrDescription, NULL); } return atk_obj->description; } static void jaw_object_set_description (AtkObject *atk_obj, const gchar *description) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "setAccessibleDescription", "(Ljava/lang/String;)"); jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); if (description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, description); (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription); description = NULL; } if (jstr != NULL) { jaw_obj->jstrDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr); description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrDescription, NULL); } if (jstr != NULL) { description = ""; } } static gint jaw_object_get_n_children (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleChildrenCount", "()I"); jint count = (*jniEnv)->CallIntMethod( jniEnv, ac, jmid ); return (gint)count; } static gint jaw_object_get_index_in_parent (AtkObject *atk_obj) { if (jaw_toplevel_get_child_index(JAW_TOPLEVEL(atk_get_root()), atk_obj) != -1) { return jaw_toplevel_get_child_index(JAW_TOPLEVEL(atk_get_root()), atk_obj); } JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleIndexInParent", "()I"); jint index = (*jniEnv)->CallIntMethod( jniEnv, ac, jmid ); return (gint)index; } static AtkRole jaw_object_get_role (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); atk_obj->role = jaw_util_get_atk_role_from_jobj(jaw_obj->acc_context); return atk_obj->role; } static void jaw_object_set_role (AtkObject *atk_obj, AtkRole role) { atk_obj->role = role; if (atk_obj != NULL && atk_obj->role) atk_object_set_role(atk_obj, atk_obj->role); } static AtkStateSet* jaw_object_ref_state_set (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); AtkStateSet* state_set = jaw_obj->state_set; atk_state_set_clear_states( state_set ); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleStateSet", "()Ljavax/accessibility/AccessibleStateSet;" ); jobject jstate_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); jclass classAccessibleStateSet = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleStateSet" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleStateSet, "toArray", "()[Ljavax/accessibility/AccessibleState;"); jobjectArray jstate_arr = (*jniEnv)->CallObjectMethod( jniEnv, jstate_set, jmid ); jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jstate_arr); jsize i; for (i = 0; i < jarr_size; i++) { jobject jstate = (*jniEnv)->GetObjectArrayElement( jniEnv, jstate_arr, i ); AtkStateType state_type = jaw_util_get_atk_state_type_from_java_state( jniEnv, jstate ); atk_state_set_add_state( state_set, state_type ); if (state_type == ATK_STATE_ENABLED) { atk_state_set_add_state( state_set, ATK_STATE_SENSITIVE ); } } if (G_OBJECT(state_set) != NULL) g_object_ref(G_OBJECT(state_set)); return state_set; } static const gchar *jaw_object_get_object_locale (AtkObject *atk_obj) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getLocale", "()Ljavax/accessibility/AccessibleContext;"); jobject locale = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); JawImpl *target_obj = jaw_impl_get_instance(jniEnv, locale); if(target_obj == NULL) return NULL; return atk_object_get_object_locale((AtkObject*) target_obj); } static AtkRelationSet* jaw_object_ref_relation_set (AtkObject *atk_obj) { if (atk_obj->relation_set) g_object_unref(G_OBJECT(atk_obj->relation_set)); atk_obj->relation_set = atk_relation_set_new(); if(atk_obj == NULL) return NULL; JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleRelationSet", "()Ljavax/accessibility/AccessibleRelationSet;" ); jobject jrel_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid ); jclass classAccessibleRelationSet = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleRelationSet"); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelationSet, "toArray", "()[Ljavax/accessibility/AccessibleRelation;"); jobjectArray jrel_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel_set, jmid); jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jrel_arr); jsize i; for (i = 0; i < jarr_size; i++) { jobject jrel = (*jniEnv)->GetObjectArrayElement(jniEnv, jrel_arr, i); jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleRelation"); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelation, "getKey", "()Ljava/lang/String;"); jstring jrel_key = (*jniEnv)->CallObjectMethod( jniEnv, jrel, jmid ); AtkRelationType rel_type = jaw_impl_get_atk_relation_type(jniEnv, jrel_key); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRelation, "getTarget", "()[Ljava/lang/Object;"); jobjectArray jtarget_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel, jmid); jsize jtarget_size = (*jniEnv)->GetArrayLength(jniEnv, jtarget_arr); jsize j; for (j = 0; j < jtarget_size; j++) { jobject jtarget = (*jniEnv)->GetObjectArrayElement(jniEnv, jtarget_arr, j); jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible"); if ((*jniEnv)->IsInstanceOf(jniEnv, jtarget, classAccessible)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); jobject target_ac = (*jniEnv)->CallObjectMethod(jniEnv, jtarget, jmid); JawImpl *target_obj = jaw_impl_get_instance(jniEnv, target_ac); if(target_obj == NULL) return NULL; atk_object_add_relationship(atk_obj, rel_type, ATK_OBJECT(target_obj)); } } } if(atk_obj->relation_set == NULL) return NULL; if (G_OBJECT(atk_obj->relation_set) != NULL) g_object_ref (atk_obj->relation_set); return atk_obj->relation_set; } static AtkObject* jaw_object_ref_child(AtkObject *atk_obj, gint i) { JawObject *jaw_obj = JAW_OBJECT(atk_obj); jobject ac = jaw_obj->acc_context; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleChild", "(I)Ljavax/accessibility/Accessible;" ); jobject jchild = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid, i ); if (jchild == NULL) { return NULL; } jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;" ); jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid ); AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac ); if (G_OBJECT(obj) != NULL) g_object_ref(G_OBJECT(obj)); return obj; } static JawObject* jaw_object_table_lookup (JNIEnv *jniEnv, jobject ac) { object_table = jaw_impl_get_object_hash_table(); jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" ); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "hashCode", "()I" ); gint hash_key = (gint)(*jniEnv)->CallIntMethod( jniEnv, ac, jmid ); gpointer value = NULL; if (object_table == NULL) return NULL; value = g_hash_table_lookup(object_table, GINT_TO_POINTER(hash_key)); return (JawObject*)value; } #ifdef __cplusplus } #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawobject.h000066400000000000000000000036051255546517100233250ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 _JAW_OBJECT_H_ #define _JAW_OBJECT_H_ #include #include G_BEGIN_DECLS #define JAW_TYPE_OBJECT (jaw_object_get_type ()) #define JAW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_OBJECT, JawObject)) #define JAW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_OBJECT, JawObjectClass)) #define JAW_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_OBJECT)) #define JAW_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_OBJECT)) #define JAW_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_OBJECT, JawObjectClass)) typedef struct _JawObject JawObject; typedef struct _JawObjectClass JawObjectClass; struct _JawObject { AtkObject parent; jobject acc_context; jstring jstrName; jstring jstrDescription; AtkStateSet *state_set; GHashTable *storedData; }; GType jaw_object_get_type (void); struct _JawObjectClass { AtkObjectClass parent_class; gpointer (*get_interface_data) (JawObject*, guint); }; gpointer jaw_object_get_interface_data (JawObject*, guint); G_END_DECLS #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawselection.c000066400000000000000000000173271255546517100240450ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_selection_interface_init (AtkSelectionIface*); extern gpointer jaw_selection_data_init (jobject ac); extern void jaw_selection_data_finalize (gpointer); static gboolean jaw_selection_add_selection (AtkSelection *selection, gint i); static gboolean jaw_selection_clear_selection (AtkSelection *selection); static AtkObject* jaw_selection_ref_selection (AtkSelection *selection, gint i); static gint jaw_selection_get_selection_count (AtkSelection *selection); static gboolean jaw_selection_is_child_selected (AtkSelection *selection, gint i); static gboolean jaw_selection_remove_selection (AtkSelection *selection, gint i); static gboolean jaw_selection_select_all_selection (AtkSelection *selection); typedef struct _SelectionData { jobject atk_selection; } SelectionData; void jaw_selection_interface_init (AtkSelectionIface *iface) { iface->add_selection = jaw_selection_add_selection; iface->clear_selection = jaw_selection_clear_selection; iface->ref_selection = jaw_selection_ref_selection; iface->get_selection_count = jaw_selection_get_selection_count; iface->is_child_selected = jaw_selection_is_child_selected; iface->remove_selection = jaw_selection_remove_selection; iface->select_all_selection = jaw_selection_select_all_selection; } gpointer jaw_selection_data_init (jobject ac) { SelectionData *data = g_new0(SelectionData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classSelection, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_selection = (*jniEnv)->NewObject(jniEnv, classSelection, jmid, ac); data->atk_selection = (*jniEnv)->NewGlobalRef(jniEnv, jatk_selection); return data; } void jaw_selection_data_finalize (gpointer p) { SelectionData *data = (SelectionData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_selection) { (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_selection); data->atk_selection = NULL; } } static gboolean jaw_selection_add_selection (AtkSelection *selection, gint i) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "add_selection", "(I)Z"); jboolean jbool = (*jniEnv)->CallBooleanMethod(jniEnv, atk_selection, jmid, (jint)i); if (jbool == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_selection_clear_selection (AtkSelection *selection) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "clear_selection", "()Z"); jboolean jbool = (*jniEnv)->CallBooleanMethod(jniEnv, atk_selection, jmid); if (jbool == JNI_TRUE) { return TRUE; } else { return FALSE; } } static AtkObject* jaw_selection_ref_selection (AtkSelection *selection, gint i) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "ref_selection", "(I)Ljavax/accessibility/Accessible;"); jobject jchild = (*jniEnv)->CallObjectMethod(jniEnv, atk_selection, jmid, (jint)i); jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" ); jmid = (*jniEnv)->GetMethodID( jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;" ); jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid ); AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac ); g_object_ref (G_OBJECT(obj)); return obj; } static gint jaw_selection_get_selection_count (AtkSelection *selection) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "get_selection_count", "()I"); jint jcount = (*jniEnv)->CallIntMethod(jniEnv, atk_selection, jmid); return (gint)jcount; } static gboolean jaw_selection_is_child_selected (AtkSelection *selection, gint i) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "is_child_selected", "(I)Z"); jboolean jbool = (*jniEnv)->CallBooleanMethod(jniEnv, atk_selection, jmid, (jint)i); if (jbool == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_selection_remove_selection (AtkSelection *selection, gint i) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "remove_selection", "(I)Z"); jboolean jbool = (*jniEnv)->CallBooleanMethod(jniEnv, atk_selection, jmid, (jint)i); if (jbool == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_selection_select_all_selection (AtkSelection *selection) { JawObject *jaw_obj = JAW_OBJECT(selection); SelectionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_SELECTION); jobject atk_selection = data->atk_selection; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkSelection = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkSelection"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkSelection, "select_all_selection", "()Z"); jboolean jbool = (*jniEnv)->CallBooleanMethod(jniEnv, atk_selection, jmid); if (jbool == JNI_TRUE) { return TRUE; } else { return FALSE; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawtable.c000066400000000000000000000565211255546517100231460ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_table_interface_init (AtkTableIface*); extern gpointer jaw_table_data_init (jobject ac); extern void jaw_table_data_finalize (gpointer); static AtkObject* jaw_table_ref_at(AtkTable *table, gint row, gint column); static gint jaw_table_get_column_at_index(AtkTable *table, gint index); static gint jaw_table_get_row_at_index(AtkTable *table, gint index); static gint jaw_table_get_n_columns(AtkTable *table); static gint jaw_table_get_n_rows(AtkTable *table); static gint jaw_table_get_column_extent_at(AtkTable *table, gint row, gint column); static gint jaw_table_get_row_extent_at(AtkTable *table, gint row, gint column); static AtkObject* jaw_table_get_caption(AtkTable *table); static const gchar* jaw_table_get_column_description(AtkTable *table, gint column); static const gchar* jaw_table_get_row_description(AtkTable *table, gint row); static AtkObject* jaw_table_get_column_header(AtkTable *table, gint column); static AtkObject* jaw_table_get_row_header(AtkTable *table, gint row); static AtkObject* jaw_table_get_summary(AtkTable *table); static gint jaw_table_get_selected_columns(AtkTable *table, gint **selected); static gint jaw_table_get_selected_rows(AtkTable *table, gint **selected); static gboolean jaw_table_is_column_selected(AtkTable *table, gint column); static gboolean jaw_table_is_row_selected(AtkTable *table, gint row); static gboolean jaw_table_is_selected(AtkTable *table,gint row, gint column); static gboolean jaw_table_add_row_selection(AtkTable *table, gint row); static gboolean jaw_table_add_column_selection(AtkTable *table, gint column); static void jaw_table_set_row_description(AtkTable *table, gint row, const gchar *description); static void jaw_table_set_column_description(AtkTable *table, gint column, const gchar *description); static void jaw_table_set_row_header(AtkTable *table, gint row, AtkObject *header); static void jaw_table_set_column_header(AtkTable *table, gint column, AtkObject *header); static void jaw_table_set_caption(AtkTable *table, AtkObject *caption); static void jaw_table_set_summary(AtkTable *table, AtkObject *summary); typedef struct _TableData { jobject atk_table; gchar* description; jstring jstrDescription; } TableData; void jaw_table_interface_init (AtkTableIface *iface) { iface->ref_at = jaw_table_ref_at; iface->get_column_at_index = jaw_table_get_column_at_index; iface->get_row_at_index = jaw_table_get_row_at_index; iface->get_n_columns = jaw_table_get_n_columns; iface->get_n_rows = jaw_table_get_n_rows; iface->get_column_extent_at = jaw_table_get_column_extent_at; iface->get_row_extent_at = jaw_table_get_row_extent_at; iface->get_caption = jaw_table_get_caption; iface->get_column_description = jaw_table_get_column_description; iface->get_row_description = jaw_table_get_row_description; iface->get_column_header = jaw_table_get_column_header; iface->get_row_header = jaw_table_get_row_header; iface->get_summary = jaw_table_get_summary; iface->get_selected_columns = jaw_table_get_selected_columns; iface->get_selected_rows = jaw_table_get_selected_rows; iface->is_column_selected = jaw_table_is_column_selected; iface->is_row_selected = jaw_table_is_row_selected; iface->is_selected = jaw_table_is_selected; iface->add_row_selection = jaw_table_add_row_selection; iface->add_column_selection = jaw_table_add_column_selection; iface->set_row_description = jaw_table_set_row_description; iface->set_column_description = jaw_table_set_column_description; iface->set_row_header = jaw_table_set_row_header; iface->set_column_header = jaw_table_set_column_header; iface->set_caption = jaw_table_set_caption; iface->set_summary = jaw_table_set_summary; } gpointer jaw_table_data_init (jobject ac) { TableData *data = g_new0(TableData, 1); JNIEnv *env = jaw_util_get_jni_env(); jclass classTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classTable, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_table = (*env)->NewObject(env, classTable, jmid, ac); data->atk_table = (*env)->NewGlobalRef(env, jatk_table); return data; } void jaw_table_data_finalize (gpointer p) { TableData *data = (TableData*)p; JNIEnv *env = jaw_util_get_jni_env(); if (data && data->atk_table) { if (data->description != NULL) { (*env)->ReleaseStringUTFChars(env, data->jstrDescription, data->description); (*env)->DeleteGlobalRef(env, data->jstrDescription); data->jstrDescription = NULL; data->description = NULL; } (*env)->DeleteGlobalRef(env, data->atk_table); data->atk_table = NULL; } } static AtkObject* jaw_table_ref_at (AtkTable *table, gint row, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "ref_at", "(II)Ljavax/accessibility/AccessibleContext;"); jobject jac = (*env)->CallObjectMethod(env, atk_table, jmid, (jint)row, (jint)column); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance( env, jac ); if (G_OBJECT(jaw_impl) != NULL) g_object_ref(G_OBJECT(jaw_impl)); return ATK_OBJECT(jaw_impl); } static gint jaw_table_get_column_at_index (AtkTable *table, gint index) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_column_at_index", "(I)I"); jint jcolumn = (*env)->CallIntMethod(env, atk_table, jmid, (jint)index); return (gint)jcolumn; } static gint jaw_table_get_row_at_index (AtkTable *table, gint index) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_row_at_index", "(I)I"); jint jrow = (*env)->CallIntMethod(env, atk_table, jmid, (jint)index); return (gint)jrow; } static gint jaw_table_get_n_columns (AtkTable *table) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_n_columns", "()I"); jint jcolumns = (*env)->CallIntMethod(env, atk_table, jmid); return (gint)jcolumns; } static gint jaw_table_get_n_rows (AtkTable *table) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_n_rows", "()I"); jint jrows = (*env)->CallIntMethod(env, atk_table, jmid); return (gint)jrows; } static gint jaw_table_get_column_extent_at (AtkTable *table, gint row, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_column_extent_at", "(II)I"); jint jextent = (*env)->CallIntMethod(env, atk_table, jmid, (jint)row, (jint)column); return (gint)jextent; } static gint jaw_table_get_row_extent_at (AtkTable *table, gint row, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_row_extent_at", "(II)I"); jint jextent = (*env)->CallIntMethod(env, atk_table, jmid, (jint)row, (jint)column); return (gint)jextent; } static AtkObject* jaw_table_get_caption (AtkTable *table) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_caption", "()Ljavax/accessibility/AccessibleContext;"); jobject jac = (*env)->CallObjectMethod(env, atk_table, jmid); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance( env, jac ); return ATK_OBJECT(jaw_impl); } static const gchar* jaw_table_get_column_description (AtkTable *table, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_column_description", "(I)Ljava/lang/String;"); jstring jstr = (*env)->CallObjectMethod(env, atk_table, jmid, (jint)column); if (data->description != NULL) { (*env)->ReleaseStringUTFChars(env, data->jstrDescription, data->description); (*env)->DeleteGlobalRef(env, data->jstrDescription); } data->jstrDescription = (*env)->NewGlobalRef(env, jstr); data->description = (gchar*)(*env)->GetStringUTFChars(env, data->jstrDescription, NULL); return data->description; } static const gchar* jaw_table_get_row_description (AtkTable *table, gint row) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_row_description", "(I)Ljava/lang/String;"); jstring jstr = (*env)->CallObjectMethod(env, atk_table, jmid, (jint)row); if (data->description != NULL) { (*env)->ReleaseStringUTFChars(env, data->jstrDescription, data->description); (*env)->DeleteGlobalRef(env, data->jstrDescription); } data->jstrDescription = (*env)->NewGlobalRef(env, jstr); data->description = (gchar*)(*env)->GetStringUTFChars(env, data->jstrDescription, NULL); return data->description; } static AtkObject* jaw_table_get_column_header (AtkTable *table, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_column_header", "(I)Ljavax/accessibility/AccessibleContext;"); jobject jac = (*env)->CallObjectMethod(env, atk_table, jmid, (jint)column); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance( env, jac ); return ATK_OBJECT(jaw_impl); } static AtkObject* jaw_table_get_row_header (AtkTable *table, gint row) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_row_header", "(I)Ljavax/accessibility/AccessibleContext;"); jobject jac = (*env)->CallObjectMethod(env, atk_table, jmid, (jint)row); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance( env, jac ); return ATK_OBJECT(jaw_impl); } static AtkObject* jaw_table_get_summary (AtkTable *table) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_summary", "()Ljavax/accessibility/AccessibleContext;"); jobject jac = (*env)->CallObjectMethod(env, atk_table, jmid); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance( env, jac ); return ATK_OBJECT(jaw_impl); } static gint jaw_table_get_selected_columns (AtkTable *table, gint **selected) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_selected_columns", "()[I"); jintArray jcolumnArray = (*env)->CallObjectMethod(env, atk_table, jmid); if (!jcolumnArray) return 0; jsize length = (*env)->GetArrayLength(env, jcolumnArray); jint *jcolumns = (*env)->GetIntArrayElements(env, jcolumnArray, NULL); gint *columns = g_new(gint, length); gint i; for (i = 0; i < length; i++) { columns[i] = (gint)jcolumns[i]; } (*env)->ReleaseIntArrayElements(env, jcolumnArray, jcolumns, JNI_ABORT); return (gint)length; } static gint jaw_table_get_selected_rows (AtkTable *table, gint **selected) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "get_selected_rows", "()[I"); jintArray jrowArray = (*env)->CallObjectMethod(env, atk_table, jmid); if (!jrowArray) return 0; jsize length = (*env)->GetArrayLength(env, jrowArray); jint *jrows = (*env)->GetIntArrayElements(env, jrowArray, NULL); gint *rows = g_new(gint, length); gint i; for (i = 0; i < length; i++) { rows[i] = (gint)jrows[i]; } (*env)->ReleaseIntArrayElements(env, jrowArray, jrows, JNI_ABORT); return (gint)length; } static gboolean jaw_table_is_column_selected (AtkTable *table, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "is_column_selected", "(I)Z"); jboolean jselected = (*env)->CallBooleanMethod(env, atk_table, jmid, (jint)column); if (jselected == JNI_TRUE) return TRUE; return FALSE; } static gboolean jaw_table_is_row_selected (AtkTable *table, gint row) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "is_row_selected", "(I)Z"); jboolean jselected = (*env)->CallBooleanMethod(env, atk_table, jmid, (jint)row); if (jselected == JNI_TRUE) return TRUE; return FALSE; } static gboolean jaw_table_is_selected (AtkTable *table, gint row, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "is_selected", "(II)Z"); jboolean jselected = (*env)->CallBooleanMethod(env, atk_table, jmid, (jint)row, (jint)column); if (jselected == JNI_TRUE) return TRUE; return FALSE; } static gboolean jaw_table_add_row_selection(AtkTable *table, gint row) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "addRowSelection", "(I)Z"); jboolean jselected = (*env)->CallBooleanMethod(env, atk_table, jmid, (jint)row); if (jselected == JNI_TRUE) return TRUE; return FALSE; } static gboolean jaw_table_add_column_selection(AtkTable *table, gint column) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "addColumnSelection", "(I)Z"); jboolean jselected = (*env)->CallBooleanMethod(env, atk_table, jmid, (jint)column); if (jselected == JNI_TRUE) return TRUE; return FALSE; } static void jaw_table_set_row_description(AtkTable *table, gint row, const gchar *description) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setRowDescription", "(ILjava/lang/String;)V"); jstring jstr = (*env)->NewStringUTF(env, description); (*env)->CallVoidMethod(env, atk_table, jmid, (jint)row, jstr); } static void jaw_table_set_column_description(AtkTable *table, gint column, const gchar *description) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setColumnDescription", "(ILjava/lang/String;)V"); jstring jstr = (*env)->NewStringUTF(env, description); (*env)->CallVoidMethod(env, atk_table, jmid, (jint)column, jstr); } static void jaw_table_set_row_header(AtkTable *table, gint row, AtkObject *header) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setRowHeader", "(ILjavax/accessibility/AccessibleTable;)V"); (*env)->CallVoidMethod(env, atk_table, jmid, (jint)row, (jobject)header); } static void jaw_table_set_column_header(AtkTable *table, gint column, AtkObject *header) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setColumnHeader", "(ILjavax/accessibility/AccessibleTable;)V"); (*env)->CallVoidMethod(env, atk_table, jmid, (jint)column, (jobject)header); } static void jaw_table_set_caption(AtkTable *table, AtkObject *caption) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setCaption", "(Ljavax/accessibility/Accessible;)V"); (*env)->CallVoidMethod(env, atk_table, jmid, (jobject)caption); } static void jaw_table_set_summary(AtkTable *table, AtkObject *summary) { JawObject *jaw_obj = JAW_OBJECT(table); TableData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE); jobject atk_table = data->atk_table; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTable = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTable"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTable, "setSummary", "(Ljavax/accessibility/Accessible;)V"); (*env)->CallVoidMethod(env, atk_table, jmid, (jobject)summary); } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawtablecell.c000066400000000000000000000200761255546517100240020ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2015 Magdalen Berns * * 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 021101301 USA */ #include #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_table_cell_interface_init (AtkTableCellIface*); extern gpointer jaw_table_cell_data_init (jobject ac); extern void jaw_table_cell_data_finalize (gpointer); static AtkObject *jaw_table_cell_get_table (AtkTableCell *cell); static gboolean jaw_table_cell_get_position(AtkTableCell *cell, gint *row, gint *column); static gboolean jaw_table_cell_get_row_column_span(AtkTableCell *cell, gint *row, gint *column, gint *row_span, gint *column_span); static gint jaw_table_cell_get_row_span(AtkTableCell *cell); static gint jaw_table_cell_get_column_span(AtkTableCell *cell); typedef struct _TableCellData { jobject atk_table_cell; gchar* description; jstring jstrDescription; } TableCellData; void jaw_table_cell_interface_init (AtkTableCellIface *iface) { iface->get_table = jaw_table_cell_get_table; iface->get_position = jaw_table_cell_get_position; iface->get_row_column_span = jaw_table_cell_get_row_column_span; iface->get_row_span = jaw_table_cell_get_row_span; iface->get_column_span = jaw_table_cell_get_column_span; } gpointer jaw_table_cell_data_init (jobject ac) { TableCellData *data = g_new0(TableCellData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classTableCell = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classTableCell, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_table_cell = (*jniEnv)->NewObject(jniEnv, classTableCell, jmid, ac); data->atk_table_cell = (*jniEnv)->NewGlobalRef(jniEnv, jatk_table_cell); return data; } void jaw_table_cell_data_finalize (gpointer p) { TableCellData *data = (TableCellData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_table_cell) { if (data->description != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrDescription, data->description); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrDescription); data->jstrDescription = NULL; data->description = NULL; } (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_table_cell); data->atk_table_cell = NULL; } } static AtkObject* jaw_table_cell_get_table(AtkTableCell *cell) { JawObject *jaw_obj = JAW_OBJECT(cell); TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL); jobject jatk_table_cell = data->atk_table_cell; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkTableCell = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTableCell, "getTable", "()Ljavax/accessibility/AccessibleTable;"); jobject jac = (*jniEnv)->CallObjectMethod(jniEnv, jatk_table_cell, jmid); if (!jac) return NULL; JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, jac); return ATK_OBJECT(jaw_impl); } static gboolean jaw_table_cell_get_position(AtkTableCell *cell, gint *row, gint *column) { JawObject *jaw_obj = JAW_OBJECT(cell); TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL); jobject jatk_table_cell = data->atk_table_cell; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkTableCell = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTableCell, "getPosition", "(II)Z;"); jboolean jposition = (*jniEnv)->CallBooleanMethod(jniEnv, jatk_table_cell, jmid, (jint)GPOINTER_TO_INT(row), (jint)GPOINTER_TO_INT(column)); if (jposition == JNI_TRUE) return TRUE; return FALSE; } static gboolean jaw_table_cell_get_row_column_span(AtkTableCell *cell, gint *row, gint *column, gint *row_span, gint *column_span) { JawObject *jaw_obj = JAW_OBJECT(cell); TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL); jobject jatk_table_cell = data->atk_table_cell; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkTableCell = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkTableCell, "getRowColumnSpan", "(IIII)Z;"); jboolean jspan = (*jniEnv)->CallBooleanMethod(jniEnv, jatk_table_cell, jmid, (jint)GPOINTER_TO_INT(row), (jint)GPOINTER_TO_INT(column), (jint)GPOINTER_TO_INT(row_span), (jint)GPOINTER_TO_INT(column_span) ); if (jspan == JNI_TRUE) return TRUE; return FALSE; } static gint jaw_table_cell_get_row_span(AtkTableCell *cell) { JawObject *jaw_obj = JAW_OBJECT(cell); TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL); jobject jatk_table_cell = data->atk_table_cell; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTableCell = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTableCell, "getRowSpan", "()I;"); return (gint) (*env)->CallIntMethod(env, jatk_table_cell, jmid); } static gint jaw_table_cell_get_column_span(AtkTableCell *cell) { JawObject *jaw_obj = JAW_OBJECT(cell); TableCellData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TABLE_CELL); jobject jatk_table_cell = data->atk_table_cell; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkTableCell = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkTableCell"); jmethodID jmid = (*env)->GetMethodID(env, classAtkTableCell, "getColumnSpan", "()I;"); return (gint) (*env)->CallIntMethod(env, jatk_table_cell, jmid); } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawtext.c000066400000000000000000000516171255546517100230440ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include "jawimpl.h" #include "jawutil.h" extern void jaw_text_interface_init(AtkTextIface*); extern gpointer jaw_text_data_init(jobject); extern void jaw_text_data_finalize(gpointer); static gchar* jaw_text_get_text(AtkText *text, gint start_offset, gint end_offset); static gunichar jaw_text_get_character_at_offset(AtkText *text, gint offset); static gchar* jaw_text_get_text_at_offset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); static gint jaw_text_get_caret_offset(AtkText *text); static void jaw_text_get_character_extents(AtkText *text, gint offset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords); static gint jaw_text_get_character_count(AtkText *text); static gint jaw_text_get_offset_at_point(AtkText *text, gint x, gint y, AtkCoordType coords); static void jaw_text_get_range_extents(AtkText *text, gint start_offset, gint end_offset, AtkCoordType coord_type, AtkTextRectangle *rect); static gint jaw_text_get_n_selections(AtkText *text); static gchar* jaw_text_get_selection(AtkText *text, gint selection_num, gint *start_offset, gint *end_offset); static gboolean jaw_text_add_selection(AtkText *text, gint start_offset, gint end_offset); static gboolean jaw_text_remove_selection(AtkText *text, gint selection_num); static gboolean jaw_text_set_selection(AtkText *text, gint selection_num, gint start_offset, gint end_offset); static gboolean jaw_text_set_caret_offset(AtkText *text, gint offset); typedef struct _TextData { jobject atk_text; gchar* text; jstring jstrText; }TextData; void jaw_text_interface_init (AtkTextIface *iface) { iface->get_text = jaw_text_get_text; iface->get_character_at_offset = jaw_text_get_character_at_offset; iface->get_text_at_offset = jaw_text_get_text_at_offset; iface->get_caret_offset = jaw_text_get_caret_offset; iface->get_character_extents = jaw_text_get_character_extents; iface->get_character_count = jaw_text_get_character_count; iface->get_offset_at_point = jaw_text_get_offset_at_point; iface->get_range_extents = jaw_text_get_range_extents; iface->get_n_selections = jaw_text_get_n_selections; iface->get_selection = jaw_text_get_selection; iface->add_selection = jaw_text_add_selection; iface->remove_selection = jaw_text_remove_selection; iface->set_selection = jaw_text_set_selection; iface->set_caret_offset = jaw_text_set_caret_offset; } gpointer jaw_text_data_init (jobject ac) { TextData *data = g_new0(TextData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classText, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_text = (*jniEnv)->NewObject(jniEnv, classText, jmid, ac); data->atk_text = (*jniEnv)->NewGlobalRef(jniEnv, jatk_text); return data; } void jaw_text_data_finalize (gpointer p) { TextData *data = (TextData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_text) { if (data->text != NULL) { (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrText, data->text); (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrText); data->jstrText = NULL; data->text = NULL; } (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_text); data->atk_text = NULL; } } static gchar* jaw_text_get_gtext_from_jstr (JNIEnv *jniEnv, TextData *data, jstring jstr) { if (jstr == NULL) { return NULL; } gchar* tmp_text = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jstr, NULL); gchar* text = g_strdup(tmp_text); (*jniEnv)->ReleaseStringUTFChars(jniEnv, jstr, tmp_text); return text; } static gchar* jaw_text_get_text (AtkText *text, gint start_offset, gint end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_text", "(II)Ljava/lang/String;"); jstring jstr = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)start_offset, (jint)end_offset ); return jaw_text_get_gtext_from_jstr(jniEnv, data, jstr); } static gunichar jaw_text_get_character_at_offset (AtkText *text, gint offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_character_at_offset", "(I)C"); jchar jcharacter = (*jniEnv)->CallCharMethod(jniEnv, atk_text, jmid, (jint)offset ); return (gunichar)jcharacter; } static gchar* jaw_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_text_at_offset", "(II)Lorg/GNOME/Accessibility/AtkText$StringSequence;"); jobject jStrSeq = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)offset, (jint)boundary_type ); if (jStrSeq == NULL) { return NULL; } jclass classStringSeq = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText$StringSequence"); jfieldID jfidStr = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "str", "Ljava/lang/String;"); jfieldID jfidStart = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "start_offset", "I"); jfieldID jfidEnd = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "end_offset", "I"); jstring jStr = (*jniEnv)->GetObjectField(jniEnv, jStrSeq, jfidStr); jint jStart = (*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidStart); jint jEnd = (*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidEnd); (*start_offset) = (gint)jStart; (*end_offset) = (gint)jEnd; return jaw_text_get_gtext_from_jstr(jniEnv, data, jStr); } static gint jaw_text_get_caret_offset (AtkText *text) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_caret_offset", "()I"); jint joffset = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid); return (gint)joffset; } static void jaw_text_get_character_extents (AtkText *text, gint offset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_character_extents", "(II)Ljava/awt/Rectangle;"); jobject jrect = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)offset, (jint)coords); if (jrect == NULL) { return; } jaw_util_get_rect_info(jniEnv, jrect, x, y, width, height); } static gint jaw_text_get_character_count (AtkText *text) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_character_count", "()I"); jint jcount = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid); return (gint)jcount; } static gint jaw_text_get_offset_at_point (AtkText *text, gint x, gint y, AtkCoordType coords) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_offset_at_point", "(III)I"); jint joffset = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid, (jint)x, (jint)y, (jint)coords); return (gint)joffset; } static void jaw_text_get_range_extents (AtkText *text, gint start_offset, gint end_offset, AtkCoordType coord_type, AtkTextRectangle *rect) { if (rect == NULL) { return; } JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_range_extents", "(III)Ljava/awt/Rectangle;"); jobject jrect = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid, (jint)start_offset, (jint)end_offset, (jint)coord_type); if (!jrect) { return; } jaw_util_get_rect_info(jniEnv, jrect, &(rect->x), &(rect->y), &(rect->width), &(rect->height)); } static gint jaw_text_get_n_selections (AtkText *text) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_n_selections", "()I"); jint jselections = (*jniEnv)->CallIntMethod(jniEnv, atk_text, jmid); return (gint)jselections; } static gchar* jaw_text_get_selection (AtkText *text, gint selection_num, gint *start_offset, gint *end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "get_selection", "()Lorg/GNOME/Accessibility/AtkText$StringSequence;"); jobject jStrSeq = (*jniEnv)->CallObjectMethod(jniEnv, atk_text, jmid); if (jStrSeq == NULL) { return NULL; } jclass classStringSeq = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText$StringSequence"); jfieldID jfidStr = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "str", "Ljava/lang/String;"); jfieldID jfidStart = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "start_offset", "I"); jfieldID jfidEnd = (*jniEnv)->GetFieldID(jniEnv, classStringSeq, "end_offset", "I"); jstring jStr = (*jniEnv)->GetObjectField(jniEnv, jStrSeq, jfidStr); *start_offset = (gint)(*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidStart); *end_offset = (gint)(*jniEnv)->GetIntField(jniEnv, jStrSeq, jfidEnd); return jaw_text_get_gtext_from_jstr(jniEnv, data, jStr); } static gboolean jaw_text_add_selection (AtkText *text, gint start_offset, gint end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "add_selection", "(II)Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_text, jmid, (jint)start_offset, (jint)end_offset); if (jresult == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_text_remove_selection (AtkText *text, gint selection_num) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "remove_selection", "(I)Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_text, jmid, (jint)selection_num); if (jresult == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_text_set_selection (AtkText *text, gint selection_num, gint start_offset, gint end_offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "set_selection", "(III)Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_text, jmid, (jint)selection_num, (jint)start_offset, (jint)end_offset); if (jresult == JNI_TRUE) { return TRUE; } else { return FALSE; } } static gboolean jaw_text_set_caret_offset (AtkText *text, gint offset) { JawObject *jaw_obj = JAW_OBJECT(text); TextData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_TEXT); jobject atk_text = data->atk_text; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkText = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkText"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkText, "set_caret_offset", "(I)Z"); jboolean jresult = (*jniEnv)->CallBooleanMethod(jniEnv, atk_text, jmid, (jint)offset); if (jresult == JNI_TRUE) { return TRUE; } else { return FALSE; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawtoplevel.c000066400000000000000000000116641255546517100237100ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 #include #include #include #include "jawtoplevel.h" static void jaw_toplevel_class_init(JawToplevelClass *klass); static void jaw_toplevel_init(JawToplevel *toplevel); static void jaw_toplevel_initialize(AtkObject *accessible, gpointer data); static void jaw_toplevel_object_finalize(GObject *obj); /* override AtkObject function */ static const gchar* jaw_toplevel_get_name(AtkObject *obj); static const gchar* jaw_toplevel_get_description(AtkObject *obj); static gint jaw_toplevel_get_n_children(AtkObject *obj); static gint jaw_toplevel_get_index_in_parent(AtkObject *obj); static AtkRole jaw_toplevel_get_role(AtkObject *obj); static AtkObject* jaw_toplevel_ref_child(AtkObject *obj, gint i); static AtkObject* jaw_toplevel_get_parent(AtkObject *obj); G_DEFINE_TYPE (JawToplevel, jaw_toplevel, ATK_TYPE_OBJECT) static void jaw_toplevel_class_init (JawToplevelClass *klass) { AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS(klass); GObjectClass *g_object_class = G_OBJECT_CLASS(klass); atk_object_class->initialize = jaw_toplevel_initialize; atk_object_class->get_name = jaw_toplevel_get_name; atk_object_class->get_description = jaw_toplevel_get_description; atk_object_class->get_n_children = jaw_toplevel_get_n_children; atk_object_class->get_index_in_parent = jaw_toplevel_get_index_in_parent; atk_object_class->get_role = jaw_toplevel_get_role; atk_object_class->ref_child = jaw_toplevel_ref_child; atk_object_class->get_parent = jaw_toplevel_get_parent; g_object_class->finalize = jaw_toplevel_object_finalize; } static void jaw_toplevel_init (JawToplevel *toplevel) { toplevel->windows = NULL; } static void jaw_toplevel_initialize(AtkObject *accessible, gpointer data) { ATK_OBJECT_CLASS (jaw_toplevel_parent_class)->initialize(accessible, data); } static void jaw_toplevel_object_finalize (GObject *obj) { JawToplevel *jaw_toplevel = JAW_TOPLEVEL(obj); g_list_free(jaw_toplevel->windows); JawToplevelClass *klass = JAW_TOPLEVEL_GET_CLASS(obj); G_OBJECT_CLASS(klass)->finalize(obj); } static const gchar* jaw_toplevel_get_name (AtkObject *obj) { gint i; for(i = 0; i < atk_object_get_n_accessible_children(obj); i++) { AtkObject* child = atk_object_ref_accessible_child(obj, i); const gchar* name = atk_object_get_name(child); if (name && strlen(name) > 0) { g_object_unref(G_OBJECT(child)); return name; } g_object_unref(G_OBJECT(child)); } return "Java Application"; } static const gchar* jaw_toplevel_get_description (AtkObject *obj) { return "Accessible Java application"; } static gint jaw_toplevel_get_n_children (AtkObject *obj) { JawToplevel* jaw_toplevel = JAW_TOPLEVEL(obj); gint n = g_list_length(jaw_toplevel->windows); return n; } static gint jaw_toplevel_get_index_in_parent (AtkObject *obj) { JawToplevel *jaw_toplevel = JAW_TOPLEVEL(obj); gint i = g_list_index(jaw_toplevel->windows, obj); return i; } static AtkRole jaw_toplevel_get_role (AtkObject *obj) { return ATK_ROLE_APPLICATION; } static AtkObject* jaw_toplevel_ref_child (AtkObject *obj, gint i) { JawToplevel *jaw_toplevel = JAW_TOPLEVEL(obj); AtkObject* child = (AtkObject*)g_list_nth_data(jaw_toplevel->windows, i); if (G_OBJECT(child) != NULL) g_object_ref(G_OBJECT(child)); return child; } static AtkObject* jaw_toplevel_get_parent (AtkObject *obj) { return NULL; } gint jaw_toplevel_add_window (JawToplevel *toplevel, AtkObject *child) { if (toplevel == NULL) { return -1; } if (g_list_index(toplevel->windows, child) != -1) { return -1; } toplevel->windows = g_list_append(toplevel->windows, child); return g_list_index(toplevel->windows, child); } gint jaw_toplevel_remove_window(JawToplevel *toplevel, AtkObject *child) { gint index = -1; if (toplevel == NULL) { return index; } if ((index = g_list_index(toplevel->windows, child)) == -1) { return index; } toplevel->windows = g_list_remove(toplevel->windows, child); return index; } gint jaw_toplevel_get_child_index(JawToplevel *toplevel, AtkObject *child) { gint i = g_list_index(toplevel->windows, child); return i; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawtoplevel.h000066400000000000000000000035701255546517100237120ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 _JAW_TOPLEVEL_H_ #define _JAW_TOPLEVEL_H_ #include G_BEGIN_DECLS #define JAW_TYPE_TOPLEVEL (jaw_toplevel_get_type ()) #define JAW_TOPLEVEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_TOPLEVEL, JawToplevel)) #define JAW_TOPLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_TOPLEVEL, JawToplevelClass)) #define JAW_IS_TOPLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_TOPLEVEL)) #define JAW_IS_TOPLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_TOPLEVEL)) #define JAW_TOPLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_TOPLEVEL, JawToplevelClass)) typedef struct _JawToplevel JawToplevel; typedef struct _JawToplevelClass JawToplevelClass; struct _JawToplevel { AtkObject parent; GList *windows; }; GType jaw_toplevel_get_type (void); struct _JawToplevelClass { AtkObjectClass parent_class; }; gint jaw_toplevel_add_window(JawToplevel*, AtkObject*); gint jaw_toplevel_remove_window(JawToplevel*, AtkObject*); gint jaw_toplevel_get_child_index(JawToplevel*, AtkObject*); G_END_DECLS #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawutil.c000066400000000000000000000625361255546517100230370ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include #include #include #include #include "jawutil.h" #include "jawtoplevel.h" #include "jawobject.h" #ifdef __cplusplus extern "C" { #endif /* AtkUtil */ static void jaw_util_class_init(JawUtilClass *klass); static guint jaw_util_add_key_event_listener(AtkKeySnoopFunc listener, gpointer data); static void jaw_util_remove_key_event_listener(guint remove_listener); static AtkObject* jaw_util_get_root(void); static const gchar* jaw_util_get_toolkit_name(void); static const gchar* jaw_util_get_toolkit_version(void); static GHashTable *key_listener_list = NULL; JavaVM *cachedJVM; GType jaw_util_get_type(void) { static GType type = 0; if (!type) { static const GTypeInfo tinfo = { sizeof(JawUtilClass), (GBaseInitFunc) NULL, /*base init*/ (GBaseFinalizeFunc) NULL, /*base finalize */ (GClassInitFunc) jaw_util_class_init, /* class init */ (GClassFinalizeFunc) NULL, /*class finalize */ NULL, /* class data */ sizeof(JawUtil), /* instance size */ 0, /* nb preallocs */ (GInstanceInitFunc) NULL, /* instance init */ NULL /* value table */ }; type = g_type_register_static(ATK_TYPE_UTIL, "JawUtil", &tinfo, 0); } return type; } static void jaw_util_class_init(JawUtilClass *kclass) { AtkUtilClass *atk_class; gpointer data; data = g_type_class_peek (ATK_TYPE_UTIL); atk_class = ATK_UTIL_CLASS (data); atk_class->add_key_event_listener = jaw_util_add_key_event_listener; atk_class->remove_key_event_listener = jaw_util_remove_key_event_listener; atk_class->get_root = jaw_util_get_root; atk_class->get_toolkit_name = jaw_util_get_toolkit_name; atk_class->get_toolkit_version = jaw_util_get_toolkit_version; } typedef struct _JawKeyListenerInfo{ AtkKeySnoopFunc listener; gpointer data; }JawKeyListenerInfo; static gboolean notify_hf (gpointer key, gpointer value, gpointer data) { JawKeyListenerInfo *info = (JawKeyListenerInfo*)value; AtkKeyEventStruct *key_event = (AtkKeyEventStruct*)data; AtkKeySnoopFunc func = info->listener; gpointer func_data = info->data; return (*func)(key_event, func_data) ? TRUE : FALSE; } static void insert_hf (gpointer key, gpointer value, gpointer data) { GHashTable *new_table = (GHashTable *) data; g_hash_table_insert (new_table, key, value); } gboolean jaw_util_dispatch_key_event (AtkKeyEventStruct *event) { gint consumed = 0; if (key_listener_list) { GHashTable *new_hash = g_hash_table_new(NULL, NULL); g_hash_table_foreach(key_listener_list, insert_hf, new_hash); consumed = g_hash_table_foreach_steal(new_hash, notify_hf, event); g_hash_table_destroy(new_hash); } return (consumed > 0) ? TRUE : FALSE; } static guint jaw_util_add_key_event_listener (AtkKeySnoopFunc listener, gpointer data) { static guint key = 0; if (!listener) { return 0; } if (!key_listener_list) { key_listener_list = g_hash_table_new(NULL, NULL); } JawKeyListenerInfo *info = g_new0(JawKeyListenerInfo, 1); info->listener = listener; info->data = data; key++; g_hash_table_insert(key_listener_list, GUINT_TO_POINTER(key), info); return key; } static void jaw_util_remove_key_event_listener (guint remove_listener) { gpointer *value = g_hash_table_lookup(key_listener_list, GUINT_TO_POINTER(remove_listener)); if (value) g_free(value); g_hash_table_remove(key_listener_list, GUINT_TO_POINTER(remove_listener)); } static AtkObject* jaw_util_get_root (void) { static JawToplevel *root = NULL; if (!root) { root = g_object_new(JAW_TYPE_TOPLEVEL, NULL); atk_object_initialize(ATK_OBJECT(root), NULL); } return ATK_OBJECT(root); } static const gchar* jaw_util_get_toolkit_name (void) { return "J2SE-access-bridge"; } static const gchar* jaw_util_get_toolkit_version (void) { return "1.0"; } /* static functions */ guint jaw_util_get_tflag_from_jobj(JNIEnv *jniEnv, jobject jObj) { guint tflag = 0; jmethodID jmid; jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext"); jclass classAccessible = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/Accessible"); jobject ac; jobject iface; if((*jniEnv)->IsInstanceOf(jniEnv, jObj, classAccessibleContext) ) { ac = jObj; } else if((*jniEnv)->IsInstanceOf(jniEnv, jObj, classAccessible)) { jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); ac = (*jniEnv)->CallObjectMethod(jniEnv, jObj, jmid); } else { return 0; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleAction", "()Ljavax/accessibility/AccessibleAction;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_ACTION; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleComponent", "()Ljavax/accessibility/AccessibleComponent;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_COMPONENT; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleText", "()Ljavax/accessibility/AccessibleText;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_TEXT; jclass classAccessibleHypertext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleHypertext"); if ( (*jniEnv)->IsInstanceOf(jniEnv, iface, classAccessibleHypertext)) { tflag |= INTERFACE_HYPERTEXT; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleEditableText", "()Ljavax/accessibility/AccessibleEditableText;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_EDITABLE_TEXT; } } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleIcon", "()[Ljavax/accessibility/AccessibleIcon;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_IMAGE; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleSelection", "()Ljavax/accessibility/AccessibleSelection;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_SELECTION; } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleTable", "()Ljavax/accessibility/AccessibleTable;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_TABLE; jclass classAccessibleExtendedTable = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleExtendedTable"); if ((*jniEnv)->IsInstanceOf(jniEnv, iface, classAccessibleExtendedTable)) { tflag |= INTERFACE_TABLE_CELL; } } jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleValue", "()Ljavax/accessibility/AccessibleValue;"); iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (iface != NULL) { tflag |= INTERFACE_VALUE; } return tflag; } gboolean jaw_util_is_same_jobject(gconstpointer a, gconstpointer b) { JNIEnv *jniEnv = jaw_util_get_jni_env(); if ( (*jniEnv)->IsSameObject(jniEnv, (jobject)a, (jobject)b) ) { return TRUE; } else { return FALSE; } } JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserve) { if (jvm == NULL) { g_error("JavaVM pointer was NULL when initializing library"); return JNI_ERR; } cachedJVM = jvm; return JNI_VERSION_1_6; } JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *jvm, void *reserve) { } JNIEnv* jaw_util_get_jni_env(void) { JNIEnv *env; env = NULL; static int i; i = 0; void* ptr; ptr = NULL; JavaVMAttachArgs args = { 0, }; jint res; #ifdef JNI_VERSION_1_6 res = (*cachedJVM)->GetEnv(cachedJVM, &ptr, JNI_VERSION_1_6); #endif env = (JNIEnv*) ptr; if (env != NULL) return env; switch (res) { case JNI_EDETACHED: args.version = JNI_VERSION_1_6; args.name = g_strdup_printf("NativeThread %d", i++); res = (*cachedJVM)->AttachCurrentThread(cachedJVM, &ptr, NULL); env = (JNIEnv*) ptr; if ((res == JNI_OK) && (env != NULL)) { g_free(args.name); return env; } g_printerr("\n *** Attach failed. *** JNIEnv thread is detached.\n"); break; case JNI_EVERSION: g_printerr(" *** Version error *** \n"); break; } fflush(stderr); exit(2); return NULL; } void jaw_util_detach(void) { JavaVM* jvm; jvm = cachedJVM; (*jvm)->DetachCurrentThread(jvm); } static jobject jaw_util_get_java_acc_role (JNIEnv *jniEnv, const gchar* roleName) { jclass classAccessibleRole = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleRole"); jfieldID jfid = (*jniEnv)->GetStaticFieldID(jniEnv, classAccessibleRole, roleName, "Ljavax/accessibility/AccessibleRole;"); jobject jrole = (*jniEnv)->GetStaticObjectField(jniEnv, classAccessibleRole, jfid); return jrole; } static gboolean jaw_util_is_java_acc_role (JNIEnv *jniEnv, jobject acc_role, const gchar* roleName) { jobject jrole = jaw_util_get_java_acc_role (jniEnv, roleName); if ((*jniEnv)->IsSameObject(jniEnv, acc_role, jrole)) { return TRUE; } else { return FALSE; } } AtkRole jaw_util_get_atk_role_from_jobj (jobject jobj) { jobject ac; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleContext"); jclass classAccessible = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/Accessible"); jmethodID jmidGetContext; jmidGetContext = (*jniEnv)->GetMethodID(jniEnv, classAccessible, "getAccessibleContext", "()Ljavax/accessibility/AccessibleContext;"); if( (*jniEnv)->IsInstanceOf(jniEnv, jobj, classAccessibleContext)) { ac = jobj; } else if ((*jniEnv)->IsInstanceOf(jniEnv, jobj, classAccessible)) { ac = (*jniEnv)->CallObjectMethod(jniEnv, jobj, jmidGetContext); } else { return ATK_ROLE_INVALID; } jmethodID jmidGetRole = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleRole", "()Ljavax/accessibility/AccessibleRole;"); jobject ac_role = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmidGetRole); if (jaw_util_is_java_acc_role(jniEnv, ac_role, "ALERT")) return ATK_ROLE_ALERT; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "AWT_COMPONENT")) return ATK_ROLE_UNKNOWN; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "CANVAS")) return ATK_ROLE_CANVAS; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "CHECK_BOX")) return ATK_ROLE_CHECK_BOX; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "COLOR_CHOOSER")) return ATK_ROLE_COLOR_CHOOSER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "COLUMN_HEADER")) return ATK_ROLE_COLUMN_HEADER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "COMBO_BOX")) return ATK_ROLE_COMBO_BOX; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "DATE_EDITOR")) return ATK_ROLE_DATE_EDITOR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "DESKTOP_ICON")) return ATK_ROLE_DESKTOP_ICON; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "DESKTOP_PANE")) return ATK_ROLE_DESKTOP_FRAME; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "DIALOG")) return ATK_ROLE_DIALOG; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "DIRECTORY_PANE")) return ATK_ROLE_DIRECTORY_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "EDITBAR")) return ATK_ROLE_EDITBAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "FILE_CHOOSER")) return ATK_ROLE_FILE_CHOOSER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "FILLER")) return ATK_ROLE_FILLER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "FONT_CHOOSER")) return ATK_ROLE_FONT_CHOOSER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "FOOTER")) return ATK_ROLE_FOOTER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "FRAME")) return ATK_ROLE_FRAME; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "GLASS_PANE")) return ATK_ROLE_GLASS_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "GROUP_BOX")) return ATK_ROLE_PANEL; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "HEADER")) return ATK_ROLE_HEADER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "HTML_CONTAINER")) return ATK_ROLE_HTML_CONTAINER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "HYPERLINK")) return ATK_ROLE_UNKNOWN; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "ICON")) return ATK_ROLE_ICON; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "INTERNAL_FRAME")) return ATK_ROLE_INTERNAL_FRAME; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "LABEL")) return ATK_ROLE_LABEL; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "LAYERED_PANE")) return ATK_ROLE_LAYERED_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "LIST")) return ATK_ROLE_LIST; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "LIST_ITEM")) return ATK_ROLE_LIST_ITEM; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "MENU")) return ATK_ROLE_MENU; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "MENU_BAR")) return ATK_ROLE_MENU_BAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "MENU_ITEM")) return ATK_ROLE_MENU_ITEM; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "OPTION_PANE")) return ATK_ROLE_OPTION_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PAGE_TAB")) return ATK_ROLE_PAGE_TAB; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PAGE_TAB_LIST")) return ATK_ROLE_PAGE_TAB_LIST; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PANEL")) return ATK_ROLE_PANEL; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PARAGRAPH")) return ATK_ROLE_PARAGRAPH; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PASSWORD_TEXT")) return ATK_ROLE_PASSWORD_TEXT; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "POPUP_MENU")) return ATK_ROLE_POPUP_MENU; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PROGRESS_BAR")) return ATK_ROLE_PROGRESS_BAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "PUSH_BUTTON")) return ATK_ROLE_PUSH_BUTTON; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "RADIO_BUTTON")) { jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleParent", "()Ljavax/accessibility/Accessible;"); jobject parent_obj = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (!parent_obj) return ATK_ROLE_RADIO_BUTTON; jobject parent_ac = (*jniEnv)->CallObjectMethod(jniEnv, parent_obj, jmidGetContext); jobject parent_role = (*jniEnv)->CallObjectMethod(jniEnv, parent_ac, jmidGetRole); if (jaw_util_is_java_acc_role(jniEnv, parent_role, "MENU")) return ATK_ROLE_RADIO_MENU_ITEM; return ATK_ROLE_RADIO_BUTTON; } if (jaw_util_is_java_acc_role(jniEnv, ac_role, "ROOT_PANE")) return ATK_ROLE_ROOT_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "ROW_HEADER")) return ATK_ROLE_ROW_HEADER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "RULER")) return ATK_ROLE_RULER; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "SCROLL_BAR")) return ATK_ROLE_SCROLL_BAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "SCROLL_PANE")) return ATK_ROLE_SCROLL_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "SEPARATOR")) return ATK_ROLE_SEPARATOR; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "SLIDER")) return ATK_ROLE_SLIDER; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "SPIN_BOX")) return ATK_ROLE_SPIN_BUTTON; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "SPLIT_PANE")) return ATK_ROLE_SPLIT_PANE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "STATUS_BAR")) return ATK_ROLE_STATUSBAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "SWING_COMPONENT")) return ATK_ROLE_UNKNOWN; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "TABLE")) return ATK_ROLE_TABLE; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "TEXT")) return ATK_ROLE_TEXT; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "TOGGLE_BUTTON")) return ATK_ROLE_TOGGLE_BUTTON; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "TOOL_BAR")) return ATK_ROLE_TOOL_BAR; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "TOOL_TIP")) return ATK_ROLE_TOOL_TIP; if (jaw_util_is_java_acc_role(jniEnv, ac_role, "TREE")) return ATK_ROLE_TREE; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "UNKNOWN")) { jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAccessibleContext, "getAccessibleParent", "()Ljavax/accessibility/Accessible;"); jobject parent_obj = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid); if (parent_obj == NULL) return ATK_ROLE_APPLICATION; return ATK_ROLE_UNKNOWN; } if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "VIEWPORT")) return ATK_ROLE_VIEWPORT; if ( jaw_util_is_java_acc_role(jniEnv, ac_role, "WINDOW")) return ATK_ROLE_WINDOW; jclass classAccessibleRole = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleRole"); jmethodID jmidToDisplayString = (*jniEnv)->GetMethodID(jniEnv, classAccessibleRole, "toDisplayString", "(Ljava/util/Locale;)Ljava/lang/String;"); jclass classLocale = (*jniEnv)->FindClass(jniEnv, "java/util/Locale"); jfieldID jfidUS = (*jniEnv)->GetStaticFieldID(jniEnv, classLocale, "US", "Ljava/util/Locale;"); jobject jobjUS = (*jniEnv)->GetStaticObjectField(jniEnv, classLocale, jfidUS); jobject jobjString = (*jniEnv)->CallObjectMethod(jniEnv, ac_role, jmidToDisplayString, jobjUS); jclass classString = (*jniEnv)->FindClass(jniEnv, "java/lang/String"); jmethodID jmidEqualsIgnoreCase = (*jniEnv)->GetMethodID(jniEnv, classString, "equalsIgnoreCase", "(Ljava/lang/String;)Z"); jstring jstr = (*jniEnv)->NewStringUTF(jniEnv, "paragraph"); if ((*jniEnv)->CallBooleanMethod(jniEnv, jobjString, jmidEqualsIgnoreCase, jstr)) return ATK_ROLE_PARAGRAPH; return ATK_ROLE_UNKNOWN; /* ROLE_EXTENDED */ } static gboolean is_same_java_state (JNIEnv *jniEnv, jobject jobj, const gchar* strState) { jclass classAccessibleState = (*jniEnv)->FindClass(jniEnv, "javax/accessibility/AccessibleState"); jfieldID jfid = (*jniEnv)->GetStaticFieldID(jniEnv, classAccessibleState, strState, "Ljavax/accessibility/AccessibleState;"); jobject jstate = (*jniEnv)->GetStaticObjectField(jniEnv, classAccessibleState, jfid); if ((*jniEnv)->IsSameObject( jniEnv, jobj, jstate )) { return TRUE; } return FALSE; } AtkStateType jaw_util_get_atk_state_type_from_java_state (JNIEnv *jniEnv, jobject jobj) { if (is_same_java_state( jniEnv, jobj, "ACTIVE" )) return ATK_STATE_ACTIVE; if (is_same_java_state( jniEnv, jobj, "ARMED" )) return ATK_STATE_ARMED; if (is_same_java_state( jniEnv, jobj, "BUSY" )) return ATK_STATE_BUSY; if (is_same_java_state( jniEnv, jobj, "CHECKED" )) return ATK_STATE_CHECKED; if (is_same_java_state( jniEnv, jobj, "COLLAPSED" )) return ATK_STATE_INVALID; if (is_same_java_state( jniEnv, jobj, "EDITABLE" )) return ATK_STATE_EDITABLE; if (is_same_java_state( jniEnv, jobj, "ENABLED" )) return ATK_STATE_ENABLED; if (is_same_java_state( jniEnv, jobj, "EXPANDABLE" )) return ATK_STATE_EXPANDABLE; if (is_same_java_state( jniEnv, jobj, "EXPANDED" )) return ATK_STATE_EXPANDED; if (is_same_java_state( jniEnv, jobj, "FOCUSABLE" )) return ATK_STATE_FOCUSABLE; if (is_same_java_state( jniEnv, jobj, "FOCUSED" )) return ATK_STATE_FOCUSED; if (is_same_java_state( jniEnv, jobj, "HORIZONTAL" )) return ATK_STATE_HORIZONTAL; if (is_same_java_state( jniEnv, jobj, "ICONIFIED" )) return ATK_STATE_ICONIFIED; if (is_same_java_state( jniEnv, jobj, "INDETERMINATE" )) return ATK_STATE_INDETERMINATE; if (is_same_java_state( jniEnv, jobj, "MANAGES_DESCENDANTS" )) return ATK_STATE_MANAGES_DESCENDANTS; if (is_same_java_state( jniEnv, jobj, "MODAL" )) return ATK_STATE_MODAL; if (is_same_java_state( jniEnv, jobj, "MULTI_LINE" )) return ATK_STATE_MULTI_LINE; if (is_same_java_state( jniEnv, jobj, "MULTISELECTABLE" )) return ATK_STATE_MULTISELECTABLE; if (is_same_java_state( jniEnv, jobj, "OPAQUE" )) return ATK_STATE_OPAQUE; if (is_same_java_state( jniEnv, jobj, "PRESSED" )) return ATK_STATE_PRESSED; if (is_same_java_state( jniEnv, jobj, "RESIZABLE" )) return ATK_STATE_RESIZABLE; if (is_same_java_state( jniEnv, jobj, "SELECTABLE" )) return ATK_STATE_SELECTABLE; if (is_same_java_state( jniEnv, jobj, "SELECTED" )) return ATK_STATE_SELECTED; if (is_same_java_state( jniEnv, jobj, "SHOWING" )) return ATK_STATE_SHOWING; if (is_same_java_state( jniEnv, jobj, "SINGLE_LINE" )) return ATK_STATE_SINGLE_LINE; if (is_same_java_state( jniEnv, jobj, "TRANSIENT" )) return ATK_STATE_TRANSIENT; if (is_same_java_state( jniEnv, jobj, "TRUNCATED" )) return ATK_STATE_TRUNCATED; if (is_same_java_state( jniEnv, jobj, "VERTICAL" )) return ATK_STATE_VERTICAL; if (is_same_java_state( jniEnv, jobj, "VISIBLE" )) return ATK_STATE_VISIBLE; return ATK_STATE_INVALID; } void jaw_util_get_rect_info (JNIEnv *jniEnv, jobject jrect, gint *x, gint *y, gint *width, gint *height) { jclass classRectangle = (*jniEnv)->FindClass(jniEnv, "java/awt/Rectangle"); jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "x", "I"); jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "y", "I"); jfieldID jfidWidth = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "width", "I"); jfieldID jfidHeight = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "height", "I"); (*x) = (gint)(*jniEnv)->GetIntField(jniEnv, jrect, jfidX); (*y) = (gint)(*jniEnv)->GetIntField(jniEnv, jrect, jfidY); (*width) = (gint)(*jniEnv)->GetIntField(jniEnv, jrect, jfidWidth); (*height) = (gint)(*jniEnv)->GetIntField(jniEnv, jrect, jfidHeight); } #ifdef __cplusplus } #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawutil.h000066400000000000000000000056741255546517100230440ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 _JAW_UTIL_H_ #define _JAW_UTIL_H_ #include #include G_BEGIN_DECLS #define INTERFACE_ACTION 0x00000001 #define INTERFACE_COMPONENT 0x00000002 #define INTERFACE_DOCUMENT 0x00000004 #define INTERFACE_EDITABLE_TEXT 0x00000008 #define INTERFACE_HYPERLINK 0x00000010 #define INTERFACE_HYPERTEXT 0x00000020 #define INTERFACE_IMAGE 0x00000040 #define INTERFACE_SELECTION 0x00000080 #define INTERFACE_STREAMABLE_CONTENT 0x00000100 #define INTERFACE_TABLE 0x00000200 #define INTERFACE_TABLE_CELL 0x00000400 #define INTERFACE_TEXT 0x00000800 #define INTERFACE_VALUE 0x00001000 #define JAW_TYPE_UTIL (jaw_util_get_type()) #define JAW_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_UTIL, JawUtil)) #define JAW_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_UTIL, JawUtilClass)) #define JAW_IS_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_UTIL)) #define JAW_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_UTIL)) #define JAW_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_UTIL, JawUtilClass)) typedef struct _JawUtil JawUtil; typedef struct _JawUtilClass JawUtilClass; struct _JawUtil { AtkUtil parent; }; GType jaw_util_get_type(void); struct _JawUtilClass { AtkUtilClass parent_class; }; guint jaw_util_get_tflag_from_jobj(JNIEnv *jniEnv, jobject jObj); gboolean jaw_util_is_same_jobject(gconstpointer a, gconstpointer b); JNIEnv* jaw_util_get_jni_env(void); AtkRole jaw_util_get_atk_role_from_jobj(jobject jobj); AtkStateType jaw_util_get_atk_state_type_from_java_state(JNIEnv *jniEnv, jobject jobj); void jaw_util_get_rect_info(JNIEnv *jniEnv, jobject jrect, gint *x, gint *y, gint *width, gint *height); gboolean jaw_util_dispatch_key_event (AtkKeyEventStruct *event); G_END_DECLS #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/jni/src/jawvalue.c000066400000000000000000000167231255546517100231730ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 #include #include "jawimpl.h" #include "jawutil.h" #ifdef __cplusplus extern "C" { #endif extern void jaw_value_interface_init (AtkValueIface*); extern gpointer jaw_value_data_init (jobject ac); extern void jaw_value_data_finalize (gpointer); static void jaw_value_get_current_value(AtkValue *obj, GValue *value); static void jaw_value_set_value(AtkValue *obj, const gdouble value); static gdouble jaw_value_get_increment (AtkValue *obj); static AtkRange* jaw_value_get_range(AtkValue *obj); typedef struct _ValueData { jobject atk_value; } ValueData; void jaw_value_interface_init (AtkValueIface *iface) { iface->get_current_value = jaw_value_get_current_value; iface->set_value = jaw_value_set_value; iface->get_increment = jaw_value_get_increment; iface->get_range = jaw_value_get_range; } gpointer jaw_value_data_init (jobject ac) { ValueData *data = g_new0(ValueData, 1); JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classValue = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkValue"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classValue, "", "(Ljavax/accessibility/AccessibleContext;)V"); jobject jatk_value = (*jniEnv)->NewObject(jniEnv, classValue, jmid, ac); data->atk_value = (*jniEnv)->NewGlobalRef(jniEnv, jatk_value); return data; } void jaw_value_data_finalize (gpointer p) { ValueData *data = (ValueData*)p; JNIEnv *jniEnv = jaw_util_get_jni_env(); if (data && data->atk_value) { (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_value); data->atk_value = NULL; } } static void get_g_value_from_java_number (JNIEnv *jniEnv, jobject jnumber, GValue *value) { jclass classByte = (*jniEnv)->FindClass(jniEnv, "java/lang/Byte"); jclass classDouble = (*jniEnv)->FindClass(jniEnv, "java/lang/Double"); jclass classFloat = (*jniEnv)->FindClass(jniEnv, "java/lang/Float"); jclass classInteger = (*jniEnv)->FindClass(jniEnv, "java/lang/Integer"); jclass classLong = (*jniEnv)->FindClass(jniEnv, "java/lang/Long"); jclass classShort = (*jniEnv)->FindClass(jniEnv, "java/lang/Short"); jmethodID jmid; if ((*jniEnv)->IsInstanceOf(jniEnv, jnumber, classByte)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classByte, "byteValue", "()B"); g_value_init(value, G_TYPE_CHAR); g_value_set_schar(value, (gchar)(*jniEnv)->CallByteMethod(jniEnv, jnumber, jmid)); return; } if ((*jniEnv)->IsInstanceOf(jniEnv, jnumber, classDouble)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classDouble, "doubleValue", "()D"); g_value_init(value, G_TYPE_DOUBLE); g_value_set_double(value, (gdouble)(*jniEnv)->CallDoubleMethod(jniEnv, jnumber, jmid)); return; } if ((*jniEnv)->IsInstanceOf(jniEnv, jnumber, classFloat)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classFloat, "floatValue", "()F"); g_value_init(value, G_TYPE_FLOAT); g_value_set_float(value, (gfloat)(*jniEnv)->CallFloatMethod(jniEnv, jnumber, jmid)); return; } if ((*jniEnv)->IsInstanceOf(jniEnv, jnumber, classInteger) || (*jniEnv)->IsInstanceOf(jniEnv, jnumber, classShort)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classInteger, "intValue", "()I"); g_value_init(value, G_TYPE_INT); g_value_set_int(value, (gint)(*jniEnv)->CallIntMethod(jniEnv, jnumber, jmid)); return; } if ((*jniEnv)->IsInstanceOf(jniEnv, jnumber, classLong)) { jmid = (*jniEnv)->GetMethodID(jniEnv, classLong, "longValue", "()J"); g_value_init(value, G_TYPE_INT64); g_value_set_int64(value, (gint64)(*jniEnv)->CallLongMethod(jniEnv, jnumber, jmid)); return; } } static void jaw_value_get_current_value (AtkValue *obj, GValue *value) { if (!value) { return; } JawObject *jaw_obj = JAW_OBJECT(obj); ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE); jobject atk_value = data->atk_value; JNIEnv *jniEnv = jaw_util_get_jni_env(); jclass classAtkValue = (*jniEnv)->FindClass(jniEnv, "org/GNOME/Accessibility/AtkValue"); jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv, classAtkValue, "get_current_value", "()Ljava/lang/Number;"); jobject jnumber = (*jniEnv)->CallObjectMethod(jniEnv, atk_value, jmid); if (!jnumber) { return; } get_g_value_from_java_number(jniEnv, jnumber, value); } static void jaw_value_set_value(AtkValue *obj, const gdouble value) { if (!value) return; JawObject *jaw_obj = JAW_OBJECT(obj); ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE); jobject atk_value = data->atk_value; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue"); jmethodID jmid = (*env)->GetMethodID(env, classAtkValue, "setValue", "(Ljava/lang/Number;)V"); (*env)->CallVoidMethod(env, atk_value, jmid,(jdouble)value); } static AtkRange* jaw_value_get_range(AtkValue *obj) { JawObject *jaw_obj = JAW_OBJECT(obj); ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE); jobject atk_value = data->atk_value; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue"); jmethodID jmidMin = (*env)->GetMethodID(env, classAtkValue, "getMinimumValue", "()D"); jmethodID jmidMax = (*env)->GetMethodID(env, classAtkValue, "getMaximumValue", "()D"); return atk_range_new((gdouble)(*env)->CallDoubleMethod(env, atk_value, jmidMin), (gdouble)(*env)->CallDoubleMethod(env, atk_value, jmidMax), NULL); // NULL description } static gdouble jaw_value_get_increment (AtkValue *obj) { JawObject *jaw_obj = JAW_OBJECT(obj); ValueData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_VALUE); jobject atk_value = data->atk_value; JNIEnv *env = jaw_util_get_jni_env(); jclass classAtkValue = (*env)->FindClass(env, "org/GNOME/Accessibility/AtkValue"); jmethodID jmid = (*env)->GetMethodID(env, classAtkValue, "getIncrement", "()D"); return (*env)->CallDoubleMethod(env, atk_value, jmid); } #ifdef __cplusplus } #endif java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/000077500000000000000000000000001255546517100213115ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/Makefile.am000066400000000000000000000011141255546517100233420ustar00rootroot00000000000000SUBDIRS=org JARFILES=java-atk-wrapper.jar ALL_CLASSES=org/GNOME/Accessibility/*.class DEP_CLASSES=$(wildcard $(ALL_CLASSES)) if USER java_atk_wrapperdir = $(JAVA_HOME)/lib/ext propertiesdir = $(JAVA_HOME)/lib else java_atk_wrapperdir = $(HOME)$(JAVA_HOME)/lib/ext propertiesdir = $(HOME)$(JAVA_HOME)/lib endif java_atk_wrapper_DATA = $(JARFILES) properties_DATA = accessibility.properties EXTRA_DIST = $(properties_DATA) $(JARFILES) : $(DEP_CLASSES) $(JAR) cfm $(JARFILES) manifest.txt org/GNOME/Accessibility/*.class all-local : $(DATA) $(JARFILES) clean-local: rm -f $(JARFILES) java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/accessibility.properties000066400000000000000000000005461255546517100262630ustar00rootroot00000000000000# # The following line specifies the assistive technology classes # that should be loaded into the Java VM when the AWT is initailized. # Specify multiple classes by separating them with commas. # Note: the line below cannot end the file (there must be at # a minimum a blank line following it). # assistive_technologies=org.GNOME.Accessibility.AtkWrapper java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/manifest.txt000066400000000000000000000000601255546517100236540ustar00rootroot00000000000000Main-Class: org.GNOME.Accessibility.AtkWrapper java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/000077500000000000000000000000001255546517100221005ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/000077500000000000000000000000001255546517100227455ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/000077500000000000000000000000001255546517100255345ustar00rootroot00000000000000java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkAction.java000066400000000000000000000143001255546517100302520ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import javax.swing.*; import java.awt.event.KeyEvent; public class AtkAction { AccessibleContext ac; AccessibleAction acc_action; AccessibleExtendedComponent acc_ext_component; public AtkAction (AccessibleContext ac) { super(); this.ac = ac; this.acc_action = ac.getAccessibleAction(); AccessibleComponent acc_component = ac.getAccessibleComponent(); if (acc_component instanceof AccessibleExtendedComponent) { this.acc_ext_component = (AccessibleExtendedComponent)acc_component; } } private class ActionRunner implements Runnable { private AccessibleAction acc_action; private int index; public ActionRunner (AccessibleAction acc_action, int index) { this.acc_action = acc_action; this.index = index; } public void run () { acc_action.doAccessibleAction(index); } } public boolean do_action (int i) { SwingUtilities.invokeLater(new ActionRunner(acc_action, i)); return true; } public int get_n_actions () { return acc_action.getAccessibleActionCount(); } public String get_description (int i) { String description = ""; return description; } public boolean setDescription(int i, String description) { if (description == acc_action.getAccessibleActionDescription(i) && description != null) return true; return false; } public String get_name (int i) { String name = acc_action.getAccessibleActionDescription(i); if (name == null) { name = " "; } return name; } /** * @param i an integer holding the index of the name of * the accessible. * @return the localized name of the object or otherwise, * null if the "action" object does not have a * name (really, java's AccessibleAction class * does not provide * a getter for an AccessibleAction * name so a getter from the AcccessibleContext * class is one way to work around that) */ public String getLocalizedName (int i) { String name = ac.getAccessibleName(); String description = acc_action.getAccessibleActionDescription(i); if (description == name && description != null) return description; if (description == null && name != null) return name; else if (description != null) return description; return null; } private String convertModString (String mods) { if (mods == null || mods.length() == 0) { return ""; } String modStrs[] = mods.split("\\+"); String newModString = ""; for (int i = 0; i < modStrs.length; i++) { newModString += "<" + modStrs[i] + ">"; } return newModString; } public String get_keybinding (int index) { // TODO: improve/fix conversion to strings, concatenate, // and follow our formatting convention for the role of // various keybindings (i.e. global, transient, etc.) // // Presently, JAA doesn't define a relationship between the index used // and the action associated. As such, all keybindings are only // associated with the default (index 0 in GNOME) action. // if (index > 0) { return ""; } if(acc_ext_component != null) { AccessibleKeyBinding akb = acc_ext_component.getAccessibleKeyBinding(); if (akb != null && akb.getAccessibleKeyBindingCount() > 0) { String rVal = ""; int i; // Privately Agreed interface with StarOffice to workaround // deficiency in JAA. // // The aim is to use an array of keystrokes, if there is more // than one keypress involved meaning that we would have: // // KeyBinding(0) -> nmeumonic KeyStroke // KeyBinding(1) -> full key path KeyStroke[] // KeyBinding(2) -> accelerator KeyStroke // // GNOME Expects a string in the format: // // ;; // // The keybindings in should be separated by ":" // // Since only the first three are relevant, ignore others for (i = 0;( i < akb.getAccessibleKeyBindingCount() && i < 3); i++) { Object o = akb.getAccessibleKeyBinding(i); if ( i > 0 ) { rVal += ";"; } if (o instanceof javax.swing.KeyStroke) { javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o; String modString = KeyEvent.getKeyModifiersText(keyStroke.getModifiers()); String keyString = KeyEvent.getKeyText(keyStroke.getKeyCode()); if ( keyString != null ) { if ( modString != null && modString.length() > 0 ) { rVal += convertModString(modString) + keyString; } else { rVal += keyString; } } } else if (o instanceof javax.swing.KeyStroke[]) { javax.swing.KeyStroke[] keyStroke = (javax.swing.KeyStroke[])o; for ( int j = 0; j < keyStroke.length; j++ ) { String modString = KeyEvent.getKeyModifiersText(keyStroke[j].getModifiers()); String keyString = KeyEvent.getKeyText(keyStroke[j].getKeyCode()); if (j > 0) { rVal += ":"; } if ( keyString != null ) { if (modString != null && modString.length() > 0) { rVal += convertModString(modString) + keyString; } else { rVal += keyString; } } } } } if ( i < 2 ) rVal += ";"; if ( i < 3 ) rVal += ";"; return rVal; } } return ""; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkComponent.java000066400000000000000000000070111255546517100310000ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import java.awt.Point; import java.awt.Rectangle; import java.awt.Dimension; public class AtkComponent { AccessibleContext ac; AccessibleComponent acc_component; private int x, y, width, height; private Rectangle extents; public AtkComponent (AccessibleContext ac) { super(); this.ac = ac; this.acc_component = ac.getAccessibleComponent(); } public boolean contains (int x, int y, int coord_type) { if (coord_type == AtkCoordType.SCREEN) { Point p = acc_component.getLocationOnScreen(); this.x -= p.x; this.y -= p.y; } return acc_component.contains(new Point(x, y)); } public AccessibleContext get_accessible_at_point (int x, int y, int coord_type) { if (coord_type == AtkCoordType.SCREEN) { Point p = acc_component.getLocationOnScreen(); this.x -= p.x; this.y -= p.y; } javax.accessibility.Accessible accessible = acc_component.getAccessibleAt(new Point(x, y)); if (accessible == null) { return null; } return accessible.getAccessibleContext(); } public boolean grab_focus () { if (!acc_component.isFocusTraversable()) { return false; } acc_component.requestFocus(); return true; } public Point get_position (int coord_type) { if (coord_type == AtkCoordType.SCREEN) return acc_component.getLocationOnScreen(); return acc_component.getLocation(); } public Rectangle set_extents(int x, int y, int width, int height, int coord_type) { this.width = (int)acc_component.getSize().getWidth(); this.height = (int)acc_component.getSize().getHeight(); if (coord_type == AtkCoordType.SCREEN) { Point p = acc_component.getLocationOnScreen(); } else { Point p = acc_component.getLocation(); this.x -= p.x; this.y -= p.y; } return new Rectangle(x, y, width, height); } public Rectangle get_extents() { return acc_component.getBounds(); } public int get_layer () { AccessibleRole role = ac.getAccessibleRole(); if (role == AccessibleRole.MENU || role == AccessibleRole.MENU_ITEM || role == AccessibleRole.POPUP_MENU ) { return AtkLayer.POPUP; } if (role == AccessibleRole.INTERNAL_FRAME) { return AtkLayer.MDI; } if (role == AccessibleRole.GLASS_PANE) { return AtkLayer.OVERLAY; } if (role == AccessibleRole.CANVAS || role == AccessibleRole.ROOT_PANE || role == AccessibleRole.LAYERED_PANE ) { return AtkLayer.CANVAS; } if (role == AccessibleRole.WINDOW) { return AtkLayer.WINDOW; } return AtkLayer.WIDGET; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkCoordType.java000066400000000000000000000016571255546517100307600ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; public interface AtkCoordType { public int SCREEN = 0; public int WINDOW = 1; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkEditableText.java000066400000000000000000000054451255546517100314250ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import javax.swing.text.*; public class AtkEditableText extends AtkText { AccessibleEditableText acc_edt_text; public AtkEditableText (AccessibleContext ac) { super(ac); acc_edt_text = ac.getAccessibleEditableText(); } public void set_text_contents (String s) { acc_edt_text.setTextContents(s); } public void insert_text (String s, int position) { if (position < 0) { position = 0; } acc_edt_text.insertTextAtIndex(position, s); } public void copy_text (int start, int end) { int n = acc_edt_text.getCharCount(); if (start < 0) { start = 0; } if (end > n || end == -1) { end = n; } else if (end < -1) { end = 0; } String s = acc_edt_text.getTextRange(start, end); if (s != null) { StringSelection stringSel = new StringSelection(s); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSel, stringSel ); } } public void cut_text (int start, int end) { acc_edt_text.cut(start, end); } public void delete_text (int start, int end) { acc_edt_text.delete(start, end); } public void paste_text (int position) { acc_edt_text.paste(position); } /** * Sets run attributes for the text between two indices. * * @param as the AttributeSet for the text * @param start the start index of the text as an int * @param end the end index for the text as an int * @return whether setRunAttributes was called * TODO return is a bit presumptious. This should ideally include a check for whether * attributes were set. */ public boolean setRunAttributes(AttributeSet as, int start, int end) { acc_edt_text.setAttributes(start, end, as); return true; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkHyperlink.java000066400000000000000000000032771255546517100310150ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkHyperlink { AccessibleHyperlink acc_hyperlink; public AtkHyperlink (AccessibleHyperlink hl) { super(); acc_hyperlink = hl; } public String get_uri (int i) { String s = ""; Object o = acc_hyperlink.getAccessibleActionObject(i); if (o != null) { s = o.toString(); } return s; } public Object get_object (int i) { Object o = null; Object anchor = acc_hyperlink.getAccessibleActionAnchor(i); if (anchor instanceof javax.accessibility.Accessible) { o = anchor; } return o; } public int get_end_index () { return acc_hyperlink.getEndIndex(); } public int get_start_index () { return acc_hyperlink.getStartIndex(); } public boolean is_valid () { return acc_hyperlink.isValid(); } public int get_n_anchors () { return acc_hyperlink.getAccessibleActionCount(); } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkHypertext.java000066400000000000000000000033721255546517100310400ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkHypertext extends AtkText { AccessibleHypertext acc_hyper_text; public AtkHypertext (AccessibleContext ac) { super(ac); AccessibleText ac_text = ac.getAccessibleText(); if (ac_text instanceof AccessibleHypertext) { acc_hyper_text = (AccessibleHypertext)ac_text; } else { acc_hyper_text = null; } } public AtkHyperlink get_link (int link_index) { if (acc_hyper_text != null) { AccessibleHyperlink link = acc_hyper_text.getLink(link_index); if (link != null) { return new AtkHyperlink(link); } } return null; } public int get_n_links () { int nLinks = 0; if (acc_hyper_text != null) { nLinks = acc_hyper_text.getLinkCount(); } return nLinks; } public int get_link_index (int char_index) { int index = 0; if (acc_hyper_text != null) { index = acc_hyper_text.getLinkIndex(char_index); } return index; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkImage.java000066400000000000000000000036171255546517100300700ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import java.awt.Point; import java.awt.Dimension; public class AtkImage { AccessibleContext ac; AccessibleIcon[] acc_icons; public AtkImage (AccessibleContext ac) { super(); this.ac = ac; this.acc_icons = ac.getAccessibleIcon(); } public Point get_image_position (int coord_type) { AccessibleComponent acc_component = ac.getAccessibleComponent(); if (acc_component == null) { return null; } if (coord_type == AtkCoordType.SCREEN) { return acc_component.getLocationOnScreen(); } return acc_component.getLocation(); } public String get_image_description () { String desc = ""; if (acc_icons != null && acc_icons.length > 0) { desc = acc_icons[0].getAccessibleIconDescription(); if (desc == null) { desc = ""; } } return desc; } public Dimension get_image_size () { Dimension d = new Dimension(0, 0); if (acc_icons != null && acc_icons.length > 0) { d.height = acc_icons[0].getAccessibleIconHeight(); d.width = acc_icons[0].getAccessibleIconWidth(); } return d; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkKeyEvent.java000066400000000000000000000456611255546517100306050ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import java.awt.event.*; import java.util.HashMap; public class AtkKeyEvent { private static HashMapnonAlphaNumericMap = null; public static final int ATK_KEY_EVENT_PRESSED = 0; public static final int ATK_KEY_EVENT_RELEASED = 1; public int type; public boolean isShiftKeyDown = false; public boolean isCtrlKeyDown = false; public boolean isAltKeyDown = false; public boolean isMetaKeyDown = false; public int keyval = 0; public String string; public int keycode; public int timestamp; static { // Non-alphanumeric symbols that need to be mapped to X11 keysym names nonAlphaNumericMap = new HashMap<>( 40 ); nonAlphaNumericMap.put("!", "exclam"); nonAlphaNumericMap.put("@", "at"); nonAlphaNumericMap.put("#", "numbersign"); nonAlphaNumericMap.put("$", "dollar"); nonAlphaNumericMap.put("%", "percent"); nonAlphaNumericMap.put("^", "asciicircum"); nonAlphaNumericMap.put("&", "ampersand"); nonAlphaNumericMap.put("*", "asterisk"); nonAlphaNumericMap.put("(", "parenleft"); nonAlphaNumericMap.put(")", "parenright"); nonAlphaNumericMap.put("-", "minus"); nonAlphaNumericMap.put("_", "underscore"); nonAlphaNumericMap.put("=", "equal"); nonAlphaNumericMap.put("+", "plus"); nonAlphaNumericMap.put("\\", "backslash"); nonAlphaNumericMap.put("|", "bar"); nonAlphaNumericMap.put("`", "grave"); nonAlphaNumericMap.put("~", "asciitilde"); nonAlphaNumericMap.put("[", "bracketleft"); nonAlphaNumericMap.put("{", "braceleft"); nonAlphaNumericMap.put("]", "bracketright"); nonAlphaNumericMap.put("}", "braceright"); nonAlphaNumericMap.put(";", "semicolon"); nonAlphaNumericMap.put(":", "colon"); nonAlphaNumericMap.put("'", "apostrophe"); nonAlphaNumericMap.put("\"", "quotedbl"); nonAlphaNumericMap.put(",", "comma"); nonAlphaNumericMap.put("<", "less"); nonAlphaNumericMap.put(".", "period"); nonAlphaNumericMap.put(">", "greater"); nonAlphaNumericMap.put("/", "slash"); nonAlphaNumericMap.put("?", "question"); } public AtkKeyEvent (KeyEvent e) { //type switch (e.getID()) { case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_TYPED: type = ATK_KEY_EVENT_PRESSED; break; case KeyEvent.KEY_RELEASED: type = ATK_KEY_EVENT_RELEASED; break; default: type = ATK_KEY_EVENT_PRESSED; } //modifiers int modifierMask = e.getModifiersEx(); if ((modifierMask & InputEvent.SHIFT_DOWN_MASK) != 0) { isShiftKeyDown = true; } if ((modifierMask & InputEvent.CTRL_DOWN_MASK) != 0) { isCtrlKeyDown = true; } if ((modifierMask & InputEvent.ALT_DOWN_MASK) != 0) { isAltKeyDown = true; } if ((modifierMask & InputEvent.META_DOWN_MASK) != 0) { isMetaKeyDown = true; } GNOMEKeyMapping.GNOMEKeyInfo keyInfo = GNOMEKeyMapping.getKey(e); switch (e.getKeyChar()) { case KeyEvent.CHAR_UNDEFINED: { if (keyInfo != null) { keyval = keyInfo.getGdkKeyCode(); string = keyInfo.getGdkKeyString(); } else { string = KeyEvent.getKeyText(e.getKeyCode()); if (string == null) string = ""; } break; } default: { char[] chars = new char[1]; if (keyInfo == null) { keyval = e.getKeyChar(); chars[0] = (char)keyval; string = new String(chars); } else { keyval = keyInfo.getGdkKeyCode(); string = keyInfo.getGdkKeyString(); } } } keycode = e.getKeyCode(); timestamp = (int)e.getWhen(); String nonAlphaNumericString = (String) nonAlphaNumericMap.get(string); if (nonAlphaNumericString != null) string = nonAlphaNumericString; } } class GNOMEKeyMapping { private static HashMapkeyMap = null; public static final class GNOMEKeyInfo { private int gdkKeyCode; private String gdkKeyString; public GNOMEKeyInfo ( int code, String string ) { gdkKeyCode = code; gdkKeyString = string; } public int getGdkKeyCode() { return gdkKeyCode; } public String getGdkKeyString() { return gdkKeyString; } } // Used to offset VK for NUMPAD keys that don't have a VK_KP_* equivalent. // // At present max VK_* value is 0x0000FFFF // // Also need to support Left/Right variations private final static int NUMPAD_OFFSET = 0xFEFE0000; private final static int LEFT_OFFSET = 0xFEFD0000; private final static int RIGHT_OFFSET = 0xFEFC0000; static { initializeMap(); } public static GNOMEKeyInfo getKey( KeyEvent e ) { GNOMEKeyInfo gdkKeyInfo; int javaKeyCode = e.getKeyCode(); int javaKeyLocation = e.getKeyLocation(); if (javaKeyLocation == KeyEvent.KEY_LOCATION_NUMPAD) javaKeyCode += NUMPAD_OFFSET; else if (javaKeyLocation == KeyEvent.KEY_LOCATION_LEFT) javaKeyCode += LEFT_OFFSET; else if (javaKeyLocation == KeyEvent.KEY_LOCATION_RIGHT) javaKeyCode += RIGHT_OFFSET; if ( (gdkKeyInfo = (GNOMEKeyInfo)keyMap.get ( new Integer(javaKeyCode) )) != null ) { return ( gdkKeyInfo ); } else { return null; } } private GNOMEKeyMapping() { } private static void initializeMap() { keyMap = new HashMap<>( 146 ); // Currently only 110, so allocate 110 / 0.75 keyMap.put( new Integer(KeyEvent.VK_COLON), new GNOMEKeyInfo( 0x20a1, "ColonSign" ) ); // GDK_ColonSign keyMap.put( new Integer(KeyEvent.VK_EURO_SIGN), new GNOMEKeyInfo( 0x20ac, "EuroSign" ) ); // GDK_EuroSign keyMap.put( new Integer(KeyEvent.VK_BACK_SPACE), new GNOMEKeyInfo( 0xFF08, "BackSpace" ) ); // GDK_BackSpace keyMap.put( new Integer(KeyEvent.VK_TAB), new GNOMEKeyInfo( 0xFF09, "Tab" ) ); // GDK_Tab keyMap.put( new Integer(KeyEvent.VK_CLEAR), new GNOMEKeyInfo( 0xFF0B, "Clear" ) ); // GDK_Clear keyMap.put( new Integer(KeyEvent.VK_ENTER), new GNOMEKeyInfo( 0xFF0D, "Return" ) ); // GDK_Return keyMap.put( new Integer(KeyEvent.VK_PAUSE), new GNOMEKeyInfo( 0xFF13, "Pause" ) ); // GDK_Pause keyMap.put( new Integer(KeyEvent.VK_SCROLL_LOCK), new GNOMEKeyInfo( 0xFF14, "Scroll_Lock" ) ); // GDK_Scroll_Lock keyMap.put( new Integer(KeyEvent.VK_ESCAPE), new GNOMEKeyInfo( 0xFF1B, "Escape" ) ); // GDK_Escape keyMap.put( new Integer(KeyEvent.VK_KANJI), new GNOMEKeyInfo( 0xFF21, "Kanji" ) ); // GDK_Kanji keyMap.put( new Integer(KeyEvent.VK_HIRAGANA), new GNOMEKeyInfo( 0xFF25, "Hiragana" ) ); // GDK_Hiragana keyMap.put( new Integer(KeyEvent.VK_KATAKANA), new GNOMEKeyInfo( 0xFF26, "Katakana" ) ); // GDK_Katakana keyMap.put( new Integer(KeyEvent.VK_KANA_LOCK), new GNOMEKeyInfo( 0xFF2D, "Kana_Lock" ) ); // GDK_Kana_Lock keyMap.put( new Integer(KeyEvent.VK_KANA), new GNOMEKeyInfo( 0xFF2E, "Kana_Shift" ) ); // GDK_Kana_Shift keyMap.put( new Integer(KeyEvent.VK_KANJI), new GNOMEKeyInfo( 0xFF37, "Kanji_Bangou" ) ); // GDK_Kanji_Bangou keyMap.put( new Integer(KeyEvent.VK_HOME), new GNOMEKeyInfo( 0xFF50, "Home" ) ); // GDK_Home keyMap.put( new Integer(KeyEvent.VK_LEFT), new GNOMEKeyInfo( 0xFF51, "Left" ) ); // GDK_Left keyMap.put( new Integer(KeyEvent.VK_UP), new GNOMEKeyInfo( 0xFF52, "Up" ) ); // GDK_Up keyMap.put( new Integer(KeyEvent.VK_RIGHT), new GNOMEKeyInfo( 0xFF53, "Right" ) ); // GDK_Right keyMap.put( new Integer(KeyEvent.VK_DOWN), new GNOMEKeyInfo( 0xFF54, "Down" ) ); // GDK_Down keyMap.put( new Integer(KeyEvent.VK_PAGE_UP), new GNOMEKeyInfo( 0xFF55, "Page_Up" ) ); // GDK_Page_Up keyMap.put( new Integer(KeyEvent.VK_PAGE_DOWN), new GNOMEKeyInfo( 0xFF56, "Page_Down" ) ); // GDK_Page_Down keyMap.put( new Integer(KeyEvent.VK_END), new GNOMEKeyInfo( 0xFF57, "End" ) ); // GDK_End keyMap.put( new Integer(KeyEvent.VK_PRINTSCREEN), new GNOMEKeyInfo( 0xFF61, "Print" ) ); // GDK_Print keyMap.put( new Integer(KeyEvent.VK_INSERT), new GNOMEKeyInfo( 0xFF63, "Insert" ) ); // GDK_Insert keyMap.put( new Integer(KeyEvent.VK_UNDO), new GNOMEKeyInfo( 0xFF65, "Undo" ) ); // GDK_Undo keyMap.put( new Integer(KeyEvent.VK_AGAIN), new GNOMEKeyInfo( 0xFF66, "Redo" ) ); // GDK_Redo keyMap.put( new Integer(KeyEvent.VK_FIND), new GNOMEKeyInfo( 0xFF68, "Find" ) ); // GDK_Find keyMap.put( new Integer(KeyEvent.VK_CANCEL), new GNOMEKeyInfo( 0xFF69, "Cancel" ) ); // GDK_Cancel keyMap.put( new Integer(KeyEvent.VK_HELP), new GNOMEKeyInfo( 0xFF6A, "Help" ) ); // GDK_Help keyMap.put( new Integer(KeyEvent.VK_ALT_GRAPH), new GNOMEKeyInfo( 0xFF7E, "Mode_Switch" ) ); // GDK_Mode_Switch keyMap.put( new Integer(KeyEvent.VK_NUM_LOCK), new GNOMEKeyInfo( 0xFF7F, "Num_Lock" ) ); // GDK_Num_Lock keyMap.put( new Integer(KeyEvent.VK_KP_LEFT), new GNOMEKeyInfo( 0xFF96, "KP_Left" ) ); // GDK_KP_Left keyMap.put( new Integer(KeyEvent.VK_KP_UP), new GNOMEKeyInfo( 0xFF97, "KP_Up" ) ); // GDK_KP_Up keyMap.put( new Integer(KeyEvent.VK_KP_RIGHT), new GNOMEKeyInfo( 0xFF98, "KP_Right" ) ); // GDK_KP_Right keyMap.put( new Integer(KeyEvent.VK_KP_DOWN), new GNOMEKeyInfo( 0xFF99, "KP_Down" ) ); // GDK_KP_Down // For Key's that are NUMPAD, but no VK_KP_* equivalent exists // NOTE: Some syms do have VK_KP equivalents, but may or may not have // KeyLocation() set to NUMPAD - so these are in twice with and // without the offset.. keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUM_LOCK), new GNOMEKeyInfo( 0xFF7F, "Num_Lock" ) ); // GDK_Num_Lock keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_ENTER), new GNOMEKeyInfo( 0xFF8D, "KP_Enter" ) ); // GDK_KP_Enter keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_HOME), new GNOMEKeyInfo( 0xFF95, "KP_Home" ) ); // GDK_KP_Home keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_KP_LEFT), new GNOMEKeyInfo( 0xFF96, "KP_Left" ) ); // GDK_KP_Left keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_KP_UP), new GNOMEKeyInfo( 0xFF97, "KP_Up" ) ); // GDK_KP_Up keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_KP_RIGHT), new GNOMEKeyInfo( 0xFF98, "KP_Right" ) ); // GDK_KP_Right keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_KP_DOWN), new GNOMEKeyInfo( 0xFF99, "KP_Down" ) ); // GDK_KP_Down keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_PAGE_UP), new GNOMEKeyInfo( 0xFF9A, "KP_Page_Up" ) ); // GDK_KP_Page_Up keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_PAGE_DOWN), new GNOMEKeyInfo( 0xFF9B, "KP_Page_Down" ) ); // GDK_KP_Page_Down keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_END), new GNOMEKeyInfo( 0xFF9C, "KP_End" ) ); // GDK_KP_End keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_BEGIN), new GNOMEKeyInfo( 0xFF9D, "KP_Begin" ) ); // GDK_KP_Begin keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_INSERT), new GNOMEKeyInfo( 0xFF9E, "KP_Insert" ) ); // GDK_KP_Insert keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DELETE), new GNOMEKeyInfo( 0xFF9F, "KP_Delete" ) ); // GDK_KP_Delete keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_MULTIPLY), new GNOMEKeyInfo( 0xFFAA, "KP_Multiply" ) ); // GDK_KP_Multiply keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_ADD), new GNOMEKeyInfo( 0xFFAB, "KP_Add" ) ); // GDK_KP_Add keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_SEPARATOR), new GNOMEKeyInfo( 0xFFAC, "KP_Separator" ) ); // GDK_KP_Separator keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_SUBTRACT), new GNOMEKeyInfo( 0xFFAD, "KP_Subtract" ) ); // GDK_KP_Subtract keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DECIMAL), new GNOMEKeyInfo( 0xFFAE, "KP_Decimal" ) ); // GDK_KP_Decimal keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DIVIDE), new GNOMEKeyInfo( 0xFFAF, "KP_Divide" ) ); // GDK_KP_Divide keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD0), new GNOMEKeyInfo( 0xFFB0, "KP_0" ) ); // GDK_KP_0 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD1), new GNOMEKeyInfo( 0xFFB1, "KP_1" ) ); // GDK_KP_1 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD2), new GNOMEKeyInfo( 0xFFB2, "KP_2" ) ); // GDK_KP_2 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD3), new GNOMEKeyInfo( 0xFFB3, "KP_3" ) ); // GDK_KP_3 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD4), new GNOMEKeyInfo( 0xFFB4, "KP_4" ) ); // GDK_KP_4 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD5), new GNOMEKeyInfo( 0xFFB5, "KP_5" ) ); // GDK_KP_5 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD6), new GNOMEKeyInfo( 0xFFB6, "KP_6" ) ); // GDK_KP_6 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD7), new GNOMEKeyInfo( 0xFFB7, "KP_7" ) ); // GDK_KP_7 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD8), new GNOMEKeyInfo( 0xFFB8, "KP_8" ) ); // GDK_KP_8 keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD9), new GNOMEKeyInfo( 0xFFB9, "KP_9" ) ); // GDK_KP_9 keyMap.put( new Integer(KeyEvent.VK_NUMPAD0), new GNOMEKeyInfo( 0xFFB0, "KP_0" ) ); // GDK_KP_0 keyMap.put( new Integer(KeyEvent.VK_NUMPAD1), new GNOMEKeyInfo( 0xFFB1, "KP_1" ) ); // GDK_KP_1 keyMap.put( new Integer(KeyEvent.VK_NUMPAD2), new GNOMEKeyInfo( 0xFFB2, "KP_2" ) ); // GDK_KP_2 keyMap.put( new Integer(KeyEvent.VK_NUMPAD3), new GNOMEKeyInfo( 0xFFB3, "KP_3" ) ); // GDK_KP_3 keyMap.put( new Integer(KeyEvent.VK_NUMPAD4), new GNOMEKeyInfo( 0xFFB4, "KP_4" ) ); // GDK_KP_4 keyMap.put( new Integer(KeyEvent.VK_NUMPAD5), new GNOMEKeyInfo( 0xFFB5, "KP_5" ) ); // GDK_KP_5 keyMap.put( new Integer(KeyEvent.VK_NUMPAD6), new GNOMEKeyInfo( 0xFFB6, "KP_6" ) ); // GDK_KP_6 keyMap.put( new Integer(KeyEvent.VK_NUMPAD7), new GNOMEKeyInfo( 0xFFB7, "KP_7" ) ); // GDK_KP_7 keyMap.put( new Integer(KeyEvent.VK_NUMPAD8), new GNOMEKeyInfo( 0xFFB8, "KP_8" ) ); // GDK_KP_8 keyMap.put( new Integer(KeyEvent.VK_NUMPAD9), new GNOMEKeyInfo( 0xFFB9, "KP_9" ) ); // GDK_KP_9 keyMap.put( new Integer(KeyEvent.VK_F1), new GNOMEKeyInfo( 0xFFBE, "F1" ) ); // GDK_F1 keyMap.put( new Integer(KeyEvent.VK_F2), new GNOMEKeyInfo( 0xFFBF, "F2" ) ); // GDK_F2 keyMap.put( new Integer(KeyEvent.VK_F3), new GNOMEKeyInfo( 0xFFC0, "F3" ) ); // GDK_F3 keyMap.put( new Integer(KeyEvent.VK_F4), new GNOMEKeyInfo( 0xFFC1, "F4" ) ); // GDK_F4 keyMap.put( new Integer(KeyEvent.VK_F5), new GNOMEKeyInfo( 0xFFC2, "F5" ) ); // GDK_F5 keyMap.put( new Integer(KeyEvent.VK_F6), new GNOMEKeyInfo( 0xFFC3, "F6" ) ); // GDK_F6 keyMap.put( new Integer(KeyEvent.VK_F7), new GNOMEKeyInfo( 0xFFC4, "F7" ) ); // GDK_F7 keyMap.put( new Integer(KeyEvent.VK_F8), new GNOMEKeyInfo( 0xFFC5, "F8" ) ); // GDK_F8 keyMap.put( new Integer(KeyEvent.VK_F9), new GNOMEKeyInfo( 0xFFC6, "F9" ) ); // GDK_F9 keyMap.put( new Integer(KeyEvent.VK_F10), new GNOMEKeyInfo( 0xFFC7, "F10" ) ); // GDK_F10 keyMap.put( new Integer(KeyEvent.VK_F11), new GNOMEKeyInfo( 0xFFC8, "F11" ) ); // GDK_F11 keyMap.put( new Integer(KeyEvent.VK_F12), new GNOMEKeyInfo( 0xFFC9, "F12" ) ); // GDK_F12 keyMap.put( new Integer(KeyEvent.VK_F13), new GNOMEKeyInfo( 0xFFCA, "F13" ) ); // GDK_F13 keyMap.put( new Integer(KeyEvent.VK_F14), new GNOMEKeyInfo( 0xFFCB, "F14" ) ); // GDK_F14 keyMap.put( new Integer(KeyEvent.VK_F15), new GNOMEKeyInfo( 0xFFCC, "F15" ) ); // GDK_F15 keyMap.put( new Integer(KeyEvent.VK_F16), new GNOMEKeyInfo( 0xFFCD, "F16" ) ); // GDK_F16 keyMap.put( new Integer(KeyEvent.VK_F17), new GNOMEKeyInfo( 0xFFCE, "F17" ) ); // GDK_F17 keyMap.put( new Integer(KeyEvent.VK_F18), new GNOMEKeyInfo( 0xFFCF, "F18" ) ); // GDK_F18 keyMap.put( new Integer(KeyEvent.VK_F19), new GNOMEKeyInfo( 0xFFD0, "F19" ) ); // GDK_F19 keyMap.put( new Integer(KeyEvent.VK_F20), new GNOMEKeyInfo( 0xFFD1, "F20" ) ); // GDK_F20 keyMap.put( new Integer(KeyEvent.VK_F21), new GNOMEKeyInfo( 0xFFD2, "F21" ) ); // GDK_F21 keyMap.put( new Integer(KeyEvent.VK_F22), new GNOMEKeyInfo( 0xFFD3, "F22" ) ); // GDK_F22 keyMap.put( new Integer(KeyEvent.VK_F23), new GNOMEKeyInfo( 0xFFD4, "F23" ) ); // GDK_F23 keyMap.put( new Integer(KeyEvent.VK_F24), new GNOMEKeyInfo( 0xFFD5, "F24" ) ); // GDK_F24 keyMap.put( new Integer(KeyEvent.VK_SHIFT), new GNOMEKeyInfo( 0xFFE2, "Shift_R" ) ); // GDK_Shift_R keyMap.put( new Integer(KeyEvent.VK_CONTROL), new GNOMEKeyInfo( 0xFFE4, "Control_R" ) ); // GDK_Control_R keyMap.put( new Integer(KeyEvent.VK_CAPS_LOCK), new GNOMEKeyInfo( 0xFFE5, "Caps_Lock" ) ); // GDK_Caps_Lock keyMap.put( new Integer(KeyEvent.VK_META), new GNOMEKeyInfo( 0xFFE8, "Meta_R" ) ); // GDK_Meta_R keyMap.put( new Integer(KeyEvent.VK_ALT), new GNOMEKeyInfo( 0xFFEA, "Alt_R" ) ); // GDK_Alt_R keyMap.put( new Integer(KeyEvent.VK_DELETE), new GNOMEKeyInfo( 0xFFFF, "Delete" ) ); // GDK_Delete // Left & Right Variations, default (set above) will be right... keyMap.put( new Integer(LEFT_OFFSET + KeyEvent.VK_SHIFT), new GNOMEKeyInfo( 0xFFE1, "Shift_L" ) ); // GDK_Shift_L keyMap.put( new Integer(RIGHT_OFFSET + KeyEvent.VK_SHIFT), new GNOMEKeyInfo( 0xFFE2, "Shift_R" ) ); // GDK_Shift_R keyMap.put( new Integer(LEFT_OFFSET + KeyEvent.VK_CONTROL),new GNOMEKeyInfo( 0xFFE3, "Control_L" ) ); // GDK_Control_L keyMap.put( new Integer(RIGHT_OFFSET + KeyEvent.VK_CONTROL),new GNOMEKeyInfo( 0xFFE4, "Control_R" ) ); // GDK_Control_R keyMap.put( new Integer(LEFT_OFFSET + KeyEvent.VK_META), new GNOMEKeyInfo( 0xFFE7, "Meta_L" ) ); // GDK_Meta_L keyMap.put( new Integer(RIGHT_OFFSET + KeyEvent.VK_META), new GNOMEKeyInfo( 0xFFE8, "Meta_R" ) ); // GDK_Meta_R keyMap.put( new Integer(LEFT_OFFSET + KeyEvent.VK_ALT), new GNOMEKeyInfo( 0xFFE9, "Alt_L" ) ); // GDK_Alt_L keyMap.put( new Integer(RIGHT_OFFSET + KeyEvent.VK_ALT), new GNOMEKeyInfo( 0xFFEA, "Alt_R" ) ); // GDK_Alt_R } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkLayer.java000066400000000000000000000020751255546517100301170ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; public interface AtkLayer { public int INVALID = 0; public int BACKGROUND = 1; public int CANVAS = 2; public int WIDGET = 3; public int MDI = 4; public int POPUP = 5; public int OVERLAY = 6; public int WINDOW = 7; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkSelection.java000066400000000000000000000042501255546517100307650ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkSelection { AccessibleContext ac; AccessibleSelection acc_selection; public AtkSelection (AccessibleContext ac) { super(); this.ac = ac; this.acc_selection = ac.getAccessibleSelection(); } public boolean add_selection (int i) { acc_selection.addAccessibleSelection(i); return is_child_selected(i); } public boolean clear_selection () { acc_selection.clearAccessibleSelection(); return true; } public javax.accessibility.Accessible ref_selection (int i) { return acc_selection.getAccessibleSelection(i); } public int get_selection_count () { int count = 0; for(int i = 0; i < ac.getAccessibleChildrenCount(); i++) { if (acc_selection.isAccessibleChildSelected(i)) count++; } return count; //A bug in AccessibleJMenu?? //return acc_selection.getAccessibleSelectionCount(); } public boolean is_child_selected (int i) { return acc_selection.isAccessibleChildSelected(i); } public boolean remove_selection (int i) { acc_selection.removeAccessibleSelection(i); return !is_child_selected(i); } public boolean select_all_selection () { AccessibleStateSet stateSet = ac.getAccessibleStateSet(); if (stateSet.contains(AccessibleState.MULTISELECTABLE)) { acc_selection.selectAllAccessibleSelection(); return true; } return false; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkSignal.java000066400000000000000000000040701255546517100302550ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; public interface AtkSignal { public int TEXT_CARET_MOVED = 0; public int TEXT_PROPERTY_CHANGED_INSERT = 1; public int TEXT_PROPERTY_CHANGED_DELETE = 2; public int TEXT_PROPERTY_CHANGED_REPLACE = 3; public int OBJECT_CHILDREN_CHANGED_ADD = 4; public int OBJECT_CHILDREN_CHANGED_REMOVE = 5; public int OBJECT_ACTIVE_DESCENDANT_CHANGED = 6; public int OBJECT_SELECTION_CHANGED = 7; public int OBJECT_VISIBLE_DATA_CHANGED = 8; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_ACTIONS = 9; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_VALUE = 10; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_DESCRIPTION = 11; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_NAME = 12; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_HYPERTEXT_OFFSET = 13; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_CAPTION = 14; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_SUMMARY = 15; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_COLUMN_HEADER = 16; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_COLUMN_DESCRIPTION = 17; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_ROW_HEADER = 18; public int OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_ROW_DESCRIPTION = 19; public int TABLE_MODEL_CHANGED = 20; public int TEXT_PROPERTY_CHANGED = 21; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkTable.java000066400000000000000000000144411255546517100300720ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkTable { AccessibleContext ac; AccessibleTable acc_table; public AtkTable (AccessibleContext ac) { this.ac = ac; this.acc_table = ac.getAccessibleTable(); } public AccessibleContext ref_at (int row, int column) { javax.accessibility.Accessible accessible = acc_table.getAccessibleAt(row, column); if (accessible != null) { return accessible.getAccessibleContext(); } return null; } public int get_column_at_index (int index) { int column = -1; if (acc_table instanceof AccessibleExtendedTable) { column = ((AccessibleExtendedTable)acc_table).getAccessibleColumn(index); } return column; } public int get_row_at_index (int index) { int row = -1; if (acc_table instanceof AccessibleExtendedTable) { row = ((AccessibleExtendedTable)acc_table).getAccessibleRow(index); } return row; } public int get_n_columns () { return acc_table.getAccessibleColumnCount(); } public int get_n_rows () { return acc_table.getAccessibleRowCount(); } public int get_column_extent_at (int row, int column) { return acc_table.getAccessibleColumnExtentAt(row, column); } public int get_row_extent_at (int row, int column) { return acc_table.getAccessibleRowExtentAt(row, column); } public AccessibleContext get_caption () { javax.accessibility.Accessible accessible = acc_table.getAccessibleCaption(); if (accessible != null) { return accessible.getAccessibleContext(); } return null; } /** * * @param a an Accessible object */ public void setCaption(Accessible a) { acc_table.setAccessibleCaption(a); } public String get_column_description (int column) { javax.accessibility.Accessible accessible = acc_table.getAccessibleColumnDescription(column); if (accessible != null) { return accessible.getAccessibleContext().getAccessibleDescription(); } return ""; } /** * * @param column an int representing a column in table * @param description a String object representing the description text to set for the * specified column of the table */ public void setColumnDescription(int column, String description) { javax.accessibility.Accessible accessible = acc_table.getAccessibleColumnDescription(column); if (description.equals(accessible.toString()) && accessible != null) { acc_table.setAccessibleColumnDescription(column, accessible); } } public String get_row_description (int row) { javax.accessibility.Accessible accessible = acc_table.getAccessibleRowDescription(row); if (accessible != null) { return accessible.getAccessibleContext().getAccessibleDescription(); } return ""; } /** * * @param row an int representing a row in table * @param description a String object representing the description text to set for the * specified row of the table */ public void setRowDescription(int row, String description) { javax.accessibility.Accessible accessible = acc_table.getAccessibleRowDescription(row); if (description.equals(accessible.toString()) && accessible != null) { acc_table.setAccessibleRowDescription(row, accessible); } } public AccessibleContext get_column_header (int column) { AccessibleTable accessibleTable = acc_table.getAccessibleColumnHeader(); if (accessibleTable != null) { javax.accessibility.Accessible accessible = accessibleTable.getAccessibleAt(0, column); if (accessible != null) { return accessible.getAccessibleContext(); } } return null; } /** * * @param column an int representing a column in table * @param table an AccessibleTable object */ public void setColumnHeader (int column, AccessibleTable table) { acc_table.setAccessibleColumnHeader(table); } public AccessibleContext get_row_header (int row) { AccessibleTable accessibleTable = acc_table.getAccessibleRowHeader(); if (accessibleTable != null) { javax.accessibility.Accessible accessible = accessibleTable.getAccessibleAt(row, 0); if (accessible != null) { return accessible.getAccessibleContext(); } } return null; } public void setRowHeader (int row, AccessibleTable table) { acc_table.setAccessibleRowHeader(table); } public AccessibleContext get_summary () { javax.accessibility.Accessible accessible = acc_table.getAccessibleSummary(); if (accessible != null) { return accessible.getAccessibleContext(); } return null; } /** * * @param a the Accessible object to set summary for */ public void setSummary(Accessible a) { acc_table.setAccessibleSummary(a); } public int[] get_selected_columns () { return acc_table.getSelectedAccessibleColumns(); } public int[] get_selected_rows () { return acc_table.getSelectedAccessibleRows(); } public boolean is_column_selected (int column) { return acc_table.isAccessibleColumnSelected(column); } public boolean is_row_selected (int row) { return acc_table.isAccessibleRowSelected(row); } public boolean is_selected (int row, int column) { return acc_table.isAccessibleSelected(row, column); } public boolean addColumnSelection (int column) { return false; } public boolean addRowSelection (int row) { return false; } public boolean remove_column_selection (int column) { return false; } public boolean remove_row_selection (int row) { return false; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkTableCell.java000066400000000000000000000056721255546517100307000ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkTableCell extends AtkTable { AccessibleContext ac; AccessibleExtendedTable acc_table_cell; private int rowSpan, columnSpan; public AtkTableCell (AccessibleContext ac) { super(ac); this.ac = ac; AccessibleTable acc_table = ac.getAccessibleTable(); if (acc_table instanceof AccessibleExtendedTable) { acc_table_cell = (AccessibleExtendedTable)acc_table; } else { acc_table_cell = null; } rowSpan = 0; columnSpan = 0; } /** * getTable * @return: Reference to the accessible of the containing table as an * AccessibleTable instance. */ public AccessibleTable getTable() { System.out.println("Get Table: " + acc_table_cell.toString()); return acc_table_cell; } /** * @param row the row of the accessible table cell * @param column the column of the accessible table cell * @return: whether the accessible index of the table cell is found */ public boolean getPosition(int row, int column) { int index = acc_table_cell.getAccessibleIndex(row, column); if (index < 0) return false; return true; } /** * @param row the row of the accessible table cell * @param column the column of the accessible table cell * @param rowSpan the row span of the accessible table cell the * @param columnSpan the column span of the accessible table cell * @return: whether the column and row span was retrieved */ public boolean getRowColumnSpan(int row, int column, int rowSpan, int columnSpan) { this.rowSpan = rowSpan; this.columnSpan = columnSpan; rowSpan = acc_table.getAccessibleRowExtentAt(row, column); columnSpan = acc_table.getAccessibleColumnExtentAt(row, column); if (rowSpan < 0 && columnSpan < 0) return false; return true; } /** * @return: span of the table_cell row as an int */ public int getRowSpan() { if (rowSpan < 0) return -1; return rowSpan; } /** * @return: span of the table_cell column as an int */ public int getColumnSpan() { if (columnSpan < 0) return -1; return columnSpan; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkText.java000066400000000000000000000271121255546517100277660ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; import java.text.*; import java.awt.Rectangle; import java.awt.Point; public class AtkText { AccessibleContext ac; AccessibleText acc_text; public class StringSequence { public String str; public int start_offset, end_offset; public StringSequence (String str, int start_offset, int end_offset) { this.str = str; this.start_offset = start_offset; this.end_offset = end_offset; } } public AtkText (AccessibleContext ac) { super(); this.ac = ac; this.acc_text = ac.getAccessibleText(); } /* Return string from start, up to, but not including end */ public String get_text (int start, int end) { int count = acc_text.getCharCount(); if (start < 0) start = 0; if (end > count || end ==-1) end = count; if (end < -1) end = 0; if (acc_text instanceof AccessibleExtendedText) { AccessibleExtendedText acc_ext_text = (AccessibleExtendedText)acc_text; return acc_ext_text.getTextRange(start, end); } StringBuffer buf = new StringBuffer(); for (int i = start; i <= end-1; i++) { String str = acc_text.getAtIndex( AccessibleText.CHARACTER, i); buf.append(str); } return buf.toString(); } public char get_character_at_offset (int offset) { String str = acc_text.getAtIndex( AccessibleText.CHARACTER, offset); if (str == null || str.length() == 0) { return 0; } return str.charAt(0); } public StringSequence get_text_at_offset (int offset, int boundary_type) { if (acc_text instanceof AccessibleExtendedText) { AccessibleExtendedText acc_ext_text = (AccessibleExtendedText)acc_text; int part = getPartTypeFromBoundary(boundary_type); if (part == -1) { return null; } AccessibleTextSequence seq = acc_ext_text.getTextSequenceAt(part, offset); return new StringSequence(seq.text, seq.startIndex, seq.endIndex+1); } else { return private_get_text_at_offset(offset, boundary_type); } } public int get_caret_offset () { return acc_text.getCaretPosition(); } public Rectangle get_character_extents (int offset, int coord_type) { Rectangle rect = acc_text.getCharacterBounds(offset); if (rect == null) { return null; } if (coord_type == AtkCoordType.SCREEN) { AccessibleComponent component = ac.getAccessibleComponent(); if (component == null) { return null; } Point p = component.getLocationOnScreen(); rect.x += p.x; rect.y += p.y; } return rect; } public int get_character_count () { return acc_text.getCharCount(); } public int get_offset_at_point (int x, int y, int coord_type) { if (coord_type == AtkCoordType.SCREEN) { AccessibleComponent component = ac.getAccessibleComponent(); if (component == null) { return -1; } Point p = component.getLocationOnScreen(); x -= p.x; y -= p.y; } return acc_text.getIndexAtPoint(new Point(x, y)); } public Rectangle get_range_extents (int start, int end, int coord_type) { if (acc_text instanceof AccessibleExtendedText) { AccessibleExtendedText acc_ext_text = (AccessibleExtendedText)acc_text; Rectangle rect = acc_ext_text.getTextBounds(start, end-1); if (rect == null) { return null; } if (coord_type == AtkCoordType.SCREEN) { AccessibleComponent component = ac.getAccessibleComponent(); if (component == null) { return null; } Point p = component.getLocationOnScreen(); rect.x += p.x; rect.y += p.y; } return rect; } else { return null; } } public int get_n_selections () { String str = acc_text.getSelectedText(); if (str != null && str.length() > 0) { return 1; } else { return 0; } } public StringSequence get_selection () { int start = acc_text.getSelectionStart(); int end = acc_text.getSelectionEnd() + 1; String text = acc_text.getSelectedText(); if (text == null) { return null; } return new StringSequence(text, start, end); } public boolean add_selection (int start, int end) { AccessibleEditableText acc_edt_text = ac.getAccessibleEditableText(); if (acc_edt_text == null || get_n_selections() > 0) { return false; } return set_selection(0, start, end); } public boolean remove_selection(int selection_num) { AccessibleEditableText acc_edt_text = ac.getAccessibleEditableText(); if (acc_edt_text == null || selection_num > 0) { return false; } acc_edt_text.selectText(0, 0); return true; } public boolean set_selection (int selection_num, int start, int end) { AccessibleEditableText acc_edt_text = ac.getAccessibleEditableText(); if (acc_edt_text == null || selection_num > 0) { return false; } acc_edt_text.selectText(start, end-1); return true; } public boolean set_caret_offset (int offset) { AccessibleEditableText acc_edt_text = ac.getAccessibleEditableText(); if (acc_edt_text != null) { acc_edt_text.selectText(offset, offset); return true; } return false; } private int getPartTypeFromBoundary (int boundary_type) { switch (boundary_type) { case AtkTextBoundary.CHAR : return AccessibleText.CHARACTER; case AtkTextBoundary.WORD_START : case AtkTextBoundary.WORD_END : return AccessibleText.WORD; case AtkTextBoundary.SENTENCE_START : case AtkTextBoundary.SENTENCE_END : return AccessibleText.SENTENCE; case AtkTextBoundary.LINE_START : case AtkTextBoundary.LINE_END : return AccessibleExtendedText.LINE; default : return -1; } } private int getNextWordStart (int offset, String str) { BreakIterator words = BreakIterator.getWordInstance(); words.setText(str); int start = words.following(offset); int end = words.next(); while (end != BreakIterator.DONE) { for (int i = start; i < end; i++) { if (Character.isLetter(str.codePointAt(i))) { return start; } } start = end; end = words.next(); } return BreakIterator.DONE; } private int getNextWordEnd (int offset, String str) { int start = getNextWordStart(offset, str); BreakIterator words = BreakIterator.getWordInstance(); words.setText(str); int next = words.following(offset); if (start == next) { return words.following(start); } else { return next; } } private int getPreviousWordStart (int offset, String str) { BreakIterator words = BreakIterator.getWordInstance(); words.setText(str); int start = words.preceding(offset); int end = words.next(); while (start != BreakIterator.DONE) { for (int i = start; i < end; i++) { if (Character.isLetter(str.codePointAt(i))) { return start; } } end = start; start = words.preceding(end); } return BreakIterator.DONE; } private int getPreviousWordEnd (int offset, String str) { int start = getPreviousWordStart(offset, str); BreakIterator words = BreakIterator.getWordInstance(); words.setText(str); int pre = words.preceding(offset); if (start == pre) { return words.preceding(start); } else { return pre; } } private int getNextSentenceStart (int offset, String str) { BreakIterator sentences = BreakIterator.getSentenceInstance(); sentences.setText(str); int start = sentences.following(offset); return start; } private int getNextSentenceEnd (int offset, String str) { int start = getNextSentenceStart(offset, str); if (start == BreakIterator.DONE) { return str.length(); } int index = start; do { index --; } while (index >= 0 && Character.isWhitespace(str.charAt(index))); index ++; if (index < offset) { start = getNextSentenceStart(start, str); if (start == BreakIterator.DONE) { return str.length(); } index = start; do { index --; } while (index >= 0 && Character.isWhitespace(str.charAt(index))); index ++; } return index; } private int getPreviousSentenceStart (int offset, String str) { BreakIterator sentences = BreakIterator.getSentenceInstance(); sentences.setText(str); int start = sentences.preceding(offset); return start; } private int getPreviousSentenceEnd (int offset, String str) { int start = getPreviousSentenceStart(offset, str); if (start == BreakIterator.DONE) { return 0; } int end = getNextSentenceEnd(start, str); if (offset < end) { start = getPreviousSentenceStart(start, str); if (start == BreakIterator.DONE) { return 0; } end = getNextSentenceEnd(start, str); } return end; } private StringSequence private_get_text_at_offset (int offset, int boundary_type) { int char_count = get_character_count(); if (offset < 0 || offset >= char_count) { return null; } switch (boundary_type) { case AtkTextBoundary.CHAR : { String str = get_text(offset, offset+1); return new StringSequence(str, offset, offset+1); } case AtkTextBoundary.WORD_START : { String s = get_text(0, get_character_count()); int start = getPreviousWordStart(offset, s); if (start == BreakIterator.DONE) { start = 0; } int end = getNextWordStart(offset, s); if (end == BreakIterator.DONE) { end = s.length(); } String str = get_text(start, end); return new StringSequence(str, start, end); } case AtkTextBoundary.WORD_END : { String s = get_text(0, get_character_count()); int start = getPreviousWordEnd(offset, s); if (start == BreakIterator.DONE) { start = 0; } int end = getNextWordEnd(offset, s); if (end == BreakIterator.DONE) { end = s.length(); } String str = get_text(start, end); return new StringSequence(str, start, end); } case AtkTextBoundary.SENTENCE_START : { String s = get_text(0, get_character_count()); int start = getPreviousSentenceStart(offset, s); if (start == BreakIterator.DONE) { start = 0; } int end = getNextSentenceStart(offset, s); if (end == BreakIterator.DONE) { end = s.length(); } String str = get_text(start, end); return new StringSequence(str, start, end); } case AtkTextBoundary.SENTENCE_END : { String s = get_text(0, get_character_count()); int start = getPreviousSentenceEnd(offset, s); if (start == BreakIterator.DONE) { start = 0; } int end = getNextSentenceEnd(offset, s); if (end == BreakIterator.DONE) { end = s.length(); } String str = get_text(start, end); return new StringSequence(str, start, end); } case AtkTextBoundary.LINE_START : case AtkTextBoundary.LINE_END : { BreakIterator lines = BreakIterator.getLineInstance(); String s = get_text(0, get_character_count()); lines.setText(s); int start = lines.preceding(offset); if (start == BreakIterator.DONE) { start = 0; } int end = lines.following(offset); if (end == BreakIterator.DONE) { end = s.length(); } String str = get_text(start, end); return new StringSequence(str, start, end); } default : { return null; } } } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkTextBoundary.java000066400000000000000000000021021255546517100314620ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems 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 */ package org.GNOME.Accessibility; public interface AtkTextBoundary { public int CHAR = 0; public int WORD_START = 1; public int WORD_END = 2; public int SENTENCE_START = 3; public int SENTENCE_END = 4; public int LINE_START = 5; public int LINE_END = 6; } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkTextGranularity.java000066400000000000000000000022341255546517100322060ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; public interface AtkTextGranularity { public int CHAR = 0; public int WORD = 1; public int SENTENCE = 2; public int LINE = 3; /* The LINE constant field value is in AccessibleExtendedText */ public int PARAGRAPH = 4; /* FThere is no constant field value, PARAGRAPH in AccessibleText */ } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkValue.java000066400000000000000000000030531255546517100301140ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; import javax.accessibility.*; public class AtkValue { AccessibleContext ac; AccessibleValue acc_value; public AtkValue (AccessibleContext ac) { super(); this.acc_value = ac.getAccessibleValue(); } public Number get_current_value () { return acc_value.getCurrentAccessibleValue(); } public double getMaximumValue () { return acc_value.getMaximumAccessibleValue().doubleValue(); } public double getMinimumValue () { return acc_value.getMinimumAccessibleValue().doubleValue(); } public void setValue (Number n) { acc_value.setCurrentAccessibleValue(n); } public double getIncrement() { return Double.MIN_VALUE; } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in000066400000000000000000000611761255546517100310770ustar00rootroot00000000000000/* * Java ATK Wrapper for GNOME * Copyright (C) 2009 Sun Microsystems Inc. * Copyright (C) 2015 Magdalen Berns * * 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 */ package org.GNOME.Accessibility; import java.awt.*; import java.awt.event.*; import java.beans.*; import java.io.*; import javax.accessibility.*; import java.awt.Toolkit; public class AtkWrapper { static boolean accessibilityEnabled = false; static { try { Process p = Runtime.getRuntime().exec("@XPROP@ -root"); BufferedReader b = new BufferedReader(new InputStreamReader (p.getInputStream ())); String result; while ((result = b.readLine()) != null) { if (result.indexOf("AT_SPI_IOR") >= 0 || result.indexOf("AT_SPI_BUS") >= 0) { System.loadLibrary("atk-wrapper"); if (AtkWrapper.initNativeLibrary()) accessibilityEnabled = true; break; } } } catch (Exception e) { e.printStackTrace(); e.getCause(); } } /** * winAdapter * * * */ final WindowAdapter winAdapter = new WindowAdapter() { /** * windowActivated: * Invoked when a Window becomes the active Window. * Only a Frame or a Dialog can be the active Window. The * native windowing system may denote the active Window * or its children with special decorations, such as a * highlighted title bar. The active Window is always either * the focused Window, or the first Frame or Dialog that is * an owner of the focused Window. * @param e A WindowEvent object */ public void windowActivated(WindowEvent e) { Object o = e.getSource(); if ( o instanceof javax.accessibility.Accessible ) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowActivate(ac); } } /** * windowDeactivated: * Invoked when a Window is no longer the active Window. * Only a Frame or a Dialog can be the active Window. The * native windowing system may denote the active Window * or its children with special decorations, such as a * highlighted title bar. The active Window is always either * the focused Window, or the first Frame or Dialog that is * an owner of the focused Window. * @param e A WindowEvent object */ public void windowDeactivated(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowDeactivate(ac); } } /** * windowStateChanged: * Invoked when a window state is changed. * * @param e A WindowEvent object */ public void windowStateChanged(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowStateChange(ac); if( (e.getNewState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH ) { AtkWrapper.windowMaximize(ac); } } } /** * windowDeiconified: * Invoked when a window is deiconified. * @param e A WindowEvent instance */ public void windowDeiconified(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowRestore(ac); } } /** * windowIconified: * Invoked when a window is iconified. * @param e A WindowEvent instance */ public void windowIconified(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowMinimize(ac); } } /** * windowOpened * @param e A WindowEvent object */ public void windowOpened(WindowEvent e) { Object o = e.getSource(); if ( o instanceof javax.accessibility.Accessible ) { boolean isToplevel = isToplevel(o); AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowOpen(ac, isToplevel); } } /** * windowClosed: * Invoked when a window has been closed. * @param e A WindowEvent object */ public void windowClosed(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { boolean isToplevel = isToplevel(o); AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowClose(ac, isToplevel); } } /** * windowClosing: * Invoked when a window is in the process of being closed. * @param e A WindowEvent object */ public void windowClosing(WindowEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { boolean isToplevel = isToplevel(o); AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.windowClose(ac, isToplevel); } } /** * windowGainedFocus: * Invoked when the Window is set to be the focused Window, * which means that the Window, or one of its subcomponents, * will receive keyboard events. * @param e A WindowEvent object */ public void windowGainedFocus(WindowEvent e) { } public void windowLostFocus(WindowEvent e) { } }; // Close WindowAdapter brace final ComponentAdapter componentAdapter = new ComponentAdapter() { /** * componentResized * * Invoked when the component's size changes and emits * a "bounds-changed" signal. * @param e a ComponentEvent object */ public void componentResized(ComponentEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.boundsChanged(ac); } } /** * componentMoved: * Invoked when the component's position changes and emits * a "bounds-changed" signal. * * @param e a ComponentEvent object */ public void componentMoved(ComponentEvent e){ Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.boundsChanged(ac); } } /** * componentShown * @param e A ComponentEvent object */ public void componentShown(ComponentEvent e) { Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.componentAdded(ac); } } /** * componentHidden: * Invoked when the component has been made invisible. * @param e A ComponentEvent object */ public void componentHidden(ComponentEvent e){ Object o = e.getSource(); if (o instanceof javax.accessibility.Accessible) { AccessibleContext ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); AtkWrapper.componentRemoved(ac); } } }; /** * isToplevel * @param o an instance * @return true if instance is of a window, frame or dialogue object * false otherwise. */ public static boolean isToplevel(Object o) { boolean isToplevel = false; if (o instanceof java.awt.Window || o instanceof java.awt.Frame || o instanceof java.awt.Dialog) { isToplevel = true; } return isToplevel; } final AWTEventListener globalListener = new AWTEventListener() { private boolean firstEvent = true; public void eventDispatched(AWTEvent e) { if (firstEvent && accessibilityEnabled) { firstEvent = false; try { AtkWrapper.loadAtkBridge(); } catch (Exception ex) { ex.printStackTrace(); } } if(e instanceof WindowEvent) { switch( e.getID() ) { case WindowEvent.WINDOW_OPENED: Window win = ((WindowEvent)e).getWindow(); win.addWindowListener(winAdapter); win.addWindowStateListener(winAdapter); win.addWindowFocusListener(winAdapter); break; case WindowEvent.WINDOW_LOST_FOCUS: AtkWrapper.dispatchFocusEvent(null); break; default: break; } } else if(e instanceof ContainerEvent ) { switch( e.getID() ) { case ContainerEvent.COMPONENT_ADDED: { java.awt.Component c = ((ContainerEvent)e).getChild(); c.addComponentListener(componentAdapter); break; } case ContainerEvent.COMPONENT_REMOVED: { java.awt.Component c = ((ContainerEvent)e).getChild(); c.addComponentListener(componentAdapter); break; } default: break; } } else if(e instanceof FocusEvent) { switch(e.getID()) { case FocusEvent.FOCUS_GAINED: AtkWrapper.dispatchFocusEvent(e.getSource()); break; default: break; } } } }; static AccessibleContext oldSourceContext = null; static AccessibleContext savedSourceContext= null; static AccessibleContext oldPaneContext = null; /** * dispatchFocusEvent * @param eventSource An instance of the event source object. */ static void dispatchFocusEvent(Object eventSource) { if (eventSource == null) { oldSourceContext = null; return; } AccessibleContext ctx; try { if (eventSource instanceof AccessibleContext) { ctx = (AccessibleContext)eventSource; } else if (eventSource instanceof javax.accessibility.Accessible) { ctx = ((javax.accessibility.Accessible)eventSource).getAccessibleContext(); } else { return; } if (ctx == oldSourceContext) { return; } if (oldSourceContext != null) { AccessibleRole role = oldSourceContext.getAccessibleRole(); if (role == AccessibleRole.MENU || role == AccessibleRole.MENU_ITEM) { String jrootpane = "javax.swing.JRootPane$AccessibleJRootPane"; String name = ctx.getClass().getName(); if (jrootpane.compareTo(name) == 0) { oldPaneContext = ctx; return; } } savedSourceContext = ctx; } else if (oldPaneContext == ctx) { ctx = savedSourceContext; } else { savedSourceContext = ctx; } oldSourceContext = ctx; AccessibleRole role = ctx.getAccessibleRole(); if (role == AccessibleRole.PAGE_TAB_LIST) { AccessibleSelection accSelection = ctx.getAccessibleSelection(); if (accSelection != null && accSelection.getAccessibleSelectionCount() > 0) { Object child = accSelection.getAccessibleSelection(0); if (child instanceof AccessibleContext) { ctx = (AccessibleContext)child; } else if (child instanceof javax.accessibility.Accessible) { ctx = ((javax.accessibility.Accessible)child).getAccessibleContext(); } else { return; } } } focusNotify(ctx); } catch (Exception e) { e.printStackTrace(); } } final Toolkit toolkit = Toolkit.getDefaultToolkit(); static PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { /** * propertyChange: * @param e An instance of the PropertyChangeEvent object. */ public void propertyChange(PropertyChangeEvent e) { Object o = e.getSource(); AccessibleContext ac; if (o instanceof AccessibleContext) { ac = (AccessibleContext)o; } else if (o instanceof javax.accessibility.Accessible) { ac = ((javax.accessibility.Accessible)o).getAccessibleContext(); } else { return; } Object oldValue = e.getOldValue(); Object newValue = e.getNewValue(); String propertyName = e.getPropertyName(); if( propertyName.equals(AccessibleContext.ACCESSIBLE_CARET_PROPERTY) ) { Object[] args = new Object[1]; args[0] = newValue; emitSignal(ac, AtkSignal.TEXT_CARET_MOVED, args); } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY) ) { if (newValue == null) { return; } if (newValue instanceof Integer) { Object[] args = new Object[1]; args[0] = newValue; emitSignal(ac, AtkSignal.TEXT_PROPERTY_CHANGED, args); } /* if (oldValue == null && newValue != null) { //insertion event if (!(newValue instanceof AccessibleTextSequence)) { return; } AccessibleTextSequence newSeq = (AccessibleTextSequence)newValue; Object[] args = new Object[2]; args[0] = new Integer(newSeq.startIndex); args[1] = new Integer(newSeq.endIndex - newSeq.startIndex); emitSignal(ac, AtkSignal.TEXT_PROPERTY_CHANGED_INSERT, args); } else if (oldValue != null && newValue == null) { //deletion event if (!(oldValue instanceof AccessibleTextSequence)) { return; } AccessibleTextSequence oldSeq = (AccessibleTextSequence)oldValue; Object[] args = new Object[2]; args[0] = new Integer(oldSeq.startIndex); args[1] = new Integer(oldSeq.endIndex - oldSeq.startIndex); emitSignal(ac, AtkSignal.TEXT_PROPERTY_CHANGED_DELETE, args); } else if (oldValue != null && newValue != null) { //replacement event //It seems ATK does not support "replace" currently return; }*/ } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY) ) { if (oldValue == null && newValue != null) { //child added AccessibleContext child_ac; if (newValue instanceof javax.accessibility.Accessible) { child_ac = ((javax.accessibility.Accessible)newValue).getAccessibleContext(); } else { return; } Object[] args = new Object[2]; args[0] = new Integer(child_ac.getAccessibleIndexInParent()); args[1] = child_ac; emitSignal(ac, AtkSignal.OBJECT_CHILDREN_CHANGED_ADD, args); } else if (oldValue != null && newValue == null) { //child removed AccessibleContext child_ac; if (oldValue instanceof javax.accessibility.Accessible) { child_ac = ((javax.accessibility.Accessible)oldValue).getAccessibleContext(); } else { return; } Object[] args = new Object[2]; args[0] = new Integer(child_ac.getAccessibleIndexInParent()); args[1] = child_ac; emitSignal(ac, AtkSignal.OBJECT_CHILDREN_CHANGED_REMOVE, args); } } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) ) { AccessibleContext child_ac; if (newValue instanceof javax.accessibility.Accessible) { child_ac = ((javax.accessibility.Accessible)newValue).getAccessibleContext(); } else { return; } Object[] args = new Object[1]; args[0] = child_ac; emitSignal(ac, AtkSignal.OBJECT_ACTIVE_DESCENDANT_CHANGED, args); } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY) ) { boolean isTextEvent = false; AccessibleRole role = ac.getAccessibleRole(); if ((role == AccessibleRole.TEXT) || role.toDisplayString(java.util.Locale.US).equalsIgnoreCase("paragraph")) { isTextEvent = true; } else if (role == AccessibleRole.MENU_BAR) { dispatchFocusEvent(o); } else if (role == AccessibleRole.PAGE_TAB_LIST) { AccessibleSelection selection = ac.getAccessibleSelection(); if (selection != null && selection.getAccessibleSelectionCount() > 0) { java.lang.Object child = selection.getAccessibleSelection(0); dispatchFocusEvent(child); } } if (!isTextEvent) { emitSignal(ac, AtkSignal.OBJECT_SELECTION_CHANGED, null); } } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY) ) { emitSignal(ac, AtkSignal.OBJECT_VISIBLE_DATA_CHANGED, null); }else if( propertyName.equals(AccessibleContext.ACCESSIBLE_ACTION_PROPERTY) ) { Object[] args = new Object[2]; args[0] = oldValue; args[1] = newValue; emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_ACTIONS, args); }else if( propertyName.equals(AccessibleContext.ACCESSIBLE_VALUE_PROPERTY) ) { if (oldValue instanceof Number && newValue instanceof Number) { Object[] args = new Object[2]; args[0] = new Double(((Number)oldValue).doubleValue()); args[1] = new Double(((Number)newValue).doubleValue()); emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_VALUE, args); } } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_DESCRIPTION, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_NAME_PROPERTY)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_NAME, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_HYPERTEXT_OFFSET)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_HYPERTEXT_OFFSET, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_MODEL_CHANGED)) { emitSignal(ac, AtkSignal.TABLE_MODEL_CHANGED, null); } else if( propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_CAPTION_CHANGED)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_CAPTION, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_SUMMARY_CHANGED)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_SUMMARY, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_COLUMN_HEADER, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED) ) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_COLUMN_DESCRIPTION, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_ROW_HEADER_CHANGED)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_ROW_HEADER, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED)) { emitSignal(ac, AtkSignal.OBJECT_PROPERTY_CHANGE_ACCESSIBLE_TABLE_ROW_DESCRIPTION, null); } else if(propertyName.equals(AccessibleContext.ACCESSIBLE_STATE_PROPERTY)) { javax.accessibility.Accessible parent = ac.getAccessibleParent(); javax.accessibility.AccessibleRole role = ac.getAccessibleRole(); javax.accessibility.AccessibleRole parent_role = null; if (parent != null) { parent_role = parent.getAccessibleContext().getAccessibleRole(); } if (role != null) { if (newValue == javax.accessibility.AccessibleState.FOCUSED || newValue == javax.accessibility.AccessibleState.SELECTED) { dispatchFocusEvent(o); } } AccessibleState state; boolean value = false; if (newValue != null) { state = (AccessibleState)newValue; value = true; } else { state = (AccessibleState)oldValue; value = false; } if (state == AccessibleState.COLLAPSED) { state = AccessibleState.EXPANDED; value = false; } if(parent instanceof javax.swing.JComboBox && oldValue == javax.accessibility.AccessibleState.VISIBLE) { objectStateChange(ac, AccessibleState.SHOWING, value); } objectStateChange(ac, state, value); if (parent instanceof javax.swing.JComboBox && newValue == javax.accessibility.AccessibleState.VISIBLE && oldValue == null) { objectStateChange(ac, AccessibleState.SHOWING, value); } } } }; public static void registerPropertyChangeListener(AccessibleContext ac) { if (ac != null) { try { ac.addPropertyChangeListener(propertyChangeListener); } catch (Exception e){ e.printStackTrace(); } } } public native static boolean initNativeLibrary(); public native static void loadAtkBridge(); public native static void focusNotify(javax.accessibility.AccessibleContext ac); public native static void windowOpen(javax.accessibility.AccessibleContext ac, boolean isToplevel); public native static void windowClose(javax.accessibility.AccessibleContext ac, boolean isToplevel); public native static void windowMinimize(javax.accessibility.AccessibleContext ac); public native static void windowMaximize(javax.accessibility.AccessibleContext ac); public native static void windowRestore(javax.accessibility.AccessibleContext ac); public native static void windowActivate(javax.accessibility.AccessibleContext ac); public native static void windowDeactivate(javax.accessibility.AccessibleContext ac); public native static void windowStateChange(javax.accessibility.AccessibleContext ac); public native static void emitSignal(javax.accessibility.AccessibleContext ac, int id, Object[] args); public native static void objectStateChange(javax.accessibility.AccessibleContext ac, java.lang.Object state, boolean value); public native static void componentAdded(javax.accessibility.AccessibleContext ac); public native static void componentRemoved(javax.accessibility.AccessibleContext ac); public native static void boundsChanged(javax.accessibility.AccessibleContext ac); public native static boolean dispatchKeyEvent(AtkKeyEvent e); public static void printLog(String str) { System.out.println(str); } public AtkWrapper() { if (!accessibilityEnabled) return; toolkit.addAWTEventListener(globalListener, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK | AWTEvent.CONTAINER_EVENT_MASK); toolkit.getSystemEventQueue().push(new EventQueue() { boolean previousPressConsumed = false; public void dispatchEvent(AWTEvent e) { if (e instanceof KeyEvent) { if (e.getID() == KeyEvent.KEY_PRESSED) { boolean isConsumed = AtkWrapper.dispatchKeyEvent(new AtkKeyEvent((KeyEvent)e)); if (isConsumed) { previousPressConsumed = true; return; } } else if (e.getID() == KeyEvent.KEY_TYPED) { if (previousPressConsumed) { return; } } else if (e.getID() == KeyEvent.KEY_RELEASED) { boolean isConsumed = AtkWrapper.dispatchKeyEvent(new AtkKeyEvent((KeyEvent)e)); previousPressConsumed = false; if (isConsumed) { return; } } } super.dispatchEvent(e); } }); } public static void main(String args[]) { new AtkWrapper(); } } java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Accessibility/Makefile.am000066400000000000000000000007711255546517100275750ustar00rootroot00000000000000JAVA_SRC=$(wildcard $(srcdir)/*.java) CLASSES=$(patsubst %.java,%.class,$(JAVA_SRC)) BUILD_CLASSES=$(patsubst $(srcdir)%,$(builddir)%,$(CLASSES)) $(builddir)/AtkWrapper.class EXTRA_DIST=$(JAVA_SRC) AtkWrapper.java.in $(srcdir)/*.java all-local: $(BUILD_CLASSES) AtkWrapper.java : AtkWrapper.java.in sed -e "s;\@XPROP\@;${XPROP};g" \ < $< >$@ %.class : %.java CLASSPATH=$(top_srcdir)/wrapper $(JAVAC) $(JAVACFLAGS) -d $(top_builddir)/wrapper $< clean-local: $(RM) *.class $(RM) AtkWrapper.java java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/GNOME/Makefile.am000066400000000000000000000000261255546517100247770ustar00rootroot00000000000000SUBDIRS=Accessibility java-atk-wrapper-JAVA_ATK_WRAPPER_0_33_3/wrapper/org/Makefile.am000066400000000000000000000000161255546517100241310ustar00rootroot00000000000000SUBDIRS=GNOME