Initial commit.

This commit is contained in:
Daiki Ueno
2010-06-04 12:09:08 +09:00
commit 9b452c0ffa
58 changed files with 8953 additions and 0 deletions

2
.dir-locals.el Normal file
View File

@ -0,0 +1,2 @@
((c-mode . ((c-basic-offset . 4)
(indent-tabs-mode . nil))))

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
*.la
*.lo
*.loT
*.o
*.so
*~
Makefile
Makefile.in
.deps
.libs
INSTALL
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
libkeyactor*.tar.*
mkinstalldirs
docs/reference/eek/eek-overrides.txt
docs/reference/eek/eek-sections.txt
docs/reference/eek/eek.types
m4/*.m4
gtk-doc.make
eek/eek-special-keysym-labels.h
eek/eek-unicode-keysym-labels.h
eek/eek-keyname-keysym-labels.h

0
AUTHORS Normal file
View File

674
COPYING Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, 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
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

0
ChangeLog Normal file
View File

20
Makefile.am Normal file
View File

@ -0,0 +1,20 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = eek examples tests docs

0
NEWS Normal file
View File

39
README Normal file
View File

@ -0,0 +1,39 @@
eek - easy embedded keyboard
*NOTE* This is not usable by now. It has still a lot of bugs and lacks
many essentital features.
* How to test
$ git clone git://github.com/ueno/eek.git
$ cd eek
$ ./autogen.sh --prefix=/usr --enable-gtk-doc
$ make
$ ./examples/eek-clutter-xkb-test --geometry=winbook --symbols=in
* API
There are two kinds of objects in eek. One is "keyboard element" and
another is "keyboard layout engine". A keyboard element represents
either a keyboard, a section, or a key. Each element implements the
Builder pattern so that it can be converted into a UI widget
(ClutterActor, GTK+ button, ...). A keyboard layout engine arranges
keyboard elements using layout rules from external configuration
mechanisms (XKB, matchbox-keyboard layouts in XML, ...)
Here is a sample code which utilizes Clutter-based keyboard elements
and an XKB-based layout engine:
EekKeyboard *keyboard;
EekLayout *layout;
/* Create a keyboard layout from XKB configuration. */
layout = eek_xkb_layout_new (NULL, "winbook", "in");
/* Create a keyboard that is implemented as ClutterActor. */
keyboard = eek_clutter_keyboard_new ();
/* Apply the layout to the keyboard. */
eek_keyboard_set_layout (keyboard, layout);
clutter_group_add (CLUTTER_GROUP(stage), CLUTTER_ACTOR(keyboard));

7
TODO Normal file
View File

@ -0,0 +1,7 @@
- modifier handling
- step-by-step scaling of key labels
- GTK+ keyboard elements
- matchbox-keyboard layout engine
- emit key events using libfakekey or xtest
- .spec
- .pc

24
autogen.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="eek"
(test -f $srcdir/configure.ac \
&& test -f $srcdir/README ) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
REQUIRED_AUTOMAKE_VERSION=1.8
. gnome-autogen.sh

53
configure.ac Normal file
View File

@ -0,0 +1,53 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
AC_INIT([eek], [0.0.0], [ueno@unixuser.org])
AC_CONFIG_SRCDIR([configure.ac])
AC_PREREQ(2.63)
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
PKG_CHECK_MODULES([GLIB2], [glib-2.0], ,
[AC_MSG_ERROR([GLib2 not found])])
PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0], ,
[AC_MSG_ERROR([GObject2 not found])])
PKG_CHECK_MODULES([CAIRO], [cairo], ,
[AC_MSG_ERROR([Cairo not found])])
PKG_CHECK_MODULES([PANGO], [pango], ,
[AC_MSG_ERROR([Pango not found])])
PKG_CHECK_MODULES([CLUTTER], [clutter-1.0], ,
[AC_MSG_ERROR([Clutter not found])])
PKG_CHECK_MODULES([XKB], [gtk+-2.0 gdk-2.0 x11], ,
[AC_MSG_ERROR([XKB support not found])])
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
EEK_API_VERSION=0.1
AC_SUBST(EEK_API_VERSION)
AC_CONFIG_HEADERS([eek/config.h])
AC_CONFIG_FILES([Makefile
eek/Makefile
examples/Makefile
tests/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/eek/Makefile])
AC_OUTPUT

19
docs/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
SUBDIRS = reference

View File

@ -0,0 +1,19 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
SUBDIRS = eek

View File

@ -0,0 +1,129 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=eek
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../eek
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/eek/*.h
CFILE_GLOB=$(top_srcdir)/eek/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES= eek-private.h \
eek-clutter-private.h \
eek-keysyms.h \
$(NULL)
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS = $(GOBJECT2_CFLAGS)
GTKDOC_LIBS = $(top_srcdir)/eek/libeek.la \
$(top_srcdir)/eek/libeek-clutter.la \
$(top_srcdir)/eek/libeek-xkb.la \
$(GOBJECT2_LIBS) \
$(CLUTTER_LIBS) \
$(XKB_LIBS) \
$(NULL)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST +=
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
#DISTCLEANFILES +=
# Comment this out if you want your docs-status tested during 'make check'
if ENABLE_GTK_DOC
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
#TESTS = $(GTKDOC_CHECK)
endif
-include $(top_srcdir)/gtk-doc.mk

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
]>
<book id="index">
<bookinfo>
<title>eek Reference Manual</title>
<releaseinfo>
for eek 0.0.0.
</releaseinfo>
</bookinfo>
<chapter>
<title>Base classes and interfaces</title>
<xi:include href="xml/eek-keyboard.xml"/>
<xi:include href="xml/eek-section.xml"/>
<xi:include href="xml/eek-key.xml"/>
<xi:include href="xml/eek-layout.xml"/>
</chapter>
<chapter>
<title>Clutter keyboard elements</title>
<xi:include href="xml/eek-clutter-keyboard.xml"/>
<xi:include href="xml/eek-clutter-section.xml"/>
<xi:include href="xml/eek-clutter-key.xml"/>
</chapter>
<chapter>
<title>XKB layout engine</title>
<xi:include href="xml/eek-xkb-layout.xml"/>
</chapter>
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>

107
eek/Makefile.am Normal file
View File

@ -0,0 +1,107 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
lib_LTLIBRARIES = libeek.la libeek-clutter.la libeek-xkb.la
libeek_la_SOURCES = \
eek-layout.c \
eek-layout.h \
eek-keyboard.c \
eek-keyboard.h \
eek-section.c \
eek-section.h \
eek-key.c \
eek-key.h \
eek-simple-keyboard.c \
eek-simple-keyboard.h \
eek-simple-section.c \
eek-simple-section.h \
eek-simple-key.c \
eek-simple-key.h \
eek-private.c \
eek-private.h \
eek-types.h \
eek-types.c \
eek-keysym.h \
eek-keysym.c \
eek-special-keysym-labels.h \
eek-unicode-keysym-labels.h \
eek-keyname-keysym-labels.h \
$(NULL)
libeek_la_CFLAGS = $(GOBJECT2_CFLAGS) $(CAIRO_CFLAGS) $(PANGO_CFLAGS)
libeek_la_LIBADD = $(GOBJECT2_LIBS) $(CAIRO_LIBS) $(PANGO_LIBS)
libeek_clutter_la_SOURCES = \
eek-clutter-keyboard.c \
eek-clutter-keyboard.h \
eek-clutter-section.c \
eek-clutter-section.h \
eek-clutter-key.c \
eek-clutter-key.h \
eek-clutter-private.c \
eek-clutter-private.h \
eek-clutter.h \
$(NULL)
libeek_clutter_la_CFLAGS = $(CLUTTER_CFLAGS)
libeek_clutter_la_LIBADD = libeek.la $(CLUTTER_LIBS)
libeek_xkb_la_SOURCES = \
eek-xkb-layout.h \
eek-xkb-layout.c \
$(NULL)
libeek_xkb_la_CFLAGS = $(XKB_CFLAGS)
libeek_xkb_la_LIBADD = libeek.la $(XKB_LIBS)
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
eek_HEADERS = \
$(top_srcdir)/eek/eek-keyboard.h \
$(top_srcdir)/eek/eek-section.h \
$(top_srcdir)/eek/eek-key.h \
$(top_srcdir)/eek/eek-layout.h \
$(top_srcdir)/eek/eek-keysym.h \
$(top_srcdir)/eek/eek-types.h \
$(top_srcdir)/eek/eek-clutter-keyboard.h \
$(top_srcdir)/eek/eek-clutter-section.h \
$(top_srcdir)/eek/eek-clutter-key.h \
$(top_srcdir)/eek/eek-xkb-layout.h \
$(top_srcdir)/eek/eek.h \
$(top_srcdir)/eek/eek-clutter.h \
$(top_srcdir)/eek/eek-xkb.h
eek-keysym.c: eek-special-keysym-labels.h eek-unicode-keysym-labels.h eek-keyname-keysym-labels.h
eek-special-keysym-labels.h: special-keysym-labels.txt
./gen-keysym-labels.py $< special_keysym_labels > $@
eek-unicode-keysym-labels.h: unicode-keysym-labels.txt
./gen-keysym-labels.py $< unicode_keysym_labels > $@
eek-keyname-keysym-labels.h: keyname-keysym-labels.txt
./gen-keysym-labels.py $< keyname_keysym_labels > $@
DISTCLEANFILES = \
eek-special-keysym-labels.h \
eek-unicode-keysym-labels.h \
eek-keyname-keysym-labels.h
EXTRA_DIST = \
gen-keysym-labels.py \
special-keysym-labels.txt \
unicode-keysym-labels.txt \
keyname-keysym-labels.txt

558
eek/eek-clutter-key.c Normal file
View File

@ -0,0 +1,558 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-clutter-key
* @short_description: #EekKey implemented as a #ClutterActor
*
* The #EekClutterKey class implements the #EekKeyIface interface as a
* #ClutterActor.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-clutter-key.h"
#include "eek-simple-key.h"
#include "eek-keysym.h"
enum {
PROP_0,
PROP_KEYSYMS,
PROP_COLUMN,
PROP_ROW,
PROP_OUTLINE,
PROP_BOUNDS,
PROP_GROUP,
PROP_LEVEL,
PROP_LAST
};
static void eek_key_iface_init (EekKeyIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekClutterKey, eek_clutter_key,
CLUTTER_TYPE_GROUP,
G_IMPLEMENT_INTERFACE (EEK_TYPE_KEY,
eek_key_iface_init));
#define EEK_CLUTTER_KEY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKeyPrivate))
struct _EekClutterKeyPrivate
{
EekSimpleKey *simple;
};
static void
eek_clutter_key_real_set_keysyms (EekKey *self,
guint *keysyms,
gint groups,
gint levels)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_set_keysyms (EEK_KEY(priv->simple), keysyms, groups, levels);
}
static gint
eek_clutter_key_real_get_groups (EekKey *self)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, -1);
return eek_key_get_groups (EEK_KEY(priv->simple));
}
static guint
eek_clutter_key_real_get_keysym (EekKey *self)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, EEK_INVALID_KEYSYM);
return eek_key_get_keysym (EEK_KEY(priv->simple));
}
static void
eek_clutter_key_real_set_index (EekKey *self,
gint column,
gint row)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_set_index (EEK_KEY(priv->simple), column, row);
}
static void
eek_clutter_key_real_get_index (EekKey *self,
gint *column,
gint *row)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_get_index (EEK_KEY(priv->simple), column, row);
}
static void
eek_clutter_key_real_set_outline (EekKey *self, EekOutline *outline)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_set_outline (EEK_KEY(priv->simple), outline);
}
static EekOutline *
eek_clutter_key_real_get_outline (EekKey *self)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, NULL);
return eek_key_get_outline (EEK_KEY(priv->simple));
}
static void
eek_clutter_key_real_set_bounds (EekKey *self, EekBounds *bounds)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_set_bounds (EEK_KEY(priv->simple), bounds);
clutter_actor_set_anchor_point_from_gravity (CLUTTER_ACTOR(self),
CLUTTER_GRAVITY_CENTER);
clutter_actor_set_position (CLUTTER_ACTOR(self),
bounds->x + bounds->w / 2,
bounds->y + bounds->h / 2);
}
static void
eek_clutter_key_real_get_bounds (EekKey *self,
EekBounds *bounds)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
return eek_key_get_bounds (EEK_KEY(priv->simple), bounds);
}
static void
eek_clutter_key_real_set_keysym_index (EekKey *self,
gint group,
gint level)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_key_set_index (EEK_KEY(priv->simple), group, level);
}
static void
eek_clutter_key_real_get_keysym_index (EekKey *self, gint *group, gint *level)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
return eek_key_get_keysym_index (EEK_KEY(priv->simple), group, level);
}
static void
eek_key_iface_init (EekKeyIface *iface)
{
iface->set_keysyms = eek_clutter_key_real_set_keysyms;
iface->get_groups = eek_clutter_key_real_get_groups;
iface->get_keysym = eek_clutter_key_real_get_keysym;
iface->set_index = eek_clutter_key_real_set_index;
iface->get_index = eek_clutter_key_real_get_index;
iface->set_outline = eek_clutter_key_real_set_outline;
iface->get_outline = eek_clutter_key_real_get_outline;
iface->set_bounds = eek_clutter_key_real_set_bounds;
iface->get_bounds = eek_clutter_key_real_get_bounds;
iface->set_keysym_index = eek_clutter_key_real_set_keysym_index;
iface->get_keysym_index = eek_clutter_key_real_get_keysym_index;
}
static void
eek_clutter_key_dispose (GObject *object)
{
clutter_group_remove_all (CLUTTER_GROUP(object));
G_OBJECT_CLASS (eek_clutter_key_parent_class)->dispose (object);
}
static void
eek_clutter_key_finalize (GObject *object)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(object);
g_object_unref (priv->simple);
G_OBJECT_CLASS (eek_clutter_key_parent_class)->finalize (object);
}
static void
draw_text_on_layout (PangoLayout *layout,
const gchar *text,
gdouble scale)
{
PangoFontDescription *font_desc;
#define FONT_SIZE (720 * 50)
/* FIXME: Font should be configurable through a property. */
font_desc = pango_font_description_from_string ("Sans");
pango_font_description_set_size (font_desc, FONT_SIZE * scale);
pango_layout_set_font_description (layout, font_desc);
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
pango_layout_set_text (layout, text, -1);
pango_font_description_free (font_desc);
}
static void
draw_key_on_layout (EekKey *key,
PangoLayout *layout)
{
PangoLayout *buffer;
PangoRectangle logical_rect = { 0, };
EekBounds bounds;
guint keysym;
const gchar *label;
gdouble scale_x, scale_y;
eek_key_get_bounds (key, &bounds);
keysym = eek_key_get_keysym (key);
if (keysym == EEK_INVALID_KEYSYM)
return;
label = eek_keysym_to_string (keysym);
if (!label)
label = "";
/* Compute the layout extents. */
buffer = pango_layout_copy (layout);
draw_text_on_layout (buffer, label, 1.0);
pango_layout_get_extents (buffer, NULL, &logical_rect);
scale_x = scale_y = 1.0;
if (PANGO_PIXELS(logical_rect.width) > bounds.w)
scale_x = bounds.w / PANGO_PIXELS(logical_rect.width);
if (PANGO_PIXELS(logical_rect.height) > bounds.h)
scale_y = bounds.h / PANGO_PIXELS(logical_rect.height);
g_object_unref (buffer);
/* Actually draw on the layout */
draw_text_on_layout (layout, label, scale_x < scale_y ? scale_x : scale_y);
}
static void
eek_clutter_key_paint (ClutterActor *self)
{
PangoLayout *layout;
PangoRectangle logical_rect = { 0, };
CoglColor color;
ClutterGeometry geom;
EekBounds bounds;
gfloat width, height;
gfloat x, y;
g_return_if_fail (CLUTTER_IS_ACTOR(self));
g_return_if_fail (EEK_IS_KEY(self));
/* Draw the background texture first. */
CLUTTER_ACTOR_CLASS (eek_clutter_key_parent_class)->paint (self);
/* Draw the label on the key. */
layout = clutter_actor_create_pango_layout (self, NULL);
draw_key_on_layout (EEK_KEY(self), layout);
pango_layout_get_extents (layout, NULL, &logical_rect);
/* FIXME: Color should be configurable through a property. */
cogl_color_set_from_4ub (&color, 0x80, 0x00, 0x00, 0xff);
clutter_actor_get_allocation_geometry (self, &geom);
cogl_pango_render_layout (layout,
(geom.width - logical_rect.width / PANGO_SCALE) / 2,
(geom.height - logical_rect.height / PANGO_SCALE) / 2,
&color,
0);
g_object_unref (layout);
}
/* FIXME: This is a workaround for the bug
* http://bugzilla.openedhand.com/show_bug.cgi?id=2137 A developer
* says this is not a right way to solve the original problem.
*/
static void
eek_clutter_key_get_preferred_width (ClutterActor *self,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
PangoLayout *layout;
PangoFontDescription *font_desc;
PangoRectangle logical_rect = { 0, };
EekBounds bounds;
guint keysym;
const gchar *label;
gdouble scale = 1.0;
eek_key_get_bounds (EEK_KEY(self), &bounds);
keysym = eek_key_get_keysym (EEK_KEY(self));
g_return_if_fail (keysym != EEK_INVALID_KEYSYM);
label = eek_keysym_to_string (keysym);
if (!label)
label = "";
/* Draw the label on the key. */
layout = clutter_actor_create_pango_layout (self, NULL);
draw_key_on_layout (EEK_KEY(self), layout);
pango_layout_get_extents (layout, NULL, &logical_rect);
cogl_pango_ensure_glyph_cache_for_layout (layout);
g_object_unref (layout);
CLUTTER_ACTOR_CLASS (eek_clutter_key_parent_class)->get_preferred_width
(self, for_height, min_width_p, natural_width_p);
}
static void
eek_clutter_key_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(object);
g_return_if_fail (priv);
switch (prop_id) {
/* Properties which affect the appearance of the key as a
ClutterActor. */
case PROP_BOUNDS:
eek_key_set_bounds (EEK_KEY(object),
g_value_get_boxed (value));
break;
case PROP_OUTLINE:
eek_key_set_outline (EEK_KEY(object),
g_value_get_pointer (value));
break;
/* Otherwise delegate to priv->simple or the parent. */
case PROP_KEYSYMS:
case PROP_COLUMN:
case PROP_GROUP:
case PROP_ROW:
case PROP_LEVEL:
g_object_set_property (G_OBJECT(priv->simple),
g_param_spec_get_name (pspec),
value);
break;
default:
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_key_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(object);
EekBounds bounds;
g_return_if_fail (priv);
switch (prop_id) {
case PROP_BOUNDS:
eek_key_get_bounds (EEK_KEY(object), &bounds);
g_value_set_boxed (value, &bounds);
break;
case PROP_KEYSYMS:
case PROP_COLUMN:
case PROP_ROW:
case PROP_OUTLINE:
case PROP_GROUP:
case PROP_LEVEL:
g_object_get_property (G_OBJECT(priv->simple),
g_param_spec_get_name (pspec),
value);
break;
default:
g_object_get_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_key_class_init (EekClutterKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekClutterKeyPrivate));
actor_class->paint = eek_clutter_key_paint;
/* FIXME: This is a workaround for the bug
* http://bugzilla.openedhand.com/show_bug.cgi?id=2137 A developer
* says this is not a right way to solve the original problem.
*/
actor_class->get_preferred_width = eek_clutter_key_get_preferred_width;
gobject_class->set_property = eek_clutter_key_set_property;
gobject_class->get_property = eek_clutter_key_get_property;
gobject_class->finalize = eek_clutter_key_finalize;
gobject_class->dispose = eek_clutter_key_dispose;
g_object_class_override_property (gobject_class,
PROP_KEYSYMS,
"keysyms");
g_object_class_override_property (gobject_class,
PROP_COLUMN,
"column");
g_object_class_override_property (gobject_class,
PROP_ROW,
"row");
g_object_class_override_property (gobject_class,
PROP_OUTLINE,
"outline");
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
g_object_class_override_property (gobject_class,
PROP_GROUP,
"group");
g_object_class_override_property (gobject_class,
PROP_LEVEL,
"level");
}
static void
on_key_animate_complete (ClutterAnimation *animation,
gpointer user_data)
{
ClutterActor *actor = (ClutterActor*)user_data;
/* reset after effect */
clutter_actor_set_opacity (actor, 0xff);
clutter_actor_set_scale (actor, 1.0, 1.0);
}
static void
key_enlarge (ClutterActor *actor)
{
clutter_actor_set_scale (actor, 1.0, 1.0);
clutter_actor_animate (actor, CLUTTER_EASE_IN_SINE, 150,
"scale-x", 1.5,
"scale-y", 1.5,
NULL);
}
static void
key_shrink (ClutterActor *actor)
{
clutter_actor_set_scale (actor, 1.5, 1.5);
clutter_actor_animate (actor, CLUTTER_EASE_OUT_SINE, 150,
"scale-x", 1.0,
"scale-y", 1.0,
NULL);
}
static gboolean
on_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
g_return_val_if_fail (EEK_IS_KEY(actor), FALSE);
if (clutter_event_get_source (event) == actor) {
ClutterActor *section;
/* Make sure the enlarged key show up on the keys which belong
to other sections. */
section = clutter_actor_get_parent (actor);
clutter_actor_raise_top (section);
clutter_actor_raise_top (actor);
if (event->type == CLUTTER_BUTTON_PRESS)
key_enlarge (actor);
else if (event->type == CLUTTER_BUTTON_RELEASE)
key_shrink (actor);
}
return FALSE;
}
static void
eek_clutter_key_init (EekClutterKey *self)
{
EekClutterKeyPrivate *priv;
priv = self->priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
priv->simple = g_object_new (EEK_TYPE_SIMPLE_KEY, NULL);
clutter_actor_set_reactive (CLUTTER_ACTOR(self), TRUE);
g_signal_connect (self, "event", G_CALLBACK (on_event), NULL);
}
ClutterActor *
eek_clutter_key_create_texture (EekClutterKey *key)
{
EekOutline *outline;
EekBounds bounds;
ClutterActor *texture;
cairo_t *cr;
cairo_pattern_t *pat;
outline = eek_key_get_outline (EEK_KEY(key));
eek_key_get_bounds (EEK_KEY(key), &bounds);
texture = clutter_cairo_texture_new (bounds.w, bounds.h);
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE(texture));
cairo_set_line_width (cr, 1);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0);
cairo_pattern_add_color_stop_rgba (pat, 1, 0.5, 0.5, 0.5, 1);
cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
cairo_set_source (cr, pat);
eek_cairo_draw_rounded_polygon (cr,
TRUE,
outline->corner_radius,
outline->points,
outline->num_points);
cairo_pattern_destroy (pat);
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 0.5);
eek_cairo_draw_rounded_polygon (cr,
FALSE,
outline->corner_radius,
outline->points,
outline->num_points);
cairo_destroy (cr);
return texture;
}
void
eek_clutter_key_set_texture (EekClutterKey *key,
ClutterActor *texture)
{
clutter_actor_set_position (texture, 0, 0);
clutter_container_add_actor (CLUTTER_CONTAINER(key), texture);
}

60
eek/eek-clutter-key.h Normal file
View File

@ -0,0 +1,60 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_CLUTTER_KEY_H
#define EEK_CLUTTER_KEY_H 1
#include <clutter/clutter.h>
#include "eek-key.h"
G_BEGIN_DECLS
#define EEK_TYPE_CLUTTER_KEY (eek_clutter_key_get_type())
#define EEK_CLUTTER_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKey))
#define EEK_CLUTTER_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_KEY, EekClutterKeyClass))
#define EEK_IS_CLUTTER_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_KEY))
#define EEK_IS_CLUTTER_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_KEY))
#define EEK_CLUTTER_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKeyClass))
typedef struct _EekClutterKey EekClutterKey;
typedef struct _EekClutterKeyClass EekClutterKeyClass;
typedef struct _EekClutterKeyPrivate EekClutterKeyPrivate;
struct _EekClutterKey
{
/*< private >*/
ClutterGroup parent;
/*< private >*/
EekClutterKeyPrivate *priv;
};
struct _EekClutterKeyClass
{
/*< private >*/
ClutterGroupClass parent_class;
};
GType eek_clutter_key_get_type (void) G_GNUC_CONST;
ClutterActor *eek_clutter_key_create_texture (EekClutterKey *key);
void eek_clutter_key_set_texture (EekClutterKey *key,
ClutterActor *texture);
G_END_DECLS
#endif /* EEK_CLUTTER_KEY_H */

256
eek/eek-clutter-keyboard.c Normal file
View File

@ -0,0 +1,256 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-clutter-keyboard
* @short_description: #EekKeyboard implemented as a #ClutterActor
*
* The #EekClutterKeyboard class implements the #EekKeyboardIface
* interface as a #ClutterActor.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-clutter-keyboard.h"
#include "eek-clutter-private.h"
#include "eek-simple-keyboard.h"
enum {
PROP_0,
PROP_BOUNDS,
PROP_LAST
};
static void eek_keyboard_iface_init (EekKeyboardIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekClutterKeyboard, eek_clutter_keyboard,
CLUTTER_TYPE_GROUP,
G_IMPLEMENT_INTERFACE (EEK_TYPE_KEYBOARD,
eek_keyboard_iface_init));
#define EEK_CLUTTER_KEYBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardPrivate))
struct _EekClutterKeyboardPrivate
{
EekSimpleKeyboard *simple;
};
static void
eek_clutter_keyboard_real_set_bounds (EekKeyboard *self,
EekBounds *bounds)
{
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
fflush (stdout);
g_return_if_fail (priv);
eek_keyboard_set_bounds (EEK_KEYBOARD(priv->simple), bounds);
clutter_actor_set_position (CLUTTER_ACTOR(self), bounds->x, bounds->y);
clutter_actor_set_size (CLUTTER_ACTOR(self), bounds->w, bounds->h);
}
static void
eek_clutter_keyboard_real_get_bounds (EekKeyboard *self,
EekBounds *bounds)
{
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
g_return_if_fail (priv);
return eek_keyboard_get_bounds (EEK_KEYBOARD(priv->simple), bounds);
}
static EekSection *
eek_clutter_keyboard_real_create_section (EekKeyboard *self,
const gchar *name,
gint angle,
EekBounds *bounds)
{
EekSection *section;
g_return_if_fail (EEK_IS_CLUTTER_KEYBOARD(self));
section = g_object_new (EEK_TYPE_CLUTTER_SECTION,
"name", name,
"angle", angle,
"bounds", bounds,
NULL);
clutter_container_add_actor (CLUTTER_CONTAINER(self),
CLUTTER_ACTOR(section));
return section;
}
static void
eek_clutter_keyboard_real_foreach_section (EekKeyboard *self,
GFunc func,
gpointer user_data)
{
EekClutterCallbackData data;
g_return_if_fail (EEK_IS_CLUTTER_KEYBOARD(self));
data.func = func;
data.user_data = user_data;
clutter_container_foreach (CLUTTER_CONTAINER(self),
eek_clutter_callback,
&data);
}
static void
eek_clutter_keyboard_real_set_layout (EekKeyboard *self,
EekLayout *layout)
{
g_return_if_fail (EEK_IS_KEYBOARD(self));
g_return_if_fail (EEK_IS_LAYOUT(layout));
EEK_LAYOUT_GET_CLASS(layout)->apply_to_keyboard (layout, self);
if (g_object_is_floating (layout))
g_object_unref (layout);
}
static void
eek_keyboard_iface_init (EekKeyboardIface *iface)
{
iface->set_bounds = eek_clutter_keyboard_real_set_bounds;
iface->get_bounds = eek_clutter_keyboard_real_get_bounds;
iface->create_section = eek_clutter_keyboard_real_create_section;
iface->foreach_section = eek_clutter_keyboard_real_foreach_section;
iface->set_layout = eek_clutter_keyboard_real_set_layout;
}
static void
eek_clutter_keyboard_dispose (GObject *object)
{
clutter_group_remove_all (CLUTTER_GROUP(object));
G_OBJECT_CLASS (eek_clutter_keyboard_parent_class)->dispose (object);
}
static void
eek_clutter_keyboard_finalize (GObject *object)
{
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(object);
g_object_unref (priv->simple);
G_OBJECT_CLASS (eek_clutter_keyboard_parent_class)->finalize (object);
}
static void
eek_clutter_keyboard_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(object);
g_return_if_fail (priv);
switch (prop_id) {
case PROP_BOUNDS:
eek_keyboard_set_bounds (EEK_KEYBOARD(object),
g_value_get_boxed (value));
break;
default:
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_keyboard_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(object);
g_return_if_fail (priv);
switch (prop_id) {
case PROP_BOUNDS:
eek_keyboard_set_bounds (EEK_KEYBOARD(object),
g_value_get_boxed (value));
break;
default:
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_keyboard_paint (ClutterActor *self)
{
CLUTTER_ACTOR_CLASS (eek_clutter_keyboard_parent_class)->paint (self);
}
static void
eek_clutter_keyboard_class_init (EekClutterKeyboardClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekClutterKeyboardPrivate));
gobject_class->set_property = eek_clutter_keyboard_set_property;
gobject_class->get_property = eek_clutter_keyboard_get_property;
gobject_class->finalize = eek_clutter_keyboard_finalize;
gobject_class->dispose = eek_clutter_keyboard_dispose;
actor_class->paint = eek_clutter_keyboard_paint;
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
}
static void
eek_clutter_keyboard_init (EekClutterKeyboard *self)
{
EekClutterKeyboardPrivate *priv;
priv = self->priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
priv->simple = g_object_new (EEK_TYPE_SIMPLE_KEYBOARD, NULL);
}
/**
* eek_clutter_keyboard_new:
* @width: max width of the area where the keyboard to be drawn
* @height: max height of the area where the keyboard to be drawn
*
* Create a new #EekClutterKeyboard.
*/
EekKeyboard*
eek_clutter_keyboard_new (gfloat width,
gfloat height)
{
EekBounds bounds;
bounds.x = bounds.y = 0;
bounds.w = width;
bounds.h = height;
return g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, "bounds", &bounds, NULL);
}

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_CLUTTER_KEYBOARD_H
#define EEK_CLUTTER_KEYBOARD_H 1
#include "eek-clutter-section.h"
#include "eek-keyboard.h"
G_BEGIN_DECLS
#define EEK_TYPE_CLUTTER_KEYBOARD (eek_clutter_keyboard_get_type())
#define EEK_CLUTTER_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekKeyboard))
#define EEK_CLUTTER_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardClass))
#define EEK_IS_CLUTTER_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_KEYBOARD))
#define EEK_IS_CLUTTER_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_KEYBOARD))
#define EEK_CLUTTER_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardClass))
typedef struct _EekClutterKeyboard EekClutterKeyboard;
typedef struct _EekClutterKeyboardClass EekClutterKeyboardClass;
typedef struct _EekClutterKeyboardPrivate EekClutterKeyboardPrivate;
struct _EekClutterKeyboard
{
/*< private >*/
ClutterGroup parent;
EekClutterKeyboardPrivate *priv;
};
struct _EekClutterKeyboardClass
{
/*< private >*/
ClutterGroupClass parent_class;
};
GType eek_clutter_keyboard_get_type (void) G_GNUC_CONST;
EekKeyboard *eek_clutter_keyboard_new (gfloat width,
gfloat height);
G_END_DECLS
#endif /* EEK_CLUTTER_KEYBOARD_H */

31
eek/eek-clutter-private.c Normal file
View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-clutter-private.h"
void
eek_clutter_callback (ClutterActor *actor, gpointer user_data)
{
EekClutterCallbackData *data = user_data;
data->func (actor, data->user_data);
}

34
eek/eek-clutter-private.h Normal file
View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_CLUTTER_PRIVATE_H
#define EEK_CLUTTER_PRIVATE_H 1
#include <glib/gtypes.h>
#include <clutter/clutter.h>
struct _EekClutterCallbackData {
GFunc func;
gpointer user_data;
};
typedef struct _EekClutterCallbackData EekClutterCallbackData;
void eek_clutter_callback (ClutterActor *actor, gpointer user_data);
#endif /* EEK_CLUTTER_PRIVATE_H */

323
eek/eek-clutter-section.c Normal file
View File

@ -0,0 +1,323 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-clutter-section
* @short_description: #EekSection implemented as a #ClutterActor
*
* The #EekClutterSection class implements the #EekSectionIface
* interface as a #ClutterActor.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-clutter-section.h"
#include "eek-clutter-private.h"
#include "eek-simple-section.h"
#include <stdio.h>
enum {
PROP_0,
PROP_COLUMNS,
PROP_ROWS,
PROP_ANGLE,
PROP_BOUNDS,
PROP_LAST
};
static void eek_section_iface_init (EekSectionIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekClutterSection, eek_clutter_section,
CLUTTER_TYPE_GROUP,
G_IMPLEMENT_INTERFACE (EEK_TYPE_SECTION,
eek_section_iface_init));
#define EEK_CLUTTER_SECTION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionPrivate))
struct _EekClutterSectionPrivate
{
EekSimpleSection *simple;
GHashTable *key_outline_texture_hash; /* outline pointer -> texture */
};
static void
eek_clutter_section_real_set_dimensions (EekSection *self,
gint columns,
gint rows)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_section_set_dimensions (EEK_SECTION(priv->simple), columns, rows);
}
static void
eek_clutter_section_real_get_dimensions (EekSection *self,
gint *columns,
gint *rows)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_section_get_dimensions (EEK_SECTION(priv->simple), columns, rows);
}
static void
eek_clutter_section_real_set_angle (EekSection *self,
gint angle)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_section_set_angle (EEK_SECTION(priv->simple), angle);
clutter_actor_set_rotation (CLUTTER_ACTOR(self),
CLUTTER_Z_AXIS,
angle,
0,
0,
0);
}
static gint
eek_clutter_section_real_get_angle (EekSection *self)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_val_if_fail (priv, 0);
eek_section_get_angle (EEK_SECTION(priv->simple));
}
static void
eek_clutter_section_real_set_bounds (EekSection *self,
EekBounds *bounds)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
eek_section_set_bounds (EEK_SECTION(priv->simple), bounds);
clutter_actor_set_position (CLUTTER_ACTOR(self), bounds->x, bounds->y);
clutter_actor_set_size (CLUTTER_ACTOR(self), bounds->w, bounds->h);
}
static void
eek_clutter_section_real_get_bounds (EekSection *self,
EekBounds *bounds)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
return eek_section_get_bounds (EEK_SECTION(priv->simple), bounds);
}
static EekKey *
eek_clutter_section_real_create_key (EekSection *self,
const gchar *name,
guint *keysyms,
gint num_groups,
gint num_levels,
gint column,
gint row,
EekOutline *outline,
EekBounds *bounds)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
EekKey *key;
EekKeysymMatrix matrix;
gint columns, rows;
ClutterActor *texture;
g_return_val_if_fail (priv, NULL);
eek_section_get_dimensions (self, &columns, &rows);
g_return_val_if_fail (column < columns, NULL);
g_return_val_if_fail (row < rows, NULL);
matrix.data = keysyms;
matrix.num_groups = num_groups;
matrix.num_levels = num_levels;
key = g_object_new (EEK_TYPE_CLUTTER_KEY,
"name", name,
"keysyms", &matrix,
"column", column,
"row", row,
"outline", outline,
"bounds", bounds,
NULL);
g_return_val_if_fail (key, NULL);
texture = g_hash_table_lookup (priv->key_outline_texture_hash, outline);
if (texture == NULL) {
texture = eek_clutter_key_create_texture (EEK_CLUTTER_KEY(key));
g_hash_table_insert (priv->key_outline_texture_hash, outline, texture);
} else
texture = clutter_clone_new (texture);
eek_clutter_key_set_texture (EEK_CLUTTER_KEY(key), texture);
clutter_container_add_actor (CLUTTER_CONTAINER(self),
CLUTTER_ACTOR(key));
return key;
}
static void
eek_clutter_section_real_foreach_key (EekSection *self,
GFunc func,
gpointer user_data)
{
EekClutterCallbackData data;
g_return_if_fail (EEK_IS_CLUTTER_SECTION(self));
data.func = func;
data.user_data = user_data;
clutter_container_foreach (CLUTTER_CONTAINER(self),
eek_clutter_callback,
&data);
}
static void
eek_section_iface_init (EekSectionIface *iface)
{
iface->set_dimensions = eek_clutter_section_real_set_dimensions;
iface->get_dimensions = eek_clutter_section_real_get_dimensions;
iface->set_angle = eek_clutter_section_real_set_angle;
iface->get_angle = eek_clutter_section_real_get_angle;
iface->set_bounds = eek_clutter_section_real_set_bounds;
iface->get_bounds = eek_clutter_section_real_get_bounds;
iface->create_key = eek_clutter_section_real_create_key;
iface->foreach_key = eek_clutter_section_real_foreach_key;
}
static void
eek_clutter_section_dispose (GObject *object)
{
clutter_group_remove_all (CLUTTER_GROUP(object));
G_OBJECT_CLASS (eek_clutter_section_parent_class)->dispose (object);
}
static void
eek_clutter_section_finalize (GObject *object)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(object);
g_object_unref (priv->simple);
G_OBJECT_CLASS (eek_clutter_section_parent_class)->finalize (object);
}
static void
eek_clutter_section_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(object);
switch (prop_id) {
case PROP_ANGLE:
eek_section_set_angle (EEK_SECTION(object),
g_value_get_int (value));
break;
case PROP_BOUNDS:
eek_section_set_bounds (EEK_SECTION(object),
g_value_get_boxed (value));
break;
default:
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_section_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(object);
EekBounds bounds;
switch (prop_id) {
case PROP_ANGLE:
g_value_set_int (value, eek_section_get_angle (EEK_SECTION(object)));
break;
case PROP_BOUNDS:
eek_section_get_bounds (EEK_SECTION(object), &bounds);
g_value_set_boxed (value, &bounds);
break;
default:
g_object_get_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_clutter_section_paint (ClutterActor *self)
{
ClutterGeometry geom;
CLUTTER_ACTOR_CLASS (eek_clutter_section_parent_class)->paint (self);
//clutter_actor_get_allocation_geometry (self, &geom);
//cogl_set_source_color4ub (0x80, 0x00, 0x00, 0xff);
//cogl_rectangle (0, 0, geom.width, geom.height);
}
static void
eek_clutter_section_class_init (EekClutterSectionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekClutterSectionPrivate));
gobject_class->set_property = eek_clutter_section_set_property;
gobject_class->get_property = eek_clutter_section_get_property;
gobject_class->finalize = eek_clutter_section_finalize;
gobject_class->dispose = eek_clutter_section_dispose;
actor_class->paint = eek_clutter_section_paint;
g_object_class_override_property (gobject_class,
PROP_ANGLE,
"angle");
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
}
static void
eek_clutter_section_init (EekClutterSection *self)
{
EekClutterSectionPrivate *priv;
priv = self->priv = EEK_CLUTTER_SECTION_GET_PRIVATE (self);
priv->simple = g_object_new (EEK_TYPE_SIMPLE_SECTION, NULL);
priv->key_outline_texture_hash =
g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
g_free);
}

56
eek/eek-clutter-section.h Normal file
View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_CLUTTER_SECTION_H
#define EEK_CLUTTER_SECTION_H 1
#include "eek-clutter-key.h"
#include "eek-section.h"
G_BEGIN_DECLS
#define EEK_TYPE_CLUTTER_SECTION (eek_clutter_section_get_type())
#define EEK_CLUTTER_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSection))
#define EEK_CLUTTER_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionClass))
#define EEK_IS_CLUTTER_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_SECTION))
#define EEK_IS_CLUTTER_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_SECTION))
#define EEK_CLUTTER_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionClass))
typedef struct _EekClutterSection EekClutterSection;
typedef struct _EekClutterSectionClass EekClutterSectionClass;
typedef struct _EekClutterSectionPrivate EekClutterSectionPrivate;
struct _EekClutterSection
{
/*< private >*/
ClutterGroup parent;
/*< private >*/
EekClutterSectionPrivate *priv;
};
struct _EekClutterSectionClass
{
/*< private >*/
ClutterGroupClass parent_class;
};
GType eek_clutter_section_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* EEK_CLUTTER_SECTION_H */

26
eek/eek-clutter.h Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_CLUTTER_H
#define EEK_CLUTTER_H 1
#include "eek.h"
#include "eek-clutter-keyboard.h"
#endif /* EEK_CLUTTER_H */

374
eek/eek-key.c Normal file
View File

@ -0,0 +1,374 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-key
* @short_description: Base interface of a key
* @see_also: #EekSection
*
* The #EekKeyIface interface represents a key, which is parented to
* #EekSectionIface.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-key.h"
#include "eek-keysym.h"
static void
eek_key_base_init (gpointer g_iface)
{
static gboolean is_initialized = FALSE;
if (!is_initialized) {
GParamSpec *pspec;
/**
* EekKey:name:
*
* The name of #EekKey.
*/
pspec = g_param_spec_string ("name",
"Name",
"Name",
NULL,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:keysyms:
*
* The symbol matrix of #EekKey.
*/
pspec = g_param_spec_boxed ("keysyms",
"Keysyms",
"Symbol matrix of the key",
EEK_TYPE_KEYSYM_MATRIX,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:column:
*
* The column index of #EekKey in the parent #EekSection.
*/
pspec = g_param_spec_int ("column",
"Column",
"Column index of the key in section",
-1, G_MAXINT, -1,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:row:
*
* The row index of #EekKey in the parent #EekSection.
*/
pspec = g_param_spec_int ("row",
"Row",
"Row index of the key in section",
-1, G_MAXINT, -1,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:outline:
*
* The pointer to the outline shape of #EekKey.
*/
/* Use pointer instead of boxed to avoid copy, since we can
assume that only a few outline shapes are used in a whole
keyboard (unlike labels and bounds). */
pspec = g_param_spec_pointer ("outline",
"Outline",
"Pointer to outline shape of the key",
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:bounds:
*
* The bounding box of #EekKey.
*/
pspec = g_param_spec_boxed ("bounds",
"Bounds",
"Bounding box of the key",
EEK_TYPE_BOUNDS,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:group:
*
* The column index of #EekKey in the label matrix #EekKey:labels.
*/
pspec = g_param_spec_int ("group",
"Group",
"Current group of the key",
0, 64, 0,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekKey:level:
*
* The row index of #EekKey in the label matrix #EekKey:labels.
*/
pspec = g_param_spec_int ("level",
"Level",
"Current level of the key",
0, 3, 0,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
is_initialized = TRUE;
}
}
GType
eek_key_get_type (void)
{
static GType iface_type = 0;
if (iface_type == 0) {
static const GTypeInfo info = {
sizeof (EekKeyIface),
eek_key_base_init, /* iface_base_init */
NULL /* iface_base_finalize */
};
iface_type = g_type_register_static (G_TYPE_INTERFACE,
"EekKey",
&info,
0);
}
return iface_type;
}
/**
* eek_key_set_keysyms:
* @key: an #EekKey
* @keysyms: symbol matrix of @key
* @num_groups: the number of groups (rows) of @keysyms
* @num_levels: the number of levels (columns) of @keysyms
*
* Set the symbol matrix of @key to @keysyms. @keysyms is an array of
* symbols (unsigned int) and the length must match with @num_groups *
* @num_levels.
*/
void
eek_key_set_keysyms (EekKey *key,
guint *keysyms,
gint num_groups,
gint num_levels)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->set_keysyms);
(*iface->set_keysyms) (key, keysyms, num_groups, num_levels);
}
/**
* eek_key_get_groups:
* @key: an #EekKey
*
* Get the number of groups (rows) of the symbol matrix of @key.
*/
gint
eek_key_get_groups (EekKey *key)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_val_if_fail (iface, -1);
g_return_val_if_fail (iface->get_groups, -1);
return (*iface->get_groups) (key);
}
/**
* eek_key_get_keysym:
* @key: an #EekKey
*
* Get the current symbol of @key. It is depend on the current group,
* level, and the symbol matrix of @key. They are set with
* eek_key_set_group(), eek_key_set_level(), and eek_key_set_labels(),
* respectively.
*/
guint
eek_key_get_keysym (EekKey *key)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_val_if_fail (iface, EEK_INVALID_KEYSYM);
g_return_val_if_fail (iface->get_keysym, EEK_INVALID_KEYSYM);
return (*iface->get_keysym) (key);
}
/**
* eek_key_set_index:
* @key: an #EekKey
* @column: column index in the section
* @row: row index in the section
*
* Set column and row index of @key in the parent section.
*/
void
eek_key_set_index (EekKey *key,
gint column,
gint row)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->set_index);
(*iface->set_index) (key, column, row);
}
/**
* eek_key_get_index:
* @key: an #EekKey
* @column: a pointer to where column index in the section is stored
* @row: a pointer to where row index in the section is stored
*
* Get column and row index of @key in the parent section.
*/
void
eek_key_get_index (EekKey *key,
gint *column,
gint *row)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->get_index);
return (*iface->get_index) (key, column, row);
}
/**
* eek_key_set_outline:
* @key: an #EekKey
* @outline: a pointer to the outline shape of @key
*
* Set outline shape of @key.
*/
void
eek_key_set_outline (EekKey *key,
EekOutline *outline)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->set_outline);
(*iface->set_outline) (key, outline);
}
/**
* eek_key_get_outline:
* @key: an #EekKey
*
* Get outline shape of @key as a pointer.
*/
EekOutline *
eek_key_get_outline (EekKey *key)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_val_if_fail (iface, NULL);
g_return_val_if_fail (iface->get_outline, NULL);
return (*iface->get_outline) (key);
}
/**
* eek_key_set_bounds:
* @key: a #EekKey
* @bounds: bounding box of @key
*
* Set the bounding box of @key to @bounds.
*/
void
eek_key_set_bounds (EekKey *key,
EekBounds *bounds)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->set_bounds);
(*iface->set_bounds) (key, bounds);
}
/**
* eek_key_get_bounds:
* @key: a #EekKey
* @bounds: the bounding box of @key
*
* Get the bounding box of @key.
*/
void
eek_key_get_bounds (EekKey *key,
EekBounds *bounds)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->get_bounds);
return (*iface->get_bounds) (key, bounds);
}
/**
* eek_key_set_keysym_index:
* @key: a #EekKey
* @group: row index of the symbol matrix #EekKey:keysyms
* @level: column index of the symbol matrix #EekKey:keysyms
*
* Select a cell of the symbol matrix of @key.
*/
void
eek_key_set_keysym_index (EekKey *key,
gint group,
gint level)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->set_keysym_index);
(*iface->set_keysym_index) (key, group, level);
}
/**
* eek_key_get_keysym_index:
* @key: a #EekKey
* @group: a pointer to row index of the symbol matrix #EekKey:keysyms
* to be stored
* @level: a pointer to column index of the symbol matrix
* #EekKey:keysyms to be stored
*
* Get the current cell position of the symbol matrix of @key.
*/
void
eek_key_get_keysym_index (EekKey *key, gint *column, gint *row)
{
EekKeyIface *iface = EEK_KEY_GET_IFACE(key);
g_return_if_fail (iface);
g_return_if_fail (iface->get_keysym_index);
return (*iface->get_keysym_index) (key, column, row);
}

103
eek/eek-key.h Normal file
View File

