diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/main.vala | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/main.vala b/lib/main.vala index 88b2e738..b49d9f3b 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -172,8 +172,10 @@ public class Indicator.Keyboard.Service : Object { [DBus (visible = false)] protected virtual Icon create_icon (string? text, uint subscript) { - const int W = 20; - const int H = 20; + const int W = 22; + const int H = 22; + const int w = 20; + const int h = 20; const double R = 2.0; const double TEXT_SIZE = 12.0; const double SUBSCRIPT_SIZE = 8.0; @@ -181,16 +183,19 @@ public class Indicator.Keyboard.Service : Object { Pango.FontDescription description; var style = get_style_context (); var colour = style.get_color (Gtk.StateFlags.NORMAL); + colour = { 0.5, 0.5, 0.5, 1.0 }; style.get (Gtk.StateFlags.NORMAL, Gtk.STYLE_PROPERTY_FONT, out description); var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, W, H); var context = new Cairo.Context (surface); + context.translate (0.5 * (W - w), 0.5 * (H - h)); + context.new_sub_path (); context.arc (R, R, R, Math.PI, -0.5 * Math.PI); - context.arc (W - R, R, R, -0.5 * Math.PI, 0); - context.arc (W - R, H - R, R, 0, 0.5 * Math.PI); - context.arc (R, H - R, R, 0.5 * Math.PI, Math.PI); + context.arc (w - R, R, R, -0.5 * Math.PI, 0); + context.arc (w - R, h - R, R, 0, 0.5 * Math.PI); + context.arc (R, h - R, R, 0.5 * Math.PI, Math.PI); context.close_path (); context.set_source_rgba (colour.red, colour.green, colour.blue, colour.alpha); @@ -219,20 +224,23 @@ public class Indicator.Keyboard.Service : Object { int subscript_height; subscript_layout.get_pixel_size (out subscript_width, out subscript_height); - context.identity_matrix (); - context.translate ((W - (text_width + subscript_width)) / 2, (H - text_height) / 2); + context.save (); + context.translate ((w - (text_width + subscript_width)) / 2, (h - text_height) / 2); Pango.cairo_layout_path (context, text_layout); context.fill (); + context.restore (); - context.identity_matrix (); - context.translate ((W + (text_width - subscript_width)) / 2, (H + text_height) / 2 - subscript_height); + context.save (); + context.translate ((w + (text_width - subscript_width)) / 2, (h + text_height) / 2 - subscript_height); Pango.cairo_layout_path (context, subscript_layout); context.fill (); + context.restore (); } else { - context.identity_matrix (); - context.translate ((W - text_width) / 2, (H - text_height) / 2); + context.save (); + context.translate ((w - text_width) / 2, (h - text_height) / 2); Pango.cairo_layout_path (context, text_layout); context.fill (); + context.restore (); } } |