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
# 02110-1301 USA
if ENABLE_VALA
SUBDIRS = vala
else
SUBDIRS =
if ENABLE_PYTHON
SUBDIRS += python
endif
if ENABLE_VALA
SUBDIRS += vala
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])
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
AM_INIT_AUTOMAKE
@ -132,6 +132,37 @@ fi
AC_MSG_RESULT($enable_cspi)
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
AC_MSG_CHECKING([whether you enable Vala language support])
AC_ARG_ENABLE(vala,
@ -195,6 +226,8 @@ eekboard/Makefile
src/Makefile
tests/Makefile
bindings/Makefile
bindings/python/Makefile
bindings/python/eekboard/Makefile
bindings/vala/Makefile
docs/Makefile
docs/reference/Makefile

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=
SCAN_OPTIONS=--rebuild-types
# Extra options to supply to gtkdoc-mkdb.
# 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
# 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.
# 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_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
GTKDOC_LIBS = $(top_srcdir)/eek/libeek.la \
$(top_srcdir)/eek/libeek-gtk.la \
$(top_srcdir)/eek/libeek-xkb.la \
$(top_srcdir)/eek/libeek-xkl.la \
GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
$(top_builddir)/eek/libeek-gtk.la \
$(top_builddir)/eek/libeek-xkb.la \
$(top_builddir)/eek/libeek-xkl.la \
$(GIO2_LIBS) \
$(GTK_LIBS) \
$(XKB_LIBS)
if ENABLE_CLUTTER
GTKDOC_LIBS += $(top_srcdir)/eek/libeek-clutter.la $(CLUTTER_LIBS)
GTKDOC_LIBS += \
$(top_builddir)/eek/libeek-clutter.la \
$(CLUTTER_LIBS)
endif
# This includes the standard gtk-doc make rules, copied by gtkdocize.

View File

@ -37,14 +37,16 @@
<title>API Manual</title>
<chapter>
<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-container.xml"/>
<xi:include href="xml/eek-keyboard.xml"/>
<xi:include href="xml/eek-section.xml"/>
<xi:include href="xml/eek-key.xml"/>
<xi:include href="xml/eek-symbol.xml"/>
<xi:include href="xml/eek-keysym.xml"/>
<xi:include href="xml/eek-layout.xml"/>
<xi:include href="xml/eek-types.xml"/>
<xi:include href="xml/eek-keysym.xml"/>
</chapter>
<chapter>
<title>Clutter Keyboard</title>
@ -62,6 +64,11 @@
<title>XKB Layout Engine</title>
<xi:include href="xml/eek-xkb-layout.xml"/>
</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">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>

View File

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

View File

@ -2,21 +2,25 @@
<FILE>eek-keyboard</FILE>
<TITLE>EekKeyboard</TITLE>
EekKeyboardClass
EekKeyboardPrivate
EekKeyboard
eek_keyboard_new
eek_keyboard_get_layout
eek_keyboard_get_size
eek_keyboard_set_size
eek_keyboard_set_symbol_index
eek_keyboard_get_symbol_index
eek_keyboard_get_group
eek_keyboard_get_level
eek_keyboard_set_group
eek_keyboard_set_level
eek_keyboard_get_size
eek_keyboard_get_modifier_behavior
eek_keyboard_get_group
eek_keyboard_get_level
eek_keyboard_set_modifier_behavior
eek_keyboard_get_modifier_behavior
eek_keyboard_get_modifiers
eek_keyboard_create_section
eek_keyboard_find_key_by_keycode
eek_keyboard_add_outline
eek_keyboard_get_outline
<SUBSECTION Standard>
EEK_KEYBOARD
EEK_IS_KEYBOARD
@ -38,6 +42,7 @@ EEK_IS_LAYOUT
EEK_TYPE_LAYOUT
eek_layout_get_type
EEK_LAYOUT_CLASS
EEK_IS_LAYOUT_CLASS
EEK_LAYOUT_GET_CLASS
</SECTION>
@ -46,6 +51,7 @@ EEK_LAYOUT_GET_CLASS
<TITLE>EekGtkKeyboard</TITLE>
EekGtkKeyboard
EekGtkKeyboardClass
EekGtkKeyboardPrivate
eek_gtk_keyboard_new
<SUBSECTION Standard>
EEK_GTK_KEYBOARD
@ -61,6 +67,7 @@ EEK_GTK_KEYBOARD_GET_CLASS
<FILE>eek-section</FILE>
<TITLE>EekSection</TITLE>
EekSectionClass
EekSectionPrivate
EekSection
eek_section_set_angle
eek_section_get_angle
@ -83,11 +90,13 @@ EEK_SECTION_GET_CLASS
<FILE>eek-container</FILE>
<TITLE>EekContainer</TITLE>
EekContainerClass
EekContainerPrivate
EekCallback
EekCompareFunc
EekContainer
eek_container_foreach_child
eek_container_find
eek_container_add_child
<SUBSECTION Standard>
EEK_CONTAINER
EEK_IS_CONTAINER
@ -103,6 +112,7 @@ EEK_CONTAINER_GET_CLASS
<TITLE>EekClutterKeyboard</TITLE>
EekClutterKeyboard
EekClutterKeyboardClass
EekClutterKeyboardPrivate
eek_clutter_keyboard_new
<SUBSECTION Standard>
EEK_CLUTTER_KEYBOARD
@ -114,11 +124,39 @@ EEK_IS_CLUTTER_KEYBOARD_CLASS
EEK_CLUTTER_KEYBOARD_GET_CLASS
</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>
<FILE>eek-xkl-layout</FILE>
<TITLE>EekXklLayout</TITLE>
EekXklLayout
EekXklLayoutClass
EekXklLayoutPrivate
eek_xkl_layout_new
eek_xkl_layout_set_config
eek_xkl_layout_set_config_full
@ -126,12 +164,12 @@ eek_xkl_layout_set_model
eek_xkl_layout_set_layouts
eek_xkl_layout_set_variants
eek_xkl_layout_set_options
eek_xkl_layout_enable_option
eek_xkl_layout_disable_option
eek_xkl_layout_get_model
eek_xkl_layout_get_layouts
eek_xkl_layout_get_variants
eek_xkl_layout_get_options
eek_xkl_layout_disable_option
eek_xkl_layout_enable_option
eek_xkl_layout_get_option
<SUBSECTION Standard>
EEK_XKL_LAYOUT
@ -143,30 +181,16 @@ EEK_IS_XKL_LAYOUT_CLASS
EEK_XKL_LAYOUT_GET_CLASS
</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>
<FILE>eek-xkb-layout</FILE>
<TITLE>EekXkbLayout</TITLE>
EekXkbLayout
EekXkbLayoutClass
EekXkbLayoutPrivate
eek_xkb_layout_new
eek_xkb_layout_set_names
eek_xkb_layout_set_names_full
eek_xkb_layout_set_names_full_valist
eek_xkb_layout_set_keycodes
eek_xkb_layout_set_geometry
eek_xkb_layout_set_symbols
@ -187,18 +211,19 @@ EEK_XKB_LAYOUT_GET_CLASS
<FILE>eek-key</FILE>
<TITLE>EekKey</TITLE>
EekKeyClass
EekKeyPrivate
EekKey
eek_key_set_keycode
eek_key_get_keycode
eek_key_set_symbol_matrix
eek_key_get_symbol_matrix
eek_key_get_symbol
eek_key_get_symbol_at_index
eek_key_get_symbol_with_fallback
eek_key_get_symbol_at_index
eek_key_set_index
eek_key_get_index
eek_key_set_outline
eek_key_get_outline
eek_key_set_oref
eek_key_get_oref
eek_key_is_pressed
<SUBSECTION Standard>
EEK_KEY
@ -210,10 +235,26 @@ EEK_IS_KEY_CLASS
EEK_KEY_GET_CLASS
</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>
<FILE>eek-element</FILE>
<TITLE>EekElement</TITLE>
EekElementClass
EekElementPrivate
EekElement
eek_element_set_parent
eek_element_get_parent
@ -221,6 +262,8 @@ eek_element_set_name
eek_element_get_name
eek_element_set_bounds
eek_element_get_bounds
eek_element_set_position
eek_element_set_size
eek_element_get_absolute_position
<SUBSECTION Standard>
EEK_ELEMENT
@ -233,72 +276,36 @@ EEK_ELEMENT_GET_CLASS
</SECTION>
<SECTION>
<FILE>eek-symbol</FILE>
<TITLE>EekSymbol</TITLE>
EekSymbolClass
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_set_modifier_mask
eek_symbol_get_modifier_mask
eek_symbol_is_modifier
<FILE>eek-xml-layout</FILE>
<TITLE>EekXmlLayout</TITLE>
EekXmlLayout
EekXmlLayoutClass
EekXmlLayoutPrivate
eek_xml_layout_new
eek_xml_layout_set_source
eek_xml_layout_get_source
<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>
<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
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>
<FILE>eek-keysym</FILE>
<TITLE>EekKeysym</TITLE>
EEK_KEYSYM
EekKeysymClass
EekKeysymPrivate
EekKeysym
EEK_INVALID_KEYSYM
EEK_INVALID_KEYCODE
eek_keysym_get_xkeysym
eek_keysym_new
eek_keysym_get_xkeysym
eek_keysym_new_from_name
<SUBSECTION Standard>
EEK_KEYSYM
EEK_INVALID_KEYSYM
EEK_IS_KEYSYM
EEK_TYPE_KEYSYM
eek_keysym_get_type
@ -306,3 +313,42 @@ EEK_KEYSYM_CLASS
EEK_IS_KEYSYM_CLASS
EEK_KEYSYM_GET_CLASS
</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
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=config.h
IGNORE_HFILES=config.h eekboard.h
# Images to copy into HTML directory.
# 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
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST +=
# EXTRA_DIST +=
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types

View File

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

View File

@ -1,22 +1,22 @@
<SECTION>
<FILE>eekboard-server</FILE>
<TITLE>EekboardServer</TITLE>
EekboardServer
EekboardServerClass
EekboardServerPrivate
eekboard_server_new
eekboard_server_create_context
eekboard_server_push_context
eekboard_server_pop_context
eekboard_server_destroy_context
<FILE>eekboard-eekboard</FILE>
<TITLE>EekboardEekboard</TITLE>
EekboardEekboard
EekboardEekboardClass
EekboardEekboardPrivate
eekboard_eekboard_new
eekboard_eekboard_create_context
eekboard_eekboard_push_context
eekboard_eekboard_pop_context
eekboard_eekboard_destroy_context
<SUBSECTION Standard>
EEKBOARD_SERVER
EEKBOARD_IS_SERVER
EEKBOARD_TYPE_SERVER
eekboard_server_get_type
EEKBOARD_SERVER_CLASS
EEKBOARD_IS_SERVER_CLASS
EEKBOARD_SERVER_GET_CLASS
EEKBOARD_EEKBOARD
EEKBOARD_IS_EEKBOARD
EEKBOARD_TYPE_EEKBOARD
eekboard_eekboard_get_type
EEKBOARD_EEKBOARD_CLASS
EEKBOARD_IS_EEKBOARD_CLASS
EEKBOARD_EEKBOARD_GET_CLASS
</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, };
CoglColor color = { 0x00, 0x00, 0x00, 0xFF };
ClutterGeometry geom;
gulong oref;
EekKeyboard *keyboard;
g_assert (EEK_IS_CLUTTER_RENDERER(renderer));
g_assert (CLUTTER_IS_ACTOR(actor));
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);
outline = eek_key_get_outline (key);
outline_texture = g_hash_table_lookup (priv->outline_texture_cache,
outline);
if (!outline_texture) {

View File

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

View File

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

View File

@ -556,7 +556,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* is shifted to the pressed state.
*/
signals[KEY_PRESSED] =
g_signal_new ("key-pressed",
g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_pressed),
@ -576,7 +576,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* is shifted to the released state.
*/
signals[KEY_RELEASED] =
g_signal_new ("key-released",
g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_released),
@ -597,7 +597,7 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
* global configuration of group/level index changes.
*/
signals[SYMBOL_INDEX_CHANGED] =
g_signal_new ("symbol-index-changed",
g_signal_new (I_("symbol-index-changed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, symbol_index_changed),
@ -738,7 +738,7 @@ eek_keyboard_create_section (EekKeyboard *keyboard)
* eek_keyboard_find_key_by_keycode:
* @keyboard: an #EekKeyboard
* @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.
*/

View File

@ -37,6 +37,12 @@ G_BEGIN_DECLS
typedef struct _EekKeyboardClass EekKeyboardClass;
typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
/**
* EekKeyboard:
*
* The #EekKeyboard structure contains only private data and should
* only be accessed using the provided API.
*/
struct _EekKeyboard
{
/*< private >*/
@ -47,16 +53,16 @@ struct _EekKeyboard
/**
* 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
* @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
* @create_section: virtual function for creating a section
* @find_key_by_keycode: virtual function for finding a key in the
* keyboard by keycode
* @key_pressed: class handler for #EekKeyboard::key-pressed 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
{

View File

@ -341,20 +341,6 @@ calculate_font_size (EekRenderer *renderer)
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
render_key (EekRenderer *self,
cairo_t *cr,
@ -367,15 +353,13 @@ render_key (EekRenderer *self,
PangoLayout *layout;
PangoRectangle extents = { 0, };
gulong oref;
EekKeyboard *keyboard;
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
oref = eek_key_get_oref (key);
if (oref == 0)
return;
keyboard = get_keyboard (key);
outline = eek_keyboard_get_outline (keyboard, oref);
outline = eek_keyboard_get_outline (priv->keyboard, oref);
outline_surface = g_hash_table_lookup (priv->outline_surface_cache,
outline);
if (!outline_surface) {
@ -626,7 +610,7 @@ eek_renderer_class_init (EekRendererClass *klass)
"Keyboard",
"Keyboard",
EEK_TYPE_KEYBOARD,
G_PARAM_WRITABLE);
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
g_object_class_install_property (gobject_class,
PROP_KEYBOARD,
pspec);
@ -635,7 +619,7 @@ eek_renderer_class_init (EekRendererClass *klass)
"Pango Context",
"Pango Context",
PANGO_TYPE_CONTEXT,
G_PARAM_WRITABLE);
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
g_object_class_install_property (gobject_class,
PROP_PCONTEXT,
pspec);

View File

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

View File

@ -17,6 +17,20 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* 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"
GType

View File

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

View File

@ -18,6 +18,13 @@
* 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
#include "config.h"
#endif /* HAVE_CONFIG_H */
@ -256,6 +263,13 @@ eek_symbol_get_label (EekSymbol *symbol)
return g_strdup (priv->label);
}
/**
* eek_symbol_set_category:
* @symbol: an #EekSymbol
* @category: an #EekSymbolCategory
*
* Set symbol category of @symbol to @category.
*/
void
eek_symbol_set_category (EekSymbol *symbol,
EekSymbolCategory category)
@ -268,6 +282,12 @@ eek_symbol_set_category (EekSymbol *symbol,
priv->category = category;
}
/**
* eek_symbol_get_category:
* @symbol: an #EekSymbol
*
* Returns symbol category of @symbol.
*/
EekSymbolCategory
eek_symbol_get_category (EekSymbol *symbol)
{
@ -279,6 +299,12 @@ eek_symbol_get_category (EekSymbol *symbol)
return priv->category;
}
/**
* eek_symbol_set_modifier_mask:
* @symbol: an #EekSymbol
*
* Set modifier mask @symbol can trigger.
*/
void
eek_symbol_set_modifier_mask (EekSymbol *symbol,
EekModifierType mask)
@ -291,6 +317,12 @@ eek_symbol_set_modifier_mask (EekSymbol *symbol,
priv->modifier_mask = mask;
}
/**
* eek_symbol_get_modifier_mask:
* @symbol: an #EekSymbol
*
* Returns modifier mask @symbol can trigger.
*/
EekModifierType
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_KEYNAME: the symbol does not have meaning but
* 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
*
* Category of the key symbols.
@ -59,6 +64,12 @@ typedef enum {
typedef struct _EekSymbolClass EekSymbolClass;
typedef struct _EekSymbolPrivate EekSymbolPrivate;
/**
* EekSymbol:
*
* The #EekSymbol structure contains only private data and should only
* be accessed using the provided API.
*/
struct _EekSymbol {
/*< private >*/
GObject parent;
@ -66,6 +77,9 @@ struct _EekSymbol {
EekSymbolPrivate *priv;
};
/**
* EekSymbolClass:
*/
struct _EekSymbolClass {
/*< private >*/
GObjectClass parent_class;

View File

@ -24,6 +24,8 @@
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 ())
@ -62,6 +64,35 @@ typedef enum {
EEK_MODIFIER_BEHAVIOR_LATCH
} 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
{
EEK_SHIFT_MASK = 1 << 0,

View File

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

View File

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

View File

@ -16,6 +16,11 @@
* 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 <stdarg.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");
}
/**
* eek_keyboard_output:
* @keyboard: an #EekKeyboard
* @output: a GString
* @indent: an integer
*
* Convert @keyboard into the XML format and store it into @output.
*/
void
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"
void eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent);
void eek_keyboard_output (EekKeyboard *keyboard,
GString *output,
gint indent);
G_END_DECLS
#endif /* EEK_XML_H */

View File

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

View File

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

View File

@ -34,21 +34,42 @@ typedef struct _EekboardContext EekboardContext;
typedef struct _EekboardContextClass EekboardContextClass;
typedef struct _EekboardContextPrivate EekboardContextPrivate;
/**
* EekboardContext:
*
* The #EekboardContext structure contains only private data and
* should only be accessed using the provided API.
*/
struct _EekboardContext {
/*< private >*/
GDBusProxy parent;
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 {
/*< private >*/
GDBusProxyClass parent_class;
/*< public >*/
/* signals */
void (*enabled) (EekboardContext *self);
void (*disabled) (EekboardContext *self);
void (*key_pressed) (EekboardContext *self,
guint keycode);
void (*key_released) (EekboardContext *self,
guint keycode);
/*< private >*/
/* padding */
gpointer pdummy[24];
};
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
*
* 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
#include "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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_SERVER, EekboardServerPrivate))
#define EEKBOARD_EEKBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEKBOARD_TYPE_EEKBOARD, EekboardEekboardPrivate))
struct _EekboardServerPrivate
struct _EekboardEekboardPrivate
{
GHashTable *context_hash;
};
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) {
g_hash_table_destroy (priv->context_hash);
priv->context_hash = NULL;
}
G_OBJECT_CLASS (eekboard_server_parent_class)->dispose (object);
G_OBJECT_CLASS (eekboard_eekboard_parent_class)->dispose (object);
}
static void
eekboard_server_class_init (EekboardServerClass *klass)
eekboard_eekboard_class_init (EekboardEekboardClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
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
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 =
g_hash_table_new_full (g_str_hash,
g_str_equal,
@ -77,15 +77,15 @@ eekboard_server_init (EekboardServer *self)
}
/**
* eekboard_server_new:
* eekboard_eekboard_new:
* @connection: a #GDBusConnection
* @cancellable: a #GCancellable
*
* Create a D-Bus proxy of eekboard-server.
* Create a D-Bus proxy of eekboard-eekboard.
*/
EekboardServer *
eekboard_server_new (GDBusConnection *connection,
GCancellable *cancellable)
EekboardEekboard *
eekboard_eekboard_new (GDBusConnection *connection,
GCancellable *cancellable)
{
GInitable *initable;
GError *error;
@ -94,7 +94,7 @@ eekboard_server_new (GDBusConnection *connection,
error = NULL;
initable =
g_initable_new (EEKBOARD_TYPE_SERVER,
g_initable_new (EEKBOARD_TYPE_EEKBOARD,
cancellable,
&error,
"g-connection", connection,
@ -103,35 +103,35 @@ eekboard_server_new (GDBusConnection *connection,
"g-object-path", "/com/redhat/Eekboard/Server",
NULL);
if (initable != NULL)
return EEKBOARD_SERVER (initable);
return EEKBOARD_EEKBOARD (initable);
return NULL;
}
/**
* eekboard_server_create_context:
* @server: an #EekboardServer
* eekboard_eekboard_create_context:
* @eekboard: an #EekboardEekboard
* @client_name: name of the client
* @cancellable: a #GCancellable
*
* Create a new input context.
*/
EekboardContext *
eekboard_server_create_context (EekboardServer *server,
const gchar *client_name,
GCancellable *cancellable)
eekboard_eekboard_create_context (EekboardEekboard *eekboard,
const gchar *client_name,
GCancellable *cancellable)
{
GVariant *variant;
const gchar *object_path;
EekboardContext *context;
EekboardServerPrivate *priv;
EekboardEekboardPrivate *priv;
GError *error;
GDBusConnection *connection;
g_assert (EEKBOARD_IS_SERVER(server));
g_assert (EEKBOARD_IS_EEKBOARD(eekboard));
g_assert (client_name);
error = NULL;
variant = g_dbus_proxy_call_sync (G_DBUS_PROXY(server),
variant = g_dbus_proxy_call_sync (G_DBUS_PROXY(eekboard),
"CreateContext",
g_variant_new ("(s)", client_name),
G_DBUS_CALL_FLAGS_NONE,
@ -142,14 +142,14 @@ eekboard_server_create_context (EekboardServer *server,
return NULL;
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);
if (!context) {
g_variant_unref (variant);
return NULL;
}
priv = EEKBOARD_SERVER_GET_PRIVATE(server);
priv = EEKBOARD_EEKBOARD_GET_PRIVATE(eekboard);
g_hash_table_insert (priv->context_hash,
g_strdup (object_path),
g_object_ref (context));
@ -157,7 +157,7 @@ eekboard_server_create_context (EekboardServer *server,
}
static void
server_async_ready_callback (GObject *source_object,
eekboard_async_ready_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
@ -172,95 +172,95 @@ server_async_ready_callback (GObject *source_object,
}
/**
* eekboard_server_push_context:
* @server: an #EekboardServer
* eekboard_eekboard_push_context:
* @eekboard: an #EekboardEekboard
* @context: an #EekboardContext
* @cancellable: a #GCancellable
*
* Enable the input context @context and disable the others.
*/
void
eekboard_server_push_context (EekboardServer *server,
EekboardContext *context,
GCancellable *cancellable)
eekboard_eekboard_push_context (EekboardEekboard *eekboard,
EekboardContext *context,
GCancellable *cancellable)
{
EekboardServerPrivate *priv;
EekboardEekboardPrivate *priv;
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));
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);
if (!context)
return;
eekboard_context_set_enabled (context, TRUE);
g_dbus_proxy_call (G_DBUS_PROXY(server),
g_dbus_proxy_call (G_DBUS_PROXY(eekboard),
"PushContext",
g_variant_new ("(s)", object_path),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
server_async_ready_callback,
eekboard_async_ready_callback,
NULL);
}
/**
* eekboard_server_pop_context:
* @server: an #EekboardServer
* eekboard_eekboard_pop_context:
* @eekboard: an #EekboardEekboard
* @cancellable: a #GCancellable
*
* Disable the current input context and enable the previous one.
*/
void
eekboard_server_pop_context (EekboardServer *server,
GCancellable *cancellable)
eekboard_eekboard_pop_context (EekboardEekboard *eekboard,
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",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
server_async_ready_callback,
eekboard_async_ready_callback,
NULL);
}
/**
* eekboard_server_destroy_context:
* @server: an #EekboardServer
* eekboard_eekboard_destroy_context:
* @eekboard: an #EekboardEekboard
* @context: an #EekboardContext
* @cancellable: a #GCancellable
*
* Remove @context from @server.
* Remove @context from @eekboard.
*/
void
eekboard_server_destroy_context (EekboardServer *server,
EekboardContext *context,
GCancellable *cancellable)
eekboard_eekboard_destroy_context (EekboardEekboard *eekboard,
EekboardContext *context,
GCancellable *cancellable)
{
EekboardServerPrivate *priv;
EekboardEekboardPrivate *priv;
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));
priv = EEKBOARD_SERVER_GET_PRIVATE(server);
priv = EEKBOARD_EEKBOARD_GET_PRIVATE(eekboard);
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
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",
g_variant_new ("(s)", object_path),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
server_async_ready_callback,
eekboard_async_ready_callback,
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
#define EEKBOARD_H 1
#include "eekboard/eekboard-server.h"
#include "eekboard/eekboard-eekboard.h"
#include "eekboard/eekboard-context.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 ""
msgstr ""
"Project-Id-Version: eekboard 0.0.3\n"
"Project-Id-Version: eekboard 0.90.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-06-23 16:52+0900\n"
"PO-Revision-Date: 2010-06-23 16:55+0900\n"
"POT-Creation-Date: 2011-02-24 17:36+0900\n"
"PO-Revision-Date: 2011-02-24 17:36+0900\n"
"Last-Translator: Daiki Ueno <ueno@unixuser.org>\n"
"Language-Team: Japanese\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/eekboard.c:198
msgid "_File"
msgstr "ファイル"
#: ../src/client-main.c:36
msgid "Upload keyboard description from an XML file"
msgstr "XML ファイルから読み込んだキーボード記述をアップロード"
#: ../src/eekboard.c:199
msgid "_Keyboard"
msgstr "キーボード"
#: ../src/client-main.c:38
msgid "Set group of the keyboard"
msgstr "キーボードのグループを設定"
#: ../src/eekboard.c:200
msgid "_Help"
msgstr "ヘルプ"
#: ../src/client-main.c:40
msgid "Show keyboard"
msgstr "キーボードを表示"
#: ../src/eekboard.c:202
msgid "Country"
msgstr ""
#: ../src/client-main.c:42
msgid "Hide keyboard"
msgstr "キーボードを隠す"
#: ../src/eekboard.c:204
msgid "Language"
msgstr "言語"
#: ../src/client-main.c:44
msgid "Press key"
msgstr "キーを押す"
#: ../src/eekboard.c:206
msgid "Model"
msgstr "モデル"
#: ../src/client-main.c:46
msgid "Release key"
msgstr "キーを離す"
#: ../src/eekboard.c:208
msgid "Layout"
msgstr "レイアウト"
#: ../src/client-main.c:48
msgid "Listen events"
msgstr "イベントの通知を受ける"
#: ../src/eekboard.c:210
msgid "Option"
msgstr "オプション"
#: ../src/desktop-client-main.c:38
msgid "Listen focus change events with AT-SPI"
msgstr "AT-SPI によるフォーカス変更イベントの通知を受ける"
#: ../src/eekboard.c:217
msgid "Monitor Key Typing"
msgstr "打鍵をモニタ"
#: ../src/desktop-client-main.c:40
msgid "Listen keystroke events with AT-SPI"
msgstr "AT-SPI による打鍵イベントの通知を受ける"
#: ../src/eekboard.c:232
msgid "Keyboard model to display"
msgstr "表示するキーボードのモデル"
#: ../src/xml-main.c:46
msgid "Show the keyboard loaded from an XML file"
msgstr "XML ファイルから読み込んだキーボードを表示"
#: ../src/eekboard.c:234
msgid "Keyboard layouts to display, separated with commas"
msgstr "表示するキーボードのレイアウト,カンマ区切り"
#: ../src/xml-main.c:48
msgid "Output the current layout into an XML file"
msgstr "現在のレイアウトを XML ファイルに出力"
#: ../src/eekboard.c:236
msgid "Keyboard layout options to display, separated with commas"
msgstr "表示するキーボードのオプション,カンマ区切り"
#: ../src/xml-main.c:50
msgid "List configuration items for given spec"
msgstr "与えられたスペックのための設定項目を一覧"
#: ../src/eekboard.c:238
msgid "List keyboard models"
msgstr "キーボードのモデルを一覧"
#: ../src/xml-main.c:52
msgid "Specify model"
msgstr "モデルを指定"
#: ../src/eekboard.c:240
msgid "List all available keyboard layouts and variants"
msgstr "利用可能なキーボードのレイアウトとバリアントを一覧"
#: ../src/xml-main.c:54
msgid "Specify layouts"
msgstr "レイアウトを指定"
#: ../src/eekboard.c:242
msgid "List all available keyboard layout options"
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 のウェブサイト"
#: ../src/xml-main.c:56
msgid "Specify options"
msgstr "オプションを指定"

View File

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

View File

@ -22,6 +22,7 @@
#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"
@ -34,9 +35,9 @@ gboolean opt_keystroke = FALSE;
static const GOptionEntry options[] = {
#ifdef HAVE_CSPI
{"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 events with AT-SPI"},
N_("Listen keystroke events with AT-SPI")},
#endif /* HAVE_CSPI */
{NULL}
};

View File

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

View File

@ -181,14 +181,11 @@ update_widget (ServerContext *context)
if (context->widget)
gtk_widget_destroy (context->widget);
if (context->window)
gtk_widget_destroy (context->window);
eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds);
#if HAVE_CLUTTER_GTK
context->widget = gtk_clutter_embed_new ();
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_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
@ -205,27 +202,29 @@ update_widget (ServerContext *context)
#endif
gtk_widget_set_size_request (context->widget, bounds.width, bounds.height);
context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (context->window, "destroy",
G_CALLBACK(on_destroy), context);
context->notify_visible_handler =
g_signal_connect (context->window, "notify::visible",
G_CALLBACK(on_notify_visible), context);
if (!context->window) {
context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (context->window, "destroy",
G_CALLBACK(on_destroy), context);
context->notify_visible_handler =
g_signal_connect (context->window, "notify::visible",
G_CALLBACK(on_notify_visible), 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_icon_name (GTK_WINDOW(context->window), "eekboard");
gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
screen = gdk_screen_get_default ();
root = gtk_widget_get_root_window (context->window);
monitor = gdk_screen_get_monitor_at_window (screen, root);
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
gtk_window_move (GTK_WINDOW(context->window),
MAX(rect.width - 20 - bounds.width, 0),
MAX(rect.height - 40 - bounds.height, 0));
}
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
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_icon_name (GTK_WINDOW(context->window), "eekboard");
gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
screen = gdk_screen_get_default ();
root = gtk_widget_get_root_window (context->window);
monitor = gdk_screen_get_monitor_at_window (screen, root);
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
gtk_window_move (GTK_WINDOW(context->window),
MAX(rect.width - 20 - bounds.width, 0),
MAX(rect.height - 40 - bounds.height, 0));
}
static void
@ -609,6 +608,7 @@ server_context_set_enabled (ServerContext *context, gboolean enabled)
if (context->enabled == enabled)
return;
context->enabled = enabled;
if (enabled) {
error = NULL;
g_dbus_connection_emit_signal (context->connection,
@ -637,7 +637,6 @@ server_context_set_enabled (ServerContext *context, gboolean enabled)
gtk_widget_hide (context->window);
}
}
context->enabled = enabled;
}
void

View File

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

View File

@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
#include <gdk/gdkx.h>
#include <glib/gi18n.h>
#include "eek/eek-xml.h"
#include "eek/eek-xkl.h"
@ -42,17 +43,17 @@ static gchar *opt_list = NULL;
static const GOptionEntry options[] = {
{"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 the current layout as XML"},
N_("Output the current layout into an XML file")},
{"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,
"Specify model"},
N_("Specify model")},
{"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
"Specify layouts"},
N_("Specify layouts")},
{"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
"Specify options"},
N_("Specify options")},
{NULL}
};