]> git.sur5r.net Git - i3/i3/blobdiff - libi3/font.c
Merge pull request #2004 from Airblader/bug-2003
[i3/i3] / libi3 / font.c
index e14bb08034bb6515f6da2ef0f345df59bec4ddea..c90f8be03be1b40f14ada4bf4d0c017e582607cd 100644 (file)
@@ -29,7 +29,6 @@ static xcb_visualtype_t *root_visual_type;
 static double pango_font_red;
 static double pango_font_green;
 static double pango_font_blue;
-static double pango_font_alpha;
 
 /* Necessary to track whether the dpi changes and trigger a LOG() message,
  * which is more easily visible to users. */
@@ -104,7 +103,7 @@ static bool load_pango_font(i3Font *font, const char *desc) {
  */
 static void draw_text_pango(const char *text, size_t text_len,
                             xcb_drawable_t drawable, xcb_visualtype_t *visual, int x, int y,
-                            int max_width, bool is_markup) {
+                            int max_width, bool pango_markup) {
     /* Create the Pango layout */
     /* root_visual_type is cached in load_pango_font */
     cairo_surface_t *surface = cairo_xcb_surface_create(conn, drawable,
@@ -118,14 +117,14 @@ static void draw_text_pango(const char *text, size_t text_len,
     pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);
     pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
 
-    if (is_markup)
+    if (pango_markup)
         pango_layout_set_markup(layout, text, text_len);
     else
         pango_layout_set_text(layout, text, text_len);
 
     /* Do the drawing */
-    cairo_set_source_rgba(cr, pango_font_red, pango_font_green, pango_font_blue, pango_font_alpha);
     cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+    cairo_set_source_rgb(cr, pango_font_red, pango_font_green, pango_font_blue);
     pango_cairo_update_layout(cr, layout);
     pango_layout_get_pixel_size(layout, NULL, &height);
     /* Center the piece of text vertically if its height is smaller than the
@@ -144,7 +143,7 @@ static void draw_text_pango(const char *text, size_t text_len,
  * Calculate the text width using Pango rendering.
  *
  */
-static int predict_text_width_pango(const char *text, size_t text_len, bool is_markup) {
+static int predict_text_width_pango(const char *text, size_t text_len, bool pango_markup) {
     /* Create a dummy Pango layout */
     /* root_visual_type is cached in load_pango_font */
     cairo_surface_t *surface = cairo_xcb_surface_create(conn, root_screen->root, root_visual_type, 1, 1);
@@ -155,7 +154,7 @@ static int predict_text_width_pango(const char *text, size_t text_len, bool is_m
     gint width;
     pango_layout_set_font_description(layout, savedFont->specific.pango_desc);
 
-    if (is_markup)
+    if (pango_markup)
         pango_layout_set_markup(layout, text, text_len);
     else
         pango_layout_set_text(layout, text, text_len);
@@ -334,7 +333,6 @@ void set_font_colors(xcb_gcontext_t gc, uint32_t foreground, uint32_t background
             pango_font_red = ((foreground >> 16) & 0xff) / 255.0;
             pango_font_green = ((foreground >> 8) & 0xff) / 255.0;
             pango_font_blue = (foreground & 0xff) / 255.0;
-            pango_font_alpha = ((foreground >> 24) & 0xff) / 255.0;
             break;
 #endif
         default: