Compare commits
	
		
			25 Commits
		
	
	
		
			eekboard-0
			...
			eekboard-0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| de064ba0c0 | |||
| ff200d9562 | |||
| a8148683d3 | |||
| 838a15d31a | |||
| 2d66bf24fb | |||
| 64bc7cc955 | |||
| 362f8ec0cb | |||
| d99a40df94 | |||
| ab08955a5f | |||
| 577fcd7f9e | |||
| 7da92bf04c | |||
| f7caf6fe49 | |||
| d111edd76a | |||
| b2657c06a8 | |||
| fccf9e8805 | |||
| 7fc80705dd | |||
| 9007f31c0a | |||
| 18f8e5b98b | |||
| 0087f74178 | |||
| 639ad8df91 | |||
| e8af3dacf1 | |||
| 5d42fb8294 | |||
| 4440a2f1ac | |||
| c9cee89d7e | |||
| 1c3d20ad6f | 
@ -51,8 +51,14 @@ class Context(gobject.GObject):
 | 
				
			|||||||
    def get_giobject(self):
 | 
					    def get_giobject(self):
 | 
				
			||||||
        return self.__giobject
 | 
					        return self.__giobject
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_keyboard(self, keyboard):
 | 
					    def add_keyboard(self, keyboard):
 | 
				
			||||||
        self.__giobject.set_keyboard(keyboard, None)
 | 
					        return self.__giobject.add_keyboard(keyboard, None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def remove_keyboard(self, keyboard_id):
 | 
				
			||||||
 | 
					        return self.__giobject.remove_keyboard(keyboard_id, None)
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    def set_keyboard(self, keyboard_id):
 | 
				
			||||||
 | 
					        self.__giobject.set_keyboard(keyboard_id, None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def show_keyboard(self):
 | 
					    def show_keyboard(self):
 | 
				
			||||||
        self.__giobject.show_keyboard(None)
 | 
					        self.__giobject.show_keyboard(None)
 | 
				
			||||||
 | 
				
			|||||||
@ -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.2], [ueno@unixuser.org])
 | 
					AC_INIT([eekboard], [0.90.3], [ueno@unixuser.org])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dnl Init automake
 | 
					dnl Init automake
 | 
				
			||||||
AM_INIT_AUTOMAKE
 | 
					AM_INIT_AUTOMAKE
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,8 @@ IGNORE_HFILES = \
 | 
				
			|||||||
	eek-renderer.h \
 | 
						eek-renderer.h \
 | 
				
			||||||
	eek-clutter-renderer.h \
 | 
						eek-clutter-renderer.h \
 | 
				
			||||||
	eek-clutter-section.h \
 | 
						eek-clutter-section.h \
 | 
				
			||||||
	eek-clutter-key.h
 | 
						eek-clutter-key.h \
 | 
				
			||||||
 | 
						eek-gtk-renderer.h
 | 
				
			||||||
if !ENABLE_CLUTTER
 | 
					if !ENABLE_CLUTTER
 | 
				
			||||||
IGNORE_HFILES += eek-clutter-keyboard.h eek-clutter.h
 | 
					IGNORE_HFILES += eek-clutter-keyboard.h eek-clutter.h
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
				
			|||||||
@ -107,23 +107,6 @@ EEK_IS_CONTAINER_CLASS
 | 
				
			|||||||
EEK_CONTAINER_GET_CLASS
 | 
					EEK_CONTAINER_GET_CLASS
 | 
				
			||||||
</SECTION>
 | 
					</SECTION>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<SECTION>
 | 
					 | 
				
			||||||
<FILE>eek-clutter-keyboard</FILE>
 | 
					 | 
				
			||||||
<TITLE>EekClutterKeyboard</TITLE>
 | 
					 | 
				
			||||||
EekClutterKeyboard
 | 
					 | 
				
			||||||
EekClutterKeyboardClass
 | 
					 | 
				
			||||||
EekClutterKeyboardPrivate
 | 
					 | 
				
			||||||
eek_clutter_keyboard_new
 | 
					 | 
				
			||||||
<SUBSECTION Standard>
 | 
					 | 
				
			||||||
EEK_CLUTTER_KEYBOARD
 | 
					 | 
				
			||||||
EEK_IS_CLUTTER_KEYBOARD
 | 
					 | 
				
			||||||
EEK_TYPE_CLUTTER_KEYBOARD
 | 
					 | 
				
			||||||
eek_clutter_keyboard_get_type
 | 
					 | 
				
			||||||
EEK_CLUTTER_KEYBOARD_CLASS
 | 
					 | 
				
			||||||
EEK_IS_CLUTTER_KEYBOARD_CLASS
 | 
					 | 
				
			||||||
EEK_CLUTTER_KEYBOARD_GET_CLASS
 | 
					 | 
				
			||||||
</SECTION>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<SECTION>
 | 
					<SECTION>
 | 
				
			||||||
<FILE>eek-symbol</FILE>
 | 
					<FILE>eek-symbol</FILE>
 | 
				
			||||||
<TITLE>EekSymbol</TITLE>
 | 
					<TITLE>EekSymbol</TITLE>
 | 
				
			||||||
@ -141,6 +124,8 @@ eek_symbol_get_category
 | 
				
			|||||||
eek_symbol_get_modifier_mask
 | 
					eek_symbol_get_modifier_mask
 | 
				
			||||||
eek_symbol_set_modifier_mask
 | 
					eek_symbol_set_modifier_mask
 | 
				
			||||||
eek_symbol_is_modifier
 | 
					eek_symbol_is_modifier
 | 
				
			||||||
 | 
					eek_symbol_set_icon_name
 | 
				
			||||||
 | 
					eek_symbol_get_icon_name
 | 
				
			||||||
<SUBSECTION Standard>
 | 
					<SUBSECTION Standard>
 | 
				
			||||||
EEK_SYMBOL
 | 
					EEK_SYMBOL
 | 
				
			||||||
EEK_IS_SYMBOL
 | 
					EEK_IS_SYMBOL
 | 
				
			||||||
@ -265,6 +250,12 @@ eek_element_get_bounds
 | 
				
			|||||||
eek_element_set_position
 | 
					eek_element_set_position
 | 
				
			||||||
eek_element_set_size
 | 
					eek_element_set_size
 | 
				
			||||||
eek_element_get_absolute_position
 | 
					eek_element_get_absolute_position
 | 
				
			||||||
 | 
					eek_element_set_symbol_index
 | 
				
			||||||
 | 
					eek_element_get_symbol_index
 | 
				
			||||||
 | 
					eek_element_set_group
 | 
				
			||||||
 | 
					eek_element_set_level
 | 
				
			||||||
 | 
					eek_element_get_group
 | 
				
			||||||
 | 
					eek_element_get_level
 | 
				
			||||||
<SUBSECTION Standard>
 | 
					<SUBSECTION Standard>
 | 
				
			||||||
EEK_ELEMENT
 | 
					EEK_ELEMENT
 | 
				
			||||||
EEK_IS_ELEMENT
 | 
					EEK_IS_ELEMENT
 | 
				
			||||||
 | 
				
			|||||||
@ -112,8 +112,11 @@ endif
 | 
				
			|||||||
libeek_gtk_public_headers =			\
 | 
					libeek_gtk_public_headers =			\
 | 
				
			||||||
	$(srcdir)/eek-gtk-keyboard.h		\
 | 
						$(srcdir)/eek-gtk-keyboard.h		\
 | 
				
			||||||
	$(srcdir)/eek-gtk.h
 | 
						$(srcdir)/eek-gtk.h
 | 
				
			||||||
 | 
					libeek_gtk_private_headers =			\
 | 
				
			||||||
 | 
						$(srcdir)/eek-gtk-renderer.h
 | 
				
			||||||
libeek_gtk_sources =				\
 | 
					libeek_gtk_sources =				\
 | 
				
			||||||
	$(srcdir)/eek-gtk-keyboard.c
 | 
						$(srcdir)/eek-gtk-keyboard.c		\
 | 
				
			||||||
 | 
						$(srcdir)/eek-gtk-renderer.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libeek_gtk_la_SOURCES = $(libeek_gtk_sources)
 | 
					libeek_gtk_la_SOURCES = $(libeek_gtk_sources)
 | 
				
			||||||
libeek_gtk_la_CFLAGS = $(GTK_CFLAGS)
 | 
					libeek_gtk_la_CFLAGS = $(GTK_CFLAGS)
 | 
				
			||||||
 | 
				
			|||||||
@ -34,15 +34,25 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "eek-element.h"
 | 
					#include "eek-element.h"
 | 
				
			||||||
#include "eek-container.h"
 | 
					#include "eek-container.h"
 | 
				
			||||||
 | 
					#include "eek-marshalers.h"
 | 
				
			||||||