@ -0,0 +1,103 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_KEY_H
#define EEK_KEY_H 1
#include <glib-object.h>
#include "eek-types.h"
G_BEGIN_DECLS
#define EEK_TYPE_KEY (eek_key_get_type())
#define EEK_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEY, EekKey))
#define EEK_IS_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEY))
#define EEK_KEY_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EEK_TYPE_KEY, EekKeyIface))
typedef struct _EekKeyIface EekKeyIface;
struct _EekKeyIface
{
/*< private >*/
GTypeInterface g_iface;
/*< public >*/
void (* set_keysyms) (EekKey *self,
guint *keysyms,
gint groups,
gint levels);
gint (* get_groups) (EekKey *self);
guint (* get_keysym) (EekKey *self);
void (* set_index) (EekKey *self,
gint column,
gint row);
void (* get_index) (EekKey *self,
gint *column,
gint *row);
void (* set_outline) (EekKey *self,
EekOutline *outline);
EekOutline *(* get_outline) (EekKey *self);
void (* set_bounds) (EekKey *self,
EekBounds *bounds);
void (* get_bounds) (EekKey *self,
EekBounds *bounds);
void (* set_keysym_index) (EekKey *self,
gint group,
gint level);
void (* get_keysym_index) (EekKey *self,
gint *group,
gint *level);
};
GType eek_key_get_type (void) G_GNUC_CONST;
void eek_key_set_keysyms (EekKey *key,
guint *keysyms,
gint groups,
gint levels);
gint eek_key_get_groups (EekKey *key);
guint eek_key_get_keysym (EekKey *key);
void eek_key_set_index (EekKey *key,
gint column,
gint row);
void eek_key_get_index (EekKey *key,
gint *column,
gint *row);
void eek_key_set_outline (EekKey *key,
EekOutline *outline);
EekOutline *eek_key_get_outline (EekKey *key);
void eek_key_set_bounds (EekKey *key,
EekBounds *bounds);
void eek_key_get_bounds (EekKey *key,
EekBounds *bounds);
void eek_key_set_keysym_index (EekKey *key,
gint group,
gint level);
void eek_key_get_keysym_index (EekKey *key,
gint *group,
gint *level);
G_END_DECLS
#endif /* EEK_KEY_H */

181
eek/eek-keyboard.c Normal file
View File

@ -0,0 +1,181 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-keyboard
* @short_description: Base interface of a keyboard
* @see_also: #EekSection
*
* The #EekKeyboardIface interface represents a keyboard, which
* consists of one or more sections of the #EekSectionIface interface.
*
* #EekKeyboardIface follows the Builder pattern and is responsible
* for creation of sections.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-keyboard.h"
static void
eek_keyboard_base_init (gpointer g_iface)
{
static gboolean is_initialized = FALSE;
if (!is_initialized) {
GParamSpec *pspec;
/**
* EekKeyboard:bounds:
*
* The bounding box of #EekKeyboard.
*/
pspec = g_param_spec_boxed ("bounds",
"Bounds",
"Bounding box of the keyboard",
EEK_TYPE_BOUNDS,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
is_initialized = TRUE;
}
}
GType
eek_keyboard_get_type (void)
{
static GType iface_type = 0;
if (iface_type == 0) {
static const GTypeInfo info = {
sizeof (EekKeyboardIface),
eek_keyboard_base_init,
NULL
};
iface_type = g_type_register_static (G_TYPE_INTERFACE,
"EekKeyboard",
&info,
0);
}
return iface_type;
}
/**
* eek_keyboard_set_bounds:
* @keyboard: a #EekKeyboard
* @bounds: bounding box of the keyboard
*
* Set the bounding box of @keyboard to @bounds.
*/
void
eek_keyboard_set_bounds (EekKeyboard *keyboard,
EekBounds *bounds)
{
EekKeyboardIface *iface = EEK_KEYBOARD_GET_IFACE(keyboard);
g_return_if_fail (iface);
g_return_if_fail (iface->set_bounds);
(*iface->set_bounds) (keyboard, bounds);
}
/**
* eek_keyboard_get_bounds:
* @keyboard: a #EekKeyboard
* @bounds: the bounding box of @keyboard
*
* Get the bounding box of @keyboard.
*/
void
eek_keyboard_get_bounds (EekKeyboard *keyboard,
EekBounds *bounds)
{
EekKeyboardIface *iface = EEK_KEYBOARD_GET_IFACE(keyboard);
g_return_if_fail (iface);
g_return_if_fail (iface->get_bounds);
return (*iface->get_bounds) (keyboard, bounds);
}
/**
* eek_keyboard_create_section:
* @keyboard: a #EekKeyboard
* @name: name of the section
* @angle: rotation angle of the section
* @bounds: bounding box of the section
*
* Create an #EekSection instance and attach it to @keyboard.
*/
EekSection *
eek_keyboard_create_section (EekKeyboard *keyboard,
const gchar *name,
gint angle,
EekBounds *bounds)
{
EekKeyboardIface *iface = EEK_KEYBOARD_GET_IFACE(keyboard);
g_return_val_if_fail (iface, NULL);
g_return_val_if_fail (iface->create_section, NULL);
return (*iface->create_section) (keyboard, name, angle, bounds);
}
/**
* eek_keyboard_foreach_section:
* @keyboard: a #EekKeyboard
* @func: a callback of #GFunc
* @user_data: a pointer to an object passed to @func
*
* Iterate over @keyboard's children list.
*/
void
eek_keyboard_foreach_section (EekKeyboard *keyboard,
GFunc func,
gpointer user_data)
{
EekKeyboardIface *iface = EEK_KEYBOARD_GET_IFACE(keyboard);
g_return_if_fail (iface);
g_return_if_fail (iface->foreach_section);
(*iface->foreach_section) (keyboard, func, user_data);
}
/**
* eek_keyboard_set_layout:
* @keyboard: a #EekKeyboard
* @layout: a #EekLayout
*
* Set the layout of @keyboard to @layout. For the user of EEK, it is
* preferable to call this function rather than
* eek_layout_apply_to_keyboard(), while the implementation calls it
* internally.
*/
void
eek_keyboard_set_layout (EekKeyboard *keyboard,
EekLayout *layout)
{
EekKeyboardIface *iface = EEK_KEYBOARD_GET_IFACE(keyboard);
g_return_if_fail (iface);
g_return_if_fail (iface->set_layout);
g_return_if_fail (EEK_IS_LAYOUT(layout));
(*iface->set_layout) (keyboard, layout);
}

78
eek/eek-keyboard.h Normal file
View File

@ -0,0 +1,78 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_KEYBOARD_H
#define EEK_KEYBOARD_H 1
#include "eek-section.h"
#include "eek-layout.h"
G_BEGIN_DECLS
#define EEK_TYPE_KEYBOARD (eek_keyboard_get_type())
#define EEK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEYBOARD, EekKeyboard))
#define EEK_IS_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEYBOARD))
#define EEK_KEYBOARD_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EEK_TYPE_KEYBOARD, EekKeyboardIface))
typedef struct _EekKeyboardIface EekKeyboardIface;
struct _EekKeyboardIface
{
/*< private >*/
GTypeInterface g_iface;
/*< public >*/
void (* set_bounds) (EekKeyboard *self,
EekBounds *bounds);
void (* get_bounds) (EekKeyboard *self,
EekBounds *bounds);
EekSection *(* create_section) (EekKeyboard *self,
const gchar *name,
gint angle,
EekBounds *bounds);
void (* foreach_section) (EekKeyboard *self,
GFunc func,
gpointer user_data);
void (* set_layout) (EekKeyboard *self,
EekLayout *layout);
};
GType eek_keyboard_get_type (void) G_GNUC_CONST;
void eek_keyboard_set_bounds (EekKeyboard *keyboard,
EekBounds *bounds);
void eek_keyboard_get_bounds (EekKeyboard *keyboard,
EekBounds *bounds);
EekSection *eek_keyboard_create_section (EekKeyboard *keyboard,
const gchar *name,
gint angle,
EekBounds *bounds);
void eek_keyboard_foreach_section (EekKeyboard *keyboard,
GFunc func,
gpointer user_data);
void eek_keyboard_set_layout (EekKeyboard *keyboard,
EekLayout *layout);
G_END_DECLS
#endif /* EEK_KEYBOARD_H */

102
eek/eek-keysym.c Normal file
View File

@ -0,0 +1,102 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <glib.h>
#include <stdlib.h>
#include "eek-keysym.h"
struct eek_keysym_label {
guint keysym;
const gchar *label;
};
#include "eek-special-keysym-labels.h"
#include "eek-unicode-keysym-labels.h"
#include "eek-keyname-keysym-labels.h"
static G_CONST_RETURN gchar *
unichar_to_utf8 (gunichar uc)
{
if (g_unichar_isgraph (uc)) {
gchar *buf;
gint len;
len = g_unichar_to_utf8 (uc, NULL);
buf = g_malloc0 (len + 1);
g_unichar_to_utf8 (uc, buf);
return buf;
}
return g_strdup ("");
}
static int
keysym_label_compare (const void *key0, const void *key1)
{
const struct eek_keysym_label *entry0 = key0, *entry1 = key1;
return (gint)entry0->keysym - (gint)entry1->keysym;
}
G_CONST_RETURN gchar *
eek_keysym_to_string (guint keysym)
{
struct eek_keysym_label bsearch_key, *bsearch_val;
/* First, search special keysyms. */
bsearch_key.keysym = keysym;
bsearch_val = bsearch (&bsearch_key,
special_keysym_labels,
G_N_ELEMENTS(special_keysym_labels),
sizeof (struct eek_keysym_label),
keysym_label_compare);
if (bsearch_val)
return g_strdup (bsearch_val->label);
/* Check for Latin-1 characters (1:1 mapping) */
if ((keysym >= 0x0020 && keysym <= 0x007e) ||
(keysym >= 0x00a0 && keysym <= 0x00ff))
return unichar_to_utf8 (keysym);
/* Also check for directly encoded 24-bit UCS characters:
*/
if ((keysym & 0xff000000) == 0x01000000)
return unichar_to_utf8 (keysym & 0x00ffffff);
/* Search known unicode keysyms. */
bsearch_key.keysym = keysym;
bsearch_val = bsearch (&bsearch_key,
unicode_keysym_labels,
G_N_ELEMENTS(unicode_keysym_labels),
sizeof (struct eek_keysym_label),
keysym_label_compare);
if (bsearch_val)
return g_strdup (bsearch_val->label);
/* Finally, search keynames. */
bsearch_key.keysym = keysym;
bsearch_val = bsearch (&bsearch_key,
keyname_keysym_labels,
G_N_ELEMENTS(keyname_keysym_labels),
sizeof (struct eek_keysym_label),
keysym_label_compare);
if (bsearch_val)
return g_strdup (bsearch_val->label);
return g_strdup ("");
}

26
eek/eek-keysym.h Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_KEYSYMS_H
#define EEK_KEYSYMS_H 1
#define EEK_INVALID_KEYSYM ((guint)(-1))
G_CONST_RETURN gchar *eek_keysym_to_string (guint keysym);
#endif /* EEK_KEYSYMS_H */

63
eek/eek-layout.c Normal file
View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-layout
* @short_description: Base class of a layout engine
*
* The #EekLayout class is a base abstract class of layout engine
* which arranges keyboard elements.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-layout.h"
#include "eek-keyboard.h"
G_DEFINE_ABSTRACT_TYPE (EekLayout, eek_layout, G_TYPE_INITIALLY_UNOWNED);
static void
eek_layout_finalize (GObject *object)
{
G_OBJECT_CLASS (eek_layout_parent_class)->finalize (object);
}
static void
eek_layout_dispose (GObject *object)
{
G_OBJECT_CLASS (eek_layout_parent_class)->dispose (object);
}
static void
eek_layout_class_init (EekLayoutClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
gobject_class->finalize = eek_layout_finalize;
gobject_class->dispose = eek_layout_dispose;
}
static void
eek_layout_init (EekLayout *self)
{
}

58
eek/eek-layout.h Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_LAYOUT_H
#define EEK_LAYOUT_H 1
#include <glib-object.h>
#include "eek-types.h"
G_BEGIN_DECLS
#define EEK_TYPE_LAYOUT (eek_layout_get_type())
#define EEK_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_LAYOUT, EekLayout))
#define EEK_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_LAYOUT, EekLayoutClass))
#define EEK_IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_LAYOUT))
#define EEK_IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_LAYOUT))
#define EEK_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_LAYOUT, EekLayoutClass))
typedef struct _EekLayoutClass EekLayoutClass;
typedef struct _EekLayout EekLayout;
struct _EekLayout
{
/*< private >*/
GInitiallyUnowned parent;
};
struct _EekLayoutClass
{
/*< private >*/
GInitiallyUnownedClass parent_class;
/*< public >*/
void (*apply_to_keyboard) (EekLayout *self,
EekKeyboard *keyboard);
};
GType eek_layout_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* EEK_LAYOUT_H */

234
eek/eek-private.c Normal file
View File

@ -0,0 +1,234 @@
/*
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
*
* 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 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-private.h"
#include <math.h>
#define noKBDRAW_DEBUG
static gdouble
length (gdouble x, gdouble y)
{
return sqrt (x * x + y * y);
}
static gdouble
point_line_distance (gdouble ax, gdouble ay, gdouble nx, gdouble ny)
{
return ax * nx + ay * ny;
}
static void
normal_form (gdouble ax, gdouble ay,
gdouble bx, gdouble by,
gdouble * nx, gdouble * ny, gdouble * d)
{
gdouble l;
*nx = by - ay;
*ny = ax - bx;
l = length (*nx, *ny);
*nx /= l;
*ny /= l;
*d = point_line_distance (ax, ay, *nx, *ny);
}
static void
inverse (gdouble a, gdouble b, gdouble c, gdouble d,
gdouble * e, gdouble * f, gdouble * g, gdouble * h)
{
gdouble det;
det = a * d - b * c;
*e = d / det;
*f = -b / det;
*g = -c / det;
*h = a / det;
}
static void
multiply (gdouble a, gdouble b, gdouble c, gdouble d,
gdouble e, gdouble f, gdouble * x, gdouble * y)
{
*x = a * e + b * f;
*y = c * e + d * f;
}
static void
intersect (gdouble n1x, gdouble n1y, gdouble d1,
gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
{
gdouble e, f, g, h;
inverse (n1x, n1y, n2x, n2y, &e, &f, &g, &h);
multiply (e, f, g, h, d1, d2, x, y);
}
/* draw an angle from the current point to b and then to c,
* with a rounded corner of the given radius.
*/
static void
rounded_corner (cairo_t * cr,
gdouble bx, gdouble by,
gdouble cx, gdouble cy, gdouble radius)
{
gdouble ax, ay;
gdouble n1x, n1y, d1;
gdouble n2x, n2y, d2;
gdouble pd1, pd2;
gdouble ix, iy;
gdouble dist1, dist2;
gdouble nx, ny, d;
gdouble a1x, a1y, c1x, c1y;
gdouble phi1, phi2;
cairo_get_current_point (cr, &ax, &ay);
#ifdef KBDRAW_DEBUG
printf (" current point: (%f, %f), radius %f:\n", ax, ay,
radius);
#endif
/* make sure radius is not too large */
dist1 = length (bx - ax, by - ay);
dist2 = length (cx - bx, cy - by);
radius = MIN (radius, MIN (dist1, dist2));
/* construct normal forms of the lines */
normal_form (ax, ay, bx, by, &n1x, &n1y, &d1);
normal_form (bx, by, cx, cy, &n2x, &n2y, &d2);
/* find which side of the line a,b the point c is on */
if (point_line_distance (cx, cy, n1x, n1y) < d1)
pd1 = d1 - radius;
else
pd1 = d1 + radius;
/* find which side of the line b,c the point a is on */
if (point_line_distance (ax, ay, n2x, n2y) < d2)
pd2 = d2 - radius;
else
pd2 = d2 + radius;
/* intersect the parallels to find the center of the arc */
intersect (n1x, n1y, pd1, n2x, n2y, pd2, &ix, &iy);
nx = (bx - ax) / dist1;
ny = (by - ay) / dist1;
d = point_line_distance (ix, iy, nx, ny);
/* a1 is the point on the line a-b where the arc starts */
intersect (n1x, n1y, d1, nx, ny, d, &a1x, &a1y);
nx = (cx - bx) / dist2;
ny = (cy - by) / dist2;
d = point_line_distance (ix, iy, nx, ny);
/* c1 is the point on the line b-c where the arc ends */
intersect (n2x, n2y, d2, nx, ny, d, &c1x, &c1y);
/* determine the first angle */
if (a1x - ix == 0)
phi1 = (a1y - iy > 0) ? M_PI_2 : 3 * M_PI_2;
else if (a1x - ix > 0)
phi1 = atan ((a1y - iy) / (a1x - ix));
else
phi1 = M_PI + atan ((a1y - iy) / (a1x - ix));
/* determine the second angle */
if (c1x - ix == 0)
phi2 = (c1y - iy > 0) ? M_PI_2 : 3 * M_PI_2;
else if (c1x - ix > 0)
phi2 = atan ((c1y - iy) / (c1x - ix));
else
phi2 = M_PI + atan ((c1y - iy) / (c1x - ix));
/* compute the difference between phi2 and phi1 mod 2pi */
d = phi2 - phi1;
while (d < 0)
d += 2 * M_PI;
while (d > 2 * M_PI)
d -= 2 * M_PI;
#ifdef KBDRAW_DEBUG
printf (" line 1 to: (%f, %f):\n", a1x, a1y);
#endif
if (!(isnan (a1x) || isnan (a1y)))
cairo_line_to (cr, a1x, a1y);
/* pick the short arc from phi1 to phi2 */
if (d < M_PI)
cairo_arc (cr, ix, iy, radius, phi1, phi2);
else
cairo_arc_negative (cr, ix, iy, radius, phi1, phi2);
#ifdef KBDRAW_DEBUG
printf (" line 2 to: (%f, %f):\n", cx, cy);
#endif
cairo_line_to (cr, cx, cy);
}
void
eek_cairo_draw_rounded_polygon (cairo_t * cr,
gboolean filled,
gdouble radius,
EekPoint * points,
gint num_points)
{
gint i, j;
cairo_move_to (cr,
(gdouble) (points[num_points - 1].x +
points[0].x) / 2,
(gdouble) (points[num_points - 1].y +
points[0].y) / 2);
#ifdef KBDRAW_DEBUG
printf (" rounded polygon of radius %f:\n", radius);
#endif
for (i = 0; i < num_points; i++) {
j = (i + 1) % num_points;
rounded_corner (cr, (gdouble) points[i].x,
(gdouble) points[i].y,
(gdouble) (points[i].x + points[j].x) / 2,
(gdouble) (points[i].y + points[j].y) / 2,
radius);
#ifdef KBDRAW_DEBUG
printf (" corner (%d, %d) -> (%d, %d):\n",
points[i].x, points[i].y, points[j].x,
points[j].y);
#endif
};
cairo_close_path (cr);
if (filled)
cairo_fill (cr);
else
cairo_stroke (cr);
}

36
eek/eek-private.h Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_PRIVATE_H
#define EEK_PRIVATE_H 1
#include <glib/gtypes.h>
#include <cairo/cairo.h>
#include "eek-types.h"
G_BEGIN_DECLS
void eek_cairo_draw_rounded_polygon (cairo_t * cr,
gboolean filled,
gdouble radius,
EekPoint * points,
gint num_points);
G_END_DECLS
#endif /* EEK_PRIVATE_H */

300
eek/eek-section.c Normal file
View File

@ -0,0 +1,300 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-section
* @short_description: Base interface of a keyboard section
* @see_also: #EekKeyboard, #EekKey
*
* The #EekSectionIface interface represents a keyboard section, which
* is parented to #EekKeyboardIface and can have one or more keys of
* the #EekKeyIface interface.
*
* #EekSectionIface follows the Builder pattern and is responsible for
* creation of keys.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-section.h"
static void
eek_section_base_init (gpointer g_iface)
{
static gboolean is_initialized = FALSE;
if (!is_initialized) {
GParamSpec *pspec;
/**
* EekSection:name:
*
* The name of #EekSection.
*/
pspec = g_param_spec_string ("name",
"Name",
"Name",
NULL,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekSection:columns:
*
* The number of columns in #EekSection.
*/
pspec = g_param_spec_int ("columns",
"Columns",
"The number of columns in the section",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekSection:rows:
*
* The number of rows in #EekSection.
*/
pspec = g_param_spec_int ("rows",
"Rows",
"The number of rows of the section",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekSection:angle:
*
* The rotation angle of #EekSection.
*/
pspec = g_param_spec_int ("angle",
"Angle",
"Rotation angle of the section",
-360, 360, 0,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
/**
* EekSection:bounds:
*
* The bounding box of #EekSection.
*/
pspec = g_param_spec_boxed ("bounds",
"Bounds",
"Bounding box of the section",
EEK_TYPE_BOUNDS,
G_PARAM_READWRITE);
g_object_interface_install_property (g_iface, pspec);
is_initialized = TRUE;
}
}
GType
eek_section_get_type (void)
{
static GType iface_type = 0;
if (iface_type == 0) {
static const GTypeInfo info = {
sizeof (EekSectionIface),
eek_section_base_init,
NULL
};
iface_type = g_type_register_static (G_TYPE_INTERFACE,
"EekSection",
&info,
0);
}
return iface_type;
}
/**
* eek_section_set_dimensions:
* @section: a #EekSection
* @columns: the number of columns in @section
* @rows: the number of rows in @section
*
* Set dimensions of @section from @columns and @rows.
*/
void
eek_section_set_dimensions (EekSection *section,
gint columns,
gint rows)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->set_dimensions);
(*iface->set_dimensions) (section, columns, rows);
}
/**
* eek_section_get_dimensions:
* @section: a #EekSection
* @columns: a pointer where the number of columns in @section is stored
* @rows: a pointer where the number of rows in @section is stored
*
* Get the rotation angle of @section.
*/
void
eek_section_get_dimensions (EekSection *section,
gint *columns,
gint *rows)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->get_dimensions);
return (*iface->get_dimensions) (section, columns, rows);
}
/**
* eek_section_set_angle:
* @section: a #EekSection
* @angle: rotation angle of @section
*
* Set the rotation angle of @section to @angle.
*/
void
eek_section_set_angle (EekSection *section,
gint angle)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->set_angle);
(*iface->set_angle) (section, angle);
}
/**
* eek_section_get_angle:
* @section: a #EekSection
*
* Get the rotation angle of @section.
*/
gint
eek_section_get_angle (EekSection *section)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_val_if_fail (iface->get_angle, 0);
return (*iface->get_angle) (section);
}
/**
* eek_section_set_bounds:
* @section: a #EekSection
* @bounds: bounding box of @section
*
* Set the bounding box of @section to @bounds.
*/
void
eek_section_set_bounds (EekSection *section,
EekBounds *bounds)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->set_bounds);
(*iface->set_bounds) (section, bounds);
}
/**
* eek_section_get_bounds:
* @section: a #EekSection
* @bounds: the bounding box of @section
*
* Get the bounding box of @section.
*/
void
eek_section_get_bounds (EekSection *section,
EekBounds *bounds)
{
EekSectionIface *iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->get_bounds);
return (*iface->get_bounds) (section, bounds);
}
/**
* eek_section_create_key:
* @section: a #EekSection
* @name: name of the key
* @keysyms: symbol matrix of the key
* @num_groups: number of rows in the @keysyms
* @num_levels: number of columns in the @keysyms
* @column: column index in the @section
* @row: row index in the section
* @outline: outline shape of the key
* @bounds: bounding box of the key
*
* Create an #EekKey instance and attach it to @section.
*/
EekKey *
eek_section_create_key (EekSection *section,
const gchar *name,
guint *keysyms,
gint num_groups,
gint num_levels,
gint column,
gint row,
EekOutline *outline,
EekBounds *bounds)
{
EekSectionIface *iface;
g_return_if_fail (EEK_IS_SECTION(section));
iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->create_key);
return (*iface->create_key) (section,
name,
keysyms,
num_groups,
num_levels,
column,
row,
outline,
bounds);
}
/**
* eek_section_foreach_key:
* @section: a #EekSection
* @func: a callback of #GFunc
* @user_data: a pointer to an object passed to @func
*
* Iterate over @section's children list.
*/
void
eek_section_foreach_key (EekSection *section,
GFunc func,
gpointer user_data)
{
EekSectionIface *iface;
g_return_if_fail (EEK_IS_SECTION(section));
iface = EEK_SECTION_GET_IFACE(section);
g_return_if_fail (iface->foreach_key);
return (*iface->foreach_key) (section, func, user_data);
}

