Compare commits

...

49 Commits

Author SHA1 Message Date
2211fb6b1e 0.90.7 released. 2011-04-22 15:12:05 +09:00
34569679f0 Ignore some files. 2011-04-22 14:44:44 +09:00
816e1f0d51 Fix Clutter build. 2011-04-22 14:41:36 +09:00
de62d74ac5 Fix GTK-DOC comments. 2011-04-22 14:41:29 +09:00
d71c79f268 Fix glib-mkenums error. 2011-04-21 16:24:19 +09:00
ee948cb2ae Update dependencies. 2011-04-19 15:44:12 +09:00
ba59a850d1 Fix compilation error when --disable-atspi. 2011-04-19 15:43:02 +09:00
b7999842a9 Display more information about build. 2011-04-19 15:41:15 +09:00
2dd0ae47db Add autostart desktop file. 2011-04-19 15:41:07 +09:00
926d9346e1 Use at-spi2 instead of at-spi1. 2011-04-19 15:12:01 +09:00
ac8764b9b7 Fix compiler warnings. 2011-04-19 11:56:00 +09:00
4cf3f24fbc Don't check GConf2 if CSPI-1.0 is disabled; disable CSPI-1.0 by default. 2011-04-19 11:29:58 +09:00
0691766a31 Don't include cspi/spi.h if CSPI-1.0 is disabled. 2011-04-19 10:20:37 +09:00
77c00a10da Replace the eekboard-desktop-client reference in desktop file with "eekboard".
https://bugzilla.redhat.com/show_bug.cgi?id=696523
2011-04-14 18:38:46 +09:00
8c407ae482 Use G_DEFINE_BOXED_TYPE. 2011-04-12 11:09:28 +09:00
8d2d612547 Use us-qwerty keyboard by default. 2011-03-28 14:48:07 +09:00
80dc26b7f4 Fix make distcheck. 2011-03-23 18:53:44 +09:00
fbe7b9ec1a Hard-code dynamic modifier masks for XML layout. 2011-03-23 17:59:43 +09:00
048fccd6e0 Use GEnumTypes. 2011-03-23 17:25:29 +09:00
638d41e0b6 Check keycode before passing it to fakekey_send_keyevent(). 2011-03-23 14:49:33 +09:00
4271eb6b3e Pick keyboard file in $(keyboarddir). 2011-03-22 18:23:04 +09:00
d25bfd8ba7 Update README. 2011-03-12 07:19:05 +09:00
0739fbf464 Fix packaging mistake of *.desktop file. 2011-03-11 18:17:41 +09:00
d1b38f8eb2 0.90.6 released. 2011-03-11 18:05:41 +09:00
e6d17fa4cb Fix the last commit. 2011-03-11 17:39:55 +09:00
d62b8b49a2 Fix the last commit. 2011-03-11 17:18:29 +09:00
149dd7dc8b Ignore some files. 2011-03-11 14:26:57 +09:00
0177f96795 Move eekboard-client from src to examples; rename eekboard-desktop-client to eekboard. 2011-03-11 14:25:48 +09:00
ec56773dc6 Don't hardcode gtk.main_quit() in inscript.py. 2011-03-11 13:24:22 +09:00
881bf34ec4 Handle the case when both shift and altgr keys are pressed. 2011-03-11 13:11:05 +09:00
6787308061 Set label/category anyway if inscript key cannot convert to keyval. 2011-03-11 12:53:54 +09:00
0cd01bf165 Fix make distcheck. 2011-03-11 12:53:35 +09:00
132ae3899f Terminate eekboard-inscript when the window is closed. 2011-03-11 12:06:07 +09:00
72f84fa4ef Export EekSymbolCategory in python binding. 2011-03-11 12:06:00 +09:00
16d81f3f71 Generate inscript keyboard on-the-fly. 2011-03-11 11:38:53 +09:00
42a0ea148b Handle "destroyed" signal in eekboard-inscript. 2011-03-10 19:38:42 +09:00
2021311a4e Add destroyed signal in python binding. 2011-03-10 19:37:30 +09:00
b64e91dffa Latch modifiers in eekboard-inscript. 2011-03-10 19:18:56 +09:00
57bb7030fb Fix toggle English feature. 2011-03-10 18:54:53 +09:00
425fe7829b Add toggle English. 2011-03-10 18:43:24 +09:00
aa88315924 Set AltGr mask in python binding. 2011-03-10 18:24:09 +09:00
39a59fb049 Serialize alt_gr_mask. 2011-03-10 18:23:49 +09:00
e0993a5e55 Add eekboard-inscript. 2011-03-10 18:14:06 +09:00
4eb59ba7ed Display client name as window title. 2011-03-10 18:11:48 +09:00
cc9fb31e61 Add examples. 2011-03-10 17:17:37 +09:00
c44ebecfb2 Improve font size computation. 2011-03-10 17:16:31 +09:00
f60e1d763e Move EekSymbolMatrix code from eek-types.[ch] to eek-symbol-matrix.[ch]. 2011-03-09 11:57:02 +09:00
5c3cb477ef Let PopContext return error if the current context is not owned by the client. 2011-03-08 19:00:04 +09:00
5fd4005967 Add transfer mode annotation for eekboard_eekboard_create_context(). 2011-03-08 14:39:41 +09:00
55 changed files with 2474 additions and 922 deletions

11
.gitignore vendored
View File

