Compare commits

...

14 Commits

46 changed files with 875 additions and 418 deletions

View File

@ -16,8 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA # 02110-1301 USA
if ENABLE_VALA
SUBDIRS = vala
else
SUBDIRS = SUBDIRS =
if ENABLE_PYTHON
SUBDIRS += python
endif
if ENABLE_VALA
SUBDIRS += vala
endif endif

View File

@ -0,0 +1,18 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 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/>.
SUBDIRS = eekboard

View File

@ -0,0 +1,21 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 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/>.
pkgpython_PYTHON = \
__init__.py \
eekboard.py \
context.py

View File

@ -0,0 +1,63 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 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/>.
from gi.repository import Eek, EekXkl, Gio
from eekboard import Eekboard
from context import Context
Keyboard = Eek.Keyboard
Section = Eek.Section
Key = Eek.Key
Symbol = Eek.Symbol
Keysym = Eek.Keysym
MODIFIER_BEHAVIOR_NONE, \
MODIFIER_BEHAVIOR_LOCK, \
MODIFIER_BEHAVIOR_LATCH = \
(Eek.ModifierBehavior.NONE,
Eek.ModifierBehavior.LOCK,
Eek.ModifierBehavior.LATCH)
CSW = 640
CSH = 480
def XmlKeyboard(path, modifier_behavior=MODIFIER_BEHAVIOR_NONE):
_file = Gio.file_new_for_path(path)
layout = Eek.XmlLayout.new(_file.read())
keyboard = Eek.Keyboard.new(layout, CSW, CSH)
keyboard.set_modifier_behavior(modifier_behavior)
return keyboard
def XklKeyboard(modifier_behavior=MODIFIER_BEHAVIOR_NONE):
layout = EekXkl.Layout.new()
keyboard = Eek.Keyboard.new(layout, CSW, CSH)
keyboard.set_modifier_behavior(modifier_behavior)
return keyboard
__all__ = ['Eekboard',
'Context',
'Keyboard',
'Section',
'Key',
'Symbol',
'Keysym',
'MODIFIER_BEHAVIOR_NONE',
'MODIFIER_BEHAVIOR_LOCK',
'MODIFIER_BEHAVIOR_LATCH',
'XmlKeyboard',
'XklKeyboard']

View File

@ -0,0 +1,73 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 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/>.
from gi.repository import Eekboard
import gobject
class Context(gobject.GObject):
__gtype_name__ = "PYEekboardContext"
__gsignals__ = {
'enabled': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
'disabled': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
'key-pressed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_UINT,)),
'key-released': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_UINT,))
}
def __init__(self, giobject):
super(Context, self).__init__()
import sys
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]))
def get_giobject(self):
return self.__giobject
def set_keyboard(self, keyboard):
self.__giobject.set_keyboard(keyboard, None)
def show_keyboard(self):
self.__giobject.show_keyboard(None)
def hide_keyboard(self):
self.__giobject.hide_keyboard(None)
def set_group(self, group):
self.__giobject.set_group(group, None)
def press_key(self, keycode):
self.__giobject.press_key(keycode, None)
def release_key(self, keycode):
self.__giobject.release_key(keycode, None)
def is_enabled(self):
return self.__giobject.is_enabled()

View File

@ -0,0 +1,42 @@
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 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/>.
from gi.repository import Gio
import gi.repository
import gobject
from context import Context
class Eekboard(gobject.GObject):
__gtype_name__ = "PYEekboardEekboard"
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);
def create_context(self, client_name):
context = self.__eekboard.create_context(client_name, None)
return Context(context)
def push_context(self, context):
self.__eekboard.push_context(context.get_giobject(), None)
def pop_context(self):
self.__eekboard.pop_context(None)
def destroy_context(self, context):
self.__eekboard.destroy_context(context.get_giobject(), None)

View File