102
eek/eek-section.h Normal file
View File

@ -0,0 +1,102 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_SECTION_H
#define EEK_SECTION_H 1
#include "eek-key.h"
G_BEGIN_DECLS
#define EEK_TYPE_SECTION (eek_section_get_type())
#define EEK_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SECTION, EekSection))
#define EEK_IS_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SECTION))
#define EEK_SECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EEK_TYPE_SECTION, EekSectionIface))
typedef struct _EekSectionIface EekSectionIface;
struct _EekSectionIface
{
/*< private >*/
GTypeInterface g_iface;
/*< public >*/
void (* set_dimensions) (EekSection *self,
gint columns,
gint rows);
void (* get_dimensions) (EekSection *self,
gint *columns,
gint *rows);
void (* set_angle) (EekSection *self,
gint angle);
gint (* get_angle) (EekSection *self);
void (* set_bounds) (EekSection *self,
EekBounds *bounds);
void (* get_bounds) (EekSection *self,
EekBounds *bounds);
EekKey *(* create_key) (EekSection *self,
const gchar *name,
guint *keysyms,
gint num_groups,
gint num_levels,
gint column,
gint row,
EekOutline *outline,
EekBounds *bounds);
void (* foreach_key) (EekSection *self,
GFunc func,
gpointer user_data);
};
GType eek_section_get_type (void) G_GNUC_CONST;
void eek_section_set_dimensions (EekSection *section,
gint columns,
gint rows);
void eek_section_get_dimensions (EekSection *section,
gint *columns,
gint *rows);
void eek_section_set_angle (EekSection *section,
gint angle);
gint eek_section_get_angle (EekSection *section);
void eek_section_set_bounds (EekSection *section,
EekBounds *bounds);
void eek_section_get_bounds (EekSection *section,
EekBounds *bounds);
EekKey *eek_section_create_key (EekSection *section,
const gchar *name,
guint *labels,
gint num_groups,
gint num_levels,
gint column,
gint row,
EekOutline *outline,
EekBounds *bounds);
void eek_section_foreach_key (EekSection *section,
GFunc func,
gpointer user_data);
G_END_DECLS
#endif /* EEK_SECTION_H */

377
eek/eek-simple-key.c Normal file
View File

@ -0,0 +1,377 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-simple-key.h"
#include "eek-keysym.h"
#include <string.h>
enum {
PROP_0,
PROP_NAME,
PROP_KEYSYMS,
PROP_COLUMN,
PROP_ROW,
PROP_OUTLINE,
PROP_BOUNDS,
PROP_GROUP,
PROP_LEVEL,
PROP_LAST
};
static void eek_key_iface_init (EekKeyIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekSimpleKey, eek_simple_key,
G_TYPE_INITIALLY_UNOWNED,
G_IMPLEMENT_INTERFACE (EEK_TYPE_KEY,
eek_key_iface_init));
#define EEK_SIMPLE_KEY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SIMPLE_KEY, EekSimpleKeyPrivate))
struct _EekSimpleKeyPrivate
{
gchar *name;
guint *keysyms;
gint num_levels;
gint num_groups;
gint column;
gint row;
EekOutline *outline;
EekBounds bounds;
gint group;
gint level;
};
static void
eek_simple_key_real_set_keysyms (EekKey *self,
guint *keysyms,
gint groups,
gint levels)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
if (priv->keysyms)
g_slice_free (guint, priv->keysyms);
priv->keysyms = g_slice_alloc (groups * levels * sizeof(guint));
memcpy (priv->keysyms, keysyms, groups * levels * sizeof(guint));
priv->num_groups = groups;
priv->num_levels = levels;
}
static gint
eek_simple_key_real_get_groups (EekKey *self)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, -1);
return priv->num_groups;
}
static guint
eek_simple_key_real_get_keysym (EekKey *self)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, EEK_INVALID_KEYSYM);
if (priv->num_groups * priv->num_levels == 0)
return EEK_INVALID_KEYSYM;
return priv->keysyms[priv->group * priv->num_levels + priv->level];
}
static void
eek_simple_key_real_set_index (EekKey *self,
gint column,
gint row)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (column < 0);
g_return_if_fail (row < 0);
priv->column = column;
priv->row = row;
}
static void
eek_simple_key_real_get_index (EekKey *self,
gint *column,
gint *row)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (column);
g_return_if_fail (row);
*column = priv->column;
*row = priv->row;
}
static void
eek_simple_key_real_set_outline (EekKey *self, EekOutline *outline)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
priv->outline = outline;
}
static EekOutline *
eek_simple_key_real_get_outline (EekKey *self)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_val_if_fail (priv, NULL);
return priv->outline;
}
static void
eek_simple_key_real_set_bounds (EekKey *self,
EekBounds *bounds)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
priv->bounds = *bounds;
}
static void
eek_simple_key_real_get_bounds (EekKey *self,
EekBounds *bounds)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (bounds);
*bounds = priv->bounds;
}
static void
eek_simple_key_real_set_keysym_index (EekKey *self,
gint group,
gint level)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (group < priv->num_groups);
g_return_if_fail (level < priv->num_levels);
priv->group = group;
priv->level = level;
}
static void
eek_simple_key_real_get_keysym_index (EekKey *self,
gint *group,
gint *level)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (group);
g_return_if_fail (level);
*group = priv->group;
*level = priv->level;
}
static void
eek_key_iface_init (EekKeyIface *iface)
{
iface->set_keysyms = eek_simple_key_real_set_keysyms;
iface->get_groups = eek_simple_key_real_get_groups;
iface->get_keysym = eek_simple_key_real_get_keysym;
iface->set_index = eek_simple_key_real_set_index;
iface->get_index = eek_simple_key_real_get_index;
iface->set_outline = eek_simple_key_real_set_outline;
iface->get_outline = eek_simple_key_real_get_outline;
iface->set_bounds = eek_simple_key_real_set_bounds;
iface->get_bounds = eek_simple_key_real_get_bounds;
iface->set_keysym_index = eek_simple_key_real_set_keysym_index;
iface->get_keysym_index = eek_simple_key_real_get_keysym_index;
}
static void
eek_simple_key_dispose (GObject *object)
{
G_OBJECT_CLASS (eek_simple_key_parent_class)->dispose (object);
}
static void
eek_simple_key_finalize (GObject *object)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(object);
g_free (priv->name);
g_slice_free (guint, priv->keysyms);
G_OBJECT_CLASS (eek_simple_key_parent_class)->finalize (object);
}
static void
eek_simple_key_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(object);
EekKeysymMatrix *matrix;
g_return_if_fail (priv);
switch (prop_id) {
case PROP_NAME:
g_free (priv->name);
priv->name = g_strdup (g_value_get_string (value));
break;
case PROP_KEYSYMS:
matrix = g_value_get_boxed (value);
eek_key_set_keysyms (EEK_KEY(object),
matrix->data,
matrix->num_groups,
matrix->num_levels);
break;
case PROP_COLUMN:
priv->column = g_value_get_int (value);
break;
case PROP_ROW:
priv->row = g_value_get_int (value);
break;
case PROP_OUTLINE:
priv->outline = g_value_get_pointer (value);
break;
case PROP_BOUNDS:
priv->bounds = *(EekBounds *)g_value_get_boxed (value);
break;
case PROP_GROUP:
priv->group = g_value_get_int (value);
break;
case PROP_LEVEL:
priv->level = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_key_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekSimpleKeyPrivate *priv = EEK_SIMPLE_KEY_GET_PRIVATE(object);
EekKeysymMatrix matrix;
g_return_if_fail (priv);
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
case PROP_KEYSYMS:
matrix.data = priv->keysyms;
matrix.num_groups = priv->num_groups;
matrix.num_levels = priv->num_levels;
g_value_set_boxed (value, &matrix);
break;
case PROP_COLUMN:
g_value_set_int (value, priv->column);
break;
case PROP_ROW:
g_value_set_int (value, priv->row);
break;
case PROP_OUTLINE:
g_value_set_pointer (value, priv->outline);
break;
case PROP_BOUNDS:
g_value_set_boxed (value, &priv->bounds);
break;
case PROP_GROUP:
g_value_set_int (value, priv->group);
break;
case PROP_LEVEL:
g_value_set_int (value, priv->level);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_get_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_key_class_init (EekSimpleKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekSimpleKeyPrivate));
gobject_class->set_property = eek_simple_key_set_property;
gobject_class->get_property = eek_simple_key_get_property;
gobject_class->finalize = eek_simple_key_finalize;
gobject_class->dispose = eek_simple_key_dispose;
g_object_class_override_property (gobject_class,
PROP_NAME,
"name");
g_object_class_override_property (gobject_class,
PROP_KEYSYMS,
"keysyms");
g_object_class_override_property (gobject_class,
PROP_COLUMN,
"column");
g_object_class_override_property (gobject_class,
PROP_ROW,
"row");
g_object_class_override_property (gobject_class,
PROP_OUTLINE,
"outline");
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
g_object_class_override_property (gobject_class,
PROP_GROUP,
"group");
g_object_class_override_property (gobject_class,
PROP_LEVEL,
"level");
}
static void
eek_simple_key_init (EekSimpleKey *self)
{
EekSimpleKeyPrivate *priv;
priv = self->priv = EEK_SIMPLE_KEY_GET_PRIVATE(self);
priv->keysyms = NULL;
priv->num_groups = 0;
priv->num_levels = 0;
priv->column = 0;
priv->row = 0;
priv->outline = NULL;
memset (&priv->bounds, 0, sizeof priv->bounds);
}

55
eek/eek-simple-key.h Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_SIMPLE_KEY_H
#define EEK_SIMPLE_KEY_H 1
#include "eek-key.h"
G_BEGIN_DECLS
#define EEK_TYPE_SIMPLE_KEY (eek_simple_key_get_type())
#define EEK_SIMPLE_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SIMPLE_KEY, EekSimpleKey))
#define EEK_SIMPLE_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SIMPLE_KEY, EekSimpleKeyClass))
#define EEK_IS_SIMPLE_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SIMPLE_KEY))
#define EEK_IS_SIMPLE_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SIMPLE_KEY))
#define EEK_SIMPLE_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SIMPLE_KEY, EekSimpleKeyClass))
typedef struct _EekSimpleKey EekSimpleKey;
typedef struct _EekSimpleKeyClass EekSimpleKeyClass;
typedef struct _EekSimpleKeyPrivate EekSimpleKeyPrivate;
struct _EekSimpleKey
{
/*< private >*/
GInitiallyUnowned parent;
/*< private >*/
EekSimpleKeyPrivate *priv;
};
struct _EekSimpleKeyClass
{
/*< private >*/
GInitiallyUnownedClass parent_class;
};
GType eek_simple_key_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* EEK_SIMPLE_KEY_H */

217
eek/eek-simple-keyboard.c Normal file
View File

@ -0,0 +1,217 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-simple-keyboard.h"
enum {
PROP_0,
PROP_BOUNDS,
PROP_LAST
};
static void eek_keyboard_iface_init (EekKeyboardIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekSimpleKeyboard, eek_simple_keyboard,
G_TYPE_INITIALLY_UNOWNED,
G_IMPLEMENT_INTERFACE (EEK_TYPE_KEYBOARD,
eek_keyboard_iface_init));
#define EEK_SIMPLE_KEYBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SIMPLE_KEYBOARD, EekSimpleKeyboardPrivate))
struct _EekSimpleKeyboardPrivate
{
EekBounds bounds;
GSList *sections;
};
static void
eek_simple_keyboard_real_set_bounds (EekKeyboard *self,
EekBounds *bounds)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(self);
g_return_if_fail (priv);
priv->bounds = *bounds;
}
static void
eek_simple_keyboard_real_get_bounds (EekKeyboard *self,
EekBounds *bounds)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (bounds);
*bounds = priv->bounds;
}
static EekSection *
eek_simple_keyboard_real_create_section (EekKeyboard *self,
const gchar *name,
gint angle,
EekBounds *bounds)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(self);
EekSection *section;
g_return_val_if_fail (priv, NULL);
section = g_object_new (EEK_TYPE_SIMPLE_SECTION,
"name", name,
"angle", angle,
"bounds", bounds,
NULL);
g_return_val_if_fail (section, NULL);
priv->sections = g_slist_prepend (priv->sections, section);
return section;
}
static void
eek_simple_keyboard_real_foreach_section (EekKeyboard *self,
GFunc func,
gpointer user_data)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(self);
g_return_if_fail (priv);
g_slist_foreach (priv->sections, func, user_data);
}
static void
eek_simple_keyboard_real_set_layout (EekKeyboard *self,
EekLayout *layout)
{
g_return_if_fail (EEK_IS_KEYBOARD(self));
g_return_if_fail (EEK_IS_LAYOUT(layout));
EEK_LAYOUT_GET_CLASS(layout)->apply_to_keyboard (layout, self);
if (g_object_is_floating (layout))
g_object_unref (layout);
}
static void
eek_keyboard_iface_init (EekKeyboardIface *iface)
{
iface->set_bounds = eek_simple_keyboard_real_set_bounds;
iface->get_bounds = eek_simple_keyboard_real_get_bounds;
iface->create_section = eek_simple_keyboard_real_create_section;
iface->foreach_section = eek_simple_keyboard_real_foreach_section;
iface->set_layout = eek_simple_keyboard_real_set_layout;
}
static void
eek_simple_keyboard_dispose (GObject *object)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(object);
GSList *head;
for (head = priv->sections; head; head = g_slist_next (head))
g_object_unref (head->data);
G_OBJECT_CLASS (eek_simple_keyboard_parent_class)->dispose (object);
}
static void
eek_simple_keyboard_finalize (GObject *object)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(object);
g_slist_free (priv->sections);
G_OBJECT_CLASS (eek_simple_keyboard_parent_class)->finalize (object);
}
static void
eek_simple_keyboard_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id) {
case PROP_BOUNDS:
eek_keyboard_set_bounds (EEK_KEYBOARD(object),
g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_keyboard_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekSimpleKeyboardPrivate *priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(object);
g_return_if_fail (priv);
switch (prop_id) {
case PROP_BOUNDS:
g_value_set_boxed (value, &priv->bounds);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_keyboard_class_init (EekSimpleKeyboardClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekSimpleKeyboardPrivate));
gobject_class->set_property = eek_simple_keyboard_set_property;
gobject_class->get_property = eek_simple_keyboard_get_property;
gobject_class->finalize = eek_simple_keyboard_finalize;
gobject_class->dispose = eek_simple_keyboard_dispose;
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
}
static void
eek_simple_keyboard_init (EekSimpleKeyboard *self)
{
EekSimpleKeyboardPrivate *priv;
priv = self->priv = EEK_SIMPLE_KEYBOARD_GET_PRIVATE(self);
priv->sections = NULL;
}
EekKeyboard*
eek_simple_keyboard_new (void)
{
return g_object_new (EEK_TYPE_SIMPLE_KEYBOARD, NULL);
}

57
eek/eek-simple-keyboard.h Normal file
View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_SIMPLE_KEYBOARD_H
#define EEK_SIMPLE_KEYBOARD_H 1
#include "eek-simple-section.h"
#include "eek-keyboard.h"
G_BEGIN_DECLS
#define EEK_TYPE_SIMPLE_KEYBOARD (eek_simple_keyboard_get_type())
#define EEK_SIMPLE_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SIMPLE_KEYBOARD, EekKeyboard))
#define EEK_SIMPLE_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SIMPLE_KEYBOARD, EekSimpleKeyboardClass))
#define EEK_IS_SIMPLE_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SIMPLE_KEYBOARD))
#define EEK_IS_SIMPLE_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SIMPLE_KEYBOARD))
#define EEK_SIMPLE_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SIMPLE_KEYBOARD, EekSimpleKeyboardClass))
typedef struct _EekSimpleKeyboard EekSimpleKeyboard;
typedef struct _EekSimpleKeyboardClass EekSimpleKeyboardClass;
typedef struct _EekSimpleKeyboardPrivate EekSimpleKeyboardPrivate;
struct _EekSimpleKeyboard
{
/*< private >*/
GInitiallyUnowned parent;
EekSimpleKeyboardPrivate *priv;
};
struct _EekSimpleKeyboardClass
{
/*< private >*/
GInitiallyUnownedClass parent_class;
};
GType eek_simple_keyboard_get_type (void) G_GNUC_CONST;
EekKeyboard *eek_simple_keyboard_new (void);
G_END_DECLS
#endif /* EEK_SIMPLE_KEYBOARD_H */

291
eek/eek-simple-section.c Normal file
View File

@ -0,0 +1,291 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-simple-section.h"
#include <string.h>
enum {
PROP_0,
PROP_NAME,
PROP_COLUMNS,
PROP_ROWS,
PROP_ANGLE,
PROP_BOUNDS,
PROP_LAST
};
static void eek_section_iface_init (EekSectionIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekSimpleSection, eek_simple_section,
G_TYPE_INITIALLY_UNOWNED,
G_IMPLEMENT_INTERFACE (EEK_TYPE_SECTION,
eek_section_iface_init));
#define EEK_SIMPLE_SECTION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SIMPLE_SECTION, EekSimpleSectionPrivate))
struct _EekSimpleSectionPrivate
{
gchar *name;
gint num_columns;
gint num_rows;
gint angle;
EekBounds bounds;
GSList *keys;
};
static void
eek_simple_section_real_set_dimensions (EekSection *self,
gint columns,
gint rows)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
priv->num_columns = columns;
priv->num_rows = rows;
}
static void
eek_simple_section_real_get_dimensions (EekSection *self,
gint *columns,
gint *rows)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
*columns = priv->num_columns;
*rows = priv->num_rows;
}
static void
eek_simple_section_real_set_angle (EekSection *self,
gint angle)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
priv->angle = angle;
}
static gint
eek_simple_section_real_get_angle (EekSection *self)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_val_if_fail (priv, 0);
return priv->angle;
}
static void
eek_simple_section_real_set_bounds (EekSection *self,
EekBounds *bounds)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (bounds);
priv->bounds = *bounds;
}
static void
eek_simple_section_real_get_bounds (EekSection *self, EekBounds *bounds)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
g_return_if_fail (bounds);
priv->bounds = *bounds;
}
static EekKey *
eek_simple_section_real_create_key (EekSection *self,
const gchar *name,
guint *keysyms,
gint num_groups,
gint num_levels,
gint column,
gint row,
EekOutline *outline,
EekBounds *bounds)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
EekKey *key;
EekKeysymMatrix matrix;
g_return_val_if_fail (priv, NULL);
g_return_val_if_fail (column < priv->num_columns, NULL);
g_return_val_if_fail (row < priv->num_rows, NULL);
matrix.data = keysyms;
matrix.num_groups = num_groups;
matrix.num_levels = num_levels;
key = g_object_new (EEK_TYPE_SIMPLE_KEY,
"name", name,
"keysyms", &matrix,
"column", column,
"row", row,
"outline", outline,
"bounds", bounds,
NULL);
g_return_val_if_fail (key, NULL);
priv->keys = g_slist_prepend (priv->keys, key);
return key;
}
static void
eek_simple_section_real_foreach_key (EekSection *self,
GFunc func,
gpointer user_data)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(self);
g_return_if_fail (priv);
g_slist_foreach (priv->keys, func, user_data);
}
static void
eek_section_iface_init (EekSectionIface *iface)
{
iface->set_dimensions = eek_simple_section_real_set_dimensions;
iface->get_dimensions = eek_simple_section_real_get_dimensions;
iface->set_angle = eek_simple_section_real_set_angle;
iface->get_angle = eek_simple_section_real_get_angle;
iface->set_bounds = eek_simple_section_real_set_bounds;
iface->get_bounds = eek_simple_section_real_get_bounds;
iface->create_key = eek_simple_section_real_create_key;
iface->foreach_key = eek_simple_section_real_foreach_key;
}
static void
eek_simple_section_dispose (GObject *object)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(object);
GSList *head;
for (head = priv->keys; head; head = g_slist_next (head))
g_object_unref (head->data);
G_OBJECT_CLASS (eek_simple_section_parent_class)->dispose (object);
}
static void
eek_simple_section_finalize (GObject *object)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(object);
g_free (priv->name);
g_slist_free (priv->keys);
G_OBJECT_CLASS (eek_simple_section_parent_class)->finalize (object);
}
static void
eek_simple_section_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(object);
switch (prop_id) {
case PROP_NAME:
g_free (priv->name);
priv->name = g_strdup (g_value_get_string (value));
break;
case PROP_ANGLE:
eek_section_set_angle (EEK_SECTION(object),
g_value_get_int (value));
break;
case PROP_BOUNDS:
eek_section_set_bounds (EEK_SECTION(object),
g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_set_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_section_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekSimpleSectionPrivate *priv = EEK_SIMPLE_SECTION_GET_PRIVATE(object);
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
case PROP_ANGLE:
g_value_set_int (value, eek_section_get_angle (EEK_SECTION(object)));
break;
case PROP_BOUNDS:
g_value_set_boxed (value, &priv->bounds);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_object_get_property (object,
g_param_spec_get_name (pspec),
value);
break;
}
}
static void
eek_simple_section_class_init (EekSimpleSectionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekSimpleSectionPrivate));
gobject_class->set_property = eek_simple_section_set_property;
gobject_class->get_property = eek_simple_section_get_property;
gobject_class->finalize = eek_simple_section_finalize;
gobject_class->dispose = eek_simple_section_dispose;
g_object_class_override_property (gobject_class,
PROP_NAME,
"name");
g_object_class_override_property (gobject_class,
PROP_ANGLE,
"angle");
g_object_class_override_property (gobject_class,
PROP_BOUNDS,
"bounds");
}
static void
eek_simple_section_init (EekSimpleSection *self)
{
EekSimpleSectionPrivate *priv;
priv = self->priv = EEK_SIMPLE_SECTION_GET_PRIVATE (self);
priv->angle = 0;
memset (&priv->bounds, 0, sizeof priv->bounds);
priv->keys = NULL;
}

56
eek/eek-simple-section.h Normal file
View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_SIMPLE_SECTION_H
#define EEK_SIMPLE_SECTION_H 1
#include "eek-simple-key.h"
#include "eek-section.h"
G_BEGIN_DECLS
#define EEK_TYPE_SIMPLE_SECTION (eek_simple_section_get_type())
#define EEK_SIMPLE_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SIMPLE_SECTION, EekSimpleSection))
#define EEK_SIMPLE_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SIMPLE_SECTION, EekSimpleSectionClass))
#define EEK_IS_SIMPLE_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SIMPLE_SECTION))
#define EEK_IS_SIMPLE_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SIMPLE_SECTION))
#define EEK_SIMPLE_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SIMPLE_SECTION, EekSimpleSectionClass))
typedef struct _EekSimpleSection EekSimpleSection;
typedef struct _EekSimpleSectionClass EekSimpleSectionClass;
typedef struct _EekSimpleSectionPrivate EekSimpleSectionPrivate;
struct _EekSimpleSection
{
/*< private >*/
GInitiallyUnowned parent;
/*< private >*/
EekSimpleSectionPrivate *priv;
};
struct _EekSimpleSectionClass
{
/*< private >*/
GInitiallyUnownedClass parent_class;
};
GType eek_simple_section_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* EEK_SIMPLE_SECTION_H */

128
eek/eek-types.c Normal file
View File

