eekboard: merge eekboard-gtk.c to eekboard.c
This commit is contained in:
@ -312,7 +312,6 @@ create_texture_for_key (EekKey *key)
|
||||
{
|
||||
ClutterActor *texture;
|
||||
cairo_t *cr;
|
||||
cairo_pattern_t *pat;
|
||||
EekOutline *outline;
|
||||
EekBounds bounds;
|
||||
|
||||
@ -321,29 +320,7 @@ create_texture_for_key (EekKey *key)
|
||||
|
||||
texture = clutter_cairo_texture_new (bounds.width, bounds.height);
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE(texture));
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 1, 0.5, 0.5, 0.5, 1);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
|
||||
|
||||
cairo_set_source (cr, pat);
|
||||
|
||||
eek_draw_rounded_polygon (cr,
|
||||
TRUE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
|
||||
cairo_pattern_destroy (pat);
|
||||
|
||||
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 0.5);
|
||||
eek_draw_rounded_polygon (cr,
|
||||
FALSE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
eek_draw_outline (cr, outline);
|
||||
cairo_destroy (cr);
|
||||
return texture;
|
||||
}
|
||||
|
||||
@ -177,6 +177,36 @@ eek_get_fonts (EekKeyboard *keyboard,
|
||||
fonts[EEK_KEYSYM_CATEGORY_KEYNAME] = font_desc;
|
||||
}
|
||||
|
||||
void
|
||||
eek_draw_outline (cairo_t *cr, EekOutline *outline)
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 1, 0.5, 0.5, 0.5, 1);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
|
||||
|
||||
cairo_set_source (cr, pat);
|
||||
|
||||
eek_draw_rounded_polygon (cr,
|
||||
TRUE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
|
||||
cairo_pattern_destroy (pat);
|
||||
|
||||
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 0.5);
|
||||
eek_draw_rounded_polygon (cr,
|
||||
FALSE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
}
|
||||
|
||||
/*
|
||||
* The functions below are borrowed from
|
||||
* libgnomekbd/gkbd-keyboard-drawing.c.
|
||||
|
||||
@ -16,6 +16,9 @@ void eek_get_fonts (EekKeyboard *keyboard,
|
||||
PangoLayout *layout,
|
||||
PangoFontDescription **fonts);
|
||||
|
||||
void eek_draw_outline (cairo_t *cr,
|
||||
EekOutline *outline);
|
||||
|
||||
void eek_draw_rounded_polygon (cairo_t *cr,
|
||||
gboolean filled,
|
||||
gdouble radius,
|
||||
|
||||
@ -117,21 +117,13 @@ draw_key (EekElement *element, gpointer user_data)
|
||||
EekBounds bounds;
|
||||
guint keysym;
|
||||
|
||||
gdk_cairo_set_source_color (priv->cr, priv->dark_color);
|
||||
cairo_set_line_width (priv->cr, 1);
|
||||
cairo_set_line_join (priv->cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
|
||||
cairo_save (priv->cr);
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
cairo_translate (priv->cr, bounds.x, bounds.y);
|
||||
outline = eek_key_get_outline (key);
|
||||
eek_draw_rounded_polygon (priv->cr,
|
||||
FALSE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
cairo_stroke (priv->cr);
|
||||
eek_draw_outline (priv->cr, outline);
|
||||
|
||||
gdk_cairo_set_source_color (priv->cr, priv->dark_color);
|
||||
|
||||
keysym = eek_key_get_keysym (key);
|
||||
if (keysym != EEK_INVALID_KEYSYM) {
|
||||
|
||||
@ -511,6 +511,37 @@ set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
|
||||
XkbComponentNamesRec names;
|
||||
gboolean success = FALSE;
|
||||
|
||||
#define DEBUG 1
|
||||
#if DEBUG
|
||||
if (config->layouts) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "layout = ");
|
||||
for (i = 0; config->layouts[i] != NULL; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->layouts[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "layouts = NULL\n");
|
||||
if (config->variants) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "variant = ");
|
||||
for (i = 0; config->variants[i]; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->variants[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "variants = NULL\n");
|
||||
if (config->options) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "option = ");
|
||||
for (i = 0; config->options[i]; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->options[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "options = NULL\n");
|
||||
#endif
|
||||
|
||||
/* Disabled since the current EekXklLayout implementation does not
|
||||
change the server setting. */
|
||||
#if 0
|
||||
|
||||
Reference in New Issue
Block a user