Factor out symbols from keyboard file.
This commit is contained in:
@ -94,8 +94,20 @@ libeek_la_SOURCES = \
|
||||
$(srcdir)/eek-enumtypes.c \
|
||||
$(srcdir)/eek-marshalers.c
|
||||
|
||||
libeek_la_CFLAGS = -DEEK_COMPILATION=1 $(GIO2_CFLAGS) $(PANGOCAIRO_CFLAGS) $(LIBCROCO_CFLAGS)
|
||||
libeek_la_LIBADD = $(GIO2_LIBS) $(PANGOCAIRO_LIBS) $(LIBCROCO_LIBS) -lm
|
||||
libeek_la_CFLAGS = \
|
||||
-DEEK_COMPILATION=1 \
|
||||
-DKEYBOARDSDIR=\"$(pkgdatadir)/keyboards\" \
|
||||
$(GIO2_CFLAGS) \
|
||||
$(PANGOCAIRO_CFLAGS) \
|
||||
$(LIBCROCO_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libeek_la_LIBADD = \
|
||||
$(GIO2_LIBS) \
|
||||
$(PANGOCAIRO_LIBS) \
|
||||
$(LIBCROCO_LIBS) \
|
||||
-lm \
|
||||
$(NULL)
|
||||
|
||||
libeek_gtk_public_headers = \
|
||||
$(srcdir)/eek-gtk-keyboard.h \
|
||||
|
||||
@ -629,7 +629,7 @@ eek_key_get_index (EekKey *key,
|
||||
*/
|
||||
void
|
||||
eek_key_set_oref (EekKey *key,
|
||||
gulong oref)
|
||||
guint oref)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
if (key->priv->oref != oref) {
|
||||
@ -643,9 +643,9 @@ eek_key_set_oref (EekKey *key,
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* Get the outline id of @key.
|
||||
* Returns: a non-zero unsigned integer on success, 0 if the id is not set
|
||||
* Returns: unsigned integer
|
||||
*/
|
||||
gulong
|
||||
guint
|
||||
eek_key_get_oref (EekKey *key)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_KEY (key), 0);
|
||||
|
||||
@ -105,8 +105,8 @@ void eek_key_get_index (EekKey *key,
|
||||
gint *row);
|
||||
|
||||
void eek_key_set_oref (EekKey *key,
|
||||
gulong oref);
|
||||
gulong eek_key_get_oref (EekKey *key);
|
||||
guint oref);
|
||||
guint eek_key_get_oref (EekKey *key);
|
||||
|
||||
gboolean eek_key_is_pressed (EekKey *key);
|
||||
gboolean eek_key_is_locked (EekKey *key);
|
||||
|
||||
@ -206,7 +206,7 @@ render_key_outline (EekRenderer *renderer,
|
||||
EekBounds bounds;
|
||||
gdouble scale;
|
||||
gint i;
|
||||
gulong oref;
|
||||
guint oref;
|
||||
EekThemeNode *theme_node;
|
||||
EekColor foreground, background, gradient_start, gradient_end, border_color;
|
||||
EekGradientType gradient_type;
|
||||
@ -214,9 +214,10 @@ render_key_outline (EekRenderer *renderer,
|
||||
gint border_radius;
|
||||
|
||||
oref = eek_key_get_oref (key);
|
||||
if (oref == 0)
|
||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||
if (outline == NULL)
|
||||
return;
|
||||
|
||||
|
||||
theme_node = g_object_get_data (G_OBJECT(key),
|
||||
active ?
|
||||
"theme-node-pressed" :
|
||||
@ -252,7 +253,6 @@ render_key_outline (EekRenderer *renderer,
|
||||
scale = MIN((bounds.width - border_width * 2) / bounds.width,
|
||||
(bounds.height - border_width * 2) / bounds.height);
|
||||
|
||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||
outline = eek_outline_copy (outline);
|
||||
for (i = 0; i < outline->num_points; i++) {
|
||||
outline->points[i].x *= priv->scale * scale;
|
||||
@ -437,28 +437,28 @@ render_key (EekRenderer *self,
|
||||
EekOutline *outline;
|
||||
cairo_surface_t *outline_surface;
|
||||
EekBounds bounds;
|
||||
gulong oref;
|
||||
guint oref;
|
||||
EekSymbol *symbol;
|
||||
GHashTable *outline_surface_cache;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle extents = { 0, };
|
||||
EekColor foreground;
|
||||
|
||||
oref = eek_key_get_oref (key);
|
||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||
if (outline == NULL)
|
||||
return;
|
||||
|
||||
/* render outline */
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
bounds.width *= priv->scale;
|
||||
bounds.height *= priv->scale;
|
||||
|
||||
oref = eek_key_get_oref (key);
|
||||
if (oref == 0)
|
||||
return;
|
||||
|
||||
if (active)
|
||||
outline_surface_cache = priv->active_outline_surface_cache;
|
||||
else
|
||||
outline_surface_cache = priv->outline_surface_cache;
|
||||
|
||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||
outline_surface = g_hash_table_lookup (outline_surface_cache, outline);
|
||||
if (!outline_surface) {
|
||||
cairo_t *cr;
|
||||
|
||||
@ -134,12 +134,15 @@ create_key (EekXkbLayout *layout,
|
||||
gchar name[XkbKeyNameLength + 1];
|
||||
KeyCode keycode;
|
||||
gint num_groups, num_levels;
|
||||
gulong oref;
|
||||
guint oref;
|
||||
gpointer v;
|
||||
|
||||
xkbgeometry = priv->xkb->geom;
|
||||
xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
|
||||
oref = (gulong)g_hash_table_lookup (priv->shape_oref_hash, xkbshape);
|
||||
if (oref == 0) {
|
||||
if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
|
||||
NULL, &v)) {
|
||||
oref = GPOINTER_TO_UINT(v);
|
||||
} else {
|
||||
EekOutline *outline;
|
||||
|
||||
xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
|
||||
@ -183,7 +186,8 @@ create_key (EekXkbLayout *layout,
|
||||
}
|
||||
oref = eek_keyboard_add_outline (keyboard, outline);
|
||||
eek_outline_free (outline);
|
||||
g_hash_table_insert (priv->shape_oref_hash, xkbshape, (gpointer)oref);
|
||||
g_hash_table_insert (priv->shape_oref_hash, xkbshape,
|
||||
GUINT_TO_POINTER(oref));
|
||||
}
|
||||
|
||||
memset (name, 0, sizeof name);
|
||||
|
||||
1717
eek/eek-xml-layout.c
1717
eek/eek-xml-layout.c
File diff suppressed because it is too large
Load Diff
@ -65,14 +65,21 @@ struct _EekXmlLayoutClass
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_xml_layout_get_type (void) G_GNUC_CONST;
|
||||
struct _EekXmlKeyboardDesc
|
||||
{
|
||||
gchar *id;
|
||||
gchar *name;
|
||||
gchar *geometry;
|
||||
gchar *symbols;
|
||||
gchar *language;
|
||||
gchar *longname;
|
||||
};
|
||||
typedef struct _EekXmlKeyboardDesc EekXmlKeyboardDesc;
|
||||
|
||||
EekLayout *eek_xml_layout_new (GInputStream *source);
|
||||
|
||||
void eek_xml_layout_set_source (EekXmlLayout *layout,
|
||||
GInputStream *source);
|
||||
|
||||
GInputStream * eek_xml_layout_get_source (EekXmlLayout *layout);
|
||||
GType eek_xml_layout_get_type (void) G_GNUC_CONST;
|
||||
EekLayout *eek_xml_layout_new (const gchar *id,
|
||||
GError **error);
|
||||
GSList *eek_xml_layout_list_keyboards (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_XML_LAYOUT_H */
|
||||
|
||||
Reference in New Issue
Block a user