@ -0,0 +1,128 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-types.h"
/* EekKeysymMatrix */
static EekKeysymMatrix *
eek_keysym_matrix_copy (const EekKeysymMatrix *matrix)
{
return g_slice_dup (EekKeysymMatrix, matrix);
}
static void
eek_keysym_matrix_free (EekKeysymMatrix *matrix)
{
g_slice_free (EekKeysymMatrix, matrix);
}
GType
eek_keysym_matrix_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekKeysymMatrix",
(GBoxedCopyFunc)eek_keysym_matrix_copy,
(GBoxedFreeFunc)eek_keysym_matrix_free);
return our_type;
}
/* EekPoint */
static EekPoint *
eek_point_copy (const EekPoint *point)
{
return g_slice_dup (EekPoint, point);
}
static void
eek_point_free (EekPoint *point)
{
g_slice_free (EekPoint, point);
}
GType
eek_point_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekPoint",
(GBoxedCopyFunc)eek_point_copy,
(GBoxedFreeFunc)eek_point_free);
return our_type;
}
/* EekBounds */
static EekBounds *
eek_bounds_copy (const EekBounds *bounds)
{
return g_slice_dup (EekBounds, bounds);
}
static void
eek_bounds_free (EekBounds *bounds)
{
g_slice_free (EekBounds, bounds);
}
GType
eek_bounds_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekBounds",
(GBoxedCopyFunc)eek_bounds_copy,
(GBoxedFreeFunc)eek_bounds_free);
return our_type;
}
/* EekOutline */
static EekOutline *
eek_outline_copy (const EekOutline *outline)
{
return g_slice_dup (EekOutline, outline);
}
static void
eek_outline_free (EekOutline *outline)
{
g_slice_free (EekOutline, outline);
}
GType
eek_outline_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekOutline",
(GBoxedCopyFunc)eek_outline_copy,
(GBoxedFreeFunc)eek_outline_free);
return our_type;
}

109
eek/eek-types.h Normal file
View File

@ -0,0 +1,109 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_TYPES_H
#define EEK_TYPES_H 1
#include <glib-object.h>
G_BEGIN_DECLS
/**
* EekKeysymMatrix:
* @data: array of keysyms
* @num_groups: the number of groups (rows)
* @num_levels: the number of levels (columns)
*
* Symbol matrix of a key.
*/
struct _EekKeysymMatrix
{
guint *data;
gint num_groups;
gint num_levels;
};
typedef struct _EekKeysymMatrix EekKeysymMatrix;
#define EEK_TYPE_KEYSYM_MATRIX (eek_keysym_matrix_get_type ())
GType eek_keysym_matrix_get_type (void) G_GNUC_CONST;
/**
* EekPoint:
* @x: X coordinate of the point
* @y: Y coordinate of the point
*
* 2D vertex
*/
struct _EekPoint
{
gdouble x;
gdouble y;
};
typedef struct _EekPoint EekPoint;
#define EEK_TYPE_POINT (eek_point_get_type ())
GType eek_point_get_type (void) G_GNUC_CONST;
/**
* EekBounds:
* @x: X coordinate of the top left point
* @y: Y coordinate of the top left point
* @width: width of the box
* @height: height of the box
*
* 2D bounding box
*/
struct _EekBounds
{
gdouble x;
gdouble y;
gdouble w;
gdouble h;
};
typedef struct _EekBounds EekBounds;
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
GType eek_bounds_get_type (void) G_GNUC_CONST;
/**
* EekOutline:
* @corner_radius: radius of corners of rounded polygon
* @points: an array of points represents a polygon
* @num_points: the length of @points
*
* 2D rounded polygon used to draw key shape
*/
struct _EekOutline
{
gdouble corner_radius;
EekPoint *points;
gint num_points;
};
typedef struct _EekOutline EekOutline;
#define EEK_TYPE_OUTLINE (eek_outline_get_type ())
GType eek_outline_get_type (void) G_GNUC_CONST;
/* dummy */
typedef struct _EekKeyboard EekKeyboard;
typedef struct _EekSection EekSection;
typedef struct _EekKey EekKey;
G_END_DECLS
#endif /* EEK_TYPES_H */

759
eek/eek-xkb-layout.c Normal file
View File

@ -0,0 +1,759 @@
/*
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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
*/
/**
* SECTION:eek-xkb-layout
* @short_description: Layout engine using XKB configuration
*
* The #EekXkbLayout inherits #EekLayout class and arranges keyboard
* elements using XKB.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <gdk/gdkx.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBgeom.h>
#include <string.h>
#include "eek-xkb-layout.h"
#include "eek-keyboard.h"
#define noKBDRAW_DEBUG
G_DEFINE_TYPE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT);
#define EEK_XKB_LAYOUT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
enum {
PROP_0,
PROP_KEYCODES,
PROP_GEOMETRY,
PROP_SYMBOLS,
PROP_LAST
};
struct _EekXkbLayoutPrivate
{
/* Configuration names that should synch'ed to the symbolic names
in priv->xkb->names. Since we use GLib's memory allocator,
don't store any address returned from the X server here. */
XkbComponentNamesRec names;
Display *display;
/* Actual XKB configuration of DISPLAY. */
XkbDescRec *xkb;
/* Hash table to cache outlines by shape address. */
GHashTable *outline_hash;
gint scale_numerator;
gint scale_denominator;
};
#define INVALID_KEYCODE ((guint)(-1))
static guint
find_keycode (EekXkbLayout *layout, gchar *key_name);
static void
get_keyboard (EekXkbLayout *layout);
static void
get_names (EekXkbLayout *layout);
static void
setup_scaling (EekXkbLayout *layout,
gdouble width,
gdouble height);
G_INLINE_FUNC gint
xkb_to_pixmap_coord (EekXkbLayout *layout,
gint n)
{
EekXkbLayoutPrivate *priv = layout->priv;
return n * priv->scale_numerator / priv->scale_denominator;
}
G_INLINE_FUNC gdouble
xkb_to_pixmap_double (EekXkbLayout *layout,
gdouble d)
{
EekXkbLayoutPrivate *priv = layout->priv;
return d * priv->scale_numerator / priv->scale_denominator;
}
static EekKey *
create_key (EekXkbLayout *layout,
EekSection *section,
gint column,
gint row,
gdouble x,
gdouble y,
XkbKeyRec *xkbkey)
{
XkbGeometryRec *xkbgeometry;
XkbBoundsRec *xkbbounds;
XkbShapeRec *xkbshape;
XkbOutlineRec *xkboutline;
EekXkbLayoutPrivate *priv = layout->priv;
EekKey *key;
EekBounds bounds;
guint *keysyms;
gchar name[XkbKeyNameLength + 1];
EekOutline *outline;
KeyCode keycode;
gint num_groups, num_levels;
xkbgeometry = priv->xkb->geom;
xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
outline = g_hash_table_lookup (priv->outline_hash, xkbshape);
if (outline == NULL) {
xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
xkbshape->primary;
outline = g_new0 (EekOutline, 1);
outline->corner_radius = xkb_to_pixmap_coord(layout, xkboutline->corner_radius);
if (xkboutline->num_points <= 2) { /* rectangular */
gdouble x1, y1, x2, y2;
outline->num_points = 4;
outline->points = g_new0 (EekPoint, outline->num_points);
if (xkboutline->num_points == 1) {
x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
} else {
x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
}
outline->points[0].x = outline->points[3].x = x1;
outline->points[0].y = outline->points[1].y = y1;
outline->points[1].x = outline->points[2].x = x2;
outline->points[2].y = outline->points[3].y = y2;
} else { /* polygon */
gint i;
outline->num_points = xkboutline->num_points;
outline->points = g_new0 (EekPoint, outline->num_points);
for (i = 0; i < xkboutline->num_points; i++) {
outline->points[i].x = xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
outline->points[i].y = xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
}
}
g_hash_table_insert (priv->outline_hash, xkbshape, outline);
}
memset (name, 0, sizeof name);
memcpy (name, xkbkey->name.name, sizeof name - 1);
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
bounds.w = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
bounds.h = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
keycode = find_keycode (layout, name);
if (keycode == INVALID_KEYCODE)
num_groups = num_levels = 0;
else {
KeySym keysym;
gint num_keysyms, i, j;
num_groups = XkbKeyNumGroups (priv->xkb, keycode);
num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
num_keysyms = num_groups * num_levels;
keysyms = g_malloc0 ((num_keysyms) * sizeof(guint));
for (i = 0; i < num_groups; i++)
for (j = 0; j < num_levels; j++) {
keysym = XkbKeySymEntry (priv->xkb, keycode, i, j);
keysyms[i * num_levels + j] = keysym;
}
}
eek_section_create_key (section,
name,
keysyms,
num_groups,
num_levels,
column,
row,
outline,
&bounds);
}
static void
create_section (EekXkbLayout *layout,
EekKeyboard *keyboard,
XkbSectionRec *xkbsection)
{
XkbGeometryRec *xkbgeometry;
EekXkbLayoutPrivate *priv;
EekSection *section;
EekBounds bounds;
const gchar *name;
gfloat left, top;
gint i, j, columns;
bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
bounds.w = xkb_to_pixmap_coord(layout, xkbsection->width);
bounds.h = xkb_to_pixmap_coord(layout, xkbsection->height);
priv = layout->priv;
xkbgeometry = priv->xkb->geom;
name = XGetAtomName (priv->display, xkbsection->name);
section = eek_keyboard_create_section (keyboard,
name,
/* angle is in tenth of degree */
xkbsection->angle / 10,
&bounds);
for (columns = 0, i = 0; i < xkbsection->num_rows; i++) {
XkbRowRec *xkbrow;
xkbrow = &xkbsection->rows[i];
if (xkbrow->num_keys > columns)
columns = xkbrow->num_keys;
}
eek_section_set_dimensions (section, columns, xkbsection->num_rows);
for (i = 0; i < xkbsection->num_rows; i++) {
XkbRowRec *xkbrow;
xkbrow = &xkbsection->rows[i];
left = xkbrow->left;
top = xkbrow->top;
for (j = 0; j < xkbrow->num_keys; j++) {
XkbKeyRec *xkbkey;
XkbBoundsRec *xkbbounds;
xkbkey = &xkbrow->keys[j];
if (xkbrow->vertical)
top += xkbkey->gap;
else
left += xkbkey->gap;
create_key (layout, section, j, i, left, top, xkbkey);
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
if (xkbrow->vertical)
top += xkbbounds->y2 - xkbbounds->y1;
else
left += xkbbounds->x2 - xkbbounds->x1;
}
}
}
static void
create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
{
EekXkbLayoutPrivate *priv = layout->priv;
XkbGeometryRec *xkbgeometry;
EekBounds bounds;
gint i;
g_return_if_fail (priv->xkb);
g_return_if_fail (priv->xkb->geom);
xkbgeometry = priv->xkb->geom;
eek_keyboard_get_bounds (keyboard, &bounds);
setup_scaling (EEK_XKB_LAYOUT(layout), bounds.w, bounds.h);
bounds.x = bounds.y = 0;
bounds.w = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
bounds.h = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
eek_keyboard_set_bounds (keyboard, &bounds);
for (i = 0; i < xkbgeometry->num_sections; i++) {
XkbSectionRec *xkbsection;
EekSection *section;
xkbsection = &xkbgeometry->sections[i];
create_section (layout, keyboard, xkbsection);
}
}
static void
eek_xkb_layout_apply_to_keyboard (EekLayout *layout, EekKeyboard *keyboard)
{
g_return_if_fail (EEK_IS_XKB_LAYOUT(layout));
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
create_keyboard (EEK_XKB_LAYOUT(layout), keyboard);
if (g_object_is_floating (keyboard))
g_object_unref (keyboard);
}
static void
eek_xkb_layout_dispose (GObject *object)
{
G_OBJECT_CLASS (eek_xkb_layout_parent_class)->dispose (object);
}
static void
eek_xkb_layout_finalize (GObject *object)
{
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
g_free (priv->names.keycodes);
g_free (priv->names.geometry);
g_free (priv->names.symbols);
g_hash_table_unref (priv->outline_hash);
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
}
static void
eek_xkb_layout_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
const gchar *name;
switch (prop_id)
{
case PROP_KEYCODES:
name = g_value_get_string (value);
eek_xkb_layout_set_keycodes (EEK_XKB_LAYOUT(object), name);
break;
case PROP_GEOMETRY:
name = g_value_get_string (value);
eek_xkb_layout_set_geometry (EEK_XKB_LAYOUT(object), name);
break;
case PROP_SYMBOLS:
name = g_value_get_string (value);
eek_xkb_layout_set_symbols (EEK_XKB_LAYOUT(object), name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkb_layout_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
const gchar *name;
switch (prop_id)
{
case PROP_KEYCODES:
name = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(object));
g_value_set_string (value, name);
break;
case PROP_GEOMETRY:
name = eek_xkb_layout_get_geometry (EEK_XKB_LAYOUT(object));
g_value_set_string (value, name);
break;
case PROP_SYMBOLS:
name = eek_xkb_layout_get_symbols (EEK_XKB_LAYOUT(object));
g_value_set_string (value, name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
gobject_class->finalize = eek_xkb_layout_finalize;
gobject_class->dispose = eek_xkb_layout_dispose;
gobject_class->set_property = eek_xkb_layout_set_property;
gobject_class->get_property = eek_xkb_layout_get_property;
layout_class->apply_to_keyboard = eek_xkb_layout_apply_to_keyboard;
pspec = g_param_spec_string ("keycodes",
"Keycodes",
"XKB keycodes component name",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_KEYCODES, pspec);
pspec = g_param_spec_string ("geometry",
"Geometry",
"XKB geometry component name",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_GEOMETRY, pspec);
pspec = g_param_spec_string ("symbols",
"Symbols",
"XKB symbols component name",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_SYMBOLS, pspec);
}
static void
eek_xkb_layout_init (EekXkbLayout *self)
{
EekXkbLayoutPrivate *priv;
priv = self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
memset (&priv->names, 0, sizeof priv->names);
priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
/* XXX: XkbClientMapMask | XkbIndicatorMapMask | XkbNamesMask |
XkbGeometryMask */
priv->xkb = XkbGetKeyboard (priv->display,
XkbGBN_GeometryMask |
XkbGBN_KeyNamesMask |
XkbGBN_OtherNamesMask |
XkbGBN_SymbolsMask |
XkbGBN_IndicatorMapMask,
XkbUseCoreKbd);
priv->outline_hash = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
g_free);
if (priv->xkb == NULL) {
g_critical ("XkbGetKeyboard failed to get keyboard from the server!");
return;
}
get_names (self);
}
static void
get_names (EekXkbLayout *layout)
{
EekXkbLayoutPrivate *priv = layout->priv;
gchar *name;
XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
if (priv->xkb->names->keycodes <= 0)
g_warning ("XKB keycodes setting is not loaded properly");
else {
name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
if (!name)
g_warning ("Can't get the name of keycodes");
else if (!priv->names.keycodes ||
g_strcmp0 (name, priv->names.keycodes)) {
g_free (priv->names.keycodes);
priv->names.keycodes = g_strdup (name);
XFree (name);
}
}
if (priv->xkb->names->geometry <= 0)
g_warning ("XKB geometry setting is not loaded");
else {
name = XGetAtomName (priv->display, priv->xkb->names->geometry);
if (!name)
g_warning ("Can't get the name of geometry");
else if (!priv->names.geometry ||
g_strcmp0 (name, priv->names.geometry)) {
g_free (priv->names.geometry);
priv->names.geometry = g_strdup (name);
XFree (name);
}
}
if (priv->xkb->names->symbols <= 0)
g_warning ("XKB symbols setting is not loaded");
else {
name = XGetAtomName (priv->display, priv->xkb->names->symbols);
if (!name)
g_warning ("Can't get the name of symbols");
else if (!priv->names.symbols ||
g_strcmp0 (name, priv->names.symbols)) {
g_free (priv->names.symbols);
priv->names.symbols = g_strdup (name);
XFree (name);
}
}
}
/**
* eek_xkb_layout_new:
* @keycodes: component name for keycodes
* @geometry: component name for geometry
* @symbols: component name for symbols
*
* Create a new #EekXkbLayout.
*/
EekLayout *
eek_xkb_layout_new (const gchar *keycodes,
const gchar *geometry,
const gchar *symbols)
{
EekXkbLayout *layout = g_object_new (EEK_TYPE_XKB_LAYOUT, NULL);
EekXkbLayoutPrivate *priv = layout->priv;
g_return_val_if_fail (layout, NULL);
if (keycodes)
priv->names.keycodes = g_strdup (keycodes);
if (geometry)
priv->names.geometry = g_strdup (geometry);
if (symbols)
priv->names.symbols = g_strdup (symbols);
get_keyboard (layout);
return EEK_LAYOUT(layout);
}
/**
* eek_xkb_layout_set_keycodes:
* @layout: an #EekXkbLayout
* @keycodes: component name for keycodes
*
* Set the keycodes component (in the XKB terminology).
*/
void
eek_xkb_layout_set_keycodes (EekXkbLayout *layout, const gchar *keycodes)
{
EekXkbLayoutPrivate *priv = layout->priv;
g_free (priv->names.keycodes);
priv->names.keycodes = g_strdup (keycodes);
get_keyboard (layout);
}
/**
* eek_xkb_layout_set_geometry:
* @layout: an #EekXkbLayout
* @geometry: component name for geometry
*
* Set the keycodes component (in the XKB terminology).
*/
void
eek_xkb_layout_set_geometry (EekXkbLayout *layout, const gchar *geometry)
{
EekXkbLayoutPrivate *priv = layout->priv;
g_free (priv->names.geometry);
priv->names.geometry = g_strdup (geometry);
get_keyboard (layout);
}
/**
* eek_xkb_layout_set_symbols:
* @layout: an #EekXkbLayout
* @symbols: component name for symbols
*
* Set the symbols component (in the XKB terminology).
*/
void
eek_xkb_layout_set_symbols (EekXkbLayout *layout, const gchar *symbols)
{
EekXkbLayoutPrivate *priv = layout->priv;
g_free (priv->names.symbols);
priv->names.symbols = g_strdup (symbols);
get_keyboard (layout);
}
/**
* eek_xkb_layout_get_keycodes:
* @layout: an #EekXkbLayout
*
* Get the keycodes component name (in the XKB terminology).
*/
G_CONST_RETURN gchar *
eek_xkb_layout_get_keycodes (EekXkbLayout *layout)
{
EekXkbLayoutPrivate *priv = layout->priv;
return priv->names.keycodes;
}
/**
* eek_xkb_layout_get_geometry:
* @layout: an #EekXkbLayout
*
* Get the geometry component name (in the XKB terminology).
*/
G_CONST_RETURN gchar *
eek_xkb_layout_get_geometry (EekXkbLayout *layout)
{
EekXkbLayoutPrivate *priv = layout->priv;
char *name;
return priv->names.geometry;
}
/**
* eek_xkb_layout_get_symbols:
* @layout: an #EekXkbLayout
*
* Get the symbols component name (in the XKB terminology).
*/
G_CONST_RETURN gchar *
eek_xkb_layout_get_symbols (EekXkbLayout *layout)
{
EekXkbLayoutPrivate *priv = layout->priv;
return priv->names.symbols;
}
static void
get_keyboard (EekXkbLayout *layout)
{
EekXkbLayoutPrivate *priv = layout->priv;
if (priv->xkb)
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
priv->xkb = NULL;
if (priv->names.keycodes &&
priv->names.geometry &&
priv->names.symbols) {
priv->xkb = XkbGetKeyboardByName (priv->display, XkbUseCoreKbd,
&priv->names, 0,
XkbGBN_GeometryMask |
XkbGBN_KeyNamesMask |
XkbGBN_OtherNamesMask |
XkbGBN_ClientSymbolsMask |
XkbGBN_IndicatorMapMask, FALSE);
} else {
priv->xkb = XkbGetKeyboard (priv->display,
XkbGBN_GeometryMask |
XkbGBN_KeyNamesMask |
XkbGBN_OtherNamesMask |
XkbGBN_SymbolsMask |
XkbGBN_IndicatorMapMask,
XkbUseCoreKbd);
get_names (layout);
}
if (priv->xkb == NULL) {
g_free (priv->names.keycodes);
priv->names.keycodes = NULL;
g_free (priv->names.geometry);
priv->names.geometry = NULL;
g_free (priv->names.symbols);
priv->names.symbols = NULL;
}
}
static guint
find_keycode (EekXkbLayout *layout, gchar *key_name)
{
#define KEYSYM_NAME_MAX_LENGTH 4
guint keycode;
gint i, j;
XkbKeyNamePtr pkey;
XkbKeyAliasPtr palias;
guint is_name_matched;
gchar *src, *dst;
EekXkbLayoutPrivate *priv = layout->priv;
if (!priv->xkb)
return INVALID_KEYCODE;
#ifdef KBDRAW_DEBUG
printf (" looking for keycode for (%c%c%c%c)\n",
key_name[0], key_name[1], key_name[2], key_name[3]);
#endif
pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
for (keycode = priv->xkb->min_key_code;
keycode <= priv->xkb->max_key_code; keycode++) {
is_name_matched = 1;
src = key_name;
dst = pkey->name;
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
if ('\0' == *src)
break;
if (*src++ != *dst++) {
is_name_matched = 0;
break;
}
}
if (is_name_matched) {
#ifdef KBDRAW_DEBUG
printf (" found keycode %u\n", keycode);
#endif
return keycode;
}
pkey++;
}
palias = priv->xkb->names->key_aliases;
for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
is_name_matched = 1;
src = key_name;
dst = palias->alias;
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
if ('\0' == *src)
break;
if (*src++ != *dst++) {
is_name_matched = 0;
break;
}
}
if (is_name_matched) {
keycode = find_keycode (layout, palias->real);
#ifdef KBDRAW_DEBUG
printf ("found alias keycode %u\n", keycode);
#endif
return keycode;
}
palias++;
}
return INVALID_KEYCODE;
}
static void
setup_scaling (EekXkbLayout *layout,
gdouble width,
gdouble height)
{
EekXkbLayoutPrivate *priv = layout->priv;
g_return_if_fail (priv->xkb);
g_return_if_fail (priv->xkb->geom->width_mm > 0);
g_return_if_fail (priv->xkb->geom->height_mm > 0);
if (width * priv->xkb->geom->height_mm <
height * priv->xkb->geom->width_mm) {
priv->scale_numerator = width;
priv->scale_denominator = priv->xkb->geom->width_mm;
} else {
priv->scale_numerator = height;
priv->scale_denominator = priv->xkb->geom->height_mm;
}
}

83
eek/eek-xkb-layout.h Normal file
View File

@ -0,0 +1,83 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_XKB_LAYOUT_H
#define EEK_XKB_LAYOUT_H 1
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include "eek-layout.h"
G_BEGIN_DECLS
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
typedef struct _EekXkbLayout EekXkbLayout;
typedef struct _EekXkbLayoutClass EekXkbLayoutClass;
typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
struct _EekXkbLayout
{
/*< private >*/
EekLayout parent;
EekXkbLayoutPrivate *priv;
};
struct _EekXkbLayoutClass
{
/*< private >*/
EekLayoutClass parent_class;
void (* set_keycodes) (EekXkbLayout *self,
const gchar *keycodes);
void (* set_geometry) (EekXkbLayout *self,
const gchar *geometry);
void (* set_symbols) (EekXkbLayout *self,
const gchar *symbols);
G_CONST_RETURN gchar *(* get_keycodes) (EekXkbLayout *self);
G_CONST_RETURN gchar *(* get_geometry) (EekXkbLayout *self);
G_CONST_RETURN gchar *(* get_symbols) (EekXkbLayout *self);
};
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
EekLayout *eek_xkb_layout_new (const gchar *keycodes,
const gchar *geometry,
const gchar *symbols);
void eek_xkb_layout_set_keycodes (EekXkbLayout *layout,
const gchar *keycodes);
void eek_xkb_layout_set_geometry (EekXkbLayout *layout,
const gchar *geometry);
void eek_xkb_layout_set_symbols (EekXkbLayout *layout,
const gchar *symbols);
G_CONST_RETURN gchar *eek_xkb_layout_get_keycodes (EekXkbLayout * layout);
G_CONST_RETURN gchar *eek_xkb_layout_get_geometry (EekXkbLayout * layout);
G_CONST_RETURN gchar *eek_xkb_layout_get_symbols (EekXkbLayout * layout);
G_END_DECLS
#endif /* #ifndef EEK_XKB_LAYOUT_H */