@ -33,6 +33,7 @@ gtk-doc.make
eek/eek-special-keysym-entries.h
eek/eek-unicode-keysym-entries.h
eek/eek-xkeysym-keysym-entries.h
eek/eek-enumtypes.[ch]
eek/eek-marshalers.[ch]
eek/*.pc
eek/*.gir
@ -43,12 +44,13 @@ eekboard/*.typelib
tests/eek-simple-test
tests/eek-xkb-test
tests/eek-xml-test
src/eekboard
src/eekboard-server
src/eekboard-client
src/eekboard-system-client
src/eekboard-xml
src/eekboard-server.service
docs/reference/eek/*.stamp
docs/reference/eek/*.txt
docs/reference/eek/eek.types
!/docs/reference/eek/eek-sections.txt
docs/reference/eek/xml
docs/reference/eek/html
@ -71,4 +73,9 @@ po/*.gmo
po/Makefile.in.in
po/POTFILES
po/stamp-it
po/.intltool-merge-cache
bindings/vala/*.vapi
py-compile
data/*.desktop
examples/eekboard-inscript/eekboard-inscript
examples/simple-client/simple-client

View File

@ -17,5 +17,5 @@
# 02110-1301 USA
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = eek eekboard src tests bindings docs po data
SUBDIRS = eek eekboard src tests bindings docs po data examples
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection

45
README
View File

@ -7,8 +7,8 @@ tools to implement desktop virtual keyboards.
** Dependencies
REQUIRED: GLib2, GTK, GConf2, PangoCairo, libxklavier, libcroco
OPTIONAL: fakekey, CSPI, Clutter, Clutter-Gtk, Vala, gobject-introspection
REQUIRED: GLib2, GTK, PangoCairo, libxklavier, libcroco
OPTIONAL: fakekey, at-spi2-core, Clutter, Clutter-Gtk, Python, Vala, gobject-introspection
** Build from git repo
@ -24,9 +24,9 @@ OPTIONAL: fakekey, CSPI, Clutter, Clutter-Gtk, Vala, gobject-introspection
$ make
$ sudo make install
* How to test
* Using command-line tools
eekboard currently includes 4 tools to implement your own virtual
eekboard currently includes 3 tools to implement your own virtual
keyboard.
** eekboard-server
@ -38,19 +38,24 @@ do that with:
$ eekboard-server &
** eekboard-desktop-client
** eekboard
eekboard-desktop-client is a client of eekboard-server. It listens
desktop events (keyboard change, focus in/out, and keystroke) and
generates key events when some keys are pressed on the on-screen
keyboard. It can be started with:
eekboard is a client of eekboard-server. It listens desktop events
(keyboard change, focus in/out, and keystroke) and generates key
events when some keys are pressed on the on-screen keyboard. It can
be started with:
$ eekboard-desktop-client
$ eekboard
By default it renders current system keyboard layout. To read custom
keyboard layout, specify --keyboard option like:
$ eekboard --keyboard /usr/share/eekboard/keyboards/us-qwerty.xml
** eekboard-xml
eekboard-xml is a tool to manipulate XML keyboard description used by
eekboard-client tool and in the eekboard library.
eekboard-xml is a tool to manipulate XML keyboard description read by
eekboard if --keyboard option is specified.
To dump the current system keyboard layout into an XML file:
@ -60,16 +65,14 @@ You can display the dumped layout with:
$ eekboard-xml --load keyboard.xml
** eekboard-client
* Using library
eekboard-client is a simple test client of eekboard-server. To upload
the keyboard description to the server, display it, and listen
key events.
eekboard currently includes two libraries. One is to access
eekboard-server via D-Bus and another is to manually render on-screen
keyboards.
$ eekboard-client --set-keyboard keyboard.xml --show-keyboard --listen
KeyPressed XXXXX
KeyReleased XXXXX
* Documentation
For the former, see
file:docs/reference/eekboard/html/index.html
For the latter, see
See file:docs/reference/eek/html/index.html

View File

@ -25,6 +25,7 @@ Section = Eek.Section
Key = Eek.Key
Symbol = Eek.Symbol
Keysym = Eek.Keysym
SymbolMatrix = Eek.SymbolMatrix
MODIFIER_BEHAVIOR_NONE, \
MODIFIER_BEHAVIOR_LOCK, \
@ -33,6 +34,8 @@ MODIFIER_BEHAVIOR_LATCH = \
Eek.ModifierBehavior.LOCK,
Eek.ModifierBehavior.LATCH)
SymbolCategory = Eek.SymbolCategory
CSW = 640
CSH = 480
@ -41,6 +44,7 @@ def XmlKeyboard(path, modifier_behavior=MODIFIER_BEHAVIOR_NONE):
layout = Eek.XmlLayout.new(_file.read())
keyboard = Eek.Keyboard.new(layout, CSW, CSH)
keyboard.set_modifier_behavior(modifier_behavior)
keyboard.set_alt_gr_mask(Eek.ModifierType.MOD5_MASK)
return keyboard
def XklKeyboard(modifier_behavior=MODIFIER_BEHAVIOR_NONE):

View File

@ -36,17 +36,38 @@ class Context(gobject.GObject):
'key-released': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_UINT,))
(gobject.TYPE_UINT,)),
'destroyed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
}
__gproperties__ = {
'keyboard-visible': (bool, None, None, False, gobject.PARAM_READWRITE),
}
def __init__(self, giobject):
super(Context, self).__init__()
import sys
self.__properties = dict()
self.__giobject = giobject
self.__giobject.connect('enabled', lambda *args: self.emit('enabled'))
self.__giobject.connect('disabled', lambda *args: self.emit('disabled'))
self.__giobject.connect('key-pressed', lambda *args: self.emit('key-pressed', args[1]))
self.__giobject.connect('key-released', lambda *args: self.emit('key-released', args[1]))
self.__giobject.connect('destroyed', lambda *args: self.emit('destroyed'))
self.__giobject.connect('notify::keyboard-visible', self.__notify_keyboard_visible_cb)
def do_set_property(self, pspec, value):
self.__properties[pspec.name] = value
def do_get_property(self, pspec):
return self.__properties[pspec.name]
def __notify_keyboard_visible_cb(self, *args):
self.set_property('keyboard-visible',
self.__giobject.get_property(args[1].name))
self.notify('keyboard-visible')
def get_giobject(self):
return self.__giobject

View File

@ -22,11 +22,18 @@ from context import Context
class Eekboard(gobject.GObject):
__gtype_name__ = "PYEekboardEekboard"
__gsignals__ = {
'destroyed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
())
}
def __init__(self):
super(Eekboard, self).__init__()
self.__connection = Gio.bus_get_sync(Gio.BusType.SESSION, None)
self.__eekboard = gi.repository.Eekboard.Eekboard.new(self.__connection, None);
self.__eekboard.connect('destroyed', lambda *args: self.emit('destroyed'))
def create_context(self, client_name):
context = self.__eekboard.create_context(client_name, None)

View File

@ -20,7 +20,7 @@ AC_PREREQ(2.63)
dnl AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_INIT([eekboard], [0.90.4], [ueno@unixuser.org])
AC_INIT([eekboard], [0.90.7], [ueno@unixuser.org])
dnl Init automake
AM_INIT_AUTOMAKE
@ -85,7 +85,7 @@ AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
AM_PATH_GLIB_2_0
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.25.4], ,
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.26.0], ,
[AC_MSG_ERROR([GLib2 not found])])
PKG_CHECK_MODULES([GIO2], [gio-2.0], ,
[AC_MSG_ERROR([Gio2 not found])])
@ -95,8 +95,6 @@ PKG_CHECK_MODULES([GTK], [
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
gdk-$GTK_API_VERSION >= $GTK_REQUIRED], ,
[AC_MSG_ERROR([GTK not found])])
PKG_CHECK_MODULES([GCONF2], [gconf-2.0], ,
[AC_MSG_ERROR([GConf not found])])
PKG_CHECK_MODULES([XKB], [x11], ,
[AC_MSG_ERROR([XKB support not found])])
PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier x11], ,
@ -119,20 +117,20 @@ fi
AM_CONDITIONAL(ENABLE_FAKEKEY, [test x$enable_fakekey = xyes])
AC_MSG_RESULT($enable_fakekey)
dnl use AT-SPI to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI event handling])
AC_ARG_ENABLE(cspi,
AS_HELP_STRING([--enable-cspi=no/yes],
[Enable AT-SPI event handling default=yes]),,
enable_cspi=yes)
dnl use AT-SPI 2 to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling])
AC_ARG_ENABLE(atspi,
AS_HELP_STRING([--enable-atspi=no/yes],
[Enable AT-SPI 2 event handling default=no]),,
enable_atspi=no)
if test x$enable_cspi = xyes; then
PKG_CHECK_MODULES([CSPI], [cspi-1.0], ,
[AC_MSG_ERROR([AT-SPI C not found])])
AC_DEFINE([HAVE_CSPI], [1], [Define if CSPI is found])
if test x$enable_atspi = xyes; then
PKG_CHECK_MODULES([ATSPI2], [atspi-2 dbus-glib-1], ,
[AC_MSG_ERROR([AT-SPI 2 not found])])
AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found])
fi
AC_MSG_RESULT($enable_cspi)
AM_CONDITIONAL(ENABLE_CSPI, [test x$enable_cspi = xyes])
AC_MSG_RESULT($enable_atspi)
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
dnl Python language binding
AC_MSG_CHECKING([whether you enable Python language support])
@ -245,6 +243,10 @@ data/icons/32x32/Makefile
data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/themes/Makefile
data/keyboards/Makefile
examples/Makefile
examples/eekboard-inscript/Makefile
examples/simple-client/Makefile
eek/eek-${EEK_API_VERSION}.pc
eek/eek-clutter-${EEK_API_VERSION}.pc
eek/eek-gtk-${EEK_API_VERSION}.pc
@ -259,6 +261,10 @@ Build options:
Build shared libs $enable_shared
Build static libs $enable_static
CFLAGS $CFLAGS
Build vala binding $enable_vala
GTK version $with_gtk
Build Clutter UI $enable_clutter
Build Vala binding $enable_vala
Build Python binding $enable_python
Build document $enable_gtk_doc
Support accessibility $enable_atspi
])

View File

@ -1 +1,22 @@
SUBDIRS = icons themes
SUBDIRS = icons themes keyboards
desktopdir = $(datadir)/applications
desktop_in_files = eekboard.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
if ENABLE_ATSPI
autostartdir = $(sysconfdir)/xdg/autostart
autostart_in_files = eekboard-autostart.desktop.in
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
endif
@INTLTOOL_DESKTOP_RULE@
CLEANFILES = $(desktop_DATA)
EXTRA_DIST = $(desktop_in_files)
if ENABLE_ATSPI
CLEANFILES += $(autostart_DATA)
EXTRA_DIST += $(autostart_in_files)
endif

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Eekboard
Exec=eekboard -f
Type=Application
AutostartCondition=GSettings org.gnome.desktop.a11y.applications screen-keyboard-enabled
X-GNOME-AutoRestart=true

9
data/eekboard.desktop.in Normal file
View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Eekboard
GenericName=Eekboard Virtual Keyboard
Comment=Virtual Keyboard
Exec=eekboard
Icon=eekboard
Terminal=false
Type=Application
Categories=GTK;Utility;

View File

@ -0,0 +1,2 @@
keyboarddir = $(pkgdatadir)/keyboards
dist_keyboard_DATA = us-qwerty.xml

View File

@ -0,0 +1,707 @@
<?xml version="1.0"?>
<keyboard version="0.90">
<bounds>0.000000,0.000000,410.000000,190.000000</bounds>
<section name="Alpha">
<bounds>10.000000,50.000000,390.000000,129.000000</bounds>
<angle>0</angle>
<row>
<columns>14</columns>
<orientation>1</orientation>
</row>
<row>
<columns>14</columns>
<orientation>1</orientation>
</row>
<row>
<columns>13</columns>
<orientation>1</orientation>
</row>
<row>
<columns>12</columns>
<orientation>1</orientation>
</row>
<row>
<columns>8</columns>
<orientation>1</orientation>
</row>
<key id="keycode105" name="RCTL" column="7" row="4">
<bounds>359.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="1">
<keysym keyval="65508">Control_R</keysym>
</symbols>
</key>
<key id="keycode135" name="MENU" column="6" row="4">
<bounds>326.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="1">
<keysym keyval="65383">Menu</keysym>
</symbols>
</key>
<key id="keycode134" name="RWIN" column="5" row="4">
<bounds>294.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="1">
<keysym keyval="65516">Super_R</keysym>
</symbols>
</key>
<key id="keycode108" name="RALT" column="4" row="4">
<bounds>261.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="1">
<keysym keyval="65027">ISO_Level3_Shift</keysym>
</symbols>
</key>
<key id="keycode65" name="SPCE" column="3" row="4">
<bounds>106.000000,104.000000,153.000000,24.000000</bounds>
<oref>outline11</oref>
<symbols groups="1" levels="1">
<keysym keyval="32">space</keysym>
</symbols>
</key>
<key id="keycode64" name="LALT" column="2" row="4">
<bounds>73.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="2">
<keysym keyval="65513">Alt_L</keysym>
<keysym keyval="65511">Meta_L</keysym>
</symbols>
</key>
<key id="keycode133" name="LWIN" column="1" row="4">
<bounds>40.000000,104.000000,31.000000,24.000000</bounds>
<oref>outline10</oref>
<symbols groups="1" levels="1">
<keysym keyval="65515">Super_L</keysym>
</symbols>
</key>
<key id="keycode37" name="LCTL" column="0" row="4">
<bounds>2.000000,104.000000,36.000000,24.000000</bounds>
<oref>outline9</oref>
<symbols groups="1" levels="1">
<keysym keyval="65507">Control_L</keysym>
</symbols>
</key>
<key id="keycode62" name="RTSH" column="11" row="3">
<bounds>320.000000,78.000000,70.000000,24.000000</bounds>
<oref>outline8</oref>
<symbols groups="1" levels="1">
<keysym keyval="65506">Shift_R</keysym>
</symbols>
</key>
<key id="keycode61" name="AB10" column="10" row="3">
<bounds>294.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="47">slash</keysym>
<keysym keyval="63">question</keysym>
</symbols>
</key>
<key id="keycode60" name="AB09" column="9" row="3">
<bounds>268.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="46">period</keysym>
<keysym keyval="62">greater</keysym>
</symbols>
</key>
<key id="keycode59" name="AB08" column="8" row="3">
<bounds>242.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="44">comma</keysym>
<keysym keyval="60">less</keysym>
</symbols>
</key>
<key id="keycode58" name="AB07" column="7" row="3">
<bounds>216.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="109">m</keysym>
<keysym keyval="77">M</keysym>
</symbols>
</key>
<key id="keycode57" name="AB06" column="6" row="3">
<bounds>190.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="110">n</keysym>
<keysym keyval="78">N</keysym>
</symbols>
</key>
<key id="keycode56" name="AB05" column="5" row="3">
<bounds>164.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="98">b</keysym>
<keysym keyval="66">B</keysym>
</symbols>
</key>
<key id="keycode55" name="AB04" column="4" row="3">
<bounds>138.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="118">v</keysym>
<keysym keyval="86">V</keysym>
</symbols>
</key>
<key id="keycode54" name="AB03" column="3" row="3">
<bounds>113.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="99">c</keysym>
<keysym keyval="67">C</keysym>
</symbols>
</key>
<key id="keycode53" name="AB02" column="2" row="3">
<bounds>87.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="120">x</keysym>
<keysym keyval="88">X</keysym>
</symbols>
</key>
<key id="keycode52" name="AB01" column="1" row="3">
<bounds>61.000000,78.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="122">z</keysym>
<keysym keyval="90">Z</keysym>
</symbols>
</key>
<key id="keycode50" name="LFSH" column="0" row="3">
<bounds>2.000000,78.000000,57.000000,24.000000</bounds>
<oref>outline7</oref>
<symbols groups="1" levels="1">
<keysym keyval="65505">Shift_L</keysym>
</symbols>
</key>
<key id="keycode36" name="RTRN" column="12" row="2">
<bounds>333.000000,53.000000,57.000000,24.000000</bounds>
<oref>outline6</oref>
<symbols groups="1" levels="1">
<keysym keyval="65293">Return</keysym>
</symbols>
</key>
<key id="keycode48" name="AC11" column="11" row="2">
<bounds>307.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="39">quoteright</keysym>
<keysym keyval="34">quotedbl</keysym>
</symbols>
</key>
<key id="keycode47" name="AC10" column="10" row="2">
<bounds>281.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="59">semicolon</keysym>
<keysym keyval="58">colon</keysym>
</symbols>
</key>
<key id="keycode46" name="AC09" column="9" row="2">
<bounds>256.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="108">l</keysym>
<keysym keyval="76">L</keysym>
</symbols>
</key>
<key id="keycode45" name="AC08" column="8" row="2">
<bounds>230.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="107">k</keysym>
<keysym keyval="75">K</keysym>
</symbols>
</key>
<key id="keycode44" name="AC07" column="7" row="2">
<bounds>204.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="106">j</keysym>
<keysym keyval="74">J</keysym>
</symbols>
</key>
<key id="keycode43" name="AC06" column="6" row="2">
<bounds>178.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="104">h</keysym>
<keysym keyval="72">H</keysym>
</symbols>
</key>
<key id="keycode42" name="AC05" column="5" row="2">
<bounds>152.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="103">g</keysym>
<keysym keyval="71">G</keysym>
</symbols>
</key>
<key id="keycode41" name="AC04" column="4" row="2">
<bounds>126.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="102">f</keysym>
<keysym keyval="70">F</keysym>
</symbols>
</key>
<key id="keycode40" name="AC03" column="3" row="2">
<bounds>100.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="100">d</keysym>
<keysym keyval="68">D</keysym>
</symbols>
</key>
<key id="keycode39" name="AC02" column="2" row="2">
<bounds>74.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="115">s</keysym>
<keysym keyval="83">S</keysym>
</symbols>
</key>
<key id="keycode38" name="AC01" column="1" row="2">
<bounds>49.000000,53.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="97">a</keysym>
<keysym keyval="65">A</keysym>
</symbols>
</key>
<key id="keycode66" name="CAPS" column="0" row="2">
<bounds>2.000000,53.000000,44.000000,24.000000</bounds>
<oref>outline5</oref>
<symbols groups="1" levels="2">
<keysym keyval="65507">Control_L</keysym>
<keysym keyval="65507">Control_L</keysym>
</symbols>
</key>
<key id="keycode51" name="BKSL" column="13" row="1">
<bounds>352.000000,27.000000,38.000000,24.000000</bounds>
<oref>outline4</oref>
<symbols groups="1" levels="2">
<keysym keyval="92">backslash</keysym>
<keysym keyval="124">bar</keysym>
</symbols>
</key>
<key id="keycode35" name="AD12" column="12" row="1">
<bounds>326.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="93">bracketright</keysym>
<keysym keyval="125">braceright</keysym>
</symbols>
</key>
<key id="keycode34" name="AD11" column="11" row="1">
<bounds>300.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="91">bracketleft</keysym>
<keysym keyval="123">braceleft</keysym>
</symbols>
</key>
<key id="keycode33" name="AD10" column="10" row="1">
<bounds>275.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="112">p</keysym>
<keysym keyval="80">P</keysym>
</symbols>
</key>
<key id="keycode32" name="AD09" column="9" row="1">
<bounds>249.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="111">o</keysym>
<keysym keyval="79">O</keysym>
</symbols>
</key>
<key id="keycode31" name="AD08" column="8" row="1">
<bounds>223.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="105">i</keysym>
<keysym keyval="73">I</keysym>
</symbols>
</key>
<key id="keycode30" name="AD07" column="7" row="1">
<bounds>197.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="117">u</keysym>
<keysym keyval="85">U</keysym>
</symbols>
</key>
<key id="keycode29" name="AD06" column="6" row="1">
<bounds>171.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="121">y</keysym>
<keysym keyval="89">Y</keysym>
</symbols>
</key>
<key id="keycode28" name="AD05" column="5" row="1">
<bounds>145.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="116">t</keysym>
<keysym keyval="84">T</keysym>
</symbols>
</key>
<key id="keycode27" name="AD04" column="4" row="1">
<bounds>119.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="114">r</keysym>
<keysym keyval="82">R</keysym>
</symbols>
</key>
<key id="keycode26" name="AD03" column="3" row="1">
<bounds>93.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="101">e</keysym>
<keysym keyval="69">E</keysym>
</symbols>
</key>
<key id="keycode25" name="AD02" column="2" row="1">
<bounds>68.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="119">w</keysym>
<keysym keyval="87">W</keysym>
</symbols>
</key>
<key id="keycode24" name="AD01" column="1" row="1">
<bounds>42.000000,27.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="113">q</keysym>
<keysym keyval="81">Q</keysym>
</symbols>
</key>
<key id="keycode23" name="TAB" column="0" row="1">
<bounds>2.000000,27.000000,38.000000,24.000000</bounds>
<oref>outline3</oref>
<symbols groups="1" levels="2">
<keysym keyval="65289">Tab</keysym>
<keysym keyval="65056">ISO_Left_Tab</keysym>
</symbols>
</key>
<key id="keycode22" name="BKSP" column="13" row="0">
<bounds>339.000000,1.000000,51.000000,24.000000</bounds>
<oref>outline2</oref>
<symbols groups="1" levels="1">
<keysym keyval="65288">BackSpace</keysym>
</symbols>
</key>
<key id="keycode21" name="AE12" column="12" row="0">
<bounds>313.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="61">equal</keysym>
<keysym keyval="43">plus</keysym>
</symbols>
</key>
<key id="keycode20" name="AE11" column="11" row="0">
<bounds>287.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="45">minus</keysym>
<keysym keyval="95">underscore</keysym>
</symbols>
</key>
<key id="keycode19" name="AE10" column="10" row="0">
<bounds>261.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="48">0</keysym>
<keysym keyval="41">parenright</keysym>
</symbols>
</key>
<key id="keycode18" name="AE09" column="9" row="0">
<bounds>235.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="57">9</keysym>
<keysym keyval="40">parenleft</keysym>
</symbols>
</key>
<key id="keycode17" name="AE08" column="8" row="0">
<bounds>209.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="56">8</keysym>
<keysym keyval="42">asterisk</keysym>
</symbols>
</key>
<key id="keycode16" name="AE07" column="7" row="0">
<bounds>183.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="55">7</keysym>
<keysym keyval="38">ampersand</keysym>
</symbols>
</key>
<key id="keycode15" name="AE06" column="6" row="0">
<bounds>157.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="54">6</keysym>
<keysym keyval="94">asciicircum</keysym>
</symbols>
</key>
<key id="keycode14" name="AE05" column="5" row="0">
<bounds>132.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="53">5</keysym>
<keysym keyval="37">percent</keysym>
</symbols>
</key>
<key id="keycode13" name="AE04" column="4" row="0">
<bounds>106.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="52">4</keysym>
<keysym keyval="36">dollar</keysym>
</symbols>
</key>
<key id="keycode12" name="AE03" column="3" row="0">
<bounds>80.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="51">3</keysym>
<keysym keyval="35">numbersign</keysym>
</symbols>
</key>
<key id="keycode11" name="AE02" column="2" row="0">
<bounds>54.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="50">2</keysym>
<keysym keyval="64">at</keysym>
</symbols>
</key>
<key id="keycode10" name="AE01" column="1" row="0">
<bounds>28.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="49">1</keysym>
<keysym keyval="33">exclam</keysym>
</symbols>
</key>
<key id="keycode49" name="TLDE" column="0" row="0">
<bounds>2.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="96">quoteleft</keysym>
<keysym keyval="126">asciitilde</keysym>
</symbols>
</key>
</section>
<section name="Function">
<bounds>10.000000,10.000000,410.000000,25.000000</bounds>
<angle>0</angle>
<row>
<columns>16</columns>
<orientation>1</orientation>
</row>
<key id="keycode96" name="FK12" column="12" row="0">
<bounds>366.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65481">F12</keysym>
<keysym keyval="269024780">(null)</keysym>
</symbols>
</key>
<key id="keycode95" name="FK11" column="11" row="0">
<bounds>340.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65480">F11</keysym>
<keysym keyval="269024779">(null)</keysym>
</symbols>
</key>
<key id="keycode76" name="FK10" column="10" row="0">
<bounds>314.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65479">F10</keysym>
<keysym keyval="269024778">(null)</keysym>
</symbols>
</key>
<key id="keycode75" name="FK09" column="9" row="0">
<bounds>288.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65478">F9</keysym>
<keysym keyval="269024777">(null)</keysym>
</symbols>
</key>
<key id="keycode74" name="FK08" column="8" row="0">
<bounds>249.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65477">F8</keysym>
<keysym keyval="269024776">(null)</keysym>
</symbols>
</key>
<key id="keycode73" name="FK07" column="7" row="0">
<bounds>223.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65476">F7</keysym>
<keysym keyval="269024775">(null)</keysym>
</symbols>
</key>
<key id="keycode72" name="FK06" column="6" row="0">
<bounds>197.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65475">F6</keysym>
<keysym keyval="269024774">(null)</keysym>
</symbols>
</key>
<key id="keycode71" name="FK05" column="5" row="0">
<bounds>171.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65474">F5</keysym>
<keysym keyval="269024773">(null)</keysym>
</symbols>
</key>
<key id="keycode70" name="FK04" column="4" row="0">
<bounds>132.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65473">F4</keysym>
<keysym keyval="269024772">(null)</keysym>
</symbols>
</key>
<key id="keycode69" name="FK03" column="3" row="0">
<bounds>106.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65472">F3</keysym>
<keysym keyval="269024771">(null)</keysym>
</symbols>
</key>
<key id="keycode68" name="FK02" column="2" row="0">
<bounds>80.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65471">F2</keysym>
<keysym keyval="269024770">(null)</keysym>
</symbols>
</key>
<key id="keycode67" name="FK01" column="1" row="0">
<bounds>54.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="2">
<keysym keyval="65470">F1</keysym>
<keysym keyval="269024769">(null)</keysym>
</symbols>
</key>
<key id="keycode9" name="ESC" column="0" row="0">
<bounds>2.000000,1.000000,24.000000,24.000000</bounds>
<oref>outline1</oref>
<symbols groups="1" levels="1">
<keysym keyval="65307">Escape</keysym>
</symbols>
</key>
</section>
<outline id="outline1">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>24.000000,0.000000</point>
<point>24.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline3">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>38.000000,0.000000</point>
<point>38.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline4">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>38.000000,0.000000</point>
<point>38.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline5">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>44.000000,0.000000</point>
<point>44.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline6">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>57.000000,0.000000</point>
<point>57.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline7">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>57.000000,0.000000</point>
<point>57.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline8">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>70.000000,0.000000</point>
<point>70.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline9">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>36.000000,0.000000</point>
<point>36.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline10">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>31.000000,0.000000</point>
<point>31.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline11">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>153.000000,0.000000</point>
<point>153.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline12">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>24.000000,0.000000</point>
<point>24.000000,50.000000</point>
<point>0.000000,50.000000</point>
</outline>
<outline id="outline13">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>50.000000,0.000000</point>
<point>50.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
<outline id="outline2">
<corner-radius>1.000000</corner-radius>
<point>0.000000,0.000000</point>
<point>51.000000,0.000000</point>
<point>51.000000,24.000000</point>
<point>0.000000,24.000000</point>
</outline>
</keyboard>

View File

@ -47,7 +47,7 @@ SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--rebuild-types
SCAN_OPTIONS=--rebuild-types --deprecated-guards="EEK_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
@ -82,7 +82,8 @@ IGNORE_HFILES = \
eek-clutter-renderer.h \
eek-clutter-section.h \
eek-clutter-key.h \
eek-gtk-renderer.h
eek-gtk-renderer.h \
eek-enumtypes.h
if !ENABLE_CLUTTER
IGNORE_HFILES += eek-clutter-keyboard.h eek-clutter.h
endif

View File

@ -1,9 +1,8 @@
<SECTION>
<FILE>eek-keyboard</FILE>
<TITLE>EekKeyboard</TITLE>
EekKeyboardClass
EekKeyboardPrivate
EekKeyboard
EekKeyboardClass
eek_keyboard_new
eek_keyboard_get_layout
eek_keyboard_get_size
@ -21,6 +20,11 @@ eek_keyboard_create_section
eek_keyboard_find_key_by_keycode
eek_keyboard_add_outline
eek_keyboard_get_outline
eek_keyboard_set_num_lock_mask
eek_keyboard_get_num_lock_mask
eek_keyboard_set_alt_gr_mask
eek_keyboard_get_alt_gr_mask
EekKeyboardPrivate
<SUBSECTION Standard>
EEK_KEYBOARD
EEK_IS_KEYBOARD
@ -34,8 +38,8 @@ EEK_KEYBOARD_GET_CLASS
<SECTION>
<FILE>eek-layout</FILE>
<TITLE>EekLayout</TITLE>
EekLayoutClass
EekLayout
EekLayoutClass
<SUBSECTION Standard>
EEK_LAYOUT
EEK_IS_LAYOUT
@ -51,8 +55,9 @@ EEK_LAYOUT_GET_CLASS
<TITLE>EekGtkKeyboard</TITLE>
EekGtkKeyboard
EekGtkKeyboardClass
EekGtkKeyboardPrivate
eek_gtk_keyboard_new
eek_gtk_keyboard_set_theme
EekGtkKeyboardPrivate
<SUBSECTION Standard>
EEK_GTK_KEYBOARD
EEK_IS_GTK_KEYBOARD
@ -63,12 +68,42 @@ EEK_IS_GTK_KEYBOARD_CLASS
EEK_GTK_KEYBOARD_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-theme-node</FILE>
EekSide
EekCorner
eek_theme_node_new
eek_theme_node_get_parent
eek_theme_node_get_theme
eek_theme_node_get_element_type
eek_theme_node_get_element_id
eek_theme_node_get_element_class
eek_theme_node_get_pseudo_class
eek_theme_node_get_color
eek_theme_node_get_background_color
eek_theme_node_get_foreground_color
eek_theme_node_get_background_gradient
eek_theme_node_get_border_width
eek_theme_node_get_border_radius
eek_theme_node_get_border_color
eek_theme_node_get_font
EekThemeNodePrivate
EekThemeNodeClass
<SUBSECTION Standard>
EEK_THEME_NODE
EEK_IS_THEME_NODE
EEK_TYPE_THEME_NODE
eek_theme_node_get_type
EEK_THEME_NODE_CLASS
EEK_IS_THEME_NODE_CLASS
EEK_THEME_NODE_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-section</FILE>
<TITLE>EekSection</TITLE>
EekSectionClass
EekSectionPrivate
EekSection
EekSectionClass
eek_section_set_angle
eek_section_get_angle
eek_section_get_n_rows
@ -76,6 +111,7 @@ eek_section_add_row
eek_section_get_row
eek_section_create_key
eek_section_find_key_by_keycode
EekSectionPrivate
<SUBSECTION Standard>
EEK_SECTION
EEK_IS_SECTION
@ -86,17 +122,39 @@ EEK_IS_SECTION_CLASS
EEK_SECTION_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-theme-context</FILE>
eek_theme_context_new
eek_theme_context_set_theme
eek_theme_context_get_theme
eek_theme_context_set_resolution
eek_theme_context_set_default_resolution
eek_theme_context_get_resolution
eek_theme_context_set_font
eek_theme_context_get_font
eek_theme_context_get_root_node
EekThemeContextClass
<SUBSECTION Standard>
EEK_THEME_CONTEXT
EEK_IS_THEME_CONTEXT
EEK_TYPE_THEME_CONTEXT
eek_theme_context_get_type
EEK_THEME_CONTEXT_CLASS
EEK_IS_THEME_CONTEXT_CLASS
EEK_THEME_CONTEXT_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-container</FILE>
<TITLE>EekContainer</TITLE>
EekContainerClass
EekContainerPrivate
EekCallback
EekCompareFunc
EekContainer
EekContainerClass
eek_container_foreach_child
eek_container_find
eek_container_add_child
EekContainerPrivate
<SUBSECTION Standard>
EEK_CONTAINER
EEK_IS_CONTAINER
@ -107,13 +165,30 @@ EEK_IS_CONTAINER_CLASS
EEK_CONTAINER_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-clutter-keyboard</FILE>
<TITLE>EekClutterKeyboard</TITLE>
EekClutterKeyboard
EekClutterKeyboardClass
eek_clutter_keyboard_new
eek_clutter_keyboard_set_theme
EekClutterKeyboardPrivate
<SUBSECTION Standard>
EEK_CLUTTER_KEYBOARD
EEK_IS_CLUTTER_KEYBOARD
EEK_TYPE_CLUTTER_KEYBOARD
eek_clutter_keyboard_get_type
EEK_CLUTTER_KEYBOARD_CLASS
EEK_IS_CLUTTER_KEYBOARD_CLASS
EEK_CLUTTER_KEYBOARD_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-symbol</FILE>
<TITLE>EekSymbol</TITLE>
EekSymbolCategory
EekSymbolClass
EekSymbolPrivate
EekSymbol
EekSymbolClass
eek_symbol_new
eek_symbol_set_name
eek_symbol_get_name
@ -126,6 +201,7 @@ eek_symbol_set_modifier_mask
eek_symbol_is_modifier
eek_symbol_set_icon_name
eek_symbol_get_icon_name
EekSymbolPrivate
<SUBSECTION Standard>
EEK_SYMBOL
EEK_IS_SYMBOL
@ -141,7 +217,6 @@ EEK_SYMBOL_GET_CLASS
<TITLE>EekXklLayout</TITLE>
EekXklLayout
EekXklLayoutClass
EekXklLayoutPrivate
eek_xkl_layout_new
eek_xkl_layout_set_config
eek_xkl_layout_set_config_full
@ -156,6 +231,7 @@ eek_xkl_layout_get_layouts
eek_xkl_layout_get_variants
eek_xkl_layout_get_options
eek_xkl_layout_get_option
EekXklLayoutPrivate
<SUBSECTION Standard>
EEK_XKL_LAYOUT
EEK_IS_XKL_LAYOUT
@ -171,7 +247,6 @@ EEK_XKL_LAYOUT_GET_CLASS
<TITLE>EekXkbLayout</TITLE>
EekXkbLayout
EekXkbLayoutClass
EekXkbLayoutPrivate
eek_xkb_layout_new
eek_xkb_layout_set_names
eek_xkb_layout_set_names_full
@ -182,6 +257,7 @@ eek_xkb_layout_set_symbols
eek_xkb_layout_get_keycodes
eek_xkb_layout_get_geometry
eek_xkb_layout_get_symbols
EekXkbLayoutPrivate
<SUBSECTION Standard>
EEK_XKB_LAYOUT
EEK_IS_XKB_LAYOUT
@ -195,9 +271,8 @@ EEK_XKB_LAYOUT_GET_CLASS
<SECTION>
<FILE>eek-key</FILE>
<TITLE>EekKey</TITLE>
EekKeyClass
EekKeyPrivate
EekKey
EekKeyClass
eek_key_set_keycode
eek_key_get_keycode
eek_key_set_symbol_matrix
@ -210,6 +285,7 @@ eek_key_get_index
eek_key_set_oref
eek_key_get_oref
eek_key_is_pressed
EekKeyPrivate
<SUBSECTION Standard>
EEK_KEY
EEK_IS_KEY
@ -223,7 +299,6 @@ EEK_KEY_GET_CLASS
<SECTION>
<FILE>eek-serializable</FILE>
<TITLE>EekSerializable</TITLE>
EekSerializable
EekSerializableIface
eek_serializable_serialize
eek_serializable_deserialize
@ -238,9 +313,8 @@ EEK_SERIALIZABLE_GET_IFACE
<SECTION>
<FILE>eek-element</FILE>
<TITLE>EekElement</TITLE>
EekElementClass
EekElementPrivate
EekElement
EekElementClass
eek_element_set_parent
eek_element_get_parent
eek_element_set_name
@ -256,6 +330,7 @@ eek_element_set_group
eek_element_set_level
eek_element_get_group
eek_element_get_level
EekElementPrivate
<SUBSECTION Standard>
EEK_ELEMENT
EEK_IS_ELEMENT
@ -271,10 +346,10 @@ EEK_ELEMENT_GET_CLASS
<TITLE>EekXmlLayout</TITLE>
EekXmlLayout
EekXmlLayoutClass
EekXmlLayoutPrivate
eek_xml_layout_new
eek_xml_layout_set_source
eek_xml_layout_get_source
EekXmlLayoutPrivate
<SUBSECTION Standard>
EEK_XML_LAYOUT
EEK_IS_XML_LAYOUT
@ -285,16 +360,33 @@ EEK_IS_XML_LAYOUT_CLASS
EEK_XML_LAYOUT_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-theme</FILE>
eek_theme_new
eek_theme_load_stylesheet
eek_theme_unload_stylesheet
EekThemeClass
<SUBSECTION Standard>
EEK_THEME
EEK_IS_THEME
EEK_TYPE_THEME
eek_theme_get_type
EEK_THEME_CLASS
EEK_IS_THEME_CLASS
EEK_THEME_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-keysym</FILE>
<TITLE>EekKeysym</TITLE>
EEK_KEYSYM
EekKeysymClass
EekKeysymPrivate
EekKeysym
EekKeysymClass
eek_keysym_new
eek_keysym_get_xkeysym
eek_keysym_new_from_name
eek_keysym_new_with_modifier
EekKeysymPrivate
<SUBSECTION Standard>
EEK_INVALID_KEYSYM
EEK_IS_KEYSYM
@ -314,7 +406,6 @@ eek_keyboard_output
<SECTION>
<FILE>eek-types</FILE>
I_
EEK_TYPE_SYMBOL_MATRIX
EEK_TYPE_POINT
EEK_TYPE_BOUNDS
EEK_TYPE_OUTLINE
@ -323,23 +414,40 @@ EekOrientation
EekModifierBehavior
EekModifierType
EEK_INVALID_KEYCODE
EekSymbolMatrix
EekPoint
eek_point_get_type
eek_point_copy
eek_point_free
eek_point_rotate
EekBounds
eek_bounds_get_type
eek_bounds_copy
eek_bounds_free
eek_bounds_long_side
EekOutline
eek_outline_get_type
eek_outline_copy
eek_outline_free
EekColor
eek_color_get_type
eek_color_new
eek_color_copy
eek_color_free
EekGradientType
EekThemeNode
EekThemeContext
EekTheme
</SECTION>
<SECTION>
<FILE>eek-symbol-matrix</FILE>
EekSymbolMatrix
EEK_TYPE_SYMBOL_MATRIX
eek_symbol_matrix_get_type
eek_symbol_matrix_new
eek_symbol_matrix_copy
eek_symbol_matrix_free
eek_point_get_type
eek_point_rotate
eek_bounds_get_type
eek_bounds_long_side
eek_outline_get_type
eek_outline_copy
eek_outline_free
eek_color_get_type
eek_color_new
eek_symbol_matrix_set_symbol
eek_symbol_matrix_get_symbol
</SECTION>

View File

@ -35,6 +35,7 @@ libeek_public_headers = \
$(srcdir)/eek-key.h \
$(srcdir)/eek-symbol.h \
$(srcdir)/eek-keysym.h \
$(srcdir)/eek-symbol-matrix.h \
$(srcdir)/eek-types.h \
$(srcdir)/eek-xml.h \
$(srcdir)/eek-xml-layout.h \
@ -59,6 +60,7 @@ libeek_sources = \
$(srcdir)/eek-keyboard.c \
$(srcdir)/eek-section.c \
$(srcdir)/eek-key.c \
$(srcdir)/eek-symbol-matrix.c \
$(srcdir)/eek-symbol.c \
$(srcdir)/eek-keysym.c \
$(srcdir)/eek-types.c \
@ -86,10 +88,12 @@ libeek_marshalers_sources = \
BUILT_SOURCES = \
$(libeek_keysym_sources) \
$(libeek_enumtypes_sources) \
$(libeek_marshalers_sources)
libeek_la_SOURCES = \
$(libeek_sources) \
$(srcdir)/eek-enumtypes.c \
$(srcdir)/eek-marshalers.c
libeek_la_CFLAGS = $(GIO2_CFLAGS) $(PANGOCAIRO_CFLAGS) $(LIBCROCO_CFLAGS)
@ -154,6 +158,7 @@ libeek_xkl_la_LIBADD = libeek-xkb.la $(LIBXKLAVIER_LIBS) $(GTK_LIBS)
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
eek_HEADERS = \
$(libeek_public_headers) \
$(srcdir)/eek-enumtypes.h \
$(libeek_clutter_public_headers) \
$(libeek_gtk_public_headers) \
$(libeek_xkb_public_headers) \
@ -173,6 +178,16 @@ eek-unicode-keysym-entries.h: unicode-keysym-entries.txt
eek-xkeysym-keysym-entries.h: xkeysym-keysym-entries.txt
$(PYTHON) ./gen-keysym-entries.py xkeysym_keysym_entries < $< > $@
eek-enumtypes.h: $(libeek_public_headers) eek-enumtypes.h.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template eek-enumtypes.h.template \
$(libeek_public_headers) > eek-enumtypes.h.tmp && \
mv eek-enumtypes.h.tmp eek-enumtypes.h
eek-enumtypes.c: $(libeek_public_headers) eek-enumtypes.c.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template eek-enumtypes.c.template \
$(libeek_public_headers) > eek-enumtypes.c.tmp && \
mv eek-enumtypes.c.tmp eek-enumtypes.c
# gen marshal
eek-marshalers.h: eek-marshalers.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_eek_marshal $(srcdir)/eek-marshalers.list --header --internal > $@.tmp && \
@ -205,6 +220,8 @@ EXTRA_DIST = \
special-keysym-entries.txt \
unicode-keysym-entries.txt \
xkeysym-keysym-entries.txt \
eek-enumtypes.h.template \
eek-enumtypes.c.template \
eek-marshalers.list
-include $(INTROSPECTION_MAKEFILE)
@ -219,7 +236,7 @@ Eek@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = --strip-prefix=Eek --pkg=glib-2.0
Eek@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0
Eek@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_la_CFLAGS)
Eek@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek.la
Eek@EEK_LIBRARY_SUFFIX_U@_gir_FILES = $(libeek_sources) $(libeek_public_headers)
Eek@EEK_LIBRARY_SUFFIX_U@_gir_FILES = $(libeek_sources) $(libeek_public_headers) $(srcdir)/eek-enumtypes.h
EekGtk@EEK_LIBRARY_SUFFIX@.gir: libeek-gtk.la Eek@EEK_LIBRARY_SUFFIX@.gir
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GObject-2.0 Gtk-@GTK_API_VERSION@ Eek@EEK_LIBRARY_SUFFIX@

View File

@ -249,7 +249,7 @@ eek_container_init (EekContainer *self)
/**
* eek_container_foreach_child:
* @container: an #EekContainer
* @callback: an #EekCallback
* @callback: (scope call): an #EekCallback
* @user_data: additional data passed to @callback
*
* Enumerate children of @container and run @callback with each child.

View File

@ -34,6 +34,14 @@ G_BEGIN_DECLS
typedef struct _EekContainerClass EekContainerClass;
typedef struct _EekContainerPrivate EekContainerPrivate;
/**
* EekCallback:
* @element: an #EekElement
* @user_data: user-supplied data
*
* The type of the callback function used for iterating over the
* children of a container, see eek_container_foreach_child().
*/
typedef void (*EekCallback) (EekElement *element, gpointer user_data);
typedef gint (*EekCompareFunc) (EekElement *element, gpointer user_data);