@ -20,7 +20,7 @@ AC_PREREQ(2.63)
dnl AC_CONFIG_SRCDIR([configure.ac]) dnl AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_INIT([eekboard], [0.90.1], [ueno@unixuser.org]) AC_INIT([eekboard], [0.90.2], [ueno@unixuser.org])
dnl Init automake dnl Init automake
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
@ -132,6 +132,37 @@ fi
AC_MSG_RESULT($enable_cspi) AC_MSG_RESULT($enable_cspi)
AM_CONDITIONAL(ENABLE_CSPI, [test x$enable_cspi = xyes]) AM_CONDITIONAL(ENABLE_CSPI, [test x$enable_cspi = xyes])
dnl Python language binding
AC_MSG_CHECKING([whether you enable Python language support])
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=no/yes],
[Enable Python language binding default=yes]),,
enable_python=yes)
AC_MSG_RESULT($enable_python)
AM_CONDITIONAL(ENABLE_PYTHON, [test x$enable_python = xyes])
if test x"$enable_python" = x"yes"; then
# check python
AM_PATH_PYTHON([2.5])
AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
if test x"$PYTHON_CONFIG" = x""; then
AC_PATH_PROG(PYTHON_CONFIG, python-config)
fi
if test x"$PYTHON_CONFIG" != x""; then
PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
PYTHON_LIBS=`$PYTHON_CONFIG --libs`
else
PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
fi
PYTHON_INCLUDES="$PYTHON_CFLAGS"
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LIBS)
else
enable_python="no (disabled, use --enable-python to enable)"
fi
dnl Vala langauge binding dnl Vala langauge binding
AC_MSG_CHECKING([whether you enable Vala language support]) AC_MSG_CHECKING([whether you enable Vala language support])
AC_ARG_ENABLE(vala, AC_ARG_ENABLE(vala,
@ -195,6 +226,8 @@ eekboard/Makefile
src/Makefile src/Makefile
tests/Makefile tests/Makefile
bindings/Makefile bindings/Makefile
bindings/python/Makefile
bindings/python/eekboard/Makefile
bindings/vala/Makefile bindings/vala/Makefile
docs/Makefile docs/Makefile
docs/reference/Makefile docs/reference/Makefile

View File

@ -47,7 +47,7 @@ SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan. # Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS= SCAN_OPTIONS=--rebuild-types
# Extra options to supply to gtkdoc-mkdb. # Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
@ -76,7 +76,15 @@ EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths # Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=config.h IGNORE_HFILES = \
config.h \
eek-renderer.h \
eek-clutter-renderer.h \
eek-clutter-section.h \
eek-clutter-key.h
if !ENABLE_CLUTTER
IGNORE_HFILES += eek-clutter-keyboard.h eek-clutter.h
endif
# Images to copy into HTML directory. # Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
@ -97,15 +105,18 @@ expand_content_files=eek-overview.xml
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS = $(GIO2_CFLAGS) GTKDOC_CFLAGS = $(GIO2_CFLAGS)
GTKDOC_LIBS = $(top_srcdir)/eek/libeek.la \ GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
$(top_srcdir)/eek/libeek-gtk.la \ $(top_builddir)/eek/libeek-gtk.la \
$(top_srcdir)/eek/libeek-xkb.la \ $(top_builddir)/eek/libeek-xkb.la \
$(top_srcdir)/eek/libeek-xkl.la \ $(top_builddir)/eek/libeek-xkl.la \
$(GIO2_LIBS) \ $(GIO2_LIBS) \
$(GTK_LIBS) \
$(XKB_LIBS) $(XKB_LIBS)
if ENABLE_CLUTTER if ENABLE_CLUTTER
GTKDOC_LIBS += $(top_srcdir)/eek/libeek-clutter.la $(CLUTTER_LIBS) GTKDOC_LIBS += \
$(top_builddir)/eek/libeek-clutter.la \
$(CLUTTER_LIBS)
endif endif
# This includes the standard gtk-doc make rules, copied by gtkdocize. # This includes the standard gtk-doc make rules, copied by gtkdocize.

View File

@ -37,14 +37,16 @@
<title>API Manual</title> <title>API Manual</title>
<chapter> <chapter>
<title>Base Classes, Interfaces, and Utilities</title> <title>Base Classes, Interfaces, and Utilities</title>
<xi:include href="xml/eek-serializable.xml"/>
<xi:include href="xml/eek-element.xml"/> <xi:include href="xml/eek-element.xml"/>
<xi:include href="xml/eek-container.xml"/> <xi:include href="xml/eek-container.xml"/>
<xi:include href="xml/eek-keyboard.xml"/> <xi:include href="xml/eek-keyboard.xml"/>
<xi:include href="xml/eek-section.xml"/> <xi:include href="xml/eek-section.xml"/>
<xi:include href="xml/eek-key.xml"/> <xi:include href="xml/eek-key.xml"/>
<xi:include href="xml/eek-symbol.xml"/>
<xi:include href="xml/eek-keysym.xml"/>
<xi:include href="xml/eek-layout.xml"/> <xi:include href="xml/eek-layout.xml"/>
<xi:include href="xml/eek-types.xml"/> <xi:include href="xml/eek-types.xml"/>
<xi:include href="xml/eek-keysym.xml"/>
</chapter> </chapter>
<chapter> <chapter>
<title>Clutter Keyboard</title> <title>Clutter Keyboard</title>
@ -62,6 +64,11 @@
<title>XKB Layout Engine</title> <title>XKB Layout Engine</title>
<xi:include href="xml/eek-xkb-layout.xml"/> <xi:include href="xml/eek-xkb-layout.xml"/>
</chapter> </chapter>
<chapter>
<title>XML Layout Engine</title>
<xi:include href="xml/eek-xml-layout.xml"/>
<xi:include href="xml/eek-xml.xml"/>
</chapter>
<chapter id="object-tree"> <chapter id="object-tree">
<title>Object Hierarchy</title> <title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/> <xi:include href="xml/tree_index.sgml"/>

View File

@ -43,19 +43,14 @@ clutter_group_add (CLUTTER_GROUP(stage), actor);
</programlisting> </programlisting>
</informalexample> </informalexample>
<para>The most interesting feature of libeek is that developer can <para>libeek currently supports GTK+ and Clutter as UI toolkits.
choose arbitrary combination of UI toolkits and layout engine To create a keyboard-like #GtkWidget instead of #ClutterActor,
supported by libeek. For example, to create a keyboard-like replace eek_clutter_keyboard_new() with eek_gtk_keyboard_new().
#GtkWidget instead of #ClutterActor, all you need is to replace Similarly, if you want to use XKB configuration directly (without
eek_clutter_keyboard_new() with eek_gtk_keyboard_new() and libxklavier), you will only need to replace eek_xkl_layout_new ()
eek_clutter_keyboard_get_actor() with with eek_xkb_layout_new().</para>
eek_gtk_keyboard_get_widget(). Similarly, if you want to use XKB
configuration directly (without libxklavier), you will only need to
replace eek_xkl_layout_new () with eek_xkb_layout_new().</para>
<para>To achieve portability across different UI toolkits, <para>In the above example, a keyboard is represented as a tree of
there is a seperate represention of keyboard elements apart from
the actual UI widgets. For example, a keyboard is represented as a tree of
#EekElement -- #EekKeyboard contains one or more #EekSection's and #EekElement -- #EekKeyboard contains one or more #EekSection's and
#EekSection contains one or more #EekKey's. Each element may emit #EekSection contains one or more #EekKey's. Each element may emit
events when user pushes the corresponding UI widget.</para> events when user pushes the corresponding UI widget.</para>

View File

@ -2,21 +2,25 @@
<FILE>eek-keyboard</FILE> <FILE>eek-keyboard</FILE>
<TITLE>EekKeyboard</TITLE> <TITLE>EekKeyboard</TITLE>
EekKeyboardClass EekKeyboardClass
EekKeyboardPrivate
EekKeyboard EekKeyboard
eek_keyboard_new eek_keyboard_new
eek_keyboard_get_layout eek_keyboard_get_layout
eek_keyboard_get_size
eek_keyboard_set_size
eek_keyboard_set_symbol_index eek_keyboard_set_symbol_index
eek_keyboard_get_symbol_index eek_keyboard_get_symbol_index
eek_keyboard_get_group
eek_keyboard_get_level
eek_keyboard_set_group eek_keyboard_set_group
eek_keyboard_set_level eek_keyboard_set_level
eek_keyboard_get_size eek_keyboard_get_group
eek_keyboard_get_modifier_behavior eek_keyboard_get_level
eek_keyboard_set_modifier_behavior eek_keyboard_set_modifier_behavior
eek_keyboard_get_modifier_behavior
eek_keyboard_get_modifiers eek_keyboard_get_modifiers
eek_keyboard_create_section eek_keyboard_create_section
eek_keyboard_find_key_by_keycode eek_keyboard_find_key_by_keycode
eek_keyboard_add_outline
eek_keyboard_get_outline
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_KEYBOARD EEK_KEYBOARD
EEK_IS_KEYBOARD EEK_IS_KEYBOARD
@ -38,6 +42,7 @@ EEK_IS_LAYOUT
EEK_TYPE_LAYOUT EEK_TYPE_LAYOUT
eek_layout_get_type eek_layout_get_type
EEK_LAYOUT_CLASS EEK_LAYOUT_CLASS
EEK_IS_LAYOUT_CLASS
EEK_LAYOUT_GET_CLASS EEK_LAYOUT_GET_CLASS
</SECTION> </SECTION>
@ -46,6 +51,7 @@ EEK_LAYOUT_GET_CLASS
<TITLE>EekGtkKeyboard</TITLE> <TITLE>EekGtkKeyboard</TITLE>
EekGtkKeyboard EekGtkKeyboard
EekGtkKeyboardClass EekGtkKeyboardClass
EekGtkKeyboardPrivate
eek_gtk_keyboard_new eek_gtk_keyboard_new
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_GTK_KEYBOARD EEK_GTK_KEYBOARD
@ -61,6 +67,7 @@ EEK_GTK_KEYBOARD_GET_CLASS
<FILE>eek-section</FILE> <FILE>eek-section</FILE>
<TITLE>EekSection</TITLE> <TITLE>EekSection</TITLE>
EekSectionClass EekSectionClass
EekSectionPrivate
EekSection EekSection
eek_section_set_angle eek_section_set_angle
eek_section_get_angle eek_section_get_angle
@ -83,11 +90,13 @@ EEK_SECTION_GET_CLASS
<FILE>eek-container</FILE> <FILE>eek-container</FILE>
<TITLE>EekContainer</TITLE> <TITLE>EekContainer</TITLE>
EekContainerClass EekContainerClass
EekContainerPrivate
EekCallback EekCallback
EekCompareFunc EekCompareFunc
EekContainer EekContainer
eek_container_foreach_child eek_container_foreach_child
eek_container_find eek_container_find
eek_container_add_child
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_CONTAINER EEK_CONTAINER
EEK_IS_CONTAINER EEK_IS_CONTAINER
@ -103,6 +112,7 @@ EEK_CONTAINER_GET_CLASS
<TITLE>EekClutterKeyboard</TITLE> <TITLE>EekClutterKeyboard</TITLE>
EekClutterKeyboard EekClutterKeyboard
EekClutterKeyboardClass EekClutterKeyboardClass
EekClutterKeyboardPrivate
eek_clutter_keyboard_new eek_clutter_keyboard_new
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_CLUTTER_KEYBOARD EEK_CLUTTER_KEYBOARD
@ -114,11 +124,39 @@ EEK_IS_CLUTTER_KEYBOARD_CLASS
EEK_CLUTTER_KEYBOARD_GET_CLASS EEK_CLUTTER_KEYBOARD_GET_CLASS
</SECTION> </SECTION>
<SECTION>
<FILE>eek-symbol</FILE>
<TITLE>EekSymbol</TITLE>
EekSymbolCategory
EekSymbolClass
EekSymbolPrivate
EekSymbol
eek_symbol_new
eek_symbol_set_name
eek_symbol_get_name
eek_symbol_set_label
eek_symbol_get_label
eek_symbol_set_category
eek_symbol_get_category
eek_symbol_get_modifier_mask
eek_symbol_set_modifier_mask
eek_symbol_is_modifier
<SUBSECTION Standard>
EEK_SYMBOL
EEK_IS_SYMBOL
EEK_TYPE_SYMBOL
eek_symbol_get_type
EEK_SYMBOL_CLASS
EEK_IS_SYMBOL_CLASS
EEK_SYMBOL_GET_CLASS
</SECTION>
<SECTION> <SECTION>
<FILE>eek-xkl-layout</FILE> <FILE>eek-xkl-layout</FILE>
<TITLE>EekXklLayout</TITLE> <TITLE>EekXklLayout</TITLE>
EekXklLayout EekXklLayout
EekXklLayoutClass EekXklLayoutClass
EekXklLayoutPrivate
eek_xkl_layout_new eek_xkl_layout_new
eek_xkl_layout_set_config eek_xkl_layout_set_config
eek_xkl_layout_set_config_full eek_xkl_layout_set_config_full
@ -126,12 +164,12 @@ eek_xkl_layout_set_model
eek_xkl_layout_set_layouts eek_xkl_layout_set_layouts
eek_xkl_layout_set_variants eek_xkl_layout_set_variants
eek_xkl_layout_set_options eek_xkl_layout_set_options
eek_xkl_layout_enable_option
eek_xkl_layout_disable_option
eek_xkl_layout_get_model eek_xkl_layout_get_model
eek_xkl_layout_get_layouts eek_xkl_layout_get_layouts
eek_xkl_layout_get_variants eek_xkl_layout_get_variants
eek_xkl_layout_get_options eek_xkl_layout_get_options
eek_xkl_layout_disable_option
eek_xkl_layout_enable_option
eek_xkl_layout_get_option eek_xkl_layout_get_option
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_XKL_LAYOUT EEK_XKL_LAYOUT
@ -143,30 +181,16 @@ EEK_IS_XKL_LAYOUT_CLASS
EEK_XKL_LAYOUT_GET_CLASS EEK_XKL_LAYOUT_GET_CLASS
</SECTION> </SECTION>
<SECTION>
<FILE>eek-xml-layout</FILE>
<TITLE>EekXmlLayout</TITLE>
eek_xml_layout_get_source
eek_xml_layout_new
eek_xml_layout_set_source
<SUBSECTION Standard>
EEK_XML_LAYOUT
EEK_IS_XML_LAYOUT
EEK_TYPE_XML_LAYOUT
eek_xml_layout_get_type
EEK_XML_LAYOUT_CLASS
EEK_IS_XML_LAYOUT_CLASS
EEK_XML_LAYOUT_GET_CLASS
</SECTION>
<SECTION> <SECTION>
<FILE>eek-xkb-layout</FILE> <FILE>eek-xkb-layout</FILE>
<TITLE>EekXkbLayout</TITLE> <TITLE>EekXkbLayout</TITLE>
EekXkbLayout EekXkbLayout
EekXkbLayoutClass EekXkbLayoutClass
EekXkbLayoutPrivate
eek_xkb_layout_new eek_xkb_layout_new
eek_xkb_layout_set_names eek_xkb_layout_set_names
eek_xkb_layout_set_names_full eek_xkb_layout_set_names_full
eek_xkb_layout_set_names_full_valist
eek_xkb_layout_set_keycodes eek_xkb_layout_set_keycodes
eek_xkb_layout_set_geometry eek_xkb_layout_set_geometry
eek_xkb_layout_set_symbols eek_xkb_layout_set_symbols
@ -187,18 +211,19 @@ EEK_XKB_LAYOUT_GET_CLASS
<FILE>eek-key</FILE> <FILE>eek-key</FILE>
<TITLE>EekKey</TITLE> <TITLE>EekKey</TITLE>
EekKeyClass EekKeyClass
EekKeyPrivate
EekKey EekKey
eek_key_set_keycode eek_key_set_keycode
eek_key_get_keycode eek_key_get_keycode
eek_key_set_symbol_matrix eek_key_set_symbol_matrix
eek_key_get_symbol_matrix eek_key_get_symbol_matrix
eek_key_get_symbol eek_key_get_symbol
eek_key_get_symbol_at_index
eek_key_get_symbol_with_fallback eek_key_get_symbol_with_fallback
eek_key_get_symbol_at_index
eek_key_set_index eek_key_set_index
eek_key_get_index eek_key_get_index
eek_key_set_outline eek_key_set_oref
eek_key_get_outline eek_key_get_oref
eek_key_is_pressed eek_key_is_pressed
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_KEY EEK_KEY
@ -210,10 +235,26 @@ EEK_IS_KEY_CLASS
EEK_KEY_GET_CLASS EEK_KEY_GET_CLASS
</SECTION> </SECTION>
<SECTION>
<FILE>eek-serializable</FILE>
<TITLE>EekSerializable</TITLE>
EekSerializable
EekSerializableIface
eek_serializable_serialize
eek_serializable_deserialize
<SUBSECTION Standard>
EEK_SERIALIZABLE
EEK_IS_SERIALIZABLE
EEK_TYPE_SERIALIZABLE
eek_serializable_get_type
EEK_SERIALIZABLE_GET_IFACE
</SECTION>
<SECTION> <SECTION>
<FILE>eek-element</FILE> <FILE>eek-element</FILE>
<TITLE>EekElement</TITLE> <TITLE>EekElement</TITLE>
EekElementClass EekElementClass
EekElementPrivate
EekElement EekElement
eek_element_set_parent eek_element_set_parent
eek_element_get_parent eek_element_get_parent
@ -221,6 +262,8 @@ eek_element_set_name
eek_element_get_name eek_element_get_name
eek_element_set_bounds eek_element_set_bounds
eek_element_get_bounds eek_element_get_bounds
eek_element_set_position
eek_element_set_size
eek_element_get_absolute_position eek_element_get_absolute_position
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_ELEMENT EEK_ELEMENT
@ -233,72 +276,36 @@ EEK_ELEMENT_GET_CLASS
</SECTION> </SECTION>
<SECTION> <SECTION>
<FILE>eek-symbol</FILE> <FILE>eek-xml-layout</FILE>
<TITLE>EekSymbol</TITLE> <TITLE>EekXmlLayout</TITLE>
EekSymbolClass EekXmlLayout
EekSymbol EekXmlLayoutClass
eek_symbol_new EekXmlLayoutPrivate
eek_symbol_set_name eek_xml_layout_new
eek_symbol_get_name eek_xml_layout_set_source
eek_symbol_set_label eek_xml_layout_get_source
eek_symbol_get_label
eek_symbol_set_category
eek_symbol_get_category
eek_symbol_set_modifier_mask
eek_symbol_get_modifier_mask
eek_symbol_is_modifier
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_SYMBOL EEK_XML_LAYOUT
EEK_IS_SYMBOL EEK_IS_XML_LAYOUT
EEK_TYPE_SYMBOL EEK_TYPE_XML_LAYOUT
eek_symbol_get_type eek_xml_layout_get_type
EEK_SYMBOL_CLASS EEK_XML_LAYOUT_CLASS
EEK_IS_SYMBOL_CLASS EEK_IS_XML_LAYOUT_CLASS
EEK_SYMBOL_GET_CLASS EEK_XML_LAYOUT_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-types</FILE>
<TITLE>Basic Types</TITLE>
EekOrientation
EekModifierBehavior
EekModifierType
EekSymbolMatrix
EekSymbolCategory
EEK_TYPE_SYMBOL_MATRIX
eek_symbol_matrix_copy
eek_symbol_matrix_free
eek_symbol_matrix_get_type
eek_symbol_matrix_new
EekPoint
EEK_TYPE_POINT
eek_point_get_type
eek_point_rotate
EekBounds
EEK_TYPE_BOUNDS
eek_bounds_get_type
eek_bounds_long_side
EekOutline
EEK_TYPE_OUTLINE
eek_outline_get_type
EekColor
EEK_TYPE_COLOR
eek_color_get_type
eek_color_new
</SECTION> </SECTION>
<SECTION> <SECTION>
<FILE>eek-keysym</FILE> <FILE>eek-keysym</FILE>
<TITLE>EekKeysym</TITLE> <TITLE>EekKeysym</TITLE>
EEK_KEYSYM
EekKeysymClass EekKeysymClass
EekKeysymPrivate
EekKeysym EekKeysym
EEK_INVALID_KEYSYM
EEK_INVALID_KEYCODE
eek_keysym_get_xkeysym
eek_keysym_new eek_keysym_new
eek_keysym_get_xkeysym
eek_keysym_new_from_name eek_keysym_new_from_name
<SUBSECTION Standard> <SUBSECTION Standard>
EEK_KEYSYM EEK_INVALID_KEYSYM
EEK_IS_KEYSYM EEK_IS_KEYSYM
EEK_TYPE_KEYSYM EEK_TYPE_KEYSYM
eek_keysym_get_type eek_keysym_get_type
@ -306,3 +313,42 @@ EEK_KEYSYM_CLASS
EEK_IS_KEYSYM_CLASS EEK_IS_KEYSYM_CLASS
EEK_KEYSYM_GET_CLASS EEK_KEYSYM_GET_CLASS
</SECTION> </SECTION>
<SECTION>
<FILE>eek-xml</FILE>
EEK_XML_SCHEMA_VERSION
eek_keyboard_output
</SECTION>
<SECTION>
<FILE>eek-types</FILE>
I_
EEK_TYPE_SYMBOL_MATRIX
EEK_TYPE_POINT
EEK_TYPE_BOUNDS
EEK_TYPE_OUTLINE
EEK_TYPE_COLOR
EekOrientation
EekModifierBehavior
EekModifierType
EEK_INVALID_KEYCODE
EekSymbolMatrix
EekPoint
EekBounds
EekOutline
EekColor
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
</SECTION>

View File

@ -76,7 +76,7 @@ EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths # Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=config.h IGNORE_HFILES=config.h eekboard.h
# Images to copy into HTML directory. # Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
@ -104,7 +104,7 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute # Other files to distribute
# e.g. EXTRA_DIST += version.xml.in # e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += # EXTRA_DIST +=
# Files not to distribute # Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types # for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types

View File

@ -35,8 +35,8 @@
<part id="apireference"> <part id="apireference">
<title>API Manual</title> <title>API Manual</title>
<chapter> <chapter>
<title>D-Bus proxy to eekboard-server</title> <title>D-Bus client interface to eekboard-server</title>
<xi:include href="xml/eekboard-server.xml"/> <xi:include href="xml/eekboard-eekboard.xml"/>
<xi:include href="xml/eekboard-context.xml"/> <xi:include href="xml/eekboard-context.xml"/>
</chapter> </chapter>
<chapter id="object-tree"> <chapter id="object-tree">

View File

@ -1,22 +1,22 @@
<SECTION> <SECTION>
<FILE>eekboard-server</FILE> <FILE>eekboard-eekboard</FILE>
<TITLE>EekboardServer</TITLE> <TITLE>EekboardEekboard</TITLE>
EekboardServer EekboardEekboard
EekboardServerClass EekboardEekboardClass
EekboardServerPrivate EekboardEekboardPrivate
eekboard_server_new eekboard_eekboard_new
eekboard_server_create_context eekboard_eekboard_create_context
eekboard_server_push_context eekboard_eekboard_push_context
eekboard_server_pop_context eekboard_eekboard_pop_context
eekboard_server_destroy_context eekboard_eekboard_destroy_context
<SUBSECTION Standard> <SUBSECTION Standard>
EEKBOARD_SERVER EEKBOARD_EEKBOARD
EEKBOARD_IS_SERVER EEKBOARD_IS_EEKBOARD
EEKBOARD_TYPE_SERVER EEKBOARD_TYPE_EEKBOARD
eekboard_server_get_type eekboard_eekboard_get_type
EEKBOARD_SERVER_CLASS EEKBOARD_EEKBOARD_CLASS
EEKBOARD_IS_SERVER_CLASS EEKBOARD_IS_EEKBOARD_CLASS
EEKBOARD_SERVER_GET_CLASS EEKBOARD_EEKBOARD_GET_CLASS
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -0,0 +1,2 @@
eekboard_context_get_type
eekboard_eekboard_get_type

View File

@ -111,15 +111,19 @@ eek_clutter_renderer_render_key (EekClutterRenderer *renderer,
PangoRectangle extents = { 0, }; PangoRectangle extents = { 0, };
CoglColor color = { 0x00, 0x00, 0x00, 0xFF }; CoglColor color = { 0x00, 0x00, 0x00, 0xFF };
ClutterGeometry geom; ClutterGeometry geom;
gulong oref;
EekKeyboard *keyboard;
g_assert (EEK_IS_CLUTTER_RENDERER(renderer)); g_assert (EEK_IS_CLUTTER_RENDERER(renderer));
g_assert (CLUTTER_IS_ACTOR(actor)); g_assert (CLUTTER_IS_ACTOR(actor));
g_assert (EEK_IS_KEY(key)); g_assert (EEK_IS_KEY(key));
oref = eek_key_get_oref (key);
g_object_get (renderer, "keyboard", &keyboard, NULL);
outline = eek_keyboard_get_outline (keyboard, oref);
g_object_unref (keyboard);
priv = EEK_CLUTTER_RENDERER_GET_PRIVATE(renderer); priv = EEK_CLUTTER_RENDERER_GET_PRIVATE(renderer);
outline = eek_key_get_outline (key);
outline_texture = g_hash_table_lookup (priv->outline_texture_cache, outline_texture = g_hash_table_lookup (priv->outline_texture_cache,
outline); outline);
if (!outline_texture) { if (!outline_texture) {

View File

@ -208,7 +208,7 @@ eek_container_class_init (EekContainerClass *klass)
* added to @container. * added to @container.
*/ */
signals[CHILD_ADDED] = signals[CHILD_ADDED] =
g_signal_new ("child-added", g_signal_new (I_("child-added"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekContainerClass, child_added), G_STRUCT_OFFSET(EekContainerClass, child_added),
@ -226,7 +226,7 @@ eek_container_class_init (EekContainerClass *klass)
* removed from @container. * removed from @container.
*/ */
signals[CHILD_REMOVED] = signals[CHILD_REMOVED] =
g_signal_new ("child-removed", g_signal_new (I_("child-removed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekContainerClass, child_removed), G_STRUCT_OFFSET(EekContainerClass, child_removed),

View File

@ -449,7 +449,7 @@ eek_key_class_init (EekKeyClass *klass)
* the pressed state. * the pressed state.
*/ */
signals[PRESSED] = signals[PRESSED] =
g_signal_new ("pressed", g_signal_new (I_("pressed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekKeyClass, pressed), G_STRUCT_OFFSET(EekKeyClass, pressed),
@ -466,7 +466,7 @@ eek_key_class_init (EekKeyClass *klass)
* the released state. * the released state.
*/ */
signals[RELEASED] = signals[RELEASED] =
g_signal_new ("released", g_signal_new (I_("released"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekKeyClass, released), G_STRUCT_OFFSET(EekKeyClass, released),

View File

@ -556,7 +556,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* is shifted to the pressed state. * is shifted to the pressed state.
*/ */
signals[KEY_PRESSED] = signals[KEY_PRESSED] =
g_signal_new ("key-pressed", g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_pressed), G_STRUCT_OFFSET(EekKeyboardClass, key_pressed),
@ -576,7 +576,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* is shifted to the released state. * is shifted to the released state.
*/ */
signals[KEY_RELEASED] = signals[KEY_RELEASED] =
g_signal_new ("key-released", g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_released), G_STRUCT_OFFSET(EekKeyboardClass, key_released),
@ -597,7 +597,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* global configuration of group/level index changes. * global configuration of group/level index changes.
*/ */
signals[SYMBOL_INDEX_CHANGED] = signals[SYMBOL_INDEX_CHANGED] =
g_signal_new ("symbol-index-changed", g_signal_new (I_("symbol-index-changed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, symbol_index_changed), G_STRUCT_OFFSET(EekKeyboardClass, symbol_index_changed),
@ -738,7 +738,7 @@ eek_keyboard_create_section (EekKeyboard *keyboard)
* eek_keyboard_find_key_by_keycode: * eek_keyboard_find_key_by_keycode:
* @keyboard: an #EekKeyboard * @keyboard: an #EekKeyboard
* @keycode: a keycode * @keycode: a keycode
* @returns: (transfer none): #EeekKey whose keycode is @keycode * @returns: (transfer none): #EekKey whose keycode is @keycode
* *
* Find an #EekKey whose keycode is @keycode. * Find an #EekKey whose keycode is @keycode.
*/ */

View File

@ -37,6 +37,12 @@ G_BEGIN_DECLS
typedef struct _EekKeyboardClass EekKeyboardClass; typedef struct _EekKeyboardClass EekKeyboardClass;
typedef struct _EekKeyboardPrivate EekKeyboardPrivate; typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
/**
* EekKeyboard:
*
* The #EekKeyboard structure contains only private data and should
* only be accessed using the provided API.
*/
struct _EekKeyboard struct _EekKeyboard
{ {
/*< private >*/ /*< private >*/
@ -47,16 +53,16 @@ struct _EekKeyboard
/** /**
* EekKeyboardClass: * EekKeyboardClass:
* @set_keysym_index: virtual function for setting group and level of * @set_symbol_index: virtual function for setting group and level of
* the entire keyboard * the entire keyboard
* @get_keysym_index: virtual function for getting group and level of * @get_symbol_index: virtual function for getting group and level of
* the entire keyboard * the entire keyboard
* @create_section: virtual function for creating a section * @create_section: virtual function for creating a section
* @find_key_by_keycode: virtual function for finding a key in the * @find_key_by_keycode: virtual function for finding a key in the
* keyboard by keycode * keyboard by keycode
* @key_pressed: class handler for #EekKeyboard::key-pressed signal * @key_pressed: class handler for #EekKeyboard::key-pressed signal
* @key_released: class handler for #EekKeyboard::key-released signal * @key_released: class handler for #EekKeyboard::key-released signal
* @keysym_index_changed: class handler for #EekKeyboard::keysym-index-changed signal * @symbol_index_changed: class handler for #EekKeyboard::symbol-index-changed signal
*/ */
struct _EekKeyboardClass struct _EekKeyboardClass
{ {

View File

@ -341,20 +341,6 @@ calculate_font_size (EekRenderer *renderer)
return data.size > 0 ? data.size : data.em_size; return data.size > 0 ? data.size : data.em_size;
} }
static EekKeyboard *
get_keyboard (EekKey *key)
{
EekElement *parent;
parent = eek_element_get_parent (EEK_ELEMENT(key));
g_return_val_if_fail (EEK_IS_SECTION(parent), NULL);
parent = eek_element_get_parent (parent);
g_return_val_if_fail (EEK_IS_KEYBOARD(parent), NULL);
return EEK_KEYBOARD(parent);
}
static void static void
render_key (EekRenderer *self, render_key (EekRenderer *self,
cairo_t *cr, cairo_t *cr,
@ -367,15 +353,13 @@ render_key (EekRenderer *self,
PangoLayout *layout; PangoLayout *layout;
PangoRectangle extents = { 0, }; PangoRectangle extents = { 0, };
gulong oref; gulong oref;
EekKeyboard *keyboard;
eek_element_get_bounds (EEK_ELEMENT(key), &bounds); eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
oref = eek_key_get_oref (key); oref = eek_key_get_oref (key);
if (oref == 0) if (oref == 0)
return; return;
keyboard = get_keyboard (key); outline = eek_keyboard_get_outline (priv->keyboard, oref);
outline = eek_keyboard_get_outline (keyboard, oref);
outline_surface = g_hash_table_lookup (priv->outline_surface_cache, outline_surface = g_hash_table_lookup (priv->outline_surface_cache,
outline); outline);
if (!outline_surface) { if (!outline_surface) {
@ -626,7 +610,7 @@ eek_renderer_class_init (EekRendererClass *klass)
"Keyboard", "Keyboard",
"Keyboard", "Keyboard",
EEK_TYPE_KEYBOARD, EEK_TYPE_KEYBOARD,
G_PARAM_WRITABLE); G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_KEYBOARD, PROP_KEYBOARD,
pspec); pspec);
@ -635,7 +619,7 @@ eek_renderer_class_init (EekRendererClass *klass)
"Pango Context", "Pango Context",
"Pango Context", "Pango Context",
PANGO_TYPE_CONTEXT, PANGO_TYPE_CONTEXT,
G_PARAM_WRITABLE); G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_PCONTEXT, PROP_PCONTEXT,
pspec); pspec);

View File

@ -376,7 +376,7 @@ eek_section_class_init (EekSectionClass *klass)
* is shifted to the pressed state. * is shifted to the pressed state.
*/ */
signals[KEY_PRESSED] = signals[KEY_PRESSED] =
g_signal_new ("key-pressed", g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
0, 0,
@ -396,7 +396,7 @@ eek_section_class_init (EekSectionClass *klass)
* is shifted to the released state. * is shifted to the released state.
*/ */
signals[KEY_RELEASED] = signals[KEY_RELEASED] =
g_signal_new ("key-released", g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
0, 0,

View File

@ -17,6 +17,20 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/**
* SECTION:eek-serializable
* @short_description: Interface implemented by #EekElement to
* serialize it to #GVariant
*
* The #EekSerializableIface interface defines serialize/deserialize
* method of #EekElement.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-serializable.h" #include "eek-serializable.h"
GType GType

View File

@ -31,6 +31,12 @@ G_BEGIN_DECLS
typedef struct _EekSerializable EekSerializable; typedef struct _EekSerializable EekSerializable;
typedef struct _EekSerializableIface EekSerializableIface; typedef struct _EekSerializableIface EekSerializableIface;
/**
* EekSerializableIface:
*
* @serialize: virtual function for serializing object into #GVariant
* @deserialize: virtual function for deserializing object from #GVariant
*/
struct _EekSerializableIface struct _EekSerializableIface
{ {
/*< private >*/ /*< private >*/
@ -41,8 +47,6 @@ struct _EekSerializableIface
gsize (* deserialize) (EekSerializable *object, gsize (* deserialize) (EekSerializable *object,
GVariant *variant, GVariant *variant,
gsize index); gsize index);
void (* copy) (EekSerializable *dest,
const EekSerializable *src);
/*< private >*/ /*< private >*/
/* padding */ /* padding */
@ -51,7 +55,6 @@ struct _EekSerializableIface
GType eek_serializable_get_type (void); GType eek_serializable_get_type (void);
EekSerializable *eek_serializable_copy (EekSerializable *object);
GVariant *eek_serializable_serialize (EekSerializable *object); GVariant *eek_serializable_serialize (EekSerializable *object);
EekSerializable *eek_serializable_deserialize (GVariant *variant); EekSerializable *eek_serializable_deserialize (GVariant *variant);

View File

@ -18,6 +18,13 @@
* 02110-1301 USA * 02110-1301 USA
*/ */
/**
* SECTION:eek-symbol
* @short_description: Base class of a symbol
*
* The #EekSymbolClass class represents a symbol assigned to a key.
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
@ -256,6 +263,13 @@ eek_symbol_get_label (EekSymbol *symbol)
return g_strdup (priv->label); return g_strdup (priv->label);
} }
/**
* eek_symbol_set_category:
* @symbol: an #EekSymbol
* @category: an #EekSymbolCategory
*
* Set symbol category of @symbol to @category.
*/
void void
eek_symbol_set_category (EekSymbol *symbol, eek_symbol_set_category (EekSymbol *symbol,
EekSymbolCategory category) EekSymbolCategory category)
@ -268,6 +282,12 @@ eek_symbol_set_category (EekSymbol *symbol,
priv->category = category; priv->category = category;
} }
/**
* eek_symbol_get_category:
* @symbol: an #EekSymbol
*
* Returns symbol category of @symbol.
*/
EekSymbolCategory EekSymbolCategory
eek_symbol_get_category (EekSymbol *symbol) eek_symbol_get_category (EekSymbol *symbol)
{ {
@ -279,6 +299,12 @@ eek_symbol_get_category (EekSymbol *symbol)
return priv->category; return priv->category;
} }
/**
* eek_symbol_set_modifier_mask:
* @symbol: an #EekSymbol
*
* Set modifier mask @symbol can trigger.
*/
void void
eek_symbol_set_modifier_mask (EekSymbol *symbol, eek_symbol_set_modifier_mask (EekSymbol *symbol,
EekModifierType mask) EekModifierType mask)
@ -291,6 +317,12 @@ eek_symbol_set_modifier_mask (EekSymbol *symbol,
priv->modifier_mask = mask; priv->modifier_mask = mask;
} }
/**
* eek_symbol_get_modifier_mask:
* @symbol: an #EekSymbol
*
* Returns modifier mask @symbol can trigger.
*/
EekModifierType EekModifierType
eek_symbol_get_modifier_mask (EekSymbol *symbol) eek_symbol_get_modifier_mask (EekSymbol *symbol)
{ {

View File

@ -31,6 +31,11 @@ G_BEGIN_DECLS
* @EEK_SYMBOL_CATEGORY_FUNCTION: the symbol represents a function * @EEK_SYMBOL_CATEGORY_FUNCTION: the symbol represents a function
* @EEK_SYMBOL_CATEGORY_KEYNAME: the symbol does not have meaning but * @EEK_SYMBOL_CATEGORY_KEYNAME: the symbol does not have meaning but
* have a name * have a name
* @EEK_SYMBOL_CATEGORY_USER0: reserved for future use
* @EEK_SYMBOL_CATEGORY_USER1: reserved for future use
* @EEK_SYMBOL_CATEGORY_USER2: reserved for future use
* @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_UNKNOWN: used for error reporting
* *
* Category of the key symbols. * Category of the key symbols.
@ -59,6 +64,12 @@ typedef enum {
typedef struct _EekSymbolClass EekSymbolClass; typedef struct _EekSymbolClass EekSymbolClass;
typedef struct _EekSymbolPrivate EekSymbolPrivate; typedef struct _EekSymbolPrivate EekSymbolPrivate;
/**
* EekSymbol:
*
* The #EekSymbol structure contains only private data and should only
* be accessed using the provided API.
*/
struct _EekSymbol { struct _EekSymbol {
/*< private >*/ /*< private >*/
GObject parent; GObject parent;
@ -66,6 +77,9 @@ struct _EekSymbol {
EekSymbolPrivate *priv; EekSymbolPrivate *priv;
}; };
/**
* EekSymbolClass:
*/
struct _EekSymbolClass { struct _EekSymbolClass {
/*< private >*/ /*< private >*/
GObjectClass parent_class; GObjectClass parent_class;

View File

@ -24,6 +24,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define I_(string) g_intern_static_string (string)
#define EEK_TYPE_SYMBOL_MATRIX (eek_symbol_matrix_get_type ()) #define EEK_TYPE_SYMBOL_MATRIX (eek_symbol_matrix_get_type ())
#define EEK_TYPE_POINT (eek_point_get_type ()) #define EEK_TYPE_POINT (eek_point_get_type ())
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ()) #define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
@ -62,6 +64,35 @@ typedef enum {
EEK_MODIFIER_BEHAVIOR_LATCH EEK_MODIFIER_BEHAVIOR_LATCH
} EekModifierBehavior; } EekModifierBehavior;
/**
* EekModifierType:
* @EEK_SHIFT_MASK: the Shift key.
* @EEK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
* X server this may either be CapsLock or ShiftLock).
* @EEK_CONTROL_MASK: the Control key.
* @EEK_MOD1_MASK: the fourth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier, but
* normally it is the Alt key).
* @EEK_MOD2_MASK: the fifth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @EEK_MOD3_MASK: the sixth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @EEK_MOD4_MASK: the seventh modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @EEK_MOD5_MASK: the eighth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @EEK_BUTTON1_MASK: the first mouse button.
* @EEK_BUTTON2_MASK: the second mouse button.
* @EEK_BUTTON3_MASK: the third mouse button.
* @EEK_BUTTON4_MASK: the fourth mouse button.
* @EEK_BUTTON5_MASK: the fifth mouse button.
* @EEK_SUPER_MASK: the Super modifier. Since 2.10
* @EEK_HYPER_MASK: the Hyper modifier. Since 2.10
* @EEK_META_MASK: the Meta modifier. Since 2.10
* @EEK_RELEASE_MASK: not used in EEK itself. GTK+ uses it to differentiate
* between (keyval, modifiers) pairs from key press and release events.
* @EEK_MODIFIER_MASK: a mask covering all modifier types.
*/
typedef enum typedef enum
{ {
EEK_SHIFT_MASK = 1 << 0, EEK_SHIFT_MASK = 1 << 0,

View File

@ -21,13 +21,13 @@
* @short_description: Layout engine which loads layout information from XML * @short_description: Layout engine which loads layout information from XML
*/ */
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
#include "eek-xml-layout.h" #include "eek-xml-layout.h"
#include "eek-keyboard.h" #include "eek-keyboard.h"
#include "eek-section.h" #include "eek-section.h"

View File

@ -35,6 +35,12 @@ typedef struct _EekXmlLayout EekXmlLayout;
typedef struct _EekXmlLayoutClass EekXmlLayoutClass; typedef struct _EekXmlLayoutClass EekXmlLayoutClass;
typedef struct _EekXmlLayoutPrivate EekXmlLayoutPrivate; typedef struct _EekXmlLayoutPrivate EekXmlLayoutPrivate;
/**
* EekXmlLayout:
*
* The #EekXmlLayout structure contains only private data and should
* only be accessed using the provided API.
*/
struct _EekXmlLayout struct _EekXmlLayout
{ {
/*< private >*/ /*< private >*/
@ -43,6 +49,9 @@ struct _EekXmlLayout
EekXmlLayoutPrivate *priv; EekXmlLayoutPrivate *priv;
}; };
/**
* EekXmlLayoutClass:
*/
struct _EekXmlLayoutClass struct _EekXmlLayoutClass
{ {
/*< private >*/ /*< private >*/

View File

@ -16,6 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* SECTION: eek-xml
* @short_description: #EekKeyboard to XML conversion utilities
*/
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <glib/gprintf.h> #include <glib/gprintf.h>
@ -216,6 +221,14 @@ output_section_callback (EekElement *element, gpointer user_data)
g_string_markup_printf (data->output, "</section>\n"); g_string_markup_printf (data->output, "</section>\n");
} }
/**
* eek_keyboard_output:
* @keyboard: an #EekKeyboard
* @output: a GString
* @indent: an integer
*
* Convert @keyboard into the XML format and store it into @output.
*/
void void
eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent) eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent)
{ {

View File

@ -27,7 +27,9 @@ G_BEGIN_DECLS
#define EEK_XML_SCHEMA_VERSION "0.90" #define EEK_XML_SCHEMA_VERSION "0.90"
void eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent); void eek_keyboard_output (EekKeyboard *keyboard,
GString *output,
gint indent);
G_END_DECLS G_END_DECLS
#endif /* EEK_XML_H */ #endif /* EEK_XML_H */

View File

@ -20,10 +20,10 @@ lib_LTLIBRARIES = libeekboard.la
libeekboard_headers = \ libeekboard_headers = \
eekboard.h \ eekboard.h \
eekboard-server.h \ eekboard-eekboard.h \
eekboard-context.h eekboard-context.h
libeekboard_sources = \ libeekboard_sources = \
eekboard-server.c \ eekboard-eekboard.c \
eekboard-context.c eekboard-context.c
libeekboard_la_SOURCES = $(libeekboard_sources) libeekboard_la_SOURCES = $(libeekboard_sources)

View File

@ -30,6 +30,8 @@
#include "eekboard/eekboard-context.h" #include "eekboard/eekboard-context.h"
#define I_(string) g_intern_static_string (string)
enum { enum {
ENABLED, ENABLED,
DISABLED, DISABLED,
@ -211,10 +213,10 @@ eekboard_context_class_init (EekboardContextClass *klass)
* EekboardContext::enabled: * EekboardContext::enabled:
* @context: an #EekboardContext * @context: an #EekboardContext
* *
* The ::enabled signal is emitted each time @context is enabled. * Emitted when @context is enabled.
*/ */
signals[ENABLED] = signals[ENABLED] =
g_signal_new ("enabled", g_signal_new (I_("enabled"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekboardContextClass, enabled), G_STRUCT_OFFSET(EekboardContextClass, enabled),
@ -231,7 +233,7 @@ eekboard_context_class_init (EekboardContextClass *klass)
* The ::disabled signal is emitted each time @context is disabled. * The ::disabled signal is emitted each time @context is disabled.
*/ */
signals[DISABLED] = signals[DISABLED] =
g_signal_new ("disabled", g_signal_new (I_("disabled"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekboardContextClass, disabled), G_STRUCT_OFFSET(EekboardContextClass, disabled),
@ -250,7 +252,7 @@ eekboard_context_class_init (EekboardContextClass *klass)
* in @context. * in @context.
*/ */
signals[KEY_PRESSED] = signals[KEY_PRESSED] =
g_signal_new ("key-pressed", g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekboardContextClass, key_pressed), G_STRUCT_OFFSET(EekboardContextClass, key_pressed),
@ -270,7 +272,7 @@ eekboard_context_class_init (EekboardContextClass *klass)
* in @context. * in @context.
*/ */
signals[KEY_RELEASED] = signals[KEY_RELEASED] =
g_signal_new ("key-released", g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class), G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekboardContextClass, key_released), G_STRUCT_OFFSET(EekboardContextClass, key_released),

View File

@ -34,21 +34,42 @@ typedef struct _EekboardContext EekboardContext;
typedef struct _EekboardContextClass EekboardContextClass; typedef struct _EekboardContextClass EekboardContextClass;
typedef struct _EekboardContextPrivate EekboardContextPrivate; typedef struct _EekboardContextPrivate EekboardContextPrivate;
/**
* EekboardContext:
*
* The #EekboardContext structure contains only private data and
* should only be accessed using the provided API.
*/
struct _EekboardContext { struct _EekboardContext {
/*< private >*/
GDBusProxy parent; GDBusProxy parent;
EekboardContextPrivate *priv; EekboardContextPrivate *priv;
}; };
/**
* EekboardContextClass:
* @enabled: class handler for #EekboardContext::enabled signal
* @disabled: class handler for #EekboardContext::disabled signal
* @key_pressed: class handler for #EekboardContext::key-pressed signal
* @key_released: class handler for #EekboardContext::key-released signal
*/
struct _EekboardContextClass { struct _EekboardContextClass {
/*< private >*/
GDBusProxyClass parent_class; GDBusProxyClass parent_class;
/*< public >*/
/* signals */
void (*enabled) (EekboardContext *self); void (*enabled) (EekboardContext *self);
void (*disabled) (EekboardContext *self); void (*disabled) (EekboardContext *self);
void (*key_pressed) (EekboardContext *self, void (*key_pressed) (EekboardContext *self,
guint keycode); guint keycode);
void (*key_released) (EekboardContext *self, void (*key_released) (EekboardContext *self,
guint keycode); guint keycode);
/*< private >*/
/* padding */
gpointer pdummy[24];
}; };
GType eekboard_context_get_type (void) G_GNUC_CONST; GType eekboard_context_get_type (void) G_GNUC_CONST;

View File

@ -17,58 +17,58 @@
*/ */
/** /**
* SECTION:eekboard-server * SECTION:eekboard-eekboard
* @short_description: D-Bus proxy of eekboard-server * @short_description: D-Bus proxy of eekboard-server
* *
* The #EekboardServer class provides a client side access to eekboard-server. * The #EekboardEekboard class provides a client side access to eekboard-server.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include "eekboard/eekboard-server.h" #include "eekboard/eekboard-eekboard.h"
G_DEFINE_TYPE (EekboardServer, eekboard_server, G_TYPE_DBUS_PROXY); G_DEFINE_TYPE (EekboardEekboard, eekboard_eekboard, G_TYPE_DBUS_PROXY);
#define EEKBOARD_SERVER_GET_PRIVATE(obj) \ #define EEKBOARD_EEKBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_SERVER, EekboardServerPrivate)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_EEKBOARD, EekboardEekboardPrivate))
struct _EekboardServerPrivate struct _EekboardEekboardPrivate
{ {
GHashTable *context_hash; GHashTable *context_hash;
}; };
static void static void
eekboard_server_dispose (GObject *object) eekboard_eekboard_dispose (GObject *object)
{ {
EekboardServerPrivate *priv = EEKBOARD_SERVER_GET_PRIVATE(object); EekboardEekboardPrivate *priv = EEKBOARD_EEKBOARD_GET_PRIVATE(object);
if (priv->context_hash) { if (priv->context_hash) {
g_hash_table_destroy (priv->context_hash); g_hash_table_destroy (priv->context_hash);
priv->context_hash = NULL; priv->context_hash = NULL;
} }
G_OBJECT_CLASS (eekboard_server_parent_class)->dispose (object); G_OBJECT_CLASS (eekboard_eekboard_parent_class)->dispose (object);
} }
static void static void
eekboard_server_class_init (EekboardServerClass *klass) eekboard_eekboard_class_init (EekboardEekboardClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (gobject_class, g_type_class_add_private (gobject_class,
sizeof (EekboardServerPrivate)); sizeof (EekboardEekboardPrivate));
gobject_class->dispose = eekboard_server_dispose; gobject_class->dispose = eekboard_eekboard_dispose;
} }
static void static void
eekboard_server_init (EekboardServer *self) eekboard_eekboard_init (EekboardEekboard *self)
{ {
EekboardServerPrivate *priv; EekboardEekboardPrivate *priv;
priv = self->priv = EEKBOARD_SERVER_GET_PRIVATE(self); priv = self->priv = EEKBOARD_EEKBOARD_GET_PRIVATE(self);
priv->context_hash = priv->context_hash =
g_hash_table_new_full (g_str_hash, g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,
@ -77,14 +77,14 @@ eekboard_server_init (EekboardServer *self)
} }
/** /**
* eekboard_server_new: * eekboard_eekboard_new:
* @connection: a #GDBusConnection * @connection: a #GDBusConnection
* @cancellable: a #GCancellable * @cancellable: a #GCancellable
* *
* Create a D-Bus proxy of eekboard-server. * Create a D-Bus proxy of eekboard-eekboard.
*/ */
EekboardServer * EekboardEekboard *
eekboard_server_new (GDBusConnection *connection, eekboard_eekboard_new (GDBusConnection *connection,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GInitable *initable; GInitable *initable;
@ -94,7 +94,7 @@ eekboard_server_new (GDBusConnection *connection,
error = NULL; error = NULL;
initable = initable =
g_initable_new (EEKBOARD_TYPE_SERVER, g_initable_new (EEKBOARD_TYPE_EEKBOARD,
cancellable, cancellable,
&error, &error,
"g-connection", connection, "g-connection", connection,
@ -103,35 +103,35 @@ eekboard_server_new (GDBusConnection *connection,
"g-object-path", "/com/redhat/Eekboard/Server", "g-object-path", "/com/redhat/Eekboard/Server",
NULL); NULL);
if (initable != NULL) if (initable != NULL)
return EEKBOARD_SERVER (initable); return EEKBOARD_EEKBOARD (initable);
return NULL; return NULL;
} }
/** /**
* eekboard_server_create_context: * eekboard_eekboard_create_context:
* @server: an #EekboardServer * @eekboard: an #EekboardEekboard
* @client_name: name of the client * @client_name: name of the client
* @cancellable: a #GCancellable * @cancellable: a #GCancellable
* *
* Create a new input context. * Create a new input context.
*/ */
EekboardContext * EekboardContext *
eekboard_server_create_context (EekboardServer *server, eekboard_eekboard_create_context (EekboardEekboard *eekboard,
const gchar *client_name, const gchar *client_name,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GVariant *variant; GVariant *variant;
const gchar *object_path; const gchar *object_path;
EekboardContext *context; EekboardContext *context;
EekboardServerPrivate *priv; EekboardEekboardPrivate *priv;
GError *error; GError *error;
GDBusConnection *connection; GDBusConnection *connection;
g_assert (EEKBOARD_IS_SERVER(server)); g_assert (EEKBOARD_IS_EEKBOARD(eekboard));
g_assert (client_name); g_assert (client_name);
error = NULL; error = NULL;
variant = g_dbus_proxy_call_sync (G_DBUS_PROXY(server), variant = g_dbus_proxy_call_sync (G_DBUS_PROXY(eekboard),
"CreateContext", "CreateContext",
g_variant_new ("(s)", client_name), g_variant_new ("(s)", client_name),
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
@ -142,14 +142,14 @@ eekboard_server_create_context (EekboardServer *server,
return NULL; return NULL;
g_variant_get (variant, "(&s)", &object_path); g_variant_get (variant, "(&s)", &object_path);
connection = g_dbus_proxy_get_connection (G_DBUS_PROXY(server)); connection = g_dbus_proxy_get_connection (G_DBUS_PROXY(eekboard));
context = eekboard_context_new (connection, object_path, cancellable); context = eekboard_context_new (connection, object_path, cancellable);
if (!context) { if (!context) {
g_variant_unref (variant); g_variant_unref (variant);
return NULL; return NULL;
} }
priv = EEKBOARD_SERVER_GET_PRIVATE(server); priv = EEKBOARD_EEKBOARD_GET_PRIVATE(eekboard);
g_hash_table_insert (priv->context_hash, g_hash_table_insert (priv->context_hash,
g_strdup (object_path), g_strdup (object_path),
g_object_ref (context)); g_object_ref (context));
@ -157,7 +157,7 @@ eekboard_server_create_context (EekboardServer *server,
} }
static void static void
server_async_ready_callback (GObject *source_object, eekboard_async_ready_callback (GObject *source_object,
GAsyncResult *res, GAsyncResult *res,
gpointer user_data) gpointer user_data)
{ {
@ -172,95 +172,95 @@ server_async_ready_callback (GObject *source_object,
} }
/** /**
* eekboard_server_push_context: * eekboard_eekboard_push_context:
* @server: an #EekboardServer * @eekboard: an #EekboardEekboard
* @context: an #EekboardContext * @context: an #EekboardContext
* @cancellable: a #GCancellable * @cancellable: a #GCancellable
* *
* Enable the input context @context and disable the others. * Enable the input context @context and disable the others.
*/ */
void void
eekboard_server_push_context (EekboardServer *server, eekboard_eekboard_push_context (EekboardEekboard *eekboard,
EekboardContext *context, EekboardContext *context,
GCancellable *cancellable) GCancellable *cancellable)
{ {
EekboardServerPrivate *priv; EekboardEekboardPrivate *priv;
const gchar *object_path; const gchar *object_path;
g_return_if_fail (EEKBOARD_IS_SERVER(server)); g_return_if_fail (EEKBOARD_IS_EEKBOARD(eekboard));
g_return_if_fail (EEKBOARD_IS_CONTEXT(context)); g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context)); object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
priv = EEKBOARD_SERVER_GET_PRIVATE(server); priv = EEKBOARD_EEKBOARD_GET_PRIVATE(eekboard);
context = g_hash_table_lookup (priv->context_hash, object_path); context = g_hash_table_lookup (priv->context_hash, object_path);
if (!context) if (!context)
return; return;
eekboard_context_set_enabled (context, TRUE); eekboard_context_set_enabled (context, TRUE);
g_dbus_proxy_call (G_DBUS_PROXY(server), g_dbus_proxy_call (G_DBUS_PROXY(eekboard),
"PushContext", "PushContext",
g_variant_new ("(s)", object_path), g_variant_new ("(s)", object_path),
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, -1,
cancellable, cancellable,
server_async_ready_callback, eekboard_async_ready_callback,
NULL); NULL);
} }
/** /**
* eekboard_server_pop_context: * eekboard_eekboard_pop_context:
* @server: an #EekboardServer * @eekboard: an #EekboardEekboard
* @cancellable: a #GCancellable * @cancellable: a #GCancellable
* *
* Disable the current input context and enable the previous one. * Disable the current input context and enable the previous one.
*/ */
void void
eekboard_server_pop_context (EekboardServer *server, eekboard_eekboard_pop_context (EekboardEekboard *eekboard,
GCancellable *cancellable) GCancellable *cancellable)
{ {
g_return_if_fail (EEKBOARD_IS_SERVER(server)); g_return_if_fail (EEKBOARD_IS_EEKBOARD(eekboard));
g_dbus_proxy_call (G_DBUS_PROXY(server), g_dbus_proxy_call (G_DBUS_PROXY(eekboard),
"PopContext", "PopContext",
NULL, NULL,
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, -1,
cancellable, cancellable,
server_async_ready_callback, eekboard_async_ready_callback,
NULL); NULL);
} }
/** /**
* eekboard_server_destroy_context: * eekboard_eekboard_destroy_context:
* @server: an #EekboardServer * @eekboard: an #EekboardEekboard
* @context: an #EekboardContext * @context: an #EekboardContext
* @cancellable: a #GCancellable * @cancellable: a #GCancellable
* *
* Remove @context from @server. * Remove @context from @eekboard.
*/ */
void void
eekboard_server_destroy_context (EekboardServer *server, eekboard_eekboard_destroy_context (EekboardEekboard *eekboard,
EekboardContext *context, EekboardContext *context,
GCancellable *cancellable) GCancellable *cancellable)
{ {
EekboardServerPrivate *priv; EekboardEekboardPrivate *priv;
const gchar *object_path; const gchar *object_path;
g_return_if_fail (EEKBOARD_IS_SERVER(server)); g_return_if_fail (EEKBOARD_IS_EEKBOARD(eekboard));
g_return_if_fail (EEKBOARD_IS_CONTEXT(context)); g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
priv = EEKBOARD_SERVER_GET_PRIVATE(server); priv = EEKBOARD_EEKBOARD_GET_PRIVATE(eekboard);
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context)); object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
g_hash_table_remove (priv->context_hash, object_path); g_hash_table_remove (priv->context_hash, object_path);
g_dbus_proxy_call (G_DBUS_PROXY(server), g_dbus_proxy_call (G_DBUS_PROXY(eekboard),
"DestroyContext", "DestroyContext",
g_variant_new ("(s)", object_path), g_variant_new ("(s)", object_path),
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, -1,
cancellable, cancellable,
server_async_ready_callback, eekboard_async_ready_callback,
NULL); NULL);
} }

View File

@ -0,0 +1,73 @@
/*
* 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_EEKBOARD_H
#define EEKBOARD_EEKBOARD_H 1
#include <gio/gio.h>
#include "eekboard/eekboard-context.h"
G_BEGIN_DECLS
#define EEKBOARD_TYPE_EEKBOARD (eekboard_eekboard_get_type())
#define EEKBOARD_EEKBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_EEKBOARD, EekboardEekboard))
#define EEKBOARD_EEKBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_EEKBOARD, EekboardEekboardClass))
#define EEKBOARD_IS_EEKBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_EEKBOARD))
#define EEKBOARD_IS_EEKBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_EEKBOARD))
#define EEKBOARD_EEKBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_EEKBOARD, EekboardEekboardClass))
typedef struct _EekboardEekboard EekboardEekboard;
typedef struct _EekboardEekboardClass EekboardEekboardClass;
typedef struct _EekboardEekboardPrivate EekboardEekboardPrivate;
struct _EekboardEekboard {
/*< private >*/
GDBusProxy parent;
EekboardEekboardPrivate *priv;
};
struct _EekboardEekboardClass {
/*< private >*/
GDBusProxyClass parent_class;
/*< private >*/
/* padding */
gpointer pdummy[24];
};
GType eekboard_eekboard_get_type (void) G_GNUC_CONST;
EekboardEekboard *eekboard_eekboard_new (GDBusConnection *connection,
GCancellable *cancellable);
EekboardContext *eekboard_eekboard_create_context
(EekboardEekboard *eekboard,
const gchar *client_name,
GCancellable *cancellable);
void eekboard_eekboard_push_context
(EekboardEekboard *eekboard,
EekboardContext *context,
GCancellable *cancellable);
void eekboard_eekboard_pop_context (EekboardEekboard *eekboard,
GCancellable *cancellable);
void eekboard_eekboard_destroy_context
(EekboardEekboard *eekboard,
EekboardContext *context,
GCancellable *cancellable);
G_END_DECLS
#endif /* EEKBOARD_EEKBOARD_H */

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_SERVER_H
#define EEKBOARD_SERVER_H 1
#include <gio/gio.h>
#include "eekboard/eekboard-context.h"
G_BEGIN_DECLS
#define EEKBOARD_TYPE_SERVER (eekboard_server_get_type())
#define EEKBOARD_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_SERVER, EekboardServer))
#define EEKBOARD_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_SERVER, EekboardServerClass))
#define EEKBOARD_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_SERVER))
#define EEKBOARD_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_SERVER))
#define EEKBOARD_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_SERVER, EekboardServerClass))
typedef struct _EekboardServer EekboardServer;
typedef struct _EekboardServerClass EekboardServerClass;
typedef struct _EekboardServerPrivate EekboardServerPrivate;
struct _EekboardServer {
GDBusProxy parent;
EekboardServerPrivate *priv;
};
struct _EekboardServerClass {
GDBusProxyClass parent_class;
};
GType eekboard_server_get_type (void) G_GNUC_CONST;
EekboardServer *eekboard_server_new (GDBusConnection *connection,
GCancellable *cancellable);
EekboardContext *eekboard_server_create_context (EekboardServer *server,
const gchar *client_name,
GCancellable *cancellable);
void eekboard_server_push_context (EekboardServer *server,
EekboardContext *context,
GCancellable *cancellable);
void eekboard_server_pop_context (EekboardServer *server,
GCancellable *cancellable);
void eekboard_server_destroy_context (EekboardServer *server,
EekboardContext *context,
GCancellable *cancellable);
G_END_DECLS
#endif /* EEKBOARD_SERVER_H */

View File

@ -18,7 +18,7 @@
#ifndef EEKBOARD_H #ifndef EEKBOARD_H
#define EEKBOARD_H 1 #define EEKBOARD_H 1
#include "eekboard/eekboard-server.h" #include "eekboard/eekboard-eekboard.h"
#include "eekboard/eekboard-context.h" #include "eekboard/eekboard-context.h"
#endif /* EEKBOARD_H */ #endif /* EEKBOARD_H */

5
po/POTFILES.skip Normal file
View File

@ -0,0 +1,5 @@
eek/eek-container.c
eek/eek-key.c
eek/eek-keyboard.c
eek/eek-section.c
eekboard/eekboard-context.c

109
po/ja.po
View File

@ -6,85 +6,74 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: eekboard 0.0.3\n" "Project-Id-Version: eekboard 0.90.2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-06-23 16:52+0900\n" "POT-Creation-Date: 2011-02-24 17:36+0900\n"
"PO-Revision-Date: 2010-06-23 16:55+0900\n" "PO-Revision-Date: 2011-02-24 17:36+0900\n"
"Last-Translator: Daiki Ueno <ueno@unixuser.org>\n" "Last-Translator: Daiki Ueno <ueno@unixuser.org>\n"
"Language-Team: Japanese\n" "Language-Team: Japanese\n"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/eekboard.c:198 #: ../src/client-main.c:36
msgid "_File" msgid "Upload keyboard description from an XML file"
msgstr "ファイル" msgstr "XML ファイルから読み込んだキーボード記述をアップロード"
#: ../src/eekboard.c:199 #: ../src/client-main.c:38
msgid "_Keyboard" msgid "Set group of the keyboard"
msgstr "キーボード" msgstr "キーボードのグループを設定"
#: ../src/eekboard.c:200 #: ../src/client-main.c:40
msgid "_Help" msgid "Show keyboard"
msgstr "ヘルプ" msgstr "キーボードを表示"
#: ../src/eekboard.c:202 #: ../src/client-main.c:42
msgid "Country" msgid "Hide keyboard"
msgstr "" msgstr "キーボードを隠す"
#: ../src/eekboard.c:204 #: ../src/client-main.c:44
msgid "Language" msgid "Press key"
msgstr "言語" msgstr "キーを押す"
#: ../src/eekboard.c:206 #: ../src/client-main.c:46
msgid "Model" msgid "Release key"
msgstr "モデル" msgstr "キーを離す"
#: ../src/eekboard.c:208 #: ../src/client-main.c:48
msgid "Layout" msgid "Listen events"
msgstr "レイアウト" msgstr "イベントの通知を受ける"
#: ../src/eekboard.c:210 #: ../src/desktop-client-main.c:38
msgid "Option" msgid "Listen focus change events with AT-SPI"
msgstr "オプション" msgstr "AT-SPI によるフォーカス変更イベントの通知を受ける"
#: ../src/eekboard.c:217 #: ../src/desktop-client-main.c:40
msgid "Monitor Key Typing" msgid "Listen keystroke events with AT-SPI"
msgstr "打鍵をモニタ" msgstr "AT-SPI による打鍵イベントの通知を受ける"
#: ../src/eekboard.c:232 #: ../src/xml-main.c:46
msgid "Keyboard model to display" msgid "Show the keyboard loaded from an XML file"
msgstr "表示するキーボードのモデル" msgstr "XML ファイルから読み込んだキーボードを表示"
#: ../src/eekboard.c:234 #: ../src/xml-main.c:48
msgid "Keyboard layouts to display, separated with commas" msgid "Output the current layout into an XML file"
msgstr "表示するキーボードのレイアウト,カンマ区切り" msgstr "現在のレイアウトを XML ファイルに出力"
#: ../src/eekboard.c:236 #: ../src/xml-main.c:50
msgid "Keyboard layout options to display, separated with commas" msgid "List configuration items for given spec"
msgstr "表示するキーボードのオプション,カンマ区切り" msgstr "与えられたスペックのための設定項目を一覧"
#: ../src/eekboard.c:238 #: ../src/xml-main.c:52
msgid "List keyboard models" msgid "Specify model"
msgstr "キーボードのモデルを一覧" msgstr "モデルを指定"
#: ../src/eekboard.c:240 #: ../src/xml-main.c:54
msgid "List all available keyboard layouts and variants" msgid "Specify layouts"
msgstr "利用可能なキーボードのレイアウトとバリアントを一覧" msgstr "レイアウトを指定"
#: ../src/eekboard.c:242 #: ../src/xml-main.c:56
msgid "List all available keyboard layout options" msgid "Specify options"
msgstr "利用可能なキーボードのレイアウトオプションを一覧" msgstr "オプションを指定"
#: ../src/eekboard.c:244
msgid "Display version"
msgstr "バージョンを表示"
#: ../src/eekboard.c:261
msgid "A virtual keyboard for GNOME"
msgstr "GNOME 向け仮想キーボード"
#: ../src/eekboard.c:265
msgid "Eekboard web site"
msgstr "Eekboard のウェブサイト"

View File

@ -19,6 +19,8 @@
#include "config.h" #include "config.h"
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <glib/gi18n.h>
#include "eekboard/eekboard.h" #include "eekboard/eekboard.h"
static gchar *opt_set_keyboard = NULL; static gchar *opt_set_keyboard = NULL;
@ -31,19 +33,19 @@ static gboolean opt_listen = FALSE;
static const GOptionEntry options[] = { static const GOptionEntry options[] = {
{"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard, {"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard,
"Set keyboard keyboard from an XML file"}, N_("Upload keyboard description from an XML file")},
{"set-group", '\0', 0, G_OPTION_ARG_INT, &opt_set_group, {"set-group", '\0', 0, G_OPTION_ARG_INT, &opt_set_group,
"Set group of the keyboard"}, N_("Set group of the keyboard")},
{"show-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_show_keyboard, {"show-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_show_keyboard,
"Show keyboard"}, N_("Show keyboard")},
{"hide-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_hide_keyboard, {"hide-keyboard", '\0', 0, G_OPTION_ARG_NONE, &opt_hide_keyboard,
"Hide keyboard"}, N_("Hide keyboard")},
{"press-key", '\0', 0, G_OPTION_ARG_INT, &opt_press_key, {"press-key", '\0', 0, G_OPTION_ARG_INT, &opt_press_key,
"Press key"}, N_("Press key")},
{"release-key", '\0', 0, G_OPTION_ARG_INT, &opt_release_key, {"release-key", '\0', 0, G_OPTION_ARG_INT, &opt_release_key,
"Release key"}, N_("Release key")},
{"listen", '\0', 0, G_OPTION_ARG_NONE, &opt_listen, {"listen", '\0', 0, G_OPTION_ARG_NONE, &opt_listen,
"Listen events"}, N_("Listen events")},
{NULL} {NULL}
}; };
@ -62,7 +64,7 @@ on_key_released (guint keycode, gpointer user_data)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
EekboardServer *server = NULL; EekboardEekboard *eekboard = NULL;
EekboardContext *context = NULL; EekboardContext *context = NULL;
GDBusConnection *connection = NULL; GDBusConnection *connection = NULL;
GError *error; GError *error;
@ -86,14 +88,14 @@ main (int argc, char **argv)
goto out; goto out;
} }
server = eekboard_server_new (connection, NULL); eekboard = eekboard_eekboard_new (connection, NULL);
if (!server) { if (!eekboard) {
g_printerr ("Can't create server\n"); g_printerr ("Can't create eekboard\n");
retval = 1; retval = 1;
goto out; goto out;
} }
context = eekboard_server_create_context (server, context = eekboard_eekboard_create_context (eekboard,
"eekboard-client", "eekboard-client",
NULL); NULL);
if (!context) { if (!context) {
@ -102,7 +104,7 @@ main (int argc, char **argv)
goto out; goto out;
} }
eekboard_server_push_context (server, context, NULL); eekboard_eekboard_push_context (eekboard, context, NULL);
if (opt_set_keyboard) { if (opt_set_keyboard) {
GFile *file; GFile *file;

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <cspi/spi.h> #include <cspi/spi.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include "eekboard/eekboard.h" #include "eekboard/eekboard.h"
#include "desktop-client.h" #include "desktop-client.h"
@ -34,9 +35,9 @@ gboolean opt_keystroke = FALSE;
static const GOptionEntry options[] = { static const GOptionEntry options[] = {
#ifdef HAVE_CSPI #ifdef HAVE_CSPI
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus, {"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
"Listen focus change events with AT-SPI"}, N_("Listen focus change events with AT-SPI")},
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke, {"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
"Listen keystroke events with AT-SPI"}, N_("Listen keystroke events with AT-SPI")},
#endif /* HAVE_CSPI */ #endif /* HAVE_CSPI */
{NULL} {NULL}
}; };

View File

@ -51,7 +51,7 @@ typedef struct _EekboardDesktopClientClass EekboardDesktopClientClass;
struct _EekboardDesktopClient { struct _EekboardDesktopClient {
GObject parent; GObject parent;
EekboardServer *server; EekboardEekboard *eekboard;
EekboardContext *context; EekboardContext *context;
EekKeyboard *keyboard; EekKeyboard *keyboard;
@ -119,16 +119,16 @@ eekboard_desktop_client_set_property (GObject *object,
case PROP_CONNECTION: case PROP_CONNECTION:
connection = g_value_get_object (value); connection = g_value_get_object (value);
client->server = eekboard_server_new (connection, NULL); client->eekboard = eekboard_eekboard_new (connection, NULL);
g_assert (client->server); g_assert (client->eekboard);
client->context = client->context =
eekboard_server_create_context (client->server, eekboard_eekboard_create_context (client->eekboard,
"eekboard-desktop-client", "eekboard-desktop-client",
NULL); NULL);
g_assert (client->context); g_assert (client->context);
eekboard_server_push_context (client->server, client->context, NULL); eekboard_eekboard_push_context (client->eekboard, client->context, NULL);
break; break;
default: default:
g_object_set_property (object, g_object_set_property (object,
@ -175,17 +175,17 @@ eekboard_desktop_client_dispose (GObject *object)
#endif /* HAVE_FAKEKEY */ #endif /* HAVE_FAKEKEY */
if (client->context) { if (client->context) {
if (client->server) { if (client->eekboard) {
eekboard_server_pop_context (client->server, NULL); eekboard_eekboard_pop_context (client->eekboard, NULL);
} }
g_object_unref (client->context); g_object_unref (client->context);
client->context = NULL; client->context = NULL;
} }
if (client->server) { if (client->eekboard) {
g_object_unref (client->server); g_object_unref (client->eekboard);
client->server = NULL; client->eekboard = NULL;
} }
if (client->keyboard) { if (client->keyboard) {
@ -239,7 +239,7 @@ eekboard_desktop_client_class_init (EekboardDesktopClientClass *klass)
static void static void
eekboard_desktop_client_init (EekboardDesktopClient *client) eekboard_desktop_client_init (EekboardDesktopClient *client)
{ {
client->server = NULL; client->eekboard = NULL;
client->context = NULL; client->context = NULL;
client->display = NULL; client->display = NULL;
client->xkl_engine = NULL; client->xkl_engine = NULL;

View File

@ -181,14 +181,11 @@ update_widget (ServerContext *context)
if (context->widget) if (context->widget)
gtk_widget_destroy (context->widget); gtk_widget_destroy (context->widget);
if (context->window)
gtk_widget_destroy (context->window);
eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds); eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds);
#if HAVE_CLUTTER_GTK #if HAVE_CLUTTER_GTK
context->widget = gtk_clutter_embed_new (); context->widget = gtk_clutter_embed_new ();
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget)); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget));
actor = eek_clutter_context_new (context->keyboard); actor = eek_clutter_keyboard_new (context->keyboard);
clutter_container_add_actor (CLUTTER_CONTAINER(stage), actor); clutter_container_add_actor (CLUTTER_CONTAINER(stage), actor);
clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color); clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
@ -205,13 +202,13 @@ update_widget (ServerContext *context)
#endif #endif
gtk_widget_set_size_request (context->widget, bounds.width, bounds.height); gtk_widget_set_size_request (context->widget, bounds.width, bounds.height);
if (!context->window) {
context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (context->window, "destroy", g_signal_connect (context->window, "destroy",
G_CALLBACK(on_destroy), context); G_CALLBACK(on_destroy), context);
context->notify_visible_handler = context->notify_visible_handler =
g_signal_connect (context->window, "notify::visible", g_signal_connect (context->window, "notify::visible",
G_CALLBACK(on_notify_visible), context); G_CALLBACK(on_notify_visible), context);
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
gtk_widget_set_can_focus (context->window, FALSE); gtk_widget_set_can_focus (context->window, FALSE);
g_object_set (G_OBJECT(context->window), "accept_focus", FALSE, NULL); g_object_set (G_OBJECT(context->window), "accept_focus", FALSE, NULL);
@ -226,6 +223,8 @@ update_widget (ServerContext *context)
gtk_window_move (GTK_WINDOW(context->window), gtk_window_move (GTK_WINDOW(context->window),
MAX(rect.width - 20 - bounds.width, 0), MAX(rect.width - 20 - bounds.width, 0),
MAX(rect.height - 40 - bounds.height, 0)); MAX(rect.height - 40 - bounds.height, 0));
}
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
} }
static void static void
@ -609,6 +608,7 @@ server_context_set_enabled (ServerContext *context, gboolean enabled)
if (context->enabled == enabled) if (context->enabled == enabled)
return; return;
context->enabled = enabled;
if (enabled) { if (enabled) {
error = NULL; error = NULL;
g_dbus_connection_emit_signal (context->connection, g_dbus_connection_emit_signal (context->connection,
@ -637,7 +637,6 @@ server_context_set_enabled (ServerContext *context, gboolean enabled)
gtk_widget_hide (context->window); gtk_widget_hide (context->window);
} }
} }
context->enabled = enabled;
} }
void void

View File

@ -18,6 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"

View File

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <glib/gi18n.h>
#include "eek/eek-xml.h" #include "eek/eek-xml.h"
#include "eek/eek-xkl.h" #include "eek/eek-xkl.h"
@ -42,17 +43,17 @@ static gchar *opt_list = NULL;
static const GOptionEntry options[] = { static const GOptionEntry options[] = {
{"load", 'l', 0, G_OPTION_ARG_STRING, &opt_load, {"load", 'l', 0, G_OPTION_ARG_STRING, &opt_load,
"Show the keyboard loaded from an XML file"}, N_("Show the keyboard loaded from an XML file")},
{"dump", 'd', 0, G_OPTION_ARG_NONE, &opt_dump, {"dump", 'd', 0, G_OPTION_ARG_NONE, &opt_dump,
"Dump the current layout as XML"}, N_("Output the current layout into an XML file")},
{"list", 'L', 0, G_OPTION_ARG_STRING, &opt_list, {"list", 'L', 0, G_OPTION_ARG_STRING, &opt_list,
"List configuration items for given spec"}, N_("List configuration items for given spec")},
{"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model, {"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
"Specify model"}, N_("Specify model")},
{"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts, {"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
"Specify layouts"}, N_("Specify layouts")},
{"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options, {"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
"Specify options"}, N_("Specify options")},
{NULL} {NULL}
}; };