26
eek/eek-xkb.h Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_XKB_H
#define EEK_XKB_H 1
#include "eek.h"
#include "eek-xkb-layout.h"
#endif /* EEK_XKB_H */

27
eek/eek.h Normal file
View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 EEK_H
#define EEK_H 1
#include "eek-keyboard.h"
#include "eek-layout.h"
#include "eek-keysym.c"
#endif /* EEK_H */

28
eek/gen-keysym-labels.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python
from __future__ import with_statement
import sys
import re
if len(sys.argv) != 3:
print >> sys.stderr, "Usage: %s table.txt table-name" % sys.argv[0]
sys.exit(-1)
table = dict()
with open(sys.argv[1], 'r') as fp:
for line in fp:
line = line.decode('UTF-8')
match = re.match(r'\s*(0x[0-9A-F]+)\s+(\S*)', line, re.I)
if match:
table[int(match.group(1), 16)] = match.group(2)
sys.stdout.write("static const struct eek_keysym_label %s[] = {\n" %
sys.argv[2])
for index, (keysym, label) in enumerate([(keysym, table[keysym])
for keysym in sorted(table.keys())]):
sys.stdout.write(" { 0x%X, %s }" % (keysym, label.encode('UTF-8')))
if index < len(table) - 1:
sys.stdout.write(",")
sys.stdout.write("\n")
sys.stdout.write("};\n")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
0x20 ""
0x8A3 "horiz\nconn"
0xFE50 "ˋ"
0xFE51 "ˊ"
0xFE52 "ˆ"
0xFE53 "~"
0xFE54 "ˉ"
0xFE55 "˘"
0xFE56 "˙"
0xFE57 "¨"
0xFE58 "˚"
0xFE59 "˝"
0xFE5A "ˇ"
0xFE5B "¸"
0xFE5C "˛"
0xFF14 "Scroll\nLock"
0xFF20 "Compose"
0xFF55 "Page\nUp"
0xFF56 "Page\nDown"
0xFF7E "AltGr"
0xFF7F "Num\nLock"
0xFF8D "Enter"
0xFF95 "Home"
0xFF96 "Left"
0xFF97 "Up"
0xFF98 "Right"
0xFF99 "Down"
0xFF9C "End"
0xFF9D "Begin"
0xFF9E "Ins"
0xFF9F "Del"

View File