View File

@ -0,0 +1,36 @@
/*** BEGIN file-header ***/
#include "eek.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/*** END value-tail ***/

View File

@ -0,0 +1,24 @@
/*** BEGIN file-header ***/
#ifndef __EEK_ENUMTYPES_H__
#define __EEK_ENUMTYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __EEK_ENUMTYPES_H__ */
/*** END file-tail ***/

View File

@ -557,9 +557,9 @@ eek_key_get_symbol_matrix (EekKey *key)
/**
* eek_key_get_symbol:
* @key: an #EekKey
* @returns: (transfer none): the current #EekSymbol or %NULL on failure
*
* Get the current symbol of @key.
* Return value: (transfer none): the current #EekSymbol or %NULL on failure
*/
EekSymbol *
eek_key_get_symbol (EekKey *key)
@ -572,9 +572,9 @@ eek_key_get_symbol (EekKey *key)
* @key: an #EekKey
* @fallback_group: fallback group index
* @fallback_level: fallback level index
* @returns: (transfer none): the current #EekSymbol or %NULL on failure
*
* Get the current symbol of @key.
* Return value: (transfer none): the current #EekSymbol or %NULL on failure
*/
EekSymbol *
eek_key_get_symbol_with_fallback (EekKey *key,
@ -628,9 +628,9 @@ eek_key_get_symbol_with_fallback (EekKey *key,
* @level: level index of the symbol matrix
* @fallback_group: fallback group index
* @fallback_level: fallback level index
* @returns: (transfer none): an #EekSymbol at (@group, @level), or %NULL
*
* Get the symbol at (@group, @level) in the symbol matrix of @key.
* Return value: (transfer none): an #EekSymbol at (@group, @level), or %NULL
*/
EekSymbol *
eek_key_get_symbol_at_index (EekKey *key,

View File

@ -20,9 +20,8 @@
#ifndef EEK_KEY_H
#define EEK_KEY_H 1
#include <glib-object.h>
#include "eek-element.h"
#include "eek-types.h"
#include "eek-symbol-matrix.h"
G_BEGIN_DECLS

View File

@ -36,6 +36,7 @@
#include "eek-key.h"
#include "eek-symbol.h"
#include "eek-serializable.h"
#include "eek-enumtypes.h"
enum {
PROP_0,
@ -147,6 +148,7 @@ eek_keyboard_real_serialize (EekSerializable *self,
}
g_variant_builder_add (builder, "v", g_variant_builder_end (&array));
g_variant_builder_add (builder, "u", priv->num_lock_mask);
g_variant_builder_add (builder, "u", priv->alt_gr_mask);
}
static gsize
@ -172,6 +174,7 @@ eek_keyboard_real_deserialize (EekSerializable *self,
g_slice_free (EekOutline, _outline);
}
g_variant_get_child (variant, index++, "u", &priv->num_lock_mask);
g_variant_get_child (variant, index++, "u", &priv->alt_gr_mask);
return index;
}
@ -272,7 +275,7 @@ eek_keyboard_set_property (GObject *object,
break;
case PROP_MODIFIER_BEHAVIOR:
eek_keyboard_set_modifier_behavior (EEK_KEYBOARD(object),
g_value_get_int (value));
g_value_get_enum (value));
break;
default:
g_object_set_property (object,
@ -295,7 +298,7 @@ eek_keyboard_get_property (GObject *object,
g_value_set_object (value, priv->layout);
break;
case PROP_MODIFIER_BEHAVIOR:
g_value_set_int (value,
g_value_set_enum (value,
eek_keyboard_get_modifier_behavior (EEK_KEYBOARD(object)));
break;
default:
@ -359,6 +362,9 @@ eek_keyboard_real_key_released (EekKeyboard *self,
priv->modifiers ^= modifier;
break;
case EEK_MODIFIER_BEHAVIOR_LATCH:
if (modifier == priv->alt_gr_mask || modifier == EEK_SHIFT_MASK)
priv->modifiers ^= modifier;
else
priv->modifiers = (priv->modifiers ^ modifier) & modifier;
break;
}
@ -460,10 +466,11 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
*
* The modifier handling mode of #EekKeyboard.
*/
pspec = g_param_spec_int ("modifier-behavior",
pspec = g_param_spec_enum ("modifier-behavior",
"Modifier behavior",
"Modifier handling mode of the keyboard",
0, G_MAXINT, EEK_MODIFIER_BEHAVIOR_NONE,
EEK_TYPE_MODIFIER_BEHAVIOR,
EEK_MODIFIER_BEHAVIOR_NONE,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_MODIFIER_BEHAVIOR,
@ -653,9 +660,9 @@ eek_keyboard_create_section (EekKeyboard *keyboard)
* eek_keyboard_find_key_by_keycode:
* @keyboard: an #EekKeyboard
* @keycode: a keycode
* @returns: (transfer none): #EekKey whose keycode is @keycode
*
* Find an #EekKey whose keycode is @keycode.
* Return value: (transfer none): #EekKey whose keycode is @keycode
*/
EekKey *
eek_keyboard_find_key_by_keycode (EekKeyboard *keyboard,

View File

@ -104,6 +104,7 @@ void eek_keyboard_set_size
(EekKeyboard *keyboard,
gdouble width,
gdouble height);
#ifndef EEK_DISABLE_DEPRECATED
void eek_keyboard_set_symbol_index
(EekKeyboard *keyboard,
gint group,
@ -112,7 +113,6 @@ void eek_keyboard_get_symbol_index
(EekKeyboard *keyboard,
gint *group,
gint *level);
void eek_keyboard_set_group
(EekKeyboard *keyboard,
gint group);
@ -123,6 +123,7 @@ gint eek_keyboard_get_group
(EekKeyboard *keyboard);
gint eek_keyboard_get_level
(EekKeyboard *keyboard);
#endif /* EEK_DISABLE_DEPRECATED */
void eek_keyboard_set_modifier_behavior
(EekKeyboard *keyboard,

View File

@ -223,7 +223,8 @@ eek_keysym_init (EekKeysym *self)
* modifier @modifier_mask.
*/
EekKeysym *
eek_keysym_new_with_modifier (guint xkeysym, EekModifierType modifier_mask)
eek_keysym_new_with_modifier (guint xkeysym,
EekModifierType modifier_mask)
{
EekKeysym *keysym;
EekKeysymPrivate *priv;

View File

@ -53,6 +53,7 @@ struct _EekRendererPrivate
gdouble allocation_height;
gdouble scale;
PangoFontDescription *ascii_font;
PangoFontDescription *font;
GHashTable *outline_surface_cache;
GHashTable *active_outline_surface_cache;
@ -65,14 +66,13 @@ struct _EekRendererPrivate
static const EekColor DEFAULT_FOREGROUND_COLOR = {0.3, 0.3, 0.3, 1.0};
static const EekColor DEFAULT_BACKGROUND_COLOR = {1.0, 1.0, 1.0, 1.0};
struct {
struct _TextProperty {
gint category;
gboolean ascii;
gdouble scale;
} symbol_category_scale_factors[EEK_SYMBOL_CATEGORY_LAST] = {
{ EEK_SYMBOL_CATEGORY_LETTER, 1.0 },
{ EEK_SYMBOL_CATEGORY_FUNCTION, 0.5 },
{ EEK_SYMBOL_CATEGORY_KEYNAME, 0.5 }
gboolean ellipses;
};
typedef struct _TextProperty TextProperty;
/* eek-keyboard-drawing.c */
extern void _eek_rounded_polygon (cairo_t *cr,
@ -342,7 +342,7 @@ render_key_outline (EekRenderer *renderer,
struct _CalculateFontSizeCallbackData {
gdouble size;
gdouble em_size;
gboolean ascii;
EekRenderer *renderer;
const PangoFontDescription *base_font;
};
@ -358,16 +358,21 @@ calculate_font_size_key_callback (EekElement *element, gpointer user_data)
PangoRectangle extents = { 0, };
PangoLayout *layout;
gdouble size;
EekSymbol *symbol;
EekBounds bounds;
const gchar *label = NULL;
if (data->ascii)
label = "M";
else {
EekSymbol *symbol;
symbol = eek_key_get_symbol (EEK_KEY(element));
if (symbol &&
eek_symbol_get_category (symbol) == EEK_SYMBOL_CATEGORY_LETTER)
label = eek_symbol_get_label (symbol);
if (!label)
label = "M";
}
font = pango_font_description_copy (data->base_font);
@ -390,12 +395,8 @@ calculate_font_size_key_callback (EekElement *element, gpointer user_data)
sy = bounds.height * PANGO_SCALE / extents.height;
size *= MIN(sx, sy);
if (size >= pango_font_description_get_size (data->base_font)) {
if (size < data->size)
data->size = size;
if (size < data->em_size)
data->em_size = size;
}
}
static void
@ -407,19 +408,21 @@ calculate_font_size_section_callback (EekElement *element, gpointer user_data)
}
static gdouble
calculate_font_size (EekRenderer *renderer, const PangoFontDescription *base_font)
calculate_font_size (EekRenderer *renderer,
const PangoFontDescription *base_font,
gboolean ascii)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
CalculateFontSizeCallbackData data;
data.size = G_MAXDOUBLE;
data.em_size = G_MAXDOUBLE;
data.ascii = ascii;
data.renderer = renderer;
data.base_font = base_font;
eek_container_foreach_child (EEK_CONTAINER(priv->keyboard),
calculate_font_size_section_callback,
&data);
return data.size > 0 ? data.size : data.em_size;
return data.size;
}
static void
@ -479,7 +482,6 @@ render_key (EekRenderer *self,
PangoLayout *layout;
PangoRectangle extents = { 0, };
EekColor foreground;
EekThemeNode *theme_node;
layout = pango_cairo_create_layout (cr);
eek_renderer_render_key_label (self, layout, key);
@ -491,11 +493,6 @@ render_key (EekRenderer *self,
(bounds.width * priv->scale - extents.width / PANGO_SCALE) / 2,
(bounds.height * priv->scale - extents.height / PANGO_SCALE) / 2);
if (eek_key_is_pressed (key))
theme_node = g_object_get_data (G_OBJECT(key), "theme-node-pressed");
else
theme_node = g_object_get_data (G_OBJECT(key), "theme-node");
eek_renderer_get_foreground_color (self, EEK_ELEMENT(key), &foreground);
cairo_set_source_rgba (cr,
foreground.red,
@ -538,6 +535,23 @@ eek_renderer_apply_transformation_for_key (EekRenderer *self,
}
}
static const TextProperty *
get_text_property_for_category (EekSymbolCategory category)
{
static const TextProperty props[EEK_SYMBOL_CATEGORY_LAST] = {
{ EEK_SYMBOL_CATEGORY_LETTER, FALSE, 1.0, FALSE },
{ EEK_SYMBOL_CATEGORY_FUNCTION, TRUE, 0.5, FALSE },
{ EEK_SYMBOL_CATEGORY_KEYNAME, TRUE, 0.5, TRUE }
};
gint i;
for (i = 0; i < G_N_ELEMENTS(props); i++)
if (props[i].category == category)
return &props[i];
g_return_val_if_reached (NULL);
}
static void
eek_renderer_real_render_key_label (EekRenderer *self,
PangoLayout *layout,
@ -548,9 +562,9 @@ eek_renderer_real_render_key_label (EekRenderer *self,
EekSymbolCategory category;
const gchar *label;
EekBounds bounds;
const TextProperty *prop;
PangoFontDescription *font;
gdouble size, scale;
gint i;
gdouble scale;
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (!symbol)
@ -562,7 +576,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
if (!priv->font) {
const PangoFontDescription *base_font;
gdouble size;
gdouble ascii_size, size;
EekThemeNode *theme_node;
theme_node = g_object_get_data (G_OBJECT(key), "theme-node");
@ -570,7 +584,11 @@ eek_renderer_real_render_key_label (EekRenderer *self,
base_font = eek_theme_node_get_font (theme_node);
else
base_font = pango_context_get_font_description (priv->pcontext);
size = calculate_font_size (self, base_font);
ascii_size = calculate_font_size (self, base_font, TRUE);
priv->ascii_font = pango_font_description_copy (base_font);
pango_font_description_set_size (priv->ascii_font, ascii_size);
size = calculate_font_size (self, base_font, FALSE);
priv->font = pango_font_description_copy (base_font);
pango_font_description_set_size (priv->font, size);
}
@ -579,20 +597,22 @@ eek_renderer_real_render_key_label (EekRenderer *self,
scale = MIN((bounds.width - priv->border_width) / bounds.width,
(bounds.height - priv->border_width) / bounds.height);
font = pango_font_description_copy (priv->font);
size = pango_font_description_get_size (font);
category = eek_symbol_get_category (symbol);
for (i = 0; i < G_N_ELEMENTS(symbol_category_scale_factors); i++)
if (symbol_category_scale_factors[i].category == category) {
size *= symbol_category_scale_factors[i].scale;
break;
}
pango_font_description_set_size (font, size * priv->scale * scale);
prop = get_text_property_for_category (category);
font = pango_font_description_copy (prop->ascii ?
priv->ascii_font :
priv->font);
pango_font_description_set_size (font,
pango_font_description_get_size (font) *
prop->scale * priv->scale * scale);
pango_layout_set_font_description (layout, font);
pango_font_description_free (font);
pango_layout_set_text (layout, label, -1);
pango_layout_set_width (layout,
PANGO_SCALE * bounds.width * priv->scale * scale);
if (prop->ellipses)
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
}
@ -719,6 +739,7 @@ eek_renderer_finalize (GObject *object)
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(object);
g_hash_table_destroy (priv->outline_surface_cache);
g_hash_table_destroy (priv->active_outline_surface_cache);
pango_font_description_free (priv->ascii_font);
pango_font_description_free (priv->font);
G_OBJECT_CLASS (eek_renderer_parent_class)->finalize (object);
}
@ -1114,7 +1135,6 @@ eek_renderer_get_background_gradient (EekRenderer *renderer,
EekColor *start,
EekColor *end)
{
EekRendererPrivate *priv;
EekThemeNode *theme_node;
g_return_if_fail (EEK_IS_RENDERER(renderer));
@ -1123,8 +1143,6 @@ eek_renderer_get_background_gradient (EekRenderer *renderer,
g_return_if_fail (start);
g_return_if_fail (end);
priv = EEK_RENDERER_GET_PRIVATE(renderer);
theme_node = g_object_get_data (G_OBJECT(element), "theme-node");
if (theme_node)
eek_theme_node_get_background_gradient (theme_node, type, start, end);
@ -1207,11 +1225,8 @@ find_key_by_position_section_callback (EekElement *element,
{
FindKeyByPositionCallbackData *data = user_data;
EekBounds bounds;
EekRendererPrivate *priv;
EekPoint origin;
priv = EEK_RENDERER_GET_PRIVATE(data->renderer);
origin = data->origin;
eek_element_get_bounds (element, &bounds);
data->origin.x += bounds.x;

View File

@ -54,6 +54,8 @@ struct _EekSection
* @create_key: virtual function for creating key in the section
* @find_key_by_keycode: virtual function for accessing a key in the
* section by keycode
* @key_pressed: class handler for #EekSection::key-pressed signal
* @key_released: class handler for #EekSection::key-released signal
*/
struct _EekSectionClass
{

105
eek/eek-symbol-matrix.c Normal file
View File

@ -0,0 +1,105 @@
/*
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2011 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-symbol-matrix.h"
EekSymbolMatrix *
eek_symbol_matrix_new (gint num_groups,
gint num_levels)
{
EekSymbolMatrix *matrix = g_slice_new (EekSymbolMatrix);
matrix->num_groups = num_groups;
matrix->num_levels = num_levels;
matrix->data = g_slice_alloc0 (sizeof (EekSymbol *) *
num_groups * num_levels);
return matrix;
}
EekSymbolMatrix *
eek_symbol_matrix_copy (const EekSymbolMatrix *matrix)
{
EekSymbolMatrix *retval;
gint i, num_symbols = matrix->num_groups * matrix->num_levels;
retval = g_slice_dup (EekSymbolMatrix, matrix);
retval->data = g_slice_copy (sizeof (EekSymbol *) * num_symbols,
matrix->data);
for (i = 0; i < num_symbols; i++)
if (retval->data[i])
g_object_ref (retval->data[i]);
return retval;
}
void
eek_symbol_matrix_free (EekSymbolMatrix *matrix)
{
gint i, num_symbols = matrix->num_groups * matrix->num_levels;
for (i = 0; i < num_symbols; i++)
if (matrix->data[i])
g_object_unref (matrix->data[i]);
g_slice_free1 (sizeof (EekSymbol *) * num_symbols, matrix->data);
g_slice_free (EekSymbolMatrix, matrix);
}
GType
eek_symbol_matrix_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekSymbolMatrix",
(GBoxedCopyFunc)eek_symbol_matrix_copy,
(GBoxedFreeFunc)eek_symbol_matrix_free);
return our_type;
}
void
eek_symbol_matrix_set_symbol (EekSymbolMatrix *matrix,
gint group,
gint level,
EekSymbol *symbol)
{
g_return_if_fail (group >= 0 && group < matrix->num_groups);
g_return_if_fail (level >= 0 && level < matrix->num_levels);
g_return_if_fail (EEK_IS_SYMBOL(symbol));
matrix->data[group * matrix->num_levels + level] = g_object_ref (symbol);
}
/**
* eek_symbol_matrix_get_symbol:
* @matrix: an #EekSymbolMatrix
* @group: group index of @matrix
* @level: level index of @matrix
*
* Get an #EekSymbol stored in the cell selected by (@group, @level)
* in @matrix.
*
* Return value: (transfer none): an #EekSymbol.
*/
EekSymbol *
eek_symbol_matrix_get_symbol (EekSymbolMatrix *matrix,
gint group,
gint level)
{
g_return_val_if_fail (group >= 0 && group < matrix->num_groups, NULL);
g_return_val_if_fail (level >= 0 && level < matrix->num_levels, NULL);
return matrix->data[group * matrix->num_levels + level];
}

61
eek/eek-symbol-matrix.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2011 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_SYMBOL_MATRIX_H
#define EEK_SYMBOL_MATRIX_H 1
#include "eek-symbol.h"
G_BEGIN_DECLS
/**
* EekSymbolMatrix:
* @data: array of symbols
* @num_groups: the number of groups (rows)
* @num_levels: the number of levels (columns)
*
* Symbol matrix of a key.
*/
struct _EekSymbolMatrix
{
gint num_groups;
gint num_levels;
EekSymbol **data;
};
#define EEK_TYPE_SYMBOL_MATRIX (eek_symbol_matrix_get_type ())
GType eek_symbol_matrix_get_type (void) G_GNUC_CONST;
EekSymbolMatrix *eek_symbol_matrix_new (gint num_groups,
gint num_levels);
EekSymbolMatrix *eek_symbol_matrix_copy (const EekSymbolMatrix *matrix);
void eek_symbol_matrix_free (EekSymbolMatrix *matrix);
void eek_symbol_matrix_set_symbol
(EekSymbolMatrix *matrix,
gint group,
gint level,
EekSymbol *symbol);
EekSymbol *eek_symbol_matrix_get_symbol
(EekSymbolMatrix *matrix,
gint group,
gint level);
G_END_DECLS
#endif /* EEK_SYMBOL_MATRIX_H */

View File

@ -31,6 +31,7 @@
#include "eek-symbol.h"
#include "eek-serializable.h"
#include "eek-enumtypes.h"
enum {
PROP_0,
@ -110,11 +111,11 @@ eek_symbol_set_property (GObject *object,
eek_symbol_set_label (EEK_SYMBOL(object), g_value_get_string (value));
break;
case PROP_CATEGORY:
eek_symbol_set_category (EEK_SYMBOL(object), g_value_get_uint (value));
eek_symbol_set_category (EEK_SYMBOL(object), g_value_get_enum (value));
break;
case PROP_MODIFIER_MASK:
eek_symbol_set_modifier_mask (EEK_SYMBOL(object),
g_value_get_uint (value));
g_value_get_flags (value));
break;
case PROP_ICON_NAME:
eek_symbol_set_icon_name (EEK_SYMBOL(object),
@ -142,10 +143,10 @@ eek_symbol_get_property (GObject *object,
g_value_set_string (value, eek_symbol_get_label (EEK_SYMBOL(object)));
break;
case PROP_CATEGORY:
g_value_set_uint (value, eek_symbol_get_category (EEK_SYMBOL(object)));
g_value_set_enum (value, eek_symbol_get_category (EEK_SYMBOL(object)));
break;
case PROP_MODIFIER_MASK:
g_value_set_uint (value,
g_value_set_flags (value,
eek_symbol_get_modifier_mask (EEK_SYMBOL(object)));
break;
case PROP_ICON_NAME:
@ -197,17 +198,19 @@ eek_symbol_class_init (EekSymbolClass *klass)
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_LABEL, pspec);
pspec = g_param_spec_uint ("category",
pspec = g_param_spec_enum ("category",
"Category",
"Category of the symbol",
0, G_MAXUINT, 0,
EEK_TYPE_SYMBOL_CATEGORY,
EEK_SYMBOL_CATEGORY_UNKNOWN,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_CATEGORY, pspec);
pspec = g_param_spec_uint ("modifier-mask",
pspec = g_param_spec_flags ("modifier-mask",
"Modifier mask",
"Modifier mask of the symbol",
0, G_MAXUINT, 0,
EEK_TYPE_MODIFIER_TYPE,
0,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_MODIFIER_MASK, pspec);
@ -361,8 +364,9 @@ eek_symbol_get_category (EekSymbol *symbol)
/**
* eek_symbol_set_modifier_mask:
* @symbol: an #EekSymbol
* @mask: an #EekModifierType
*
* Set modifier mask @symbol can trigger.
* Set modifier mask that @symbol can trigger.
*/
void
eek_symbol_set_modifier_mask (EekSymbol *symbol,
@ -380,7 +384,7 @@ eek_symbol_set_modifier_mask (EekSymbol *symbol,
* eek_symbol_get_modifier_mask:
* @symbol: an #EekSymbol
*
* Get modifier mask @symbol can trigger.
* Get modifier mask that @symbol can trigger.
*/
EekModifierType
eek_symbol_get_modifier_mask (EekSymbol *symbol)

View File

@ -20,7 +20,6 @@
#ifndef EEK_SYMBOL_H
#define EEK_SYMBOL_H 1
#include <glib-object.h>
#include "eek-types.h"
G_BEGIN_DECLS
@ -37,6 +36,7 @@ G_BEGIN_DECLS
* @EEK_SYMBOL_CATEGORY_USER3: reserved for future use
* @EEK_SYMBOL_CATEGORY_USER4: reserved for future use
* @EEK_SYMBOL_CATEGORY_UNKNOWN: used for error reporting
* @EEK_SYMBOL_CATEGORY_LAST: the last symbol category
*
* Category of the key symbols.
*/
@ -50,7 +50,6 @@ typedef enum {
EEK_SYMBOL_CATEGORY_USER3,
EEK_SYMBOL_CATEGORY_USER4,
EEK_SYMBOL_CATEGORY_UNKNOWN,
/*< private >*/
EEK_SYMBOL_CATEGORY_LAST = EEK_SYMBOL_CATEGORY_UNKNOWN
} EekSymbolCategory;

View File

@ -121,7 +121,8 @@ eek_theme_context_changed (EekThemeContext *context)
/**
* eek_theme_context_set_theme:
* @context: a #EekThemeContext
* @context: an #EekThemeContext
* @theme: an #EekTheme
*
* Sets the default set of theme stylesheets for the context. This theme will
* be used for the root node and for nodes descending from it, unless some other

View File

@ -28,7 +28,7 @@
G_BEGIN_DECLS
/**
* SECTION:EekThemeContext
* SECTION:eek-theme-context
* @short_description: holds global information about a tree of styled objects
*
* #EekThemeContext is responsible for managing information global to

View File

@ -26,12 +26,12 @@
G_BEGIN_DECLS
/**
* SECTION:EekThemeNode
* SECTION:eek-theme-node
* @short_description: style information for one node in a tree of
* themed objects
*
* A #EekThemeNode represents the CSS style information (the set of
* CSS properties) for one node in a tree of themed objects. In
* The #EekThemeNode class represents the CSS style information (the
* set of CSS properties) for one node in a tree of themed objects. In
* typical usage, it represents the style information for a single
* #EekElement. A #EekThemeNode is immutable: attributes such as the
* CSS classes for the node are passed in at construction. If the

View File

@ -32,84 +32,21 @@
#include "eek-types.h"
/* EekSymbolMatrix */
EekSymbolMatrix *
eek_symbol_matrix_new (gint num_groups, gint num_levels)
{
EekSymbolMatrix *matrix = g_slice_new (EekSymbolMatrix);
matrix->num_groups = num_groups;
matrix->num_levels = num_levels;
matrix->data = g_slice_alloc0 (sizeof (EekSymbol *) *
num_groups * num_levels);
return matrix;
}
EekSymbolMatrix *
eek_symbol_matrix_copy (const EekSymbolMatrix *matrix)
{
EekSymbolMatrix *retval;
gint i, num_symbols = matrix->num_groups * matrix->num_levels;
retval = g_slice_dup (EekSymbolMatrix, matrix);
retval->data = g_slice_copy (sizeof (EekSymbol *) * num_symbols,
matrix->data);
for (i = 0; i < num_symbols; i++)
if (retval->data[i])
g_object_ref (retval->data[i]);
return retval;
}
void
eek_symbol_matrix_free (EekSymbolMatrix *matrix)
{
gint i, num_symbols = matrix->num_groups * matrix->num_levels;
for (i = 0; i < num_symbols; i++)
if (matrix->data[i])
g_object_unref (matrix->data[i]);
g_slice_free1 (sizeof (EekSymbol *) * num_symbols, matrix->data);
g_slice_free (EekSymbolMatrix, matrix);
}
GType
eek_symbol_matrix_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekSymbolMatrix",
(GBoxedCopyFunc)eek_symbol_matrix_copy,
(GBoxedFreeFunc)eek_symbol_matrix_free);
return our_type;
}
/* EekPoint */
static EekPoint *
G_DEFINE_BOXED_TYPE(EekPoint, eek_point, eek_point_copy, eek_point_free);
EekPoint *
eek_point_copy (const EekPoint *point)
{
return g_slice_dup (EekPoint, point);
}
static void
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;
}
void
eek_point_rotate (EekPoint *point, gint angle)
{
@ -123,32 +60,24 @@ eek_point_rotate (EekPoint *point, gint angle)
}
/* EekBounds */
static EekBounds *
G_DEFINE_BOXED_TYPE(EekBounds, eek_bounds, eek_bounds_copy, eek_bounds_free);
EekBounds *
eek_bounds_copy (const EekBounds *bounds)
{
return g_slice_dup (EekBounds, bounds);
}
static void
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 */
G_DEFINE_BOXED_TYPE(EekOutline, eek_outline,
eek_outline_copy, eek_outline_free);
EekOutline *
eek_outline_copy (const EekOutline *outline)
{
@ -167,20 +96,9 @@ 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;
}
/* EekColor */
G_DEFINE_BOXED_TYPE(EekColor, eek_color, eek_color_copy, eek_color_free);
EekColor *
eek_color_copy (const EekColor *color)
{
@ -193,19 +111,6 @@ eek_color_free (EekColor *color)
g_slice_free (EekColor, color);
}
GType
eek_color_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type =
g_boxed_type_register_static ("EekColor",
(GBoxedCopyFunc)eek_color_copy,
(GBoxedFreeFunc)eek_color_free);
return our_type;
}
EekColor *
eek_color_new (gdouble red,
gdouble green,

View File

@ -26,7 +26,6 @@ G_BEGIN_DECLS
#define I_(string) g_intern_static_string (string)
#define EEK_TYPE_SYMBOL_MATRIX (eek_symbol_matrix_get_type ())
#define EEK_TYPE_POINT (eek_point_get_type ())
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
#define EEK_TYPE_OUTLINE (eek_outline_get_type ())
@ -141,33 +140,10 @@ typedef struct _EekThemeContext EekThemeContext;
typedef struct _EekThemeNode EekThemeNode;
typedef struct _EekSymbolMatrix EekSymbolMatrix;
typedef struct _EekPoint EekPoint;
typedef struct _EekBounds EekBounds;
typedef struct _EekOutline EekOutline;
typedef struct _EekColor EekColor;
/**
* EekSymbolMatrix:
* @data: array of symbols
* @num_groups: the number of groups (rows)
* @num_levels: the number of levels (columns)
*
* Symbol matrix of a key.
*/
struct _EekSymbolMatrix
{
gint num_groups;
gint num_levels;
EekSymbol **data;
};
GType eek_symbol_matrix_get_type
(void) G_GNUC_CONST;
EekSymbolMatrix * eek_symbol_matrix_new (gint num_groups,
gint num_levels);
EekSymbolMatrix *eek_symbol_matrix_copy (const EekSymbolMatrix *matrix);
void eek_symbol_matrix_free (EekSymbolMatrix *matrix);
/**
* EekPoint:
* @x: X coordinate of the point
@ -175,6 +151,7 @@ void eek_symbol_matrix_free (EekSymbolMatrix *matrix);
*
* 2D vertex
*/
typedef struct _EekPoint EekPoint;
struct _EekPoint
{
gdouble x;
@ -182,6 +159,8 @@ struct _EekPoint
};
GType eek_point_get_type (void) G_GNUC_CONST;
EekPoint *eek_point_copy (const EekPoint *point);
void eek_point_free (EekPoint *point);
void eek_point_rotate (EekPoint *point,
gint angle);
@ -196,7 +175,6 @@ void eek_point_rotate (EekPoint *point,
*/
struct _EekBounds
{
/*< public >*/
gdouble x;
gdouble y;
gdouble width;
@ -204,6 +182,8 @@ struct _EekBounds
};
GType eek_bounds_get_type (void) G_GNUC_CONST;
EekBounds *eek_bounds_copy (const EekBounds *bounds);
void eek_bounds_free (EekBounds *bounds);
G_INLINE_FUNC gdouble
eek_bounds_long_side (EekBounds *bounds)

View File

@ -127,7 +127,7 @@ create_key (EekXkbLayout *layout,
EekSymbolMatrix *matrix = NULL;
gchar name[XkbKeyNameLength + 1];
KeyCode keycode;
gint num_groups, num_levels, num_symbols;
gint num_groups, num_levels;
gulong oref;
xkbgeometry = priv->xkb->geom;
@ -199,7 +199,6 @@ create_key (EekXkbLayout *layout,
num_groups = XkbKeyNumGroups (priv->xkb, keycode);
num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
num_symbols = num_groups * num_levels;
matrix = eek_symbol_matrix_new (num_groups, num_levels);
for (i = 0; i < num_groups; i++)
for (j = 0; j < num_levels; j++) {

View File

@ -590,6 +590,10 @@ eek_xml_layout_real_create_keyboard (EekLayout *self,
if (data.oref_outline_hash)
g_hash_table_destroy (data.oref_outline_hash);
/* use pre-defined modifier mask here */
eek_keyboard_set_num_lock_mask (data.keyboard, EEK_MOD2_MASK);
eek_keyboard_set_alt_gr_mask (data.keyboard, EEK_MOD5_MASK);
return data.keyboard;
}

View File

@ -188,6 +188,8 @@ on_context_destroyed (EekboardContext *context,
* @cancellable: a #GCancellable
*
* Create a new input context.
*
* Return value: (transfer full): a newly created #EekboardContext.
*/
EekboardContext *
eekboard_eekboard_create_context (EekboardEekboard *eekboard,

1
examples/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = eekboard-inscript simple-client

View File

@ -0,0 +1,14 @@
bin_SCRIPTS = eekboard-inscript
keyboarddir = $(pkgdatadir)/keyboards
eekboard_inscript_datadir = $(datarootdir)/eekboard-inscript
eekboard_inscript_data_PYTHON = inscript.py main.py
eekboard-inscript: eekboard-inscript.in
$(AM_V_GEN) sed -e 's!@''PYTHON@!'$(PYTHON)'!' \
-e 's!@EEKBOARD_KEYBOARDDIR@!'$(keyboarddir)'!' \
-e 's!@M17N_DIR@!'$(datadir)/m17n'!' \
-e 's!@EEKBOARD_INSCRIPT_DATADIR@!'$(eekboard_inscript_datadir)'!' < $< > $@
CLEANFILES = eekboard-inscript
EXTRA_DIST = eekboard-inscript.in

View File

@ -0,0 +1,23 @@
#!/bin/sh
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 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
export EEKBOARD_KEYBOARDDIR=@EEKBOARD_KEYBOARDDIR@
export M17N_DIR=@M17N_DIR@
exec @PYTHON@ @EEKBOARD_INSCRIPT_DATADIR@/main.py $@

View File

@ -0,0 +1,226 @@
#!/usr/bin/env python
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 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
import eekboard
import gobject, gtk, virtkey
import sys, os.path, re
KEYCODE_TABLE = {
'1': 10, '2': 11, '3': 12, '4': 13, '5': 14, '6': 15, '7': 16, '8': 17,
'9': 18, '0': 19, '-': 20, '=': 21, 'q': 24, 'w': 25, 'e': 26, 'r': 27,
't': 28, 'y': 29, 'u': 30, 'i': 31, 'o': 32, 'p': 33, '[': 34, ']': 35,
'a': 38, 's': 39, 'd': 40, 'f': 41, 'g': 42, 'h': 43, 'j': 44, 'k': 45,
'l': 46, ';': 47, '\'': 48, '`': 49, '\\': 51, 'z': 52, 'x': 53, 'c': 54,
'v': 55, 'b': 56, 'n': 57, 'm': 58, ',': 59, '.': 60, '/': 61
}
MARK_UPPER = '~!@#$%^&*()_+{}|:"<>?'
MARK_LOWER = '`1234567890-=[]\\;\',./'
INSCRIPT_MAPS = (
"as-inscript",
"bn-inscript",
"gu-inscript",
"hi-inscript",
"kn-inscript",
"ml-inscript",
"mr-inscript",
"or-inscript",
"pa-inscript",
"sd-inscript",
"ta-inscript",
"te-inscript",
"kn-inscript2",
"kok-inscript2-deva",
"mai-inscript2",
"ml-inscript2",
"mni-inscript2-beng",
"mni-inscript2-mtei",
"mr-inscript2",
"ne-inscript2-deva",
"or-inscript2",
"pa-inscript2-guru",
"sa-inscript2",
"sat-inscript2-deva",
"sat-inscript2-olck",
"sd-inscript2-deva",
"ta-inscript2",
"te-inscript2")
class MapFile(object):
MAPENTRY_PATTERN = re.compile(r'\A\s*\((?:\((.*?)\)|"(.*?)")\s*"(.*?)"\)')
def __init__(self, path):
self.__dict = dict()
with open(path, 'r') as fp:
for line in fp:
match = re.match(self.MAPENTRY_PATTERN, line)
if match:
insert = match.group(3).decode('UTF-8')
if match.group(1):
keyseq = re.sub(r'\\(.)', r'\1', match.group(1))
self.__add_symbol_entry(keyseq, insert)
else:
keyseq = re.sub(r'\\(.)', r'\1', match.group(2))
self.__add_text_entry(keyseq, insert)
def get_entry_for_keycode(self, keycode):
return self.__dict.get(keycode)
def __add_entry(self, letter, level, insert):
if letter.isupper():
level |= 1
letter = letter.lower()
elif letter in MARK_UPPER:
level |= 1
letter = MARK_LOWER[MARK_UPPER.index(letter)]
keycode = KEYCODE_TABLE[letter]
if keycode not in self.__dict:
self.__dict[keycode] = list([None,None,None,None])
self.__dict[keycode][level] = insert
def __add_symbol_entry(self, symbol, insert):
level = 0
if symbol.startswith('G-'):
level |= 2
symbol = symbol[2:]
if not symbol.startswith('KP_'):
self.__add_entry(symbol, level, insert)
def __add_text_entry(self, text, insert):
self.__add_entry(text, 0, insert)
class Keyboard(gobject.GObject):
__gtype_name__ = "PYInscriptKeyboard"
__gsignals__ = {
'quit': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
}
def __init__(self, client_name, map_path, kbd_path):
super(Keyboard, self).__init__()
self.__keyboard = self.__create_keyboard(map_path, kbd_path)
self.__eekboard = eekboard.Eekboard()
self.__context = self.__eekboard.create_context(client_name)
keyboard_id = self.__context.add_keyboard(self.__keyboard)
self.__context.set_keyboard(keyboard_id)
self.__keyboard.connect('key-pressed', self.__key_pressed_cb)
self.__keyboard.connect('key-released', self.__key_released_cb)
self.__virtkey = virtkey.virtkey()
self.__english = False
self.__eekboard.connect('destroyed', self.__destroyed_cb)
self.__context.connect('destroyed', self.__destroyed_cb)
self.__context.connect('notify::keyboard-visible', self.__notify_keyboard_visible_cb)
def __create_keyboard(self, map_path, kbd_path):
def __each_key(element, data):
keycode = element.get_keycode()
# keycode 37 is used to toggle English/Inscript
if keycode == 37:
matrix = eekboard.SymbolMatrix.new(2, 1)
keysym = eekboard.Keysym.new(0)
keysym.set_label("Ind")
keysym.set_category(eekboard.SymbolCategory.FUNCTION)
matrix.set_symbol(0, 0, keysym)
keysym = eekboard.Keysym.new(0)
keysym.set_label("Eng")
keysym.set_category(eekboard.SymbolCategory.FUNCTION)
matrix.set_symbol(1, 0, keysym)
element.set_symbol_matrix(matrix)
return
# group(0) is us keyboard
matrix = eekboard.SymbolMatrix.new(2, 4)
for l in xrange(4):
keysym = element.get_symbol_at_index(0, l, 0, 0)
matrix.set_symbol(0, l, keysym)
# group(1) is inscript keyboard
entry = data.get_entry_for_keycode(keycode)
for l in xrange(4):
if entry and entry[l]:
try:
keyval = gtk.gdk.unicode_to_keyval(ord(entry[l]))
keysym = eekboard.Keysym.new(keyval)
except:
keysym = eekboard.Keysym.new(0)
keysym.set_label(entry[l].encode('UTF-8'))
keysym.set_category(eekboard.SymbolCategory.LETTER)
print >> sys.stderr, "can't convert %s (%d) to keyval" % (entry[l], keycode)
else:
keysym = element.get_symbol_at_index(1, l, 0, 0)
matrix.set_symbol(1, l, keysym)
element.set_symbol_matrix(matrix)
def __each_section(element, data):
element.foreach_child(__each_key, data)
mapfile = MapFile(map_path)
keyboard = eekboard.XmlKeyboard(kbd_path,
eekboard.MODIFIER_BEHAVIOR_LATCH)
keyboard.foreach_child(__each_section, mapfile)
return keyboard
def __destroyed_cb(self, *args):
self.emit('quit')
def __notify_keyboard_visible_cb(self, obj, pspec):
if not obj.get_property(pspec.name):
self.emit('quit')
def enable(self):
self.__eekboard.push_context(self.__context)
def disable(self):
self.__eekboard.pop_context(self.__context)
def show(self):
self.__context.show_keyboard()
def set_group(self, group):
self.__group = group
self.__context.set_group(self.__group)
def __key_pressed_cb(self, keyboard, key):
if key.get_keycode() == 37:
return
symbol = key.get_symbol()
if isinstance(symbol, eekboard.Keysym):
xkeysym = symbol.get_xkeysym()
modifiers = self.__keyboard.get_modifiers()
self.__virtkey.latch_mod(modifiers)
self.__virtkey.press_keysym(xkeysym)
self.__virtkey.unlatch_mod(modifiers)
def __key_released_cb(self, keyboard, key):
if key.get_keycode() == 37:
if self.__english:
self.__context.set_group(self.__group)
self.__english = False
else:
self.__context.set_group(0)
self.__english = True
return
symbol = key.get_symbol()
if isinstance(symbol, eekboard.Keysym):
xkeysym = symbol.get_xkeysym()
self.__virtkey.release_keysym(xkeysym)

View File

@ -0,0 +1,60 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 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
import inscript
import gtk
from optparse import OptionParser
import sys, os, os.path, glob
parser = OptionParser()
parser.add_option("-n", "--name=LANGCODE", dest="langcode",
help="Specify language code to LANGCODE",
metavar="LANGCODE")
parser.add_option("-l", "--list", dest="list", default=False,
action="store_true",
help="List available language codes")
(options, args) = parser.parse_args()
if options.list:
pat = os.path.join(os.getenv("M17N_DIR"), "*.mim")
for fname in sorted(glob.glob(pat)):
mname = os.path.basename(fname[:-4])
if mname in inscript.INSCRIPT_MAPS:
print mname
exit(0)
if options.langcode is None:
print >> sys.stderr, "Specify language code with -n"
exit(1)
map_path = os.path.join(os.getenv("M17N_DIR"), options.langcode + ".mim")
if not os.path.exists(map_path):
print >> sys.stderr, "%s not found" % map_path
exit(1)
kbd_path = os.path.join(os.getenv("EEKBOARD_KEYBOARDDIR"), "us-qwerty.xml")
if not os.path.exists(kbd_path):
print >> sys.stderr, "%s not found" % kbd_path
exit(1)
keyboard = inscript.Keyboard("eekboard-inscript", map_path, kbd_path)
keyboard.connect('quit', lambda *args: gtk.main_quit())
keyboard.set_group(1)
keyboard.enable()
keyboard.show()
gtk.main()

View File

@ -0,0 +1,12 @@
noinst_PROGRAMS = simple-client
simple_client_CFLAGS = \
-I$(top_srcdir) \
$(GIO2_CFLAGS)
simple_client_LDADD = \
$(top_builddir)/eekboard/libeekboard.la \
$(top_builddir)/eek/libeek.la \
$(GIO2_LIBS)
simple_client_SOURCES = main.c

View File

@ -0,0 +1,217 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* 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/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <glib/gi18n.h>
#include "eekboard/eekboard.h"
static gboolean opt_system = FALSE;
static gboolean opt_session = FALSE;
static gchar *opt_address = NULL;
static gchar *opt_set_keyboard = NULL;
static gint opt_set_group = -1;
static gboolean opt_show_keyboard = FALSE;
static gboolean opt_hide_keyboard = FALSE;
static gint opt_press_key = -1;
static gint opt_release_key = -1;
static gboolean opt_listen = FALSE;
static const GOptionEntry options[] = {
{"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
N_("Connect to the system bus")},
{"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
N_("Connect to the session bus")},
{"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
N_("Connect to the given D-Bus address")},
{"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard,
N_("Upload keyboard description from an XML file")},
{"set-group", '\0', 0, G_OPTION_ARG_INT, &opt_set_group,
N_("Set group of the keyboard")},
{"show-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_show_keyboard,
N_("Show keyboard")},
{"hide-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_hide_keyboard,
N_("Hide keyboard")},
{"press-key", '\0', 0, G_OPTION_ARG_INT, &opt_press_key,
N_("Press key")},
{"release-key", '\0', 0, G_OPTION_ARG_INT, &opt_release_key,
N_("Release key")},
{"listen", '\0', 0, G_OPTION_ARG_NONE, &opt_listen,
N_("Listen events")},
{NULL}
};
static void
on_key_pressed (guint keycode, gpointer user_data)
{
g_print ("KeyPressed %u\n", keycode);
}
static void
on_key_released (guint keycode, gpointer user_data)
{
g_print ("KeyReleased %u\n", keycode);
}
int
main (int argc, char **argv)
{
EekboardEekboard *eekboard = NULL;
EekboardContext *context = NULL;
GBusType bus_type;
GDBusConnection *connection = NULL;
GError *error;
GOptionContext *option_context;
GMainLoop *loop = NULL;
gint retval = 0;
g_type_init ();
g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
option_context = g_option_context_new ("eekboard-client");
g_option_context_add_main_entries (option_context, options, NULL);
g_option_context_parse (option_context, &argc, &argv, NULL);
g_option_context_free (option_context);
if (opt_system)
bus_type = G_BUS_TYPE_SYSTEM;
else if (opt_address)
bus_type = G_BUS_TYPE_NONE;
else
bus_type = G_BUS_TYPE_SESSION;
switch (bus_type) {
case G_BUS_TYPE_SYSTEM:
case G_BUS_TYPE_SESSION:
error = NULL;
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
g_printerr ("Can't connect to the bus: %s\n", error->message);
exit (1);
}
break;
case G_BUS_TYPE_NONE:
error = NULL;
connection = g_dbus_connection_new_for_address_sync (opt_address,
0,
NULL,
NULL,
&error);
if (connection == NULL) {
g_printerr ("Can't connect to the bus at %s: %s\n",
opt_address,
error->message);
exit (1);
}
break;
default:
g_assert_not_reached ();
break;
}
eekboard = eekboard_eekboard_new (connection, NULL);
if (eekboard == NULL) {
g_printerr ("Can't create eekboard proxy\n");
retval = 1;
goto out;
}
context = eekboard_eekboard_create_context (eekboard,
"eekboard-client",
NULL);
if (context == NULL) {
g_printerr ("Can't create context\n");
retval = 1;
goto out;
}
eekboard_eekboard_push_context (eekboard, context, NULL);
if (opt_set_keyboard) {
GFile *file;
GFileInputStream *input;
EekLayout *layout;
EekKeyboard *keyboard;
guint keyboard_id;
file = g_file_new_for_path (opt_set_keyboard);
error = NULL;
input = g_file_read (file, NULL, &error);
if (error) {
g_printerr ("Can't read file %s: %s\n",
opt_set_keyboard, error->message);
retval = 1;
goto out;
}
layout = eek_xml_layout_new (G_INPUT_STREAM(input));
g_object_unref (input);
keyboard = eek_keyboard_new (layout, 640, 480);
g_object_unref (layout);
keyboard_id = eekboard_context_add_keyboard (context, keyboard, NULL);
g_object_unref (keyboard);
eekboard_context_set_keyboard (context, keyboard_id, NULL);
}
if (opt_set_group >= 0) {
eekboard_context_set_group (context, opt_set_group, NULL);
}
if (opt_show_keyboard) {
eekboard_context_show_keyboard (context, NULL);
}
if (opt_hide_keyboard) {
eekboard_context_hide_keyboard (context, NULL);
}
if (opt_press_key >= 0) {
eekboard_context_press_key (context, opt_press_key, NULL);
}
if (opt_release_key >= 0) {
eekboard_context_release_key (context, opt_release_key, NULL);
}
if (opt_listen) {
g_signal_connect (context, "key-pressed",
G_CALLBACK(on_key_pressed), NULL);
g_signal_connect (context, "key-released",
G_CALLBACK(on_key_released), NULL);
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
}
out:
if (context)
g_object_unref (context);
if (connection)
g_object_unref (connection);
if (loop)
g_main_loop_unref (loop);
return retval;
}

View File

@ -1,7 +1,7 @@
src/server-server.c
src/server-context.c
src/client-main.c
src/desktop-client.c
src/desktop-client-main.c
src/xml-main.c
src/server-main.c
src/client.c
src/client-main.c
src/xml-main.c
examples/simple-client/main.c

View File

@ -18,48 +18,46 @@
if ENABLE_EEKBOARD
bin_PROGRAMS = \
eekboard-desktop-client \
eekboard-client \
eekboard \
eekboard-server \
eekboard-xml
noinst_LTLIBRARIES = libxklutil.la
eekboard_desktop_client_CFLAGS = \
eekboard_CFLAGS = \
-I$(top_srcdir) \
$(GIO2_CFLAGS) \
$(GTK_CFLAGS) \
$(GCONF2_CFLAGS) \
$(XKB_CFLAGS) \
$(LIBXKLAVIER_CFLAGS)
$(LIBXKLAVIER_CFLAGS) \
-DKEYBOARDDIR=\"$(pkgdatadir)/keyboards\"
eekboard_desktop_client_LDADD = \
eekboard_LDADD = \
$(builddir)/libxklutil.la \
$(top_builddir)/eekboard/libeekboard.la \
$(top_builddir)/eek/libeek.la \
$(top_builddir)/eek/libeek-xkl.la \
$(GIO2_LIBS) \
$(GTK_LIBS) \
$(GCONF2_LIBS) \
$(XKB_LIBS) \
$(LIBXKLAVIER_LIBS)
if ENABLE_FAKEKEY
eekboard_desktop_client_CFLAGS += \
eekboard_CFLAGS += \
$(FAKEKEY_CFLAGS)
eekboard_desktop_client_LDADD += \
eekboard_LDADD += \
$(FAKEKEY_LIBS)
endif
if ENABLE_CSPI
eekboard_desktop_client_CFLAGS += \
$(CSPI_CFLAGS)
eekboard_desktop_client_LDADD += \
$(CSPI_LIBS)
if ENABLE_ATSPI
eekboard_CFLAGS += \
$(ATSPI2_CFLAGS)
eekboard_LDADD += \
$(ATSPI2_LIBS)
endif
eekboard_desktop_client_headers = desktop-client.h
eekboard_desktop_client_SOURCES = desktop-client.c desktop-client-main.c
eekboard_headers = client.h
eekboard_SOURCES = client.c client-main.c
eekboard_server_CFLAGS = \
-I$(top_srcdir) \
@ -82,17 +80,6 @@ endif
eekboard_server_headers = server-server.h server-context.h
eekboard_server_SOURCES = server-server.c server-context.c server-main.c
eekboard_client_CFLAGS = \
-I$(top_srcdir) \
$(GIO2_CFLAGS)
eekboard_client_LDADD = \
$(top_builddir)/eekboard/libeekboard.la \
$(top_builddir)/eek/libeek.la \
$(GIO2_LIBS)
eekboard_client_SOURCES = client-main.c
eekboard_xml_CFLAGS = \
-I$(top_srcdir) \
$(GIO2_CFLAGS) \
@ -125,8 +112,7 @@ eekboard_HEADERS = \
$(libeekboard_headers)
noinst_HEADERS = \
$(eekboard_desktop_client_headers) \
$(eekboard_client_headers) \
$(eekboard_headers) \
$(eekboard_server_headers) \
$(eekboard_xml_headers) \
$(libxklutil_la_headers)

View File

@ -20,21 +20,32 @@
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#ifdef HAVE_ATSPI
#include <dbus/dbus.h>
#include <atspi/atspi.h>
#endif /* HAVE_ATSPI */
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "eekboard/eekboard.h"
#include "client.h"
#define DEFAULT_LAYOUT "us-qwerty"
static gboolean opt_system = FALSE;
static gboolean opt_session = FALSE;
static gchar *opt_address = NULL;
static gchar *opt_set_keyboard = NULL;
static gint opt_set_group = -1;
static gboolean opt_show_keyboard = FALSE;
static gboolean opt_hide_keyboard = FALSE;
static gint opt_press_key = -1;
static gint opt_release_key = -1;
static gboolean opt_listen = FALSE;
static gboolean opt_use_system_layout = FALSE;
static gboolean opt_focus = FALSE;
static gboolean opt_keystroke = FALSE;
static gchar *opt_keyboard = NULL;
static gchar *opt_model = NULL;
static gchar *opt_layouts = NULL;
static gchar *opt_options = NULL;
static gboolean opt_fullscreen = FALSE;
static const GOptionEntry options[] = {
{"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
@ -43,51 +54,78 @@ static const GOptionEntry options[] = {
N_("Connect to the session bus")},
{"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
N_("Connect to the given D-Bus address")},
{"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard,
N_("Upload keyboard description from an XML file")},
{"set-group", '\0', 0, G_OPTION_ARG_INT, &opt_set_group,
N_("Set group of the keyboard")},
{"show-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_show_keyboard,
N_("Show keyboard")},
{"hide-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_hide_keyboard,
N_("Hide keyboard")},
{"press-key", '\0', 0, G_OPTION_ARG_INT, &opt_press_key,
N_("Press key")},
{"release-key", '\0', 0, G_OPTION_ARG_INT, &opt_release_key,
N_("Release key")},
{"listen", '\0', 0, G_OPTION_ARG_NONE, &opt_listen,
N_("Listen events")},
{"use-system-layout", 'x', 0, G_OPTION_ARG_NONE, &opt_use_system_layout,
N_("Use system keyboard layout")},
#ifdef HAVE_ATSPI
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
N_("Listen focus change events with AT-SPI")},
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
N_("Listen keystroke events with AT-SPI")},
#endif /* HAVE_ATSPI */
{"keyboard", 'k', 0, G_OPTION_ARG_STRING, &opt_keyboard,
N_("Specify keyboard")},
{"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
N_("Specify model")},
{"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
N_("Specify layouts")},
{"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
N_("Specify options")},
{"fullscreen", 'F', 0, G_OPTION_ARG_NONE, &opt_fullscreen,
N_("Create window in fullscreen mode")},
{NULL}
};
static void
on_key_pressed (guint keycode, gpointer user_data)
on_notify_keyboard_visible (GObject *object,
GParamSpec *spec,
gpointer user_data)
{
g_print ("KeyPressed %u\n", keycode);
GMainLoop *loop = user_data;
gboolean visible;
g_object_get (object, "keyboard-visible", &visible, NULL);
/* user explicitly closed the window */
if (!visible && eekboard_context_is_enabled (EEKBOARD_CONTEXT(object)))
g_main_loop_quit (loop);
}
static void
on_key_released (guint keycode, gpointer user_data)
on_context_destroyed (EekboardContext *context,
gpointer user_data)
{
g_print ("KeyReleased %u\n", keycode);
GMainLoop *loop = user_data;
g_main_loop_quit (loop);
}
static void
on_destroyed (EekboardEekboard *eekboard,
gpointer user_data)
{
GMainLoop *loop = user_data;
g_main_loop_quit (loop);
}
int
main (int argc, char **argv)
{
EekboardEekboard *eekboard = NULL;
EekboardContext *context = NULL;
EekboardClient *client;
EekboardEekboard *eekboard;
EekboardContext *context;
GBusType bus_type;
GDBusConnection *connection = NULL;
GDBusConnection *connection;
GError *error;
GOptionContext *option_context;
GMainLoop *loop = NULL;
gint retval = 0;
GMainLoop *loop;
g_type_init ();
g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
if (!gtk_init_check (&argc, &argv)) {
g_printerr ("Can't init GTK\n");
exit (1);
}
option_context = g_option_context_new ("eekboard-client");
option_context = g_option_context_new ("eekboard-desktop-client");
g_option_context_add_main_entries (option_context, options, NULL);
g_option_context_parse (option_context, &argc, &argv, NULL);
g_option_context_free (option_context);
@ -128,90 +166,105 @@ main (int argc, char **argv)
break;
}
eekboard = eekboard_eekboard_new (connection, NULL);
if (eekboard == NULL) {
g_printerr ("Can't create eekboard proxy\n");
retval = 1;
goto out;
client = eekboard_client_new (connection);
if (client == NULL) {
g_printerr ("Can't create a client\n");
exit (1);
}
context = eekboard_eekboard_create_context (eekboard,
"eekboard-client",
NULL);
if (context == NULL) {
g_printerr ("Can't create context\n");
retval = 1;
goto out;
#ifdef HAVE_ATSPI
if (opt_focus || opt_keystroke) {
GSettings *settings = g_settings_new ("org.gnome.desktop.interface");
if (g_settings_get_boolean (settings, "toolkit-accessibility")) {
if (atspi_init () != 0) {
g_printerr ("Can't init AT-SPI 2\n");
exit (1);
}
eekboard_eekboard_push_context (eekboard, context, NULL);
if (opt_set_keyboard) {
GFile *file;
GFileInputStream *input;
EekLayout *layout;
EekKeyboard *keyboard;
guint keyboard_id;
file = g_file_new_for_path (opt_set_keyboard);
error = NULL;
input = g_file_read (file, NULL, &error);
if (error) {
g_printerr ("Can't read file %s: %s\n",
opt_set_keyboard, error->message);
retval = 1;
goto out;
if (opt_focus &&
!eekboard_client_enable_atspi_focus (client)) {
g_printerr ("Can't register focus change event listeners\n");
exit (1);
}
layout = eek_xml_layout_new (G_INPUT_STREAM(input));
g_object_unref (input);
keyboard = eek_keyboard_new (layout, 640, 480);
g_object_unref (layout);
if (opt_keystroke &&
!eekboard_client_enable_atspi_keystroke (client)) {
g_printerr ("Can't register keystroke event listeners\n");
exit (1);
}
} else {
g_printerr ("Desktop accessibility support is disabled\n");
exit (1);
}
}
#endif /* HAVE_ATSPI */
keyboard_id = eekboard_context_add_keyboard (context, keyboard, NULL);
g_object_unref (keyboard);
eekboard_context_set_keyboard (context, keyboard_id, NULL);
if (opt_use_system_layout && (opt_keyboard || opt_model || opt_layouts || opt_options)) {
g_printerr ("Can't use --use-system-layout option with keyboard options\n");
exit (1);
}
if (opt_set_group >= 0) {
eekboard_context_set_group (context, opt_set_group, NULL);
if (opt_use_system_layout) {
if (!eekboard_client_enable_xkl (client)) {
g_printerr ("Can't register xklavier event listeners\n");
exit (1);
}
} else if (opt_model || opt_layouts || opt_options) {
if (!eekboard_client_set_xkl_config (client,
opt_model,
opt_layouts,
opt_options)) {
g_printerr ("Can't set xklavier config\n");
exit (1);
}
} else {
gchar *file;
if (!opt_keyboard)
opt_keyboard = DEFAULT_LAYOUT;
if (g_str_has_suffix (opt_keyboard, ".xml"))
file = g_strdup (opt_keyboard);
else
file = g_strdup_printf ("%s/%s.xml", KEYBOARDDIR, opt_keyboard);
if (!eekboard_client_load_keyboard_from_file (client, file)) {
g_printerr ("Can't load keyboard file %s\n", file);
g_free (file);
exit (1);
}
g_free (file);
}
if (opt_show_keyboard) {
eekboard_context_show_keyboard (context, NULL);
#ifdef HAVE_FAKEKEY
if (!eekboard_client_enable_fakekey (client)) {
g_printerr ("Can't init fakekey\n");
exit (1);
}
#endif /* HAVE_FAKEKEY */
if (opt_hide_keyboard) {
eekboard_context_hide_keyboard (context, NULL);
}
if (opt_press_key >= 0) {
eekboard_context_press_key (context, opt_press_key, NULL);
}
if (opt_release_key >= 0) {
eekboard_context_release_key (context, opt_release_key, NULL);
}
if (opt_listen) {
g_signal_connect (context, "key-pressed",
G_CALLBACK(on_key_pressed), NULL);
g_signal_connect (context, "key-released",
G_CALLBACK(on_key_released), NULL);
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
if (!opt_focus) {
g_object_get (client, "context", &context, NULL);
g_signal_connect (context, "notify::keyboard-visible",
G_CALLBACK(on_notify_keyboard_visible), loop);
g_signal_connect (context, "destroyed",
G_CALLBACK(on_context_destroyed), loop);
g_object_unref (context);
}
out:
if (context)
if (opt_fullscreen) {
g_object_get (client, "context", &context, NULL);
eekboard_context_set_fullscreen (context, TRUE, NULL);
g_object_unref (context);
if (connection)
g_object_unref (connection);
if (loop)
}
g_object_get (client, "eekboard", &eekboard, NULL);
g_signal_connect (eekboard, "destroyed",
G_CALLBACK(on_destroyed), loop);
g_main_loop_run (loop);
g_main_loop_unref (loop);
return retval;
return 0;
}

View File

@ -21,9 +21,10 @@
#include <libxklavier/xklavier.h>
#ifdef HAVE_CSPI
#include <cspi/spi.h>
#endif /* HAVE_CSPI */
#ifdef HAVE_ATSPI
#include <dbus/dbus.h>
#include <atspi/atspi.h>
#endif /* HAVE_ATSPI */
#include <gdk/gdkx.h>
@ -34,7 +35,7 @@
#include "eek/eek.h"
#include "eek/eek-xkl.h"
#include "eekboard/eekboard.h"
#include "desktop-client.h"
#include "client.h"
#include "xklutil.h"
#define CSW 640
@ -48,9 +49,9 @@ enum {
PROP_LAST
};
typedef struct _EekboardDesktopClientClass EekboardDesktopClientClass;
typedef struct _EekboardClientClass EekboardClientClass;
struct _EekboardDesktopClient {
struct _EekboardClient {
GObject parent;
EekboardEekboard *eekboard;
@ -67,58 +68,58 @@ struct _EekboardDesktopClient {
gulong key_pressed_handler;
gulong key_released_handler;
#ifdef HAVE_CSPI
Accessible *acc;
AccessibleEventListener *focus_listener;
AccessibleEventListener *keystroke_listener;
#endif /* HAVE_CSPI */
#ifdef HAVE_ATSPI
AtspiAccessible *acc;
gboolean follows_focus;
AtspiDeviceListener *keystroke_listener;
#endif /* HAVE_ATSPI */
#ifdef HAVE_FAKEKEY
FakeKey *fakekey;
#endif /* HAVE_FAKEKEY */
};
struct _EekboardDesktopClientClass {
struct _EekboardClientClass {
GObjectClass parent_class;
};
G_DEFINE_TYPE (EekboardDesktopClient, eekboard_desktop_client, G_TYPE_OBJECT);
G_DEFINE_TYPE (EekboardClient, eekboard_client, G_TYPE_OBJECT);
static GdkFilterReturn filter_xkl_event (GdkXEvent *xev,
GdkEvent *event,
gpointer user_data);
static void on_xkl_config_changed
(XklEngine *xklengine,
static void on_xkl_config_changed (XklEngine *xklengine,
gpointer user_data);
static void on_xkl_state_changed
(XklEngine *xklengine,
static void on_xkl_state_changed (XklEngine *xklengine,
XklEngineStateChange type,
gint value,
gboolean restore,
gpointer user_data);
#ifdef HAVE_CSPI
static SPIBoolean focus_listener_cb (const AccessibleEvent *event,
#ifdef HAVE_ATSPI
static void focus_listener_cb (const AtspiEvent *event,
void *user_data);
static SPIBoolean keystroke_listener_cb
(const AccessibleKeystroke *stroke,
static gboolean keystroke_listener_cb (const AtspiDeviceEvent *stroke,
void *user_data);
#endif /* HAVE_CSPI */
static gboolean set_keyboard (EekboardDesktopClient *client,
#endif /* HAVE_ATSPI */
static gboolean set_keyboard (EekboardClient *client,
gboolean show,
EekLayout *layout);
static gboolean set_xkl_keyboard (EekboardClient *client,
gboolean show,
const gchar *model,
const gchar *layouts,
const gchar *options);
static void
eekboard_desktop_client_set_property (GObject *object,
eekboard_client_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekboardDesktopClient *client = EEKBOARD_DESKTOP_CLIENT(object);
EekboardClient *client = EEKBOARD_CLIENT(object);
GDBusConnection *connection;
switch (prop_id) {
@ -129,7 +130,7 @@ eekboard_desktop_client_set_property (GObject *object,
if (client->eekboard != NULL) {
client->context =
eekboard_eekboard_create_context (client->eekboard,
"eekboard-desktop-client",
"eekboard",
NULL);
if (client->context == NULL) {
g_object_unref (client->eekboard);
@ -149,12 +150,12 @@ eekboard_desktop_client_set_property (GObject *object,
}
static void
eekboard_desktop_client_get_property (GObject *object,
eekboard_client_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekboardDesktopClient *client = EEKBOARD_DESKTOP_CLIENT(object);
EekboardClient *client = EEKBOARD_CLIENT(object);
switch (prop_id) {
case PROP_EEKBOARD:
@ -172,19 +173,19 @@ eekboard_desktop_client_get_property (GObject *object,
}
static void
eekboard_desktop_client_dispose (GObject *object)
eekboard_client_dispose (GObject *object)
{
EekboardDesktopClient *client = EEKBOARD_DESKTOP_CLIENT(object);
EekboardClient *client = EEKBOARD_CLIENT(object);
eekboard_desktop_client_disable_xkl (client);
eekboard_client_disable_xkl (client);
#ifdef HAVE_CSPI
eekboard_desktop_client_disable_cspi_focus (client);
eekboard_desktop_client_disable_cspi_keystroke (client);
#endif /* HAVE_CSPI */
#ifdef HAVE_ATSPI
eekboard_client_disable_atspi_focus (client);
eekboard_client_disable_atspi_keystroke (client);
#endif /* HAVE_ATSPI */
#ifdef HAVE_FAKEKEY
eekboard_desktop_client_disable_fakekey (client);
eekboard_client_disable_fakekey (client);
#endif /* HAVE_FAKEKEY */
if (client->context) {
@ -217,18 +218,18 @@ eekboard_desktop_client_dispose (GObject *object)
client->display = NULL;
}
G_OBJECT_CLASS (eekboard_desktop_client_parent_class)->dispose (object);
G_OBJECT_CLASS (eekboard_client_parent_class)->dispose (object);
}
static void
eekboard_desktop_client_class_init (EekboardDesktopClientClass *klass)
eekboard_client_class_init (EekboardClientClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
gobject_class->set_property = eekboard_desktop_client_set_property;
gobject_class->get_property = eekboard_desktop_client_get_property;
gobject_class->dispose = eekboard_desktop_client_dispose;
gobject_class->set_property = eekboard_client_set_property;
gobject_class->get_property = eekboard_client_get_property;
gobject_class->dispose = eekboard_client_dispose;
pspec = g_param_spec_object ("connection",
"Connection",
@ -259,7 +260,7 @@ eekboard_desktop_client_class_init (EekboardDesktopClientClass *klass)
}
static void
eekboard_desktop_client_init (EekboardDesktopClient *client)
eekboard_client_init (EekboardClient *client)
{
client->eekboard = NULL;
client->context = NULL;
@ -271,29 +272,29 @@ eekboard_desktop_client_init (EekboardDesktopClient *client)
client->key_released_handler = 0;
client->xkl_config_changed_handler = 0;
client->xkl_state_changed_handler = 0;
#ifdef HAVE_CSPI
client->focus_listener = NULL;
#ifdef HAVE_ATSPI
client->follows_focus = FALSE;
client->keystroke_listener = NULL;
#endif /* HAVE_CSPI */
#endif /* HAVE_ATSPI */
#ifdef HAVE_FAKEKEY
client->fakekey = NULL;
#endif /* HAVE_FAKEKEY */
}
gboolean
eekboard_desktop_client_set_xkl_config (EekboardDesktopClient *client,
eekboard_client_set_xkl_config (EekboardClient *client,
const gchar *model,
const gchar *layouts,
const gchar *options)
{
#ifdef HAVE_CSPI
return set_keyboard (client,
client->focus_listener ? FALSE : TRUE,
#ifdef HAVE_ATSPI
return set_xkl_keyboard (client,
!client->follows_focus,
model,
layouts,
options);
#else
return set_keyboard (client,
return set_xkl_keyboard (client,
TRUE,
model,
layouts,
@ -302,7 +303,7 @@ eekboard_desktop_client_set_xkl_config (EekboardDesktopClient *client,
}
gboolean
eekboard_desktop_client_enable_xkl (EekboardDesktopClient *client)
eekboard_client_enable_xkl (EekboardClient *client)
{
if (!client->display) {
client->display = gdk_display_get_default ();
@ -337,16 +338,19 @@ eekboard_desktop_client_enable_xkl (EekboardDesktopClient *client)
xkl_engine_start_listen (client->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
#ifdef HAVE_CSPI
return set_keyboard (client, client->focus_listener ? FALSE : TRUE,
NULL, NULL, NULL);
#ifdef HAVE_ATSPI
return set_xkl_keyboard (client,
!client->follows_focus,
NULL,
NULL,
NULL);
#else
return set_keyboard (client, TRUE, NULL, NULL, NULL);
return set_xkl_keyboard (client, TRUE, NULL, NULL, NULL);
#endif
}
void
eekboard_desktop_client_disable_xkl (EekboardDesktopClient *client)
eekboard_client_disable_xkl (EekboardClient *client)
{
if (client->xkl_engine)
xkl_engine_stop_listen (client->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
@ -360,80 +364,135 @@ eekboard_desktop_client_disable_xkl (EekboardDesktopClient *client)
client->xkl_state_changed_handler);
}
#ifdef HAVE_CSPI
#ifdef HAVE_ATSPI
gboolean
eekboard_desktop_client_enable_cspi_focus (EekboardDesktopClient *client)
eekboard_client_enable_atspi_focus (EekboardClient *client)
{
client->focus_listener = SPI_createAccessibleEventListener
((AccessibleEventListenerCB)focus_listener_cb,
client);
GError *error;
if (!SPI_registerGlobalEventListener (client->focus_listener,
"object:state-changed:focused"))
error = NULL;
if (!atspi_event_listener_register_from_callback
((AtspiEventListenerCB)focus_listener_cb,
client,
NULL,
"object:state-changed:focused",
&error))
return FALSE;
if (!SPI_registerGlobalEventListener (client->focus_listener,
"focus:"))
error = NULL;
if (!atspi_event_listener_register_from_callback
((AtspiEventListenerCB)focus_listener_cb,
client,
NULL,
"focus:",
&error))
return FALSE;
client->follows_focus = TRUE;
return TRUE;
}
void
eekboard_desktop_client_disable_cspi_focus (EekboardDesktopClient *client)
eekboard_client_disable_atspi_focus (EekboardClient *client)
{
if (client->focus_listener) {
SPI_deregisterGlobalEventListenerAll (client->focus_listener);
AccessibleEventListener_unref (client->focus_listener);
client->focus_listener = NULL;
}
GError *error;
client->follows_focus = FALSE;
error = NULL;
atspi_event_listener_deregister_from_callback
((AtspiEventListenerCB)focus_listener_cb,
client,
"object:state-changed:focused",
&error);
error = NULL;
atspi_event_listener_deregister_from_callback
((AtspiEventListenerCB)focus_listener_cb,
client,
"focus:",
&error);
}
gboolean
eekboard_desktop_client_enable_cspi_keystroke (EekboardDesktopClient *client)
eekboard_client_enable_atspi_keystroke (EekboardClient *client)
{
GError *error;
client->keystroke_listener =
SPI_createAccessibleKeystrokeListener (keystroke_listener_cb,
atspi_device_listener_new ((AtspiDeviceListenerCB)keystroke_listener_cb,
NULL,
client);
if (!SPI_registerAccessibleKeystrokeListener
error = NULL;
if (!atspi_register_keystroke_listener
(client->keystroke_listener,
SPI_KEYSET_ALL_KEYS,
NULL,
0,
SPI_KEY_PRESSED |
SPI_KEY_RELEASED,
SPI_KEYLISTENER_NOSYNC))
ATSPI_KEY_PRESSED,
ATSPI_KEYLISTENER_NOSYNC,
&error))
return FALSE;
error = NULL;
if (!atspi_register_keystroke_listener
(client->keystroke_listener,
NULL,
0,
ATSPI_KEY_RELEASED,
ATSPI_KEYLISTENER_NOSYNC,
&error))
return FALSE;
return TRUE;
}
void
eekboard_desktop_client_disable_cspi_keystroke (EekboardDesktopClient *client)
eekboard_client_disable_atspi_keystroke (EekboardClient *client)
{
if (client->keystroke_listener) {
SPI_deregisterAccessibleKeystrokeListener (client->keystroke_listener,
0);
AccessibleKeystrokeListener_unref (client->keystroke_listener);
GError *error;
error = NULL;
atspi_deregister_keystroke_listener (client->keystroke_listener,
NULL,
0,
ATSPI_KEY_PRESSED,
&error);
error = NULL;
atspi_deregister_keystroke_listener (client->keystroke_listener,
NULL,
0,
ATSPI_KEY_RELEASED,
&error);
g_object_unref (client->keystroke_listener);
client->keystroke_listener = NULL;
}
}
static SPIBoolean
focus_listener_cb (const AccessibleEvent *event,
static void
focus_listener_cb (const AtspiEvent *event,
void *user_data)
{
EekboardDesktopClient *client = user_data;
Accessible *accessible = event->source;
AccessibleStateSet *state_set = Accessible_getStateSet (accessible);
AccessibleRole role = Accessible_getRole (accessible);
EekboardClient *client = user_data;
AtspiAccessible *accessible = event->source;
AtspiStateSet *state_set = atspi_accessible_get_state_set (accessible);
AtspiRole role;
GError *error;
if (AccessibleStateSet_contains (state_set, SPI_STATE_EDITABLE) ||
role == SPI_ROLE_TERMINAL) {
error = NULL;
role = atspi_accessible_get_role (accessible, &error);
if (error)
return;
if (atspi_state_set_contains (state_set, ATSPI_STATE_EDITABLE) ||
role == ATSPI_ROLE_TERMINAL) {
switch (role) {
case SPI_ROLE_TEXT:
case SPI_ROLE_PARAGRAPH:
case SPI_ROLE_PASSWORD_TEXT:
case SPI_ROLE_TERMINAL:
case ATSPI_ROLE_TEXT:
case ATSPI_ROLE_PARAGRAPH:
case ATSPI_ROLE_PASSWORD_TEXT:
case ATSPI_ROLE_TERMINAL:
if (strncmp (event->type, "focus", 5) == 0 || event->detail1 == 1) {
client->acc = accessible;
eekboard_context_show_keyboard (client->context, NULL);
@ -442,7 +501,7 @@ focus_listener_cb (const AccessibleEvent *event,
eekboard_context_hide_keyboard (client->context, NULL);
}
break;
case SPI_ROLE_ENTRY:
case ATSPI_ROLE_ENTRY:
if (strncmp (event->type, "focus", 5) == 0 || event->detail1 == 1) {
client->acc = accessible;
eekboard_context_show_keyboard (client->context, NULL);
@ -458,41 +517,39 @@ focus_listener_cb (const AccessibleEvent *event,
} else {
eekboard_context_hide_keyboard (client->context, NULL);
}
return FALSE;
}
static SPIBoolean
keystroke_listener_cb (const AccessibleKeystroke *stroke,
static gboolean
keystroke_listener_cb (const AtspiDeviceEvent *stroke,
void *user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
EekKey *key;
/* Ignore modifiers since the keystroke listener does not called
when a modifier key is released. */
key = eek_keyboard_find_key_by_keycode (client->keyboard,
stroke->keycode);
stroke->hw_code);
if (key) {
EekSymbol *symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (symbol && eek_symbol_is_modifier (symbol))
return FALSE;
}
if (stroke->type == SPI_KEY_PRESSED) {
eekboard_context_press_key (client->context, stroke->keycode, NULL);
if (stroke->type == ATSPI_KEY_PRESSED) {
eekboard_context_press_key (client->context, stroke->hw_code, NULL);
} else {
eekboard_context_release_key (client->context, stroke->keycode, NULL);
eekboard_context_release_key (client->context, stroke->hw_code, NULL);
}
return TRUE;
}
#endif /* HAVE_CSPI */
#endif /* HAVE_ATSPI */
EekboardDesktopClient *
eekboard_desktop_client_new (GDBusConnection *connection)
EekboardClient *
eekboard_client_new (GDBusConnection *connection)
{
EekboardDesktopClient *client = g_object_new (EEKBOARD_TYPE_DESKTOP_CLIENT,
EekboardClient *client = g_object_new (EEKBOARD_TYPE_CLIENT,
"connection", connection,
NULL);
if (client->context)
@ -505,7 +562,7 @@ filter_xkl_event (GdkXEvent *xev,
GdkEvent *event,
gpointer user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
XEvent *xevent = (XEvent *)xev;
xkl_engine_filter_events (client->xkl_engine, xevent);
@ -516,10 +573,10 @@ static void
on_xkl_config_changed (XklEngine *xklengine,
gpointer user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
gboolean retval;
retval = set_keyboard (client, FALSE, NULL, NULL, NULL);
retval = set_xkl_keyboard (client, FALSE, NULL, NULL, NULL);
g_return_if_fail (retval);
#ifdef HAVE_FAKEKEY
@ -529,16 +586,40 @@ on_xkl_config_changed (XklEngine *xklengine,
}
static gboolean
set_keyboard (EekboardDesktopClient *client,
set_keyboard (EekboardClient *client,
gboolean show,
EekLayout *layout)
{
gchar *keyboard_name;
static gint keyboard_serial = 0;
guint keyboard_id;
client->keyboard = eek_keyboard_new (layout, CSW, CSH);
eek_keyboard_set_modifier_behavior (client->keyboard,
EEK_MODIFIER_BEHAVIOR_LATCH);
keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
g_free (keyboard_name);
keyboard_id = eekboard_context_add_keyboard (client->context,
client->keyboard,
NULL);
eekboard_context_set_keyboard (client->context, keyboard_id, NULL);
if (show)
eekboard_context_show_keyboard (client->context, NULL);
return TRUE;
}
static gboolean
set_xkl_keyboard (EekboardClient *client,
gboolean show,
const gchar *model,
const gchar *layouts,
const gchar *options)
{
EekLayout *layout;
gchar *keyboard_name;
static gint keyboard_serial = 0;
guint keyboard_id;
gboolean retval;
if (client->keyboard)
g_object_unref (client->keyboard);
@ -583,22 +664,9 @@ set_keyboard (EekboardDesktopClient *client,
}
}
client->keyboard = eek_keyboard_new (layout, CSW, CSH);
eek_keyboard_set_modifier_behavior (client->keyboard,
EEK_MODIFIER_BEHAVIOR_LATCH);
keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
g_free (keyboard_name);
keyboard_id = eekboard_context_add_keyboard (client->context,
client->keyboard,
NULL);
eekboard_context_set_keyboard (client->context, keyboard_id, NULL);
if (show)
eekboard_context_show_keyboard (client->context, NULL);
return TRUE;
retval = set_keyboard (client, show, layout);
g_object_unref (layout);
return retval;
}
static void
@ -608,7 +676,7 @@ on_xkl_state_changed (XklEngine *xklengine,
gboolean restore,
gpointer user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
if (type == GROUP_CHANGED && client->keyboard) {
gint group = eek_element_get_group (EEK_ELEMENT(client->keyboard));
@ -641,19 +709,26 @@ on_key_pressed (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
EekSymbol *symbol;
g_assert (client->fakekey);
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (EEK_IS_KEYSYM(symbol) && !eek_symbol_is_modifier (symbol)) {
guint xkeysym = eek_keysym_get_xkeysym (EEK_KEYSYM(symbol));
guint keycode =
XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (client->display), xkeysym);
EekModifierType modifiers =
eek_keyboard_get_modifiers (client->keyboard);
FakeKeyModifier fakekey_modifiers = get_fakekey_modifiers (modifiers);
guint xkeysym;
guint keycode;
EekModifierType modifiers;
FakeKeyModifier fakekey_modifiers;
xkeysym = eek_keysym_get_xkeysym (EEK_KEYSYM(symbol));
g_return_if_fail (xkeysym > 0);
keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (client->display),
xkeysym);
g_return_if_fail (keycode > 0);
modifiers = eek_keyboard_get_modifiers (client->keyboard);
fakekey_modifiers = get_fakekey_modifiers (modifiers);
fakekey_send_keyevent (client->fakekey,
keycode,
@ -671,14 +746,14 @@ on_key_released (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
{
EekboardDesktopClient *client = user_data;
EekboardClient *client = user_data;
g_assert (client->fakekey);
fakekey_release (client->fakekey);
}
gboolean
eekboard_desktop_client_enable_fakekey (EekboardDesktopClient *client)
eekboard_client_enable_fakekey (EekboardClient *client)
{
if (!client->display) {
client->display = gdk_display_get_default ();
@ -701,7 +776,7 @@ eekboard_desktop_client_enable_fakekey (EekboardDesktopClient *client)
}
void
eekboard_desktop_client_disable_fakekey (EekboardDesktopClient *client)
eekboard_client_disable_fakekey (EekboardClient *client)
{
if (client->fakekey)
fakekey_release (client->fakekey);
@ -715,4 +790,33 @@ eekboard_desktop_client_disable_fakekey (EekboardDesktopClient *client)
g_signal_handler_disconnect (client->keyboard,
client->key_released_handler);
}
gboolean
eekboard_client_load_keyboard_from_file (EekboardClient *client,
const gchar *keyboard_file)
{
GFile *file;
GFileInputStream *input;
GError *error;
EekLayout *layout;
gboolean retval;
file = g_file_new_for_path (keyboard_file);
error = NULL;
input = g_file_read (file, NULL, &error);
if (input == NULL)
return FALSE;
layout = eek_xml_layout_new (G_INPUT_STREAM(input));
g_object_unref (input);
#ifdef HAVE_ATSPI
retval = set_keyboard (client, !client->follows_focus, layout);
#else
retval = set_keyboard (client, TRUE, layout);
#endif
g_object_unref (layout);
return retval;
}
#endif /* HAVE_FAKEKEY */

61
src/client.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* 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/>.
*/
#ifndef EEKBOARD_CLIENT_H
#define EEKBOARD_CLIENT_H 1
#include <gio/gio.h>
G_BEGIN_DECLS
#define EEKBOARD_TYPE_CLIENT (eekboard_client_get_type())
#define EEKBOARD_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_CLIENT, EekboardClient))
#define EEKBOARD_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_CLIENT, EekboardClientClass))
#define EEKBOARD_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_CLIENT))
#define EEKBOARD_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_CLIENT))
#define EEKBOARD_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_CLIENT, EekboardClientClass))
typedef struct _EekboardClient EekboardClient;
EekboardClient * eekboard_client_new (GDBusConnection *connection);
gboolean eekboard_client_load_keyboard_from_file
(EekboardClient *client,
const gchar *file);
gboolean eekboard_client_set_xkl_config (EekboardClient *client,
const gchar *model,
const gchar *layouts,
const gchar *options);
gboolean eekboard_client_enable_xkl (EekboardClient *client);
void eekboard_client_disable_xkl (EekboardClient *client);
gboolean eekboard_client_enable_atspi_focus
(EekboardClient *client);
void eekboard_client_disable_atspi_focus
(EekboardClient *client);
gboolean eekboard_client_enable_atspi_keystroke
(EekboardClient *client);
void eekboard_client_disable_atspi_keystroke
(EekboardClient *client);
gboolean eekboard_client_enable_fakekey (EekboardClient *client);
void eekboard_client_disable_fakekey (EekboardClient *client);
G_END_DECLS
#endif /* EEKBOARD_CLIENT_H */

View File

@ -1,245 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* 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/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <cspi/spi.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include "eekboard/eekboard.h"
#include "desktop-client.h"
static gboolean opt_system = FALSE;
static gboolean opt_session = FALSE;
static gchar *opt_address = NULL;
#ifdef HAVE_CSPI
static gboolean opt_focus = FALSE;
static gboolean opt_keystroke = FALSE;
#endif /* HAVE_CSPI */
static gchar *opt_model = NULL;
static gchar *opt_layouts = NULL;
static gchar *opt_options = NULL;
static gboolean opt_fullscreen = FALSE;
static const GOptionEntry options[] = {
{"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
N_("Connect to the system bus")},
{"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
N_("Connect to the session bus")},
{"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
N_("Connect to the given D-Bus address")},
#ifdef HAVE_CSPI
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
N_("Listen focus change events with AT-SPI")},
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
N_("Listen keystroke events with AT-SPI")},
#endif /* HAVE_CSPI */
{"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
N_("Specify model")},
{"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
N_("Specify layouts")},
{"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
N_("Specify options")},
{"fullscreen", 'F', 0, G_OPTION_ARG_NONE, &opt_fullscreen,
N_("Create window in fullscreen mode")},
{NULL}
};
static void
on_notify_keyboard_visible (GObject *object,
GParamSpec *spec,
gpointer user_data)
{
GMainLoop *loop = user_data;
gboolean visible;
g_object_get (object, "keyboard-visible", &visible, NULL);
/* user explicitly closed the window */
if (!visible && eekboard_context_is_enabled (EEKBOARD_CONTEXT(object)))
g_main_loop_quit (loop);
}
static void
on_context_destroyed (EekboardContext *context,
gpointer user_data)
{
GMainLoop *loop = user_data;
g_main_loop_quit (loop);
}
static void
on_destroyed (EekboardEekboard *eekboard,
gpointer user_data)
{
GMainLoop *loop = user_data;
g_main_loop_quit (loop);
}
int
main (int argc, char **argv)
{
EekboardDesktopClient *client;
EekboardEekboard *eekboard;
EekboardContext *context;
GBusType bus_type;
GDBusConnection *connection;
GError *error;
GConfClient *gconfc;
GOptionContext *option_context;
GMainLoop *loop;
if (!gtk_init_check (&argc, &argv)) {
g_printerr ("Can't init GTK\n");
exit (1);
}
option_context = g_option_context_new ("eekboard-desktop-client");
g_option_context_add_main_entries (option_context, options, NULL);
g_option_context_parse (option_context, &argc, &argv, NULL);
g_option_context_free (option_context);
if (opt_system)
bus_type = G_BUS_TYPE_SYSTEM;
else if (opt_address)
bus_type = G_BUS_TYPE_NONE;
else
bus_type = G_BUS_TYPE_SESSION;
switch (bus_type) {
case G_BUS_TYPE_SYSTEM:
case G_BUS_TYPE_SESSION:
error = NULL;
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
g_printerr ("Can't connect to the bus: %s\n", error->message);
exit (1);
}
break;
case G_BUS_TYPE_NONE:
error = NULL;
connection = g_dbus_connection_new_for_address_sync (opt_address,
0,
NULL,
NULL,
&error);
if (connection == NULL) {
g_printerr ("Can't connect to the bus at %s: %s\n",
opt_address,
error->message);
exit (1);
}
break;
default:
g_assert_not_reached ();
break;
}
client = eekboard_desktop_client_new (connection);
if (client == NULL) {
g_printerr ("Can't create a client\n");
exit (1);
}
gconfc = gconf_client_get_default ();
#ifdef HAVE_CSPI
error = NULL;
if (opt_focus || opt_keystroke) {
if (gconf_client_get_bool (gconfc,
"/desktop/gnome/interface/accessibility",
&error) ||
gconf_client_get_bool (gconfc,
"/desktop/gnome/interface/accessibility2",
&error)) {
if (SPI_init () != 0) {
g_printerr ("Can't init CSPI\n");
exit (1);
}
if (opt_focus &&
!eekboard_desktop_client_enable_cspi_focus (client)) {
g_printerr ("Can't register focus change event listeners\n");
exit (1);
}
if (opt_keystroke &&
!eekboard_desktop_client_enable_cspi_keystroke (client)) {
g_printerr ("Can't register keystroke event listeners\n");
exit (1);
}
} else {
g_printerr ("Desktop accessibility support is disabled\n");
exit (1);
}
}
#endif /* HAVE_CSPI */
if (opt_model || opt_layouts || opt_options) {
if (!eekboard_desktop_client_set_xkl_config (client,
opt_model,
opt_layouts,
opt_options)) {
g_printerr ("Can't set xklavier config\n");
exit (1);
}
} else if (!eekboard_desktop_client_enable_xkl (client)) {
g_printerr ("Can't register xklavier event listeners\n");
exit (1);
}
#ifdef HAVE_FAKEKEY
if (!eekboard_desktop_client_enable_fakekey (client)) {
g_printerr ("Can't init fakekey\n");
exit (1);
}
#endif /* HAVE_FAKEKEY */
loop = g_main_loop_new (NULL, FALSE);
if (!opt_focus) {
g_object_get (client, "context", &context, NULL);
g_signal_connect (context, "notify::keyboard-visible",
G_CALLBACK(on_notify_keyboard_visible), loop);
g_signal_connect (context, "destroyed",
G_CALLBACK(on_context_destroyed), loop);
g_object_unref (context);
}
if (opt_fullscreen) {
g_object_get (client, "context", &context, NULL);
eekboard_context_set_fullscreen (context, TRUE, NULL);
g_object_unref (context);
}
g_object_get (client, "eekboard", &eekboard, NULL);
g_signal_connect (eekboard, "destroyed",
G_CALLBACK(on_destroyed), loop);
g_main_loop_run (loop);
g_main_loop_unref (loop);
return 0;
}

View File

@ -1,64 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* 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/>.
*/
#ifndef EEKBOARD_DESKTOP_CLIENT_H
#define EEKBOARD_DESKTOP_CLIENT_H 1
#include <gio/gio.h>
G_BEGIN_DECLS
#define EEKBOARD_TYPE_DESKTOP_CLIENT (eekboard_desktop_client_get_type())
#define EEKBOARD_DESKTOP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_DESKTOP_CLIENT, EekboardDesktopClient))
#define EEKBOARD_DESKTOP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_DESKTOP_CLIENT, EekboardDesktopClientClass))
#define EEKBOARD_IS_DESKTOP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_DESKTOP_CLIENT))
#define EEKBOARD_IS_DESKTOP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_DESKTOP_CLIENT))
#define EEKBOARD_DESKTOP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_DESKTOP_CLIENT, EekboardDesktopClientClass))
typedef struct _EekboardDesktopClient EekboardDesktopClient;
EekboardDesktopClient * eekboard_desktop_client_new
(GDBusConnection *connection);
gboolean eekboard_desktop_client_set_xkl_config
(EekboardDesktopClient *client,
const gchar *model,
const gchar *layouts,
const gchar *options);
gboolean eekboard_desktop_client_enable_xkl
(EekboardDesktopClient *client);
void eekboard_desktop_client_disable_xkl
(EekboardDesktopClient *client);
gboolean eekboard_desktop_client_enable_cspi_focus
(EekboardDesktopClient *client);
void eekboard_desktop_client_disable_cspi_focus
(EekboardDesktopClient *client);
gboolean eekboard_desktop_client_enable_cspi_keystroke
(EekboardDesktopClient *client);
void eekboard_desktop_client_disable_cspi_keystroke
(EekboardDesktopClient *client);
gboolean eekboard_desktop_client_enable_fakekey
(EekboardDesktopClient *client);
void eekboard_desktop_client_disable_fakekey
(EekboardDesktopClient *client);
G_END_DECLS
#endif /* EEKBOARD_DESKTOP_CLIENT_H */

View File

@ -94,6 +94,7 @@ struct _ServerContext {
guint registration_id;
char *object_path;
char *client_connection;
char *client_name;
gboolean enabled;
gboolean last_keyboard_visible;
@ -140,7 +141,10 @@ on_allocation_changed (ClutterActor *stage,
ClutterAllocationFlags flags,
gpointer user_data)
{
ClutterActor *actor = user_data;
ClutterActor *actor =
clutter_container_find_child_by_name (CLUTTER_CONTAINER(stage),
"keyboard");
clutter_actor_set_size (actor,
box->x2 - box->x1,
box->y2 - box->y1);
@ -233,12 +237,11 @@ set_geometry (ServerContext *context)
g_signal_connect (stage,
"allocation-changed",
G_CALLBACK(on_allocation_changed),
actor);
#else
NULL);
#endif
gtk_widget_set_size_request (context->widget,
bounds.width,
bounds.height);
#endif
gtk_window_move (GTK_WINDOW(context->window),
MAX(rect.width - 20 - bounds.width, 0),
MAX(rect.height - 40 - bounds.height, 0));
@ -264,6 +267,7 @@ update_widget (ServerContext *context)
context->widget = gtk_clutter_embed_new ();
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget));
actor = eek_clutter_keyboard_new (context->keyboard);
clutter_actor_set_name (actor, "keyboard");
if (theme)
eek_clutter_keyboard_set_theme (EEK_CLUTTER_KEYBOARD(actor), theme);
clutter_container_add_actor (CLUTTER_CONTAINER(stage), actor);
@ -285,7 +289,10 @@ update_widget (ServerContext *context)
gtk_widget_set_can_focus (context->window, FALSE);
g_object_set (G_OBJECT(context->window), "accept_focus", FALSE, NULL);
gtk_window_set_title (GTK_WINDOW(context->window), _("Keyboard"));
gtk_window_set_title (GTK_WINDOW(context->window),
context->client_name ?
context->client_name :
_("Keyboard"));
gtk_window_set_icon_name (GTK_WINDOW(context->window), "eekboard");
gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
@ -372,6 +379,7 @@ server_context_finalize (GObject *object)
g_free (context->object_path);
g_free (context->client_connection);
g_free (context->client_name);
G_OBJECT_CLASS (server_context_parent_class)->finalize (object);
}
@ -797,6 +805,7 @@ void
server_context_set_client_connection (ServerContext *context,
const gchar *client_connection)
{
g_free (context->client_connection);
context->client_connection = g_strdup (client_connection);
}
@ -805,3 +814,11 @@ server_context_get_client_connection (ServerContext *context)
{
return context->client_connection;
}
void
server_context_set_client_name (ServerContext *context,
const gchar *client_name)
{
g_free (context->client_name);
context->client_name = g_strdup (client_name);
}

View File

@ -43,6 +43,9 @@ void server_context_set_client_connection
const gchar *client_connection);
const gchar *server_context_get_client_connection
(ServerContext *context);
void server_context_set_client_name
(ServerContext *context,
const gchar *client_name);
G_END_DECLS
#endif /* SERVER_CONTEXT_H */

View File

@ -321,6 +321,7 @@ handle_method_call (GDBusConnection *connection,
object_path = g_strdup_printf (SERVER_CONTEXT_PATH, context_id++);
context = server_context_new (object_path, server->connection);
server_context_set_client_connection (context, sender);
server_context_set_client_name (context, client_name);
g_hash_table_insert (server->context_hash,
object_path,
context);
@ -367,6 +368,17 @@ handle_method_call (GDBusConnection *connection,
if (server->context_stack) {
ServerContext *context = server->context_stack->data;
if (g_strcmp0 (server_context_get_client_connection (context),
sender) != 0) {
g_dbus_method_invocation_return_error
(invocation,
G_IO_ERROR,
G_IO_ERROR_FAILED_HANDLED,
"the current context not owned by %s",
sender);
return;
}
server_context_set_enabled (context, FALSE);
server->context_stack = g_slist_next (server->context_stack);
g_object_unref (context);