#include "eek-serializable.h"
 | 
					#include "eek-serializable.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
    PROP_0,
 | 
					    PROP_0,
 | 
				
			||||||
    PROP_NAME,
 | 
					    PROP_NAME,
 | 
				
			||||||
    PROP_BOUNDS,
 | 
					    PROP_BOUNDS,
 | 
				
			||||||
 | 
					    PROP_GROUP,
 | 
				
			||||||
 | 
					    PROP_LEVEL,
 | 
				
			||||||
    PROP_LAST
 | 
					    PROP_LAST
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum {
 | 
				
			||||||
 | 
					    SYMBOL_INDEX_CHANGED,
 | 
				
			||||||
 | 
					    LAST_SIGNAL
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static guint signals[LAST_SIGNAL] = { 0, };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eek_serializable_iface_init (EekSerializableIface *iface);
 | 
					static void eek_serializable_iface_init (EekSerializableIface *iface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (EekElement, eek_element, G_TYPE_OBJECT,
 | 
					G_DEFINE_ABSTRACT_TYPE_WITH_CODE (EekElement, eek_element, G_TYPE_OBJECT,
 | 
				
			||||||
@ -58,6 +68,8 @@ struct _EekElementPrivate
 | 
				
			|||||||
    gchar *name;
 | 
					    gchar *name;
 | 
				
			||||||
    EekBounds bounds;
 | 
					    EekBounds bounds;
 | 
				
			||||||
    EekElement *parent;
 | 
					    EekElement *parent;
 | 
				
			||||||
 | 
					    gint group;
 | 
				
			||||||
 | 
					    gint level;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GVariant *
 | 
					static GVariant *
 | 
				
			||||||
@ -182,6 +194,41 @@ eek_element_real_get_bounds (EekElement *self,
 | 
				
			|||||||
    g_object_notify (G_OBJECT(self), "bounds");
 | 
					    g_object_notify (G_OBJECT(self), "bounds");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_element_real_set_symbol_index (EekElement *self,
 | 
				
			||||||
 | 
					                                   gint        group,
 | 
				
			||||||
 | 
					                                   gint        level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (priv->group != group || priv->level != level) {
 | 
				
			||||||
 | 
					        priv->group = group;
 | 
				
			||||||
 | 
					        priv->level = level;
 | 
				
			||||||
 | 
					        g_signal_emit_by_name (self, "symbol-index-changed", group, level);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_element_real_get_symbol_index (EekElement *self,
 | 
				
			||||||
 | 
					                                   gint       *group,
 | 
				
			||||||
 | 
					                                   gint       *level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (group)
 | 
				
			||||||
 | 
					        *group = priv->group;
 | 
				
			||||||
 | 
					    if (level)
 | 
				
			||||||
 | 
					        *level = priv->level;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_element_real_symbol_index_changed (EekElement *self,
 | 
				
			||||||
 | 
					                                       gint        group,
 | 
				
			||||||
 | 
					                                       gint        level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    // g_debug ("symbol-index-changed");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
eek_element_finalize (GObject *object)
 | 
					eek_element_finalize (GObject *object)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -206,6 +253,13 @@ eek_element_set_property (GObject      *object,
 | 
				
			|||||||
        eek_element_set_bounds (EEK_ELEMENT(object),
 | 
					        eek_element_set_bounds (EEK_ELEMENT(object),
 | 
				
			||||||
                                g_value_get_boxed (value));
 | 
					                                g_value_get_boxed (value));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_GROUP:
 | 
				
			||||||
 | 
					        eek_element_set_group (EEK_ELEMENT(object),
 | 
				
			||||||
 | 
					                               g_value_get_int (value));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_LEVEL:
 | 
				
			||||||
 | 
					        eek_element_set_level (EEK_ELEMENT(object),
 | 
				
			||||||
 | 
					                               g_value_get_int (value));
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
					        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@ -228,6 +282,12 @@ eek_element_get_property (GObject    *object,
 | 
				
			|||||||
        eek_element_get_bounds (EEK_ELEMENT(object), &bounds);
 | 
					        eek_element_get_bounds (EEK_ELEMENT(object), &bounds);
 | 
				
			||||||
        g_value_set_boxed (value, &bounds);
 | 
					        g_value_set_boxed (value, &bounds);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_GROUP:
 | 
				
			||||||
 | 
					        g_value_set_int (value, eek_element_get_group (EEK_ELEMENT(object)));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_LEVEL:
 | 
				
			||||||
 | 
					        g_value_set_int (value, eek_element_get_level (EEK_ELEMENT(object)));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
					        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@ -249,6 +309,11 @@ eek_element_class_init (EekElementClass *klass)
 | 
				
			|||||||
    klass->get_name = eek_element_real_get_name;
 | 
					    klass->get_name = eek_element_real_get_name;
 | 
				
			||||||
    klass->set_bounds = eek_element_real_set_bounds;
 | 
					    klass->set_bounds = eek_element_real_set_bounds;
 | 
				
			||||||
    klass->get_bounds = eek_element_real_get_bounds;
 | 
					    klass->get_bounds = eek_element_real_get_bounds;
 | 
				
			||||||
 | 
					    klass->set_symbol_index = eek_element_real_set_symbol_index;
 | 
				
			||||||
 | 
					    klass->get_symbol_index = eek_element_real_get_symbol_index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* signals */
 | 
				
			||||||
 | 
					    klass->symbol_index_changed = eek_element_real_symbol_index_changed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gobject_class->set_property = eek_element_set_property;
 | 
					    gobject_class->set_property = eek_element_set_property;
 | 
				
			||||||
    gobject_class->get_property = eek_element_get_property;
 | 
					    gobject_class->get_property = eek_element_get_property;
 | 
				
			||||||
@ -281,6 +346,56 @@ eek_element_class_init (EekElementClass *klass)
 | 
				
			|||||||
    g_object_class_install_property (gobject_class,
 | 
					    g_object_class_install_property (gobject_class,
 | 
				
			||||||
                                     PROP_BOUNDS,
 | 
					                                     PROP_BOUNDS,
 | 
				
			||||||
                                     pspec);
 | 
					                                     pspec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * EekElement:group:
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * The group value of the symbol index of #EekElement.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    pspec = g_param_spec_int ("group",
 | 
				
			||||||
 | 
					                              "Group",
 | 
				
			||||||
 | 
					                              "Group value of the symbol index",
 | 
				
			||||||
 | 
					                              -1, G_MAXINT, -1,
 | 
				
			||||||
 | 
					                              G_PARAM_READWRITE);
 | 
				
			||||||
 | 
					    g_object_class_install_property (gobject_class,
 | 
				
			||||||
 | 
					                                     PROP_GROUP,
 | 
				
			||||||
 | 
					                                     pspec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * EekElement:level:
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * The level value of the symbol index of #EekElement.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    pspec = g_param_spec_int ("level",
 | 
				
			||||||
 | 
					                              "Level",
 | 
				
			||||||
 | 
					                              "Level value of the symbol index",
 | 
				
			||||||
 | 
					                              -1, G_MAXINT, -1,
 | 
				
			||||||
 | 
					                              G_PARAM_READWRITE);
 | 
				
			||||||
 | 
					    g_object_class_install_property (gobject_class,
 | 
				
			||||||
 | 
					                                     PROP_LEVEL,
 | 
				
			||||||
 | 
					                                     pspec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * EekElement::symbol-index-changed:
 | 
				
			||||||
 | 
					     * @element: an #EekElement
 | 
				
			||||||
 | 
					     * @group: row index of the symbol matrix of keys on @element
 | 
				
			||||||
 | 
					     * @level: column index of the symbol matrix of keys on @element
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * The ::symbol-index-changed signal is emitted each time the
 | 
				
			||||||
 | 
					     * global configuration of group/level index changes.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    signals[SYMBOL_INDEX_CHANGED] =
 | 
				
			||||||
 | 
					        g_signal_new (I_("symbol-index-changed"),
 | 
				
			||||||
 | 
					                      G_TYPE_FROM_CLASS(gobject_class),
 | 
				
			||||||
 | 
					                      G_SIGNAL_RUN_LAST,
 | 
				
			||||||
 | 
					                      G_STRUCT_OFFSET(EekElementClass, symbol_index_changed),
 | 
				
			||||||
 | 
					                      NULL,
 | 
				
			||||||
 | 
					                      NULL,
 | 
				
			||||||
 | 
					                      _eek_marshal_VOID__INT_INT,
 | 
				
			||||||
 | 
					                      G_TYPE_NONE,
 | 
				
			||||||
 | 
					                      2,
 | 
				
			||||||
 | 
					                      G_TYPE_INT,
 | 
				
			||||||
 | 
					                      G_TYPE_INT);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -291,6 +406,8 @@ eek_element_init (EekElement *self)
 | 
				
			|||||||
    priv = self->priv = EEK_ELEMENT_GET_PRIVATE(self);
 | 
					    priv = self->priv = EEK_ELEMENT_GET_PRIVATE(self);
 | 
				
			||||||
    priv->name = NULL;
 | 
					    priv->name = NULL;
 | 
				
			||||||
    memset (&priv->bounds, 0, sizeof priv->bounds);
 | 
					    memset (&priv->bounds, 0, sizeof priv->bounds);
 | 
				
			||||||
 | 
					    priv->group = -1;
 | 
				
			||||||
 | 
					    priv->level = -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -452,3 +569,117 @@ eek_element_set_size (EekElement  *element,
 | 
				
			|||||||
    bounds.height = height;
 | 
					    bounds.height = height;
 | 
				
			||||||
    eek_element_set_bounds (element, &bounds);
 | 
					    eek_element_set_bounds (element, &bounds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_set_symbol_index:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 * @group: row index of the symbol matrix
 | 
				
			||||||
 | 
					 * @level: column index of the symbol matrix
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the default index of the symbol matrices of @element.  The
 | 
				
			||||||
 | 
					 * setting affects the child, if child does not have the index set, as
 | 
				
			||||||
 | 
					 * well as this element.  To unset, pass -1 as group/level.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_element_set_symbol_index (EekElement *element,
 | 
				
			||||||
 | 
					                              gint        group,
 | 
				
			||||||
 | 
					                              gint        level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    g_return_if_fail (EEK_IS_ELEMENT(element));
 | 
				
			||||||
 | 
					    EEK_ELEMENT_GET_CLASS(element)->set_symbol_index (element, group, level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_get_symbol_index:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 * @group: a pointer where the group value of the symbol index will be stored
 | 
				
			||||||
 | 
					 * @level: a pointer where the level value of the symbol index will be stored
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Get the default index of the symbol matrices of @element.
 | 
				
			||||||
 | 
					 * If the index is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_element_get_symbol_index (EekElement *element,
 | 
				
			||||||
 | 
					                              gint       *group,
 | 
				
			||||||
 | 
					                              gint       *level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    g_return_if_fail (EEK_IS_ELEMENT(element));
 | 
				
			||||||
 | 
					    g_return_if_fail (group || level);
 | 
				
			||||||
 | 
					    EEK_ELEMENT_GET_CLASS(element)->get_symbol_index (element, group, level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_set_group:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 * @group: group index of @element
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the group value of the default symbol index of @element.  To
 | 
				
			||||||
 | 
					 * unset, pass -1 as @group.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_element_set_symbol_index()
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_element_set_group (EekElement *element,
 | 
				
			||||||
 | 
					                       gint        group)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    gint level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    level = eek_element_get_level (element);
 | 
				
			||||||
 | 
					    eek_element_set_symbol_index (element, group, level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_set_level:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 * @level: level index of @element
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the level value of the default symbol index of @element.  To
 | 
				
			||||||
 | 
					 * unset, pass -1 as @level.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_element_set_symbol_index()
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_element_set_level (EekElement *element,
 | 
				
			||||||
 | 
					                       gint        level)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    gint group;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    group = eek_element_get_group (element);
 | 
				
			||||||
 | 
					    eek_element_set_symbol_index (element, group, level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_get_group:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Return the group value of the default symbol index of @element.
 | 
				
			||||||
 | 
					 * If the value is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_element_get_symbol_index()
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					gint
 | 
				
			||||||
 | 
					eek_element_get_group (EekElement *element)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    gint group;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    eek_element_get_symbol_index (element, &group, NULL);
 | 
				
			||||||
 | 
					    return group;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_element_get_level:
 | 
				
			||||||
 | 
					 * @element: an #EekElement
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Return the level value of the default symbol index of @element.
 | 
				
			||||||
 | 
					 * If the value is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_element_get_symbol_index()
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					gint
 | 
				
			||||||
 | 
					eek_element_get_level (EekElement *element)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    gint level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    eek_element_get_symbol_index (element, NULL, &level);
 | 
				
			||||||
 | 
					    return level;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -60,9 +60,21 @@ struct _EekElementClass
 | 
				
			|||||||
    void                  (* get_bounds)           (EekElement  *self,
 | 
					    void                  (* get_bounds)           (EekElement  *self,
 | 
				
			||||||
                                                    EekBounds   *bounds);
 | 
					                                                    EekBounds   *bounds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void                  (* set_symbol_index)     (EekElement  *self,
 | 
				
			||||||
 | 
					                                                    gint         group,
 | 
				
			||||||
 | 
					                                                    gint         level);
 | 
				
			||||||
 | 
					    void                  (* get_symbol_index)     (EekElement  *self,
 | 
				
			||||||
 | 
					                                                    gint        *group,
 | 
				
			||||||
 | 
					                                                    gint        *level);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* signals */
 | 
				
			||||||
 | 
					    void                  (* symbol_index_changed) (EekElement  *self,
 | 
				
			||||||
 | 
					                                                    gint         group,
 | 
				
			||||||
 | 
					                                                    gint         level);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*< private >*/
 | 
					    /*< private >*/
 | 
				
			||||||
    /* padding */
 | 
					    /* padding */
 | 
				
			||||||
    gpointer pdummy[24];
 | 
					    gpointer pdummy[21];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GType                 eek_element_get_type              (void) G_GNUC_CONST;
 | 
					GType                 eek_element_get_type              (void) G_GNUC_CONST;
 | 
				
			||||||
@ -92,5 +104,18 @@ void                  eek_element_get_absolute_position (EekElement  *element,
 | 
				
			|||||||
                                                         gdouble     *x,
 | 
					                                                         gdouble     *x,
 | 
				
			||||||
                                                         gdouble     *y);
 | 
					                                                         gdouble     *y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void                  eek_element_set_symbol_index      (EekElement  *element,
 | 
				
			||||||
 | 
					                                                         gint         group,
 | 
				
			||||||
 | 
					                                                         gint         level);
 | 
				
			||||||
 | 
					void                  eek_element_get_symbol_index      (EekElement  *element,
 | 
				
			||||||
 | 
					                                                         gint        *group,
 | 
				
			||||||
 | 
					                                                         gint        *level);
 | 
				
			||||||
 | 
					void                  eek_element_set_group             (EekElement  *element,
 | 
				
			||||||
 | 
					                                                         gint         group);
 | 
				
			||||||
 | 
					void                  eek_element_set_level             (EekElement  *element,
 | 
				
			||||||
 | 
					                                                         gint         level);
 | 
				
			||||||
 | 
					gint                  eek_element_get_group             (EekElement  *element);
 | 
				
			||||||
 | 
					gint                  eek_element_get_level             (EekElement  *element);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_END_DECLS
 | 
					G_END_DECLS
 | 
				
			||||||
#endif  /* EEK_ELEMENT_H */
 | 
					#endif  /* EEK_ELEMENT_H */
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@
 | 
				
			|||||||
#endif  /* HAVE_CONFIG_H */
 | 
					#endif  /* HAVE_CONFIG_H */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "eek-gtk-keyboard.h"
 | 
					#include "eek-gtk-keyboard.h"
 | 
				
			||||||
#include "eek-renderer.h"
 | 
					#include "eek-gtk-renderer.h"
 | 
				
			||||||
#include "eek-keyboard.h"
 | 
					#include "eek-keyboard.h"
 | 
				
			||||||
#include "eek-section.h"
 | 
					#include "eek-section.h"
 | 
				
			||||||
#include "eek-key.h"
 | 
					#include "eek-key.h"
 | 
				
			||||||
@ -105,7 +105,7 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
 | 
				
			|||||||
        PangoContext *pcontext;
 | 
					        PangoContext *pcontext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pcontext = gtk_widget_get_pango_context (self);
 | 
					        pcontext = gtk_widget_get_pango_context (self);
 | 
				
			||||||
        priv->renderer = eek_renderer_new (priv->keyboard, pcontext);
 | 
					        priv->renderer = eek_gtk_renderer_new (priv->keyboard, pcontext, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        eek_renderer_set_allocation_size (priv->renderer,
 | 
					        eek_renderer_set_allocation_size (priv->renderer,
 | 
				
			||||||
                                          allocation.width,
 | 
					                                          allocation.width,
 | 
				
			||||||
@ -260,6 +260,13 @@ eek_gtk_keyboard_dispose (GObject *object)
 | 
				
			|||||||
            g_signal_handler_disconnect (priv->keyboard,
 | 
					            g_signal_handler_disconnect (priv->keyboard,
 | 
				
			||||||
                                         priv->symbol_index_changed_handler);
 | 
					                                         priv->symbol_index_changed_handler);
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
					        if (priv->dragged_key) {
 | 
				
			||||||
 | 
					            g_signal_emit_by_name (priv->dragged_key,
 | 
				
			||||||
 | 
					                                   "released",
 | 
				
			||||||
 | 
					                                   priv->keyboard);
 | 
				
			||||||
 | 
					            priv->dragged_key = NULL;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g_object_unref (priv->keyboard);
 | 
					        g_object_unref (priv->keyboard);
 | 
				
			||||||
        priv->keyboard = NULL;
 | 
					        priv->keyboard = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										133
									
								
								eek/eek-gtk-renderer.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								eek/eek-gtk-renderer.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,133 @@
 | 
				
			|||||||
 | 
					/* 
 | 
				
			||||||
 | 
					 * Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
 | 
				
			||||||
 | 
					 * Copyright (C) 2011 Red Hat, Inc.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU Lesser General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2 of
 | 
				
			||||||
 | 
					 * the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is distributed in the hope that it will be useful, but
 | 
				
			||||||
 | 
					 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
				
			||||||
 | 
					 * Lesser General Public License for more details.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Lesser General Public
 | 
				
			||||||
 | 
					 * License along with this library; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
				
			||||||
 | 
					 * 02110-1301 USA
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef HAVE_CONFIG_H
 | 
				
			||||||
 | 
					#include "config.h"
 | 
				
			||||||
 | 
					#endif  /* HAVE_CONFIG_H */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <gdk-pixbuf/gdk-pixbuf.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "eek-gtk-renderer.h"
 | 
				
			||||||
 | 
					#include "eek-key.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					G_DEFINE_TYPE (EekGtkRenderer, eek_gtk_renderer, EEK_TYPE_RENDERER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static cairo_surface_t *
 | 
				
			||||||
 | 
					pixbuf_to_cairo_surface (GdkPixbuf *pixbuf)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cairo_surface_t *dummy_surface;
 | 
				
			||||||
 | 
					  cairo_pattern_t *pattern;
 | 
				
			||||||
 | 
					  cairo_surface_t *surface;
 | 
				
			||||||
 | 
					  cairo_t *cr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  dummy_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  cr = cairo_create (dummy_surface);
 | 
				
			||||||
 | 
					  gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
 | 
				
			||||||
 | 
					  pattern = cairo_get_source (cr);
 | 
				
			||||||
 | 
					  cairo_pattern_get_surface (pattern, &surface);
 | 
				
			||||||
 | 
					  cairo_surface_reference (surface);
 | 
				
			||||||
 | 
					  cairo_destroy (cr);
 | 
				
			||||||
 | 
					  cairo_surface_destroy (dummy_surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return surface;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_gtk_renderer_real_render_key_icon (EekRenderer *self,
 | 
				
			||||||
 | 
					                                       cairo_t     *cr,
 | 
				
			||||||
 | 
					                                       EekKey      *key,
 | 
				
			||||||
 | 
					                                       gdouble      scale,
 | 
				
			||||||
 | 
					                                       gboolean     rotate)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekBounds bounds;
 | 
				
			||||||
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
 | 
					    const gchar *icon_name;
 | 
				
			||||||
 | 
					    GdkPixbuf *pixbuf;
 | 
				
			||||||
 | 
					    cairo_surface_t *surface;
 | 
				
			||||||
 | 
					    GError *error;
 | 
				
			||||||
 | 
					    gint width, height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
 | 
					    g_return_if_fail (symbol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    icon_name = eek_symbol_get_icon_name (symbol);
 | 
				
			||||||
 | 
					    g_return_if_fail (icon_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
 | 
				
			||||||
 | 
					    bounds.width *= scale;
 | 
				
			||||||
 | 
					    bounds.height *= scale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    error = NULL;
 | 
				
			||||||
 | 
					    pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
 | 
				
			||||||
 | 
					                                       icon_name,
 | 
				
			||||||
 | 
					                                       MIN(bounds.width, bounds.height),
 | 
				
			||||||
 | 
					                                       0,
 | 
				
			||||||
 | 
					                                       &error);
 | 
				
			||||||
 | 
					    g_return_if_fail (pixbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    width = gdk_pixbuf_get_width (pixbuf);
 | 
				
			||||||
 | 
					    height = gdk_pixbuf_get_height (pixbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (bounds.width * height < bounds.height * width)
 | 
				
			||||||
 | 
					        scale = bounds.width / width;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        scale = bounds.height / height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cairo_save (cr);
 | 
				
			||||||
 | 
					    cairo_translate (cr,
 | 
				
			||||||
 | 
					                     (bounds.width - width * scale) / 2,
 | 
				
			||||||
 | 
					                     (bounds.height - height * scale) / 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    eek_renderer_apply_transformation_for_key (self, cr, key, scale, rotate);
 | 
				
			||||||
 | 
					    surface = pixbuf_to_cairo_surface (pixbuf);
 | 
				
			||||||
 | 
					    cairo_set_source_surface (cr, surface, 0.0, 0.0);
 | 
				
			||||||
 | 
					    cairo_paint (cr);
 | 
				
			||||||
 | 
					    cairo_restore (cr);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_gtk_renderer_class_init (EekGtkRendererClass *klass)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekRendererClass *renderer_class = EEK_RENDERER_CLASS (klass);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    renderer_class->render_key_icon = eek_gtk_renderer_real_render_key_icon;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_gtk_renderer_init (EekGtkRenderer *self)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EekRenderer *
 | 
				
			||||||
 | 
					eek_gtk_renderer_new (EekKeyboard  *keyboard,
 | 
				
			||||||
 | 
					                      PangoContext *pcontext,
 | 
				
			||||||
 | 
					                      GtkWidget    *widget)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekRenderer *renderer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    renderer = g_object_new (EEK_TYPE_GTK_RENDERER,
 | 
				
			||||||
 | 
					                             "keyboard", keyboard,
 | 
				
			||||||
 | 
					                             "pango-context", pcontext,
 | 
				
			||||||
 | 
					                             NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return renderer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										61
									
								
								eek/eek-gtk-renderer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								eek/eek-gtk-renderer.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					/* 
 | 
				
			||||||
 | 
					 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
				
			||||||
 | 
					 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is free software; you can redistribute it and/or
 | 
				
			||||||
 | 
					 * modify it under the terms of the GNU Lesser General Public License
 | 
				
			||||||
 | 
					 * as published by the Free Software Foundation; either version 2 of
 | 
				
			||||||
 | 
					 * the License, or (at your option) any later version.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is distributed in the hope that it will be useful, but
 | 
				
			||||||
 | 
					 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
				
			||||||
 | 
					 * Lesser General Public License for more details.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU Lesser General Public
 | 
				
			||||||
 | 
					 * License along with this library; if not, write to the Free Software
 | 
				
			||||||
 | 
					 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
				
			||||||
 | 
					 * 02110-1301 USA
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef EEK_GTK_RENDERER_H
 | 
				
			||||||
 | 
					#define EEK_GTK_RENDERER_H 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					#include "eek-renderer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					G_BEGIN_DECLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define EEK_TYPE_GTK_RENDERER (eek_gtk_renderer_get_type())
 | 
				
			||||||
 | 
					#define EEK_GTK_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_GTK_RENDERER, EekGtkRenderer))
 | 
				
			||||||
 | 
					#define EEK_GTK_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_GTK_RENDERER, EekGtkRendererClass))
 | 
				
			||||||
 | 
					#define EEK_IS_GTK_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_GTK_RENDERER))
 | 
				
			||||||
 | 
					#define EEK_IS_GTK_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_GTK_RENDERER))
 | 
				
			||||||
 | 
					#define EEK_GTK_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_GTK_RENDERER, EekGtkRendererClass))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct _EekGtkRenderer EekGtkRenderer;
 | 
				
			||||||
 | 
					typedef struct _EekGtkRendererClass EekGtkRendererClass;
 | 
				
			||||||
 | 
					typedef struct _EekGtkRendererPrivate EekGtkRendererPrivate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct _EekGtkRenderer {
 | 
				
			||||||
 | 
					    EekRenderer parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    EekGtkRendererPrivate *priv;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct _EekGtkRendererClass
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekRendererClass parent_class;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*< private >*/
 | 
				
			||||||
 | 
					    /* padding */
 | 
				
			||||||
 | 
					    gpointer pdummy[24];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GType        eek_gtk_renderer_get_type (void) G_GNUC_CONST;
 | 
				
			||||||
 | 
					EekRenderer *eek_gtk_renderer_new      (EekKeyboard  *keyboard,
 | 
				
			||||||
 | 
					                                        PangoContext *pcontext,
 | 
				
			||||||
 | 
					                                        GtkWidget *widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					G_END_DECLS
 | 
				
			||||||
 | 
					#endif  /* EEK_GTK_RENDERER_H */
 | 
				
			||||||
@ -451,7 +451,7 @@ eek_key_class_init (EekKeyClass *klass)
 | 
				
			|||||||
    signals[PRESSED] =
 | 
					    signals[PRESSED] =
 | 
				
			||||||
        g_signal_new (I_("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_LAST,
 | 
				
			||||||
                      G_STRUCT_OFFSET(EekKeyClass, pressed),
 | 
					                      G_STRUCT_OFFSET(EekKeyClass, pressed),
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
@ -468,7 +468,7 @@ eek_key_class_init (EekKeyClass *klass)
 | 
				
			|||||||
   signals[RELEASED] =
 | 
					   signals[RELEASED] =
 | 
				
			||||||
        g_signal_new (I_("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_LAST,
 | 
				
			||||||
                      G_STRUCT_OFFSET(EekKeyClass, released),
 | 
					                      G_STRUCT_OFFSET(EekKeyClass, released),
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
@ -550,20 +550,6 @@ eek_key_get_symbol_matrix (EekKey *key)
 | 
				
			|||||||
    return EEK_KEY_GET_CLASS(key)->get_symbol_matrix (key);
 | 
					    return EEK_KEY_GET_CLASS(key)->get_symbol_matrix (key);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * eek_key_get_symbol:
 | 
					 * eek_key_get_symbol:
 | 
				
			||||||
 * @key: an #EekKey
 | 
					 * @key: an #EekKey
 | 
				
			||||||
@ -592,14 +578,38 @@ eek_key_get_symbol_with_fallback (EekKey *key,
 | 
				
			|||||||
                                  gint    fallback_level)
 | 
					                                  gint    fallback_level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint group, level;
 | 
					    gint group, level;
 | 
				
			||||||
    EekKeyboard *keyboard;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_return_val_if_fail (EEK_IS_KEY (key), NULL);
 | 
					    g_return_val_if_fail (EEK_IS_KEY (key), NULL);
 | 
				
			||||||
 | 
					    g_return_val_if_fail (fallback_group >= 0, NULL);
 | 
				
			||||||
 | 
					    g_return_val_if_fail (fallback_level >= 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    keyboard = get_keyboard (key);
 | 
					    eek_element_get_symbol_index (EEK_ELEMENT(key), &group, &level);
 | 
				
			||||||
    g_return_val_if_fail (keyboard, NULL);
 | 
					
 | 
				
			||||||
 | 
					    if (group < 0 || level < 0) {
 | 
				
			||||||
 | 
					        EekElement *section;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        section = eek_element_get_parent (EEK_ELEMENT(key));
 | 
				
			||||||
 | 
					        g_return_val_if_fail (EEK_IS_SECTION (section), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (group < 0)
 | 
				
			||||||
 | 
					            group = eek_element_get_group (section);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (level < 0)
 | 
				
			||||||
 | 
					            level = eek_element_get_level (section);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (group < 0 || level < 0) {
 | 
				
			||||||
 | 
					            EekElement *keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            keyboard = eek_element_get_parent (section);
 | 
				
			||||||
 | 
					            g_return_val_if_fail (EEK_IS_KEYBOARD (keyboard), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (group < 0)
 | 
				
			||||||
 | 
					                group = eek_element_get_group (keyboard);
 | 
				
			||||||
 | 
					            if (level < 0)
 | 
				
			||||||
 | 
					                level = eek_element_get_level (keyboard);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    eek_keyboard_get_symbol_index (keyboard, &group, &level);
 | 
					 | 
				
			||||||
    return eek_key_get_symbol_at_index (key,
 | 
					    return eek_key_get_symbol_at_index (key,
 | 
				
			||||||
                                        group,
 | 
					                                        group,
 | 
				
			||||||
                                        level,
 | 
					                                        level,
 | 
				
			||||||
@ -628,8 +638,13 @@ eek_key_get_symbol_at_index (EekKey *key,
 | 
				
			|||||||
    EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(key);
 | 
					    EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(key);
 | 
				
			||||||
    gint num_symbols;
 | 
					    gint num_symbols;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_return_val_if_fail (group >= 0, NULL);
 | 
					    g_return_val_if_fail (fallback_group >= 0, NULL);
 | 
				
			||||||
    g_return_val_if_fail (level >= 0, NULL);
 | 
					    g_return_val_if_fail (fallback_level >= 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (group < 0)
 | 
				
			||||||
 | 
					        group = fallback_group;
 | 
				
			||||||
 | 
					    if (level < 0)
 | 
				
			||||||
 | 
					        level = fallback_level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!priv->symbol_matrix)
 | 
					    if (!priv->symbol_matrix)
 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
 | 
				
			|||||||
@ -35,13 +35,10 @@
 | 
				
			|||||||
#include "eek-section.h"
 | 
					#include "eek-section.h"
 | 
				
			||||||
#include "eek-key.h"
 | 
					#include "eek-key.h"
 | 
				
			||||||
#include "eek-symbol.h"
 | 
					#include "eek-symbol.h"
 | 
				
			||||||
#include "eek-marshalers.h"
 | 
					 | 
				
			||||||
#include "eek-serializable.h"
 | 
					#include "eek-serializable.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
    PROP_0,
 | 
					    PROP_0,
 | 
				
			||||||
    PROP_GROUP,
 | 
					 | 
				
			||||||
    PROP_LEVEL,
 | 
					 | 
				
			||||||
    PROP_LAYOUT,
 | 
					    PROP_LAYOUT,
 | 
				
			||||||
    PROP_MODIFIER_BEHAVIOR,
 | 
					    PROP_MODIFIER_BEHAVIOR,
 | 
				
			||||||
    PROP_LAST
 | 
					    PROP_LAST
 | 
				
			||||||
@ -50,7 +47,6 @@ enum {
 | 
				
			|||||||
enum {
 | 
					enum {
 | 
				
			||||||
    KEY_PRESSED,
 | 
					    KEY_PRESSED,
 | 
				
			||||||
    KEY_RELEASED,
 | 
					    KEY_RELEASED,
 | 
				
			||||||
    SYMBOL_INDEX_CHANGED,
 | 
					 | 
				
			||||||
    LAST_SIGNAL
 | 
					    LAST_SIGNAL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -68,12 +64,11 @@ G_DEFINE_TYPE_WITH_CODE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct _EekKeyboardPrivate
 | 
					struct _EekKeyboardPrivate
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint group;
 | 
					 | 
				
			||||||
    gint level;
 | 
					 | 
				
			||||||
    EekLayout *layout;
 | 
					    EekLayout *layout;
 | 
				
			||||||
    EekModifierBehavior modifier_behavior;
 | 
					    EekModifierBehavior modifier_behavior;
 | 
				
			||||||
    EekModifierType modifiers;
 | 
					    EekModifierType modifiers;
 | 
				
			||||||
    GArray *outline_array;
 | 
					    GArray *outline_array;
 | 
				
			||||||
 | 
					    EekModifierType num_lock_mask;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static EekSerializableIface *eek_keyboard_parent_serializable_iface;
 | 
					static EekSerializableIface *eek_keyboard_parent_serializable_iface;
 | 
				
			||||||
@ -148,6 +143,7 @@ eek_keyboard_real_serialize (EekSerializable *self,
 | 
				
			|||||||
                               _g_variant_new_outline (outline));
 | 
					                               _g_variant_new_outline (outline));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    g_variant_builder_add (builder, "v", g_variant_builder_end (&array));
 | 
					    g_variant_builder_add (builder, "v", g_variant_builder_end (&array));
 | 
				
			||||||
 | 
					    g_variant_builder_add (builder, "u", priv->num_lock_mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static gsize
 | 
					static gsize
 | 
				
			||||||
@ -170,6 +166,7 @@ eek_keyboard_real_deserialize (EekSerializable *self,
 | 
				
			|||||||
        EekOutline *_outline = _g_variant_get_outline (outline);
 | 
					        EekOutline *_outline = _g_variant_get_outline (outline);
 | 
				
			||||||
        g_array_append_val (priv->outline_array, *_outline);
 | 
					        g_array_append_val (priv->outline_array, *_outline);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    g_variant_get_child (variant, index++, "u", &priv->num_lock_mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -184,35 +181,6 @@ eek_serializable_iface_init (EekSerializableIface *iface)
 | 
				
			|||||||
    iface->deserialize = eek_keyboard_real_deserialize;
 | 
					    iface->deserialize = eek_keyboard_real_deserialize;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
eek_keyboard_real_set_symbol_index (EekKeyboard *self,
 | 
					 | 
				
			||||||
                                    gint         group,
 | 
					 | 
				
			||||||
                                    gint         level)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (priv->group != group || priv->level != level) {
 | 
					 | 
				
			||||||
        priv->group = group;
 | 
					 | 
				
			||||||
        priv->level = level;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        g_signal_emit_by_name (self, "symbol-index-changed", group, level);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
eek_keyboard_real_get_symbol_index (EekKeyboard *self,
 | 
					 | 
				
			||||||
                                    gint        *group,
 | 
					 | 
				
			||||||
                                    gint        *level)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    g_return_if_fail (group || level);
 | 
					 | 
				
			||||||
    if (group)
 | 
					 | 
				
			||||||
        *group = priv->group;
 | 
					 | 
				
			||||||
    if (level)
 | 
					 | 
				
			||||||
        *level = priv->level;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
on_key_pressed (EekSection  *section,
 | 
					on_key_pressed (EekSection  *section,
 | 
				
			||||||
                EekKey      *key,
 | 
					                EekKey      *key,
 | 
				
			||||||
@ -229,6 +197,15 @@ on_key_released (EekSection  *section,
 | 
				
			|||||||
    g_signal_emit_by_name (keyboard, "key-released", key);
 | 
					    g_signal_emit_by_name (keyboard, "key-released", key);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					on_symbol_index_changed (EekSection *section,
 | 
				
			||||||
 | 
					                         gint group,
 | 
				
			||||||
 | 
					                         gint level,
 | 
				
			||||||
 | 
					                         EekKeyboard *keyboard)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    g_signal_emit_by_name (keyboard, "symbol-index-changed", group, level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static EekSection *
 | 
					static EekSection *
 | 
				
			||||||
eek_keyboard_real_create_section (EekKeyboard *self)
 | 
					eek_keyboard_real_create_section (EekKeyboard *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -283,12 +260,6 @@ eek_keyboard_set_property (GObject      *object,
 | 
				
			|||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
 | 
					    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (prop_id) {
 | 
					    switch (prop_id) {
 | 
				
			||||||
    case PROP_GROUP:
 | 
					 | 
				
			||||||
        eek_keyboard_set_group (EEK_KEYBOARD(object), g_value_get_int (value));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case PROP_LEVEL:
 | 
					 | 
				
			||||||
        eek_keyboard_set_level (EEK_KEYBOARD(object), g_value_get_int (value));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case PROP_LAYOUT:
 | 
					    case PROP_LAYOUT:
 | 
				
			||||||
        priv->layout = g_value_get_object (value);
 | 
					        priv->layout = g_value_get_object (value);
 | 
				
			||||||
        if (priv->layout)
 | 
					        if (priv->layout)
 | 
				
			||||||
@ -315,14 +286,6 @@ eek_keyboard_get_property (GObject    *object,
 | 
				
			|||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
 | 
					    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (prop_id) {
 | 
					    switch (prop_id) {
 | 
				
			||||||
    case PROP_GROUP:
 | 
					 | 
				
			||||||
        g_value_set_int (value,
 | 
					 | 
				
			||||||
                         eek_keyboard_get_group (EEK_KEYBOARD(object)));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case PROP_LEVEL:
 | 
					 | 
				
			||||||
        g_value_set_int (value,
 | 
					 | 
				
			||||||
                         eek_keyboard_get_level (EEK_KEYBOARD(object)));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case PROP_LAYOUT:
 | 
					    case PROP_LAYOUT:
 | 
				
			||||||
        g_value_set_object (value, priv->layout);
 | 
					        g_value_set_object (value, priv->layout);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@ -338,25 +301,17 @@ eek_keyboard_get_property (GObject    *object,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
eek_keyboard_real_symbol_index_changed (EekKeyboard *self,
 | 
					 | 
				
			||||||
                                        gint         group,
 | 
					 | 
				
			||||||
                                        gint         level)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    /* g_debug ("symbol-index-changed"); */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
set_level_from_modifiers (EekKeyboard *self)
 | 
					set_level_from_modifiers (EekKeyboard *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
					    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
				
			||||||
    guint level = 0;
 | 
					    gint level = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (priv->modifiers & EEK_MOD5_MASK)
 | 
					    if (priv->modifiers & EEK_MOD5_MASK)
 | 
				
			||||||
        level |= 2;
 | 
					        level |= 2;
 | 
				
			||||||
    if (priv->modifiers & EEK_SHIFT_MASK)
 | 
					    if (priv->modifiers & EEK_SHIFT_MASK)
 | 
				
			||||||
        level |= 1;
 | 
					        level |= 1;
 | 
				
			||||||
    eek_keyboard_set_level (self, level);
 | 
					    eek_element_set_level (EEK_ELEMENT(self), level);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -367,11 +322,7 @@ eek_keyboard_real_key_pressed (EekKeyboard *self,
 | 
				
			|||||||
    EekSymbol *symbol;
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
    EekModifierType modifier;
 | 
					    EekModifierType modifier;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    symbol = eek_key_get_symbol_at_index (key,
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
                                          priv->group,
 | 
					 | 
				
			||||||
                                          priv->level,
 | 
					 | 
				
			||||||
                                          0,
 | 
					 | 
				
			||||||
                                          0);
 | 
					 | 
				
			||||||
    if (!symbol)
 | 
					    if (!symbol)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -398,11 +349,7 @@ eek_keyboard_real_key_released (EekKeyboard *self,
 | 
				
			|||||||
    EekSymbol *symbol;
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
    EekModifierType modifier;
 | 
					    EekModifierType modifier;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    symbol = eek_key_get_symbol_at_index (key,
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
                                          priv->group,
 | 
					 | 
				
			||||||
                                          priv->level,
 | 
					 | 
				
			||||||
                                          0,
 | 
					 | 
				
			||||||
                                          0);
 | 
					 | 
				
			||||||
    if (!symbol)
 | 
					    if (!symbol)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -453,6 +400,8 @@ eek_keyboard_real_child_added (EekContainer *self,
 | 
				
			|||||||
                      G_CALLBACK(on_key_pressed), self);
 | 
					                      G_CALLBACK(on_key_pressed), self);
 | 
				
			||||||
    g_signal_connect (element, "key-released",
 | 
					    g_signal_connect (element, "key-released",
 | 
				
			||||||
                      G_CALLBACK(on_key_released), self);
 | 
					                      G_CALLBACK(on_key_released), self);
 | 
				
			||||||
 | 
					    g_signal_connect (element, "symbol-index-changed",
 | 
				
			||||||
 | 
					                      G_CALLBACK(on_symbol_index_changed), self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -473,15 +422,12 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
 | 
				
			|||||||
    g_type_class_add_private (gobject_class,
 | 
					    g_type_class_add_private (gobject_class,
 | 
				
			||||||
                              sizeof (EekKeyboardPrivate));
 | 
					                              sizeof (EekKeyboardPrivate));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    klass->set_symbol_index = eek_keyboard_real_set_symbol_index;
 | 
					 | 
				
			||||||
    klass->get_symbol_index = eek_keyboard_real_get_symbol_index;
 | 
					 | 
				
			||||||
    klass->create_section = eek_keyboard_real_create_section;
 | 
					    klass->create_section = eek_keyboard_real_create_section;
 | 
				
			||||||
    klass->find_key_by_keycode = eek_keyboard_real_find_key_by_keycode;
 | 
					    klass->find_key_by_keycode = eek_keyboard_real_find_key_by_keycode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* signals */
 | 
					    /* signals */
 | 
				
			||||||
    klass->key_pressed = eek_keyboard_real_key_pressed;
 | 
					    klass->key_pressed = eek_keyboard_real_key_pressed;
 | 
				
			||||||
    klass->key_released = eek_keyboard_real_key_released;
 | 
					    klass->key_released = eek_keyboard_real_key_released;
 | 
				
			||||||
    klass->symbol_index_changed = eek_keyboard_real_symbol_index_changed;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    container_class->child_added = eek_keyboard_real_child_added;
 | 
					    container_class->child_added = eek_keyboard_real_child_added;
 | 
				
			||||||
    container_class->child_removed = eek_keyboard_real_child_removed;
 | 
					    container_class->child_removed = eek_keyboard_real_child_removed;
 | 
				
			||||||
@ -491,34 +437,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
 | 
				
			|||||||
    gobject_class->dispose = eek_keyboard_dispose;
 | 
					    gobject_class->dispose = eek_keyboard_dispose;
 | 
				
			||||||
    gobject_class->finalize = eek_keyboard_finalize;
 | 
					    gobject_class->finalize = eek_keyboard_finalize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * EekKeyboard:group:
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * The group (row) index of symbol matrix of #EekKeyboard.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    pspec = g_param_spec_int ("group",
 | 
					 | 
				
			||||||
                              "Group",
 | 
					 | 
				
			||||||
                              "Group index of symbol matrix of the keyboard",
 | 
					 | 
				
			||||||
                              0, G_MAXINT, 0,
 | 
					 | 
				
			||||||
                              G_PARAM_READWRITE);
 | 
					 | 
				
			||||||
    g_object_class_install_property (gobject_class,
 | 
					 | 
				
			||||||
                                     PROP_GROUP,
 | 
					 | 
				
			||||||
                                     pspec);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * EekKeyboard:level:
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * The level (row) index of symbol matrix of #EekKeyboard.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    pspec = g_param_spec_int ("level",
 | 
					 | 
				
			||||||
                              "Level",
 | 
					 | 
				
			||||||
                              "Level index of symbol matrix of the keyboard",
 | 
					 | 
				
			||||||
                              0, G_MAXINT, 0,
 | 
					 | 
				
			||||||
                              G_PARAM_READWRITE);
 | 
					 | 
				
			||||||
    g_object_class_install_property (gobject_class,
 | 
					 | 
				
			||||||
                                     PROP_LEVEL,
 | 
					 | 
				
			||||||
                                     pspec);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * EekKeyboard:layout:
 | 
					     * EekKeyboard:layout:
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -586,28 +504,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
 | 
				
			|||||||
                      G_TYPE_NONE,
 | 
					                      G_TYPE_NONE,
 | 
				
			||||||
                      1,
 | 
					                      1,
 | 
				
			||||||
                      EEK_TYPE_KEY);
 | 
					                      EEK_TYPE_KEY);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * EekKeyboard::symbol-index-changed:
 | 
					 | 
				
			||||||
     * @keyboard: an #EekKeyboard
 | 
					 | 
				
			||||||
     * @group: row index of the symbol matrix of keys on @keyboard
 | 
					 | 
				
			||||||
     * @level: column index of the symbol matrix of keys on @keyboard
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * The ::symbol-index-changed signal is emitted each time the
 | 
					 | 
				
			||||||
     * global configuration of group/level index changes.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    signals[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),
 | 
					 | 
				
			||||||
                      NULL,
 | 
					 | 
				
			||||||
                      NULL,
 | 
					 | 
				
			||||||
                      _eek_marshal_VOID__INT_INT,
 | 
					 | 
				
			||||||
                      G_TYPE_NONE,
 | 
					 | 
				
			||||||
                      2,
 | 
					 | 
				
			||||||
                      G_TYPE_INT,
 | 
					 | 
				
			||||||
                      G_TYPE_INT);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -616,11 +512,12 @@ eek_keyboard_init (EekKeyboard *self)
 | 
				
			|||||||
    EekKeyboardPrivate *priv;
 | 
					    EekKeyboardPrivate *priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    priv = self->priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
					    priv = self->priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
				
			||||||
    priv->group = priv->level = 0;
 | 
					 | 
				
			||||||
    priv->layout = NULL;
 | 
					    priv->layout = NULL;
 | 
				
			||||||
    priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_NONE;
 | 
					    priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_NONE;
 | 
				
			||||||
    priv->modifiers = 0;
 | 
					    priv->modifiers = 0;
 | 
				
			||||||
    priv->outline_array = g_array_new (FALSE, TRUE, sizeof (EekOutline));
 | 
					    priv->outline_array = g_array_new (FALSE, TRUE, sizeof (EekOutline));
 | 
				
			||||||
 | 
					    priv->num_lock_mask = 0;
 | 
				
			||||||
 | 
					    eek_element_set_symbol_index (EEK_ELEMENT(self), 0, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -629,7 +526,10 @@ eek_keyboard_init (EekKeyboard *self)
 | 
				
			|||||||
 * @group: row index of the symbol matrix of keys on @keyboard
 | 
					 * @group: row index of the symbol matrix of keys on @keyboard
 | 
				
			||||||
 * @level: column index of the symbol matrix of keys on @keyboard
 | 
					 * @level: column index of the symbol matrix of keys on @keyboard
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Select a cell of the symbol matrix of each key on @keyboard.
 | 
					 * Set the default index of the symbol matrices of keys in @keyboard.
 | 
				
			||||||
 | 
					 * To unset, pass -1 as group/level.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_set_symbol_index()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_keyboard_set_symbol_index (EekKeyboard *keyboard,
 | 
					eek_keyboard_set_symbol_index (EekKeyboard *keyboard,
 | 
				
			||||||
@ -637,18 +537,19 @@ eek_keyboard_set_symbol_index (EekKeyboard *keyboard,
 | 
				
			|||||||
                               gint         level)
 | 
					                               gint         level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
 | 
					    g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
 | 
				
			||||||
    EEK_KEYBOARD_GET_CLASS(keyboard)->set_symbol_index (keyboard, group, level);
 | 
					    eek_element_set_symbol_index (EEK_ELEMENT(keyboard), group, level);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * eek_keyboard_get_symbol_index:
 | 
					 * eek_keyboard_get_symbol_index:
 | 
				
			||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 * @group: a pointer where row index of the symbol matrix of keys on
 | 
					 * @group: a pointer where the group value of the symbol index will be stored
 | 
				
			||||||
 * @keyboard will be stored
 | 
					 * @level: a pointer where the level value of the symbol index will be stored
 | 
				
			||||||
 * @level: a pointer where column index of the symbol matrix of keys
 | 
					 | 
				
			||||||
 * on @keyboard will be stored
 | 
					 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Get the current cell position of the symbol matrix of each key on @keyboard.
 | 
					 * Get the default index of the symbol matrices of keys in @keyboard.
 | 
				
			||||||
 | 
					 * If the index is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_get_symbol_index()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_keyboard_get_symbol_index (EekKeyboard *keyboard,
 | 
					eek_keyboard_get_symbol_index (EekKeyboard *keyboard,
 | 
				
			||||||
@ -656,7 +557,7 @@ eek_keyboard_get_symbol_index (EekKeyboard *keyboard,
 | 
				
			|||||||
                               gint        *level)
 | 
					                               gint        *level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
 | 
					    g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
 | 
				
			||||||
    EEK_KEYBOARD_GET_CLASS(keyboard)->get_symbol_index (keyboard, group, level);
 | 
					    eek_element_get_symbol_index(EEK_ELEMENT(keyboard), group, level);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -664,14 +565,17 @@ eek_keyboard_get_symbol_index (EekKeyboard *keyboard,
 | 
				
			|||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 * @group: group index of @keyboard
 | 
					 * @group: group index of @keyboard
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Set the group index of symbol matrix of @keyboard.
 | 
					 * Set the group value of the default symbol index of @keyboard.  To
 | 
				
			||||||
 | 
					 * unset, pass -1 as @group.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_keyboard_set_symbol_index()
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_set_group()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_keyboard_set_group (EekKeyboard *keyboard,
 | 
					eek_keyboard_set_group (EekKeyboard *keyboard,
 | 
				
			||||||
                        gint         group)
 | 
					                        gint         group)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint level = eek_keyboard_get_level (keyboard);
 | 
					    eek_element_set_group (EEK_ELEMENT(keyboard), group);
 | 
				
			||||||
    eek_keyboard_set_symbol_index (keyboard, group, level);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -679,42 +583,49 @@ eek_keyboard_set_group (EekKeyboard *keyboard,
 | 
				
			|||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 * @level: level index of @keyboard
 | 
					 * @level: level index of @keyboard
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Set the level index of symbol matrix of @keyboard.
 | 
					 * Set the level value of the default symbol index of @keyboard.  To
 | 
				
			||||||
 | 
					 * unset, pass -1 as @level.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_keyboard_set_symbol_index()
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_set_level()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_keyboard_set_level (EekKeyboard *keyboard,
 | 
					eek_keyboard_set_level (EekKeyboard *keyboard,
 | 
				
			||||||
                        gint         level)
 | 
					                        gint         level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint group = eek_keyboard_get_group (keyboard);
 | 
					    eek_element_set_level (EEK_ELEMENT(keyboard), level);
 | 
				
			||||||
    eek_keyboard_set_symbol_index (keyboard, group, level);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * eek_keyboard_get_group:
 | 
					 * eek_keyboard_get_group:
 | 
				
			||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Return the group index of @keyboard.
 | 
					 * Return the group value of the default symbol index of @keyboard.
 | 
				
			||||||
 | 
					 * If the value is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_keyboard_get_symbol_index()
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_get_group()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
gint
 | 
					gint
 | 
				
			||||||
eek_keyboard_get_group (EekKeyboard *keyboard)
 | 
					eek_keyboard_get_group (EekKeyboard *keyboard)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint group;
 | 
					    return eek_element_get_group (EEK_ELEMENT(keyboard));
 | 
				
			||||||
    eek_keyboard_get_symbol_index (keyboard, &group, NULL);
 | 
					 | 
				
			||||||
    return group;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * eek_keyboard_get_level:
 | 
					 * eek_keyboard_get_level:
 | 
				
			||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Return the level index of @keyboard.
 | 
					 * Return the level value of the default symbol index of @keyboard.
 | 
				
			||||||
 | 
					 * If the value is not set, -1 will be returned.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See also: eek_keyboard_get_symbol_index()
 | 
				
			||||||
 | 
					 * Deprecated: 1.0: Use eek_element_get_level()
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
gint
 | 
					gint
 | 
				
			||||||
eek_keyboard_get_level (EekKeyboard *keyboard)
 | 
					eek_keyboard_get_level (EekKeyboard *keyboard)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gint level;
 | 
					    return eek_element_get_level (EEK_ELEMENT(keyboard));
 | 
				
			||||||
    eek_keyboard_get_symbol_index (keyboard, NULL, &level);
 | 
					 | 
				
			||||||
    return level;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -889,3 +800,26 @@ eek_keyboard_get_outline (EekKeyboard *keyboard,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return &g_array_index (priv->outline_array, EekOutline, oref - 1);
 | 
					    return &g_array_index (priv->outline_array, EekOutline, oref - 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_keyboard_set_num_lock_mask (EekKeyboard    *keyboard,
 | 
				
			||||||
 | 
					                                EekModifierType num_lock_mask)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekKeyboardPrivate *priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_assert (EEK_IS_KEYBOARD(keyboard));
 | 
				
			||||||
 | 
					    priv = EEK_KEYBOARD_GET_PRIVATE(keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv->num_lock_mask = num_lock_mask;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EekModifierType
 | 
				
			||||||
 | 
					eek_keyboard_get_num_lock_mask (EekKeyboard *keyboard)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekKeyboardPrivate *priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_assert (EEK_IS_KEYBOARD(keyboard));
 | 
				
			||||||
 | 
					    priv = EEK_KEYBOARD_GET_PRIVATE(keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return priv->num_lock_mask;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -53,30 +53,22 @@ struct _EekKeyboard
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * EekKeyboardClass:
 | 
					 * EekKeyboardClass:
 | 
				
			||||||
 * @set_symbol_index: virtual function for setting group and level of
 | 
					 | 
				
			||||||
 * the entire keyboard
 | 
					 | 
				
			||||||
 * @get_symbol_index: virtual function for getting group and level of
 | 
					 | 
				
			||||||
 * 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
 | 
				
			||||||
 * @symbol_index_changed: class handler for #EekKeyboard::symbol-index-changed signal
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct _EekKeyboardClass
 | 
					struct _EekKeyboardClass
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /*< private >*/
 | 
					    /*< private >*/
 | 
				
			||||||
    EekContainerClass parent_class;
 | 
					    EekContainerClass parent_class;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*< public >*/
 | 
					    /* obsolete members moved to EekElement */
 | 
				
			||||||
    void        (* set_symbol_index)     (EekKeyboard *self,
 | 
					    gpointer set_symbol_index;
 | 
				
			||||||
                                          gint         group,
 | 
					    gpointer get_symbol_index;
 | 
				
			||||||
                                          gint         level);
 | 
					 | 
				
			||||||
    void        (* get_symbol_index)     (EekKeyboard *self,
 | 
					 | 
				
			||||||
                                          gint        *group,
 | 
					 | 
				
			||||||
                                          gint        *level);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*< public >*/
 | 
				
			||||||
    EekSection *(* create_section)       (EekKeyboard *self);
 | 
					    EekSection *(* create_section)       (EekKeyboard *self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    EekKey     *(* find_key_by_keycode)  (EekKeyboard *self,
 | 
					    EekKey     *(* find_key_by_keycode)  (EekKeyboard *self,
 | 
				
			||||||
@ -87,11 +79,11 @@ struct _EekKeyboardClass
 | 
				
			|||||||
                                          EekKey      *key);
 | 
					                                          EekKey      *key);
 | 
				
			||||||
    void        (* key_released)         (EekKeyboard *self,
 | 
					    void        (* key_released)         (EekKeyboard *self,
 | 
				
			||||||
                                          EekKey      *key);
 | 
					                                          EekKey      *key);
 | 
				
			||||||
    void        (* symbol_index_changed) (EekKeyboard *self,
 | 
					 | 
				
			||||||
                                          gint         group,
 | 
					 | 
				
			||||||
                                          gint         level);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*< private >*/
 | 
					    /*< private >*/
 | 
				
			||||||
 | 
					    /* obsolete members moved to EekElement */
 | 
				
			||||||
 | 
					    gpointer symbol_index_changed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* padding */
 | 
					    /* padding */
 | 
				
			||||||
    gpointer pdummy[24];
 | 
					    gpointer pdummy[24];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -155,5 +147,11 @@ EekOutline         *eek_keyboard_get_outline
 | 
				
			|||||||
                                     (EekKeyboard        *keyboard,
 | 
					                                     (EekKeyboard        *keyboard,
 | 
				
			||||||
                                      gulong              oref);
 | 
					                                      gulong              oref);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void                eek_keyboard_set_num_lock_mask
 | 
				
			||||||
 | 
					                                     (EekKeyboard        *keyboard,
 | 
				
			||||||
 | 
					                                      EekModifierType     num_lock_mask);
 | 
				
			||||||
 | 
					EekModifierType     eek_keyboard_get_num_lock_mask
 | 
				
			||||||
 | 
					                                     (EekKeyboard        *keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_END_DECLS
 | 
					G_END_DECLS
 | 
				
			||||||
#endif  /* EEK_KEYBOARD_H */
 | 
					#endif  /* EEK_KEYBOARD_H */
 | 
				
			||||||
 | 
				
			|||||||
@ -214,8 +214,16 @@ eek_keysym_init (EekKeysym *self)
 | 
				
			|||||||
    priv->xkeysym = EEK_INVALID_KEYSYM;
 | 
					    priv->xkeysym = EEK_INVALID_KEYSYM;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_keysym_new_with_modifier:
 | 
				
			||||||
 | 
					 * @xkeysym: an X keysym value
 | 
				
			||||||
 | 
					 * @modifier_mask: modifier assigned to @xkeysym
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Create an #EekKeysym with given X keysym value @xkeysym and
 | 
				
			||||||
 | 
					 * modifier @modifier_mask.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
EekKeysym *
 | 
					EekKeysym *
 | 
				
			||||||
eek_keysym_new (guint xkeysym)
 | 
					eek_keysym_new_with_modifier (guint xkeysym, EekModifierType modifier_mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekKeysym *keysym;
 | 
					    EekKeysym *keysym;
 | 
				
			||||||
    EekKeysymPrivate *priv;
 | 
					    EekKeysymPrivate *priv;
 | 
				
			||||||
@ -223,7 +231,6 @@ eek_keysym_new (guint xkeysym)
 | 
				
			|||||||
        *unichar_entry;
 | 
					        *unichar_entry;
 | 
				
			||||||
    gchar *name, *label;
 | 
					    gchar *name, *label;
 | 
				
			||||||
    EekSymbolCategory category;
 | 
					    EekSymbolCategory category;
 | 
				
			||||||
    EekModifierType modifier_mask;
 | 
					 | 
				
			||||||
    gunichar uc;
 | 
					    gunichar uc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    special_entry =
 | 
					    special_entry =
 | 
				
			||||||
@ -272,8 +279,6 @@ eek_keysym_new (guint xkeysym)
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
        label = g_strdup (name);
 | 
					        label = g_strdup (name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    modifier_mask = get_modifier_mask (xkeysym);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    keysym = g_object_new (EEK_TYPE_KEYSYM,
 | 
					    keysym = g_object_new (EEK_TYPE_KEYSYM,
 | 
				
			||||||
                           "name", name,
 | 
					                           "name", name,
 | 
				
			||||||
                           "label", label,
 | 
					                           "label", label,
 | 
				
			||||||
@ -294,6 +299,24 @@ eek_keysym_new (guint xkeysym)
 | 
				
			|||||||
    return keysym;
 | 
					    return keysym;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_keysym_new:
 | 
				
			||||||
 | 
					 * @xkeysym: an X keysym value
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Create an #EekKeysym with given X keysym value @xkeysym.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					EekKeysym *
 | 
				
			||||||
 | 
					eek_keysym_new (guint xkeysym)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return eek_keysym_new_with_modifier (xkeysym, get_modifier_mask (xkeysym));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_keysym_new_from_name:
 | 
				
			||||||
 | 
					 * @name: an X keysym name
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Create an #EekKeysym with an X keysym value looked up by @name.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
EekKeysym *
 | 
					EekKeysym *
 | 
				
			||||||
eek_keysym_new_from_name (const gchar *name)
 | 
					eek_keysym_new_from_name (const gchar *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -312,6 +335,12 @@ eek_keysym_new_from_name (const gchar *name)
 | 
				
			|||||||
                         NULL);
 | 
					                         NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_keysym_get_xkeysym:
 | 
				
			||||||
 | 
					 * @keysym: an #EekKeysym
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Get an X keysym value associated with @keysym
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
guint
 | 
					guint
 | 
				
			||||||
eek_keysym_get_xkeysym (EekKeysym *keysym)
 | 
					eek_keysym_get_xkeysym (EekKeysym *keysym)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,7 @@
 | 
				
			|||||||
#ifndef EEK_KEYSYM_H
 | 
					#ifndef EEK_KEYSYM_H
 | 
				
			||||||
#define EEK_KEYSYM_H 1
 | 
					#define EEK_KEYSYM_H 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <X11/XKBlib.h>
 | 
				
			||||||
#include "eek-symbol.h"
 | 
					#include "eek-symbol.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_BEGIN_DECLS
 | 
					G_BEGIN_DECLS
 | 
				
			||||||
@ -58,6 +59,8 @@ EekKeysym *eek_keysym_new           (guint        xkeysym);
 | 
				
			|||||||
guint      eek_keysym_get_xkeysym       (EekKeysym      *keysym);
 | 
					guint      eek_keysym_get_xkeysym       (EekKeysym      *keysym);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EekKeysym *eek_keysym_new_from_name     (const gchar    *name);
 | 
					EekKeysym *eek_keysym_new_from_name     (const gchar    *name);
 | 
				
			||||||
 | 
					EekKeysym *eek_keysym_new_with_modifier (guint           xkeysym,
 | 
				
			||||||
 | 
					                                         EekModifierType modifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_END_DECLS
 | 
					G_END_DECLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -276,14 +276,14 @@ calculate_font_size_key_callback (EekElement *element, gpointer user_data)
 | 
				
			|||||||
    gdouble size;
 | 
					    gdouble size;
 | 
				
			||||||
    EekSymbol *symbol;
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
    EekBounds bounds;
 | 
					    EekBounds bounds;
 | 
				
			||||||
    gchar *label = NULL;
 | 
					    const gchar *label = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    symbol = eek_key_get_symbol (EEK_KEY(element));
 | 
					    symbol = eek_key_get_symbol (EEK_KEY(element));
 | 
				
			||||||
    if (symbol &&
 | 
					    if (symbol &&
 | 
				
			||||||
        eek_symbol_get_category (symbol) == EEK_SYMBOL_CATEGORY_LETTER)
 | 
					        eek_symbol_get_category (symbol) == EEK_SYMBOL_CATEGORY_LETTER)
 | 
				
			||||||
        label = eek_symbol_get_label (symbol);
 | 
					        label = eek_symbol_get_label (symbol);
 | 
				
			||||||
    if (!label)
 | 
					    if (!label)
 | 
				
			||||||
        label = g_strdup ("M");
 | 
					        label = "M";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    base_font = pango_context_get_font_description (priv->pcontext);
 | 
					    base_font = pango_context_get_font_description (priv->pcontext);
 | 
				
			||||||
    font = pango_font_description_copy (base_font);
 | 
					    font = pango_font_description_copy (base_font);
 | 
				
			||||||
@ -296,7 +296,6 @@ calculate_font_size_key_callback (EekElement *element, gpointer user_data)
 | 
				
			|||||||
    pango_font_description_free (font);
 | 
					    pango_font_description_free (font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pango_layout_set_text (layout, label, -1);
 | 
					    pango_layout_set_text (layout, label, -1);
 | 
				
			||||||
    g_free (label);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pango_layout_get_extents (layout, NULL, &extents);
 | 
					    pango_layout_get_extents (layout, NULL, &extents);
 | 
				
			||||||
    g_object_unref (layout);
 | 
					    g_object_unref (layout);
 | 
				
			||||||
@ -350,9 +349,8 @@ render_key (EekRenderer *self,
 | 
				
			|||||||
    EekOutline *outline;
 | 
					    EekOutline *outline;
 | 
				
			||||||
    cairo_surface_t *outline_surface;
 | 
					    cairo_surface_t *outline_surface;
 | 
				
			||||||
    EekBounds bounds;
 | 
					    EekBounds bounds;
 | 
				
			||||||
    PangoLayout *layout;
 | 
					 | 
				
			||||||
    PangoRectangle extents = { 0, };
 | 
					 | 
				
			||||||
    gulong oref;
 | 
					    gulong oref;
 | 
				
			||||||
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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);
 | 
				
			||||||
@ -381,7 +379,7 @@ render_key (EekRenderer *self,
 | 
				
			|||||||
                         bounds.height * priv->scale);
 | 
					                         bounds.height * priv->scale);
 | 
				
			||||||
        cairo_fill (cr);
 | 
					        cairo_fill (cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        render_key_outline (self, cr, key);
 | 
					        eek_renderer_render_key_outline (self, cr, key, 1.0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g_hash_table_insert (priv->outline_surface_cache,
 | 
					        g_hash_table_insert (priv->outline_surface_cache,
 | 
				
			||||||
                             outline,
 | 
					                             outline,
 | 
				
			||||||
@ -391,8 +389,16 @@ render_key (EekRenderer *self,
 | 
				
			|||||||
    cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
 | 
					    cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
 | 
				
			||||||
    cairo_paint (cr);
 | 
					    cairo_paint (cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
 | 
					    if (EEK_RENDERER_GET_CLASS(self)->render_key_icon &&
 | 
				
			||||||
 | 
					        symbol && eek_symbol_get_icon_name (symbol)) {
 | 
				
			||||||
 | 
					        eek_renderer_render_key_icon (self, cr, key, 1.0, 0);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        PangoLayout *layout;
 | 
				
			||||||
 | 
					        PangoRectangle extents = { 0, };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        layout = pango_cairo_create_layout (cr);
 | 
					        layout = pango_cairo_create_layout (cr);
 | 
				
			||||||
    eek_renderer_real_render_key_label (self, layout, key);
 | 
					        eek_renderer_render_key_label (self, layout, key);
 | 
				
			||||||
        pango_layout_get_extents (layout, NULL, &extents);
 | 
					        pango_layout_get_extents (layout, NULL, &extents);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cairo_save (cr);
 | 
					        cairo_save (cr);
 | 
				
			||||||
@ -405,13 +411,15 @@ render_key (EekRenderer *self,
 | 
				
			|||||||
                               priv->foreground->green,
 | 
					                               priv->foreground->green,
 | 
				
			||||||
                               priv->foreground->blue,
 | 
					                               priv->foreground->blue,
 | 
				
			||||||
                               priv->foreground->alpha);
 | 
					                               priv->foreground->alpha);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pango_cairo_show_layout (cr, layout);
 | 
					        pango_cairo_show_layout (cr, layout);
 | 
				
			||||||
        cairo_restore (cr);
 | 
					        cairo_restore (cr);
 | 
				
			||||||
        g_object_unref (layout);
 | 
					        g_object_unref (layout);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					void
 | 
				
			||||||
prepare_render_key (EekRenderer *self,
 | 
					eek_renderer_apply_transformation_for_key (EekRenderer *self,
 | 
				
			||||||
                                           cairo_t     *cr,
 | 
					                                           cairo_t     *cr,
 | 
				
			||||||
                                           EekKey      *key,
 | 
					                                           EekKey      *key,
 | 
				
			||||||
                                           gdouble      scale,
 | 
					                                           gdouble      scale,
 | 
				
			||||||
@ -447,7 +455,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
 | 
				
			|||||||
    EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
 | 
					    EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
 | 
				
			||||||
    EekSymbol *symbol;
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
    EekSymbolCategory category;
 | 
					    EekSymbolCategory category;
 | 
				
			||||||
    gchar *label;
 | 
					    const gchar *label;
 | 
				
			||||||
    EekBounds bounds;
 | 
					    EekBounds bounds;
 | 
				
			||||||
    PangoFontDescription *font;
 | 
					    PangoFontDescription *font;
 | 
				
			||||||
    gdouble size, scale;
 | 
					    gdouble size, scale;
 | 
				
			||||||
@ -486,7 +494,6 @@ eek_renderer_real_render_key_label (EekRenderer *self,
 | 
				
			|||||||
    pango_font_description_set_size (font, size * priv->scale * scale);
 | 
					    pango_font_description_set_size (font, size * priv->scale * scale);
 | 
				
			||||||
    pango_layout_set_font_description (layout, font);
 | 
					    pango_layout_set_font_description (layout, font);
 | 
				
			||||||
    pango_layout_set_text (layout, label, -1);
 | 
					    pango_layout_set_text (layout, label, -1);
 | 
				
			||||||
    g_free (label);
 | 
					 | 
				
			||||||
    pango_layout_set_width (layout,
 | 
					    pango_layout_set_width (layout,
 | 
				
			||||||
                            PANGO_SCALE * bounds.width * priv->scale * scale);
 | 
					                            PANGO_SCALE * bounds.width * priv->scale * scale);
 | 
				
			||||||
    pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
 | 
					    pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
 | 
				
			||||||
@ -500,7 +507,7 @@ eek_renderer_real_render_key_outline (EekRenderer *self,
 | 
				
			|||||||
                                      gboolean     rotate)
 | 
					                                      gboolean     rotate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    cairo_save (cr);
 | 
					    cairo_save (cr);
 | 
				
			||||||
    prepare_render_key (self, cr, key, scale, rotate);
 | 
					    eek_renderer_apply_transformation_for_key (self, cr, key, scale, rotate);
 | 
				
			||||||
    render_key_outline (self, cr, key);
 | 
					    render_key_outline (self, cr, key);
 | 
				
			||||||
    cairo_restore (cr);
 | 
					    cairo_restore (cr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -513,7 +520,7 @@ eek_renderer_real_render_key (EekRenderer *self,
 | 
				
			|||||||
                              gboolean     rotate)
 | 
					                              gboolean     rotate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    cairo_save (cr);
 | 
					    cairo_save (cr);
 | 
				
			||||||
    prepare_render_key (self, cr, key, scale, rotate);
 | 
					    eek_renderer_apply_transformation_for_key (self, cr, key, scale, rotate);
 | 
				
			||||||
    render_key (self, cr, key);
 | 
					    render_key (self, cr, key);
 | 
				
			||||||
    cairo_restore (cr);
 | 
					    cairo_restore (cr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -857,6 +864,24 @@ eek_renderer_render_key_outline (EekRenderer *renderer,
 | 
				
			|||||||
                                                          rotate);
 | 
					                                                          rotate);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_renderer_render_key_icon (EekRenderer *renderer,
 | 
				
			||||||
 | 
					                                 cairo_t     *cr,
 | 
				
			||||||
 | 
					                                 EekKey      *key,
 | 
				
			||||||
 | 
					                                 gdouble      scale,
 | 
				
			||||||
 | 
					                                 gboolean     rotate)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    g_return_if_fail (EEK_IS_RENDERER(renderer));
 | 
				
			||||||
 | 
					    g_return_if_fail (EEK_IS_KEY(key));
 | 
				
			||||||
 | 
					    g_return_if_fail (scale >= 0.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    EEK_RENDERER_GET_CLASS(renderer)->render_key_icon (renderer,
 | 
				
			||||||
 | 
					                                                       cr,
 | 
				
			||||||
 | 
					                                                       key,
 | 
				
			||||||
 | 
					                                                       scale,
 | 
				
			||||||
 | 
					                                                       rotate);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_renderer_render_key (EekRenderer *renderer,
 | 
					eek_renderer_render_key (EekRenderer *renderer,
 | 
				
			||||||
                         cairo_t     *cr,
 | 
					                         cairo_t     *cr,
 | 
				
			||||||
 | 
				
			|||||||
@ -68,9 +68,15 @@ struct _EekRendererClass
 | 
				
			|||||||
    void (* render_keyboard)    (EekRenderer *self,
 | 
					    void (* render_keyboard)    (EekRenderer *self,
 | 
				
			||||||
                                 cairo_t     *cr);
 | 
					                                 cairo_t     *cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void (* render_key_icon)    (EekRenderer *self,
 | 
				
			||||||
 | 
					                                 cairo_t     *cr,
 | 
				
			||||||
 | 
					                                 EekKey      *key,
 | 
				
			||||||
 | 
					                                 gdouble      scale,
 | 
				
			||||||
 | 
					                                 gboolean     rotate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*< private >*/
 | 
					    /*< private >*/
 | 
				
			||||||
    /* padding */
 | 
					    /* padding */
 | 
				
			||||||
    gpointer pdummy[24];
 | 
					    gpointer pdummy[23];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GType        eek_renderer_get_type             (void) G_GNUC_CONST;
 | 
					GType        eek_renderer_get_type             (void) G_GNUC_CONST;
 | 
				
			||||||
@ -106,6 +112,12 @@ void         eek_renderer_render_key           (EekRenderer  *renderer,
 | 
				
			|||||||
                                                gdouble       scale,
 | 
					                                                gdouble       scale,
 | 
				
			||||||
                                                gboolean      rotate);
 | 
					                                                gboolean      rotate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void         eek_renderer_render_key_icon      (EekRenderer  *renderer,
 | 
				
			||||||
 | 
					                                                cairo_t      *cr,
 | 
				
			||||||
 | 
					                                                EekKey       *key,
 | 
				
			||||||
 | 
					                                                gdouble       scale,
 | 
				
			||||||
 | 
					                                                gboolean      rotate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void         eek_renderer_render_keyboard      (EekRenderer  *renderer,
 | 
					void         eek_renderer_render_keyboard      (EekRenderer  *renderer,
 | 
				
			||||||
                                                cairo_t      *cr);
 | 
					                                                cairo_t      *cr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -122,6 +134,12 @@ void         eek_renderer_set_border_width     (EekRenderer  *renderer,
 | 
				
			|||||||
EekKey      *eek_renderer_find_key_by_position (EekRenderer  *renderer,
 | 
					EekKey      *eek_renderer_find_key_by_position (EekRenderer  *renderer,
 | 
				
			||||||
                                                gdouble       x,
 | 
					                                                gdouble       x,
 | 
				
			||||||
                                                gdouble       y);
 | 
					                                                gdouble       y);
 | 
				
			||||||
 | 
					void         eek_renderer_apply_transformation_for_key
 | 
				
			||||||
 | 
					                                               (EekRenderer  *renderer,
 | 
				
			||||||
 | 
					                                                cairo_t      *cr,
 | 
				
			||||||
 | 
					                                                EekKey       *key,
 | 
				
			||||||
 | 
					                                                gdouble       scale,
 | 
				
			||||||
 | 
					                                                gboolean      rotate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_END_DECLS
 | 
					G_END_DECLS
 | 
				
			||||||
#endif  /* EEK_RENDERER_H */
 | 
					#endif  /* EEK_RENDERER_H */
 | 
				
			||||||
 | 
				
			|||||||
@ -32,8 +32,10 @@
 | 
				
			|||||||
#ifdef HAVE_CONFIG_H
 | 
					#ifdef HAVE_CONFIG_H
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#endif  /* HAVE_CONFIG_H */
 | 
					#endif  /* HAVE_CONFIG_H */
 | 
				
			||||||
 | 
					#include "eek-keyboard.h"
 | 
				
			||||||
#include "eek-section.h"
 | 
					#include "eek-section.h"
 | 
				
			||||||
#include "eek-key.h"
 | 
					#include "eek-key.h"
 | 
				
			||||||
 | 
					#include "eek-symbol.h"
 | 
				
			||||||
#include "eek-serializable.h"
 | 
					#include "eek-serializable.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
@ -71,6 +73,7 @@ struct _EekSectionPrivate
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    gint angle;
 | 
					    gint angle;
 | 
				
			||||||
    GSList *rows;
 | 
					    GSList *rows;
 | 
				
			||||||
 | 
					    EekModifierType modifiers;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static EekSerializableIface *eek_section_parent_serializable_iface;
 | 
					static EekSerializableIface *eek_section_parent_serializable_iface;
 | 
				
			||||||
@ -262,6 +265,71 @@ eek_section_real_find_key_by_keycode (EekSection *self,
 | 
				
			|||||||
                                         (gpointer)(long)keycode);
 | 
					                                         (gpointer)(long)keycode);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_section_real_key_pressed (EekSection *self, EekKey *key)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
 | 
				
			||||||
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					    EekModifierBehavior behavior;
 | 
				
			||||||
 | 
					    EekModifierType modifier;
 | 
				
			||||||
 | 
					    EekModifierType num_lock_mask;
 | 
				
			||||||
 | 
					    gint level = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
 | 
					    if (!symbol)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    keyboard = EEK_KEYBOARD(eek_element_get_parent (EEK_ELEMENT(self)));
 | 
				
			||||||
 | 
					    behavior = eek_keyboard_get_modifier_behavior (keyboard);
 | 
				
			||||||
 | 
					    modifier = eek_symbol_get_modifier_mask (symbol);
 | 
				
			||||||
 | 
					    switch (behavior) {
 | 
				
			||||||
 | 
					    case EEK_MODIFIER_BEHAVIOR_NONE:
 | 
				
			||||||
 | 
					        priv->modifiers |= modifier;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case EEK_MODIFIER_BEHAVIOR_LOCK:
 | 
				
			||||||
 | 
					        priv->modifiers ^= modifier;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case EEK_MODIFIER_BEHAVIOR_LATCH:
 | 
				
			||||||
 | 
					        priv->modifiers = (priv->modifiers ^ modifier) & modifier;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    num_lock_mask = eek_keyboard_get_num_lock_mask (keyboard);
 | 
				
			||||||
 | 
					    if (priv->modifiers & num_lock_mask)
 | 
				
			||||||
 | 
					        level = 1;
 | 
				
			||||||
 | 
					    eek_element_set_level (EEK_ELEMENT(self), level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					eek_section_real_key_released (EekSection *self, EekKey *key)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
 | 
				
			||||||
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					    EekModifierBehavior behavior;
 | 
				
			||||||
 | 
					    EekModifierType modifier;
 | 
				
			||||||
 | 
					    EekModifierType num_lock_mask;
 | 
				
			||||||
 | 
					    gint level = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
 | 
					    if (!symbol)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    keyboard = EEK_KEYBOARD(eek_element_get_parent (EEK_ELEMENT(self)));
 | 
				
			||||||
 | 
					    behavior = eek_keyboard_get_modifier_behavior (keyboard);
 | 
				
			||||||
 | 
					    modifier = eek_symbol_get_modifier_mask (symbol);
 | 
				
			||||||
 | 
					    if (modifier != 0) {
 | 
				
			||||||
 | 
					        if (behavior == EEK_MODIFIER_BEHAVIOR_NONE)
 | 
				
			||||||
 | 
					            priv->modifiers &= ~modifier;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    num_lock_mask = eek_keyboard_get_num_lock_mask (keyboard);
 | 
				
			||||||
 | 
					    if (priv->modifiers & num_lock_mask)
 | 
				
			||||||
 | 
					        level = 1;
 | 
				
			||||||
 | 
					    eek_element_set_level (EEK_ELEMENT(self), level);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
eek_section_finalize (GObject *object)
 | 
					eek_section_finalize (GObject *object)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -346,6 +414,9 @@ eek_section_class_init (EekSectionClass *klass)
 | 
				
			|||||||
    klass->find_key_by_keycode = eek_section_real_find_key_by_keycode;
 | 
					    klass->find_key_by_keycode = eek_section_real_find_key_by_keycode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* signals */
 | 
					    /* signals */
 | 
				
			||||||
 | 
					    klass->key_pressed = eek_section_real_key_pressed;
 | 
				
			||||||
 | 
					    klass->key_released = eek_section_real_key_released;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    container_class->child_added = eek_section_real_child_added;
 | 
					    container_class->child_added = eek_section_real_child_added;
 | 
				
			||||||
    container_class->child_removed = eek_section_real_child_removed;
 | 
					    container_class->child_removed = eek_section_real_child_removed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -378,8 +449,8 @@ eek_section_class_init (EekSectionClass *klass)
 | 
				
			|||||||
    signals[KEY_PRESSED] =
 | 
					    signals[KEY_PRESSED] =
 | 
				
			||||||
        g_signal_new (I_("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_LAST,
 | 
				
			||||||
                      0,
 | 
					                      G_STRUCT_OFFSET(EekSectionClass, key_pressed),
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      g_cclosure_marshal_VOID__OBJECT,
 | 
					                      g_cclosure_marshal_VOID__OBJECT,
 | 
				
			||||||
@ -398,8 +469,8 @@ eek_section_class_init (EekSectionClass *klass)
 | 
				
			|||||||
    signals[KEY_RELEASED] =
 | 
					    signals[KEY_RELEASED] =
 | 
				
			||||||
        g_signal_new (I_("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_LAST,
 | 
				
			||||||
                      0,
 | 
					                      G_STRUCT_OFFSET(EekSectionClass, key_released),
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      NULL,
 | 
					                      NULL,
 | 
				
			||||||
                      g_cclosure_marshal_VOID__OBJECT,
 | 
					                      g_cclosure_marshal_VOID__OBJECT,
 | 
				
			||||||
@ -416,6 +487,7 @@ eek_section_init (EekSection *self)
 | 
				
			|||||||
    priv = self->priv = EEK_SECTION_GET_PRIVATE (self);
 | 
					    priv = self->priv = EEK_SECTION_GET_PRIVATE (self);
 | 
				
			||||||
    priv->angle = 0;
 | 
					    priv->angle = 0;
 | 
				
			||||||
    priv->rows = NULL;
 | 
					    priv->rows = NULL;
 | 
				
			||||||
 | 
					    priv->modifiers = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -81,9 +81,15 @@ struct _EekSectionClass
 | 
				
			|||||||
    EekKey *(* find_key_by_keycode) (EekSection     *self,
 | 
					    EekKey *(* find_key_by_keycode) (EekSection     *self,
 | 
				
			||||||
                                     guint           keycode);
 | 
					                                     guint           keycode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* signals */
 | 
				
			||||||
 | 
					    void    (* key_pressed)         (EekSection     *self,
 | 
				
			||||||
 | 
					                                     EekKey         *key);
 | 
				
			||||||
 | 
					    void    (* key_released)        (EekSection     *self,
 | 
				
			||||||
 | 
					                                     EekKey         *key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*< private >*/
 | 
					    /*< private >*/
 | 
				
			||||||
    /* padding */
 | 
					    /* padding */
 | 
				
			||||||
    gpointer pdummy[24];
 | 
					    gpointer pdummy[22];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GType   eek_section_get_type             (void) G_GNUC_CONST;
 | 
					GType   eek_section_get_type             (void) G_GNUC_CONST;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										111
									
								
								eek/eek-symbol.c
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								eek/eek-symbol.c
									
									
									
									
									
								
							@ -38,6 +38,7 @@ enum {
 | 
				
			|||||||
    PROP_LABEL,
 | 
					    PROP_LABEL,
 | 
				
			||||||
    PROP_CATEGORY,
 | 
					    PROP_CATEGORY,
 | 
				
			||||||
    PROP_MODIFIER_MASK,
 | 
					    PROP_MODIFIER_MASK,
 | 
				
			||||||
 | 
					    PROP_ICON_NAME,
 | 
				
			||||||
    PROP_LAST
 | 
					    PROP_LAST
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,6 +47,7 @@ struct _EekSymbolPrivate {
 | 
				
			|||||||
    gchar *label;
 | 
					    gchar *label;
 | 
				
			||||||
    EekSymbolCategory category;
 | 
					    EekSymbolCategory category;
 | 
				
			||||||
    EekModifierType modifier_mask;
 | 
					    EekModifierType modifier_mask;
 | 
				
			||||||
 | 
					    gchar *icon_name;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eek_serializable_iface_init (EekSerializableIface *iface);
 | 
					static void eek_serializable_iface_init (EekSerializableIface *iface);
 | 
				
			||||||
@ -62,11 +64,13 @@ eek_symbol_real_serialize (EekSerializable *self,
 | 
				
			|||||||
                           GVariantBuilder *builder)
 | 
					                           GVariantBuilder *builder)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(self);
 | 
					    EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(self);
 | 
				
			||||||
 | 
					#define NOTNULL(s) ((s) != NULL ? (s) : "")
 | 
				
			||||||
    g_variant_builder_add (builder, "s", priv->name);
 | 
					    g_variant_builder_add (builder, "s", NOTNULL(priv->name));
 | 
				
			||||||
    g_variant_builder_add (builder, "s", priv->label);
 | 
					    g_variant_builder_add (builder, "s", NOTNULL(priv->label));
 | 
				
			||||||
    g_variant_builder_add (builder, "u", priv->category);
 | 
					    g_variant_builder_add (builder, "u", priv->category);
 | 
				
			||||||
    g_variant_builder_add (builder, "u", priv->modifier_mask);
 | 
					    g_variant_builder_add (builder, "u", priv->modifier_mask);
 | 
				
			||||||
 | 
					    g_variant_builder_add (builder, "s", NOTNULL(priv->icon_name));
 | 
				
			||||||
 | 
					#undef NOTNULL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static gsize
 | 
					static gsize
 | 
				
			||||||
@ -80,6 +84,7 @@ eek_symbol_real_deserialize (EekSerializable *self,
 | 
				
			|||||||
    g_variant_get_child (variant, index++, "s", &priv->label);
 | 
					    g_variant_get_child (variant, index++, "s", &priv->label);
 | 
				
			||||||
    g_variant_get_child (variant, index++, "u", &priv->category);
 | 
					    g_variant_get_child (variant, index++, "u", &priv->category);
 | 
				
			||||||
    g_variant_get_child (variant, index++, "u", &priv->modifier_mask);
 | 
					    g_variant_get_child (variant, index++, "u", &priv->modifier_mask);
 | 
				
			||||||
 | 
					    g_variant_get_child (variant, index++, "s", &priv->icon_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -111,6 +116,10 @@ eek_symbol_set_property (GObject      *object,
 | 
				
			|||||||
        eek_symbol_set_modifier_mask (EEK_SYMBOL(object),
 | 
					        eek_symbol_set_modifier_mask (EEK_SYMBOL(object),
 | 
				
			||||||
                                      g_value_get_uint (value));
 | 
					                                      g_value_get_uint (value));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_ICON_NAME:
 | 
				
			||||||
 | 
					        eek_symbol_set_icon_name (EEK_SYMBOL(object),
 | 
				
			||||||
 | 
					                                  g_value_get_string (value));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        g_object_set_property (object,
 | 
					        g_object_set_property (object,
 | 
				
			||||||
                               g_param_spec_get_name (pspec),
 | 
					                               g_param_spec_get_name (pspec),
 | 
				
			||||||
@ -139,6 +148,10 @@ eek_symbol_get_property (GObject    *object,
 | 
				
			|||||||
        g_value_set_uint (value,
 | 
					        g_value_set_uint (value,
 | 
				
			||||||
                          eek_symbol_get_modifier_mask (EEK_SYMBOL(object)));
 | 
					                          eek_symbol_get_modifier_mask (EEK_SYMBOL(object)));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case PROP_ICON_NAME:
 | 
				
			||||||
 | 
					        g_value_set_string (value,
 | 
				
			||||||
 | 
					                            eek_symbol_get_icon_name (EEK_SYMBOL(object)));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        g_object_get_property (object,
 | 
					        g_object_get_property (object,
 | 
				
			||||||
                               g_param_spec_get_name (pspec),
 | 
					                               g_param_spec_get_name (pspec),
 | 
				
			||||||
@ -153,6 +166,8 @@ eek_symbol_finalize (GObject *object)
 | 
				
			|||||||
    EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(object);
 | 
					    EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(object);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_free (priv->name);
 | 
					    g_free (priv->name);
 | 
				
			||||||
 | 
					    g_free (priv->label);
 | 
				
			||||||
 | 
					    g_free (priv->icon_name);
 | 
				
			||||||
    G_OBJECT_CLASS (eek_symbol_parent_class)->finalize (object);
 | 
					    G_OBJECT_CLASS (eek_symbol_parent_class)->finalize (object);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -195,6 +210,13 @@ eek_symbol_class_init (EekSymbolClass *klass)
 | 
				
			|||||||
                               0, G_MAXUINT, 0,
 | 
					                               0, G_MAXUINT, 0,
 | 
				
			||||||
                               G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
 | 
					                               G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
 | 
				
			||||||
    g_object_class_install_property (gobject_class, PROP_MODIFIER_MASK, pspec);
 | 
					    g_object_class_install_property (gobject_class, PROP_MODIFIER_MASK, pspec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pspec = g_param_spec_string ("icon-name",
 | 
				
			||||||
 | 
					                                 "Icon name",
 | 
				
			||||||
 | 
					                                 "Icon name used to render the symbol",
 | 
				
			||||||
 | 
					                                 NULL,
 | 
				
			||||||
 | 
					                                 G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
 | 
				
			||||||
 | 
					    g_object_class_install_property (gobject_class, PROP_ICON_NAME, pspec);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -205,16 +227,30 @@ eek_symbol_init (EekSymbol *self)
 | 
				
			|||||||
    priv = self->priv = EEK_SYMBOL_GET_PRIVATE(self);
 | 
					    priv = self->priv = EEK_SYMBOL_GET_PRIVATE(self);
 | 
				
			||||||
    priv->name = NULL;
 | 
					    priv->name = NULL;
 | 
				
			||||||
    priv->label = NULL;
 | 
					    priv->label = NULL;
 | 
				
			||||||
 | 
					    priv->icon_name = NULL;
 | 
				
			||||||
    priv->category = EEK_SYMBOL_CATEGORY_UNKNOWN;
 | 
					    priv->category = EEK_SYMBOL_CATEGORY_UNKNOWN;
 | 
				
			||||||
    priv->modifier_mask = 0;
 | 
					    priv->modifier_mask = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_new:
 | 
				
			||||||
 | 
					 * @name: name of the symbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Create a new #EekSymbol with @name.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
EekSymbol *
 | 
					EekSymbol *
 | 
				
			||||||
eek_symbol_new (const gchar *name)
 | 
					eek_symbol_new (const gchar *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return g_object_new (EEK_TYPE_SYMBOL, "name", name);
 | 
					    return g_object_new (EEK_TYPE_SYMBOL, "name", name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_set_name:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 * @name: name of the symbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the name of @symbol to @name.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_symbol_set_name (EekSymbol   *symbol,
 | 
					eek_symbol_set_name (EekSymbol   *symbol,
 | 
				
			||||||
                     const gchar *name)
 | 
					                     const gchar *name)
 | 
				
			||||||
@ -228,6 +264,12 @@ eek_symbol_set_name (EekSymbol   *symbol,
 | 
				
			|||||||
    priv->name = g_strdup (name);
 | 
					    priv->name = g_strdup (name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_get_name:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Get the name of @symbol.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
G_CONST_RETURN gchar *
 | 
					G_CONST_RETURN gchar *
 | 
				
			||||||
eek_symbol_get_name (EekSymbol *symbol)
 | 
					eek_symbol_get_name (EekSymbol *symbol)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -236,9 +278,18 @@ eek_symbol_get_name (EekSymbol *symbol)
 | 
				
			|||||||
    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
					    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
					    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
				
			||||||
 | 
					    if (priv->name == NULL || *priv->name == '\0')
 | 
				
			||||||
 | 
					        return NULL;
 | 
				
			||||||
    return priv->name;
 | 
					    return priv->name;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_set_label:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 * @label: label text of @symbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the label text of @symbol to @label.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
eek_symbol_set_label (EekSymbol   *symbol,
 | 
					eek_symbol_set_label (EekSymbol   *symbol,
 | 
				
			||||||
                      const gchar *label)
 | 
					                      const gchar *label)
 | 
				
			||||||
@ -252,7 +303,13 @@ eek_symbol_set_label (EekSymbol   *symbol,
 | 
				
			|||||||
    priv->label = g_strdup (label);
 | 
					    priv->label = g_strdup (label);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gchar *
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_get_label:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Get the label text of @symbol.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					G_CONST_RETURN gchar *
 | 
				
			||||||
eek_symbol_get_label (EekSymbol *symbol)
 | 
					eek_symbol_get_label (EekSymbol *symbol)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekSymbolPrivate *priv;
 | 
					    EekSymbolPrivate *priv;
 | 
				
			||||||
@ -260,7 +317,9 @@ eek_symbol_get_label (EekSymbol *symbol)
 | 
				
			|||||||
    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
					    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
					    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
				
			||||||
    return g_strdup (priv->label);
 | 
					    if (priv->label == NULL || *priv->label == '\0')
 | 
				
			||||||
 | 
					        return NULL;
 | 
				
			||||||
 | 
					    return priv->label;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -286,7 +345,7 @@ eek_symbol_set_category (EekSymbol        *symbol,
 | 
				
			|||||||
 * eek_symbol_get_category:
 | 
					 * eek_symbol_get_category:
 | 
				
			||||||
 * @symbol: an #EekSymbol
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Returns symbol category of @symbol.
 | 
					 * Get symbol category of @symbol.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
EekSymbolCategory
 | 
					EekSymbolCategory
 | 
				
			||||||
eek_symbol_get_category (EekSymbol *symbol)
 | 
					eek_symbol_get_category (EekSymbol *symbol)
 | 
				
			||||||
@ -321,7 +380,7 @@ eek_symbol_set_modifier_mask (EekSymbol      *symbol,
 | 
				
			|||||||
 * eek_symbol_get_modifier_mask:
 | 
					 * eek_symbol_get_modifier_mask:
 | 
				
			||||||
 * @symbol: an #EekSymbol
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Returns modifier mask @symbol can trigger.
 | 
					 * Get modifier mask @symbol can trigger.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
EekModifierType
 | 
					EekModifierType
 | 
				
			||||||
eek_symbol_get_modifier_mask (EekSymbol *symbol)
 | 
					eek_symbol_get_modifier_mask (EekSymbol *symbol)
 | 
				
			||||||
@ -347,3 +406,41 @@ eek_symbol_is_modifier (EekSymbol *symbol)
 | 
				
			|||||||
    return eek_symbol_get_modifier_mask (symbol) != 0;
 | 
					    return eek_symbol_get_modifier_mask (symbol) != 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_set_icon_name:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 * @icon_name: icon name of @symbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Set the icon name of @symbol to @icon_name.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eek_symbol_set_icon_name (EekSymbol   *symbol,
 | 
				
			||||||
 | 
					                          const gchar *icon_name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekSymbolPrivate *priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_return_if_fail (EEK_IS_SYMBOL(symbol));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
				
			||||||
 | 
					    g_free (priv->icon_name);
 | 
				
			||||||
 | 
					    priv->icon_name = g_strdup (icon_name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eek_symbol_get_icon_name:
 | 
				
			||||||
 | 
					 * @symbol: an #EekSymbol
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Get the icon name of @symbol.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					G_CONST_RETURN gchar *
 | 
				
			||||||
 | 
					eek_symbol_get_icon_name (EekSymbol *symbol)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekSymbolPrivate *priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
				
			||||||
 | 
					    if (priv->icon_name == NULL || *priv->icon_name == '\0')
 | 
				
			||||||
 | 
					        return NULL;
 | 
				
			||||||
 | 
					    return priv->icon_name;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -93,14 +93,19 @@ void                  eek_symbol_set_name          (EekSymbol        *symbol,
 | 
				
			|||||||
G_CONST_RETURN gchar *eek_symbol_get_name      (EekSymbol        *symbol);
 | 
					G_CONST_RETURN gchar *eek_symbol_get_name      (EekSymbol        *symbol);
 | 
				
			||||||
void                  eek_symbol_set_label     (EekSymbol        *symbol,
 | 
					void                  eek_symbol_set_label     (EekSymbol        *symbol,
 | 
				
			||||||
                                                const gchar      *label);
 | 
					                                                const gchar      *label);
 | 
				
			||||||
gchar                *eek_symbol_get_label         (EekSymbol        *symbol);
 | 
					G_CONST_RETURN gchar *eek_symbol_get_label     (EekSymbol        *symbol);
 | 
				
			||||||
void                  eek_symbol_set_category  (EekSymbol        *symbol,
 | 
					void                  eek_symbol_set_category  (EekSymbol        *symbol,
 | 
				
			||||||
                                                EekSymbolCategory category);
 | 
					                                                EekSymbolCategory category);
 | 
				
			||||||
EekSymbolCategory     eek_symbol_get_category  (EekSymbol        *symbol);
 | 
					EekSymbolCategory     eek_symbol_get_category  (EekSymbol        *symbol);
 | 
				
			||||||
EekModifierType       eek_symbol_get_modifier_mask (EekSymbol        *keysym);
 | 
					EekModifierType       eek_symbol_get_modifier_mask
 | 
				
			||||||
void                  eek_symbol_set_modifier_mask (EekSymbol        *keysym,
 | 
					                                               (EekSymbol        *keysym);
 | 
				
			||||||
 | 
					void                  eek_symbol_set_modifier_mask
 | 
				
			||||||
 | 
					                                               (EekSymbol        *keysym,
 | 
				
			||||||
                                                EekModifierType   mask);
 | 
					                                                EekModifierType   mask);
 | 
				
			||||||
gboolean              eek_symbol_is_modifier   (EekSymbol        *symbol);
 | 
					gboolean              eek_symbol_is_modifier   (EekSymbol        *symbol);
 | 
				
			||||||
 | 
					void                  eek_symbol_set_icon_name (EekSymbol        *symbol,
 | 
				
			||||||
 | 
					                                                const gchar      *icon_name);
 | 
				
			||||||
 | 
					G_CONST_RETURN gchar *eek_symbol_get_icon_name (EekSymbol        *symbol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_END_DECLS
 | 
					G_END_DECLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -202,9 +202,13 @@ create_key (EekXkbLayout *layout,
 | 
				
			|||||||
        matrix = eek_symbol_matrix_new (num_groups, num_levels);
 | 
					        matrix = eek_symbol_matrix_new (num_groups, num_levels);
 | 
				
			||||||
        for (i = 0; i < num_groups; i++)
 | 
					        for (i = 0; i < num_groups; i++)
 | 
				
			||||||
            for (j = 0; j < num_levels; j++) {
 | 
					            for (j = 0; j < num_levels; j++) {
 | 
				
			||||||
 | 
					                EekModifierType modifier;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
 | 
					                keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
 | 
				
			||||||
 | 
					                modifier = XkbKeysymToModifiers (priv->display, keysym);
 | 
				
			||||||
                matrix->data[i * num_levels + j] =
 | 
					                matrix->data[i * num_levels + j] =
 | 
				
			||||||
                    EEK_SYMBOL(eek_keysym_new (keysym));
 | 
					                    EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
 | 
				
			||||||
 | 
					                                                             modifier));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -320,6 +324,10 @@ eek_xkb_layout_real_create_keyboard (EekLayout *self,
 | 
				
			|||||||
    bounds.height = initial_height;
 | 
					    bounds.height = initial_height;
 | 
				
			||||||
    eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
					    eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    eek_keyboard_set_num_lock_mask (keyboard,
 | 
				
			||||||
 | 
					                                    XkbKeysymToModifiers (priv->display,
 | 
				
			||||||
 | 
					                                                          XK_Num_Lock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (priv->shape_oref_hash)
 | 
					    if (priv->shape_oref_hash)
 | 
				
			||||||
        g_hash_table_destroy (priv->shape_oref_hash);
 | 
					        g_hash_table_destroy (priv->shape_oref_hash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -64,6 +64,8 @@ struct _ParseCallbackData {
 | 
				
			|||||||
    EekOrientation orientation;
 | 
					    EekOrientation orientation;
 | 
				
			||||||
    GSList *points;
 | 
					    GSList *points;
 | 
				
			||||||
    GSList *symbols;
 | 
					    GSList *symbols;
 | 
				
			||||||
 | 
					    gchar *label;
 | 
				
			||||||
 | 
					    gchar *icon;
 | 
				
			||||||
    guint keyval;
 | 
					    guint keyval;
 | 
				
			||||||
    gint groups, levels;
 | 
					    gint groups, levels;
 | 
				
			||||||
    EekOutline outline;
 | 
					    EekOutline outline;
 | 
				
			||||||
@ -160,7 +162,7 @@ start_element_callback (GMarkupParseContext *pcontext,
 | 
				
			|||||||
    const gchar **values = attribute_values;
 | 
					    const gchar **values = attribute_values;
 | 
				
			||||||
    gint column = -1, row = -1, groups = -1, levels = -1;
 | 
					    gint column = -1, row = -1, groups = -1, levels = -1;
 | 
				
			||||||
    guint keyval = EEK_INVALID_KEYSYM;
 | 
					    guint keyval = EEK_INVALID_KEYSYM;
 | 
				
			||||||
    gchar *name = NULL, *id = NULL, *version = NULL;
 | 
					    gchar *name = NULL, *label = NULL, *icon = NULL, *id = NULL, *version = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    validate (element_name, data->element_stack, error);
 | 
					    validate (element_name, data->element_stack, error);
 | 
				
			||||||
    if (error && *error)
 | 
					    if (error && *error)
 | 
				
			||||||
@ -175,6 +177,10 @@ start_element_callback (GMarkupParseContext *pcontext,
 | 
				
			|||||||
            id = g_strdup (*values);
 | 
					            id = g_strdup (*values);
 | 
				
			||||||
        else if (g_strcmp0 (*names, "name") == 0)
 | 
					        else if (g_strcmp0 (*names, "name") == 0)
 | 
				
			||||||
            name = g_strdup (*values);
 | 
					            name = g_strdup (*values);
 | 
				
			||||||
 | 
					        else if (g_strcmp0 (*names, "label") == 0)
 | 
				
			||||||
 | 
					            label = g_strdup (*values);
 | 
				
			||||||
 | 
					        else if (g_strcmp0 (*names, "icon") == 0)
 | 
				
			||||||
 | 
					            icon = g_strdup (*values);
 | 
				
			||||||
        else if (g_strcmp0 (*names, "keyval") == 0)
 | 
					        else if (g_strcmp0 (*names, "keyval") == 0)
 | 
				
			||||||
            keyval = strtoul (*values, NULL, 10);
 | 
					            keyval = strtoul (*values, NULL, 10);
 | 
				
			||||||
        else if (g_strcmp0 (*names, "version") == 0)
 | 
					        else if (g_strcmp0 (*names, "version") == 0)
 | 
				
			||||||
@ -220,8 +226,11 @@ start_element_callback (GMarkupParseContext *pcontext,
 | 
				
			|||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (g_strcmp0 (element_name, "keysym") == 0)
 | 
					    if (g_strcmp0 (element_name, "keysym") == 0) {
 | 
				
			||||||
 | 
					        data->label = g_strdup (label);
 | 
				
			||||||
 | 
					        data->icon = g_strdup (icon);
 | 
				
			||||||
        data->keyval = keyval;
 | 
					        data->keyval = keyval;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (g_strcmp0 (element_name, "outline") == 0) {
 | 
					    if (g_strcmp0 (element_name, "outline") == 0) {
 | 
				
			||||||
        data->oref = g_strdup (id);
 | 
					        data->oref = g_strdup (id);
 | 
				
			||||||
@ -229,6 +238,8 @@ start_element_callback (GMarkupParseContext *pcontext,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 out:
 | 
					 out:
 | 
				
			||||||
    g_free (name);
 | 
					    g_free (name);
 | 
				
			||||||
 | 
					    g_free (label);
 | 
				
			||||||
 | 
					    g_free (icon);
 | 
				
			||||||
    g_free (id);
 | 
					    g_free (id);
 | 
				
			||||||
    g_free (version);
 | 
					    g_free (version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -396,6 +407,14 @@ end_element_callback (GMarkupParseContext *pcontext,
 | 
				
			|||||||
            //g_debug ("%u %s", data->keyval, eek_symbol_get_label (EEK_SYMBOL(keysym)));
 | 
					            //g_debug ("%u %s", data->keyval, eek_symbol_get_label (EEK_SYMBOL(keysym)));
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
            keysym = eek_keysym_new_from_name (text);
 | 
					            keysym = eek_keysym_new_from_name (text);
 | 
				
			||||||
 | 
					        if (data->label) {
 | 
				
			||||||
 | 
					            eek_symbol_set_label (EEK_SYMBOL(keysym), data->label);
 | 
				
			||||||
 | 
					            g_free (data->label);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (data->icon) {
 | 
				
			||||||
 | 
					            eek_symbol_set_icon_name (EEK_SYMBOL(keysym), data->icon);
 | 
				
			||||||
 | 
					            g_free (data->icon);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        data->symbols = g_slist_prepend (data->symbols, keysym);
 | 
					        data->symbols = g_slist_prepend (data->symbols, keysym);
 | 
				
			||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -56,6 +56,7 @@ G_DEFINE_TYPE (EekboardContext, eekboard_context, G_TYPE_DBUS_PROXY);
 | 
				
			|||||||
struct _EekboardContextPrivate
 | 
					struct _EekboardContextPrivate
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekKeyboard *keyboard;
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					    GHashTable *keyboard_hash;
 | 
				
			||||||
    gboolean keyboard_visible;
 | 
					    gboolean keyboard_visible;
 | 
				
			||||||
    gboolean enabled;
 | 
					    gboolean enabled;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -173,6 +174,11 @@ eekboard_context_dispose (GObject *self)
 | 
				
			|||||||
        g_object_unref (priv->keyboard);
 | 
					        g_object_unref (priv->keyboard);
 | 
				
			||||||
        priv->keyboard = NULL;
 | 
					        priv->keyboard = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (priv->keyboard_hash) {
 | 
				
			||||||
 | 
					        g_hash_table_destroy (priv->keyboard_hash);
 | 
				
			||||||
 | 
					        priv->keyboard_hash = NULL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -293,6 +299,11 @@ eekboard_context_init (EekboardContext *self)
 | 
				
			|||||||
    priv->keyboard = NULL;
 | 
					    priv->keyboard = NULL;
 | 
				
			||||||
    priv->keyboard_visible = FALSE;
 | 
					    priv->keyboard_visible = FALSE;
 | 
				
			||||||
    priv->enabled = FALSE;
 | 
					    priv->enabled = FALSE;
 | 
				
			||||||
 | 
					    priv->keyboard_hash =
 | 
				
			||||||
 | 
					        g_hash_table_new_full (g_direct_hash,
 | 
				
			||||||
 | 
					                               g_direct_equal,
 | 
				
			||||||
 | 
					                               NULL,
 | 
				
			||||||
 | 
					                               (GDestroyNotify)g_object_unref);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -347,39 +358,127 @@ context_async_ready_callback (GObject      *source_object,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * eekboard_context_set_keyboard:
 | 
					 * eekboard_context_add_keyboard:
 | 
				
			||||||
 * @context: an #EekboardContext
 | 
					 * @context: an #EekboardContext
 | 
				
			||||||
 * @keyboard: an #EekKeyboard
 | 
					 * @keyboard: an #EekKeyboard
 | 
				
			||||||
 * @cancellable: a #GCancellable
 | 
					 * @cancellable: a #GCancellable
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Set the keyboard description of @context to @keyboard.
 | 
					 * Register @keyboard in @context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					guint
 | 
				
			||||||
eekboard_context_set_keyboard (EekboardContext *context,
 | 
					eekboard_context_add_keyboard (EekboardContext *context,
 | 
				
			||||||
                               EekKeyboard     *keyboard,
 | 
					                               EekKeyboard     *keyboard,
 | 
				
			||||||
                               GCancellable    *cancellable)
 | 
					                               GCancellable    *cancellable)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekboardContextPrivate *priv;
 | 
					    EekboardContextPrivate *priv;
 | 
				
			||||||
    GVariant *variant;
 | 
					    GVariant *variant, *result;
 | 
				
			||||||
 | 
					    GError *error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_return_val_if_fail (EEKBOARD_IS_CONTEXT(context), 0);
 | 
				
			||||||
 | 
					    g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv = EEKBOARD_CONTEXT_GET_PRIVATE (context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    variant = eek_serializable_serialize (EEK_SERIALIZABLE(keyboard));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    error = NULL;
 | 
				
			||||||
 | 
					    result = g_dbus_proxy_call_sync (G_DBUS_PROXY(context),
 | 
				
			||||||
 | 
					                                     "AddKeyboard",
 | 
				
			||||||
 | 
					                                     g_variant_new ("(v)", variant),
 | 
				
			||||||
 | 
					                                     G_DBUS_CALL_FLAGS_NONE,
 | 
				
			||||||
 | 
					                                     -1,
 | 
				
			||||||
 | 
					                                     cancellable,
 | 
				
			||||||
 | 
					                                     &error);
 | 
				
			||||||
 | 
					    g_variant_unref (variant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (result) {
 | 
				
			||||||
 | 
					        guint keyboard_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_variant_get (result, "(u)", &keyboard_id);
 | 
				
			||||||
 | 
					        g_variant_unref (result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (keyboard_id != 0) {
 | 
				
			||||||
 | 
					            g_hash_table_insert (priv->keyboard_hash,
 | 
				
			||||||
 | 
					                                 GUINT_TO_POINTER(keyboard_id),
 | 
				
			||||||
 | 
					                                 g_object_ref (keyboard));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return keyboard_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eekboard_context_remove_keyboard:
 | 
				
			||||||
 | 
					 * @context: an #EekboardContext
 | 
				
			||||||
 | 
					 * @keyboard_id: keyboard ID
 | 
				
			||||||
 | 
					 * @cancellable: a #GCancellable
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Unregister the keyboard with @keyboard_id in @context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eekboard_context_remove_keyboard (EekboardContext *context,
 | 
				
			||||||
 | 
					                                  guint            keyboard_id,
 | 
				
			||||||
 | 
					                                  GCancellable    *cancellable)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekboardContextPrivate *priv;
 | 
				
			||||||
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
 | 
					    g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
 | 
				
			||||||
    g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    priv = EEKBOARD_CONTEXT_GET_PRIVATE(context);
 | 
					    priv = EEKBOARD_CONTEXT_GET_PRIVATE (context);
 | 
				
			||||||
    if (priv->keyboard)
 | 
					
 | 
				
			||||||
        g_object_unref (priv->keyboard);
 | 
					    keyboard = g_hash_table_lookup (priv->keyboard_hash,
 | 
				
			||||||
    priv->keyboard = g_object_ref (keyboard);
 | 
					                                    GUINT_TO_POINTER(keyboard_id));
 | 
				
			||||||
 | 
					    if (keyboard == priv->keyboard)
 | 
				
			||||||
 | 
					        priv->keyboard = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_hash_table_remove (priv->keyboard_hash, GUINT_TO_POINTER(keyboard_id));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    variant = eek_serializable_serialize (EEK_SERIALIZABLE(priv->keyboard));
 | 
					 | 
				
			||||||
    g_dbus_proxy_call (G_DBUS_PROXY(context),
 | 
					    g_dbus_proxy_call (G_DBUS_PROXY(context),
 | 
				
			||||||
                       "SetKeyboard",
 | 
					                       "RemoveKeyboard",
 | 
				
			||||||
                       g_variant_new ("(v)", variant),
 | 
					                       g_variant_new ("(u)", keyboard_id),
 | 
				
			||||||
 | 
					                       G_DBUS_CALL_FLAGS_NONE,
 | 
				
			||||||
 | 
					                       -1,
 | 
				
			||||||
 | 
					                       cancellable,
 | 
				
			||||||
 | 
					                       context_async_ready_callback,
 | 
				
			||||||
 | 
					                       NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * eekboard_context_set_keyboard:
 | 
				
			||||||
 | 
					 * @context: an #EekboardContext
 | 
				
			||||||
 | 
					 * @keyboard_id: keyboard ID
 | 
				
			||||||
 | 
					 * @cancellable: a #GCancellable
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Select a keyboard with ID @keyboard_id in @context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					eekboard_context_set_keyboard (EekboardContext *context,
 | 
				
			||||||
 | 
					                               guint            keyboard_id,
 | 
				
			||||||
 | 
					                               GCancellable    *cancellable)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    EekboardContextPrivate *priv;
 | 
				
			||||||
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv = EEKBOARD_CONTEXT_GET_PRIVATE (context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    keyboard = g_hash_table_lookup (priv->keyboard_hash,
 | 
				
			||||||
 | 
					                                    GUINT_TO_POINTER(keyboard_id));
 | 
				
			||||||
 | 
					    if (!keyboard || keyboard == priv->keyboard)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv->keyboard = keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_dbus_proxy_call (G_DBUS_PROXY(context),
 | 
				
			||||||
 | 
					                       "SetKeyboard",
 | 
				
			||||||
 | 
					                       g_variant_new ("(u)", keyboard_id),
 | 
				
			||||||
                       G_DBUS_CALL_FLAGS_NONE,
 | 
					                       G_DBUS_CALL_FLAGS_NONE,
 | 
				
			||||||
                       -1,
 | 
					                       -1,
 | 
				
			||||||
                       cancellable,
 | 
					                       cancellable,
 | 
				
			||||||
                       context_async_ready_callback,
 | 
					                       context_async_ready_callback,
 | 
				
			||||||
                       NULL);
 | 
					                       NULL);
 | 
				
			||||||
    g_variant_unref (variant);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -402,9 +501,8 @@ eekboard_context_set_group (EekboardContext *context,
 | 
				
			|||||||
    priv = EEKBOARD_CONTEXT_GET_PRIVATE (context);
 | 
					    priv = EEKBOARD_CONTEXT_GET_PRIVATE (context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_return_if_fail (priv->keyboard);
 | 
					    g_return_if_fail (priv->keyboard);
 | 
				
			||||||
    g_return_if_fail (group >= 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    eek_keyboard_set_group (priv->keyboard, group);
 | 
					    eek_element_set_group (EEK_ELEMENT(priv->keyboard), group);
 | 
				
			||||||
    g_dbus_proxy_call (G_DBUS_PROXY(context),
 | 
					    g_dbus_proxy_call (G_DBUS_PROXY(context),
 | 
				
			||||||
                       "SetGroup",
 | 
					                       "SetGroup",
 | 
				
			||||||
                       g_variant_new ("(i)", group),
 | 
					                       g_variant_new ("(i)", group),
 | 
				
			||||||
 | 
				
			|||||||
@ -77,9 +77,16 @@ GType            eekboard_context_get_type      (void) G_GNUC_CONST;
 | 
				
			|||||||
EekboardContext *eekboard_context_new           (GDBusConnection *connection,
 | 
					EekboardContext *eekboard_context_new           (GDBusConnection *connection,
 | 
				
			||||||
                                                 const gchar     *object_path,
 | 
					                                                 const gchar     *object_path,
 | 
				
			||||||
                                                 GCancellable    *cancellable);
 | 
					                                                 GCancellable    *cancellable);
 | 
				
			||||||
void             eekboard_context_set_keyboard  (EekboardContext *context,
 | 
					guint            eekboard_context_add_keyboard  (EekboardContext *context,
 | 
				
			||||||
                                                 EekKeyboard     *keyboard,
 | 
					                                                 EekKeyboard     *keyboard,
 | 
				
			||||||
                                                 GCancellable    *cancellable);
 | 
					                                                 GCancellable    *cancellable);
 | 
				
			||||||
 | 
					void             eekboard_context_remove_keyboard
 | 
				
			||||||
 | 
					                                                (EekboardContext *context,
 | 
				
			||||||
 | 
					                                                 guint            keyboard_id,
 | 
				
			||||||
 | 
					                                                 GCancellable    *cancellable);
 | 
				
			||||||
 | 
					void             eekboard_context_set_keyboard  (EekboardContext *context,
 | 
				
			||||||
 | 
					                                                 guint            keyboard_id,
 | 
				
			||||||
 | 
					                                                 GCancellable    *cancellable);
 | 
				
			||||||
void             eekboard_context_show_keyboard (EekboardContext *context,
 | 
					void             eekboard_context_show_keyboard (EekboardContext *context,
 | 
				
			||||||
                                                 GCancellable    *cancellable);
 | 
					                                                 GCancellable    *cancellable);
 | 
				
			||||||
void             eekboard_context_hide_keyboard (EekboardContext *context,
 | 
					void             eekboard_context_hide_keyboard (EekboardContext *context,
 | 
				
			||||||
 | 
				
			|||||||
@ -4,3 +4,4 @@ src/client-main.c
 | 
				
			|||||||
src/desktop-client.c
 | 
					src/desktop-client.c
 | 
				
			||||||
src/desktop-client-main.c
 | 
					src/desktop-client-main.c
 | 
				
			||||||
src/xml-main.c
 | 
					src/xml-main.c
 | 
				
			||||||
 | 
					src/server-main.c
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					eek/eek-element.c
 | 
				
			||||||
eek/eek-container.c
 | 
					eek/eek-container.c
 | 
				
			||||||
eek/eek-key.c
 | 
					eek/eek-key.c
 | 
				
			||||||
eek/eek-keyboard.c
 | 
					eek/eek-keyboard.c
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										38
									
								
								po/ja.po
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								po/ja.po
									
									
									
									
									
								
							@ -8,8 +8,8 @@ msgid ""
 | 
				
			|||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
"Project-Id-Version: eekboard 0.90.2\n"
 | 
					"Project-Id-Version: eekboard 0.90.2\n"
 | 
				
			||||||
"Report-Msgid-Bugs-To: \n"
 | 
					"Report-Msgid-Bugs-To: \n"
 | 
				
			||||||
"POT-Creation-Date: 2011-02-24 17:36+0900\n"
 | 
					"POT-Creation-Date: 2011-02-25 13:13+0900\n"
 | 
				
			||||||
"PO-Revision-Date: 2011-02-24 17:36+0900\n"
 | 
					"PO-Revision-Date: 2011-02-25 13:14+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"
 | 
					"Language: \n"
 | 
				
			||||||
@ -18,39 +18,55 @@ msgstr ""
 | 
				
			|||||||
"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/client-main.c:36
 | 
					#: ../src/server-context.c:216
 | 
				
			||||||
 | 
					msgid "Keyboard"
 | 
				
			||||||
 | 
					msgstr "キーボード"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: ../src/client-main.c:41 ../src/desktop-client-main.c:41
 | 
				
			||||||
 | 
					msgid "Connect to the system bus"
 | 
				
			||||||
 | 
					msgstr "システムバスに接続"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: ../src/client-main.c:43 ../src/desktop-client-main.c:43
 | 
				
			||||||
 | 
					msgid "Connect to the session bus"
 | 
				
			||||||
 | 
					msgstr "セッションバスに接続"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: ../src/client-main.c:45 ../src/desktop-client-main.c:45
 | 
				
			||||||
 | 
					msgid "Connect to the given D-Bus address"
 | 
				
			||||||
 | 
					msgstr "与えられた D-Bus アドレスに接続"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: ../src/client-main.c:47
 | 
				
			||||||
msgid "Upload keyboard description from an XML file"
 | 
					msgid "Upload keyboard description from an XML file"
 | 
				
			||||||
msgstr "XML ファイルから読み込んだキーボード記述をアップロード"
 | 
					msgstr "XML ファイルから読み込んだキーボード記述をアップロード"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:38
 | 
					#: ../src/client-main.c:49
 | 
				
			||||||
msgid "Set group of the keyboard"
 | 
					msgid "Set group of the keyboard"
 | 
				
			||||||
msgstr "キーボードのグループを設定"
 | 
					msgstr "キーボードのグループを設定"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:40
 | 
					#: ../src/client-main.c:51
 | 
				
			||||||
msgid "Show keyboard"
 | 
					msgid "Show keyboard"
 | 
				
			||||||
msgstr "キーボードを表示"
 | 
					msgstr "キーボードを表示"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:42
 | 
					#: ../src/client-main.c:53
 | 
				
			||||||
msgid "Hide keyboard"
 | 
					msgid "Hide keyboard"
 | 
				
			||||||
msgstr "キーボードを隠す"
 | 
					msgstr "キーボードを隠す"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:44
 | 
					#: ../src/client-main.c:55
 | 
				
			||||||
msgid "Press key"
 | 
					msgid "Press key"
 | 
				
			||||||
msgstr "キーを押す"
 | 
					msgstr "キーを押す"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:46
 | 
					#: ../src/client-main.c:57
 | 
				
			||||||
msgid "Release key"
 | 
					msgid "Release key"
 | 
				
			||||||
msgstr "キーを離す"
 | 
					msgstr "キーを離す"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/client-main.c:48
 | 
					#: ../src/client-main.c:59
 | 
				
			||||||
msgid "Listen events"
 | 
					msgid "Listen events"
 | 
				
			||||||
msgstr "イベントの通知を受ける"
 | 
					msgstr "イベントの通知を受ける"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/desktop-client-main.c:38
 | 
					#: ../src/desktop-client-main.c:48
 | 
				
			||||||
msgid "Listen focus change events with AT-SPI"
 | 
					msgid "Listen focus change events with AT-SPI"
 | 
				
			||||||
msgstr "AT-SPI によるフォーカス変更イベントの通知を受ける"
 | 
					msgstr "AT-SPI によるフォーカス変更イベントの通知を受ける"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: ../src/desktop-client-main.c:40
 | 
					#: ../src/desktop-client-main.c:50
 | 
				
			||||||
msgid "Listen keystroke events with AT-SPI"
 | 
					msgid "Listen keystroke events with AT-SPI"
 | 
				
			||||||
msgstr "AT-SPI による打鍵イベントの通知を受ける"
 | 
					msgstr "AT-SPI による打鍵イベントの通知を受ける"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ bin_PROGRAMS = \
 | 
				
			|||||||
	eekboard-server \
 | 
						eekboard-server \
 | 
				
			||||||
	eekboard-xml
 | 
						eekboard-xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					noinst_LTLIBRARIES = libxklutil.la
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eekboard_desktop_client_CFLAGS = \
 | 
					eekboard_desktop_client_CFLAGS = \
 | 
				
			||||||
	-I$(top_srcdir) \
 | 
						-I$(top_srcdir) \
 | 
				
			||||||
	$(GIO2_CFLAGS) \
 | 
						$(GIO2_CFLAGS) \
 | 
				
			||||||
@ -32,6 +34,7 @@ eekboard_desktop_client_CFLAGS = \
 | 
				
			|||||||
	$(LIBXKLAVIER_CFLAGS)
 | 
						$(LIBXKLAVIER_CFLAGS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eekboard_desktop_client_LDADD = \
 | 
					eekboard_desktop_client_LDADD = \
 | 
				
			||||||
 | 
						$(builddir)/libxklutil.la \
 | 
				
			||||||
	$(top_builddir)/eekboard/libeekboard.la \
 | 
						$(top_builddir)/eekboard/libeekboard.la \
 | 
				
			||||||
	$(top_builddir)/eek/libeek.la \
 | 
						$(top_builddir)/eek/libeek.la \
 | 
				
			||||||
	$(top_builddir)/eek/libeek-xkl.la \
 | 
						$(top_builddir)/eek/libeek-xkl.la \
 | 
				
			||||||
@ -96,6 +99,7 @@ eekboard_xml_CFLAGS = \
 | 
				
			|||||||
	$(LIBXKLAVIER_CFLAGS)
 | 
						$(LIBXKLAVIER_CFLAGS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eekboard_xml_LDADD = \
 | 
					eekboard_xml_LDADD = \
 | 
				
			||||||
 | 
						$(builddir)/libxklutil.la \
 | 
				
			||||||
	$(top_builddir)/eek/libeek.la \
 | 
						$(top_builddir)/eek/libeek.la \
 | 
				
			||||||
	$(top_builddir)/eek/libeek-xkl.la \
 | 
						$(top_builddir)/eek/libeek-xkl.la \
 | 
				
			||||||
	$(top_builddir)/eek/libeek-gtk.la \
 | 
						$(top_builddir)/eek/libeek-gtk.la \
 | 
				
			||||||
@ -103,8 +107,12 @@ eekboard_xml_LDADD = \
 | 
				
			|||||||
	$(GTK_LIBS) \
 | 
						$(GTK_LIBS) \
 | 
				
			||||||
	$(LIBXKLAVIER_LIBS)
 | 
						$(LIBXKLAVIER_LIBS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eekboard_xml_headers = xklutil.h
 | 
					eekboard_xml_SOURCES = xml-main.c
 | 
				
			||||||
eekboard_xml_SOURCES = xklutil.c xml-main.c
 | 
					
 | 
				
			||||||
 | 
					libxklutil_la_headers = xklutil.h
 | 
				
			||||||
 | 
					libxklutil_la_SOURCES = xklutil.c
 | 
				
			||||||
 | 
					libxklutil_la_CFLAGS = $(LIBXKLAVIER_CFLAGS)
 | 
				
			||||||
 | 
					libxklutil_la_LIBADD = $(LIBXKLAVIER_LIBS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eekboarddir = $(includedir)/eekboard-$(EEK_API_VERSION)/eekboard
 | 
					eekboarddir = $(includedir)/eekboard-$(EEK_API_VERSION)/eekboard
 | 
				
			||||||
eekboard_HEADERS =				\
 | 
					eekboard_HEADERS =				\
 | 
				
			||||||
@ -114,7 +122,8 @@ noinst_HEADERS = \
 | 
				
			|||||||
	$(eekboard_desktop_client_headers) \
 | 
						$(eekboard_desktop_client_headers) \
 | 
				
			||||||
	$(eekboard_client_headers) \
 | 
						$(eekboard_client_headers) \
 | 
				
			||||||
	$(eekboard_server_headers) \
 | 
						$(eekboard_server_headers) \
 | 
				
			||||||
	$(eekboard_xml_headers)
 | 
						$(eekboard_xml_headers) \
 | 
				
			||||||
 | 
						$(libxklutil_la_headers)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXTRA_DIST = $(service_in_files)
 | 
					EXTRA_DIST = $(service_in_files)
 | 
				
			||||||
DISTCLEANFILES = $(service_DATA)
 | 
					DISTCLEANFILES = $(service_DATA)
 | 
				
			||||||
 | 
				
			|||||||
@ -19,10 +19,15 @@
 | 
				
			|||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#endif  /* HAVE_CONFIG_H */
 | 
					#endif  /* HAVE_CONFIG_H */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <glib/gi18n.h>
 | 
					#include <glib/gi18n.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "eekboard/eekboard.h"
 | 
					#include "eekboard/eekboard.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static gboolean opt_system = FALSE;
 | 
				
			||||||
 | 
					static gboolean opt_session = FALSE;
 | 
				
			||||||
 | 
					static gchar *opt_address = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static gchar *opt_set_keyboard = NULL;
 | 
					static gchar *opt_set_keyboard = NULL;
 | 
				
			||||||
static gint opt_set_group = -1;
 | 
					static gint opt_set_group = -1;
 | 
				
			||||||
static gboolean opt_show_keyboard = FALSE;
 | 
					static gboolean opt_show_keyboard = FALSE;
 | 
				
			||||||
@ -32,6 +37,12 @@ static gint opt_release_key = -1;
 | 
				
			|||||||
static gboolean opt_listen = FALSE;
 | 
					static gboolean opt_listen = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const GOptionEntry options[] = {
 | 
					static const GOptionEntry options[] = {
 | 
				
			||||||
 | 
					    {"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
 | 
				
			||||||
 | 
					     N_("Connect to the system bus")},
 | 
				
			||||||
 | 
					    {"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
 | 
				
			||||||
 | 
					     N_("Connect to the session bus")},
 | 
				
			||||||
 | 
					    {"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
 | 
				
			||||||
 | 
					     N_("Connect to the given D-Bus address")},
 | 
				
			||||||
    {"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard,
 | 
					    {"set-keyboard", '\0', 0, G_OPTION_ARG_STRING, &opt_set_keyboard,
 | 
				
			||||||
     N_("Upload keyboard description 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,
 | 
				
			||||||
@ -66,6 +77,7 @@ main (int argc, char **argv)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    EekboardEekboard *eekboard = NULL;
 | 
					    EekboardEekboard *eekboard = NULL;
 | 
				
			||||||
    EekboardContext *context = NULL;
 | 
					    EekboardContext *context = NULL;
 | 
				
			||||||
 | 
					    GBusType bus_type;
 | 
				
			||||||
    GDBusConnection *connection = NULL;
 | 
					    GDBusConnection *connection = NULL;
 | 
				
			||||||
    GError *error;
 | 
					    GError *error;
 | 
				
			||||||
    GOptionContext *option_context;
 | 
					    GOptionContext *option_context;
 | 
				
			||||||
@ -80,17 +92,45 @@ main (int argc, char **argv)
 | 
				
			|||||||
    g_option_context_parse (option_context, &argc, &argv, NULL);
 | 
					    g_option_context_parse (option_context, &argc, &argv, NULL);
 | 
				
			||||||
    g_option_context_free (option_context);
 | 
					    g_option_context_free (option_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (opt_system)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SYSTEM;
 | 
				
			||||||
 | 
					    else if (opt_address)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_NONE;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SESSION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (bus_type) {
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SYSTEM:
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SESSION:
 | 
				
			||||||
        error = NULL;
 | 
					        error = NULL;
 | 
				
			||||||
        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
					        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
				
			||||||
    if (error) {
 | 
					        if (connection == NULL) {
 | 
				
			||||||
        g_printerr ("%s\n", error->message);
 | 
					            g_printerr ("Can't connect to the bus: %s\n", error->message);
 | 
				
			||||||
        retval = 1;
 | 
					            exit (1);
 | 
				
			||||||
        goto out;
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_NONE:
 | 
				
			||||||
 | 
					        error = NULL;
 | 
				
			||||||
 | 
					        connection = g_dbus_connection_new_for_address_sync (opt_address,
 | 
				
			||||||
 | 
					                                                             0,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             &error);
 | 
				
			||||||
 | 
					        if (connection == NULL) {
 | 
				
			||||||
 | 
					            g_printerr ("Can't connect to the bus at %s: %s\n",
 | 
				
			||||||
 | 
					                        opt_address,
 | 
				
			||||||
 | 
					                        error->message);
 | 
				
			||||||
 | 
					            exit (1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        g_assert_not_reached ();
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    eekboard = eekboard_eekboard_new (connection, NULL);
 | 
					    eekboard = eekboard_eekboard_new (connection, NULL);
 | 
				
			||||||
    if (!eekboard) {
 | 
					    if (eekboard == NULL) {
 | 
				
			||||||
        g_printerr ("Can't create eekboard\n");
 | 
					        g_printerr ("Can't create eekboard proxy\n");
 | 
				
			||||||
        retval = 1;
 | 
					        retval = 1;
 | 
				
			||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -98,7 +138,7 @@ main (int argc, char **argv)
 | 
				
			|||||||
    context = eekboard_eekboard_create_context (eekboard,
 | 
					    context = eekboard_eekboard_create_context (eekboard,
 | 
				
			||||||
                                                "eekboard-client",
 | 
					                                                "eekboard-client",
 | 
				
			||||||
                                                NULL);
 | 
					                                                NULL);
 | 
				
			||||||
    if (!context) {
 | 
					    if (context == NULL) {
 | 
				
			||||||
        g_printerr ("Can't create context\n");
 | 
					        g_printerr ("Can't create context\n");
 | 
				
			||||||
        retval = 1;
 | 
					        retval = 1;
 | 
				
			||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
@ -111,6 +151,7 @@ main (int argc, char **argv)
 | 
				
			|||||||
        GFileInputStream *input;
 | 
					        GFileInputStream *input;
 | 
				
			||||||
        EekLayout *layout;
 | 
					        EekLayout *layout;
 | 
				
			||||||
        EekKeyboard *keyboard;
 | 
					        EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					        guint keyboard_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        file = g_file_new_for_path (opt_set_keyboard);
 | 
					        file = g_file_new_for_path (opt_set_keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -128,8 +169,10 @@ main (int argc, char **argv)
 | 
				
			|||||||
        keyboard = eek_keyboard_new (layout, 640, 480);
 | 
					        keyboard = eek_keyboard_new (layout, 640, 480);
 | 
				
			||||||
        g_object_unref (layout);
 | 
					        g_object_unref (layout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        eekboard_context_set_keyboard (context, keyboard, NULL);
 | 
					        keyboard_id = eekboard_context_add_keyboard (context, keyboard, NULL);
 | 
				
			||||||
        g_object_unref (keyboard);
 | 
					        g_object_unref (keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        eekboard_context_set_keyboard (context, keyboard_id, NULL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (opt_set_group >= 0) {
 | 
					    if (opt_set_group >= 0) {
 | 
				
			||||||
 | 
				
			|||||||
@ -27,18 +27,38 @@
 | 
				
			|||||||
#include "eekboard/eekboard.h"
 | 
					#include "eekboard/eekboard.h"
 | 
				
			||||||
#include "desktop-client.h"
 | 
					#include "desktop-client.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static gboolean opt_system = FALSE;
 | 
				
			||||||
 | 
					static gboolean opt_session = FALSE;
 | 
				
			||||||
 | 
					static gchar *opt_address = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_CSPI
 | 
					#ifdef HAVE_CSPI
 | 
				
			||||||
gboolean opt_focus = FALSE;
 | 
					static gboolean opt_focus = FALSE;
 | 
				
			||||||
gboolean opt_keystroke = FALSE;
 | 
					static gboolean opt_keystroke = FALSE;
 | 
				
			||||||
#endif  /* HAVE_CSPI */
 | 
					#endif  /* HAVE_CSPI */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static gchar *opt_model = NULL;
 | 
				
			||||||
 | 
					static gchar *opt_layouts = NULL;
 | 
				
			||||||
 | 
					static gchar *opt_options = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const GOptionEntry options[] = {
 | 
					static const GOptionEntry options[] = {
 | 
				
			||||||
 | 
					    {"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
 | 
				
			||||||
 | 
					     N_("Connect to the system bus")},
 | 
				
			||||||
 | 
					    {"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
 | 
				
			||||||
 | 
					     N_("Connect to the session bus")},
 | 
				
			||||||
 | 
					    {"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
 | 
				
			||||||
 | 
					     N_("Connect to the given D-Bus address")},
 | 
				
			||||||
#ifdef HAVE_CSPI
 | 
					#ifdef HAVE_CSPI
 | 
				
			||||||
    {"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
 | 
					    {"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
 | 
				
			||||||
     N_("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,
 | 
				
			||||||
     N_("Listen keystroke events with AT-SPI")},
 | 
					     N_("Listen keystroke events with AT-SPI")},
 | 
				
			||||||
#endif  /* HAVE_CSPI */
 | 
					#endif  /* HAVE_CSPI */
 | 
				
			||||||
 | 
					    {"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
 | 
				
			||||||
 | 
					     N_("Specify model")},
 | 
				
			||||||
 | 
					    {"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
 | 
				
			||||||
 | 
					     N_("Specify layouts")},
 | 
				
			||||||
 | 
					    {"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
 | 
				
			||||||
 | 
					     N_("Specify options")},
 | 
				
			||||||
    {NULL}
 | 
					    {NULL}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -62,6 +82,7 @@ main (int argc, char **argv)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    EekboardDesktopClient *client;
 | 
					    EekboardDesktopClient *client;
 | 
				
			||||||
    EekboardContext *context;
 | 
					    EekboardContext *context;
 | 
				
			||||||
 | 
					    GBusType bus_type;
 | 
				
			||||||
    GDBusConnection *connection;
 | 
					    GDBusConnection *connection;
 | 
				
			||||||
    GError *error;
 | 
					    GError *error;
 | 
				
			||||||
    GConfClient *gconfc;
 | 
					    GConfClient *gconfc;
 | 
				
			||||||
@ -78,12 +99,42 @@ main (int argc, char **argv)
 | 
				
			|||||||
    g_option_context_parse (option_context, &argc, &argv, NULL);
 | 
					    g_option_context_parse (option_context, &argc, &argv, NULL);
 | 
				
			||||||
    g_option_context_free (option_context);
 | 
					    g_option_context_free (option_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (opt_system)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SYSTEM;
 | 
				
			||||||
 | 
					    else if (opt_address)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_NONE;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SESSION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (bus_type) {
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SYSTEM:
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SESSION:
 | 
				
			||||||
        error = NULL;
 | 
					        error = NULL;
 | 
				
			||||||
        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
					        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
				
			||||||
    if (error) {
 | 
					        if (connection == NULL) {
 | 
				
			||||||
        g_printerr ("%s\n", error->message);
 | 
					            g_printerr ("Can't connect to the bus: %s\n", error->message);
 | 
				
			||||||
            exit (1);
 | 
					            exit (1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_NONE:
 | 
				
			||||||
 | 
					        error = NULL;
 | 
				
			||||||
 | 
					        connection = g_dbus_connection_new_for_address_sync (opt_address,
 | 
				
			||||||
 | 
					                                                             0,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             &error);
 | 
				
			||||||
 | 
					        if (connection == NULL) {
 | 
				
			||||||
 | 
					            g_printerr ("Can't connect to the bus at %s: %s\n",
 | 
				
			||||||
 | 
					                        opt_address,
 | 
				
			||||||
 | 
					                        error->message);
 | 
				
			||||||
 | 
					            exit (1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        g_assert_not_reached ();
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client = eekboard_desktop_client_new (connection);
 | 
					    client = eekboard_desktop_client_new (connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gconfc = gconf_client_get_default ();
 | 
					    gconfc = gconf_client_get_default ();
 | 
				
			||||||
@ -114,13 +165,21 @@ main (int argc, char **argv)
 | 
				
			|||||||
                exit (1);
 | 
					                exit (1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            g_printerr ("Desktop accessibility support is disabled");
 | 
					            g_printerr ("Desktop accessibility support is disabled\n");
 | 
				
			||||||
            exit (1);
 | 
					            exit (1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif  /* HAVE_CSPI */
 | 
					#endif  /* HAVE_CSPI */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!eekboard_desktop_client_enable_xkl (client)) {
 | 
					    if (opt_model || opt_layouts || opt_options) {
 | 
				
			||||||
 | 
					        if (!eekboard_desktop_client_set_xkl_config (client,
 | 
				
			||||||
 | 
					                                                     opt_model,
 | 
				
			||||||
 | 
					                                                     opt_layouts,
 | 
				
			||||||
 | 
					                                                     opt_options)) {
 | 
				
			||||||
 | 
					            g_printerr ("Can't set xklavier config\n");
 | 
				
			||||||
 | 
					            exit (1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else if (!eekboard_desktop_client_enable_xkl (client)) {
 | 
				
			||||||
        g_printerr ("Can't register xklavier event listeners\n");
 | 
					        g_printerr ("Can't register xklavier event listeners\n");
 | 
				
			||||||
        exit (1);
 | 
					        exit (1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,7 @@
 | 
				
			|||||||
#include "eek/eek-xkl.h"
 | 
					#include "eek/eek-xkl.h"
 | 
				
			||||||
#include "eekboard/eekboard.h"
 | 
					#include "eekboard/eekboard.h"
 | 
				
			||||||
#include "desktop-client.h"
 | 
					#include "desktop-client.h"
 | 
				
			||||||
 | 
					#include "xklutil.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CSW 640
 | 
					#define CSW 640
 | 
				
			||||||
#define CSH 480
 | 
					#define CSH 480
 | 
				
			||||||
@ -103,8 +104,11 @@ static SPIBoolean      keystroke_listener_cb
 | 
				
			|||||||
                                         (const AccessibleKeystroke *stroke,
 | 
					                                         (const AccessibleKeystroke *stroke,
 | 
				
			||||||
                                          void                      *user_data);
 | 
					                                          void                      *user_data);
 | 
				
			||||||
#endif  /* HAVE_CSPI */
 | 
					#endif  /* HAVE_CSPI */
 | 
				
			||||||
static void            set_keyboard      (EekboardDesktopClient      *client,
 | 
					static gboolean        set_keyboard      (EekboardDesktopClient     *client,
 | 
				
			||||||
                                          gboolean                   show);
 | 
					                                          gboolean                   show,
 | 
				
			||||||
 | 
					                                          const gchar               *model,
 | 
				
			||||||
 | 
					                                          const gchar               *layouts,
 | 
				
			||||||
 | 
					                                          const gchar               *options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
eekboard_desktop_client_set_property (GObject      *object,
 | 
					eekboard_desktop_client_set_property (GObject      *object,
 | 
				
			||||||
@ -258,6 +262,27 @@ eekboard_desktop_client_init (EekboardDesktopClient *client)
 | 
				
			|||||||
#endif  /* HAVE_FAKEKEY */
 | 
					#endif  /* HAVE_FAKEKEY */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gboolean
 | 
				
			||||||
 | 
					eekboard_desktop_client_set_xkl_config (EekboardDesktopClient *client,
 | 
				
			||||||
 | 
					                                        const gchar *model,
 | 
				
			||||||
 | 
					                                        const gchar *layouts,
 | 
				
			||||||
 | 
					                                        const gchar *options)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#ifdef HAVE_CSPI
 | 
				
			||||||
 | 
					    return set_keyboard (client,
 | 
				
			||||||
 | 
					                         client->focus_listener ? FALSE : TRUE,
 | 
				
			||||||
 | 
					                         model,
 | 
				
			||||||
 | 
					                         layouts,
 | 
				
			||||||
 | 
					                         options);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    return set_keyboard (client,
 | 
				
			||||||
 | 
					                         TRUE,
 | 
				
			||||||
 | 
					                         model,
 | 
				
			||||||
 | 
					                         layouts,
 | 
				
			||||||
 | 
					                         options);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gboolean
 | 
					gboolean
 | 
				
			||||||
eekboard_desktop_client_enable_xkl (EekboardDesktopClient *client)
 | 
					eekboard_desktop_client_enable_xkl (EekboardDesktopClient *client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -295,12 +320,11 @@ eekboard_desktop_client_enable_xkl (EekboardDesktopClient *client)
 | 
				
			|||||||
    xkl_engine_start_listen (client->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
 | 
					    xkl_engine_start_listen (client->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_CSPI
 | 
					#ifdef HAVE_CSPI
 | 
				
			||||||
    set_keyboard (client, client->focus_listener ? FALSE : TRUE);
 | 
					    return set_keyboard (client, client->focus_listener ? FALSE : TRUE,
 | 
				
			||||||
 | 
					                         NULL, NULL, NULL);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    set_keyboard (client, TRUE);
 | 
					    return set_keyboard (client, TRUE, NULL, NULL, NULL);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@ -458,8 +482,10 @@ on_xkl_config_changed (XklEngine *xklengine,
 | 
				
			|||||||
                       gpointer   user_data)
 | 
					                       gpointer   user_data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekboardDesktopClient *client = user_data;
 | 
					    EekboardDesktopClient *client = user_data;
 | 
				
			||||||
 | 
					    gboolean retval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set_keyboard (client, FALSE);
 | 
					    retval = set_keyboard (client, FALSE, NULL, NULL, NULL);
 | 
				
			||||||
 | 
					    g_return_if_fail (retval);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_FAKEKEY
 | 
					#ifdef HAVE_FAKEKEY
 | 
				
			||||||
    if (client->fakekey)
 | 
					    if (client->fakekey)
 | 
				
			||||||
@ -467,17 +493,61 @@ on_xkl_config_changed (XklEngine *xklengine,
 | 
				
			|||||||
#endif  /* HAVE_FAKEKEY */
 | 
					#endif  /* HAVE_FAKEKEY */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static gboolean
 | 
				
			||||||
set_keyboard (EekboardDesktopClient *client,
 | 
					set_keyboard (EekboardDesktopClient *client,
 | 
				
			||||||
              gboolean              show)
 | 
					              gboolean               show,
 | 
				
			||||||
 | 
					              const gchar           *model,
 | 
				
			||||||
 | 
					              const gchar           *layouts,
 | 
				
			||||||
 | 
					              const gchar           *options)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekLayout *layout;
 | 
					    EekLayout *layout;
 | 
				
			||||||
    gchar *keyboard_name;
 | 
					    gchar *keyboard_name;
 | 
				
			||||||
    static gint keyboard_serial = 0;
 | 
					    static gint keyboard_serial = 0;
 | 
				
			||||||
 | 
					    guint keyboard_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (client->keyboard)
 | 
					    if (client->keyboard)
 | 
				
			||||||
        g_object_unref (client->keyboard);
 | 
					        g_object_unref (client->keyboard);
 | 
				
			||||||
    layout = eek_xkl_layout_new ();
 | 
					    layout = eek_xkl_layout_new ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (model) {
 | 
				
			||||||
 | 
					        if (!eek_xkl_layout_set_model (EEK_XKL_LAYOUT(layout), model)) {
 | 
				
			||||||
 | 
					            g_object_unref (layout);
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (layouts) {
 | 
				
			||||||
 | 
					        XklConfigRec *rec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        rec = eekboard_xkl_config_rec_new_from_string (layouts);
 | 
				
			||||||
 | 
					        if (!eek_xkl_layout_set_layouts (EEK_XKL_LAYOUT(layout),
 | 
				
			||||||
 | 
					                                         rec->layouts)) {
 | 
				
			||||||
 | 
					            g_object_unref (rec);
 | 
				
			||||||
 | 
					            g_object_unref (layout);
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!eek_xkl_layout_set_variants (EEK_XKL_LAYOUT(layout),
 | 
				
			||||||
 | 
					                                          rec->variants)) {
 | 
				
			||||||
 | 
					            g_object_unref (rec);
 | 
				
			||||||
 | 
					            g_object_unref (layout);
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }            
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_object_unref (rec);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (options) {
 | 
				
			||||||
 | 
					        gchar **_options;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        _options = g_strsplit (options, ",", -1);
 | 
				
			||||||
 | 
					        if (!eek_xkl_layout_set_options (EEK_XKL_LAYOUT(layout), _options)) {
 | 
				
			||||||
 | 
					            g_strfreev (_options);
 | 
				
			||||||
 | 
					            g_object_unref (layout);
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client->keyboard = eek_keyboard_new (layout, CSW, CSH);
 | 
					    client->keyboard = eek_keyboard_new (layout, CSW, CSH);
 | 
				
			||||||
    eek_keyboard_set_modifier_behavior (client->keyboard,
 | 
					    eek_keyboard_set_modifier_behavior (client->keyboard,
 | 
				
			||||||
                                        EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
					                                        EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
				
			||||||
@ -485,9 +555,14 @@ set_keyboard (EekboardDesktopClient *client,
 | 
				
			|||||||
    keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
 | 
					    keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
 | 
				
			||||||
    eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
 | 
					    eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    eekboard_context_set_keyboard (client->context, client->keyboard, NULL);
 | 
					    keyboard_id = eekboard_context_add_keyboard (client->context,
 | 
				
			||||||
 | 
					                                                 client->keyboard,
 | 
				
			||||||
 | 
					                                                 NULL);
 | 
				
			||||||
 | 
					    eekboard_context_set_keyboard (client->context, keyboard_id, NULL);
 | 
				
			||||||
    if (show)
 | 
					    if (show)
 | 
				
			||||||
        eekboard_context_show_keyboard (client->context, NULL);
 | 
					        eekboard_context_show_keyboard (client->context, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -500,7 +575,7 @@ on_xkl_state_changed (XklEngine           *xklengine,
 | 
				
			|||||||
    EekboardDesktopClient *client = user_data;
 | 
					    EekboardDesktopClient *client = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (type == GROUP_CHANGED && client->keyboard) {
 | 
					    if (type == GROUP_CHANGED && client->keyboard) {
 | 
				
			||||||
        gint group = eek_keyboard_get_group (client->keyboard);
 | 
					        gint group = eek_element_get_group (EEK_ELEMENT(client->keyboard));
 | 
				
			||||||
        if (group != value) {
 | 
					        if (group != value) {
 | 
				
			||||||
            eekboard_context_set_group (client->context, value, NULL);
 | 
					            eekboard_context_set_group (client->context, value, NULL);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -508,23 +583,6 @@ on_xkl_state_changed (XklEngine           *xklengine,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_FAKEKEY
 | 
					#ifdef HAVE_FAKEKEY
 | 
				
			||||||
G_INLINE_FUNC FakeKeyModifier
 | 
					 | 
				
			||||||
get_fakekey_modifiers (EekModifierType modifiers)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    FakeKeyModifier retval = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (modifiers & EEK_SHIFT_MASK)
 | 
					 | 
				
			||||||
        retval |= FAKEKEYMOD_SHIFT;
 | 
					 | 
				
			||||||
    if (modifiers & EEK_CONTROL_MASK)
 | 
					 | 
				
			||||||
        retval |= FAKEKEYMOD_CONTROL;
 | 
					 | 
				
			||||||
    if (modifiers & EEK_MOD1_MASK)
 | 
					 | 
				
			||||||
        retval |= FAKEKEYMOD_ALT;
 | 
					 | 
				
			||||||
    if (modifiers & EEK_META_MASK)
 | 
					 | 
				
			||||||
        retval |= FAKEKEYMOD_META;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return retval;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
on_key_pressed (EekKeyboard *keyboard,
 | 
					on_key_pressed (EekKeyboard *keyboard,
 | 
				
			||||||
                EekKey      *key,
 | 
					                EekKey      *key,
 | 
				
			||||||
@ -532,19 +590,15 @@ on_key_pressed (EekKeyboard *keyboard,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    EekboardDesktopClient *client = user_data;
 | 
					    EekboardDesktopClient *client = user_data;
 | 
				
			||||||
    EekSymbol *symbol;
 | 
					    EekSymbol *symbol;
 | 
				
			||||||
    EekModifierType modifiers;
 | 
					 | 
				
			||||||
    FakeKeyModifier fakekey_modifiers;
 | 
					 | 
				
			||||||
    guint keycode;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_assert (client->fakekey);
 | 
					    g_assert (client->fakekey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    modifiers = eek_keyboard_get_modifiers (client->keyboard);
 | 
					 | 
				
			||||||
    fakekey_modifiers = get_fakekey_modifiers (modifiers);
 | 
					 | 
				
			||||||
    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
					    symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
 | 
				
			||||||
    keycode = eek_key_get_keycode (key);
 | 
					 | 
				
			||||||
    if (EEK_IS_KEYSYM(symbol) && !eek_symbol_is_modifier (symbol)) {
 | 
					    if (EEK_IS_KEYSYM(symbol) && !eek_symbol_is_modifier (symbol)) {
 | 
				
			||||||
        fakekey_send_keyevent (client->fakekey, keycode, True, fakekey_modifiers);
 | 
					        fakekey_press_keysym (client->fakekey,
 | 
				
			||||||
        fakekey_send_keyevent (client->fakekey, keycode, False, fakekey_modifiers);
 | 
					                              eek_keysym_get_xkeysym (EEK_KEYSYM(symbol)),
 | 
				
			||||||
 | 
					                              0);
 | 
				
			||||||
 | 
					        fakekey_release (client->fakekey);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,12 @@ typedef struct _EekboardDesktopClient EekboardDesktopClient;
 | 
				
			|||||||
EekboardDesktopClient * eekboard_desktop_client_new
 | 
					EekboardDesktopClient * eekboard_desktop_client_new
 | 
				
			||||||
                        (GDBusConnection       *connection);
 | 
					                        (GDBusConnection       *connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gboolean                eekboard_desktop_client_set_xkl_config
 | 
				
			||||||
 | 
					                        (EekboardDesktopClient *client,
 | 
				
			||||||
 | 
					                         const gchar           *model,
 | 
				
			||||||
 | 
					                         const gchar           *layouts,
 | 
				
			||||||
 | 
					                         const gchar           *options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gboolean                eekboard_desktop_client_enable_xkl
 | 
					gboolean                eekboard_desktop_client_enable_xkl
 | 
				
			||||||
                        (EekboardDesktopClient *client);
 | 
					                        (EekboardDesktopClient *client);
 | 
				
			||||||
void                    eekboard_desktop_client_disable_xkl
 | 
					void                    eekboard_desktop_client_disable_xkl
 | 
				
			||||||
 | 
				
			|||||||
@ -15,12 +15,13 @@
 | 
				
			|||||||
 * You should have received a copy of the GNU General Public License
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef HAVE_CONFIG_H
 | 
					#ifdef HAVE_CONFIG_H
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#endif  /* HAVE_CONFIG_H */
 | 
					#endif  /* HAVE_CONFIG_H */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					#include <glib/gi18n.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "eek/eek.h"
 | 
					#include "eek/eek.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if HAVE_CLUTTER_GTK
 | 
					#if HAVE_CLUTTER_GTK
 | 
				
			||||||
@ -45,8 +46,15 @@ enum {
 | 
				
			|||||||
static const gchar introspection_xml[] =
 | 
					static const gchar introspection_xml[] =
 | 
				
			||||||
    "<node>"
 | 
					    "<node>"
 | 
				
			||||||
    "  <interface name='com.redhat.Eekboard.Context'>"
 | 
					    "  <interface name='com.redhat.Eekboard.Context'>"
 | 
				
			||||||
 | 
					    "    <method name='AddKeyboard'>"
 | 
				
			||||||
 | 
					    "      <arg direction='in' type='v' name='keyboard'/>"
 | 
				
			||||||
 | 
					    "      <arg direction='out' type='u' name='keyboard_id'/>"
 | 
				
			||||||
 | 
					    "    </method>"
 | 
				
			||||||
 | 
					    "    <method name='RemoveKeyboard'>"
 | 
				
			||||||
 | 
					    "      <arg direction='in' type='u' name='keyboard_id'/>"
 | 
				
			||||||
 | 
					    "    </method>"
 | 
				
			||||||
    "    <method name='SetKeyboard'>"
 | 
					    "    <method name='SetKeyboard'>"
 | 
				
			||||||
    "      <arg type='v' name='keyboard'/>"
 | 
					    "      <arg type='u' name='keyboard_id'/>"
 | 
				
			||||||
    "    </method>"
 | 
					    "    </method>"
 | 
				
			||||||
    "    <method name='ShowKeyboard'/>"
 | 
					    "    <method name='ShowKeyboard'/>"
 | 
				
			||||||
    "    <method name='HideKeyboard'/>"
 | 
					    "    <method name='HideKeyboard'/>"
 | 
				
			||||||
@ -89,7 +97,9 @@ struct _ServerContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    GtkWidget *window;
 | 
					    GtkWidget *window;
 | 
				
			||||||
    GtkWidget *widget;
 | 
					    GtkWidget *widget;
 | 
				
			||||||
 | 
					    guint keyboard_id;
 | 
				
			||||||
    EekKeyboard *keyboard;
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					    GHashTable *keyboard_hash;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gulong key_pressed_handler;
 | 
					    gulong key_pressed_handler;
 | 
				
			||||||
    gulong key_released_handler;
 | 
					    gulong key_released_handler;
 | 
				
			||||||
@ -165,6 +175,22 @@ on_notify_visible (GObject *object, GParamSpec *spec, gpointer user_data)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					on_realize (GtkWidget *widget,
 | 
				
			||||||
 | 
					            gpointer   user_data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ServerContext *context = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_assert (context && context->window == widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* make the window not maximizable */
 | 
				
			||||||
 | 
					    gdk_window_set_functions (gtk_widget_get_window (widget),
 | 
				
			||||||
 | 
					                              GDK_FUNC_RESIZE |
 | 
				
			||||||
 | 
					                              GDK_FUNC_MOVE |
 | 
				
			||||||
 | 
					                              GDK_FUNC_MINIMIZE |
 | 
				
			||||||
 | 
					                              GDK_FUNC_CLOSE);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
update_widget (ServerContext *context)
 | 
					update_widget (ServerContext *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -212,10 +238,13 @@ update_widget (ServerContext *context)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        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);
 | 
				
			||||||
        gtk_window_set_title (GTK_WINDOW(context->window), "Keyboard");
 | 
					        gtk_window_set_title (GTK_WINDOW(context->window), _("Keyboard"));
 | 
				
			||||||
        gtk_window_set_icon_name (GTK_WINDOW(context->window), "eekboard");
 | 
					        gtk_window_set_icon_name (GTK_WINDOW(context->window), "eekboard");
 | 
				
			||||||
        gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
 | 
					        gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_signal_connect (context->window, "realize",
 | 
				
			||||||
 | 
					                          G_CALLBACK(on_realize), context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        screen = gdk_screen_get_default ();
 | 
					        screen = gdk_screen_get_default ();
 | 
				
			||||||
        root = gtk_widget_get_root_window (context->window);
 | 
					        root = gtk_widget_get_root_window (context->window);
 | 
				
			||||||
        monitor = gdk_screen_get_monitor_at_window (screen, root);
 | 
					        monitor = gdk_screen_get_monitor_at_window (screen, root);
 | 
				
			||||||
@ -263,10 +292,14 @@ server_context_dispose (GObject *object)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (context->keyboard) {
 | 
					    if (context->keyboard) {
 | 
				
			||||||
        disconnect_keyboard_signals (context);
 | 
					        disconnect_keyboard_signals (context);
 | 
				
			||||||
        g_object_unref (context->keyboard);
 | 
					 | 
				
			||||||
        context->keyboard = NULL;
 | 
					        context->keyboard = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (context->keyboard_hash) {
 | 
				
			||||||
 | 
					        g_hash_table_destroy (context->keyboard_hash);
 | 
				
			||||||
 | 
					        context->keyboard_hash = NULL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (context->window) {
 | 
					    if (context->window) {
 | 
				
			||||||
        gtk_widget_destroy (context->window);
 | 
					        gtk_widget_destroy (context->window);
 | 
				
			||||||
        context->window = NULL;
 | 
					        context->window = NULL;
 | 
				
			||||||
@ -366,6 +399,12 @@ server_context_init (ServerContext *context)
 | 
				
			|||||||
    context->last_keyboard_visible = FALSE;
 | 
					    context->last_keyboard_visible = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context->keyboard = NULL;
 | 
					    context->keyboard = NULL;
 | 
				
			||||||
 | 
					    context->keyboard_hash =
 | 
				
			||||||
 | 
					        g_hash_table_new_full (g_direct_hash,
 | 
				
			||||||
 | 
					                               g_direct_equal,
 | 
				
			||||||
 | 
					                               NULL,
 | 
				
			||||||
 | 
					                               (GDestroyNotify)g_object_unref);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context->widget = NULL;
 | 
					    context->widget = NULL;
 | 
				
			||||||
    context->window = NULL;
 | 
					    context->window = NULL;
 | 
				
			||||||
    context->key_pressed_handler = 0;
 | 
					    context->key_pressed_handler = 0;
 | 
				
			||||||
@ -443,11 +482,13 @@ handle_method_call (GDBusConnection       *connection,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    ServerContext *context = user_data;
 | 
					    ServerContext *context = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (g_strcmp0 (method_name, "SetKeyboard") == 0) {
 | 
					    if (g_strcmp0 (method_name, "AddKeyboard") == 0) {
 | 
				
			||||||
        EekSerializable *serializable;
 | 
					 | 
				
			||||||
        GVariant *variant;
 | 
					        GVariant *variant;
 | 
				
			||||||
 | 
					        EekSerializable *serializable;
 | 
				
			||||||
 | 
					        static guint keyboard_id = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g_variant_get (parameters, "(v)", &variant);
 | 
					        g_variant_get (parameters, "(v)", &variant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        serializable = eek_serializable_deserialize (variant);
 | 
					        serializable = eek_serializable_deserialize (variant);
 | 
				
			||||||
        if (!EEK_IS_KEYBOARD(serializable)) {
 | 
					        if (!EEK_IS_KEYBOARD(serializable)) {
 | 
				
			||||||
            g_dbus_method_invocation_return_error (invocation,
 | 
					            g_dbus_method_invocation_return_error (invocation,
 | 
				
			||||||
@ -456,9 +497,65 @@ handle_method_call (GDBusConnection       *connection,
 | 
				
			|||||||
                                                   "not a keyboard");
 | 
					                                                   "not a keyboard");
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        eek_keyboard_set_modifier_behavior (EEK_KEYBOARD(serializable),
 | 
				
			||||||
 | 
					                                            EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        context->keyboard = EEK_KEYBOARD(serializable);
 | 
					        g_hash_table_insert (context->keyboard_hash,
 | 
				
			||||||
 | 
					                             GUINT_TO_POINTER(++keyboard_id),
 | 
				
			||||||
 | 
					                             g_object_ref (serializable));
 | 
				
			||||||
 | 
					        g_dbus_method_invocation_return_value (invocation,
 | 
				
			||||||
 | 
					                                               g_variant_new ("(u)",
 | 
				
			||||||
 | 
					                                                              keyboard_id));
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (g_strcmp0 (method_name, "RemoveKeyboard") == 0) {
 | 
				
			||||||
 | 
					        guint keyboard_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_variant_get (parameters, "(u)", &keyboard_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (keyboard_id == context->keyboard_id) {
 | 
				
			||||||
            disconnect_keyboard_signals (context);
 | 
					            disconnect_keyboard_signals (context);
 | 
				
			||||||
 | 
					            if (context->window) {
 | 
				
			||||||
 | 
					                gtk_widget_hide (context->window);
 | 
				
			||||||
 | 
					                gtk_widget_destroy (context->widget);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            context->keyboard = NULL;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_hash_table_remove (context->keyboard_hash,
 | 
				
			||||||
 | 
					                             GUINT_TO_POINTER(keyboard_id));
 | 
				
			||||||
 | 
					        g_dbus_method_invocation_return_value (invocation, NULL);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (g_strcmp0 (method_name, "SetKeyboard") == 0) {
 | 
				
			||||||
 | 
					        EekKeyboard *keyboard;
 | 
				
			||||||
 | 
					        guint keyboard_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        g_variant_get (parameters, "(u)", &keyboard_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        keyboard = g_hash_table_lookup (context->keyboard_hash,
 | 
				
			||||||
 | 
					                                        GUINT_TO_POINTER(keyboard_id));
 | 
				
			||||||
 | 
					        if (!keyboard) {
 | 
				
			||||||
 | 
					            g_dbus_method_invocation_return_error (invocation,
 | 
				
			||||||
 | 
					                                                   G_IO_ERROR,
 | 
				
			||||||
 | 
					                                                   G_IO_ERROR_FAILED_HANDLED,
 | 
				
			||||||
 | 
					                                                   "no such keyboard");
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (keyboard == context->keyboard) {
 | 
				
			||||||
 | 
					            g_dbus_method_invocation_return_value (invocation, NULL);
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (context->keyboard)
 | 
				
			||||||
 | 
					            disconnect_keyboard_signals (context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        context->keyboard = keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        context->key_pressed_handler =
 | 
					        context->key_pressed_handler =
 | 
				
			||||||
            g_signal_connect (context->keyboard, "key-pressed",
 | 
					            g_signal_connect (context->keyboard, "key-pressed",
 | 
				
			||||||
                              G_CALLBACK(on_key_pressed),
 | 
					                              G_CALLBACK(on_key_pressed),
 | 
				
			||||||
@ -467,8 +564,6 @@ handle_method_call (GDBusConnection       *connection,
 | 
				
			|||||||
            g_signal_connect (context->keyboard, "key-released",
 | 
					            g_signal_connect (context->keyboard, "key-released",
 | 
				
			||||||
                              G_CALLBACK(on_key_released),
 | 
					                              G_CALLBACK(on_key_released),
 | 
				
			||||||
                              context);
 | 
					                              context);
 | 
				
			||||||
        eek_keyboard_set_modifier_behavior (context->keyboard,
 | 
					 | 
				
			||||||
                                            EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (context->window) {
 | 
					        if (context->window) {
 | 
				
			||||||
            gboolean was_visible = gtk_widget_get_visible (context->window);
 | 
					            gboolean was_visible = gtk_widget_get_visible (context->window);
 | 
				
			||||||
@ -498,7 +593,7 @@ handle_method_call (GDBusConnection       *connection,
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g_variant_get (parameters, "(i)", &group);
 | 
					        g_variant_get (parameters, "(i)", &group);
 | 
				
			||||||
        eek_keyboard_set_group (context->keyboard, group);
 | 
					        eek_element_set_group (EEK_ELEMENT(context->keyboard), group);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (context->window) {
 | 
					        if (context->window) {
 | 
				
			||||||
            gboolean was_visible = gtk_widget_get_visible (context->window);
 | 
					            gboolean was_visible = gtk_widget_get_visible (context->window);
 | 
				
			||||||
 | 
				
			|||||||
@ -31,6 +31,20 @@
 | 
				
			|||||||
#include "server-server.h"
 | 
					#include "server-server.h"
 | 
				
			||||||
#include "eek/eek.h"
 | 
					#include "eek/eek.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static gboolean opt_system = FALSE;
 | 
				
			||||||
 | 
					static gboolean opt_session = FALSE;
 | 
				
			||||||
 | 
					static gchar *opt_address = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const GOptionEntry options[] = {
 | 
				
			||||||
 | 
					    {"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
 | 
				
			||||||
 | 
					     N_("Connect to the system bus")},
 | 
				
			||||||
 | 
					    {"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
 | 
				
			||||||
 | 
					     N_("Connect to the session bus")},
 | 
				
			||||||
 | 
					    {"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
 | 
				
			||||||
 | 
					     N_("Connect to the given D-Bus address")},
 | 
				
			||||||
 | 
					    {NULL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
on_name_acquired (GDBusConnection *connection,
 | 
					on_name_acquired (GDBusConnection *connection,
 | 
				
			||||||
                  const gchar     *name,
 | 
					                  const gchar     *name,
 | 
				
			||||||
@ -50,6 +64,7 @@ int
 | 
				
			|||||||
main (int argc, char **argv)
 | 
					main (int argc, char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ServerServer *server;
 | 
					    ServerServer *server;
 | 
				
			||||||
 | 
					    GBusType bus_type;
 | 
				
			||||||
    GDBusConnection *connection;
 | 
					    GDBusConnection *connection;
 | 
				
			||||||
    GError *error;
 | 
					    GError *error;
 | 
				
			||||||
    GMainLoop *loop;
 | 
					    GMainLoop *loop;
 | 
				
			||||||
@ -75,17 +90,46 @@ main (int argc, char **argv)
 | 
				
			|||||||
    g_type_class_ref (EEK_TYPE_SYMBOL);
 | 
					    g_type_class_ref (EEK_TYPE_SYMBOL);
 | 
				
			||||||
    g_type_class_ref (EEK_TYPE_KEYSYM);
 | 
					    g_type_class_ref (EEK_TYPE_KEYSYM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (opt_system)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SYSTEM;
 | 
				
			||||||
 | 
					    else if (opt_address)
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_NONE;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        bus_type = G_BUS_TYPE_SESSION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (bus_type) {
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SYSTEM:
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_SESSION:
 | 
				
			||||||
        error = NULL;
 | 
					        error = NULL;
 | 
				
			||||||
        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
					        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 | 
				
			||||||
    if (error) {
 | 
					        if (connection == NULL) {
 | 
				
			||||||
        g_printerr ("%s\n", error->message);
 | 
					            g_printerr ("Can't connect to the bus: %s\n", error->message);
 | 
				
			||||||
            exit (1);
 | 
					            exit (1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case G_BUS_TYPE_NONE:
 | 
				
			||||||
 | 
					        error = NULL;
 | 
				
			||||||
 | 
					        connection = g_dbus_connection_new_for_address_sync (opt_address,
 | 
				
			||||||
 | 
					                                                             0,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             NULL,
 | 
				
			||||||
 | 
					                                                             &error);
 | 
				
			||||||
 | 
					        if (connection == NULL) {
 | 
				
			||||||
 | 
					            g_printerr ("Can't connect to the bus at %s: %s\n",
 | 
				
			||||||
 | 
					                        opt_address,
 | 
				
			||||||
 | 
					                        error->message);
 | 
				
			||||||
 | 
					            exit (1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        g_assert_not_reached ();
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    server = server_server_new (SERVER_SERVER_PATH, connection);
 | 
					    server = server_server_new (SERVER_SERVER_PATH, connection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (server == NULL) {
 | 
					    if (server == NULL) {
 | 
				
			||||||
        g_printerr ("Can't create server server\n");
 | 
					        g_printerr ("Can't create server\n");
 | 
				
			||||||
        exit (1);
 | 
					        exit (1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -40,6 +40,7 @@ static gchar *opt_model = NULL;
 | 
				
			|||||||
static gchar *opt_layouts = NULL;
 | 
					static gchar *opt_layouts = NULL;
 | 
				
			||||||
static gchar *opt_options = NULL;
 | 
					static gchar *opt_options = NULL;
 | 
				
			||||||
static gchar *opt_list = NULL;
 | 
					static gchar *opt_list = NULL;
 | 
				
			||||||
 | 
					static guint opt_group = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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,
 | 
				
			||||||
@ -54,6 +55,8 @@ static const GOptionEntry options[] = {
 | 
				
			|||||||
     N_("Specify layouts")},
 | 
					     N_("Specify layouts")},
 | 
				
			||||||
    {"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
 | 
					    {"options", '\0', 0, G_OPTION_ARG_STRING, &opt_options,
 | 
				
			||||||
     N_("Specify options")},
 | 
					     N_("Specify options")},
 | 
				
			||||||
 | 
					    {"group", 'g', 0, G_OPTION_ARG_INT, &opt_group,
 | 
				
			||||||
 | 
					     N_("Specify group")},
 | 
				
			||||||
    {NULL}
 | 
					    {NULL}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -110,6 +113,8 @@ main (int argc, char **argv)
 | 
				
			|||||||
        keyboard = eek_keyboard_new (layout, 640, 480);
 | 
					        keyboard = eek_keyboard_new (layout, 640, 480);
 | 
				
			||||||
        g_object_unref (layout);
 | 
					        g_object_unref (layout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        eek_element_set_group (EEK_ELEMENT(keyboard), opt_group);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        widget = eek_gtk_keyboard_new (keyboard);
 | 
					        widget = eek_gtk_keyboard_new (keyboard);
 | 
				
			||||||
        g_object_unref (keyboard);
 | 
					        g_object_unref (keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user