@ -0,0 +1,826 @@
# This file is derived from gdkkeyuni.c in GTK+. Thanks for the
# team. The original comments are below:
# Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
# file for a list of people on the GTK+ Team. See the ChangeLog
# files for a list of changes. These files are distributed with
# GTK+ at ftp://ftp.gtk.org/pub/gtk/.
# Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
# mapping functions, from the xterm sources.
# These tables could be compressed by contiguous ranges, but the
# benefit of doing so is smallish. It would save about ~1000 bytes
# total.
0x01a1 "Ą" # Aogonek Ą LATIN CAPITAL LETTER A WITH OGONEK
0x01a2 "˘" # breve ˘ BREVE
0x01a3 "Ł" # Lstroke Ł LATIN CAPITAL LETTER L WITH STROKE
0x01a5 "Ľ" # Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON
0x01a6 "Ś" # Sacute Ś LATIN CAPITAL LETTER S WITH ACUTE
0x01a9 "Š" # Scaron Š LATIN CAPITAL LETTER S WITH CARON
0x01aa "Ş" # Scedilla Ş LATIN CAPITAL LETTER S WITH CEDILLA
0x01ab "Ť" # Tcaron Ť LATIN CAPITAL LETTER T WITH CARON
0x01ac "Ź" # Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE
0x01ae "Ž" # Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON
0x01af "Ż" # Zabovedot Ż LATIN CAPITAL LETTER Z WITH DOT ABOVE
0x01b1 "ą" # aogonek ą LATIN SMALL LETTER A WITH OGONEK
0x01b2 "˛" # ogonek ˛ OGONEK
0x01b3 "ł" # lstroke ł LATIN SMALL LETTER L WITH STROKE
0x01b5 "ľ" # lcaron ľ LATIN SMALL LETTER L WITH CARON
0x01b6 "ś" # sacute ś LATIN SMALL LETTER S WITH ACUTE
0x01b7 "ˇ" # caron ˇ CARON
0x01b9 "š" # scaron š LATIN SMALL LETTER S WITH CARON
0x01ba "ş" # scedilla ş LATIN SMALL LETTER S WITH CEDILLA
0x01bb "ť" # tcaron ť LATIN SMALL LETTER T WITH CARON
0x01bc "ź" # zacute ź LATIN SMALL LETTER Z WITH ACUTE
0x01bd "˝" # doubleacute ˝ DOUBLE ACUTE ACCENT
0x01be "ž" # zcaron ž LATIN SMALL LETTER Z WITH CARON
0x01bf "ż" # zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE
0x01c0 "Ŕ" # Racute Ŕ LATIN CAPITAL LETTER R WITH ACUTE
0x01c3 "Ă" # Abreve Ă LATIN CAPITAL LETTER A WITH BREVE
0x01c5 "Ĺ" # Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE
0x01c6 "Ć" # Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE
0x01c8 "Č" # Ccaron Č LATIN CAPITAL LETTER C WITH CARON
0x01ca "Ę" # Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK
0x01cc "Ě" # Ecaron Ě LATIN CAPITAL LETTER E WITH CARON
0x01cf "Ď" # Dcaron Ď LATIN CAPITAL LETTER D WITH CARON
0x01d0 "Đ" # Dstroke Đ LATIN CAPITAL LETTER D WITH STROKE
0x01d1 "Ń" # Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE
0x01d2 "Ň" # Ncaron Ň LATIN CAPITAL LETTER N WITH CARON
0x01d5 "Ő" # Odoubleacute Ő LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0x01d8 "Ř" # Rcaron Ř LATIN CAPITAL LETTER R WITH CARON
0x01d9 "Ů" # Uring Ů LATIN CAPITAL LETTER U WITH RING ABOVE
0x01db "Ű" # Udoubleacute Ű LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0x01de "Ţ" # Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA
0x01e0 "ŕ" # racute ŕ LATIN SMALL LETTER R WITH ACUTE
0x01e3 "ă" # abreve ă LATIN SMALL LETTER A WITH BREVE
0x01e5 "ĺ" # lacute ĺ LATIN SMALL LETTER L WITH ACUTE
0x01e6 "ć" # cacute ć LATIN SMALL LETTER C WITH ACUTE
0x01e8 "č" # ccaron č LATIN SMALL LETTER C WITH CARON
0x01ea "ę" # eogonek ę LATIN SMALL LETTER E WITH OGONEK
0x01ec "ě" # ecaron ě LATIN SMALL LETTER E WITH CARON
0x01ef "ď" # dcaron ď LATIN SMALL LETTER D WITH CARON
0x01f0 "đ" # dstroke đ LATIN SMALL LETTER D WITH STROKE
0x01f1 "ń" # nacute ń LATIN SMALL LETTER N WITH ACUTE
0x01f2 "ň" # ncaron ň LATIN SMALL LETTER N WITH CARON
0x01f5 "ő" # odoubleacute ő LATIN SMALL LETTER O WITH DOUBLE ACUTE
0x01f8 "ř" # rcaron ř LATIN SMALL LETTER R WITH CARON
0x01f9 "ů" # uring ů LATIN SMALL LETTER U WITH RING ABOVE
0x01fb "ű" # udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE
0x01fe "ţ" # tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA
0x01ff "˙" # abovedot ˙ DOT ABOVE
0x02a1 "Ħ" # Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE
0x02a6 "Ĥ" # Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX
0x02a9 "İ" # Iabovedot İ LATIN CAPITAL LETTER I WITH DOT ABOVE
0x02ab "Ğ" # Gbreve Ğ LATIN CAPITAL LETTER G WITH BREVE
0x02ac "Ĵ" # Jcircumflex Ĵ LATIN CAPITAL LETTER J WITH CIRCUMFLEX
0x02b1 "ħ" # hstroke ħ LATIN SMALL LETTER H WITH STROKE
0x02b6 "ĥ" # hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX
0x02b9 "ı" # idotless ı LATIN SMALL LETTER DOTLESS I
0x02bb "ğ" # gbreve ğ LATIN SMALL LETTER G WITH BREVE
0x02bc "ĵ" # jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX
0x02c5 "Ċ" # Cabovedot Ċ LATIN CAPITAL LETTER C WITH DOT ABOVE
0x02c6 "Ĉ" # Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX
0x02d5 "Ġ" # Gabovedot Ġ LATIN CAPITAL LETTER G WITH DOT ABOVE
0x02d8 "Ĝ" # Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX
0x02dd "Ŭ" # Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE
0x02de "Ŝ" # Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX
0x02e5 "ċ" # cabovedot ċ LATIN SMALL LETTER C WITH DOT ABOVE
0x02e6 "ĉ" # ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX
0x02f5 "ġ" # gabovedot ġ LATIN SMALL LETTER G WITH DOT ABOVE
0x02f8 "ĝ" # gcircumflex ĝ LATIN SMALL LETTER G WITH CIRCUMFLEX
0x02fd "ŭ" # ubreve ŭ LATIN SMALL LETTER U WITH BREVE
0x02fe "ŝ" # scircumflex ŝ LATIN SMALL LETTER S WITH CIRCUMFLEX
0x03a2 "ĸ" # kra ĸ LATIN SMALL LETTER KRA
0x03a3 "Ŗ" # Rcedilla Ŗ LATIN CAPITAL LETTER R WITH CEDILLA
0x03a5 "Ĩ" # Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE
0x03a6 "Ļ" # Lcedilla Ļ LATIN CAPITAL LETTER L WITH CEDILLA
0x03aa "Ē" # Emacron Ē LATIN CAPITAL LETTER E WITH MACRON
0x03ab "Ģ" # Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA
0x03ac "Ŧ" # Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE
0x03b3 "ŗ" # rcedilla ŗ LATIN SMALL LETTER R WITH CEDILLA
0x03b5 "ĩ" # itilde ĩ LATIN SMALL LETTER I WITH TILDE
0x03b6 "ļ" # lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA
0x03ba "ē" # emacron ē LATIN SMALL LETTER E WITH MACRON
0x03bb "ģ" # gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA
0x03bc "ŧ" # tslash ŧ LATIN SMALL LETTER T WITH STROKE
0x03bd "Ŋ" # ENG Ŋ LATIN CAPITAL LETTER ENG
0x03bf "ŋ" # eng ŋ LATIN SMALL LETTER ENG
0x03c0 "Ā" # Amacron Ā LATIN CAPITAL LETTER A WITH MACRON
0x03c7 "Į" # Iogonek Į LATIN CAPITAL LETTER I WITH OGONEK
0x03cc "Ė" # Eabovedot Ė LATIN CAPITAL LETTER E WITH DOT ABOVE
0x03cf "Ī" # Imacron Ī LATIN CAPITAL LETTER I WITH MACRON
0x03d1 "Ņ" # Ncedilla Ņ LATIN CAPITAL LETTER N WITH CEDILLA
0x03d2 "Ō" # Omacron Ō LATIN CAPITAL LETTER O WITH MACRON
0x03d3 "Ķ" # Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA
0x03d9 "Ų" # Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK
0x03dd "Ũ" # Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE
0x03de "Ū" # Umacron Ū LATIN CAPITAL LETTER U WITH MACRON
0x03e0 "ā" # amacron ā LATIN SMALL LETTER A WITH MACRON
0x03e7 "į" # iogonek į LATIN SMALL LETTER I WITH OGONEK
0x03ec "ė" # eabovedot ė LATIN SMALL LETTER E WITH DOT ABOVE
0x03ef "ī" # imacron ī LATIN SMALL LETTER I WITH MACRON
0x03f1 "ņ" # ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA
0x03f2 "ō" # omacron ō LATIN SMALL LETTER O WITH MACRON
0x03f3 "ķ" # kcedilla ķ LATIN SMALL LETTER K WITH CEDILLA
0x03f9 "ų" # uogonek ų LATIN SMALL LETTER U WITH OGONEK
0x03fd "ũ" # utilde ũ LATIN SMALL LETTER U WITH TILDE
0x03fe "ū" # umacron ū LATIN SMALL LETTER U WITH MACRON
0x047e "‾" # overline ‾ OVERLINE
0x04a1 "。" # kana_fullstop 。 IDEOGRAPHIC FULL STOP
0x04a2 "「" # kana_openingbracket 「 LEFT CORNER BRACKET
0x04a3 "」" # kana_closingbracket 」 RIGHT CORNER BRACKET
0x04a4 "、" # kana_comma 、 IDEOGRAPHIC COMMA
0x04a5 "・" # kana_conjunctive ・ KATAKANA MIDDLE DOT
0x04a6 "ヲ" # kana_WO ヲ KATAKANA LETTER WO
0x04a7 "ァ" # kana_a ァ KATAKANA LETTER SMALL A
0x04a8 "ィ" # kana_i ィ KATAKANA LETTER SMALL I
0x04a9 "ゥ" # kana_u ゥ KATAKANA LETTER SMALL U
0x04aa "ェ" # kana_e ェ KATAKANA LETTER SMALL E
0x04ab "ォ" # kana_o ォ KATAKANA LETTER SMALL O
0x04ac "ャ" # kana_ya ャ KATAKANA LETTER SMALL YA
0x04ad "ュ" # kana_yu ュ KATAKANA LETTER SMALL YU
0x04ae "ョ" # kana_yo ョ KATAKANA LETTER SMALL YO
0x04af "ッ" # kana_tsu ッ KATAKANA LETTER SMALL TU
0x04b0 "ー" # prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK
0x04b1 "ア" # kana_A ア KATAKANA LETTER A
0x04b2 "イ" # kana_I イ KATAKANA LETTER I
0x04b3 "ウ" # kana_U ウ KATAKANA LETTER U
0x04b4 "エ" # kana_E エ KATAKANA LETTER E
0x04b5 "オ" # kana_O オ KATAKANA LETTER O
0x04b6 "カ" # kana_KA カ KATAKANA LETTER KA
0x04b7 "キ" # kana_KI キ KATAKANA LETTER KI
0x04b8 "ク" # kana_KU ク KATAKANA LETTER KU
0x04b9 "ケ" # kana_KE ケ KATAKANA LETTER KE
0x04ba "コ" # kana_KO コ KATAKANA LETTER KO
0x04bb "サ" # kana_SA サ KATAKANA LETTER SA
0x04bc "シ" # kana_SHI シ KATAKANA LETTER SI
0x04bd "ス" # kana_SU ス KATAKANA LETTER SU
0x04be "セ" # kana_SE セ KATAKANA LETTER SE
0x04bf "ソ" # kana_SO ソ KATAKANA LETTER SO
0x04c0 "タ" # kana_TA タ KATAKANA LETTER TA
0x04c1 "チ" # kana_CHI チ KATAKANA LETTER TI
0x04c2 "ツ" # kana_TSU ツ KATAKANA LETTER TU
0x04c3 "テ" # kana_TE テ KATAKANA LETTER TE
0x04c4 "ト" # kana_TO ト KATAKANA LETTER TO
0x04c5 "ナ" # kana_NA ナ KATAKANA LETTER NA
0x04c6 "ニ" # kana_NI ニ KATAKANA LETTER NI
0x04c7 "ヌ" # kana_NU ヌ KATAKANA LETTER NU
0x04c8 "ネ" # kana_NE ネ KATAKANA LETTER NE
0x04c9 "" # kana_NO KATAKANA LETTER NO
0x04ca "ハ" # kana_HA ハ KATAKANA LETTER HA
0x04cb "ヒ" # kana_HI ヒ KATAKANA LETTER HI
0x04cc "フ" # kana_FU フ KATAKANA LETTER HU
0x04cd "ヘ" # kana_HE ヘ KATAKANA LETTER HE
0x04ce "ホ" # kana_HO ホ KATAKANA LETTER HO
0x04cf "マ" # kana_MA マ KATAKANA LETTER MA
0x04d0 "ミ" # kana_MI ミ KATAKANA LETTER MI
0x04d1 "ム" # kana_MU ム KATAKANA LETTER MU
0x04d2 "メ" # kana_ME メ KATAKANA LETTER ME
0x04d3 "モ" # kana_MO モ KATAKANA LETTER MO
0x04d4 "ヤ" # kana_YA ヤ KATAKANA LETTER YA
0x04d5 "ユ" # kana_YU ユ KATAKANA LETTER YU
0x04d6 "ヨ" # kana_YO ヨ KATAKANA LETTER YO
0x04d7 "ラ" # kana_RA ラ KATAKANA LETTER RA
0x04d8 "リ" # kana_RI リ KATAKANA LETTER RI
0x04d9 "ル" # kana_RU ル KATAKANA LETTER RU
0x04da "レ" # kana_RE レ KATAKANA LETTER RE
0x04db "ロ" # kana_RO ロ KATAKANA LETTER RO
0x04dc "ワ" # kana_WA ワ KATAKANA LETTER WA
0x04dd "ン" # kana_N ン KATAKANA LETTER N
0x04de "゛" # voicedsound ゛ KATAKANA-HIRAGANA VOICED SOUND MARK
0x04df "゜" # semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
0x05ac "،" # Arabic_comma ، ARABIC COMMA
0x05bb "؛" # Arabic_semicolon ؛ ARABIC SEMICOLON
0x05bf "؟" # Arabic_question_mark ؟ ARABIC QUESTION MARK
0x05c1 "ء" # Arabic_hamza ء ARABIC LETTER HAMZA
0x05c2 "آ" # Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE
0x05c3 "أ" # Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE
0x05c4 "ؤ" # Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE
0x05c5 "إ" # Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW
0x05c6 "ئ" # Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE
0x05c7 "ا" # Arabic_alef ا ARABIC LETTER ALEF
0x05c8 "ب" # Arabic_beh ب ARABIC LETTER BEH
0x05c9 "ة" # Arabic_tehmarbuta ة ARABIC LETTER TEH MARBUTA
0x05ca "ت" # Arabic_teh ت ARABIC LETTER TEH
0x05cb "ث" # Arabic_theh ث ARABIC LETTER THEH
0x05cc "ج" # Arabic_jeem ج ARABIC LETTER JEEM
0x05cd "ح" # Arabic_hah ح ARABIC LETTER HAH
0x05ce "خ" # Arabic_khah خ ARABIC LETTER KHAH
0x05cf "د" # Arabic_dal د ARABIC LETTER DAL
0x05d0 "ذ" # Arabic_thal ذ ARABIC LETTER THAL
0x05d1 "ر" # Arabic_ra ر ARABIC LETTER REH
0x05d2 "ز" # Arabic_zain ز ARABIC LETTER ZAIN
0x05d3 "س" # Arabic_seen س ARABIC LETTER SEEN
0x05d4 "ش" # Arabic_sheen ش ARABIC LETTER SHEEN
0x05d5 "ص" # Arabic_sad ص ARABIC LETTER SAD
0x05d6 "ض" # Arabic_dad ض ARABIC LETTER DAD
0x05d7 "ط" # Arabic_tah ط ARABIC LETTER TAH
0x05d8 "ظ" # Arabic_zah ظ ARABIC LETTER ZAH
0x05d9 "ع" # Arabic_ain ع ARABIC LETTER AIN
0x05da "غ" # Arabic_ghain غ ARABIC LETTER GHAIN
0x05e0 "ـ" # Arabic_tatweel ـ ARABIC TATWEEL
0x05e1 "ف" # Arabic_feh ف ARABIC LETTER FEH
0x05e2 "ق" # Arabic_qaf ق ARABIC LETTER QAF
0x05e3 "ك" # Arabic_kaf ك ARABIC LETTER KAF
0x05e4 "ل" # Arabic_lam ل ARABIC LETTER LAM
0x05e5 "م" # Arabic_meem م ARABIC LETTER MEEM
0x05e6 "ن" # Arabic_noon ن ARABIC LETTER NOON
0x05e7 "ه" # Arabic_ha ه ARABIC LETTER HEH
0x05e8 "و" # Arabic_waw و ARABIC LETTER WAW
0x05e9 "ى" # Arabic_alefmaksura ى ARABIC LETTER ALEF MAKSURA
0x05ea "ي" # Arabic_yeh ي ARABIC LETTER YEH
0x05eb "ً" # Arabic_fathatan ً ARABIC FATHATAN
0x05ec "ٌ" # Arabic_dammatan ٌ ARABIC DAMMATAN
0x05ed "ٍ" # Arabic_kasratan ٍ ARABIC KASRATAN
0x05ee "َ" # Arabic_fatha َ ARABIC FATHA
0x05ef "ُ" # Arabic_damma ُ ARABIC DAMMA
0x05f0 "ِ" # Arabic_kasra ِ ARABIC KASRA
0x05f1 "ّ" # Arabic_shadda ّ ARABIC SHADDA
0x05f2 "ْ" # Arabic_sukun ْ ARABIC SUKUN
0x06a1 "ђ" # Serbian_dje ђ CYRILLIC SMALL LETTER DJE
0x06a2 "ѓ" # Macedonia_gje ѓ CYRILLIC SMALL LETTER GJE
0x06a3 "ё" # Cyrillic_io ё CYRILLIC SMALL LETTER IO
0x06a4 "є" # Ukrainian_ie є CYRILLIC SMALL LETTER UKRAINIAN IE
0x06a5 "ѕ" # Macedonia_dse ѕ CYRILLIC SMALL LETTER DZE
0x06a6 "і" # Ukrainian_i і CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
0x06a7 "ї" # Ukrainian_yi ї CYRILLIC SMALL LETTER YI
0x06a8 "ј" # Cyrillic_je ј CYRILLIC SMALL LETTER JE
0x06a9 "љ" # Cyrillic_lje љ CYRILLIC SMALL LETTER LJE
0x06aa "њ" # Cyrillic_nje њ CYRILLIC SMALL LETTER NJE
0x06ab "ћ" # Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE
0x06ac "ќ" # Macedonia_kje ќ CYRILLIC SMALL LETTER KJE
0x06ad "ґ" # Ukrainian_ghe_with_upturn ґ CYRILLIC SMALL LETTER GHE WITH UPTURN
0x06ae "ў" # Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U
0x06af "џ" # Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE
0x06b0 "№" # numerosign № NUMERO SIGN
0x06b1 "Ђ" # Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE
0x06b2 "Ѓ" # Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE
0x06b3 "Ё" # Cyrillic_IO Ё CYRILLIC CAPITAL LETTER IO
0x06b4 "Є" # Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE
0x06b5 "Ѕ" # Macedonia_DSE Ѕ CYRILLIC CAPITAL LETTER DZE
0x06b6 "І" # Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
0x06b7 "Ї" # Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI
0x06b8 "Ј" # Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE
0x06b9 "Љ" # Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE
0x06ba "Њ" # Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE
0x06bb "Ћ" # Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE
0x06bc "Ќ" # Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE
0x06bd "Ґ" # Ukrainian_GHE_WITH_UPTURN Ґ CYRILLIC CAPITAL LETTER GHE WITH UPTURN
0x06be "Ў" # Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U
0x06bf "Џ" # Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE
0x06c0 "ю" # Cyrillic_yu ю CYRILLIC SMALL LETTER YU
0x06c1 "а" # Cyrillic_a а CYRILLIC SMALL LETTER A
0x06c2 "б" # Cyrillic_be б CYRILLIC SMALL LETTER BE
0x06c3 "ц" # Cyrillic_tse ц CYRILLIC SMALL LETTER TSE
0x06c4 "д" # Cyrillic_de д CYRILLIC SMALL LETTER DE
0x06c5 "е" # Cyrillic_ie е CYRILLIC SMALL LETTER IE
0x06c6 "ф" # Cyrillic_ef ф CYRILLIC SMALL LETTER EF
0x06c7 "г" # Cyrillic_ghe г CYRILLIC SMALL LETTER GHE
0x06c8 "х" # Cyrillic_ha х CYRILLIC SMALL LETTER HA
0x06c9 "и" # Cyrillic_i и CYRILLIC SMALL LETTER I
0x06ca "й" # Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I
0x06cb "к" # Cyrillic_ka к CYRILLIC SMALL LETTER KA
0x06cc "л" # Cyrillic_el л CYRILLIC SMALL LETTER EL
0x06cd "м" # Cyrillic_em м CYRILLIC SMALL LETTER EM
0x06ce "н" # Cyrillic_en н CYRILLIC SMALL LETTER EN
0x06cf "о" # Cyrillic_o о CYRILLIC SMALL LETTER O
0x06d0 "п" # Cyrillic_pe п CYRILLIC SMALL LETTER PE
0x06d1 "я" # Cyrillic_ya я CYRILLIC SMALL LETTER YA
0x06d2 "р" # Cyrillic_er р CYRILLIC SMALL LETTER ER
0x06d3 "с" # Cyrillic_es с CYRILLIC SMALL LETTER ES
0x06d4 "т" # Cyrillic_te т CYRILLIC SMALL LETTER TE
0x06d5 "у" # Cyrillic_u у CYRILLIC SMALL LETTER U
0x06d6 "ж" # Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE
0x06d7 "в" # Cyrillic_ve в CYRILLIC SMALL LETTER VE
0x06d8 "ь" # Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN
0x06d9 "ы" # Cyrillic_yeru ы CYRILLIC SMALL LETTER YERU
0x06da "з" # Cyrillic_ze з CYRILLIC SMALL LETTER ZE
0x06db "ш" # Cyrillic_sha ш CYRILLIC SMALL LETTER SHA
0x06dc "э" # Cyrillic_e э CYRILLIC SMALL LETTER E
0x06dd "щ" # Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA
0x06de "ч" # Cyrillic_che ч CYRILLIC SMALL LETTER CHE
0x06df "ъ" # Cyrillic_hardsign ъ CYRILLIC SMALL LETTER HARD SIGN
0x06e0 "Ю" # Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU
0x06e1 "А" # Cyrillic_A А CYRILLIC CAPITAL LETTER A
0x06e2 "Б" # Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE
0x06e3 "Ц" # Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE
0x06e4 "Д" # Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE
0x06e5 "Е" # Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE
0x06e6 "Ф" # Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF
0x06e7 "Г" # Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE
0x06e8 "Х" # Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA
0x06e9 "И" # Cyrillic_I И CYRILLIC CAPITAL LETTER I
0x06ea "Й" # Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I
0x06eb "К" # Cyrillic_KA К CYRILLIC CAPITAL LETTER KA
0x06ec "Л" # Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL
0x06ed "М" # Cyrillic_EM М CYRILLIC CAPITAL LETTER EM
0x06ee "Н" # Cyrillic_EN Н CYRILLIC CAPITAL LETTER EN
0x06ef "О" # Cyrillic_O О CYRILLIC CAPITAL LETTER O
0x06f0 "П" # Cyrillic_PE П CYRILLIC CAPITAL LETTER PE
0x06f1 "Я" # Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA
0x06f2 "Р" # Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER
0x06f3 "С" # Cyrillic_ES С CYRILLIC CAPITAL LETTER ES
0x06f4 "Т" # Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE
0x06f5 "У" # Cyrillic_U У CYRILLIC CAPITAL LETTER U
0x06f6 "Ж" # Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE
0x06f7 "В" # Cyrillic_VE В CYRILLIC CAPITAL LETTER VE
0x06f8 "Ь" # Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN
0x06f9 "Ы" # Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU
0x06fa "З" # Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE
0x06fb "Ш" # Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA
0x06fc "Э" # Cyrillic_E Э CYRILLIC CAPITAL LETTER E
0x06fd "Щ" # Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA
0x06fe "Ч" # Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE
0x06ff "Ъ" # Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN
0x07a1 "Ά" # Geek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS
0x07a2 "Έ" # Geek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS
0x07a3 "Ή" # Geek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS
0x07a4 "Ί" # Geek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS
0x07a5 "Ϊ" # Geek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
0x07a7 "Ό" # Geek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS
0x07a8 "Ύ" # Geek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS
0x07a9 "Ϋ" # Geek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
0x07ab "Ώ" # Geek_OMEGAaccent Ώ GREEK CAPITAL LETTER OMEGA WITH TONOS
0x07ae "΅" # Geek_accentdieresis ΅ GREEK DIALYTIKA TONOS
0x07af "―" # Geek_horizbar ― HORIZONTAL BAR
0x07b1 "ά" # Geek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS
0x07b2 "έ" # Geek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS
0x07b3 "ή" # Geek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS
0x07b4 "ί" # Geek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS
0x07b5 "ϊ" # Geek_iotadieresis ϊ GREEK SMALL LETTER IOTA WITH DIALYTIKA
0x07b6 "ΐ" # Geek_iotaaccentdieresis ΐ GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
0x07b7 "ό" # Geek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS
0x07b8 "ύ" # Geek_upsilonaccent ύ GREEK SMALL LETTER UPSILON WITH TONOS
0x07b9 "ϋ" # Geek_upsilondieresis ϋ GREEK SMALL LETTER UPSILON WITH DIALYTIKA
0x07ba "ΰ" # Geek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
0x07bb "ώ" # Geek_omegaaccent ώ GREEK SMALL LETTER OMEGA WITH TONOS
0x07c1 "Α" # Geek_ALPHA Α GREEK CAPITAL LETTER ALPHA
0x07c2 "Β" # Geek_BETA Β GREEK CAPITAL LETTER BETA
0x07c3 "Γ" # Geek_GAMMA Γ GREEK CAPITAL LETTER GAMMA
0x07c4 "Δ" # Geek_DELTA Δ GREEK CAPITAL LETTER DELTA
0x07c5 "Ε" # Geek_EPSILON Ε GREEK CAPITAL LETTER EPSILON
0x07c6 "Ζ" # Geek_ZETA Ζ GREEK CAPITAL LETTER ZETA
0x07c7 "Η" # Geek_ETA Η GREEK CAPITAL LETTER ETA
0x07c8 "Θ" # Geek_THETA Θ GREEK CAPITAL LETTER THETA
0x07c9 "Ι" # Geek_IOTA Ι GREEK CAPITAL LETTER IOTA
0x07ca "Κ" # Geek_KAPPA Κ GREEK CAPITAL LETTER KAPPA
0x07cb "Λ" # Geek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA
0x07cc "Μ" # Geek_MU Μ GREEK CAPITAL LETTER MU
0x07cd "Ν" # Geek_NU Ν GREEK CAPITAL LETTER NU
0x07ce "Ξ" # Geek_XI Ξ GREEK CAPITAL LETTER XI
0x07cf "Ο" # Geek_OMICRON Ο GREEK CAPITAL LETTER OMICRON
0x07d0 "Π" # Geek_PI Π GREEK CAPITAL LETTER PI
0x07d1 "Ρ" # Geek_RHO Ρ GREEK CAPITAL LETTER RHO
0x07d2 "Σ" # Geek_SIGMA Σ GREEK CAPITAL LETTER SIGMA
0x07d4 "Τ" # Geek_TAU Τ GREEK CAPITAL LETTER TAU
0x07d5 "Υ" # Geek_UPSILON Υ GREEK CAPITAL LETTER UPSILON
0x07d6 "Φ" # Geek_PHI Φ GREEK CAPITAL LETTER PHI
0x07d7 "Χ" # Geek_CHI Χ GREEK CAPITAL LETTER CHI
0x07d8 "Ψ" # Geek_PSI Ψ GREEK CAPITAL LETTER PSI
0x07d9 "Ω" # Geek_OMEGA Ω GREEK CAPITAL LETTER OMEGA
0x07e1 "α" # Geek_alpha α GREEK SMALL LETTER ALPHA
0x07e2 "β" # Geek_beta β GREEK SMALL LETTER BETA
0x07e3 "γ" # Geek_gamma γ GREEK SMALL LETTER GAMMA
0x07e4 "δ" # Geek_delta δ GREEK SMALL LETTER DELTA
0x07e5 "ε" # Geek_epsilon ε GREEK SMALL LETTER EPSILON
0x07e6 "ζ" # Geek_zeta ζ GREEK SMALL LETTER ZETA
0x07e7 "η" # Geek_eta η GREEK SMALL LETTER ETA
0x07e8 "θ" # Geek_theta θ GREEK SMALL LETTER THETA
0x07e9 "ι" # Geek_iota ι GREEK SMALL LETTER IOTA
0x07ea "κ" # Geek_kappa κ GREEK SMALL LETTER KAPPA
0x07eb "λ" # Geek_lambda λ GREEK SMALL LETTER LAMDA
0x07ec "μ" # Geek_mu μ GREEK SMALL LETTER MU
0x07ed "ν" # Geek_nu ν GREEK SMALL LETTER NU
0x07ee "ξ" # Geek_xi ξ GREEK SMALL LETTER XI
0x07ef "ο" # Geek_omicron ο GREEK SMALL LETTER OMICRON
0x07f0 "π" # Geek_pi π GREEK SMALL LETTER PI
0x07f1 "ρ" # Geek_rho ρ GREEK SMALL LETTER RHO
0x07f2 "σ" # Geek_sigma σ GREEK SMALL LETTER SIGMA
0x07f3 "ς" # Geek_finalsmallsigma ς GREEK SMALL LETTER FINAL SIGMA
0x07f4 "τ" # Geek_tau τ GREEK SMALL LETTER TAU
0x07f5 "υ" # Geek_upsilon υ GREEK SMALL LETTER UPSILON
0x07f6 "φ" # Geek_phi φ GREEK SMALL LETTER PHI
0x07f7 "χ" # Geek_chi χ GREEK SMALL LETTER CHI
0x07f8 "ψ" # Geek_psi ψ GREEK SMALL LETTER PSI
0x07f9 "ω" # Geek_omega ω GREEK SMALL LETTER OMEGA
# 0x08a1 leftradical ? ???
# 0x08a2 topleftradical ? ???
# 0x08a3 horizconnector ? ???
0x08a4 "⌠" # topintegral ⌠ TOP HALF INTEGRAL
0x08a5 "⌡" # botintegral ⌡ BOTTOM HALF INTEGRAL
0x08a6 "│" # vertconnector │ BOX DRAWINGS LIGHT VERTICAL
# 0x08a7 topleftsqbracket ? ???
# 0x08a8 botleftsqbracket ? ???
# 0x08a9 toprightsqbracket ? ???
# 0x08aa botrightsqbracket ? ???
# 0x08ab topleftparens ? ???
# 0x08ac botleftparens ? ???
# 0x08ad toprightparens ? ???
# 0x08ae botrightparens ? ???
# 0x08af leftmiddlecurlybrace ? ???
# 0x08b0 rightmiddlecurlybrace ? ???
# 0x08b1 topleftsummation ? ???
# 0x08b2 botleftsummation ? ???
# 0x08b3 topvertsummationconnector ? ???
# 0x08b4 botvertsummationconnector ? ???
# 0x08b5 toprightsummation ? ???
# 0x08b6 botrightsummation ? ???
# 0x08b7 rightmiddlesummation ? ???
0x08bc "≤" # lessthanequal ≤ LESS-THAN OR EQUAL TO
0x08bd "≠" # notequal ≠ NOT EQUAL TO
0x08be "≥" # greaterthanequal ≥ GREATER-THAN OR EQUAL TO
0x08bf "∫" # integral ∫ INTEGRAL
0x08c0 "∴" # therefore ∴ THEREFORE
0x08c1 "∝" # variation ∝ PROPORTIONAL TO
0x08c2 "∞" # infinity ∞ INFINITY
0x08c5 "∇" # nabla ∇ NABLA
0x08c8 "≅" # approximate ≅ APPROXIMATELY EQUAL TO
# 0x08c9 similarequal ? ???
0x08cd "⇔" # ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW
0x08ce "⇒" # implies ⇒ RIGHTWARDS DOUBLE ARROW
0x08cf "≡" # identical ≡ IDENTICAL TO
0x08d6 "√" # radical √ SQUARE ROOT
0x08da "⊂" # includedin ⊂ SUBSET OF
0x08db "⊃" # includes ⊃ SUPERSET OF
0x08dc "∩" # intersection ∩ INTERSECTION
0x08dd "" # union UNION
0x08de "∧" # logicaland ∧ LOGICAL AND
0x08df "" # logicalor LOGICAL OR
0x08ef "∂" # partialderivative ∂ PARTIAL DIFFERENTIAL
0x08f6 "ƒ" # function ƒ LATIN SMALL LETTER F WITH HOOK
0x08fb "←" # leftarrow ← LEFTWARDS ARROW
0x08fc "↑" # uparrow ↑ UPWARDS ARROW
0x08fd "→" # rightarrow → RIGHTWARDS ARROW
0x08fe "↓" # downarrow ↓ DOWNWARDS ARROW
0x09df "␢" # blank ␢ BLANK SYMBOL
0x09e0 "◆" # soliddiamond ◆ BLACK DIAMOND
0x09e1 "▒" # checkerboard ▒ MEDIUM SHADE
0x09e2 "␉" # ht ␉ SYMBOL FOR HORIZONTAL TABULATION
0x09e3 "␌" # ff ␌ SYMBOL FOR FORM FEED
0x09e4 "␍" # cr ␍ SYMBOL FOR CARRIAGE RETURN
0x09e5 "␊" # lf ␊ SYMBOL FOR LINE FEED
0x09e8 "␤" # nl ␤ SYMBOL FOR NEWLINE
0x09e9 "␋" # vt ␋ SYMBOL FOR VERTICAL TABULATION
0x09ea "┘" # lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT
0x09eb "┐" # uprightcorner ┐ BOX DRAWINGS LIGHT DOWN AND LEFT
0x09ec "┌" # upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT
0x09ed "└" # lowleftcorner └ BOX DRAWINGS LIGHT UP AND RIGHT
0x09ee "┼" # crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
# 0x09ef horizlinescan1 ? ???
# 0x09f0 horizlinescan3 ? ???
0x09f1 "─" # horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL
# 0x09f2 horizlinescan7 ? ???
# 0x09f3 horizlinescan9 ? ???
0x09f4 "├" # leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT
0x09f5 "┤" # rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT
0x09f6 "┴" # bott ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL
0x09f7 "┬" # topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
0x09f8 "│" # vertbar │ BOX DRAWINGS LIGHT VERTICAL
0x0aa1 "" # emspace EM SPACE
0x0aa2 "" # enspace EN SPACE
0x0aa3 "" # em3space THREE-PER-EM SPACE
0x0aa4 "" # em4space FOUR-PER-EM SPACE
0x0aa5 "" # digitspace FIGURE SPACE
0x0aa6 "" # punctspace PUNCTUATION SPACE
0x0aa7 "" # thinspace THIN SPACE
0x0aa8 "" # hairspace HAIR SPACE
0x0aa9 "—" # emdash — EM DASH
0x0aaa "" # endash EN DASH
# 0x0aac signifblank ? ???
0x0aae "…" # ellipsis … HORIZONTAL ELLIPSIS
# 0x0aaf doubbaselinedot ? ???
0x0ab0 "⅓" # onethird ⅓ VULGAR FRACTION ONE THIRD
0x0ab1 "⅔" # twothirds ⅔ VULGAR FRACTION TWO THIRDS
0x0ab2 "⅕" # onefifth ⅕ VULGAR FRACTION ONE FIFTH
0x0ab3 "⅖" # twofifths ⅖ VULGAR FRACTION TWO FIFTHS
0x0ab4 "⅗" # threefifths ⅗ VULGAR FRACTION THREE FIFTHS
0x0ab5 "⅘" # fourfifths ⅘ VULGAR FRACTION FOUR FIFTHS
0x0ab6 "⅙" # onesixth ⅙ VULGAR FRACTION ONE SIXTH
0x0ab7 "⅚" # fivesixths ⅚ VULGAR FRACTION FIVE SIXTHS
0x0ab8 "℅" # careof ℅ CARE OF
0x0abb "" # figdash FIGURE DASH
0x0abc "〈" # leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET
0x0abd "." # decimalpoint . FULL STOP
0x0abe "〉" # rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET
# 0x0abf marker ? ???
0x0ac3 "⅛" # oneeighth ⅛ VULGAR FRACTION ONE EIGHTH
0x0ac4 "⅜" # threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS
0x0ac5 "⅝" # fiveeighths ⅝ VULGAR FRACTION FIVE EIGHTHS
0x0ac6 "⅞" # seveneighths ⅞ VULGAR FRACTION SEVEN EIGHTHS
0x0ac9 "™" # trademark ™ TRADE MARK SIGN
0x0aca "☓" # signaturemark ☓ SALTIRE
# 0x0acb trademarkincircle ? ???
0x0acc "◁" # leftopentriangle ◁ WHITE LEFT-POINTING TRIANGLE
0x0acd "▷" # rightopentriangle ▷ WHITE RIGHT-POINTING TRIANGLE
0x0ace "○" # emopencircle ○ WHITE CIRCLE
0x0acf "□" # emopenrectangle □ WHITE SQUARE
0x0ad0 "" # leftsinglequotemark LEFT SINGLE QUOTATION MARK
0x0ad1 "" # rightsinglequotemark RIGHT SINGLE QUOTATION MARK
0x0ad2 "“" # leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK
0x0ad3 "”" # rightdoublequotemark ” RIGHT DOUBLE QUOTATION MARK
0x0ad4 "℞" # prescription ℞ PRESCRIPTION TAKE
0x0ad6 "" # minutes PRIME
0x0ad7 "″" # seconds ″ DOUBLE PRIME
0x0ad9 "✝" # latincross ✝ LATIN CROSS
# 0x0ada hexagram ? ???
0x0adb "▬" # filledrectbullet ▬ BLACK RECTANGLE
0x0adc "◀" # filledlefttribullet ◀ BLACK LEFT-POINTING TRIANGLE
0x0add "▶" # filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE
0x0ade "●" # emfilledcircle ● BLACK CIRCLE
0x0adf "■" # emfilledrect ■ BLACK SQUARE
0x0ae0 "◦" # enopencircbullet ◦ WHITE BULLET
0x0ae1 "▫" # enopensquarebullet ▫ WHITE SMALL SQUARE
0x0ae2 "▭" # openrectbullet ▭ WHITE RECTANGLE
0x0ae3 "△" # opentribulletup △ WHITE UP-POINTING TRIANGLE
0x0ae4 "▽" # opentribulletdown ▽ WHITE DOWN-POINTING TRIANGLE
0x0ae5 "☆" # openstar ☆ WHITE STAR
0x0ae6 "•" # enfilledcircbullet • BULLET
0x0ae7 "▪" # enfilledsqbullet ▪ BLACK SMALL SQUARE
0x0ae8 "▲" # filledtribulletup ▲ BLACK UP-POINTING TRIANGLE
0x0ae9 "▼" # filledtribulletdown ▼ BLACK DOWN-POINTING TRIANGLE
0x0aea "☜" # leftpointer ☜ WHITE LEFT POINTING INDEX
0x0aeb "☞" # rightpointer ☞ WHITE RIGHT POINTING INDEX
0x0aec "♣" # club ♣ BLACK CLUB SUIT
0x0aed "♦" # diamond ♦ BLACK DIAMOND SUIT
0x0aee "♥" # heart ♥ BLACK HEART SUIT
0x0af0 "✠" # maltesecross ✠ MALTESE CROSS
0x0af1 "†" # dagger † DAGGER
0x0af2 "‡" # doubledagger ‡ DOUBLE DAGGER
0x0af3 "✓" # checkmark ✓ CHECK MARK
0x0af4 "✗" # ballotcross ✗ BALLOT X
0x0af5 "♯" # musicalsharp ♯ MUSIC SHARP SIGN
0x0af6 "♭" # musicalflat ♭ MUSIC FLAT SIGN
0x0af7 "♂" # malesymbol ♂ MALE SIGN
0x0af8 "♀" # femalesymbol ♀ FEMALE SIGN
0x0af9 "☎" # telephone ☎ BLACK TELEPHONE
0x0afa "⌕" # telephonerecorder ⌕ TELEPHONE RECORDER
0x0afb "℗" # phonographcopyright ℗ SOUND RECORDING COPYRIGHT
0x0afc "‸" # caret ‸ CARET
0x0afd "" # singlelowquotemark SINGLE LOW-9 QUOTATION MARK
0x0afe "„" # doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK
# 0x0aff cursor ? ???
0x0ba3 "<" # leftcaret < LESS-THAN SIGN
0x0ba6 ">" # rightcaret > GREATER-THAN SIGN
0x0ba8 "" # downcaret LOGICAL OR
0x0ba9 "∧" # upcaret ∧ LOGICAL AND
0x0bc0 "¯" # overbar ¯ MACRON
0x0bc2 "" # downtack DOWN TACK
0x0bc3 "∩" # upshoe ∩ INTERSECTION
0x0bc4 "⌊" # downstile ⌊ LEFT FLOOR
0x0bc6 "_" # underbar _ LOW LINE
0x0bca "∘" # jot ∘ RING OPERATOR
0x0bcc "⎕" # quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0)
0x0bce "⊥" # uptack ⊥ UP TACK
0x0bcf "○" # circle ○ WHITE CIRCLE
0x0bd3 "⌈" # upstile ⌈ LEFT CEILING
0x0bd6 "" # downshoe UNION
0x0bd8 "⊃" # rightshoe ⊃ SUPERSET OF
0x0bda "⊂" # leftshoe ⊂ SUBSET OF
0x0bdc "⊣" # lefttack ⊣ LEFT TACK
0x0bfc "⊢" # righttack ⊢ RIGHT TACK
0x0cdf "‗" # hebrew_doublelowline ‗ DOUBLE LOW LINE
0x0ce0 "א" # hebrew_aleph א HEBREW LETTER ALEF
0x0ce1 "ב" # hebrew_bet ב HEBREW LETTER BET
0x0ce2 "ג" # hebrew_gimel ג HEBREW LETTER GIMEL
0x0ce3 "ד" # hebrew_dalet ד HEBREW LETTER DALET
0x0ce4 "ה" # hebrew_he ה HEBREW LETTER HE
0x0ce5 "ו" # hebrew_waw ו HEBREW LETTER VAV
0x0ce6 "ז" # hebrew_zain ז HEBREW LETTER ZAYIN
0x0ce7 "ח" # hebrew_chet ח HEBREW LETTER HET
0x0ce8 "ט" # hebrew_tet ט HEBREW LETTER TET
0x0ce9 "י" # hebrew_yod י HEBREW LETTER YOD
0x0cea "ך" # hebrew_finalkaph ך HEBREW LETTER FINAL KAF
0x0ceb "כ" # hebrew_kaph כ HEBREW LETTER KAF
0x0cec "ל" # hebrew_lamed ל HEBREW LETTER LAMED
0x0ced "ם" # hebrew_finalmem ם HEBREW LETTER FINAL MEM
0x0cee "מ" # hebrew_mem מ HEBREW LETTER MEM
0x0cef "ן" # hebrew_finalnun ן HEBREW LETTER FINAL NUN
0x0cf0 "נ" # hebrew_nun נ HEBREW LETTER NUN
0x0cf1 "ס" # hebrew_samech ס HEBREW LETTER SAMEKH
0x0cf2 "ע" # hebrew_ayin ע HEBREW LETTER AYIN
0x0cf3 "ף" # hebrew_finalpe ף HEBREW LETTER FINAL PE
0x0cf4 "פ" # hebrew_pe פ HEBREW LETTER PE
0x0cf5 "ץ" # hebrew_finalzade ץ HEBREW LETTER FINAL TSADI
0x0cf6 "צ" # hebrew_zade צ HEBREW LETTER TSADI
0x0cf7 "ק" # hebrew_qoph ק HEBREW LETTER QOF
0x0cf8 "ר" # hebrew_resh ר HEBREW LETTER RESH
0x0cf9 "ש" # hebrew_shin ש HEBREW LETTER SHIN
0x0cfa "ת" # hebrew_taw ת HEBREW LETTER TAV
0x0da1 "ก" # Thai_kokai ก THAI CHARACTER KO KAI
0x0da2 "ข" # Thai_khokhai ข THAI CHARACTER KHO KHAI
0x0da3 "ฃ" # Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT
0x0da4 "ค" # Thai_khokhwai ค THAI CHARACTER KHO KHWAI
0x0da5 "ฅ" # Thai_khokhon ฅ THAI CHARACTER KHO KHON
0x0da6 "ฆ" # Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG
0x0da7 "ง" # Thai_ngongu ง THAI CHARACTER NGO NGU
0x0da8 "จ" # Thai_chochan จ THAI CHARACTER CHO CHAN
0x0da9 "ฉ" # Thai_choching ฉ THAI CHARACTER CHO CHING
0x0daa "ช" # Thai_chochang ช THAI CHARACTER CHO CHANG
0x0dab "ซ" # Thai_soso ซ THAI CHARACTER SO SO
0x0dac "ฌ" # Thai_chochoe ฌ THAI CHARACTER CHO CHOE
0x0dad "ญ" # Thai_yoying ญ THAI CHARACTER YO YING
0x0dae "ฎ" # Thai_dochada ฎ THAI CHARACTER DO CHADA
0x0daf "ฏ" # Thai_topatak ฏ THAI CHARACTER TO PATAK
0x0db0 "ฐ" # Thai_thothan ฐ THAI CHARACTER THO THAN
0x0db1 "ฑ" # Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO
0x0db2 "ฒ" # Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO
0x0db3 "ณ" # Thai_nonen ณ THAI CHARACTER NO NEN
0x0db4 "ด" # Thai_dodek ด THAI CHARACTER DO DEK
0x0db5 "ต" # Thai_totao ต THAI CHARACTER TO TAO
0x0db6 "ถ" # Thai_thothung ถ THAI CHARACTER THO THUNG
0x0db7 "ท" # Thai_thothahan ท THAI CHARACTER THO THAHAN
0x0db8 "ธ" # Thai_thothong ธ THAI CHARACTER THO THONG
0x0db9 "น" # Thai_nonu น THAI CHARACTER NO NU
0x0dba "บ" # Thai_bobaimai บ THAI CHARACTER BO BAIMAI
0x0dbb "ป" # Thai_popla ป THAI CHARACTER PO PLA
0x0dbc "ผ" # Thai_phophung ผ THAI CHARACTER PHO PHUNG
0x0dbd "ฝ" # Thai_fofa ฝ THAI CHARACTER FO FA
0x0dbe "พ" # Thai_phophan พ THAI CHARACTER PHO PHAN
0x0dbf "ฟ" # Thai_fofan ฟ THAI CHARACTER FO FAN
0x0dc0 "ภ" # Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO
0x0dc1 "ม" # Thai_moma ม THAI CHARACTER MO MA
0x0dc2 "ย" # Thai_yoyak ย THAI CHARACTER YO YAK
0x0dc3 "ร" # Thai_rorua ร THAI CHARACTER RO RUA
0x0dc4 "ฤ" # Thai_ru ฤ THAI CHARACTER RU
0x0dc5 "ล" # Thai_loling ล THAI CHARACTER LO LING
0x0dc6 "ฦ" # Thai_lu ฦ THAI CHARACTER LU
0x0dc7 "ว" # Thai_wowaen ว THAI CHARACTER WO WAEN
0x0dc8 "ศ" # Thai_sosala ศ THAI CHARACTER SO SALA
0x0dc9 "ษ" # Thai_sorusi ษ THAI CHARACTER SO RUSI
0x0dca "ส" # Thai_sosua ส THAI CHARACTER SO SUA
0x0dcb "ห" # Thai_hohip ห THAI CHARACTER HO HIP
0x0dcc "ฬ" # Thai_lochula ฬ THAI CHARACTER LO CHULA
0x0dcd "อ" # Thai_oang อ THAI CHARACTER O ANG
0x0dce "ฮ" # Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK
0x0dcf "ฯ" # Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI
0x0dd0 "ะ" # Thai_saraa ะ THAI CHARACTER SARA A
0x0dd1 "ั" # Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT
0x0dd2 "า" # Thai_saraaa า THAI CHARACTER SARA AA
0x0dd3 "ำ" # Thai_saraam ำ THAI CHARACTER SARA AM
0x0dd4 "ิ" # Thai_sarai ิ THAI CHARACTER SARA I
0x0dd5 "ี" # Thai_saraii ี THAI CHARACTER SARA II
0x0dd6 "ึ" # Thai_saraue ึ THAI CHARACTER SARA UE
0x0dd7 "ื" # Thai_sarauee ื THAI CHARACTER SARA UEE
0x0dd8 "ุ" # Thai_sarau ุ THAI CHARACTER SARA U
0x0dd9 "ู" # Thai_sarauu ู THAI CHARACTER SARA UU
0x0dda "ฺ" # Thai_phinthu ฺ THAI CHARACTER PHINTHU
0x0dde "฾" # Thai_maihanakat_maitho ฾ ???
0x0ddf "฿" # Thai_baht ฿ THAI CURRENCY SYMBOL BAHT
0x0de0 "เ" # Thai_sarae เ THAI CHARACTER SARA E
0x0de1 "แ" # Thai_saraae แ THAI CHARACTER SARA AE
0x0de2 "โ" # Thai_sarao โ THAI CHARACTER SARA O
0x0de3 "ใ" # Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN
0x0de4 "ไ" # Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI
0x0de5 "ๅ" # Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO
0x0de6 "ๆ" # Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK
0x0de7 "็" # Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU
0x0de8 "่" # Thai_maiek ่ THAI CHARACTER MAI EK
0x0de9 "้" # Thai_maitho ้ THAI CHARACTER MAI THO
0x0dea "๊" # Thai_maitri ๊ THAI CHARACTER MAI TRI
0x0deb "๋" # Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA
0x0dec "์" # Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT
0x0ded "ํ" # Thai_nikhahit ํ THAI CHARACTER NIKHAHIT
0x0df0 "" # Thai_leksun THAI DIGIT ZERO
0x0df1 "๑" # Thai_leknung ๑ THAI DIGIT ONE
0x0df2 "๒" # Thai_leksong ๒ THAI DIGIT TWO
0x0df3 "๓" # Thai_leksam ๓ THAI DIGIT THREE
0x0df4 "๔" # Thai_leksi ๔ THAI DIGIT FOUR
0x0df5 "๕" # Thai_lekha ๕ THAI DIGIT FIVE
0x0df6 "๖" # Thai_lekhok ๖ THAI DIGIT SIX
0x0df7 "๗" # Thai_lekchet ๗ THAI DIGIT SEVEN
0x0df8 "๘" # Thai_lekpaet ๘ THAI DIGIT EIGHT
0x0df9 "๙" # Thai_lekkao ๙ THAI DIGIT NINE
0x0ea1 "ㄱ" # Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK
0x0ea2 "ㄲ" # Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK
0x0ea3 "ㄳ" # Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS
0x0ea4 "ㄴ" # Hangul_Nieun ㄴ HANGUL LETTER NIEUN
0x0ea5 "ㄵ" # Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC
0x0ea6 "ㄶ" # Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH
0x0ea7 "ㄷ" # Hangul_Dikeud ㄷ HANGUL LETTER TIKEUT
0x0ea8 "ㄸ" # Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT
0x0ea9 "ㄹ" # Hangul_Rieul ㄹ HANGUL LETTER RIEUL
0x0eaa "ㄺ" # Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK
0x0eab "ㄻ" # Hangul_RieulMieum ㄻ HANGUL LETTER RIEUL-MIEUM
0x0eac "ㄼ" # Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP
0x0ead "ㄽ" # Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS
0x0eae "ㄾ" # Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH
0x0eaf "ㄿ" # Hangul_RieulPhieuf ㄿ HANGUL LETTER RIEUL-PHIEUPH
0x0eb0 "ㅀ" # Hangul_RieulHieuh ㅀ HANGUL LETTER RIEUL-HIEUH
0x0eb1 "ㅁ" # Hangul_Mieum ㅁ HANGUL LETTER MIEUM
0x0eb2 "ㅂ" # Hangul_Pieub ㅂ HANGUL LETTER PIEUP
0x0eb3 "ㅃ" # Hangul_SsangPieub ㅃ HANGUL LETTER SSANGPIEUP
0x0eb4 "ㅄ" # Hangul_PieubSios ㅄ HANGUL LETTER PIEUP-SIOS
0x0eb5 "ㅅ" # Hangul_Sios ㅅ HANGUL LETTER SIOS
0x0eb6 "ㅆ" # Hangul_SsangSios ㅆ HANGUL LETTER SSANGSIOS
0x0eb7 "ㅇ" # Hangul_Ieung ㅇ HANGUL LETTER IEUNG
0x0eb8 "ㅈ" # Hangul_Jieuj ㅈ HANGUL LETTER CIEUC
0x0eb9 "ㅉ" # Hangul_SsangJieuj ㅉ HANGUL LETTER SSANGCIEUC
0x0eba "ㅊ" # Hangul_Cieuc ㅊ HANGUL LETTER CHIEUCH
0x0ebb "ㅋ" # Hangul_Khieuq ㅋ HANGUL LETTER KHIEUKH
0x0ebc "ㅌ" # Hangul_Tieut ㅌ HANGUL LETTER THIEUTH
0x0ebd "ㅍ" # Hangul_Phieuf ㅍ HANGUL LETTER PHIEUPH
0x0ebe "ㅎ" # Hangul_Hieuh ㅎ HANGUL LETTER HIEUH
0x0ebf "ㅏ" # Hangul_A ㅏ HANGUL LETTER A
0x0ec0 "ㅐ" # Hangul_AE ㅐ HANGUL LETTER AE
0x0ec1 "ㅑ" # Hangul_YA ㅑ HANGUL LETTER YA
0x0ec2 "ㅒ" # Hangul_YAE ㅒ HANGUL LETTER YAE
0x0ec3 "ㅓ" # Hangul_EO ㅓ HANGUL LETTER EO
0x0ec4 "ㅔ" # Hangul_E ㅔ HANGUL LETTER E
0x0ec5 "ㅕ" # Hangul_YEO ㅕ HANGUL LETTER YEO
0x0ec6 "ㅖ" # Hangul_YE ㅖ HANGUL LETTER YE
0x0ec7 "ㅗ" # Hangul_O ㅗ HANGUL LETTER O
0x0ec8 "ㅘ" # Hangul_WA ㅘ HANGUL LETTER WA
0x0ec9 "ㅙ" # Hangul_WAE ㅙ HANGUL LETTER WAE
0x0eca "ㅚ" # Hangul_OE ㅚ HANGUL LETTER OE
0x0ecb "ㅛ" # Hangul_YO ㅛ HANGUL LETTER YO
0x0ecc "ㅜ" # Hangul_U ㅜ HANGUL LETTER U
0x0ecd "ㅝ" # Hangul_WEO ㅝ HANGUL LETTER WEO
0x0ece "ㅞ" # Hangul_WE ㅞ HANGUL LETTER WE
0x0ecf "ㅟ" # Hangul_WI ㅟ HANGUL LETTER WI
0x0ed0 "ㅠ" # Hangul_YU ㅠ HANGUL LETTER YU
0x0ed1 "ㅡ" # Hangul_EU ㅡ HANGUL LETTER EU
0x0ed2 "ㅢ" # Hangul_YI ㅢ HANGUL LETTER YI
0x0ed3 "ㅣ" # Hangul_I ㅣ HANGUL LETTER I
0x0ed4 "ᆨ" # Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK
0x0ed5 "ᆩ" # Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK
0x0ed6 "ᆪ" # Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS
0x0ed7 "ᆫ" # Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN
0x0ed8 "ᆬ" # Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC
0x0ed9 "ᆭ" # Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH
0x0eda "ᆮ" # Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT
0x0edb "ᆯ" # Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL
0x0edc "ᆰ" # Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK
0x0edd "ᆱ" # Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM
0x0ede "ᆲ" # Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP
0x0edf "ᆳ" # Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS
0x0ee0 "ᆴ" # Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH
0x0ee1 "ᆵ" # Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH
0x0ee2 "ᆶ" # Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH
0x0ee3 "ᆷ" # Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM
0x0ee4 "ᆸ" # Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP
0x0ee5 "ᆹ" # Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS
0x0ee6 "ᆺ" # Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS
0x0ee7 "ᆻ" # Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS
0x0ee8 "ᆼ" # Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG
0x0ee9 "ᆽ" # Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC
0x0eea "ᆾ" # Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH
0x0eeb "ᆿ" # Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH
0x0eec "ᇀ" # Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH
0x0eed "ᇁ" # Hangul_J_Phieuf ᇁ HANGUL JONGSEONG PHIEUPH
0x0eee "ᇂ" # Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH
0x0eef "ㅭ" # Hangul_RieulYeorinHieuh ㅭ HANGUL LETTER RIEUL-YEORINHIEUH
0x0ef0 "ㅱ" # Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM
0x0ef1 "ㅸ" # Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP
0x0ef2 "ㅿ" # Hangul_PanSios ㅿ HANGUL LETTER PANSIOS
# 0x0ef3 Hangul_KkogjiDalrinIeung ? ???
0x0ef4 "ㆄ" # Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH
0x0ef5 "ㆆ" # Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH
0x0ef6 "ㆍ" # Hangul_AraeA ㆍ HANGUL LETTER ARAEA
0x0ef7 "ㆎ" # Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE
0x0ef8 "ᇫ" # Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS
# 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ???
0x0efa "ᇹ" # Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH
0x0eff "₩" # Korean_Won ₩ WON SIGN
0x13bc "Œ" # OE Œ LATIN CAPITAL LIGATURE OE
0x13bd "œ" # oe œ LATIN SMALL LIGATURE OE
0x13be "Ÿ" # Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS
0x20a0 "₠" # EcuSign ₠ EURO-CURRENCY SIGN
0x20a1 "₡" # ColonSign ₡ COLON SIGN
0x20a2 "₢" # CruzeiroSign ₢ CRUZEIRO SIGN
0x20a3 "₣" # FFrancSign ₣ FRENCH FRANC SIGN
0x20a4 "₤" # LiraSign ₤ LIRA SIGN
0x20a5 "₥" # MillSign ₥ MILL SIGN
0x20a6 "₦" # NairaSign ₦ NAIRA SIGN
0x20a7 "₧" # PesetaSign ₧ PESETA SIGN
0x20a8 "₨" # RupeeSign ₨ RUPEE SIGN
0x20a9 "₩" # WonSign ₩ WON SIGN
0x20aa "₪" # NewSheqelSign ₪ NEW SHEQEL SIGN
0x20ab "₫" # DongSign ₫ DONG SIGN
0x20ac "€" # EuroSign € EURO SIGN
# Following items added to GTK, not in the xterm table
# Numeric keypad
# 0xFF80 # Space *
0xFFAA "*" # Multiply *
0xFFAB "+" # Add *
0xFFAC "," # Separator *
0xFFAD "-" # Subtract *
0xFFAE "." # Decimal *
0xFFAF "/" # Divide *
0xFFB0 "0" # 0 *
0xFFB1 "1" # 1 *
0xFFB2 "2" # 2 *
0xFFB3 "3" # 3 *
0xFFB4 "4" # 4 *
0xFFB5 "5" # 5 *
0xFFB6 "6" # 6 *
0xFFB7 "7" # 7 *
0xFFB8 "8" # 8 *
0xFFB9 "9" # 9 *
0xFFBD "=" # Equal *
# End numeric keypad

21
examples/Makefile.am Normal file
View File

@ -0,0 +1,21 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
noinst_PROGRAMS = eek-clutter-xkb-test
eek_clutter_xkb_test_CFLAGS = -I$(top_srcdir) $(GOBJECT2_CFLAGS) $(CLUTTER_CFLAGS) $(XKB_CFLAGS)
eek_clutter_xkb_test_LDFLAGS = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkb.la $(top_builddir)/eek/libeek-clutter.la $(GOBJECT2_LIBS) $(CLUTTER_LIBS) $(XKB_LIBS)

View File

@ -0,0 +1,149 @@
#include "eek/eek-clutter.h"
#include "eek/eek-xkb.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define CSW 640
#define CSH 480
static gchar *symbols = NULL;
static gchar *keycodes = NULL;
static gchar *geometry = NULL;
static const GOptionEntry options[] = {
{"symbols", '\0', 0, G_OPTION_ARG_STRING, &symbols,
"Symbols component of the keyboard. If you omit this option, it is "
"obtained from the X server; that is, the keyboard that is currently "
"configured is drawn. Examples: --symbols=us or "
"--symbols=us(pc104)+iso9995-3+group(switch)+ctrl(nocaps)", NULL},
{"keycodes", '\0', 0, G_OPTION_ARG_STRING, &keycodes,
"Keycodes component of the keyboard. If you omit this option, it is "
"obtained from the X server; that is, the keyboard that is currently"
" configured is drawn. Examples: --keycodes=xfree86+aliases(qwerty)",
NULL},
{"geometry", '\0', 0, G_OPTION_ARG_STRING, &geometry,
"Geometry xkb component. If you omit this option, it is obtained from the"
" X server; that is, the keyboard that is currently configured is drawn. "
"Example: --geometry=kinesis", NULL},
{NULL},
};
gfloat stage_width, stage_height;
static gboolean
on_event (ClutterStage *stage,
ClutterEvent *event,
gpointer user_data)
{
if (event->type == CLUTTER_BUTTON_PRESS) {
ClutterActor *actor = clutter_event_get_source (event);
if (EEK_IS_KEY(actor)) {
guint keysym;
const gchar *label = NULL;
keysym = eek_key_get_keysym (EEK_KEY(actor));
if (keysym != EEK_INVALID_KEYSYM)
label = eek_keysym_to_string (keysym);
if (label) {
printf ("%s", label);
fflush (stdout);
}
}
return TRUE;
}
return FALSE;
}
static void
on_resize (GObject *object,
GParamSpec *param_spec,
gpointer user_data)
{
GValue value = {0};
gfloat width, height, scale;
ClutterActor *stage = CLUTTER_ACTOR(object);
g_object_get (G_OBJECT(stage), "width", &width, NULL);
g_object_get (G_OBJECT(stage), "height", &height, NULL);
g_value_init (&value, G_TYPE_DOUBLE);
scale = width > height ? width / stage_width : width / stage_height;
g_value_set_double (&value, scale);
g_object_set_property (G_OBJECT (stage),
"scale-x",
&value);
g_value_set_double (&value, scale);
g_object_set_property (G_OBJECT (stage),
"scale-y",
&value);
}
int
main (int argc, char *argv[])
{
EekKeyboard *keyboard;
EekLayout *layout;
ClutterActor *stage;
ClutterColor stage_color = { 0xff, 0xff, 0xff, 0xff };
GOptionContext *context;
context = g_option_context_new ("test-xkb-clutter");
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
clutter_init (&argc, &argv);
gtk_init (&argc, &argv);
layout = eek_xkb_layout_new (keycodes, geometry, symbols);
if (layout == NULL) {
fprintf (stderr, "Failed to create layout\n");
exit(1);
}
g_object_ref_sink (layout);
keyboard = eek_clutter_keyboard_new (CSW, CSH);
if (keyboard == NULL) {
fprintf (stderr, "Failed to create keyboard\n");
exit(1);
}
g_object_ref_sink (keyboard);
eek_keyboard_set_layout (keyboard, layout);
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
clutter_actor_get_size (CLUTTER_ACTOR(keyboard), &stage_width, &stage_height);
clutter_actor_set_size (stage, stage_width, stage_height);
clutter_group_add (CLUTTER_GROUP(stage), CLUTTER_ACTOR(keyboard));
clutter_actor_show_all (stage);
g_signal_connect (stage,
"notify::width",
G_CALLBACK (on_resize),
NULL);
g_signal_connect (stage,
"notify::height",
G_CALLBACK (on_resize),
NULL);
g_signal_connect (stage,
"event",
G_CALLBACK (on_event),
NULL);
clutter_main ();
return 0;
}

28
tests/Makefile.am Normal file
View File

@ -0,0 +1,28 @@
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010 Red Hat, 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 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
INCLUDES = -I$(top_srcdir) $(GOBJECT2_CFLAGS) $(SIMPLE_CFLAGS) $(XKB_CFLAGS)
TESTS = eek-simple-test eek-xkb-test
noinst_PROGRAMS = $(TESTS)
eek_simple_test_SOURCES = eek-simple-test.c
eek_simple_test_LDADD = $(top_builddir)/eek/libeek.la
eek_xkb_test_SOURCES = eek-xkb-test.c
eek_xkb_test_LDADD = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkb.la

97
tests/eek-simple-test.c Normal file
View File

@ -0,0 +1,97 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 "eek-simple-keyboard.h"
static void
test_create (void)
{
EekKeyboard *keyboard;
EekSection *section;
EekKey *key;
EekOutline outline = {45.0, NULL, 0};
EekBounds bounds = {0.1, 0.2, 3.0, 4.0};
EekKeysymMatrix *matrix;
GValue value = {0};
gint iv;
const gchar *sv;
gpointer bv;
guint keysyms[] = {'a', 'b', 'c', 'd', 'e', 'f'};
keyboard = eek_simple_keyboard_new ();
g_assert (keyboard);
g_assert (g_object_is_floating (keyboard));
section = eek_keyboard_create_section (keyboard,
"test-section",
45,
&bounds);
g_assert (section);
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT(section), "name", &value);
sv = g_value_get_string (&value);
g_assert_cmpstr (sv, ==, "test-section");
g_value_unset (&value);
g_value_init (&value, G_TYPE_INT);
g_object_get_property (G_OBJECT(section), "angle", &value);
iv = g_value_get_int (&value);
g_assert_cmpint (iv, ==, 45);
g_value_unset (&value);
g_value_init (&value, EEK_TYPE_BOUNDS);
g_object_get_property (G_OBJECT(section), "bounds", &value);
bv = g_value_get_boxed (&value);
g_assert (bv);
g_assert_cmpfloat (((EekBounds *)bv)->x, ==, 0.1);
g_value_unset (&value);
key = eek_section_create_key (section,
"test-key",
keysyms,
3,
2,
1,
2,
&outline,
&bounds);
g_assert (key);
g_value_init (&value, EEK_TYPE_KEYSYM_MATRIX);
g_object_get_property (G_OBJECT(key), "keysyms", &value);
matrix = g_value_get_boxed (&value);
g_assert_cmpint (matrix->data[0], ==, 'a');
g_value_unset (&value);
g_value_init (&value, G_TYPE_POINTER);
g_object_get_property (G_OBJECT(key), "outline", &value);
bv = g_value_get_pointer (&value);
g_assert (bv == &outline);
g_value_unset (&value);
g_object_unref (keyboard);
}
int
main (int argc, char **argv)
{
g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/eek-simple-test/create", test_create);
return g_test_run ();
}

50
tests/eek-xkb-test.c Normal file
View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, 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 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 "eek-xkb.h"
static void
test_create (void)
{
EekLayout *layout;
const gchar *keycodes, *geometry, *symbols;
layout = eek_xkb_layout_new (NULL, "winbook", NULL);
g_assert (layout);
keycodes = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(layout));
g_assert (keycodes);
geometry = eek_xkb_layout_get_geometry (EEK_XKB_LAYOUT(layout));
g_assert (geometry);
symbols = eek_xkb_layout_get_symbols (EEK_XKB_LAYOUT(layout));
g_assert (symbols);
eek_xkb_layout_set_geometry (EEK_XKB_LAYOUT(layout), "winbook");
geometry = eek_xkb_layout_get_geometry (EEK_XKB_LAYOUT(layout));
g_assert_cmpstr (geometry, ==, "winbook");
g_object_unref (layout);
}
int
main (int argc, char **argv)
{
g_type_init ();
g_test_init (&argc, &argv, NULL);
gtk_init (&argc, &argv);
g_test_add_func ("/eek-xkb-test/create", test_create);
return g_test_run ();
}